52 lines
1.6 MiB
52 lines
1.6 MiB
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){var c;c=a("underscore"),b.exports=function(a){var b;return b=function(){function b(b,c,d){var e,f;this.engine=b,this.HB=c,this.execution_listener=d,f=function(a){return function(b){return a.send(b)}}(this),this.execution_listener.push(f),this.applied_operations=[],e=function(a){return function(b){return a.applied_operations.push(b)}}(this),this.execution_listener.push(e),0!==(null!=a?a.length:void 0)&&this.engine.applyOps(a[0].getHistoryBuffer()._encode()),this.unexecuted={}}return b.prototype.getOpsInExecutionOrder=function(){return this.applied_operations},b.prototype.getRootElement=function(){return a.length>0?a[0].getRootElement().getUid():void 0},b.prototype.send=function(b){var c,d,e,f;if(b.uid.creator===this.HB.getUserId()&&"string"!=typeof b.uid.op_number){for(f=[],d=0,e=a.length;e>d;d++)c=a[d],f.push(c.getUserId()!==this.HB.getUserId()?c.getConnector().receive(b):void 0);return f}},b.prototype.receive=function(a){var b,c;return null==(b=this.unexecuted)[c=a.creator]&&(b[c]=[]),this.unexecuted[a.creator].push(a)},b.prototype.flushOne=function(a){var b;return(null!=(b=this.unexecuted[a])?b.length:void 0)>0?this.engine.applyOp(this.unexecuted[a].shift()):void 0},b.prototype.flushOneRandom=function(){return this.flushOne(c.random(0,a.length-1))},b.prototype.flushAll=function(){var a,b,c;c=this.unexecuted;for(a in c)b=c[a],this.engine.applyOps(b);return this.unexecuted={}},b.prototype.sync=function(){throw new Error("Can't use this a.t.m.")},b}()}},{underscore:65}],2:[function(a,b){var c;c=function(){function a(a,b){this.HB=a,this.parser=b,this.unprocessed_ops=[]}return a.prototype.parseOperation=function(a){var b;if(b=this.parser[a.type],null!=b)return b(a);throw new Error("You forgot to specify a parser for type "+a.type+". The message is "+JSON.stringify(a)+".")},a.prototype.applyOps=function(a){var b,c,d,e,f,g,h,i;for(c=[],d=0,g=a.length;g>d;d++)b=a[d],c.push(this.parseOperation(b));for(e=0,h=c.length;h>e;e++)b=c[e],this.HB.addOperation(b);for(f=0,i=c.length;i>f;f++)b=c[f],b.execute()||this.unprocessed_ops.push(b);return this.tryUnprocessed()},a.prototype.applyOp=function(a){var b;return b=this.parseOperation(a),this.HB.addOperation(b),b.execute()||this.unprocessed_ops.push(b),this.tryUnprocessed()},a.prototype.tryUnprocessed=function(){var a,b,c,d,e,f,g;for(g=[];;){for(a=this.unprocessed_ops.length,c=[],f=this.unprocessed_ops,d=0,e=f.length;e>d;d++)b=f[d],b.execute()||c.push(b);if(this.unprocessed_ops=c,this.unprocessed_ops.length===a)break;g.push(void 0)}return g},a}(),b.exports=c},{}],3:[function(a,b){var c,d,e,f;f=a("../Types/JsonTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),g=f(this.HB),this.engine=new c(this.HB,g.parser),this.connector=new b(this.engine,this.HB,g.execution_listener,this),h=this.connector.getRootElement(),null==h?(e=new g.types.JsonType(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=e):this.root_element=this.HB.getOperation(h)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.setMutableDefault=function(a){return this.root_element.setMutableDefault(a)},a.prototype.getUserId=function(){return this.HB.getUserId()},a.prototype.val=function(a,b,c){return this.root_element.val(a,b,c)},Object.defineProperty(a.prototype,"value",{get:function(){return this.root_element.value},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),a}(),"undefined"!=typeof window&&null!==window&&(window.JsonYatta=e),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/JsonTypes.coffee":7}],4:[function(a,b){var c,d,e,f;f=a("../Types/TextTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),h=f(this.HB),this.engine=new c(this.HB,h.parser),this.connector=new b(this.engine,this.HB,h.execution_listener),g=this.connector.getRootElement(),null==g?(e=new h.types.Word(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=this.HB.addOperation(new h.types.ReplaceManager(e,this.HB.getNextOperationIdentifier())).execute()):this.root_element=this.HB.getOperation(g)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.getUserId=function(){return this.HB.getUserId()},a.prototype.val=function(){return this.root_element.val().val()},a.prototype.insertText=function(a,b){return this.root_element.val().insertText(a,b)},a.prototype.deleteText=function(a,b){return this.root_element.val().deleteText(a,b)},a.prototype.replaceText=function(a){return this.root_element.val().replaceText(a)},a}(),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/TextTypes.coffee":9}],5:[function(a,b){var c;c=function(){function a(a){this.user_id=a,this.operation_counter={},this.buffer={},this.change_listeners=[]}return a.prototype.getUserId=function(){return this.user_id},a.prototype.getOperationCounter=function(){var a,b,c,d;b={},d=this.operation_counter;for(c in d)a=d[c],b[c]=a;return b},a.prototype._encode=function(){var a,b,c,d,e,f;a=[],f=this.buffer;for(d in f){e=f[d];for(c in e)b=e[c],isNaN(parseInt(c))||a.push(b._encode())}return a},a.prototype.getNextOperationIdentifier=function(a){var b;return null==a&&(a=this.user_id),null==this.operation_counter[a]&&(this.operation_counter[a]=0),b={creator:a,op_number:this.operation_counter[a]},this.operation_counter[a]++,b},a.prototype.getOperation=function(a){var b;if(a instanceof Object)return null!=(b=this.buffer[a.creator])?b[a.op_number]:void 0;if(null!=a)throw new Error("This type of uid is not defined!")},a.prototype.addOperation=function(a){if(null==this.buffer[a.creator]&&(this.buffer[a.creator]={}),null==this.operation_counter[a.creator]&&(this.operation_counter[a.creator]=0),null!=this.buffer[a.creator][a.op_number])throw new Error("You must not overwrite operations!");return this.buffer[a.creator][a.op_number]=a,"number"==typeof a.op_number&&a.creator!==this.getUserId()&&this.operation_counter[a.creator]++,a},a}(),b.exports=c},{}],6:[function(a,b){var c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};b.exports=function(a){var b,c,e,f,g,h,i;return i={},h=[],g=function(){function b(b){null==b&&(b=a.getNextOperationIdentifier()),this.creator=b.creator,this.op_number=b.op_number}return b.prototype.getUid=function(){return{creator:this.creator,op_number:this.op_number}},b.prototype.execute=function(){var a,b,c;for(this.is_executed=!0,b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this},b.prototype.saveOperation=function(a,b){return null!=(null!=b?b.execute:void 0)?this[a]=b:null!=b?(null==this.unchecked&&(this.unchecked={}),this.unchecked[a]=b):void 0},b.prototype.validateSavedOperations=function(){var b,c,d,e,f,g;f={},e=this,g=this.unchecked;for(b in g)d=g[b],c=a.getOperation(d),c?this[b]=c:(f[b]=d,e=!1);return delete this.unchecked,e||(this.unchecked=f),e},b}(),b=function(a){function b(a,c){this.saveOperation("deletes",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype._encode=function(){return{type:"Delete",uid:this.getUid(),deletes:this.deletes.getUid()}},b.prototype.execute=function(){return this.validateSavedOperations()?(this.deletes.applyDelete(this),b.__super__.execute.apply(this,arguments),this):!1},b}(g),i.Delete=function(a){var c,d;return d=a.uid,c=a.deletes,new b(d,c)},f=function(a){function b(a,c,d,e){this.saveOperation("prev_cl",c),this.saveOperation("next_cl",d),null!=e?this.saveOperation("origin",e):this.saveOperation("origin",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype.applyDelete=function(a){return null==this.deleted_by&&(this.deleted_by=[]),this.deleted_by.push(a)},b.prototype.isDeleted=function(){var a;return(null!=(a=this.deleted_by)?a.length:void 0)>0},b.prototype.getDistanceToOrigin=function(){var a,b;for(a=0,b=this.prev_cl;;){if(this.origin===b)break;if(a++,this===this.prev_cl)throw new Error("this should not happen ;) ");b=b.prev_cl}return a},b.prototype.update_sl=function(){var a;return a=this.prev_cl,update("prev_cl","prev_sl"),update("next_cl","prev_sl")},b.prototype.execute=function(){var a,c,d,e,f;if(null!=this.is_executed)return this;if(this.validateSavedOperations()){if((null!=(e=this.prev_cl)?e.validateSavedOperations():void 0)&&(null!=(f=this.next_cl)?f.validateSavedOperations():void 0)&&this.prev_cl.next_cl!==this){for(a=0,d=this.prev_cl.next_cl,c=0;;){if(null==d&&(console.log(JSON.stringify(this.prev_cl.getUid())),console.log(JSON.stringify(this.next_cl.getUid()))),d===this.next_cl)break;if(d.getDistanceToOrigin()===c)d.creator<this.creator&&(this.prev_cl=d,a=c+1);else{if(!(d.getDistanceToOrigin()<c))break;c-a<=d.getDistanceToOrigin()&&(this.prev_cl=d,a=c+1)}c++,d=d.next_cl}this.next_cl=this.prev_cl.next_cl,this.prev_cl.next_cl=this,this.next_cl.prev_cl=this}return b.__super__.execute.apply(this,arguments),this}return!1},b}(g),e=function(a){function b(a,c,d,e,f){this.content=null!=c?c:"",b.__super__.constructor.call(this,a,d,e,f)}return d(b,a),b.prototype.val=function(){return this.content},b.prototype._encode=function(){var a;return a={type:"ImmutableObject",uid:this.getUid(),content:this.content},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(f),i.ImmutableObject=function(a){var b,c,d,f,g;return g=a.uid,b=a.content,f=a.prev,c=a.next,d=a.origin,new e(g,b,f,c,d)},c=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return d(b,a),b.prototype.execute=function(){var a,b,c;if(this.validateSavedOperations()){for(b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this}return!1},b.prototype._encode=function(){var a,b;return{type:"Delimiter",uid:this.getUid(),prev:null!=(a=this.prev_cl)?a.getUid():void 0,next:null!=(b=this.next_cl)?b.getUid():void 0}},b}(f),i.Delimiter=function(a){var b,d,e;return e=a.uid,d=a.prev,b=a.next,new c(e,d,b)},{types:{Delete:b,Insert:f,Delimiter:c,Operation:g,ImmutableObject:e},parser:i,execution_listener:h}}},{}],7:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./TextTypes.coffee"),b.exports=function(a){var b,d,f,g,h;return g=c(a),h=g.types,f=g.parser,d=function(a){var c;return new(c=function(){function a(c){var e,f,g,i;i=c.map,g=function(e,f){return Object.defineProperty(a.prototype,e,{get:function(){var a;return a=f.val(),a instanceof b?d(a):a instanceof h.ImmutableObject?a.val():a},set:function(a){var b,d,f,g;if(a.constructor==={}.constructor){f=c.val(e),g=[];for(b in a)d=a[b],g.push(f.val(b,d,"immutable"));return g}return c.val(e,a,"immutable")},enumerable:!0,configurable:!1})};for(e in i)f=i[e],g(e,f)}return a}())(a)},b=function(b){function c(a,b,d){var e,f;if(c.__super__.constructor.call(this,a),null!=b){if("object"!=typeof b)throw new Error("The initial value of JsonTypes must be of type Object! (current type: "+typeof b+")");for(e in b)f=b[e],this.val(e,f,d)}}return e(c,b),c.prototype.mutable_default=!0,c.prototype.setMutableDefault=function(a){if(a===!0||"mutable"===a)c.prototype.mutable_default=!0;else{if(a!==!1&&"immutable"!==a)throw new Error('Set mutable either "mutable" or "immutable"!');c.prototype.mutable_default=!1}return"OK"},c.prototype.val=function(b,d,e){var f,g,i,j,k;if("object"==typeof b){for(i in b)g=b[i],this.val(i,g,d);return this}if(null!=b&&null!=d){if(e=null!=e?e===!0||"mutable"===e?!0:!1:this.mutable_default,"function"==typeof d)return this;if(e&&"number"!=typeof d||d.constructor===Object){if("string"==typeof d)return k=a.addOperation(new h.Word(a.getNextOperationIdentifier(),d)).execute(),c.__super__.val.call(this,b,k);if(d.constructor===Object)return f=a.addOperation(new c(a.getNextOperationIdentifier(),d,e)).execute(),c.__super__.val.call(this,b,f);throw new Error("You must not set "+typeof d+"-types in collaborative Json-objects!")}return j=a.addOperation(new h.ImmutableObject(void 0,d)).execute(),c.__super__.val.call(this,b,j)}return c.__super__.val.call(this,b,d)},Object.defineProperty(c.prototype,"value",{get:function(){return d(this)},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),c.prototype._encode=function(){return{type:"JsonType",uid:this.getUid()}},c}(h.MapManager),f.JsonType=function(a){var c;return c=a.uid,new b(c)},h.JsonType=b,g}},{"./TextTypes.coffee":9}],8:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./BasicTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i,j,k;return i=c(a),k=i.types,j=i.parser,f=function(c){function d(a){this.map={},d.__super__.constructor.call(this,a)}return e(d,c),d.prototype.val=function(c,e){var f,g,h,i,j;if(null!=e)return null==this.map[c]&&a.addOperation(new b(a.getNextOperationIdentifier(),this,c)).execute(),this.map[c].replace(e),this;if(null!=c)return g=null!=(i=this.map[c])?i.val():void 0,g instanceof k.ImmutableObject?g.val():g;h={},j=this.map;for(c in j)f=j[c],g=f.val(),(g instanceof k.ImmutableObject||g instanceof d)&&(g=g.val()),h[c]=g;return h},d}(k.Operation),b=function(b){function c(a,b,d){this.name=d,this.saveOperation("map_manager",b),c.__super__.constructor.call(this,a)}return e(c,b),c.prototype.execute=function(){var b,d,e,f,h;return this.validateSavedOperations()?(h=this.map_manager.getUid(),h.op_number="_"+h.op_number+"_RM_"+this.name,null==a.getOperation(h)&&(e=this.map_manager.getUid(),e.op_number="_"+e.op_number+"_RM_"+this.name+"_beginning",f=this.map_manager.getUid(),f.op_number="_"+f.op_number+"_RM_"+this.name+"_end",b=a.addOperation(new k.Delimiter(e,void 0,f)),d=a.addOperation(new k.Delimiter(f,b,void 0)).execute(),b.execute(),this.map_manager.map[this.name]=a.addOperation(new g(void 0,h,b,d)).execute()),c.__super__.execute.apply(this,arguments)):!1},c.prototype._encode=function(){return{type:"AddName",uid:this.getUid(),map_manager:this.map_manager.getUid(),name:this.name}},c}(k.Operation),j.AddName=function(a){var c,d,e;return c=a.map_manager,e=a.uid,d=a.name,new b(e,c,d)},d=function(b){function c(b,d,e,f,g,h){null!=d&&null!=e?(this.saveOperation("beginning",d),this.saveOperation("end",e)):(this.beginning=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),void 0,void 0)),this.end=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),this.beginning,void 0)),this.beginning.next_cl=this.end,this.beginning.execute(),this.end.execute()),c.__super__.constructor.call(this,b,f,g,h)}return e(c,b),c.prototype.getLastOperation=function(){return this.end.prev_cl},c.prototype.getFirstOperation=function(){return this.beginning.next_cl},c.prototype.toArray=function(){var a,b;for(a=this.beginning.next_cl,b=[];a!==this.end;)b.push(a),a=a.next_cl;return b},c.prototype.getOperationByPosition=function(a){var b;if(b=this.beginning.next_cl,a>0)for(;;){if(b=b.next_cl,b.isDeleted()||(a-=1),0===a)break;if(b instanceof k.Delimiter)throw new Error("position parameter exceeded the length of the document!")}return b},c}(k.Insert),g=function(b){function c(a,b,d,e,f,g,h){c.__super__.constructor.call(this,b,d,e,f,g,h),null!=a&&this.replace(a)}return e(c,b),c.prototype.replace=function(b){var c,d;return c=this.getLastOperation(),d=new h(b,this,a.getNextOperationIdentifier(),c,c.next_cl),a.addOperation(d).execute()},c.prototype.val=function(){var a;if(a=this.getLastOperation(),a instanceof k.Delimiter)throw new Error("dtrn");return a.val()},c.prototype._encode=function(){var a;return a={type:"ReplaceManager",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&null!=this.next_cl&&(a.prev=this.prev_cl.getUid(),a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},c}(d),j.ReplaceManager=function(a){var b,c,d,e,f,h,i;return c=a.content,i=a.uid,h=a.prev,e=a.next,f=a.origin,b=a.beginning,d=a.end,new g(c,i,b,d,h,e,f)},h=function(a){function b(a,c,d,e,f,g){if(this.saveOperation("content",a),this.saveOperation("parent",c),null==e||null==f||null==a)throw new Error("You must define content, prev, and next for Replaceable-types!");b.__super__.constructor.call(this,d,e,f,g)}return e(b,a),b.prototype.val=function(){return this.content},b.prototype.replace=function(a){return this.parent.replace(a)},b.prototype.execute=function(){var a;return this.validateSavedOperations()?("function"==typeof(a=this.content).setReplaceManager&&a.setReplaceManager(this.parent),b.__super__.execute.apply(this,arguments),this):!1},b.prototype._encode=function(){var a;return a={type:"Replaceable",content:this.content.getUid(),ReplaceManager:this.parent.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid(),uid:this.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(k.Insert),j.Replaceable=function(a){var b,c,d,e,f,g;return b=a.content,e=a.ReplaceManager,g=a.uid,f=a.prev,c=a.next,d=a.origin,new h(b,e,g,f,c,d)},k.ListManager=d,k.MapManager=f,k.ReplaceManager=g,k.Replaceable=h,i}},{"./BasicTypes.coffee":6}],9:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./StructuredTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i;return h=c(a),i=h.types,g=h.parser,b=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return e(b,a),b}(i.Delete),g.TextDelete=g.Delete,d=function(a){function b(a,c,d,e,f){if(this.content=a,null==d||null==e)throw new Error("You must define prev, and next for TextInsert-types!");b.__super__.constructor.call(this,c,d,e,f)}return e(b,a),b.prototype.getLength=function(){return this.isDeleted()?0:this.content.length},b.prototype.val=function(){return this.isDeleted()?"":this.content},b.prototype._encode=function(){var a;return a={type:"TextInsert",content:this.content,uid:this.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(i.Insert),g.TextInsert=function(a){var b,c,e,f,g;return b=a.content,g=a.uid,f=a.prev,c=a.next,e=a.origin,new d(b,g,f,c,e)},f=function(c){function f(a,b,c,d,e,g,h){f.__super__.constructor.call(this,a,c,d,e,g,h),null!=b&&this.insertText(0,b)}return e(f,c),f.prototype.insertText=function(b,c){var e,f,g,h,i,j;for(f=this.getOperationByPosition(b),j=[],h=0,i=c.length;i>h;h++)e=c[h],g=new d(e,a.getNextOperationIdentifier(),f.prev_cl,f),j.push(a.addOperation(g).execute());return j},f.prototype.deleteText=function(c,d){var e,f,g,h,j;for(g=this.getOperationByPosition(c),j=[],f=h=0;d>=0?d>h:h>d;f=d>=0?++h:--h){for(e=a.addOperation(new b(a.getNextOperationIdentifier(),g)).execute(),g=g.next_cl;g.isDeleted();){if(g instanceof i.Delimiter)throw new Error("You can't delete more than there is..");g=g.next_cl}j.push(e._encode())}return j},f.prototype.replaceText=function(b){var c;if(null!=this.replace_manager)return c=a.addOperation(new f(a.getNextOperationIdentifier())).execute(),c.insertText(0,b),this.replace_manager.replace(c);throw new Error("This type is currently not maintained by a ReplaceManager!")},f.prototype.val=function(){var a,b;return a=function(){var a,c,d,e;for(d=this.toArray(),e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(null!=b.val?b.val():"");return e}.call(this),a.join("")},f.prototype.setReplaceManager=function(a){return this.saveOperation("replace_manager",a),this.validateSavedOperations},f.prototype._encode=function(){var a;return a={type:"Word",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},f}(i.ListManager),g.Word=function(a){var b,c,d,e,g,h;return h=a.uid,b=a.beginning,c=a.end,g=a.prev,d=a.next,e=a.origin,new f(h,void 0,b,c,g,d,e)},i.TextInsert=d,i.TextDelete=b,i.Word=f,h}},{"./StructuredTypes.coffee":8}],10:[function(a,b){b.exports=a("./lib/chai")},{"./lib/chai":11}],11:[function(a,b,c){var d=[],c=b.exports={};c.version="1.9.1",c.AssertionError=a("assertion-error");var e=a("./chai/utils");c.use=function(a){return~d.indexOf(a)||(a(this,e),d.push(a)),this};var f=a("./chai/config");c.config=f;var g=a("./chai/assertion");c.use(g);var h=a("./chai/core/assertions");c.use(h);var i=a("./chai/interface/expect");c.use(i);var j=a("./chai/interface/should");c.use(j);var k=a("./chai/interface/assert");c.use(k)},{"./chai/assertion":12,"./chai/config":13,"./chai/core/assertions":14,"./chai/interface/assert":15,"./chai/interface/expect":16,"./chai/interface/should":17,"./chai/utils":28,"assertion-error":37}],12:[function(a,b){var c=a("./config");b.exports=function(a,b){function d(a,b,c){f(this,"ssfi",c||arguments.callee),f(this,"object",a),f(this,"message",b)}var e=a.AssertionError,f=b.flag;a.Assertion=d,Object.defineProperty(d,"includeStack",{get:function(){return console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack},set:function(a){console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack=a}}),Object.defineProperty(d,"showDiff",{get:function(){return console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff},set:function(a){console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff=a}}),d.addProperty=function(a,c){b.addProperty(this.prototype,a,c)},d.addMethod=function(a,c){b.addMethod(this.prototype,a,c)},d.addChainableMethod=function(a,c,d){b.addChainableMethod(this.prototype,a,c,d)},d.overwriteProperty=function(a,c){b.overwriteProperty(this.prototype,a,c)},d.overwriteMethod=function(a,c){b.overwriteMethod(this.prototype,a,c)},d.overwriteChainableMethod=function(a,c,d){b.overwriteChainableMethod(this.prototype,a,c,d)},d.prototype.assert=function(a,d,g,h,i,j){var k=b.test(this,arguments);if(!0!==j&&(j=!1),!0!==c.showDiff&&(j=!1),!k){var d=b.getMessage(this,arguments),l=b.getActual(this,arguments);throw new e(d,{actual:l,expected:h,showDiff:j},c.includeStack?this.assert:f(this,"ssfi"))}},Object.defineProperty(d.prototype,"_obj",{get:function(){return f(this,"object")},set:function(a){f(this,"object",a)}})}},{"./config":13}],13:[function(a,b){b.exports={includeStack:!1,showDiff:!0,truncateThreshold:40}},{}],14:[function(a,b){b.exports=function(a,b){function c(a,c){c&&u(this,"message",c),a=a.toLowerCase();var d=u(this,"object"),e=~["a","e","i","o","u"].indexOf(a.charAt(0))?"an ":"a ";this.assert(a===b.type(d),"expected #{this} to be "+e+a,"expected #{this} not to be "+e+a)}function d(){u(this,"contains",!0)}function e(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=!1;if("array"===b.type(d)&&"object"===b.type(a)){for(var f in d)if(b.eql(d[f],a)){e=!0;break}}else if("object"===b.type(a)){if(!u(this,"negate")){for(var g in a)new t(d).property(g,a[g]);return}var h={};for(var g in a)h[g]=d[g];e=b.eql(h,a)}else e=d&&~d.indexOf(a);this.assert(e,"expected #{this} to include "+b.inspect(a),"expected #{this} to not include "+b.inspect(a))}function f(){var a=u(this,"object"),b=Object.prototype.toString.call(a);this.assert("[object Arguments]"===b,"expected #{this} to be arguments but got "+b,"expected #{this} to not be arguments")}function g(a,b){b&&u(this,"message",b);var c=u(this,"object");return u(this,"deep")?this.eql(a):void this.assert(a===c,"expected #{this} to equal #{exp}","expected #{this} to not equal #{exp}",a,this._obj,!0)}function h(a,c){c&&u(this,"message",c),this.assert(b.eql(a,u(this,"object")),"expected #{this} to deeply equal #{exp}","expected #{this} to not deeply equal #{exp}",a,this._obj,!0)}function i(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>a,"expected #{this} to have a length above #{exp} but got #{act}","expected #{this} to not have a length above #{exp}",a,d)}else this.assert(c>a,"expected #{this} to be above "+a,"expected #{this} to be at most "+a)}function j(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>=a,"expected #{this} to have a length at least #{exp} but got #{act}","expected #{this} to have a length below #{exp}",a,d)}else this.assert(c>=a,"expected #{this} to be at least "+a,"expected #{this} to be below "+a)}function k(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(a>d,"expected #{this} to have a length below #{exp} but got #{act}","expected #{this} to not have a length below #{exp}",a,d)}else this.assert(a>c,"expected #{this} to be below "+a,"expected #{this} to be at least "+a)}function l(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(a>=d,"expected #{this} to have a length at most #{exp} but got #{act}","expected #{this} to have a length above #{exp}",a,d)}else this.assert(a>=c,"expected #{this} to be at most "+a,"expected #{this} to be above "+a)}function m(a,c){c&&u(this,"message",c);var d=b.getName(a);this.assert(u(this,"object")instanceof a,"expected #{this} to be an instance of "+d,"expected #{this} to not be an instance of "+d)}function n(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(d.hasOwnProperty(a),"expected #{this} to have own property "+b.inspect(a),"expected #{this} to not have own property "+b.inspect(a))}function o(){u(this,"doLength",!0)}function p(a,b){b&&u(this,"message",b);var c=u(this,"object");new t(c,b).to.have.property("length");var d=c.length;this.assert(d==a,"expected #{this} to have a length of #{exp} but got #{act}","expected #{this} to not have a length of #{act}",a,d)}function q(a){var c,d=u(this,"object"),e=!0;if(a=a instanceof Array?a:Array.prototype.slice.call(arguments),!a.length)throw new Error("keys required");var f=Object.keys(d),g=a.length;if(e=a.every(function(a){return~f.indexOf(a)}),u(this,"negate")||u(this,"contains")||(e=e&&a.length==f.length),g>1){a=a.map(function(a){return b.inspect(a)});var h=a.pop();c=a.join(", ")+", and "+h}else c=b.inspect(a[0]);c=(g>1?"keys ":"key ")+c,c=(u(this,"contains")?"contain ":"have ")+c,this.assert(e,"expected #{this} to "+c,"expected #{this} to not "+c)}function r(a,c,d){d&&u(this,"message",d);var e=u(this,"object");new t(e,d).is.a("function");var f=!1,g=null,h=null,i=null;0===arguments.length?(c=null,a=null):a&&(a instanceof RegExp||"string"==typeof a)?(c=a,a=null):a&&a instanceof Error?(g=a,a=null,c=null):"function"==typeof a?(h=a.prototype.name||a.name,"Error"===h&&a!==Error&&(h=(new a).name)):a=null;try{e()}catch(j){if(g)return this.assert(j===g,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}",g instanceof Error?g.toString():g,j instanceof Error?j.toString():j),u(this,"object",j),this;if(a&&(this.assert(j instanceof a,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp} but #{act} was thrown",h,j instanceof Error?j.toString():j),!c))return u(this,"object",j),this;var k="object"===b.type(j)&&"message"in j?j.message:""+j;if(null!=k&&c&&c instanceof RegExp)return this.assert(c.exec(k),"expected #{this} to throw error matching #{exp} but got #{act}","expected #{this} to throw error not matching #{exp}",c,k),u(this,"object",j),this;if(null!=k&&c&&"string"==typeof c)return this.assert(~k.indexOf(c),"expected #{this} to throw error including #{exp} but got #{act}","expected #{this} to throw error not including #{act}",c,k),u(this,"object",j),this;f=!0,i=j}var l="",m=null!==h?h:g?"#{exp}":"an error";f&&(l=" but #{act} was thrown"),this.assert(f===!0,"expected #{this} to throw "+m+l,"expected #{this} to not throw "+m+l,g instanceof Error?g.toString():g,i instanceof Error?i.toString():i),u(this,"object",i)}function s(a,b,c){return a.every(function(a){return c?b.some(function(b){return c(a,b)}):-1!==b.indexOf(a)})}var t=a.Assertion,u=(Object.prototype.toString,b.flag);["to","be","been","is","and","has","have","with","that","at","of","same"].forEach(function(a){t.addProperty(a,function(){return this})}),t.addProperty("not",function(){u(this,"negate",!0)}),t.addProperty("deep",function(){u(this,"deep",!0)}),t.addChainableMethod("an",c),t.addChainableMethod("a",c),t.addChainableMethod("include",e,d),t.addChainableMethod("contain",e,d),t.addProperty("ok",function(){this.assert(u(this,"object"),"expected #{this} to be truthy","expected #{this} to be falsy")}),t.addProperty("true",function(){this.assert(!0===u(this,"object"),"expected #{this} to be true","expected #{this} to be false",this.negate?!1:!0)}),t.addProperty("false",function(){this.assert(!1===u(this,"object"),"expected #{this} to be false","expected #{this} to be true",this.negate?!0:!1)}),t.addProperty("null",function(){this.assert(null===u(this,"object"),"expected #{this} to be null","expected #{this} not to be null")}),t.addProperty("undefined",function(){this.assert(void 0===u(this,"object"),"expected #{this} to be undefined","expected #{this} not to be undefined")}),t.addProperty("exist",function(){this.assert(null!=u(this,"object"),"expected #{this} to exist","expected #{this} to not exist")}),t.addProperty("empty",function(){var a=u(this,"object"),b=a;Array.isArray(a)||"string"==typeof object?b=a.length:"object"==typeof a&&(b=Object.keys(a).length),this.assert(!b,"expected #{this} to be empty","expected #{this} not to be empty")}),t.addProperty("arguments",f),t.addProperty("Arguments",f),t.addMethod("equal",g),t.addMethod("equals",g),t.addMethod("eq",g),t.addMethod("eql",h),t.addMethod("eqls",h),t.addMethod("above",i),t.addMethod("gt",i),t.addMethod("greaterThan",i),t.addMethod("least",j),t.addMethod("gte",j),t.addMethod("below",k),t.addMethod("lt",k),t.addMethod("lessThan",k),t.addMethod("most",l),t.addMethod("lte",l),t.addMethod("within",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object"),e=a+".."+b;if(u(this,"doLength")){new t(d,c).to.have.property("length");var f=d.length;this.assert(f>=a&&b>=f,"expected #{this} to have a length within "+e,"expected #{this} to not have a length within "+e)}else this.assert(d>=a&&b>=d,"expected #{this} to be within "+e,"expected #{this} to not be within "+e)}),t.addMethod("instanceof",m),t.addMethod("instanceOf",m),t.addMethod("property",function(a,c,d){d&&u(this,"message",d);var e=u(this,"deep")?"deep property ":"property ",f=u(this,"negate"),g=u(this,"object"),h=u(this,"deep")?b.getPathValue(a,g):g[a];
|
||
if(f&&void 0!==c){if(void 0===h)throw d=null!=d?d+": ":"",new Error(d+b.inspect(g)+" has no "+e+b.inspect(a))}else this.assert(void 0!==h,"expected #{this} to have a "+e+b.inspect(a),"expected #{this} to not have "+e+b.inspect(a));void 0!==c&&this.assert(c===h,"expected #{this} to have a "+e+b.inspect(a)+" of #{exp}, but got #{act}","expected #{this} to not have a "+e+b.inspect(a)+" of #{act}",c,h),u(this,"object",h)}),t.addMethod("ownProperty",n),t.addMethod("haveOwnProperty",n),t.addChainableMethod("length",p,o),t.addMethod("lengthOf",p,o),t.addMethod("match",function(a,b){b&&u(this,"message",b);var c=u(this,"object");this.assert(a.exec(c),"expected #{this} to match "+a,"expected #{this} not to match "+a)}),t.addMethod("string",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d,c).is.a("string"),this.assert(~d.indexOf(a),"expected #{this} to contain "+b.inspect(a),"expected #{this} to not contain "+b.inspect(a))}),t.addMethod("keys",q),t.addMethod("key",q),t.addMethod("throw",r),t.addMethod("throws",r),t.addMethod("Throw",r),t.addMethod("respondTo",function(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=u(this,"itself"),f="function"!==b.type(d)||e?d[a]:d.prototype[a];this.assert("function"==typeof f,"expected #{this} to respond to "+b.inspect(a),"expected #{this} to not respond to "+b.inspect(a))}),t.addProperty("itself",function(){u(this,"itself",!0)}),t.addMethod("satisfy",function(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(a(d),"expected #{this} to satisfy "+b.objDisplay(a),"expected #{this} to not satisfy"+b.objDisplay(a),this.negate?!1:!0,a(d))}),t.addMethod("closeTo",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(Math.abs(d-a)<=b,"expected #{this} to be close to "+a+" +/- "+b,"expected #{this} not to be close to "+a+" +/- "+b)}),t.addMethod("members",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d).to.be.an("array"),new t(a).to.be.an("array");var e=u(this,"deep")?b.eql:void 0;return u(this,"contains")?this.assert(s(a,d,e),"expected #{this} to be a superset of #{act}","expected #{this} to not be a superset of #{act}",d,a):void this.assert(s(d,a,e)&&s(a,d,e),"expected #{this} to have the same members as #{act}","expected #{this} to not have the same members as #{act}",d,a)})}},{}],15:[function(require,module,exports){module.exports=function(chai,util){var Assertion=chai.Assertion,flag=util.flag,assert=chai.assert=function(a,b){var c=new Assertion(null,null,chai.assert);c.assert(a,b,"[ negation message unavailable ]")};assert.fail=function(a,b,c,d){throw c=c||"assert.fail()",new chai.AssertionError(c,{actual:a,expected:b,operator:d},assert.fail)},assert.ok=function(a,b){new Assertion(a,b).is.ok},assert.notOk=function(a,b){new Assertion(a,b).is.not.ok},assert.equal=function(a,b,c){var d=new Assertion(a,c,assert.equal);d.assert(b==flag(d,"object"),"expected #{this} to equal #{exp}","expected #{this} to not equal #{act}",b,a)},assert.notEqual=function(a,b,c){var d=new Assertion(a,c,assert.notEqual);d.assert(b!=flag(d,"object"),"expected #{this} to not equal #{exp}","expected #{this} to equal #{act}",b,a)},assert.strictEqual=function(a,b,c){new Assertion(a,c).to.equal(b)},assert.notStrictEqual=function(a,b,c){new Assertion(a,c).to.not.equal(b)},assert.deepEqual=function(a,b,c){new Assertion(a,c).to.eql(b)},assert.notDeepEqual=function(a,b,c){new Assertion(a,c).to.not.eql(b)},assert.isTrue=function(a,b){new Assertion(a,b).is["true"]},assert.isFalse=function(a,b){new Assertion(a,b).is["false"]},assert.isNull=function(a,b){new Assertion(a,b).to.equal(null)},assert.isNotNull=function(a,b){new Assertion(a,b).to.not.equal(null)},assert.isUndefined=function(a,b){new Assertion(a,b).to.equal(void 0)},assert.isDefined=function(a,b){new Assertion(a,b).to.not.equal(void 0)},assert.isFunction=function(a,b){new Assertion(a,b).to.be.a("function")},assert.isNotFunction=function(a,b){new Assertion(a,b).to.not.be.a("function")},assert.isObject=function(a,b){new Assertion(a,b).to.be.a("object")},assert.isNotObject=function(a,b){new Assertion(a,b).to.not.be.a("object")},assert.isArray=function(a,b){new Assertion(a,b).to.be.an("array")},assert.isNotArray=function(a,b){new Assertion(a,b).to.not.be.an("array")},assert.isString=function(a,b){new Assertion(a,b).to.be.a("string")},assert.isNotString=function(a,b){new Assertion(a,b).to.not.be.a("string")},assert.isNumber=function(a,b){new Assertion(a,b).to.be.a("number")},assert.isNotNumber=function(a,b){new Assertion(a,b).to.not.be.a("number")},assert.isBoolean=function(a,b){new Assertion(a,b).to.be.a("boolean")},assert.isNotBoolean=function(a,b){new Assertion(a,b).to.not.be.a("boolean")},assert.typeOf=function(a,b,c){new Assertion(a,c).to.be.a(b)},assert.notTypeOf=function(a,b,c){new Assertion(a,c).to.not.be.a(b)},assert.instanceOf=function(a,b,c){new Assertion(a,c).to.be.instanceOf(b)},assert.notInstanceOf=function(a,b,c){new Assertion(a,c).to.not.be.instanceOf(b)},assert.include=function(a,b,c){new Assertion(a,c,assert.include).include(b)},assert.notInclude=function(a,b,c){new Assertion(a,c,assert.notInclude).not.include(b)},assert.match=function(a,b,c){new Assertion(a,c).to.match(b)},assert.notMatch=function(a,b,c){new Assertion(a,c).to.not.match(b)},assert.property=function(a,b,c){new Assertion(a,c).to.have.property(b)},assert.notProperty=function(a,b,c){new Assertion(a,c).to.not.have.property(b)},assert.deepProperty=function(a,b,c){new Assertion(a,c).to.have.deep.property(b)},assert.notDeepProperty=function(a,b,c){new Assertion(a,c).to.not.have.deep.property(b)},assert.propertyVal=function(a,b,c,d){new Assertion(a,d).to.have.property(b,c)},assert.propertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.property(b,c)},assert.deepPropertyVal=function(a,b,c,d){new Assertion(a,d).to.have.deep.property(b,c)},assert.deepPropertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.deep.property(b,c)},assert.lengthOf=function(a,b,c){new Assertion(a,c).to.have.length(b)},assert.Throw=function(a,b,c,d){("string"==typeof b||b instanceof RegExp)&&(c=b,b=null);var e=new Assertion(a,d).to.Throw(b,c);return flag(e,"object")},assert.doesNotThrow=function(a,b,c){"string"==typeof b&&(c=b,b=null),new Assertion(a,c).to.not.Throw(b)},assert.operator=function(val,operator,val2,msg){if(!~["==","===",">",">=","<","<=","!=","!=="].indexOf(operator))throw new Error('Invalid operator "'+operator+'"');var test=new Assertion(eval(val+operator+val2),msg);test.assert(!0===flag(test,"object"),"expected "+util.inspect(val)+" to be "+operator+" "+util.inspect(val2),"expected "+util.inspect(val)+" to not be "+operator+" "+util.inspect(val2))},assert.closeTo=function(a,b,c,d){new Assertion(a,d).to.be.closeTo(b,c)},assert.sameMembers=function(a,b,c){new Assertion(a,c).to.have.same.members(b)},assert.includeMembers=function(a,b,c){new Assertion(a,c).to.include.members(b)},assert.ifError=function(a,b){new Assertion(a,b).to.not.be.ok},function a(b,c){return assert[c]=assert[b],a}("Throw","throw")("Throw","throws")}},{}],16:[function(a,b){b.exports=function(a){a.expect=function(b,c){return new a.Assertion(b,c)}}},{}],17:[function(a,b){b.exports=function(a){function b(){function a(){return this instanceof String||this instanceof Number?new c(this.constructor(this),null,a):this instanceof Boolean?new c(1==this,null,a):new c(this,null,a)}function b(a){Object.defineProperty(this,"should",{value:a,enumerable:!0,configurable:!0,writable:!0})}Object.defineProperty(Object.prototype,"should",{set:b,get:a,configurable:!0});var d={};return d.equal=function(a,b,d){new c(a,d).to.equal(b)},d.Throw=function(a,b,d,e){new c(a,e).to.Throw(b,d)},d.exist=function(a,b){new c(a,b).to.exist},d.not={},d.not.equal=function(a,b,d){new c(a,d).to.not.equal(b)},d.not.Throw=function(a,b,d,e){new c(a,e).to.not.Throw(b,d)},d.not.exist=function(a,b){new c(a,b).to.not.exist},d["throw"]=d.Throw,d.not["throw"]=d.not.Throw,d}var c=a.Assertion;a.should=b,a.Should=b}},{}],18:[function(a,b){var c=a("./transferFlags"),d=a("./flag"),e=a("../config"),f="__proto__"in Object,g=/^(?:length|name|arguments|caller)$/,h=Function.prototype.call,i=Function.prototype.apply;b.exports=function(a,b,j,k){"function"!=typeof k&&(k=function(){});var l={method:j,chainingBehavior:k};a.__methods||(a.__methods={}),a.__methods[b]=l,Object.defineProperty(a,b,{get:function(){l.chainingBehavior.call(this);var b=function m(){var a=d(this,"ssfi");a&&e.includeStack===!1&&d(this,"ssfi",m);var b=l.method.apply(this,arguments);return void 0===b?this:b};if(f){var j=b.__proto__=Object.create(this);j.call=h,j.apply=i}else{var k=Object.getOwnPropertyNames(a);k.forEach(function(c){if(!g.test(c)){var d=Object.getOwnPropertyDescriptor(a,c);Object.defineProperty(b,c,d)}})}return c(this,b),b},configurable:!0})}},{"../config":13,"./flag":21,"./transferFlags":35}],19:[function(a,b){var c=a("../config"),d=a("./flag");b.exports=function(a,b,e){a[b]=function(){var f=d(this,"ssfi");f&&c.includeStack===!1&&d(this,"ssfi",a[b]);var g=e.apply(this,arguments);return void 0===g?this:g}}},{"../config":13,"./flag":21}],20:[function(a,b){b.exports=function(a,b,c){Object.defineProperty(a,b,{get:function(){var a=c.call(this);return void 0===a?this:a},configurable:!0})}},{}],21:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));return 3!==arguments.length?d[b]:void(d[b]=c)}},{}],22:[function(a,b){b.exports=function(a,b){return b.length>4?b[4]:a._obj}},{}],23:[function(a,b){b.exports=function(a){var b=[];for(var c in a)b.push(c);return b}},{}],24:[function(a,b){var c=a("./flag"),d=a("./getActual"),e=(a("./inspect"),a("./objDisplay"));b.exports=function(a,b){var f=c(a,"negate"),g=c(a,"object"),h=b[3],i=d(a,b),j=f?b[2]:b[1],k=c(a,"message");return j=j||"",j=j.replace(/#{this}/g,e(g)).replace(/#{act}/g,e(i)).replace(/#{exp}/g,e(h)),k?k+": "+j:j}},{"./flag":21,"./getActual":22,"./inspect":29,"./objDisplay":30}],25:[function(a,b){b.exports=function(a){if(a.name)return a.name;var b=/^\s?function ([^(]*)\(/.exec(a);return b&&b[1]?b[1]:""}},{}],26:[function(a,b){function c(a){var b=a.replace(/\[/g,".["),c=b.match(/(\\\.|[^.]+?)+/g);return c.map(function(a){var b=/\[(\d+)\]$/,c=b.exec(a);return c?{i:parseFloat(c[1])}:{p:a}})}function d(a,b){for(var c,d=b,e=0,f=a.length;f>e;e++){var g=a[e];d?("undefined"!=typeof g.p?d=d[g.p]:"undefined"!=typeof g.i&&(d=d[g.i]),e==f-1&&(c=d)):c=void 0}return c}b.exports=function(a,b){var e=c(a);return d(e,b)}},{}],27:[function(a,b){b.exports=function(){function a(a){-1===b.indexOf(a)&&b.push(a)}for(var b=Object.getOwnPropertyNames(subject),c=Object.getPrototypeOf(subject);null!==c;)Object.getOwnPropertyNames(c).forEach(a),c=Object.getPrototypeOf(c);return b}},{}],28:[function(a,b,c){var c=b.exports={};c.test=a("./test"),c.type=a("./type"),c.getMessage=a("./getMessage"),c.getActual=a("./getActual"),c.inspect=a("./inspect"),c.objDisplay=a("./objDisplay"),c.flag=a("./flag"),c.transferFlags=a("./transferFlags"),c.eql=a("deep-eql"),c.getPathValue=a("./getPathValue"),c.getName=a("./getName"),c.addProperty=a("./addProperty"),c.addMethod=a("./addMethod"),c.overwriteProperty=a("./overwriteProperty"),c.overwriteMethod=a("./overwriteMethod"),c.addChainableMethod=a("./addChainableMethod"),c.overwriteChainableMethod=a("./overwriteChainableMethod")},{"./addChainableMethod":18,"./addMethod":19,"./addProperty":20,"./flag":21,"./getActual":22,"./getMessage":24,"./getName":25,"./getPathValue":26,"./inspect":29,"./objDisplay":30,"./overwriteChainableMethod":31,"./overwriteMethod":32,"./overwriteProperty":33,"./test":34,"./transferFlags":35,"./type":36,"deep-eql":38}],29:[function(a,b,c){function d(a,b,c){var d={showHidden:b,seen:[],stylize:function(a){return a}};return e(d,a,"undefined"==typeof c?2:c)}function e(a,b,d){if(b&&"function"==typeof b.inspect&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var o=b.inspect(d);return"string"!=typeof o&&(o=e(a,o,d)),o}var u=f(a,b);if(u)return u;if(t(b))return s(b);var v=r(b),w=a.showHidden?q(b):v;if(0===w.length||n(b)&&(1===w.length&&"stack"===w[0]||2===w.length&&"description"===w[0]&&"stack"===w[1])){if("function"==typeof b){var x=p(b),y=x?": "+x:"";return a.stylize("[Function"+y+"]","special")}if(l(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(m(b))return a.stylize(Date.prototype.toUTCString.call(b),"date");if(n(b))return g(b)}var z="",A=!1,B=["{","}"];if(k(b)&&(A=!0,B=["[","]"]),"function"==typeof b){var x=p(b),y=x?": "+x:"";z=" [Function"+y+"]"}if(l(b)&&(z=" "+RegExp.prototype.toString.call(b)),m(b)&&(z=" "+Date.prototype.toUTCString.call(b)),n(b))return g(b);if(0===w.length&&(!A||0==b.length))return B[0]+z+B[1];if(0>d)return l(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var C;return C=A?h(a,b,d,v,w):w.map(function(c){return i(a,b,d,v,c,A)}),a.seen.pop(),j(C,z,B)}function f(a,b){switch(typeof b){case"undefined":return a.stylize("undefined","undefined");case"string":var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string");case"number":return a.stylize(""+b,"number");case"boolean":return a.stylize(""+b,"boolean")}return null===b?a.stylize("null","null"):void 0}function g(a){return"["+Error.prototype.toString.call(a)+"]"}function h(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(Object.prototype.hasOwnProperty.call(b,String(g))?i(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(i(a,b,c,d,e,!0))}),f}function i(a,b,c,d,f,g){var h,i;if(b.__lookupGetter__&&(b.__lookupGetter__(f)?i=b.__lookupSetter__(f)?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):b.__lookupSetter__(f)&&(i=a.stylize("[Setter]","special"))),d.indexOf(f)<0&&(h="["+f+"]"),i||(a.seen.indexOf(b[f])<0?(i=null===c?e(a,b[f],null):e(a,b[f],c-1),i.indexOf("\n")>-1&&(i=g?i.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+i.split("\n").map(function(a){return" "+a}).join("\n"))):i=a.stylize("[Circular]","special")),"undefined"==typeof h){if(g&&f.match(/^\d+$/))return i;h=JSON.stringify(""+f),h.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(h=h.substr(1,h.length-2),h=a.stylize(h,"name")):(h=h.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),h=a.stylize(h,"string"))}return h+": "+i}function j(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function k(a){return Array.isArray(a)||"object"==typeof a&&"[object Array]"===o(a)}function l(a){return"object"==typeof a&&"[object RegExp]"===o(a)}function m(a){return"object"==typeof a&&"[object Date]"===o(a)}function n(a){return"object"==typeof a&&"[object Error]"===o(a)}function o(a){return Object.prototype.toString.call(a)}var p=a("./getName"),q=a("./getProperties"),r=a("./getEnumerableProperties");b.exports=d;var s=function(a){if("outerHTML"in a)return a.outerHTML;var b,c="http://www.w3.org/1999/xhtml",d=document.createElementNS(c,"_"),e=((window.HTMLElement||window.Element).prototype,new XMLSerializer);return document.xmlVersion?e.serializeToString(a):(d.appendChild(a.cloneNode(!1)),b=d.innerHTML.replace("><",">"+a.innerHTML+"<"),d.innerHTML="",b)},t=function(a){return"object"==typeof HTMLElement?a instanceof HTMLElement:a&&"object"==typeof a&&1===a.nodeType&&"string"==typeof a.nodeName}},{"./getEnumerableProperties":23,"./getName":25,"./getProperties":27}],30:[function(a,b){var c=a("./inspect"),d=a("../config");b.exports=function(a){var b=c(a),e=Object.prototype.toString.call(a);if(d.truncateThreshold&&b.length>=d.truncateThreshold){if("[object Function]"===e)return a.name&&""!==a.name?"[Function: "+a.name+"]":"[Function]";if("[object Array]"===e)return"[ Array("+a.length+") ]";if("[object Object]"===e){var f=Object.keys(a),g=f.length>2?f.splice(0,2).join(", ")+", ...":f.join(", ");return"{ Object ("+g+") }"}return b}return b}},{"../config":13,"./inspect":29}],31:[function(a,b){b.exports=function(a,b,c,d){var e=a.__methods[b],f=e.chainingBehavior;e.chainingBehavior=function(){var a=d(f).call(this);return void 0===a?this:a};var g=e.method;e.method=function(){var a=c(g).apply(this,arguments);return void 0===a?this:a}}},{}],32:[function(a,b){b.exports=function(a,b,c){var d=a[b],e=function(){return this};d&&"function"==typeof d&&(e=d),a[b]=function(){var a=c(e).apply(this,arguments);return void 0===a?this:a}}},{}],33:[function(a,b){b.exports=function(a,b,c){var d=Object.getOwnPropertyDescriptor(a,b),e=function(){};d&&"function"==typeof d.get&&(e=d.get),Object.defineProperty(a,b,{get:function(){var a=c(e).call(this);return void 0===a?this:a},configurable:!0})}},{}],34:[function(a,b){var c=a("./flag");b.exports=function(a,b){var d=c(a,"negate"),e=b[0];return d?!e:e}},{"./flag":21}],35:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));b.__flags||(b.__flags=Object.create(null)),c=3===arguments.length?c:!0;for(var e in d)(c||"object"!==e&&"ssfi"!==e&&"message"!=e)&&(b.__flags[e]=d[e])}},{}],36:[function(a,b){var c={"[object Arguments]":"arguments","[object Array]":"array","[object Date]":"date","[object Function]":"function","[object Number]":"number","[object RegExp]":"regexp","[object String]":"string"};b.exports=function(a){var b=Object.prototype.toString.call(a);return c[b]?c[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}},{}],37:[function(a,b){function c(){function a(a,c){Object.keys(c).forEach(function(d){~b.indexOf(d)||(a[d]=c[d])})}var b=[].slice.call(arguments);return function(){for(var b=[].slice.call(arguments),c=0,d={};c<b.length;c++)a(d,b[c]);return d}}function d(a,b,d){var e=c("name","message","stack","constructor","toJSON"),f=e(b||{});this.message=a||"Unspecified AssertionError",this.showDiff=!1;for(var g in f)this[g]=f[g];d=d||arguments.callee,d&&Error.captureStackTrace&&Error.captureStackTrace(this,d)}b.exports=d,d.prototype=Object.create(Error.prototype),d.prototype.name="AssertionError",d.prototype.constructor=d,d.prototype.toJSON=function(a){var b=c("constructor","toJSON","stack"),d=b({name:this.name},this);return!1!==a&&this.stack&&(d.stack=this.stack),d}},{}],38:[function(a,b){b.exports=a("./lib/eql")},{"./lib/eql":39}],39:[function(a,b){function c(a,b,c){return d(a,b)?!0:"date"===o(a)?f(a,b):"regexp"===o(a)?g(a,b):n.isBuffer(a)?k(a,b):"arguments"===o(a)?h(a,b,c):e(a,b)?"object"!==o(a)&&"object"!==o(b)&&"array"!==o(a)&&"array"!==o(b)?d(a,b):m(a,b,c):!1}function d(a,b){return a===b?0!==a||1/a===1/b:a!==a&&b!==b}function e(a,b){return o(a)===o(b)}function f(a,b){return"date"!==o(b)?!1:d(a.getTime(),b.getTime())}function g(a,b){return"regexp"!==o(b)?!1:d(a.toString(),b.toString())}function h(a,b,d){return"arguments"!==o(b)?!1:(a=[].slice.call(a),b=[].slice.call(b),c(a,b,d))}function i(a){var b=[];for(var c in a)b.push(c);return b}function j(a,b){if(a.length!==b.length)return!1;for(var c=0,d=!0;c<a.length;c++)if(a[c]!==b[c]){d=!1;break}return d}function k(a,b){return n.isBuffer(b)?j(a,b):!1}function l(a){return null!==a&&void 0!==a}function m(a,b,d){if(!l(a)||!l(b))return!1;if(a.prototype!==b.prototype)return!1;var e;if(d){for(e=0;e<d.length;e++)if(d[e][0]===a&&d[e][1]===b||d[e][0]===b&&d[e][1]===a)return!0}else d=[];try{var f=i(a),g=i(b)}catch(h){return!1}if(f.sort(),g.sort(),!j(f,g))return!1;d.push([a,b]);var k;for(e=f.length-1;e>=0;e--)if(k=f[e],!c(a[k],b[k],d))return!1;return!0}var n,o=a("type-detect");try{n=a("buffer").Buffer}catch(p){n={},n.isBuffer=function(){return!1}}b.exports=c},{buffer:42,"type-detect":40}],40:[function(a,b){b.exports=a("./lib/type")},{"./lib/type":41}],41:[function(a,b,c){function d(a){var b=Object.prototype.toString.call(a);return f[b]?f[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}function e(){this.tests={}}var c=b.exports=d,f={"[object Array]":"array","[object RegExp]":"regexp","[object Function]":"function","[object Arguments]":"arguments","[object Date]":"date"};c.Library=e,e.prototype.of=d,e.prototype.define=function(a,b){return 1===arguments.length?this.tests[a]:(this.tests[a]=b,this)},e.prototype.test=function(a,b){if(b===d(a))return!0;var c=this.tests[b];if(c&&"regexp"===d(c))return c.test(a);if(c&&"function"===d(c))return c(a);throw new ReferenceError('Type test "'+b+'" not defined or invalid.')}},{}],42:[function(a,b,c){function d(a,b,c){if(!(this instanceof d))return new d(a,b,c);var e,f=typeof a;if("number"===f)e=a>0?a>>>0:0;else if("string"===f)"base64"===b&&(a=C(a)),e=d.byteLength(a,b);else{if("object"!==f||null===a)throw new Error("First argument needs to be a number, array or string.");"Buffer"===a.type&&E(a.data)&&(a=a.data),e=+a.length>0?Math.floor(+a.length):0}var g;T?g=d._augment(new Uint8Array(e)):(g=this,g.length=e,g._isBuffer=!0);var h;if(T&&"number"==typeof a.byteLength)g._set(a);else if(F(a))if(d.isBuffer(a))for(h=0;e>h;h++)g[h]=a.readUInt8(h);else for(h=0;e>h;h++)g[h]=(a[h]%256+256)%256;else if("string"===f)g.write(a,0,b);else if("number"===f&&!T&&!c)for(h=0;e>h;h++)g[h]=0;return g}function e(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;Q(f%2===0,"Invalid hex string"),d>f/2&&(d=f/2);for(var g=0;d>g;g++){var h=parseInt(b.substr(2*g,2),16);Q(!isNaN(h),"Invalid hex string"),a[c+g]=h}return g}function f(a,b,c,d){var e=L(H(b),a,c,d);return e}function g(a,b,c,d){var e=L(I(b),a,c,d);return e}function h(a,b,c,d){return g(a,b,c,d)}function i(a,b,c,d){var e=L(K(b),a,c,d);return e}function j(a,b,c,d){var e=L(J(b),a,c,d);return e}function k(a,b,c){return R.fromByteArray(0===b&&c===a.length?a:a.slice(b,c))}function l(a,b,c){var d="",e="";c=Math.min(a.length,c);for(var f=b;c>f;f++)a[f]<=127?(d+=M(e)+String.fromCharCode(a[f]),e=""):e+="%"+a[f].toString(16);return d+M(e)}function m(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(a[e]);return d}function n(a,b,c){return m(a,b,c)}function o(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;f++)e+=G(a[f]);return e}function p(a,b,c){for(var d=a.slice(b,c),e="",f=0;f<d.length;f+=2)e+=String.fromCharCode(d[f]+256*d[f+1]);return e}function q(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(f=a[b],e>b+1&&(f|=a[b+1]<<8)):(f=a[b]<<8,e>b+1&&(f|=a[b+1])),f}}function r(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(e>b+2&&(f=a[b+2]<<16),e>b+1&&(f|=a[b+1]<<8),f|=a[b],e>b+3&&(f+=a[b+3]<<24>>>0)):(e>b+1&&(f=a[b+1]<<16),e>b+2&&(f|=a[b+2]<<8),e>b+3&&(f|=a[b+3]),f+=a[b]<<24>>>0),f}}function s(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=q(a,b,c,!0),g=32768&f;return g?-1*(65535-f+1):f}}function t(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=r(a,b,c,!0),g=2147483648&f;return g?-1*(4294967295-f+1):f}}function u(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+3<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,23,4)}function v(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+7<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,52,8)}function w(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"trying to write beyond buffer length"),N(b,65535));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,2);h>g;g++)a[c+g]=(b&255<<8*(d?g:1-g))>>>8*(d?g:1-g);return c+2}}function x(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"trying to write beyond buffer length"),N(b,4294967295));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,4);h>g;g++)a[c+g]=b>>>8*(d?g:3-g)&255;return c+4}}function y(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"Trying to write beyond buffer length"),O(b,32767,-32768));var f=a.length;if(!(c>=f))return b>=0?w(a,b,c,d,e):w(a,65535+b+1,c,d,e),c+2}function z(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),O(b,2147483647,-2147483648));var f=a.length;if(!(c>=f))return b>=0?x(a,b,c,d,e):x(a,4294967295+b+1,c,d,e),c+4}function A(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),P(b,3.4028234663852886e38,-3.4028234663852886e38));var f=a.length;if(!(c>=f))return S.write(a,b,c,d,23,4),c+4}function B(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+7<a.length,"Trying to write beyond buffer length"),P(b,1.7976931348623157e308,-1.7976931348623157e308));var f=a.length;if(!(c>=f))return S.write(a,b,c,d,52,8),c+8}function C(a){for(a=D(a).replace(V,"");a.length%4!==0;)a+="=";return a}function D(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function E(a){return(Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)})(a)}function F(a){return E(a)||d.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length}function G(a){return 16>a?"0"+a.toString(16):a.toString(16)}function H(a){for(var b=[],c=0;c<a.length;c++){var d=a.charCodeAt(c);if(127>=d)b.push(d);else{var e=c;d>=55296&&57343>=d&&c++;for(var f=encodeURIComponent(a.slice(e,c+1)).substr(1).split("%"),g=0;g<f.length;g++)b.push(parseInt(f[g],16))}}return b}function I(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function J(a){for(var b,c,d,e=[],f=0;f<a.length;f++)b=a.charCodeAt(f),c=b>>8,d=b%256,e.push(d),e.push(c);return e}function K(a){return R.toByteArray(a)}function L(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);e++)b[e+c]=a[e];return e}function M(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function N(a,b){Q("number"==typeof a,"cannot write a non-number as a number"),Q(a>=0,"specified a negative value for writing an unsigned value"),Q(b>=a,"value is larger than maximum value for type"),Q(Math.floor(a)===a,"value has a fractional component")}function O(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value"),Q(Math.floor(a)===a,"value has a fractional component")}function P(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value")}function Q(a,b){if(!a)throw new Error(b||"Failed assertion")}var R=a("base64-js"),S=a("ieee754");c.Buffer=d,c.SlowBuffer=d,c.INSPECT_MAX_BYTES=50,d.poolSize=8192;var T=function(){try{var a=new ArrayBuffer(0),b=new Uint8Array(a);return b.foo=function(){return 42},42===b.foo()&&"function"==typeof b.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(c){return!1}}();d.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.isBuffer=function(a){return!(null==a||!a._isBuffer)},d.byteLength=function(a,b){var c;switch(a=a.toString(),b||"utf8"){case"hex":c=a.length/2;break;case"utf8":case"utf-8":c=H(a).length;break;case"ascii":case"binary":case"raw":c=a.length;break;case"base64":c=K(a).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":c=2*a.length;break;default:throw new Error("Unknown encoding")}return c},d.concat=function(a,b){if(Q(E(a),"Usage: Buffer.concat(list[, length])"),0===a.length)return new d(0);if(1===a.length)return a[0];var c;if(void 0===b)for(b=0,c=0;c<a.length;c++)b+=a[c].length;var e=new d(b),f=0;for(c=0;c<a.length;c++){var g=a[c];g.copy(e,f),f+=g.length}return e},d.compare=function(a,b){Q(d.isBuffer(a)&&d.isBuffer(b),"Arguments must be Buffers");for(var c=a.length,e=b.length,f=0,g=Math.min(c,e);g>f&&a[f]===b[f];f++);return f!==g&&(c=a[f],e=b[f]),e>c?-1:c>e?1:0},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var k=d;d=b,b=c,c=k}b=Number(b)||0;var l=this.length-b;c?(c=Number(c),c>l&&(c=l)):c=l,d=String(d||"utf8").toLowerCase();var m;switch(d){case"hex":m=e(this,a,b,c);break;case"utf8":case"utf-8":m=f(this,a,b,c);break;case"ascii":m=g(this,a,b,c);break;case"binary":m=h(this,a,b,c);break;case"base64":m=i(this,a,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":m=j(this,a,b,c);break;default:throw new Error("Unknown encoding")}return m},d.prototype.toString=function(a,b,c){var d=this;if(a=String(a||"utf8").toLowerCase(),b=Number(b)||0,c=void 0===c?d.length:Number(c),c===b)return"";var e;switch(a){case"hex":e=o(d,b,c);break;case"utf8":case"utf-8":e=l(d,b,c);break;case"ascii":e=m(d,b,c);break;case"binary":e=n(d,b,c);break;case"base64":e=k(d,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":e=p(d,b,c);break;default:throw new Error("Unknown encoding")}return e},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},d.prototype.equals=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),0===d.compare(this,a)},d.prototype.compare=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),d.compare(this,a)},d.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||0===d||(d=this.length),b||(b=0),d!==c&&0!==a.length&&0!==e.length){Q(d>=c,"sourceEnd < sourceStart"),Q(b>=0&&b<a.length,"targetStart out of bounds"),Q(c>=0&&c<e.length,"sourceStart out of bounds"),Q(d>=0&&d<=e.length,"sourceEnd out of bounds"),d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);var f=d-c;if(100>f||!T)for(var g=0;f>g;g++)a[g+b]=this[g+c];else a._set(this.subarray(c,c+f),b)}},d.prototype.slice=function(a,b){var c=this.length;if(a=~~a,b=void 0===b?c:~~b,0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c),0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c),a>b&&(b=a),T)return d._augment(this.subarray(a,b));for(var e=b-a,f=new d(e,void 0,!0),g=0;e>g;g++)f[g]=this[g+a];return f},d.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},d.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},d.prototype.readUInt8=function(a,b){return b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),a>=this.length?void 0:this[a]},d.prototype.readUInt16LE=function(a,b){return q(this,a,!0,b)},d.prototype.readUInt16BE=function(a,b){return q(this,a,!1,b)},d.prototype.readUInt32LE=function(a,b){return r(this,a,!0,b)},d.prototype.readUInt32BE=function(a,b){return r(this,a,!1,b)},d.prototype.readInt8=function(a,b){if(b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),!(a>=this.length)){var c=128&this[a];return c?-1*(255-this[a]+1):this[a]}},d.prototype.readInt16LE=function(a,b){return s(this,a,!0,b)},d.prototype.readInt16BE=function(a,b){return s(this,a,!1,b)},d.prototype.readInt32LE=function(a,b){return t(this,a,!0,b)},d.prototype.readInt32BE=function(a,b){return t(this,a,!1,b)
|
||
},d.prototype.readFloatLE=function(a,b){return u(this,a,!0,b)},d.prototype.readFloatBE=function(a,b){return u(this,a,!1,b)},d.prototype.readDoubleLE=function(a,b){return v(this,a,!0,b)},d.prototype.readDoubleBE=function(a,b){return v(this,a,!1,b)},d.prototype.writeUInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"trying to write beyond buffer length"),N(a,255)),b>=this.length?void 0:(this[b]=a,b+1)},d.prototype.writeUInt16LE=function(a,b,c){return w(this,a,b,!0,c)},d.prototype.writeUInt16BE=function(a,b,c){return w(this,a,b,!1,c)},d.prototype.writeUInt32LE=function(a,b,c){return x(this,a,b,!0,c)},d.prototype.writeUInt32BE=function(a,b,c){return x(this,a,b,!1,c)},d.prototype.writeInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"Trying to write beyond buffer length"),O(a,127,-128)),b>=this.length?void 0:(a>=0?this.writeUInt8(a,b,c):this.writeUInt8(255+a+1,b,c),b+1)},d.prototype.writeInt16LE=function(a,b,c){return y(this,a,b,!0,c)},d.prototype.writeInt16BE=function(a,b,c){return y(this,a,b,!1,c)},d.prototype.writeInt32LE=function(a,b,c){return z(this,a,b,!0,c)},d.prototype.writeInt32BE=function(a,b,c){return z(this,a,b,!1,c)},d.prototype.writeFloatLE=function(a,b,c){return A(this,a,b,!0,c)},d.prototype.writeFloatBE=function(a,b,c){return A(this,a,b,!1,c)},d.prototype.writeDoubleLE=function(a,b,c){return B(this,a,b,!0,c)},d.prototype.writeDoubleBE=function(a,b,c){return B(this,a,b,!1,c)},d.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),Q(c>=b,"end < start"),c!==b&&0!==this.length){Q(b>=0&&b<this.length,"start out of bounds"),Q(c>=0&&c<=this.length,"end out of bounds");var d;if("number"==typeof a)for(d=b;c>d;d++)this[d]=a;else{var e=H(a.toString()),f=e.length;for(d=b;c>d;d++)this[d]=e[d%f]}return this}},d.prototype.inspect=function(){for(var a=[],b=this.length,d=0;b>d;d++)if(a[d]=G(this[d]),d===c.INSPECT_MAX_BYTES){a[d+1]="...";break}return"<Buffer "+a.join(" ")+">"},d.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(T)return new d(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;c>b;b+=1)a[b]=this[b];return a.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var U=d.prototype;d._augment=function(a){return a._isBuffer=!0,a._get=a.get,a._set=a.set,a.get=U.get,a.set=U.set,a.write=U.write,a.toString=U.toString,a.toLocaleString=U.toString,a.toJSON=U.toJSON,a.equals=U.equals,a.compare=U.compare,a.copy=U.copy,a.slice=U.slice,a.readUInt8=U.readUInt8,a.readUInt16LE=U.readUInt16LE,a.readUInt16BE=U.readUInt16BE,a.readUInt32LE=U.readUInt32LE,a.readUInt32BE=U.readUInt32BE,a.readInt8=U.readInt8,a.readInt16LE=U.readInt16LE,a.readInt16BE=U.readInt16BE,a.readInt32LE=U.readInt32LE,a.readInt32BE=U.readInt32BE,a.readFloatLE=U.readFloatLE,a.readFloatBE=U.readFloatBE,a.readDoubleLE=U.readDoubleLE,a.readDoubleBE=U.readDoubleBE,a.writeUInt8=U.writeUInt8,a.writeUInt16LE=U.writeUInt16LE,a.writeUInt16BE=U.writeUInt16BE,a.writeUInt32LE=U.writeUInt32LE,a.writeUInt32BE=U.writeUInt32BE,a.writeInt8=U.writeInt8,a.writeInt16LE=U.writeInt16LE,a.writeInt16BE=U.writeInt16BE,a.writeInt32LE=U.writeInt32LE,a.writeInt32BE=U.writeInt32BE,a.writeFloatLE=U.writeFloatLE,a.writeFloatBE=U.writeFloatBE,a.writeDoubleLE=U.writeDoubleLE,a.writeDoubleBE=U.writeDoubleBE,a.fill=U.fill,a.inspect=U.inspect,a.toArrayBuffer=U.toArrayBuffer,a};var V=/[^+\/0-9A-z]/g},{"base64-js":43,ieee754:44}],43:[function(a,b,c){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(a){"use strict";function b(a){var b=a.charCodeAt(0);return b===g?62:b===h?63:i>b?-1:i+10>b?b-i+26+26:k+26>b?b-k:j+26>b?b-j+26:void 0}function c(a){function c(a){j[l++]=a}var d,e,g,h,i,j;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new f(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,e=0;g>d;d+=4,e+=3)h=b(a.charAt(d))<<18|b(a.charAt(d+1))<<12|b(a.charAt(d+2))<<6|b(a.charAt(d+3)),c((16711680&h)>>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function e(a){function b(a){return d.charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var e,f,g,h=a.length%3,i="";for(e=0,g=a.length-h;g>e;e+=3)f=(a[e]<<16)+(a[e+1]<<8)+a[e+2],i+=c(f);switch(h){case 1:f=a[a.length-1],i+=b(f>>2),i+=b(f<<4&63),i+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],i+=b(f>>10),i+=b(f>>4&63),i+=b(f<<2&63),i+="="}return i}var f="undefined"!=typeof Uint8Array?Uint8Array:Array,g="+".charCodeAt(0),h="/".charCodeAt(0),i="0".charCodeAt(0),j="a".charCodeAt(0),k="A".charCodeAt(0);a.toByteArray=c,a.fromByteArray=e}("undefined"==typeof c?this.base64js={}:c)},{}],44:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],45:[function(a,b){b.exports="function"==typeof Object.create?function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],46:[function(a,b){function c(){}var d=b.exports={};d.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var d=c.shift();d()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.binding=function(){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(){throw new Error("process.chdir is not supported")}},{}],47:[function(a,b){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8}},{}],48:[function(a,b,c){(function(b,d){function e(a,b){var d={seen:[],stylize:g};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),p(b)?d.showHidden=b:b&&c._extend(d,b),v(d.showHidden)&&(d.showHidden=!1),v(d.depth)&&(d.depth=2),v(d.colors)&&(d.colors=!1),v(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=f),i(d,a,d.depth)}function f(a,b){var c=e.styles[b];return c?"["+e.colors[c][0]+"m"+a+"["+e.colors[c][1]+"m":a}function g(a){return a}function h(a){var b={};return a.forEach(function(a){b[a]=!0}),b}function i(a,b,d){if(a.customInspect&&b&&A(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return t(e)||(e=i(a,e,d)),e}var f=j(a,b);if(f)return f;var g=Object.keys(b),p=h(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),z(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return k(b);if(0===g.length){if(A(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(w(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(y(b))return a.stylize(Date.prototype.toString.call(b),"date");if(z(b))return k(b)}var r="",s=!1,u=["{","}"];if(o(b)&&(s=!0,u=["[","]"]),A(b)){var v=b.name?": "+b.name:"";r=" [Function"+v+"]"}if(w(b)&&(r=" "+RegExp.prototype.toString.call(b)),y(b)&&(r=" "+Date.prototype.toUTCString.call(b)),z(b)&&(r=" "+k(b)),0===g.length&&(!s||0==b.length))return u[0]+r+u[1];if(0>d)return w(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var x;return x=s?l(a,b,d,p,g):g.map(function(c){return m(a,b,d,p,c,s)}),a.seen.pop(),n(x,r,u)}function j(a,b){if(v(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return s(b)?a.stylize(""+b,"number"):p(b)?a.stylize(""+b,"boolean"):q(b)?a.stylize("null","null"):void 0}function k(a){return"["+Error.prototype.toString.call(a)+"]"}function l(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(F(b,String(g))?m(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(m(a,b,c,d,e,!0))}),f}function m(a,b,c,d,e,f){var g,h,j;if(j=Object.getOwnPropertyDescriptor(b,e)||{value:b[e]},j.get?h=j.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):j.set&&(h=a.stylize("[Setter]","special")),F(d,e)||(g="["+e+"]"),h||(a.seen.indexOf(j.value)<0?(h=q(c)?i(a,j.value,null):i(a,j.value,c-1),h.indexOf("\n")>-1&&(h=f?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),v(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function n(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function o(a){return Array.isArray(a)}function p(a){return"boolean"==typeof a}function q(a){return null===a}function r(a){return null==a}function s(a){return"number"==typeof a}function t(a){return"string"==typeof a}function u(a){return"symbol"==typeof a}function v(a){return void 0===a}function w(a){return x(a)&&"[object RegExp]"===C(a)}function x(a){return"object"==typeof a&&null!==a}function y(a){return x(a)&&"[object Date]"===C(a)}function z(a){return x(a)&&("[object Error]"===C(a)||a instanceof Error)}function A(a){return"function"==typeof a}function B(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function C(a){return Object.prototype.toString.call(a)}function D(a){return 10>a?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),J[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=/%[sdj%]/g;c.format=function(a){if(!t(a)){for(var b=[],c=0;c<arguments.length;c++)b.push(e(arguments[c]));return b.join(" ")}for(var c=1,d=arguments,f=d.length,g=String(a).replace(G,function(a){if("%%"===a)return"%";if(c>=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(b){return"[Circular]"}default:return a}}),h=d[c];f>c;h=d[++c])g+=q(h)||!x(h)?" "+h:" "+e(h);return g},c.deprecate=function(a,e){function f(){if(!g){if(b.throwDeprecation)throw new Error(e);b.traceDeprecation?console.trace(e):console.error(e),g=!0}return a.apply(this,arguments)}if(v(d.process))return function(){return c.deprecate(a,e).apply(this,arguments)};if(b.noDeprecation===!0)return a;var g=!1;return f};var H,I={};c.debuglog=function(a){if(v(H)&&(H=b.env.NODE_DEBUG||""),a=a.toUpperCase(),!I[a])if(new RegExp("\\b"+a+"\\b","i").test(H)){var d=b.pid;I[a]=function(){var b=c.format.apply(c,arguments);console.error("%s %d: %s",a,d,b)}}else I[a]=function(){};return I[a]},c.inspect=e,e.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},e.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},c.isArray=o,c.isBoolean=p,c.isNull=q,c.isNullOrUndefined=r,c.isNumber=s,c.isString=t,c.isSymbol=u,c.isUndefined=v,c.isRegExp=w,c.isObject=x,c.isDate=y,c.isError=z,c.isFunction=A,c.isPrimitive=B,c.isBuffer=a("./support/isBuffer");var J=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c.log=function(){console.log("%s - %s",E(),c.format.apply(c,arguments))},c.inherits=a("inherits"),c._extend=function(a,b){if(!b||!x(b))return a;for(var c=Object.keys(b),d=c.length;d--;)a[c[d]]=b[c[d]];return a}}).call(this,a("JkpR2F"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":47,JkpR2F:46,inherits:45}],49:[function(a,b,c){!function(d){"use strict";"function"==typeof a&&"object"==typeof c&&"object"==typeof b?b.exports=d:"function"==typeof define&&define.amd?define(function(){return d}):chai.use(d)}(function(a,b){"use strict";function c(a){return"function"==typeof a&&"function"==typeof a.getCall&&"function"==typeof a.calledWithExactly}function d(a){return 1===a?"once":2===a?"twice":3===a?"thrice":(a||0)+" times"}function e(a){return a&&c(a.proxy)}function f(a){if(!c(a._obj)&&!e(a._obj))throw new TypeError(b.inspect(a._obj)+" is not a spy or a call to a spy!")}function g(a,b,d,e,f){function g(b){return a.printf.apply(a,b)}var h=e?"always have ":"have ";return d=d||"",c(a.proxy)&&(a=a.proxy),{affirmative:g(["expected %n to "+h+b+d].concat(f)),negative:g(["expected %n to not "+h+b].concat(f))}}function h(c,d,e){b.addProperty(a.Assertion.prototype,c,function(){f(this);var a=g(this._obj,d,e,!1);this.assert(this._obj[c],a.affirmative,a.negative)})}function i(c,e,h){b.addMethod(a.Assertion.prototype,c,function(a){f(this);var b=g(this._obj,e,h,!1,[d(a)]);this.assert(this._obj[c]===a,b.affirmative,b.negative)})}function j(a,c,d){return function(){f(this);var e="always"+a[0].toUpperCase()+a.substring(1),h=b.flag(this,"always")&&"function"==typeof this._obj[e],i=h?e:a,j=g(this._obj,c,d,h,n.call(arguments));this.assert(this._obj[i].apply(this._obj,arguments),j.affirmative,j.negative)}}function k(c,d,e){var f=j(c,d,e);b.addProperty(a.Assertion.prototype,c,f)}function l(c,d,e,f){var g=j(d,e,f);b.addMethod(a.Assertion.prototype,c,g)}function m(a,b,c){l(a,a,b,c)}var n=Array.prototype.slice;b.addProperty(a.Assertion.prototype,"always",function(){b.flag(this,"always",!0)}),h("called","been called"," at least once, but it was never called"),i("callCount","been called exactly %1",", but it was called %c%C"),h("calledOnce","been called exactly once",", but it was called %c%C"),h("calledTwice","been called exactly twice",", but it was called %c%C"),h("calledThrice","been called exactly thrice",", but it was called %c%C"),k("calledWithNew","been called with new"),m("calledBefore","been called before %1"),m("calledAfter","been called after %1"),m("calledOn","been called with %1 as this",", but it was called with %t instead"),m("calledWith","been called with arguments %*","%C"),m("calledWithExactly","been called with exact arguments %*","%C"),m("calledWithMatch","been called with arguments matching %*","%C"),m("returned","returned %1"),l("thrown","threw","thrown %1")})},{}],50:[function(a,b,c){"use strict";!function(d){function e(a){var b=!1;try{a.appendChild(l),b=l.parentNode==a}catch(c){return!1}finally{try{a.removeChild(l)}catch(c){}}return b}function f(a){return l&&a&&1===a.nodeType&&e(a)}function g(a){return"function"==typeof a||!!(a&&a.constructor&&a.call&&a.apply)}function h(a){return"number"==typeof a&&isNaN(a)}function i(a,b){for(var c in b)m.call(a,c)||(a[c]=b[c])}function j(a){return"function"==typeof a&&"function"==typeof a.restore&&a.restore.sinon}function k(a,b,c){c.exports=n,n.spy=a("./sinon/spy"),n.spyCall=a("./sinon/call"),n.behavior=a("./sinon/behavior"),n.stub=a("./sinon/stub"),n.mock=a("./sinon/mock"),n.collection=a("./sinon/collection"),n.assert=a("./sinon/assert"),n.sandbox=a("./sinon/sandbox"),n.test=a("./sinon/test"),n.testCase=a("./sinon/test_case"),n.match=a("./sinon/match")}var l="undefined"!=typeof document&&document.createElement("div"),m=Object.prototype.hasOwnProperty,n={wrapMethod:function(a,b,c){if(!a)throw new TypeError("Should wrap property of object");if("function"!=typeof c)throw new TypeError("Method wrapper should be function");var d,e=a[b];if(g(e)){if(e.restore&&e.restore.sinon)d=new TypeError("Attempted to wrap "+b+" which is already wrapped");else if(e.calledBefore){var f=e.returns?"stubbed":"spied on";d=new TypeError("Attempted to wrap "+b+" which is already "+f)}}else d=new TypeError("Attempted to wrap "+typeof e+" property "+b+" as function");if(d)throw e&&e._stack&&(d.stack+="\n--------------\n"+e._stack),d;var h=a.hasOwnProperty?a.hasOwnProperty(b):m.call(a,b);return a[b]=c,c.displayName=b,c._stack=new Error("Stack Trace for original").stack,c.restore=function(){h||delete a[b],a[b]===c&&(a[b]=e)},c.restore.sinon=!0,i(c,e),c},extend:function(a){for(var b=1,c=arguments.length;c>b;b+=1)for(var d in arguments[b])arguments[b].hasOwnProperty(d)&&(a[d]=arguments[b][d]),arguments[b].hasOwnProperty("toString")&&arguments[b].toString!=a.toString&&(a.toString=arguments[b].toString);return a},create:function(a){var b=function(){};return b.prototype=a,new b},deepEqual:function t(a,b){if(n.match&&n.match.isMatcher(a))return a.test(b);if("object"!=typeof a||"object"!=typeof b)return h(a)&&h(b)?!0:a===b;if(f(a)||f(b))return a===b;if(a===b)return!0;if(null===a&&null!==b||null!==a&&null===b)return!1;if(a instanceof RegExp&&b instanceof RegExp)return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;var c=Object.prototype.toString.call(a);if(c!=Object.prototype.toString.call(b))return!1;if("[object Date]"==c)return a.valueOf()===b.valueOf();var d,e=0,g=0;if("[object Array]"==c&&a.length!==b.length)return!1;for(d in a){if(e+=1,!(d in b))return!1;if(!t(a[d],b[d]))return!1}for(d in b)g+=1;return e==g},functionName:function(a){var b=a.displayName||a.name;if(!b){var c=a.toString().match(/function ([^\s\(]+)/);b=c&&c[1]}return b},functionToString:function(){if(this.getCall&&this.callCount)for(var a,b,c=this.callCount;c--;){a=this.getCall(c).thisValue;for(b in a)if(a[b]===this)return b}return this.displayName||"sinon fake"},getConfig:function(a){var b={};a=a||{};var c=n.defaultConfig;for(var d in c)c.hasOwnProperty(d)&&(b[d]=a.hasOwnProperty(d)?a[d]:c[d]);return b},format:function(a){return""+a},defaultConfig:{injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},timesInWords:function(a){return 1==a&&"once"||2==a&&"twice"||3==a&&"thrice"||(a||0)+" times"},calledInOrder:function(a){for(var b=1,c=a.length;c>b;b++)if(!a[b-1].calledBefore(a[b])||!a[b].called)return!1;return!0},orderByFirstCall:function(a){return a.sort(function(a,b){var c=a.getCall(0),d=b.getCall(0),e=c&&c.callId||-1,f=d&&d.callId||-1;return f>e?-1:1})},log:function(){},logError:function(a,b){var c=a+" threw exception: ";n.log(c+"["+b.name+"] "+b.message),b.stack&&n.log(b.stack),setTimeout(function(){throw b.message=c+b.message,b},0)},typeOf:function(a){if(null===a)return"null";if(void 0===a)return"undefined";var b=Object.prototype.toString.call(a);return b.substring(8,b.length-1).toLowerCase()},createStubInstance:function(a){if("function"!=typeof a)throw new TypeError("The constructor should be a function.");return n.stub(n.create(a.prototype))},restore:function(a){if(null!==a&&"object"==typeof a)for(var b in a)j(a[b])&&a[b].restore();else j(a)&&a.restore()}},o="undefined"!=typeof b&&b.exports&&"function"==typeof a,p="function"==typeof define&&"object"==typeof define.amd&&define.amd;if(p)define(k);else if(o){try{d=a("formatio")}catch(q){}k(a,c,b)}if(d){var r=d.configure({quoteStrings:!1});n.format=function(){return r.ascii.apply(r,arguments)}}else if(o)try{var s=a("util");n.format=function(a){return"object"==typeof a&&a.toString===Object.prototype.toString?s.inspect(a):a}}catch(q){}return n}("object"==typeof formatio&&formatio)},{"./sinon/assert":51,"./sinon/behavior":52,"./sinon/call":53,"./sinon/collection":54,"./sinon/match":55,"./sinon/mock":56,"./sinon/sandbox":57,"./sinon/spy":58,"./sinon/stub":59,"./sinon/test":60,"./sinon/test_case":61,formatio:63,util:48}],51:[function(a,b){(function(c){"use strict";!function(c,d){function e(){for(var a,b=0,c=arguments.length;c>b;++b)a=arguments[b],a||i.fail("fake is not a spy"),"function"!=typeof a&&i.fail(a+" is not a function"),"function"!=typeof a.getCall&&i.fail(a+" is not stubbed")}function f(a,b){a=a||d;var c=a.fail||i.fail;c.call(a,b)}function g(a,b,c){2==arguments.length&&(c=b,b=a),i[a]=function(d){e(d);var g=k.call(arguments,1),h=!1;h="function"==typeof b?!b(d):"function"==typeof d[b]?!d[b].apply(d,g):!d[b],h?f(this,d.printf.apply(d,[c].concat(g))):i.pass(a)}}function h(a,b){return!a||/^fail/.test(b)?b:a+b.slice(0,1).toUpperCase()+b.slice(1)}var i,j="undefined"!=typeof b&&b.exports&&"function"==typeof a,k=Array.prototype.slice;!c&&j&&(c=a("../sinon")),c&&(i={failException:"AssertError",fail:function(a){var b=new Error(a);throw b.name=this.failException||i.failException,b},pass:function(){},callOrder:function(){e.apply(null,arguments);var a="",b="";if(c.calledInOrder(arguments))i.pass("callOrder");else{try{a=[].join.call(arguments,", ");for(var d=k.call(arguments),g=d.length;g;)d[--g].called||d.splice(g,1);b=c.orderByFirstCall(d).join(", ")}catch(h){}f(this,"expected "+a+" to be called in order but were called as "+b)}},callCount:function(a,b){if(e(a),a.callCount!=b){var d="expected %n to be called "+c.timesInWords(b)+" but was called %c%C";f(this,a.printf(d))}else i.pass("callCount")},expose:function(a,b){if(!a)throw new TypeError("target is null or undefined");var c=b||{},d="undefined"==typeof c.prefix&&"assert"||c.prefix,e="undefined"==typeof c.includeFail||!!c.includeFail;for(var f in this)"export"==f||!e&&/^(fail)/.test(f)||(a[h(d,f)]=this[f]);return a},match:function(a,b){var d=c.match(b);if(d.test(a))i.pass("match");else{var e=["expected value to match"," expected = "+c.format(b)," actual = "+c.format(a)];f(this,e.join("\n"))}}},g("called","expected %n to have been called at least once but was never called"),g("notCalled",function(a){return!a.called},"expected %n to not have been called but was called %c%C"),g("calledOnce","expected %n to be called once but was called %c%C"),g("calledTwice","expected %n to be called twice but was called %c%C"),g("calledThrice","expected %n to be called thrice but was called %c%C"),g("calledOn","expected %n to be called with %1 as this but was called with %t"),g("alwaysCalledOn","expected %n to always be called with %1 as this but was called with %t"),g("calledWithNew","expected %n to be called with new"),g("alwaysCalledWithNew","expected %n to always be called with new"),g("calledWith","expected %n to be called with arguments %*%C"),g("calledWithMatch","expected %n to be called with match %*%C"),g("alwaysCalledWith","expected %n to always be called with arguments %*%C"),g("alwaysCalledWithMatch","expected %n to always be called with match %*%C"),g("calledWithExactly","expected %n to be called with exact arguments %*%C"),g("alwaysCalledWithExactly","expected %n to always be called with exact arguments %*%C"),g("neverCalledWith","expected %n to never be called with arguments %*%C"),g("neverCalledWithMatch","expected %n to never be called with match %*%C"),g("threw","%n did not throw exception%C"),g("alwaysThrew","%n did not always throw exception%C"),c.assert=i,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=i}):j&&(b.exports=i))}("object"==typeof sinon&&sinon||null,"undefined"!=typeof window?window:"undefined"!=typeof self?self:c)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../sinon":50}],52:[function(a,b){(function(c){"use strict";!function(d){function e(a,b){return"string"==typeof a?(this.exception=new Error(b||""),this.exception.name=a):this.exception=a?a:new Error("Error"),this}function f(a,b){var c=a.callArgAt;if(0>c){for(var d=a.callArgProp,e=0,f=b.length;f>e;++e){if(!d&&"function"==typeof b[e])return b[e];if(d&&b[e]&&"function"==typeof b[e][d])return b[e][d]}return null}return b[c]}function g(a,b,c){if(a.callArgAt<0){var e;return e=a.callArgProp?d.functionName(a.stub)+" expected to yield to '"+a.callArgProp+"', but no object with such a property was passed.":d.functionName(a.stub)+" expected to yield, but no callback was passed.",c.length>0&&(e+=" Received ["+l.call(c,", ")+"]"),e}return"argument at index "+a.callArgAt+" is not a function: "+b}function h(a,b){if("number"==typeof a.callArgAt){var c=f(a,b);if("function"!=typeof c)throw new TypeError(g(a,c,b));a.callbackAsync?m(function(){c.apply(a.callbackContext,a.callbackArguments)}):c.apply(a.callbackContext,a.callbackArguments)}}var i="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!d&&i&&(d=a("../sinon")),d){var j,k=Array.prototype.slice,l=Array.prototype.join,m=function(){return"object"==typeof c&&"function"==typeof c.nextTick?c.nextTick:"function"==typeof setImmediate?setImmediate:function(a){setTimeout(a,0)}}();j={create:function(a){var b=d.extend({},d.behavior);return delete b.create,b.stub=a,b},isPresent:function(){return"number"==typeof this.callArgAt||this.exception||"number"==typeof this.returnArgAt||this.returnThis||this.returnValueDefined},invoke:function(a,b){if(h(this,b),this.exception)throw this.exception;return"number"==typeof this.returnArgAt?b[this.returnArgAt]:this.returnThis?a:this.returnValue},onCall:function(a){return this.stub.onCall(a)},onFirstCall:function(){return this.stub.onFirstCall()},onSecondCall:function(){return this.stub.onSecondCall()},onThirdCall:function(){return this.stub.onThirdCall()},withArgs:function(){throw new Error('Defining a stub by invoking "stub.onCall(...).withArgs(...)" is not supported. Use "stub.withArgs(...).onCall(...)" to define sequential behavior for calls with certain arguments.')},callsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOn:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgWith:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.callArgAt=a,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOnWith:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},yields:function(){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,0),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsOn:function(a){if("object"!=typeof a)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=a,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsTo:function(a){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=a,this.callbackAsync=!1,this},yieldsToOn:function(a,b){if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=a,this.callbackAsync=!1,this},"throws":e,throwsException:e,returns:function(a){return this.returnValue=a,this.returnValueDefined=!0,this},returnsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.returnArgAt=a,this},returnsThis:function(){return this.returnThis=!0,this}};for(var n in j)j.hasOwnProperty(n)&&n.match(/^(callsArg|yields)/)&&!n.match(/Async/)&&(j[n+"Async"]=function(a){return function(){var b=this[a].apply(this,arguments);return this.callbackAsync=!0,b}}(n));d.behavior=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):i&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)}).call(this,a("JkpR2F"))},{"../sinon":50,JkpR2F:46}],53:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.functionName(a)+b;throw d.length&&(e+=" Received ["+g.call(d).join(", ")+"]"),new Error(e)}function e(a,b,d,e,f,g){if("number"!=typeof g)throw new TypeError("Call id is not a number");var i=c.create(h);return i.proxy=a,i.thisValue=b,i.args=d,i.returnValue=e,i.exception=f,i.callId=g,i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&f&&(c=a("../sinon")),c){var g=Array.prototype.slice,h={calledOn:function(a){return c.match&&c.match.isMatcher(a)?a.test(this.thisValue):this.thisValue===a},calledWith:function(){for(var a=0,b=arguments.length;b>a;a+=1)if(!c.deepEqual(arguments[a],this.args[a]))return!1;return!0},calledWithMatch:function(){for(var a=0,b=arguments.length;b>a;a+=1){var d=this.args[a],e=arguments[a];if(!c.match||!c.match(e).test(d))return!1}return!0},calledWithExactly:function(){return arguments.length==this.args.length&&this.calledWith.apply(this,arguments)},notCalledWith:function(){return!this.calledWith.apply(this,arguments)},notCalledWithMatch:function(){return!this.calledWithMatch.apply(this,arguments)},returned:function(a){return c.deepEqual(a,this.returnValue)},threw:function(a){return"undefined"!=typeof a&&this.exception?this.exception===a||this.exception.name===a:!!this.exception},calledWithNew:function(){return this.proxy.prototype&&this.thisValue instanceof this.proxy},calledBefore:function(a){return this.callId<a.callId},calledAfter:function(a){return this.callId>a.callId},callArg:function(a){this.args[a]()},callArgOn:function(a,b){this.args[a].apply(b)},callArgWith:function(a){this.callArgOnWith.apply(this,[a,null].concat(g.call(arguments,1)))},callArgOnWith:function(a,b){var c=g.call(arguments,2);this.args[a].apply(b,c)},"yield":function(){this.yieldOn.apply(this,[null].concat(g.call(arguments,0)))},yieldOn:function(a){for(var b=this.args,c=0,e=b.length;e>c;++c)if("function"==typeof b[c])return void b[c].apply(a,g.call(arguments,1));d(this.proxy," cannot yield since no callback was passed.",b)},yieldTo:function(a){this.yieldToOn.apply(this,[a,null].concat(g.call(arguments,1)))},yieldToOn:function(a,b){for(var c=this.args,e=0,f=c.length;f>e;++e)if(c[e]&&"function"==typeof c[e][a])return void c[e][a].apply(b,g.call(arguments,2));d(this.proxy," cannot yield to '"+a+"' since no callback was passed.",c)},toString:function(){for(var a=this.proxy.toString()+"(",b=[],d=0,e=this.args.length;e>d;++d)b.push(c.format(this.args[d]));return a=a+b.join(", ")+")","undefined"!=typeof this.returnValue&&(a+=" => "+c.format(this.returnValue)),this.exception&&(a+=" !"+this.exception.name,this.exception.message&&(a+="("+this.exception.message+")")),a
|
||
}};h.invokeCallback=h.yield,e.toString=h.toString,c.spyCall=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],54:[function(a,b){"use strict";!function(c){function d(a){return a.fakes||(a.fakes=[]),a.fakes}function e(a,b){for(var c=d(a),e=0,f=c.length;f>e;e+=1)"function"==typeof c[e][b]&&c[e][b]()}function f(a){for(var b=d(a),c=0;c<b.length;)b.splice(c,1)}var g="undefined"!=typeof b&&b.exports&&"function"==typeof a,h=[].push,i=Object.prototype.hasOwnProperty;if(!c&&g&&(c=a("../sinon")),c){var j={verify:function(){e(this,"verify")},restore:function(){e(this,"restore"),f(this)},verifyAndRestore:function(){var a;try{this.verify()}catch(b){a=b}if(this.restore(),a)throw a},add:function(a){return h.call(d(this),a),a},spy:function(){return this.add(c.spy.apply(c,arguments))},stub:function(a,b,d){if(b){var e=a[b];if("function"!=typeof e){if(!i.call(a,b))throw new TypeError("Cannot stub non-existent own property "+b);return a[b]=d,this.add({restore:function(){a[b]=e}})}}if(!b&&a&&"object"==typeof a){var f=c.stub.apply(c,arguments);for(var g in f)"function"==typeof f[g]&&this.add(f[g]);return f}return this.add(c.stub.apply(c,arguments))},mock:function(){return this.add(c.mock.apply(c,arguments))},inject:function(a){var b=this;return a.spy=function(){return b.spy.apply(b,arguments)},a.stub=function(){return b.stub.apply(b,arguments)},a.mock=function(){return b.mock.apply(b,arguments)},a}};c.collection=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):g&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],55:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.typeOf(a);if(e!==b)throw new TypeError("Expected type of "+d+" to be "+b+", but was "+e)}function e(a){return i.isPrototypeOf(a)}function f(a,b){if(null===b||void 0===b)return!1;for(var d in a)if(a.hasOwnProperty(d)){var e=a[d],g=b[d];if(j.isMatcher(e)){if(!e.test(g))return!1}else if("object"===c.typeOf(e)){if(!f(e,g))return!1}else if(!c.deepEqual(e,g))return!1}return!0}function g(a,b){return function(e,f){d(e,"string","property");var g=1===arguments.length,h=b+'("'+e+'"';return g||(h+=", "+f),h+=")",j(function(b){return void 0!==b&&null!==b&&a(b,e)?g||c.deepEqual(f,b[e]):!1},h)}}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i={toString:function(){return this.message}};i.or=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)||a.test(c)},d.message=b.message+".or("+a.message+")",d},i.and=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)&&a.test(c)},d.message=b.message+".and("+a.message+")",d};var j=function(a,b){var d=c.create(i),e=c.typeOf(a);switch(e){case"object":if("function"==typeof a.test)return d.test=function(b){return a.test(b)===!0},d.message="match("+c.functionName(a.test)+")",d;var g=[];for(var h in a)a.hasOwnProperty(h)&&g.push(h+": "+a[h]);d.test=function(b){return f(a,b)},d.message="match("+g.join(", ")+")";break;case"number":d.test=function(b){return a==b};break;case"string":d.test=function(b){return"string"!=typeof b?!1:-1!==b.indexOf(a)},d.message='match("'+a+'")';break;case"regexp":d.test=function(b){return"string"!=typeof b?!1:a.test(b)};break;case"function":d.test=a,d.message=b?b:"match("+c.functionName(a)+")";break;default:d.test=function(b){return c.deepEqual(a,b)}}return d.message||(d.message="match("+a+")"),d};j.isMatcher=e,j.any=j(function(){return!0},"any"),j.defined=j(function(a){return null!==a&&void 0!==a},"defined"),j.truthy=j(function(a){return!!a},"truthy"),j.falsy=j(function(a){return!a},"falsy"),j.same=function(a){return j(function(b){return a===b},"same("+a+")")},j.typeOf=function(a){return d(a,"string","type"),j(function(b){return c.typeOf(b)===a},'typeOf("'+a+'")')},j.instanceOf=function(a){return d(a,"function","type"),j(function(b){return b instanceof a},"instanceOf("+c.functionName(a)+")")},j.has=g(function(a,b){return"object"==typeof a?b in a:void 0!==a[b]},"has"),j.hasOwn=g(function(a,b){return a.hasOwnProperty(b)},"hasOwn"),j.bool=j.typeOf("boolean"),j.number=j.typeOf("number"),j.string=j.typeOf("string"),j.object=j.typeOf("object"),j.func=j.typeOf("function"),j.array=j.typeOf("array"),j.regexp=j.typeOf("regexp"),j.date=j.typeOf("date"),c.match=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):h&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],56:[function(a,b){"use strict";!function(c){function d(a){return a?d.create(a):c.expectation.create("Anonymous mock")}var e,f="undefined"!=typeof b&&b.exports&&"function"==typeof a,g=[].push;if(!c&&f&&(c=a("../sinon")),c){e=c.match,!e&&f&&(e=a("./match")),c.mock=d,c.extend(d,function(){function a(a,b){if(a)for(var c=0,d=a.length;d>c;c+=1)b(a[c])}return{create:function(a){if(!a)throw new TypeError("object is null");var b=c.extend({},d);return b.object=a,delete b.create,b},expects:function(a){if(!a)throw new TypeError("method is falsy");if(this.expectations||(this.expectations={},this.proxies=[]),!this.expectations[a]){this.expectations[a]=[];var b=this;c.wrapMethod(this.object,a,function(){return b.invokeMethod(a,this,arguments)}),g.call(this.proxies,a)}var d=c.expectation.create(a);return g.call(this.expectations[a],d),d},restore:function(){var b=this.object;a(this.proxies,function(a){"function"==typeof b[a].restore&&b[a].restore()})},verify:function(){var b=this.expectations||{},d=[],e=[];return a(this.proxies,function(c){a(b[c],function(a){a.met()?g.call(e,a.toString()):g.call(d,a.toString())})}),this.restore(),d.length>0?c.expectation.fail(d.concat(e).join("\n")):c.expectation.pass(d.concat(e).join("\n")),!0},invokeMethod:function(a,b,d){var e,f=this.expectations&&this.expectations[a],h=f&&f.length||0;for(e=0;h>e;e+=1)if(!f[e].met()&&f[e].allowsCall(b,d))return f[e].apply(b,d);var i,j=[],k=0;for(e=0;h>e;e+=1)f[e].allowsCall(b,d)?i=i||f[e]:k+=1,g.call(j," "+f[e].toString());return 0===k?i.apply(b,d):(j.unshift("Unexpected call: "+c.spyCall.toString.call({proxy:a,args:d})),void c.expectation.fail(j.join("\n")))}}}());var h=c.timesInWords;c.expectation=function(){function a(a){return 0==a?"never called":"called "+h(a)}function b(a){var b=a.minCalls,c=a.maxCalls;if("number"==typeof b&&"number"==typeof c){var d=h(b);return b!=c&&(d="at least "+d+" and at most "+h(c)),d}return"number"==typeof b?"at least "+h(b):"at most "+h(c)}function d(a){var b="number"==typeof a.minCalls;return!b||a.callCount>=a.minCalls}function f(a){return"number"!=typeof a.maxCalls?!1:a.callCount==a.maxCalls}function i(a,b){return e&&e.isMatcher(a)?a.test(b):!0}var j=Array.prototype.slice,k=c.spy.invoke;return{minCalls:1,maxCalls:1,create:function(a){var b=c.extend(c.stub.create(),c.expectation);return delete b.create,b.method=a,b},invoke:function(a,b,c){return this.verifyCallAllowed(b,c),k.apply(this,arguments)},atLeast:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");return this.limitsSet||(this.maxCalls=null,this.limitsSet=!0),this.minCalls=a,this},atMost:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");return this.limitsSet||(this.minCalls=null,this.limitsSet=!0),this.maxCalls=a,this},never:function(){return this.exactly(0)},once:function(){return this.exactly(1)},twice:function(){return this.exactly(2)},thrice:function(){return this.exactly(3)},exactly:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not a number");return this.atLeast(a),this.atMost(a)},met:function(){return!this.failed&&d(this)},verifyCallAllowed:function(a,b){if(f(this)&&(this.failed=!0,c.expectation.fail(this.method+" already called "+h(this.maxCalls))),"expectedThis"in this&&this.expectedThis!==a&&c.expectation.fail(this.method+" called with "+a+" as thisValue, expected "+this.expectedThis),"expectedArguments"in this){b||c.expectation.fail(this.method+" received no arguments, expected "+c.format(this.expectedArguments)),b.length<this.expectedArguments.length&&c.expectation.fail(this.method+" received too few arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments)),this.expectsExactArgCount&&b.length!=this.expectedArguments.length&&c.expectation.fail(this.method+" received too many arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments));for(var d=0,e=this.expectedArguments.length;e>d;d+=1)i(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", didn't match "+this.expectedArguments.toString()),c.deepEqual(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", expected "+c.format(this.expectedArguments))}},allowsCall:function(a,b){if(this.met()&&f(this))return!1;if("expectedThis"in this&&this.expectedThis!==a)return!1;if(!("expectedArguments"in this))return!0;if(b=b||[],b.length<this.expectedArguments.length)return!1;if(this.expectsExactArgCount&&b.length!=this.expectedArguments.length)return!1;for(var d=0,e=this.expectedArguments.length;e>d;d+=1){if(!i(this.expectedArguments[d],b[d]))return!1;if(!c.deepEqual(this.expectedArguments[d],b[d]))return!1}return!0},withArgs:function(){return this.expectedArguments=j.call(arguments),this},withExactArgs:function(){return this.withArgs.apply(this,arguments),this.expectsExactArgCount=!0,this},on:function(a){return this.expectedThis=a,this},toString:function(){var d=(this.expectedArguments||[]).slice();this.expectsExactArgCount||g.call(d,"[...]");var e=c.spyCall.toString.call({proxy:this.method||"anonymous mock expectation",args:d}),f=e.replace(", [...","[, ...")+" "+b(this);return this.met()?"Expectation met: "+f:"Expected "+f+" ("+a(this.callCount)+")"},verify:function(){return this.met()?c.expectation.pass(this.toString()):c.expectation.fail(this.toString()),!0},pass:function(a){c.assert.pass(a)},fail:function(a){var b=new Error(a);throw b.name="ExpectationError",b}}}(),c.mock=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):f&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50,"./match":55}],57:[function(a,b){"use strict";if("undefined"!=typeof b&&b.exports&&"function"==typeof a){var c=a("../sinon");c.extend(c,a("./util/fake_timers"))}!function(){function a(a,b,c,d){d&&(!b.injectInto||c in b.injectInto?e.call(a.args,d):(b.injectInto[c]=d,a.injectedKeys.push(c)))}function d(a){var b=c.create(c.sandbox);return a.useFakeServer&&("object"==typeof a.useFakeServer&&(b.serverPrototype=a.useFakeServer),b.useFakeServer()),a.useFakeTimers&&("object"==typeof a.useFakeTimers?b.useFakeTimers.apply(b,a.useFakeTimers):b.useFakeTimers()),b}var e=[].push;c.sandbox=c.extend(c.create(c.collection),{useFakeTimers:function(){return this.clock=c.useFakeTimers.apply(c,arguments),this.add(this.clock)},serverPrototype:c.fakeServer,useFakeServer:function(){var a=this.serverPrototype||c.fakeServer;return a&&a.create?(this.server=a.create(),this.add(this.server)):null},inject:function(a){return c.collection.inject.call(this,a),this.clock&&(a.clock=this.clock),this.server&&(a.server=this.server,a.requests=this.server.requests),a},restore:function(){c.collection.restore.apply(this,arguments),this.restoreContext()},restoreContext:function(){if(this.injectedKeys){for(var a=0,b=this.injectedKeys.length;b>a;a++)delete this.injectInto[this.injectedKeys[a]];this.injectedKeys=[]}},create:function(b){if(!b)return c.create(c.sandbox);var e=d(b);e.args=e.args||[],e.injectedKeys=[],e.injectInto=b.injectInto;var f,g,h=e.inject({});if(b.properties)for(var i=0,j=b.properties.length;j>i;i++)f=b.properties[i],g=h[f]||"sandbox"==f&&e,a(e,b,f,g);else a(e,b,"sandbox",g);return e}}),c.sandbox.useFakeXMLHttpRequest=c.sandbox.useFakeServer,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=c.sandbox}):"undefined"!=typeof b&&b.exports&&(b.exports=c.sandbox)}()},{"../sinon":50,"./util/fake_timers":62}],58:[function(require,module,exports){"use strict";!function(sinon){function spy(a,b){if(!b&&"function"==typeof a)return spy.create(a);if(!a&&!b)return spy.create(function(){});var c=a[b];return sinon.wrapMethod(a,b,spy.create(c))}function matchingFake(a,b,c){if(a)for(var d=0,e=a.length;e>d;d++)if(a[d].matches(b,c))return a[d]}function incrementCallCount(){this.called=!0,this.callCount+=1,this.notCalled=!1,this.calledOnce=1==this.callCount,this.calledTwice=2==this.callCount,this.calledThrice=3==this.callCount}function createCallProperties(){this.firstCall=this.getCall(0),this.secondCall=this.getCall(1),this.thirdCall=this.getCall(2),this.lastCall=this.getCall(this.callCount-1)}function createProxy(func){var p;return func.length?eval("p = (function proxy("+vars.substring(0,2*func.length-1)+") { return p.invoke(func, this, slice.call(arguments)); });"):p=function(){return p.invoke(func,this,slice.call(arguments))},p}function delegateToCalls(a,b,c,d){spyApi[a]=function(){if(!this.called)return d?d.apply(this,arguments):!1;for(var e,f=0,g=0,h=this.callCount;h>g;g+=1)if(e=this.getCall(g),e[c||a].apply(e,arguments)&&(f+=1,b))return!0;return f===this.callCount}}var commonJSModule="undefined"!=typeof module&&module.exports&&"function"==typeof require,push=Array.prototype.push,slice=Array.prototype.slice,callId=0;if(!sinon&&commonJSModule&&(sinon=require("../sinon")),sinon){var vars="a,b,c,d,e,f,g,h,i,j,k,l",uuid=0,spyApi={reset:function(){if(this.called=!1,this.notCalled=!0,this.calledOnce=!1,this.calledTwice=!1,this.calledThrice=!1,this.callCount=0,this.firstCall=null,this.secondCall=null,this.thirdCall=null,this.lastCall=null,this.args=[],this.returnValues=[],this.thisValues=[],this.exceptions=[],this.callIds=[],this.fakes)for(var a=0;a<this.fakes.length;a++)this.fakes[a].reset()},create:function(a){var b;"function"!=typeof a?a=function(){}:b=sinon.functionName(a);var c=createProxy(a);return sinon.extend(c,spy),delete c.create,sinon.extend(c,a),c.reset(),c.prototype=a.prototype,c.displayName=b||"spy",c.toString=sinon.functionToString,c._create=sinon.spy.create,c.id="spy#"+uuid++,c},invoke:function(a,b,c){var d,e,f=matchingFake(this.fakes,c);incrementCallCount.call(this),push.call(this.thisValues,b),push.call(this.args,c),push.call(this.callIds,callId++),createCallProperties.call(this);try{e=f?f.invoke(a,b,c):(this.func||a).apply(b,c);var g=this.getCall(this.callCount-1);g.calledWithNew()&&"object"!=typeof e&&(e=b)}catch(h){d=h}if(push.call(this.exceptions,d),push.call(this.returnValues,e),createCallProperties.call(this),void 0!==d)throw d;return e},named:function(a){return this.displayName=a,this},getCall:function(a){return 0>a||a>=this.callCount?null:sinon.spyCall(this,this.thisValues[a],this.args[a],this.returnValues[a],this.exceptions[a],this.callIds[a])},getCalls:function(){var a,b=[];for(a=0;a<this.callCount;a++)b.push(this.getCall(a));return b},calledBefore:function(a){return this.called?a.called?this.callIds[0]<a.callIds[a.callIds.length-1]:!0:!1},calledAfter:function(a){return this.called&&a.called?this.callIds[this.callCount-1]>a.callIds[a.callCount-1]:!1},withArgs:function(){var a=slice.call(arguments);if(this.fakes){var b=matchingFake(this.fakes,a,!0);if(b)return b}else this.fakes=[];var c=this,d=this._create();d.matchingAguments=a,d.parent=this,push.call(this.fakes,d),d.withArgs=function(){return c.withArgs.apply(c,arguments)};for(var e=0;e<this.args.length;e++)d.matches(this.args[e])&&(incrementCallCount.call(d),push.call(d.thisValues,this.thisValues[e]),push.call(d.args,this.args[e]),push.call(d.returnValues,this.returnValues[e]),push.call(d.exceptions,this.exceptions[e]),push.call(d.callIds,this.callIds[e]));return createCallProperties.call(d),d},matches:function(a,b){var c=this.matchingAguments;return c.length<=a.length&&sinon.deepEqual(c,a.slice(0,c.length))?!b||c.length==a.length:void 0},printf:function(a){var b,c=this,d=slice.call(arguments,1);return(a||"").replace(/%(.)/g,function(a,e){return b=spyApi.formatters[e],"function"==typeof b?b.call(null,c,d):isNaN(parseInt(e,10))?"%"+e:sinon.format(d[e-1])})}};delegateToCalls("calledOn",!0),delegateToCalls("alwaysCalledOn",!1,"calledOn"),delegateToCalls("calledWith",!0),delegateToCalls("calledWithMatch",!0),delegateToCalls("alwaysCalledWith",!1,"calledWith"),delegateToCalls("alwaysCalledWithMatch",!1,"calledWithMatch"),delegateToCalls("calledWithExactly",!0),delegateToCalls("alwaysCalledWithExactly",!1,"calledWithExactly"),delegateToCalls("neverCalledWith",!1,"notCalledWith",function(){return!0}),delegateToCalls("neverCalledWithMatch",!1,"notCalledWithMatch",function(){return!0}),delegateToCalls("threw",!0),delegateToCalls("alwaysThrew",!1,"threw"),delegateToCalls("returned",!0),delegateToCalls("alwaysReturned",!1,"returned"),delegateToCalls("calledWithNew",!0),delegateToCalls("alwaysCalledWithNew",!1,"calledWithNew"),delegateToCalls("callArg",!1,"callArgWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")}),spyApi.callArgWith=spyApi.callArg,delegateToCalls("callArgOn",!1,"callArgOnWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")}),spyApi.callArgOnWith=spyApi.callArgOn,delegateToCalls("yield",!1,"yield",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),spyApi.invokeCallback=spyApi.yield,delegateToCalls("yieldOn",!1,"yieldOn",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),delegateToCalls("yieldTo",!1,"yieldTo",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),delegateToCalls("yieldToOn",!1,"yieldToOn",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),spyApi.formatters={c:function(a){return sinon.timesInWords(a.callCount)},n:function(a){return a.toString()},C:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c){var e=" "+a.getCall(c).toString();/\n/.test(b[c-1])&&(e="\n"+e),push.call(b,e)}return b.length>0?"\n"+b.join("\n"):""},t:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c)push.call(b,sinon.format(a.thisValues[c]));return b.join(", ")},"*":function(a,b){for(var c=[],d=0,e=b.length;e>d;++d)push.call(c,sinon.format(b[d]));return c.join(", ")}},sinon.extend(spy,spyApi),spy.spyCall=sinon.spyCall,sinon.spy=spy,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=spy}):commonJSModule&&(module.exports=spy)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],59:[function(a,b){"use strict";!function(c){function d(a,b,e){if(e&&"function"!=typeof e)throw new TypeError("Custom stub should be function");var f;if(f=e?c.spy&&c.spy.create?c.spy.create(e):e:d.create(),!a&&"undefined"==typeof b)return c.stub.create();if("undefined"==typeof b&&"object"==typeof a){for(var g in a)"function"==typeof a[g]&&d(a,g);return a}return c.wrapMethod(a,b,f)}function e(a){return a.defaultBehavior||f(a)||c.behavior.create(a)}function f(a){return a.parent&&g(a.parent)}function g(a){var b=a.behaviors[a.callCount-1];return b&&b.isPresent()?b:e(a)}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i=0;c.extend(d,function(){var a={create:function(){var a=function(){return g(a).invoke(this,arguments)};a.id="stub#"+i++;var b=a;return a=c.spy.create(a),a.func=b,c.extend(a,d),a._create=c.stub.create,a.displayName="stub",a.toString=c.functionToString,a.defaultBehavior=null,a.behaviors=[],a},resetBehavior:function(){var a;if(this.defaultBehavior=null,this.behaviors=[],delete this.returnValue,delete this.returnArgAt,this.returnThis=!1,this.fakes)for(a=0;a<this.fakes.length;a++)this.fakes[a].resetBehavior()},onCall:function(a){return this.behaviors[a]||(this.behaviors[a]=c.behavior.create(this)),this.behaviors[a]},onFirstCall:function(){return this.onCall(0)},onSecondCall:function(){return this.onCall(1)},onThirdCall:function(){return this.onCall(2)}};for(var b in c.behavior)c.behavior.hasOwnProperty(b)&&!a.hasOwnProperty(b)&&"create"!=b&&"withArgs"!=b&&"invoke"!=b&&(a[b]=function(a){return function(){return this.defaultBehavior=this.defaultBehavior||c.behavior.create(this),this.defaultBehavior[a].apply(this.defaultBehavior,arguments),this}}(b));return a}()),c.stub=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):h&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],60:[function(a,b){"use strict";!function(c){function d(a){function b(){var b=c.getConfig(c.config);b.injectInto=b.injectIntoThis&&this||b.injectInto;var d,e,f=c.sandbox.create(b),g=Array.prototype.slice.call(arguments).concat(f.args);try{e=a.apply(this,g)}catch(h){d=h}if("undefined"!=typeof d)throw f.restore(),d;return f.verifyAndRestore(),e}var d=typeof a;if("function"!=d)throw new TypeError("sinon.test needs to wrap a test function, got "+d);return a.length?function(){return b.apply(this,arguments)}:b}var e="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&e&&(c=a("../sinon")),c&&(d.config={injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},c.test=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):e&&(b.exports=d))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],61:[function(a,b){"use strict";!function(c){function d(a,b,c){return function(){b&&b.apply(this,arguments);var d,e;try{e=a.apply(this,arguments)}catch(f){d=f}if(c&&c.apply(this,arguments),d)throw d;return e}}function e(a,b){if(!a||"object"!=typeof a)throw new TypeError("sinon.testCase needs an object with test functions");b=b||"test";var e,f,g,h=new RegExp("^"+b),i={},j=a.setUp,k=a.tearDown;for(e in a)if(a.hasOwnProperty(e)){if(f=a[e],/^(setUp|tearDown)$/.test(e))continue;"function"==typeof f&&h.test(e)?(g=f,(j||k)&&(g=d(f,j,k)),i[e]=c.test(g)):i[e]=a[e]}return i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&f&&(c=a("../sinon")),c&&Object.prototype.hasOwnProperty&&(c.testCase=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],62:[function(require,module,exports){(function(global){"use strict";if("undefined"==typeof sinon)var sinon={};!function(global){function addTimer(a,b){if(0===a.length)throw new Error("Function requires at least 1 parameter");if("undefined"==typeof a[0])throw new Error("Callback must be provided to timer calls");var c=id++,d=a[1]||0;return this.timeouts||(this.timeouts={}),this.timeouts[c]={id:c,func:a[0],callAt:this.now+d,invokeArgs:Array.prototype.slice.call(a,2)},b===!0&&(this.timeouts[c].interval=d),addTimerReturnsObject?{id:c,ref:function(){},unref:function(){}}:c}function parseTime(a){if(!a)return 0;var b,c=a.split(":"),d=c.length,e=d,f=0;if(d>3||!/^(\d\d:){0,2}\d\d?$/.test(a))throw new Error("tick only understands numbers and 'h:m:s'");for(;e--;){if(b=parseInt(c[e],10),b>=60)throw new Error("Invalid time "+a);f+=b*Math.pow(60,d-e-1)}return 1e3*f}function createObject(a){var b;if(Object.create)b=Object.create(a);else{var c=function(){};c.prototype=a,b=new c}return b.Date.clock=b,b}function mirrorDateProperties(a,b){b.now?a.now=function(){return a.clock.now}:delete a.now,b.toSource?a.toSource=function(){return b.toSource()}:delete a.toSource,a.toString=function(){return b.toString()},a.prototype=b.prototype,a.parse=b.parse,a.UTC=b.UTC,a.prototype.toUTCString=b.prototype.toUTCString;for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function restore(){for(var a,b=0,c=this.methods.length;c>b;b++)if(a=this.methods[b],global[a].hadOwnProperty)global[a]=this["_"+a];else try{delete global[a]}catch(d){}this.methods=[]}function stubGlobal(a,b){if(b[a].hadOwnProperty=Object.prototype.hasOwnProperty.call(global,a),b["_"+a]=global[a],"Date"==a){var c=mirrorDateProperties(b[a],global[a]);global[a]=c}else{global[a]=function(){return b[a].apply(b,arguments)};for(var d in b[a])b[a].hasOwnProperty(d)&&(global[a][d]=b[a][d])}global[a].clock=b}var timeoutResult=setTimeout(function(){},0),addTimerReturnsObject="object"==typeof timeoutResult;clearTimeout(timeoutResult);var id=1;sinon.clock={now:0,create:function(a){var b=createObject(this);if("number"==typeof a&&(b.now=a),a&&"object"==typeof a)throw new TypeError("now should be milliseconds since UNIX epoch");return b},setTimeout:function(){return addTimer.call(this,arguments,!1)},clearTimeout:function(a){a&&(this.timeouts||(this.timeouts=[]),"object"==typeof a&&(a=a.id),a in this.timeouts&&delete this.timeouts[a])},setInterval:function(){return addTimer.call(this,arguments,!0)},clearInterval:function(a){this.clearTimeout(a)},setImmediate:function(a){var b=Array.prototype.slice.call(arguments,1);return addTimer.call(this,[a,0].concat(b),!1)},clearImmediate:function(a){this.clearTimeout(a)},tick:function(a){a="number"==typeof a?a:parseTime(a);for(var b,c=this.now,d=this.now+a,e=this.now,f=this.firstTimerInRange(c,d);f&&d>=c;){if(this.timeouts[f.id]){c=this.now=f.callAt;try{this.callTimer(f)}catch(g){b=b||g}}f=this.firstTimerInRange(e,d),e=c}if(this.now=d,b)throw b;return this.now},firstTimerInRange:function(a,b){var c,d,e=null;for(var f in this.timeouts)if(this.timeouts.hasOwnProperty(f)){if(this.timeouts[f].callAt<a||this.timeouts[f].callAt>b)continue;(null===e||this.timeouts[f].callAt<e)&&(d=this.timeouts[f],e=this.timeouts[f].callAt,c={func:this.timeouts[f].func,callAt:this.timeouts[f].callAt,interval:this.timeouts[f].interval,id:this.timeouts[f].id,invokeArgs:this.timeouts[f].invokeArgs})}return c||null},callTimer:function(timer){"number"==typeof timer.interval?this.timeouts[timer.id].callAt+=timer.interval:delete this.timeouts[timer.id];try{"function"==typeof timer.func?timer.func.apply(null,timer.invokeArgs):eval(timer.func)}catch(e){var exception=e}if(this.timeouts[timer.id]){if(exception)throw exception}else if(exception)throw exception},reset:function(){this.timeouts={}},Date:function(){function a(c,d,e,f,g,h,i){switch(arguments.length){case 0:return new b(a.clock.now);case 1:return new b(c);case 2:return new b(c,d);case 3:return new b(c,d,e);case 4:return new b(c,d,e,f);case 5:return new b(c,d,e,f,g);case 6:return new b(c,d,e,f,g,h);default:return new b(c,d,e,f,g,h,i)}}var b=Date;return mirrorDateProperties(a,b)}()};var methods=["Date","setTimeout","setInterval","clearTimeout","clearInterval"];"undefined"!=typeof global.setImmediate&&methods.push("setImmediate"),"undefined"!=typeof global.clearImmediate&&methods.push("clearImmediate"),sinon.useFakeTimers=function(a){var b=sinon.clock.create(a);b.restore=restore,b.methods=Array.prototype.slice.call(arguments,"number"==typeof a?1:0),0===b.methods.length&&(b.methods=methods);for(var c=0,d=b.methods.length;d>c;c++)stubGlobal(b.methods[c],b);return b}}("undefined"!=typeof global&&"function"!=typeof global?global:this),sinon.timers={setTimeout:setTimeout,clearTimeout:clearTimeout,setImmediate:"undefined"!=typeof setImmediate?setImmediate:void 0,clearImmediate:"undefined"!=typeof clearImmediate?clearImmediate:void 0,setInterval:setInterval,clearInterval:clearInterval,Date:Date},"undefined"!=typeof module&&module.exports&&(module.exports=sinon)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],63:[function(a,b){(function(c){("function"==typeof define&&define.amd&&function(a){define("formatio",["samsam"],a)}||"object"==typeof b&&function(c){b.exports=c(a("samsam"))}||function(a){this.formatio=a(this.samsam)})(function(a){"use strict";function b(a){if(!a)return"";if(a.displayName)return a.displayName;if(a.name)return a.name;var b=a.toString().match(/function\s+([^\(]+)/m);return b&&b[1]||""}function d(a,c){var d,e,f=b(c&&c.constructor),g=a.excludeConstructors||h.excludeConstructors||[];for(d=0,e=g.length;e>d;++d){if("string"==typeof g[d]&&g[d]===f)return"";if(g[d].test&&g[d].test(f))return""}return f}function e(a,b){if("object"!=typeof a)return!1;var c,d;for(c=0,d=b.length;d>c;++c)if(b[c]===a)return!0;return!1}function f(b,c,d,g){if("string"==typeof c){var h=b.quoteStrings,j="boolean"!=typeof h||h;return d||j?'"'+c+'"':c}if("function"==typeof c&&!(c instanceof RegExp))return f.func(c);if(d=d||[],e(c,d))return"[Circular]";if("[object Array]"===Object.prototype.toString.call(c))return f.array.call(b,c,d);if(!c)return String(1/c===-1/0?"-0":c);if(a.isElement(c))return f.element(c);if("function"==typeof c.toString&&c.toString!==Object.prototype.toString)return c.toString();var k,l;for(k=0,l=i.length;l>k;k++)if(c===i[k].object)return i[k].value;return f.object.call(b,c,d,g)}function g(a){for(var b in a)this[b]=a[b]}var h={excludeConstructors:["Object",/^.$/],quoteStrings:!0},i=(Object.prototype.hasOwnProperty,[]);return"undefined"!=typeof c&&i.push({object:c,value:"[object global]"}),"undefined"!=typeof document&&i.push({object:document,value:"[object HTMLDocument]"}),"undefined"!=typeof window&&i.push({object:window,value:"[object Window]"}),f.func=function(a){return"function "+b(a)+"() {}"},f.array=function(a,b){b=b||[],b.push(a);var c,d,e=[];for(c=0,d=a.length;d>c;++c)e.push(f(this,a[c],b));return"["+e.join(", ")+"]"},f.object=function(b,c,g){c=c||[],c.push(b),g=g||0;var h,i,j,k,l,m=[],n=a.keys(b).sort(),o=3;for(k=0,l=n.length;l>k;++k)h=n[k],j=b[h],i=e(j,c)?"[Circular]":f(this,j,c,g+2),i=(/\s/.test(h)?'"'+h+'"':h)+": "+i,o+=i.length,m.push(i);var p=d(this,b),q=p?"["+p+"] ":"",r="";for(k=0,l=g;l>k;++k)r+=" ";return o+g>80?q+"{\n "+r+m.join(",\n "+r)+"\n"+r+"}":q+"{ "+m.join(", ")+" }"},f.element=function(a){var b,c,d,e,f,g=a.tagName.toLowerCase(),h=a.attributes,i=[];for(d=0,e=h.length;e>d;++d)b=h.item(d),c=b.nodeName.toLowerCase().replace("html:",""),f=b.nodeValue,("contenteditable"!==c||"inherit"!==f)&&f&&i.push(c+'="'+f+'"');var j="<"+g+(i.length>0?" ":""),k=a.innerHTML;k.length>20&&(k=k.substr(0,20)+"[...]");var l=j+i.join(" ")+">"+k+"</"+g+">";return l.replace(/ contentEditable="inherit"/,"")},g.prototype={functionName:b,configure:function(a){return new g(a)},constructorName:function(a){return d(this,a)},ascii:function(a,b,c){return f(this,a,b,c)}},g.prototype})}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{samsam:64}],64:[function(a,b){("function"==typeof define&&define.amd&&function(a){define("samsam",a)}||"object"==typeof b&&function(a){b.exports=a()}||function(a){this.samsam=a()})(function(){function a(a){var b=a;return"number"==typeof a&&a!==b}function b(a){return l.toString.call(a).split(/[ \]]/)[1]}function c(a){if("Arguments"===b(a))return!0;if("object"!=typeof a||"number"!=typeof a.length||"Array"===b(a))return!1;if("function"==typeof a.callee)return!0;try{a[a.length]=6,delete a[a.length]}catch(c){return!0}return!1}function d(a){if(!a||1!==a.nodeType||!m)return!1;try{a.appendChild(m),a.removeChild(m)}catch(b){return!1}return!0}function e(a){var b,c=[];for(b in a)l.hasOwnProperty.call(a,b)&&c.push(b);return c}function f(a){return"function"==typeof a.getTime&&a.getTime()==a.valueOf()}function g(a){return 0===a&&1/a===-1/0}function h(b,c){return b===c||a(b)&&a(c)?0!==b||g(b)===g(c):void 0}function i(g,i){function j(a){return"object"!=typeof a||null===a||a instanceof Boolean||a instanceof Date||a instanceof Number||a instanceof RegExp||a instanceof String?!1:!0}function k(a,b){var c;for(c=0;c<a.length;c++)if(a[c]===b)return c;return-1}var m=[],n=[],o=[],p=[],q={};return function r(g,i,s,t){var u=typeof g,v=typeof i;if(g===i||a(g)||a(i)||null==g||null==i||"object"!==u||"object"!==v)return h(g,i);if(d(g)||d(i))return!1;var w=f(g),x=f(i);if(!(!w&&!x||w&&x&&g.getTime()===i.getTime()))return!1;if(g instanceof RegExp&&i instanceof RegExp&&g.toString()!==i.toString())return!1;var y=b(g),z=b(i),A=e(g),B=e(i);if(c(g)||c(i)){if(g.length!==i.length)return!1}else if(u!==v||y!==z||A.length!==B.length)return!1;
|
||
var C,D,E,F,G,H,I,J,K,L,M;for(D=0,E=A.length;E>D;D++){if(C=A[D],!l.hasOwnProperty.call(i,C))return!1;if(F=g[C],G=i[C],H=j(F),I=j(G),J=H?k(m,F):-1,K=I?k(n,G):-1,L=-1!==J?o[J]:s+"["+JSON.stringify(C)+"]",M=-1!==K?p[K]:t+"["+JSON.stringify(C)+"]",q[L+M])return!0;if(-1===J&&H&&(m.push(F),o.push(L)),-1===K&&I&&(n.push(G),p.push(M)),H&&I&&(q[L+M]=!0),!r(F,G,L,M))return!1}return!0}(g,i,"$1","$2")}function j(a,b){if(0===b.length)return!0;var c,d,e,f;for(c=0,d=a.length;d>c;++c)if(k(a[c],b[0])){for(e=0,f=b.length;f>e;++e)if(!k(a[c+e],b[e]))return!1;return!0}return!1}var k,l=Object.prototype,m="undefined"!=typeof document&&document.createElement("div");return k=function n(a,c){if(c&&"function"==typeof c.test)return c.test(a);if("function"==typeof c)return c(a)===!0;if("string"==typeof c){c=c.toLowerCase();var d="string"==typeof a||!!a;return d&&String(a).toLowerCase().indexOf(c)>=0}if("number"==typeof c)return c===a;if("boolean"==typeof c)return c===a;if("Array"===b(a)&&"Array"===b(c))return j(a,c);if(c&&"object"==typeof c){var e;for(e in c){var f=a[e];if("undefined"==typeof f&&"function"==typeof a.getAttribute&&(f=a.getAttribute(e)),"undefined"==typeof f||!n(f,c[e]))return!1}return!0}throw new Error("Matcher was not a string, a number, a function, a boolean or an object")},{isArguments:c,isElement:d,isDate:f,isNegZero:g,identical:h,deepEqual:i,match:k,keys:e}})},{}],65:[function(a,b,c){(function(){var a=this,d=a._,e={},f=Array.prototype,g=Object.prototype,h=Function.prototype,i=f.push,j=f.slice,k=f.concat,l=g.toString,m=g.hasOwnProperty,n=f.forEach,o=f.map,p=f.reduce,q=f.reduceRight,r=f.filter,s=f.every,t=f.some,u=f.indexOf,v=f.lastIndexOf,w=Array.isArray,x=Object.keys,y=h.bind,z=function(a){return a instanceof z?a:this instanceof z?void(this._wrapped=a):new z(a)};"undefined"!=typeof c?("undefined"!=typeof b&&b.exports&&(c=b.exports=z),c._=z):a._=z,z.VERSION="1.6.0";var A=z.each=z.forEach=function(a,b,c){if(null==a)return a;if(n&&a.forEach===n)a.forEach(b,c);else if(a.length===+a.length){for(var d=0,f=a.length;f>d;d++)if(b.call(c,a[d],d,a)===e)return}else for(var g=z.keys(a),d=0,f=g.length;f>d;d++)if(b.call(c,a[g[d]],g[d],a)===e)return;return a};z.map=z.collect=function(a,b,c){var d=[];return null==a?d:o&&a.map===o?a.map(b,c):(A(a,function(a,e,f){d.push(b.call(c,a,e,f))}),d)};var B="Reduce of empty array with no initial value";z.reduce=z.foldl=z.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),p&&a.reduce===p)return d&&(b=z.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(A(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(B);return c},z.reduceRight=z.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),q&&a.reduceRight===q)return d&&(b=z.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=z.keys(a);f=g.length}if(A(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(B);return c},z.find=z.detect=function(a,b,c){var d;return C(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},z.filter=z.select=function(a,b,c){var d=[];return null==a?d:r&&a.filter===r?a.filter(b,c):(A(a,function(a,e,f){b.call(c,a,e,f)&&d.push(a)}),d)},z.reject=function(a,b,c){return z.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},z.every=z.all=function(a,b,c){b||(b=z.identity);var d=!0;return null==a?d:s&&a.every===s?a.every(b,c):(A(a,function(a,f,g){return(d=d&&b.call(c,a,f,g))?void 0:e}),!!d)};var C=z.some=z.any=function(a,b,c){b||(b=z.identity);var d=!1;return null==a?d:t&&a.some===t?a.some(b,c):(A(a,function(a,f,g){return d||(d=b.call(c,a,f,g))?e:void 0}),!!d)};z.contains=z.include=function(a,b){return null==a?!1:u&&a.indexOf===u?-1!=a.indexOf(b):C(a,function(a){return a===b})},z.invoke=function(a,b){var c=j.call(arguments,2),d=z.isFunction(b);return z.map(a,function(a){return(d?b:a[b]).apply(a,c)})},z.pluck=function(a,b){return z.map(a,z.property(b))},z.where=function(a,b){return z.filter(a,z.matches(b))},z.findWhere=function(a,b){return z.find(a,z.matches(b))},z.max=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);var d=-1/0,e=-1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;h>e&&(d=a,e=h)}),d},z.min=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);var d=1/0,e=1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;e>h&&(d=a,e=h)}),d},z.shuffle=function(a){var b,c=0,d=[];return A(a,function(a){b=z.random(c++),d[c-1]=d[b],d[b]=a}),d},z.sample=function(a,b,c){return null==b||c?(a.length!==+a.length&&(a=z.values(a)),a[z.random(a.length-1)]):z.shuffle(a).slice(0,Math.max(0,b))};var D=function(a){return null==a?z.identity:z.isFunction(a)?a:z.property(a)};z.sortBy=function(a,b,c){return b=D(b),z.pluck(z.map(a,function(a,d,e){return{value:a,index:d,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index-b.index}),"value")};var E=function(a){return function(b,c,d){var e={};return c=D(c),A(b,function(f,g){var h=c.call(d,f,g,b);a(e,h,f)}),e}};z.groupBy=E(function(a,b,c){z.has(a,b)?a[b].push(c):a[b]=[c]}),z.indexBy=E(function(a,b,c){a[b]=c}),z.countBy=E(function(a,b){z.has(a,b)?a[b]++:a[b]=1}),z.sortedIndex=function(a,b,c,d){c=D(c);for(var e=c.call(d,b),f=0,g=a.length;g>f;){var h=f+g>>>1;c.call(d,a[h])<e?f=h+1:g=h}return f},z.toArray=function(a){return a?z.isArray(a)?j.call(a):a.length===+a.length?z.map(a,z.identity):z.values(a):[]},z.size=function(a){return null==a?0:a.length===+a.length?a.length:z.keys(a).length},z.first=z.head=z.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:0>b?[]:j.call(a,0,b)},z.initial=function(a,b,c){return j.call(a,0,a.length-(null==b||c?1:b))},z.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:j.call(a,Math.max(a.length-b,0))},z.rest=z.tail=z.drop=function(a,b,c){return j.call(a,null==b||c?1:b)},z.compact=function(a){return z.filter(a,z.identity)};var F=function(a,b,c){return b&&z.every(a,z.isArray)?k.apply(c,a):(A(a,function(a){z.isArray(a)||z.isArguments(a)?b?i.apply(c,a):F(a,b,c):c.push(a)}),c)};z.flatten=function(a,b){return F(a,b,[])},z.without=function(a){return z.difference(a,j.call(arguments,1))},z.partition=function(a,b){var c=[],d=[];return A(a,function(a){(b(a)?c:d).push(a)}),[c,d]},z.uniq=z.unique=function(a,b,c,d){z.isFunction(b)&&(d=c,c=b,b=!1);var e=c?z.map(a,c,d):a,f=[],g=[];return A(e,function(c,d){(b?d&&g[g.length-1]===c:z.contains(g,c))||(g.push(c),f.push(a[d]))}),f},z.union=function(){return z.uniq(z.flatten(arguments,!0))},z.intersection=function(a){var b=j.call(arguments,1);return z.filter(z.uniq(a),function(a){return z.every(b,function(b){return z.contains(b,a)})})},z.difference=function(a){var b=k.apply(f,j.call(arguments,1));return z.filter(a,function(a){return!z.contains(b,a)})},z.zip=function(){for(var a=z.max(z.pluck(arguments,"length").concat(0)),b=new Array(a),c=0;a>c;c++)b[c]=z.pluck(arguments,""+c);return b},z.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},z.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=z.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(u&&a.indexOf===u)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},z.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(v&&a.lastIndexOf===v)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},z.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);d>e;)f[e++]=a,a+=c;return f};var G=function(){};z.bind=function(a,b){var c,d;if(y&&a.bind===y)return y.apply(a,j.call(arguments,1));if(!z.isFunction(a))throw new TypeError;return c=j.call(arguments,2),d=function(){if(!(this instanceof d))return a.apply(b,c.concat(j.call(arguments)));G.prototype=a.prototype;var e=new G;G.prototype=null;var f=a.apply(e,c.concat(j.call(arguments)));return Object(f)===f?f:e}},z.partial=function(a){var b=j.call(arguments,1);return function(){for(var c=0,d=b.slice(),e=0,f=d.length;f>e;e++)d[e]===z&&(d[e]=arguments[c++]);for(;c<arguments.length;)d.push(arguments[c++]);return a.apply(this,d)}},z.bindAll=function(a){var b=j.call(arguments,1);if(0===b.length)throw new Error("bindAll must be passed function names");return A(b,function(b){a[b]=z.bind(a[b],a)}),a},z.memoize=function(a,b){var c={};return b||(b=z.identity),function(){var d=b.apply(this,arguments);return z.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},z.delay=function(a,b){var c=j.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},z.defer=function(a){return z.delay.apply(z,[a,1].concat(j.call(arguments,1)))},z.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:z.now(),g=null,f=a.apply(d,e),d=e=null};return function(){var j=z.now();h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k?(clearTimeout(g),g=null,h=j,f=a.apply(d,e),d=e=null):g||c.trailing===!1||(g=setTimeout(i,k)),f}},z.debounce=function(a,b,c){var d,e,f,g,h,i=function(){var j=z.now()-g;b>j?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),f=e=null))};return function(){f=this,e=arguments,g=z.now();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}},z.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},z.wrap=function(a,b){return z.partial(b,a)},z.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},z.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},z.keys=function(a){if(!z.isObject(a))return[];if(x)return x(a);var b=[];for(var c in a)z.has(a,c)&&b.push(c);return b},z.values=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},z.pairs=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},z.invert=function(a){for(var b={},c=z.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},z.functions=z.methods=function(a){var b=[];for(var c in a)z.isFunction(a[c])&&b.push(c);return b.sort()},z.extend=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},z.pick=function(a){var b={},c=k.apply(f,j.call(arguments,1));return A(c,function(c){c in a&&(b[c]=a[c])}),b},z.omit=function(a){var b={},c=k.apply(f,j.call(arguments,1));for(var d in a)z.contains(c,d)||(b[d]=a[d]);return b},z.defaults=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)void 0===a[c]&&(a[c]=b[c])}),a},z.clone=function(a){return z.isObject(a)?z.isArray(a)?a.slice():z.extend({},a):a},z.tap=function(a,b){return b(a),a};var H=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof z&&(a=a._wrapped),b instanceof z&&(b=b._wrapped);var e=l.call(a);if(e!=l.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;var g=a.constructor,h=b.constructor;if(g!==h&&!(z.isFunction(g)&&g instanceof g&&z.isFunction(h)&&h instanceof h)&&"constructor"in a&&"constructor"in b)return!1;c.push(a),d.push(b);var i=0,j=!0;if("[object Array]"==e){if(i=a.length,j=i==b.length)for(;i--&&(j=H(a[i],b[i],c,d)););}else{for(var k in a)if(z.has(a,k)&&(i++,!(j=z.has(b,k)&&H(a[k],b[k],c,d))))break;if(j){for(k in b)if(z.has(b,k)&&!i--)break;j=!i}}return c.pop(),d.pop(),j};z.isEqual=function(a,b){return H(a,b,[],[])},z.isEmpty=function(a){if(null==a)return!0;if(z.isArray(a)||z.isString(a))return 0===a.length;for(var b in a)if(z.has(a,b))return!1;return!0},z.isElement=function(a){return!(!a||1!==a.nodeType)},z.isArray=w||function(a){return"[object Array]"==l.call(a)},z.isObject=function(a){return a===Object(a)},A(["Arguments","Function","String","Number","Date","RegExp"],function(a){z["is"+a]=function(b){return l.call(b)=="[object "+a+"]"}}),z.isArguments(arguments)||(z.isArguments=function(a){return!(!a||!z.has(a,"callee"))}),"function"!=typeof/./&&(z.isFunction=function(a){return"function"==typeof a}),z.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},z.isNaN=function(a){return z.isNumber(a)&&a!=+a},z.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==l.call(a)},z.isNull=function(a){return null===a},z.isUndefined=function(a){return void 0===a},z.has=function(a,b){return m.call(a,b)},z.noConflict=function(){return a._=d,this},z.identity=function(a){return a},z.constant=function(a){return function(){return a}},z.property=function(a){return function(b){return b[a]}},z.matches=function(a){return function(b){if(b===a)return!0;for(var c in a)if(a[c]!==b[c])return!1;return!0}},z.times=function(a,b,c){for(var d=Array(Math.max(0,a)),e=0;a>e;e++)d[e]=b.call(c,e);return d},z.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))},z.now=Date.now||function(){return(new Date).getTime()};var I={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};I.unescape=z.invert(I.escape);var J={escape:new RegExp("["+z.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+z.keys(I.unescape).join("|")+")","g")};z.each(["escape","unescape"],function(a){z[a]=function(b){return null==b?"":(""+b).replace(J[a],function(b){return I[a][b]})}}),z.result=function(a,b){if(null==a)return void 0;var c=a[b];return z.isFunction(c)?c.call(a):c},z.mixin=function(a){A(z.functions(a),function(b){var c=z[b]=a[b];z.prototype[b]=function(){var a=[this._wrapped];return i.apply(a,arguments),O.call(this,c.apply(z,a))}})};var K=0;z.uniqueId=function(a){var b=++K+"";return a?a+b:b},z.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var L=/(.)^/,M={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},N=/\\|'|\r|\n|\t|\u2028|\u2029/g;z.template=function(a,b,c){var d;c=z.defaults({},c,z.templateSettings);var e=new RegExp([(c.escape||L).source,(c.interpolate||L).source,(c.evaluate||L).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(N,function(a){return"\\"+M[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=new Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,z);var i=function(a){return d.call(this,a,z)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},z.chain=function(a){return z(a).chain()};var O=function(a){return this._chain?z(a).chain():a};z.mixin(z),A(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=f[a];z.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],O.call(this,c)}}),A(["concat","join","slice"],function(a){var b=f[a];z.prototype[a]=function(){return O.call(this,b.apply(this._wrapped,arguments))}}),z.extend(z.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return z})}).call(this)},{}],66:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:10,sinon:50,"sinon-chai":49,underscore:65}],67:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/TextYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/TextYatta.coffee":4,chai:10,sinon:50,"sinon-chai":49,underscore:65}],68:[function(a){var b,c,d,e,f,g,h,i,j,k=function(a,b){return function(){return a.apply(b,arguments)}};e=a("chai"),f=e.expect,g=e.should(),h=a("sinon"),i=a("sinon-chai"),j=a("underscore"),e.use(i),d=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee"),c=function(){function a(){this.applyRandomOp=k(this.applyRandomOp,this),this.generateRandomOp=k(this.generateRandomOp,this),this.generateDeleteOp=k(this.generateDeleteOp,this),this.generateReplaceOp=k(this.generateReplaceOp,this),this.generateInsertOp=k(this.generateInsertOp,this),this.number_of_test_cases_multiplier=1,this.repeat_this=1*this.number_of_test_cases_multiplier,this.doSomething_amount=5e3*this.number_of_test_cases_multiplier,this.number_of_engines=10+this.number_of_test_cases_multiplier-1,this.time=0,this.ops=0,this.time_now=0,this.reinitialize()}return a.prototype.reinitialize=function(){var a,c,e,f;for(this.users=[],this.Connector=b(this.users),this.users.push(new d(0,this.Connector)),this.users[0].val("name","initial"),f=[],a=c=1,e=this.number_of_engines;e>=1?e>c:c>e;a=e>=1?++c:--c)f.push(this.users.push(new d(a,this.Connector)));return f},a.prototype.getSomeUser=function(){var a;return a=j.random(0,this.users.length-1),this.users[a]},a.prototype.getRandomText=function(){var a,b,c,d;return a="abcdefghijklmnopqrstuvwxyz",b=j.random(0,10),c=a[j.random(0,a.length-1)],d="",j(b).times(function(){return d+=c}),d},a.prototype.generateInsertOp=function(a){var b;return b=j.random(0,this.users[a].val("name").val().length-1),this.users[a].val("name").insertText(b,this.getRandomText()),null},a.prototype.generateReplaceOp=function(a){return this.users[a].val("name").replaceText(this.getRandomText()),null},a.prototype.generateDeleteOp=function(a){var b,c,d;return void(this.users[a].val("name").val().length>0&&(d=j.random(0,this.users[a].val("name").val().length-1),b=1,c=this.users[a].val("name").deleteText(d,b)))},a.prototype.generateRandomOp=function(a){var b,c,d;return d=[this.generateDeleteOp,this.generateInsertOp,this.generateReplaceOp],b=j.random(d.length-1),c=d[b](a)},a.prototype.applyRandomOp=function(a){var b;return b=this.users[a],b.getConnector().flushOneRandom()},a.prototype.doSomething=function(){var a,b,c;return c=j.random(this.number_of_engines-1),b=[this.applyRandomOp,this.generateRandomOp],a=j.random(b.length-1),b[a](c)},a.prototype.flushAll=function(){var a,b,c,d,e,f;for(e=this.users,f=[],b=c=0,d=e.length;d>c;b=++c)a=e[b],f.push(a.getConnector().flushAll());return f},a.prototype.compareAll=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;for(this.flushAll(),this.time+=(new Date).getTime()-this.time_now,d=0,b=i=0,m=this.users.length;m>=0?m>i:i>m;b=m>=0?++i:--i)d+=this.users[b].getConnector().getOpsInExecutionOrder().length;for(this.ops+=d*this.users.length,f=Math.floor(this.ops/this.time),null!=a&&console.log(""+a+"/"+this.repeat_this+": Every collaborator ("+this.users.length+") applied "+d+" ops in a different order."+(" Over all we consumed "+this.ops+" operations in "+this.time/1e3+" seconds ("+f+" ops/msek).")),o=[],b=j=0,n=this.users.length-1;n>=0?n>j:j>n;b=n>=0?++j:--j)if(this.users[b].val("name").val()!==this.users[b+1].val("name").val()){for(g=function(a,b){var c,d,e,f,g,h,i,j;for(e=this.users[a].getConnector().getOpsInExecutionOrder(),g=0,i=e.length;i>g;g++)f=e[g],console.log(JSON.stringify(f));for(console.log(""),f="ops = [",c=h=0,j=e.length;j>h;c=++h)d=e[c],0!==c&&(f+=", "),f+="op"+c;return f+="]",console.log(f),console.log("@users[@last_user].ot.applyOps ops"),console.log("expect(@users[@last_user].ot.val('name')).to.equal(\""+users[b].val("name")+'")'),e},console.log(""),console.log("Found an OT Puzzle!"),console.log("OT states:"),c=k=0,l=users.length;l>k;c=++k)h=users[c],console.log("OT"+c+": "+h.val("name"));console.log("\nOT execution order ("+b+","+(b+1)+"):"),g(b,b+1),console.log(""),e=g(b+1,b),o.push(console.log(""))}else o.push(void 0);return o},a.prototype.run=function(){var a,b,c,d,e,f,g;for(console.log(""),g=[],b=c=1,e=this.repeat_this;e>=1?e>=c:c>=e;b=e>=1?++c:--c){for(this.time_now=(new Date).getTime(),a=d=1,f=this.doSomething_amount;f>=1?f>=d:d>=f;a=f>=1?++d:--d)this.doSomething();this.compareAll(b),g.push(this.reinitialize())}return g},a}(),describe("JsonYatta",function(){return beforeEach(function(a){return this.yTest=new c,a()}),it("has a JsonWrapper",function(){var a,b;return b=this.yTest.getSomeUser().root_element,b.val("x","dtrn","immutable"),b.val("set",{x:"x"},"immutable"),a=b.value,a.x,a.set={y:""},a.x,a.set,a.set.x,f(a.x).to.equal("dtrn"),f(a.set.x).to.equal("x")}),it("can handle creaton of complex json",function(){return this.yTest.getSomeUser().val("x",{a:"b"}),this.yTest.getSomeUser().val("a",{a:{q:"dtrndtrtdrntdrnrtdnrtdnrtdnrtdnrdnrdt"}}),this.yTest.getSomeUser().val("b",{a:{}}),this.yTest.getSomeUser().val("c",{a:"c"}),this.yTest.getSomeUser().val("c",{a:"b"}),this.yTest.compareAll(),this.yTest.getSomeUser().value.a.a.q.insertText(0,"AAA"),this.yTest.compareAll(),f(this.yTest.getSomeUser().value.a.a.q.val()).to.equal("AAAdtrndtrtdrntdrnrtdnrtdnrtdnrtdnrdnrdt")}),it("handles some immutable tests",function(){return this.yTest.getSomeUser().val("string","text","immutable"),this.yTest.getSomeUser().val("number",4,"immutable"),this.yTest.getSomeUser().val("object",{q:"rr"},"immutable"),this.yTest.compareAll(),f(this.yTest.getSomeUser().val("string")).to.equal("text"),f(this.yTest.getSomeUser().val("number")).to.equal(4),f(this.yTest.getSomeUser().val("object").val("q")).to.equal("rr")}),it("can handle many engines, many operations, concurrently (random)",function(){return this.yTest.run()})})},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:10,sinon:50,"sinon-chai":49,underscore:65}]},{},[66,67,68]),!function b(a,c,d){function e(g,h){if(!c[g]){if(!a[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};a[g][0].call(j.exports,function(b){var c=a[g][1][b];return e(c?c:b)},j,j.exports,b,a,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){var c;c=a("underscore"),b.exports=function(a){var b;return b=function(){function b(b,c,d){var e,f;this.engine=b,this.HB=c,this.execution_listener=d,f=function(a){return function(b){return a.send(b)}}(this),this.execution_listener.push(f),this.applied_operations=[],e=function(a){return function(b){return a.applied_operations.push(b)}}(this),this.execution_listener.push(e),0!==(null!=a?a.length:void 0)&&this.engine.applyOps(a[0].getHistoryBuffer()._encode()),this.unexecuted={}}return b.prototype.getOpsInExecutionOrder=function(){return this.applied_operations},b.prototype.getRootElement=function(){return a.length>0?a[0].getRootElement().getUid():void 0},b.prototype.send=function(b){var c,d,e,f;if(b.uid.creator===this.HB.getUserId()&&"string"!=typeof b.uid.op_number){for(f=[],d=0,e=a.length;e>d;d++)c=a[d],f.push(c.getUserId()!==this.HB.getUserId()?c.getConnector().receive(b):void 0);return f}},b.prototype.receive=function(a){var b,c;return null==(b=this.unexecuted)[c=a.creator]&&(b[c]=[]),this.unexecuted[a.creator].push(a)},b.prototype.flushOne=function(a){var b;return(null!=(b=this.unexecuted[a])?b.length:void 0)>0?this.engine.applyOp(this.unexecuted[a].shift()):void 0},b.prototype.flushOneRandom=function(){return this.flushOne(c.random(0,a.length-1))},b.prototype.flushAll=function(){var a,b,c;c=this.unexecuted;for(a in c)b=c[a],this.engine.applyOps(b);return this.unexecuted={}},b.prototype.sync=function(){throw new Error("Can't use this a.t.m.")},b}()}},{underscore:65}],2:[function(a,b){var c;c=function(){function a(a,b){this.HB=a,this.parser=b,this.unprocessed_ops=[]}return a.prototype.parseOperation=function(a){var b;if(b=this.parser[a.type],null!=b)return b(a);throw new Error("You forgot to specify a parser for type "+a.type+". The message is "+JSON.stringify(a)+".")},a.prototype.applyOps=function(a){var b,c,d,e,f,g,h,i;for(c=[],d=0,g=a.length;g>d;d++)b=a[d],c.push(this.parseOperation(b));for(e=0,h=c.length;h>e;e++)b=c[e],this.HB.addOperation(b);for(f=0,i=c.length;i>f;f++)b=c[f],b.execute()||this.unprocessed_ops.push(b);return this.tryUnprocessed()},a.prototype.applyOp=function(a){var b;return b=this.parseOperation(a),this.HB.addOperation(b),b.execute()||this.unprocessed_ops.push(b),this.tryUnprocessed()},a.prototype.tryUnprocessed=function(){var a,b,c,d,e,f,g;for(g=[];;){for(a=this.unprocessed_ops.length,c=[],f=this.unprocessed_ops,d=0,e=f.length;e>d;d++)b=f[d],b.execute()||c.push(b);if(this.unprocessed_ops=c,this.unprocessed_ops.length===a)break;g.push(void 0)}return g},a}(),b.exports=c},{}],3:[function(a,b){var c,d,e,f;f=a("../Types/JsonTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),g=f(this.HB),this.engine=new c(this.HB,g.parser),this.connector=new b(this.engine,this.HB,g.execution_listener,this),h=this.connector.getRootElement(),null==h?(e=new g.types.JsonType(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=e):this.root_element=this.HB.getOperation(h)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.setMutableDefault=function(a){return this.root_element.setMutableDefault(a)},a.prototype.getUserId=function(){return this.HB.getUserId()},a.prototype.val=function(a,b,c){return this.root_element.val(a,b,c)},Object.defineProperty(a.prototype,"value",{get:function(){return this.root_element.value},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),a}(),"undefined"!=typeof window&&null!==window&&(window.JsonYatta=e),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/JsonTypes.coffee":7}],4:[function(a,b){var c,d,e,f;f=a("../Types/TextTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),h=f(this.HB),this.engine=new c(this.HB,h.parser),this.connector=new b(this.engine,this.HB,h.execution_listener),g=this.connector.getRootElement(),null==g?(e=new h.types.Word(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=this.HB.addOperation(new h.types.ReplaceManager(e,this.HB.getNextOperationIdentifier())).execute()):this.root_element=this.HB.getOperation(g)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.getUserId=function(){return this.HB.getUserId()},a.prototype.val=function(){return this.root_element.val().val()},a.prototype.insertText=function(a,b){return this.root_element.val().insertText(a,b)},a.prototype.deleteText=function(a,b){return this.root_element.val().deleteText(a,b)},a.prototype.replaceText=function(a){return this.root_element.val().replaceText(a)},a}(),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/TextTypes.coffee":9}],5:[function(a,b){var c;c=function(){function a(a){this.user_id=a,this.operation_counter={},this.buffer={},this.change_listeners=[]}return a.prototype.getUserId=function(){return this.user_id},a.prototype.getOperationCounter=function(){var a,b,c,d;b={},d=this.operation_counter;for(c in d)a=d[c],b[c]=a;return b},a.prototype._encode=function(){var a,b,c,d,e,f;a=[],f=this.buffer;for(d in f){e=f[d];for(c in e)b=e[c],isNaN(parseInt(c))||a.push(b._encode())}return a},a.prototype.getNextOperationIdentifier=function(a){var b;return null==a&&(a=this.user_id),null==this.operation_counter[a]&&(this.operation_counter[a]=0),b={creator:a,op_number:this.operation_counter[a]},this.operation_counter[a]++,b},a.prototype.getOperation=function(a){var b;if(a instanceof Object)return null!=(b=this.buffer[a.creator])?b[a.op_number]:void 0;if(null!=a)throw new Error("This type of uid is not defined!")},a.prototype.addOperation=function(a){if(null==this.buffer[a.creator]&&(this.buffer[a.creator]={}),null==this.operation_counter[a.creator]&&(this.operation_counter[a.creator]=0),null!=this.buffer[a.creator][a.op_number])throw new Error("You must not overwrite operations!");return this.buffer[a.creator][a.op_number]=a,"number"==typeof a.op_number&&a.creator!==this.getUserId()&&this.operation_counter[a.creator]++,a},a}(),b.exports=c},{}],6:[function(a,b){var c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};b.exports=function(a){var b,c,e,f,g,h,i;return i={},h=[],g=function(){function b(b){null==b&&(b=a.getNextOperationIdentifier()),this.creator=b.creator,this.op_number=b.op_number}return b.prototype.getUid=function(){return{creator:this.creator,op_number:this.op_number}},b.prototype.execute=function(){var a,b,c;for(this.is_executed=!0,b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this},b.prototype.saveOperation=function(a,b){return null!=(null!=b?b.execute:void 0)?this[a]=b:null!=b?(null==this.unchecked&&(this.unchecked={}),this.unchecked[a]=b):void 0},b.prototype.validateSavedOperations=function(){var b,c,d,e,f,g;f={},e=this,g=this.unchecked;for(b in g)d=g[b],c=a.getOperation(d),c?this[b]=c:(f[b]=d,e=!1);return delete this.unchecked,e||(this.unchecked=f),e},b}(),b=function(a){function b(a,c){this.saveOperation("deletes",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype._encode=function(){return{type:"Delete",uid:this.getUid(),deletes:this.deletes.getUid()}},b.prototype.execute=function(){return this.validateSavedOperations()?(this.deletes.applyDelete(this),b.__super__.execute.apply(this,arguments),this):!1},b}(g),i.Delete=function(a){var c,d;return d=a.uid,c=a.deletes,new b(d,c)},f=function(a){function b(a,c,d,e){this.saveOperation("prev_cl",c),this.saveOperation("next_cl",d),null!=e?this.saveOperation("origin",e):this.saveOperation("origin",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype.applyDelete=function(a){return null==this.deleted_by&&(this.deleted_by=[]),this.deleted_by.push(a)},b.prototype.isDeleted=function(){var a;return(null!=(a=this.deleted_by)?a.length:void 0)>0},b.prototype.getDistanceToOrigin=function(){var a,b;for(a=0,b=this.prev_cl;this.origin!==b;){if(a++,this===this.prev_cl)throw new Error("this should not happen ;) ");b=b.prev_cl}return a},b.prototype.update_sl=function(){var a;return a=this.prev_cl,update("prev_cl","prev_sl"),update("next_cl","prev_sl")},b.prototype.execute=function(){var a,c,d,e,f;if(null!=this.is_executed)return this;if(this.validateSavedOperations()){if((null!=(e=this.prev_cl)?e.validateSavedOperations():void 0)&&(null!=(f=this.next_cl)?f.validateSavedOperations():void 0)&&this.prev_cl.next_cl!==this){for(a=0,d=this.prev_cl.next_cl,c=0;null==d&&(console.log(JSON.stringify(this.prev_cl.getUid())),console.log(JSON.stringify(this.next_cl.getUid()))),d!==this.next_cl;){if(d.getDistanceToOrigin()===c)d.creator<this.creator&&(this.prev_cl=d,a=c+1);else{if(!(d.getDistanceToOrigin()<c))break;c-a<=d.getDistanceToOrigin()&&(this.prev_cl=d,a=c+1)
|
||
}c++,d=d.next_cl}this.next_cl=this.prev_cl.next_cl,this.prev_cl.next_cl=this,this.next_cl.prev_cl=this}return b.__super__.execute.apply(this,arguments),this}return!1},b}(g),e=function(a){function b(a,c,d,e,f){this.content=null!=c?c:"",b.__super__.constructor.call(this,a,d,e,f)}return d(b,a),b.prototype.val=function(){return this.content},b.prototype._encode=function(){var a;return a={type:"ImmutableObject",uid:this.getUid(),content:this.content},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(f),i.ImmutableObject=function(a){var b,c,d,f,g;return g=a.uid,b=a.content,f=a.prev,c=a.next,d=a.origin,new e(g,b,f,c,d)},c=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return d(b,a),b.prototype.execute=function(){var a,b,c;if(this.validateSavedOperations()){for(b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this}return!1},b.prototype._encode=function(){var a,b;return{type:"Delimiter",uid:this.getUid(),prev:null!=(a=this.prev_cl)?a.getUid():void 0,next:null!=(b=this.next_cl)?b.getUid():void 0}},b}(f),i.Delimiter=function(a){var b,d,e;return e=a.uid,d=a.prev,b=a.next,new c(e,d,b)},{types:{Delete:b,Insert:f,Delimiter:c,Operation:g,ImmutableObject:e},parser:i,execution_listener:h}}},{}],7:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./TextTypes.coffee"),b.exports=function(a){var b,d,f,g,h;return g=c(a),h=g.types,f=g.parser,d=function(a){var c;return new(c=function(){function a(c){var e,f,g,i;i=c.map,g=function(e,f){return Object.defineProperty(a.prototype,e,{get:function(){var a;return a=f.val(),a instanceof b?d(a):a instanceof h.ImmutableObject?a.val():a},set:function(a){var b,d,f,g;if(a.constructor==={}.constructor){f=c.val(e),g=[];for(b in a)d=a[b],g.push(f.val(b,d,"immutable"));return g}return c.val(e,a,"immutable")},enumerable:!0,configurable:!1})};for(e in i)f=i[e],g(e,f)}return a}())(a)},b=function(b){function c(a,b,d){var e,f;if(c.__super__.constructor.call(this,a),null!=b){if("object"!=typeof b)throw new Error("The initial value of JsonTypes must be of type Object! (current type: "+typeof b+")");for(e in b)f=b[e],this.val(e,f,d)}}return e(c,b),c.prototype.mutable_default=!0,c.prototype.setMutableDefault=function(a){if(a===!0||"mutable"===a)c.prototype.mutable_default=!0;else{if(a!==!1&&"immutable"!==a)throw new Error('Set mutable either "mutable" or "immutable"!');c.prototype.mutable_default=!1}return"OK"},c.prototype.val=function(b,d,e){var f,g,i,j,k;if("object"==typeof b){for(i in b)g=b[i],this.val(i,g,d);return this}if(null!=b&&null!=d){if(e=null!=e?e===!0||"mutable"===e?!0:!1:this.mutable_default,"function"==typeof d)return this;if(e&&"number"!=typeof d||d.constructor===Object){if("string"==typeof d)return k=a.addOperation(new h.Word(a.getNextOperationIdentifier(),d)).execute(),c.__super__.val.call(this,b,k);if(d.constructor===Object)return f=a.addOperation(new c(a.getNextOperationIdentifier(),d,e)).execute(),c.__super__.val.call(this,b,f);throw new Error("You must not set "+typeof d+"-types in collaborative Json-objects!")}return j=a.addOperation(new h.ImmutableObject(void 0,d)).execute(),c.__super__.val.call(this,b,j)}return c.__super__.val.call(this,b,d)},Object.defineProperty(c.prototype,"value",{get:function(){return d(this)},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),c.prototype._encode=function(){return{type:"JsonType",uid:this.getUid()}},c}(h.MapManager),f.JsonType=function(a){var c;return c=a.uid,new b(c)},h.JsonType=b,g}},{"./TextTypes.coffee":9}],8:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./BasicTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i,j,k;return i=c(a),k=i.types,j=i.parser,f=function(c){function d(a){this.map={},d.__super__.constructor.call(this,a)}return e(d,c),d.prototype.val=function(c,e){var f,g,h,i,j;if(null!=e)return null==this.map[c]&&a.addOperation(new b(a.getNextOperationIdentifier(),this,c)).execute(),this.map[c].replace(e),this;if(null!=c)return g=null!=(i=this.map[c])?i.val():void 0,g instanceof k.ImmutableObject?g.val():g;h={},j=this.map;for(c in j)f=j[c],g=f.val(),(g instanceof k.ImmutableObject||g instanceof d)&&(g=g.val()),h[c]=g;return h},d}(k.Operation),b=function(b){function c(a,b,d){this.name=d,this.saveOperation("map_manager",b),c.__super__.constructor.call(this,a)}return e(c,b),c.prototype.execute=function(){var b,d,e,f,h;return this.validateSavedOperations()?(h=this.map_manager.getUid(),h.op_number="_"+h.op_number+"_RM_"+this.name,null==a.getOperation(h)&&(e=this.map_manager.getUid(),e.op_number="_"+e.op_number+"_RM_"+this.name+"_beginning",f=this.map_manager.getUid(),f.op_number="_"+f.op_number+"_RM_"+this.name+"_end",b=a.addOperation(new k.Delimiter(e,void 0,f)),d=a.addOperation(new k.Delimiter(f,b,void 0)).execute(),b.execute(),this.map_manager.map[this.name]=a.addOperation(new g(void 0,h,b,d)).execute()),c.__super__.execute.apply(this,arguments)):!1},c.prototype._encode=function(){return{type:"AddName",uid:this.getUid(),map_manager:this.map_manager.getUid(),name:this.name}},c}(k.Operation),j.AddName=function(a){var c,d,e;return c=a.map_manager,e=a.uid,d=a.name,new b(e,c,d)},d=function(b){function c(b,d,e,f,g,h){null!=d&&null!=e?(this.saveOperation("beginning",d),this.saveOperation("end",e)):(this.beginning=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),void 0,void 0)),this.end=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),this.beginning,void 0)),this.beginning.next_cl=this.end,this.beginning.execute(),this.end.execute()),c.__super__.constructor.call(this,b,f,g,h)}return e(c,b),c.prototype.getLastOperation=function(){return this.end.prev_cl},c.prototype.getFirstOperation=function(){return this.beginning.next_cl},c.prototype.toArray=function(){var a,b;for(a=this.beginning.next_cl,b=[];a!==this.end;)b.push(a),a=a.next_cl;return b},c.prototype.getOperationByPosition=function(a){var b;if(b=this.beginning.next_cl,a>0)for(;b=b.next_cl,b.isDeleted()||(a-=1),0!==a;)if(b instanceof k.Delimiter)throw new Error("position parameter exceeded the length of the document!");return b},c}(k.Insert),g=function(b){function c(a,b,d,e,f,g,h){c.__super__.constructor.call(this,b,d,e,f,g,h),null!=a&&this.replace(a)}return e(c,b),c.prototype.replace=function(b){var c,d;return c=this.getLastOperation(),d=new h(b,this,a.getNextOperationIdentifier(),c,c.next_cl),a.addOperation(d).execute()},c.prototype.val=function(){var a;if(a=this.getLastOperation(),a instanceof k.Delimiter)throw new Error("dtrn");return a.val()},c.prototype._encode=function(){var a;return a={type:"ReplaceManager",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&null!=this.next_cl&&(a.prev=this.prev_cl.getUid(),a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},c}(d),j.ReplaceManager=function(a){var b,c,d,e,f,h,i;return c=a.content,i=a.uid,h=a.prev,e=a.next,f=a.origin,b=a.beginning,d=a.end,new g(c,i,b,d,h,e,f)},h=function(a){function b(a,c,d,e,f,g){if(this.saveOperation("content",a),this.saveOperation("parent",c),null==e||null==f||null==a)throw new Error("You must define content, prev, and next for Replaceable-types!");b.__super__.constructor.call(this,d,e,f,g)}return e(b,a),b.prototype.val=function(){return this.content},b.prototype.replace=function(a){return this.parent.replace(a)},b.prototype.execute=function(){var a;return this.validateSavedOperations()?("function"==typeof(a=this.content).setReplaceManager&&a.setReplaceManager(this.parent),b.__super__.execute.apply(this,arguments),this):!1},b.prototype._encode=function(){var a;return a={type:"Replaceable",content:this.content.getUid(),ReplaceManager:this.parent.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid(),uid:this.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(k.Insert),j.Replaceable=function(a){var b,c,d,e,f,g;return b=a.content,e=a.ReplaceManager,g=a.uid,f=a.prev,c=a.next,d=a.origin,new h(b,e,g,f,c,d)},k.ListManager=d,k.MapManager=f,k.ReplaceManager=g,k.Replaceable=h,i}},{"./BasicTypes.coffee":6}],9:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./StructuredTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i;return h=c(a),i=h.types,g=h.parser,b=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return e(b,a),b}(i.Delete),g.TextDelete=g.Delete,d=function(a){function b(a,c,d,e,f){if(this.content=a,null==d||null==e)throw new Error("You must define prev, and next for TextInsert-types!");b.__super__.constructor.call(this,c,d,e,f)}return e(b,a),b.prototype.getLength=function(){return this.isDeleted()?0:this.content.length},b.prototype.val=function(){return this.isDeleted()?"":this.content},b.prototype._encode=function(){var a;return a={type:"TextInsert",content:this.content,uid:this.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(i.Insert),g.TextInsert=function(a){var b,c,e,f,g;return b=a.content,g=a.uid,f=a.prev,c=a.next,e=a.origin,new d(b,g,f,c,e)},f=function(c){function f(a,b,c,d,e,g,h){f.__super__.constructor.call(this,a,c,d,e,g,h),null!=b&&this.insertText(0,b)}return e(f,c),f.prototype.insertText=function(b,c){var e,f,g,h,i,j;for(f=this.getOperationByPosition(b),j=[],h=0,i=c.length;i>h;h++)e=c[h],g=new d(e,a.getNextOperationIdentifier(),f.prev_cl,f),j.push(a.addOperation(g).execute());return j},f.prototype.deleteText=function(c,d){var e,f,g,h,j;for(g=this.getOperationByPosition(c),j=[],f=h=0;d>=0?d>h:h>d;f=d>=0?++h:--h){for(e=a.addOperation(new b(a.getNextOperationIdentifier(),g)).execute(),g=g.next_cl;g.isDeleted();){if(g instanceof i.Delimiter)throw new Error("You can't delete more than there is..");g=g.next_cl}j.push(e._encode())}return j},f.prototype.replaceText=function(b){var c;if(null!=this.replace_manager)return c=a.addOperation(new f(a.getNextOperationIdentifier())).execute(),c.insertText(0,b),this.replace_manager.replace(c);throw new Error("This type is currently not maintained by a ReplaceManager!")},f.prototype.val=function(){var a,b;return a=function(){var a,c,d,e;for(d=this.toArray(),e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(null!=b.val?b.val():"");return e}.call(this),a.join("")},f.prototype.setReplaceManager=function(a){return this.saveOperation("replace_manager",a),this.validateSavedOperations},f.prototype._encode=function(){var a;return a={type:"Word",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},f}(i.ListManager),g.Word=function(a){var b,c,d,e,g,h;return h=a.uid,b=a.beginning,c=a.end,g=a.prev,d=a.next,e=a.origin,new f(h,void 0,b,c,g,d,e)},i.TextInsert=d,i.TextDelete=b,i.Word=f,h}},{"./StructuredTypes.coffee":8}],10:[function(a,b){b.exports=a("./lib/chai")},{"./lib/chai":11}],11:[function(a,b,c){var d=[],c=b.exports={};c.version="1.9.1",c.AssertionError=a("assertion-error");var e=a("./chai/utils");c.use=function(a){return~d.indexOf(a)||(a(this,e),d.push(a)),this};var f=a("./chai/config");c.config=f;var g=a("./chai/assertion");c.use(g);var h=a("./chai/core/assertions");c.use(h);var i=a("./chai/interface/expect");c.use(i);var j=a("./chai/interface/should");c.use(j);var k=a("./chai/interface/assert");c.use(k)},{"./chai/assertion":12,"./chai/config":13,"./chai/core/assertions":14,"./chai/interface/assert":15,"./chai/interface/expect":16,"./chai/interface/should":17,"./chai/utils":28,"assertion-error":37}],12:[function(a,b){var c=a("./config");b.exports=function(a,b){function d(a,b,c){f(this,"ssfi",c||arguments.callee),f(this,"object",a),f(this,"message",b)}var e=a.AssertionError,f=b.flag;a.Assertion=d,Object.defineProperty(d,"includeStack",{get:function(){return console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack},set:function(a){console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack=a}}),Object.defineProperty(d,"showDiff",{get:function(){return console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff},set:function(a){console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff=a}}),d.addProperty=function(a,c){b.addProperty(this.prototype,a,c)},d.addMethod=function(a,c){b.addMethod(this.prototype,a,c)},d.addChainableMethod=function(a,c,d){b.addChainableMethod(this.prototype,a,c,d)},d.overwriteProperty=function(a,c){b.overwriteProperty(this.prototype,a,c)},d.overwriteMethod=function(a,c){b.overwriteMethod(this.prototype,a,c)},d.overwriteChainableMethod=function(a,c,d){b.overwriteChainableMethod(this.prototype,a,c,d)},d.prototype.assert=function(a,d,g,h,i,j){var k=b.test(this,arguments);if(!0!==j&&(j=!1),!0!==c.showDiff&&(j=!1),!k){var d=b.getMessage(this,arguments),l=b.getActual(this,arguments);throw new e(d,{actual:l,expected:h,showDiff:j},c.includeStack?this.assert:f(this,"ssfi"))}},Object.defineProperty(d.prototype,"_obj",{get:function(){return f(this,"object")},set:function(a){f(this,"object",a)}})}},{"./config":13}],13:[function(a,b){b.exports={includeStack:!1,showDiff:!0,truncateThreshold:40}},{}],14:[function(a,b){b.exports=function(a,b){function c(a,c){c&&u(this,"message",c),a=a.toLowerCase();var d=u(this,"object"),e=~["a","e","i","o","u"].indexOf(a.charAt(0))?"an ":"a ";this.assert(a===b.type(d),"expected #{this} to be "+e+a,"expected #{this} not to be "+e+a)}function d(){u(this,"contains",!0)}function e(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=!1;if("array"===b.type(d)&&"object"===b.type(a)){for(var f in d)if(b.eql(d[f],a)){e=!0;break}}else if("object"===b.type(a)){if(!u(this,"negate")){for(var g in a)new t(d).property(g,a[g]);return}var h={};for(var g in a)h[g]=d[g];e=b.eql(h,a)}else e=d&&~d.indexOf(a);this.assert(e,"expected #{this} to include "+b.inspect(a),"expected #{this} to not include "+b.inspect(a))}function f(){var a=u(this,"object"),b=Object.prototype.toString.call(a);this.assert("[object Arguments]"===b,"expected #{this} to be arguments but got "+b,"expected #{this} to not be arguments")}function g(a,b){b&&u(this,"message",b);var c=u(this,"object");return u(this,"deep")?this.eql(a):void this.assert(a===c,"expected #{this} to equal #{exp}","expected #{this} to not equal #{exp}",a,this._obj,!0)}function h(a,c){c&&u(this,"message",c),this.assert(b.eql(a,u(this,"object")),"expected #{this} to deeply equal #{exp}","expected #{this} to not deeply equal #{exp}",a,this._obj,!0)}function i(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>a,"expected #{this} to have a length above #{exp} but got #{act}","expected #{this} to not have a length above #{exp}",a,d)}else this.assert(c>a,"expected #{this} to be above "+a,"expected #{this} to be at most "+a)}function j(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>=a,"expected #{this} to have a length at least #{exp} but got #{act}","expected #{this} to have a length below #{exp}",a,d)}else this.assert(c>=a,"expected #{this} to be at least "+a,"expected #{this} to be below "+a)}function k(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(a>d,"expected #{this} to have a length below #{exp} but got #{act}","expected #{this} to not have a length below #{exp}",a,d)}else this.assert(a>c,"expected #{this} to be below "+a,"expected #{this} to be at least "+a)}function l(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(a>=d,"expected #{this} to have a length at most #{exp} but got #{act}","expected #{this} to have a length above #{exp}",a,d)}else this.assert(a>=c,"expected #{this} to be at most "+a,"expected #{this} to be above "+a)}function m(a,c){c&&u(this,"message",c);var d=b.getName(a);this.assert(u(this,"object")instanceof a,"expected #{this} to be an instance of "+d,"expected #{this} to not be an instance of "+d)}function n(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(d.hasOwnProperty(a),"expected #{this} to have own property "+b.inspect(a),"expected #{this} to not have own property "+b.inspect(a))}function o(){u(this,"doLength",!0)}function p(a,b){b&&u(this,"message",b);var c=u(this,"object");new t(c,b).to.have.property("length");var d=c.length;this.assert(d==a,"expected #{this} to have a length of #{exp} but got #{act}","expected #{this} to not have a length of #{act}",a,d)}function q(a){var c,d=u(this,"object"),e=!0;if(a=a instanceof Array?a:Array.prototype.slice.call(arguments),!a.length)throw new Error("keys required");var f=Object.keys(d),g=a.length;if(e=a.every(function(a){return~f.indexOf(a)}),u(this,"negate")||u(this,"contains")||(e=e&&a.length==f.length),g>1){a=a.map(function(a){return b.inspect(a)});var h=a.pop();c=a.join(", ")+", and "+h}else c=b.inspect(a[0]);c=(g>1?"keys ":"key ")+c,c=(u(this,"contains")?"contain ":"have ")+c,this.assert(e,"expected #{this} to "+c,"expected #{this} to not "+c)}function r(a,c,d){d&&u(this,"message",d);var e=u(this,"object");new t(e,d).is.a("function");var f=!1,g=null,h=null,i=null;0===arguments.length?(c=null,a=null):a&&(a instanceof RegExp||"string"==typeof a)?(c=a,a=null):a&&a instanceof Error?(g=a,a=null,c=null):"function"==typeof a?(h=a.prototype.name||a.name,"Error"===h&&a!==Error&&(h=(new a).name)):a=null;try{e()}catch(j){if(g)return this.assert(j===g,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}",g instanceof Error?g.toString():g,j instanceof Error?j.toString():j),u(this,"object",j),this;if(a&&(this.assert(j instanceof a,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp} but #{act} was thrown",h,j instanceof Error?j.toString():j),!c))return u(this,"object",j),this;var k="object"===b.type(j)&&"message"in j?j.message:""+j;if(null!=k&&c&&c instanceof RegExp)return this.assert(c.exec(k),"expected #{this} to throw error matching #{exp} but got #{act}","expected #{this} to throw error not matching #{exp}",c,k),u(this,"object",j),this;if(null!=k&&c&&"string"==typeof c)return this.assert(~k.indexOf(c),"expected #{this} to throw error including #{exp} but got #{act}","expected #{this} to throw error not including #{act}",c,k),u(this,"object",j),this;f=!0,i=j}var l="",m=null!==h?h:g?"#{exp}":"an error";f&&(l=" but #{act} was thrown"),this.assert(f===!0,"expected #{this} to throw "+m+l,"expected #{this} to not throw "+m+l,g instanceof Error?g.toString():g,i instanceof Error?i.toString():i),u(this,"object",i)}function s(a,b,c){return a.every(function(a){return c?b.some(function(b){return c(a,b)}):-1!==b.indexOf(a)})}var t=a.Assertion,u=(Object.prototype.toString,b.flag);["to","be","been","is","and","has","have","with","that","at","of","same"].forEach(function(a){t.addProperty(a,function(){return this})}),t.addProperty("not",function(){u(this,"negate",!0)}),t.addProperty("deep",function(){u(this,"deep",!0)}),t.addChainableMethod("an",c),t.addChainableMethod("a",c),t.addChainableMethod("include",e,d),t.addChainableMethod("contain",e,d),t.addProperty("ok",function(){this.assert(u(this,"object"),"expected #{this} to be truthy","expected #{this} to be falsy")}),t.addProperty("true",function(){this.assert(!0===u(this,"object"),"expected #{this} to be true","expected #{this} to be false",this.negate?!1:!0)}),t.addProperty("false",function(){this.assert(!1===u(this,"object"),"expected #{this} to be false","expected #{this} to be true",this.negate?!0:!1)}),t.addProperty("null",function(){this.assert(null===u(this,"object"),"expected #{this} to be null","expected #{this} not to be null")}),t.addProperty("undefined",function(){this.assert(void 0===u(this,"object"),"expected #{this} to be undefined","expected #{this} not to be undefined")}),t.addProperty("exist",function(){this.assert(null!=u(this,"object"),"expected #{this} to exist","expected #{this} to not exist")}),t.addProperty("empty",function(){var a=u(this,"object"),b=a;Array.isArray(a)||"string"==typeof object?b=a.length:"object"==typeof a&&(b=Object.keys(a).length),this.assert(!b,"expected #{this} to be empty","expected #{this} not to be empty")}),t.addProperty("arguments",f),t.addProperty("Arguments",f),t.addMethod("equal",g),t.addMethod("equals",g),t.addMethod("eq",g),t.addMethod("eql",h),t.addMethod("eqls",h),t.addMethod("above",i),t.addMethod("gt",i),t.addMethod("greaterThan",i),t.addMethod("least",j),t.addMethod("gte",j),t.addMethod("below",k),t.addMethod("lt",k),t.addMethod("lessThan",k),t.addMethod("most",l),t.addMethod("lte",l),t.addMethod("within",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object"),e=a+".."+b;if(u(this,"doLength")){new t(d,c).to.have.property("length");var f=d.length;this.assert(f>=a&&b>=f,"expected #{this} to have a length within "+e,"expected #{this} to not have a length within "+e)}else this.assert(d>=a&&b>=d,"expected #{this} to be within "+e,"expected #{this} to not be within "+e)}),t.addMethod("instanceof",m),t.addMethod("instanceOf",m),t.addMethod("property",function(a,c,d){d&&u(this,"message",d);var e=u(this,"deep")?"deep property ":"property ",f=u(this,"negate"),g=u(this,"object"),h=u(this,"deep")?b.getPathValue(a,g):g[a];if(f&&void 0!==c){if(void 0===h)throw d=null!=d?d+": ":"",new Error(d+b.inspect(g)+" has no "+e+b.inspect(a))}else this.assert(void 0!==h,"expected #{this} to have a "+e+b.inspect(a),"expected #{this} to not have "+e+b.inspect(a));void 0!==c&&this.assert(c===h,"expected #{this} to have a "+e+b.inspect(a)+" of #{exp}, but got #{act}","expected #{this} to not have a "+e+b.inspect(a)+" of #{act}",c,h),u(this,"object",h)}),t.addMethod("ownProperty",n),t.addMethod("haveOwnProperty",n),t.addChainableMethod("length",p,o),t.addMethod("lengthOf",p,o),t.addMethod("match",function(a,b){b&&u(this,"message",b);var c=u(this,"object");this.assert(a.exec(c),"expected #{this} to match "+a,"expected #{this} not to match "+a)}),t.addMethod("string",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d,c).is.a("string"),this.assert(~d.indexOf(a),"expected #{this} to contain "+b.inspect(a),"expected #{this} to not contain "+b.inspect(a))}),t.addMethod("keys",q),t.addMethod("key",q),t.addMethod("throw",r),t.addMethod("throws",r),t.addMethod("Throw",r),t.addMethod("respondTo",function(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=u(this,"itself"),f="function"!==b.type(d)||e?d[a]:d.prototype[a];this.assert("function"==typeof f,"expected #{this} to respond to "+b.inspect(a),"expected #{this} to not respond to "+b.inspect(a))}),t.addProperty("itself",function(){u(this,"itself",!0)}),t.addMethod("satisfy",function(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(a(d),"expected #{this} to satisfy "+b.objDisplay(a),"expected #{this} to not satisfy"+b.objDisplay(a),this.negate?!1:!0,a(d))}),t.addMethod("closeTo",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(Math.abs(d-a)<=b,"expected #{this} to be close to "+a+" +/- "+b,"expected #{this} not to be close to "+a+" +/- "+b)}),t.addMethod("members",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d).to.be.an("array"),new t(a).to.be.an("array");var e=u(this,"deep")?b.eql:void 0;return u(this,"contains")?this.assert(s(a,d,e),"expected #{this} to be a superset of #{act}","expected #{this} to not be a superset of #{act}",d,a):void this.assert(s(d,a,e)&&s(a,d,e),"expected #{this} to have the same members as #{act}","expected #{this} to not have the same members as #{act}",d,a)})}},{}],15:[function(require,module,exports){module.exports=function(chai,util){var Assertion=chai.Assertion,flag=util.flag,assert=chai.assert=function(a,b){var c=new Assertion(null,null,chai.assert);c.assert(a,b,"[ negation message unavailable ]")};assert.fail=function(a,b,c,d){throw c=c||"assert.fail()",new chai.AssertionError(c,{actual:a,expected:b,operator:d},assert.fail)},assert.ok=function(a,b){new Assertion(a,b).is.ok},assert.notOk=function(a,b){new Assertion(a,b).is.not.ok},assert.equal=function(a,b,c){var d=new Assertion(a,c,assert.equal);d.assert(b==flag(d,"object"),"expected #{this} to equal #{exp}","expected #{this} to not equal #{act}",b,a)},assert.notEqual=function(a,b,c){var d=new Assertion(a,c,assert.notEqual);d.assert(b!=flag(d,"object"),"expected #{this} to not equal #{exp}","expected #{this} to equal #{act}",b,a)},assert.strictEqual=function(a,b,c){new Assertion(a,c).to.equal(b)},assert.notStrictEqual=function(a,b,c){new Assertion(a,c).to.not.equal(b)},assert.deepEqual=function(a,b,c){new Assertion(a,c).to.eql(b)},assert.notDeepEqual=function(a,b,c){new Assertion(a,c).to.not.eql(b)},assert.isTrue=function(a,b){new Assertion(a,b).is["true"]},assert.isFalse=function(a,b){new Assertion(a,b).is["false"]},assert.isNull=function(a,b){new Assertion(a,b).to.equal(null)},assert.isNotNull=function(a,b){new Assertion(a,b).to.not.equal(null)},assert.isUndefined=function(a,b){new Assertion(a,b).to.equal(void 0)},assert.isDefined=function(a,b){new Assertion(a,b).to.not.equal(void 0)},assert.isFunction=function(a,b){new Assertion(a,b).to.be.a("function")},assert.isNotFunction=function(a,b){new Assertion(a,b).to.not.be.a("function")},assert.isObject=function(a,b){new Assertion(a,b).to.be.a("object")},assert.isNotObject=function(a,b){new Assertion(a,b).to.not.be.a("object")},assert.isArray=function(a,b){new Assertion(a,b).to.be.an("array")},assert.isNotArray=function(a,b){new Assertion(a,b).to.not.be.an("array")},assert.isString=function(a,b){new Assertion(a,b).to.be.a("string")},assert.isNotString=function(a,b){new Assertion(a,b).to.not.be.a("string")},assert.isNumber=function(a,b){new Assertion(a,b).to.be.a("number")},assert.isNotNumber=function(a,b){new Assertion(a,b).to.not.be.a("number")},assert.isBoolean=function(a,b){new Assertion(a,b).to.be.a("boolean")},assert.isNotBoolean=function(a,b){new Assertion(a,b).to.not.be.a("boolean")},assert.typeOf=function(a,b,c){new Assertion(a,c).to.be.a(b)},assert.notTypeOf=function(a,b,c){new Assertion(a,c).to.not.be.a(b)},assert.instanceOf=function(a,b,c){new Assertion(a,c).to.be.instanceOf(b)},assert.notInstanceOf=function(a,b,c){new Assertion(a,c).to.not.be.instanceOf(b)},assert.include=function(a,b,c){new Assertion(a,c,assert.include).include(b)},assert.notInclude=function(a,b,c){new Assertion(a,c,assert.notInclude).not.include(b)},assert.match=function(a,b,c){new Assertion(a,c).to.match(b)},assert.notMatch=function(a,b,c){new Assertion(a,c).to.not.match(b)},assert.property=function(a,b,c){new Assertion(a,c).to.have.property(b)},assert.notProperty=function(a,b,c){new Assertion(a,c).to.not.have.property(b)},assert.deepProperty=function(a,b,c){new Assertion(a,c).to.have.deep.property(b)},assert.notDeepProperty=function(a,b,c){new Assertion(a,c).to.not.have.deep.property(b)},assert.propertyVal=function(a,b,c,d){new Assertion(a,d).to.have.property(b,c)},assert.propertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.property(b,c)},assert.deepPropertyVal=function(a,b,c,d){new Assertion(a,d).to.have.deep.property(b,c)},assert.deepPropertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.deep.property(b,c)},assert.lengthOf=function(a,b,c){new Assertion(a,c).to.have.length(b)},assert.Throw=function(a,b,c,d){("string"==typeof b||b instanceof RegExp)&&(c=b,b=null);var e=new Assertion(a,d).to.Throw(b,c);return flag(e,"object")},assert.doesNotThrow=function(a,b,c){"string"==typeof b&&(c=b,b=null),new Assertion(a,c).to.not.Throw(b)},assert.operator=function(val,operator,val2,msg){if(!~["==","===",">",">=","<","<=","!=","!=="].indexOf(operator))throw new Error('Invalid operator "'+operator+'"');var test=new Assertion(eval(val+operator+val2),msg);test.assert(!0===flag(test,"object"),"expected "+util.inspect(val)+" to be "+operator+" "+util.inspect(val2),"expected "+util.inspect(val)+" to not be "+operator+" "+util.inspect(val2))},assert.closeTo=function(a,b,c,d){new Assertion(a,d).to.be.closeTo(b,c)},assert.sameMembers=function(a,b,c){new Assertion(a,c).to.have.same.members(b)},assert.includeMembers=function(a,b,c){new Assertion(a,c).to.include.members(b)},assert.ifError=function(a,b){new Assertion(a,b).to.not.be.ok},function a(b,c){return assert[c]=assert[b],a}("Throw","throw")("Throw","throws")}},{}],16:[function(a,b){b.exports=function(a){a.expect=function(b,c){return new a.Assertion(b,c)}}},{}],17:[function(a,b){b.exports=function(a){function b(){function a(){return this instanceof String||this instanceof Number?new c(this.constructor(this),null,a):this instanceof Boolean?new c(1==this,null,a):new c(this,null,a)}function b(a){Object.defineProperty(this,"should",{value:a,enumerable:!0,configurable:!0,writable:!0})}Object.defineProperty(Object.prototype,"should",{set:b,get:a,configurable:!0});var d={};return d.equal=function(a,b,d){new c(a,d).to.equal(b)},d.Throw=function(a,b,d,e){new c(a,e).to.Throw(b,d)},d.exist=function(a,b){new c(a,b).to.exist},d.not={},d.not.equal=function(a,b,d){new c(a,d).to.not.equal(b)},d.not.Throw=function(a,b,d,e){new c(a,e).to.not.Throw(b,d)},d.not.exist=function(a,b){new c(a,b).to.not.exist},d["throw"]=d.Throw,d.not["throw"]=d.not.Throw,d}var c=a.Assertion;a.should=b,a.Should=b}},{}],18:[function(a,b){var c=a("./transferFlags"),d=a("./flag"),e=a("../config"),f="__proto__"in Object,g=/^(?:length|name|arguments|caller)$/,h=Function.prototype.call,i=Function.prototype.apply;b.exports=function(a,b,j,k){"function"!=typeof k&&(k=function(){});var l={method:j,chainingBehavior:k};a.__methods||(a.__methods={}),a.__methods[b]=l,Object.defineProperty(a,b,{get:function(){l.chainingBehavior.call(this);var b=function m(){var a=d(this,"ssfi");a&&e.includeStack===!1&&d(this,"ssfi",m);var b=l.method.apply(this,arguments);return void 0===b?this:b};if(f){var j=b.__proto__=Object.create(this);j.call=h,j.apply=i}else{var k=Object.getOwnPropertyNames(a);k.forEach(function(c){if(!g.test(c)){var d=Object.getOwnPropertyDescriptor(a,c);Object.defineProperty(b,c,d)}})}return c(this,b),b},configurable:!0})}},{"../config":13,"./flag":21,"./transferFlags":35}],19:[function(a,b){var c=a("../config"),d=a("./flag");b.exports=function(a,b,e){a[b]=function(){var f=d(this,"ssfi");f&&c.includeStack===!1&&d(this,"ssfi",a[b]);var g=e.apply(this,arguments);return void 0===g?this:g}}},{"../config":13,"./flag":21}],20:[function(a,b){b.exports=function(a,b,c){Object.defineProperty(a,b,{get:function(){var a=c.call(this);return void 0===a?this:a},configurable:!0})}},{}],21:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));return 3!==arguments.length?d[b]:void(d[b]=c)}},{}],22:[function(a,b){b.exports=function(a,b){return b.length>4?b[4]:a._obj}},{}],23:[function(a,b){b.exports=function(a){var b=[];for(var c in a)b.push(c);return b}},{}],24:[function(a,b){var c=a("./flag"),d=a("./getActual"),e=(a("./inspect"),a("./objDisplay"));b.exports=function(a,b){var f=c(a,"negate"),g=c(a,"object"),h=b[3],i=d(a,b),j=f?b[2]:b[1],k=c(a,"message");
|
||
return j=j||"",j=j.replace(/#{this}/g,e(g)).replace(/#{act}/g,e(i)).replace(/#{exp}/g,e(h)),k?k+": "+j:j}},{"./flag":21,"./getActual":22,"./inspect":29,"./objDisplay":30}],25:[function(a,b){b.exports=function(a){if(a.name)return a.name;var b=/^\s?function ([^(]*)\(/.exec(a);return b&&b[1]?b[1]:""}},{}],26:[function(a,b){function c(a){var b=a.replace(/\[/g,".["),c=b.match(/(\\\.|[^.]+?)+/g);return c.map(function(a){var b=/\[(\d+)\]$/,c=b.exec(a);return c?{i:parseFloat(c[1])}:{p:a}})}function d(a,b){for(var c,d=b,e=0,f=a.length;f>e;e++){var g=a[e];d?("undefined"!=typeof g.p?d=d[g.p]:"undefined"!=typeof g.i&&(d=d[g.i]),e==f-1&&(c=d)):c=void 0}return c}b.exports=function(a,b){var e=c(a);return d(e,b)}},{}],27:[function(a,b){b.exports=function(){function a(a){-1===b.indexOf(a)&&b.push(a)}for(var b=Object.getOwnPropertyNames(subject),c=Object.getPrototypeOf(subject);null!==c;)Object.getOwnPropertyNames(c).forEach(a),c=Object.getPrototypeOf(c);return b}},{}],28:[function(a,b,c){var c=b.exports={};c.test=a("./test"),c.type=a("./type"),c.getMessage=a("./getMessage"),c.getActual=a("./getActual"),c.inspect=a("./inspect"),c.objDisplay=a("./objDisplay"),c.flag=a("./flag"),c.transferFlags=a("./transferFlags"),c.eql=a("deep-eql"),c.getPathValue=a("./getPathValue"),c.getName=a("./getName"),c.addProperty=a("./addProperty"),c.addMethod=a("./addMethod"),c.overwriteProperty=a("./overwriteProperty"),c.overwriteMethod=a("./overwriteMethod"),c.addChainableMethod=a("./addChainableMethod"),c.overwriteChainableMethod=a("./overwriteChainableMethod")},{"./addChainableMethod":18,"./addMethod":19,"./addProperty":20,"./flag":21,"./getActual":22,"./getMessage":24,"./getName":25,"./getPathValue":26,"./inspect":29,"./objDisplay":30,"./overwriteChainableMethod":31,"./overwriteMethod":32,"./overwriteProperty":33,"./test":34,"./transferFlags":35,"./type":36,"deep-eql":38}],29:[function(a,b,c){function d(a,b,c){var d={showHidden:b,seen:[],stylize:function(a){return a}};return e(d,a,"undefined"==typeof c?2:c)}function e(a,b,d){if(b&&"function"==typeof b.inspect&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var o=b.inspect(d);return"string"!=typeof o&&(o=e(a,o,d)),o}var u=f(a,b);if(u)return u;if(t(b))return s(b);var v=r(b),w=a.showHidden?q(b):v;if(0===w.length||n(b)&&(1===w.length&&"stack"===w[0]||2===w.length&&"description"===w[0]&&"stack"===w[1])){if("function"==typeof b){var x=p(b),y=x?": "+x:"";return a.stylize("[Function"+y+"]","special")}if(l(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(m(b))return a.stylize(Date.prototype.toUTCString.call(b),"date");if(n(b))return g(b)}var z="",A=!1,B=["{","}"];if(k(b)&&(A=!0,B=["[","]"]),"function"==typeof b){var x=p(b),y=x?": "+x:"";z=" [Function"+y+"]"}if(l(b)&&(z=" "+RegExp.prototype.toString.call(b)),m(b)&&(z=" "+Date.prototype.toUTCString.call(b)),n(b))return g(b);if(0===w.length&&(!A||0==b.length))return B[0]+z+B[1];if(0>d)return l(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var C;return C=A?h(a,b,d,v,w):w.map(function(c){return i(a,b,d,v,c,A)}),a.seen.pop(),j(C,z,B)}function f(a,b){switch(typeof b){case"undefined":return a.stylize("undefined","undefined");case"string":var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string");case"number":return a.stylize(""+b,"number");case"boolean":return a.stylize(""+b,"boolean")}return null===b?a.stylize("null","null"):void 0}function g(a){return"["+Error.prototype.toString.call(a)+"]"}function h(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(Object.prototype.hasOwnProperty.call(b,String(g))?i(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(i(a,b,c,d,e,!0))}),f}function i(a,b,c,d,f,g){var h,i;if(b.__lookupGetter__&&(b.__lookupGetter__(f)?i=b.__lookupSetter__(f)?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):b.__lookupSetter__(f)&&(i=a.stylize("[Setter]","special"))),d.indexOf(f)<0&&(h="["+f+"]"),i||(a.seen.indexOf(b[f])<0?(i=null===c?e(a,b[f],null):e(a,b[f],c-1),i.indexOf("\n")>-1&&(i=g?i.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+i.split("\n").map(function(a){return" "+a}).join("\n"))):i=a.stylize("[Circular]","special")),"undefined"==typeof h){if(g&&f.match(/^\d+$/))return i;h=JSON.stringify(""+f),h.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(h=h.substr(1,h.length-2),h=a.stylize(h,"name")):(h=h.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),h=a.stylize(h,"string"))}return h+": "+i}function j(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function k(a){return Array.isArray(a)||"object"==typeof a&&"[object Array]"===o(a)}function l(a){return"object"==typeof a&&"[object RegExp]"===o(a)}function m(a){return"object"==typeof a&&"[object Date]"===o(a)}function n(a){return"object"==typeof a&&"[object Error]"===o(a)}function o(a){return Object.prototype.toString.call(a)}var p=a("./getName"),q=a("./getProperties"),r=a("./getEnumerableProperties");b.exports=d;var s=function(a){if("outerHTML"in a)return a.outerHTML;var b,c="http://www.w3.org/1999/xhtml",d=document.createElementNS(c,"_"),e=((window.HTMLElement||window.Element).prototype,new XMLSerializer);return document.xmlVersion?e.serializeToString(a):(d.appendChild(a.cloneNode(!1)),b=d.innerHTML.replace("><",">"+a.innerHTML+"<"),d.innerHTML="",b)},t=function(a){return"object"==typeof HTMLElement?a instanceof HTMLElement:a&&"object"==typeof a&&1===a.nodeType&&"string"==typeof a.nodeName}},{"./getEnumerableProperties":23,"./getName":25,"./getProperties":27}],30:[function(a,b){var c=a("./inspect"),d=a("../config");b.exports=function(a){var b=c(a),e=Object.prototype.toString.call(a);if(d.truncateThreshold&&b.length>=d.truncateThreshold){if("[object Function]"===e)return a.name&&""!==a.name?"[Function: "+a.name+"]":"[Function]";if("[object Array]"===e)return"[ Array("+a.length+") ]";if("[object Object]"===e){var f=Object.keys(a),g=f.length>2?f.splice(0,2).join(", ")+", ...":f.join(", ");return"{ Object ("+g+") }"}return b}return b}},{"../config":13,"./inspect":29}],31:[function(a,b){b.exports=function(a,b,c,d){var e=a.__methods[b],f=e.chainingBehavior;e.chainingBehavior=function(){var a=d(f).call(this);return void 0===a?this:a};var g=e.method;e.method=function(){var a=c(g).apply(this,arguments);return void 0===a?this:a}}},{}],32:[function(a,b){b.exports=function(a,b,c){var d=a[b],e=function(){return this};d&&"function"==typeof d&&(e=d),a[b]=function(){var a=c(e).apply(this,arguments);return void 0===a?this:a}}},{}],33:[function(a,b){b.exports=function(a,b,c){var d=Object.getOwnPropertyDescriptor(a,b),e=function(){};d&&"function"==typeof d.get&&(e=d.get),Object.defineProperty(a,b,{get:function(){var a=c(e).call(this);return void 0===a?this:a},configurable:!0})}},{}],34:[function(a,b){var c=a("./flag");b.exports=function(a,b){var d=c(a,"negate"),e=b[0];return d?!e:e}},{"./flag":21}],35:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));b.__flags||(b.__flags=Object.create(null)),c=3===arguments.length?c:!0;for(var e in d)(c||"object"!==e&&"ssfi"!==e&&"message"!=e)&&(b.__flags[e]=d[e])}},{}],36:[function(a,b){var c={"[object Arguments]":"arguments","[object Array]":"array","[object Date]":"date","[object Function]":"function","[object Number]":"number","[object RegExp]":"regexp","[object String]":"string"};b.exports=function(a){var b=Object.prototype.toString.call(a);return c[b]?c[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}},{}],37:[function(a,b){function c(){function a(a,c){Object.keys(c).forEach(function(d){~b.indexOf(d)||(a[d]=c[d])})}var b=[].slice.call(arguments);return function(){for(var b=[].slice.call(arguments),c=0,d={};c<b.length;c++)a(d,b[c]);return d}}function d(a,b,d){var e=c("name","message","stack","constructor","toJSON"),f=e(b||{});this.message=a||"Unspecified AssertionError",this.showDiff=!1;for(var g in f)this[g]=f[g];d=d||arguments.callee,d&&Error.captureStackTrace&&Error.captureStackTrace(this,d)}b.exports=d,d.prototype=Object.create(Error.prototype),d.prototype.name="AssertionError",d.prototype.constructor=d,d.prototype.toJSON=function(a){var b=c("constructor","toJSON","stack"),d=b({name:this.name},this);return!1!==a&&this.stack&&(d.stack=this.stack),d}},{}],38:[function(a,b){b.exports=a("./lib/eql")},{"./lib/eql":39}],39:[function(a,b){function c(a,b,c){return d(a,b)?!0:"date"===o(a)?f(a,b):"regexp"===o(a)?g(a,b):n.isBuffer(a)?k(a,b):"arguments"===o(a)?h(a,b,c):e(a,b)?"object"!==o(a)&&"object"!==o(b)&&"array"!==o(a)&&"array"!==o(b)?d(a,b):m(a,b,c):!1}function d(a,b){return a===b?0!==a||1/a===1/b:a!==a&&b!==b}function e(a,b){return o(a)===o(b)}function f(a,b){return"date"!==o(b)?!1:d(a.getTime(),b.getTime())}function g(a,b){return"regexp"!==o(b)?!1:d(a.toString(),b.toString())}function h(a,b,d){return"arguments"!==o(b)?!1:(a=[].slice.call(a),b=[].slice.call(b),c(a,b,d))}function i(a){var b=[];for(var c in a)b.push(c);return b}function j(a,b){if(a.length!==b.length)return!1;for(var c=0,d=!0;c<a.length;c++)if(a[c]!==b[c]){d=!1;break}return d}function k(a,b){return n.isBuffer(b)?j(a,b):!1}function l(a){return null!==a&&void 0!==a}function m(a,b,d){if(!l(a)||!l(b))return!1;if(a.prototype!==b.prototype)return!1;var e;if(d){for(e=0;e<d.length;e++)if(d[e][0]===a&&d[e][1]===b||d[e][0]===b&&d[e][1]===a)return!0}else d=[];try{var f=i(a),g=i(b)}catch(h){return!1}if(f.sort(),g.sort(),!j(f,g))return!1;d.push([a,b]);var k;for(e=f.length-1;e>=0;e--)if(k=f[e],!c(a[k],b[k],d))return!1;return!0}var n,o=a("type-detect");try{n=a("buffer").Buffer}catch(p){n={},n.isBuffer=function(){return!1}}b.exports=c},{buffer:42,"type-detect":40}],40:[function(a,b){b.exports=a("./lib/type")},{"./lib/type":41}],41:[function(a,b,c){function d(a){var b=Object.prototype.toString.call(a);return f[b]?f[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}function e(){this.tests={}}var c=b.exports=d,f={"[object Array]":"array","[object RegExp]":"regexp","[object Function]":"function","[object Arguments]":"arguments","[object Date]":"date"};c.Library=e,e.prototype.of=d,e.prototype.define=function(a,b){return 1===arguments.length?this.tests[a]:(this.tests[a]=b,this)},e.prototype.test=function(a,b){if(b===d(a))return!0;var c=this.tests[b];if(c&&"regexp"===d(c))return c.test(a);if(c&&"function"===d(c))return c(a);throw new ReferenceError('Type test "'+b+'" not defined or invalid.')}},{}],42:[function(a,b,c){function d(a,b,c){if(!(this instanceof d))return new d(a,b,c);var e,f=typeof a;if("number"===f)e=a>0?a>>>0:0;else if("string"===f)"base64"===b&&(a=C(a)),e=d.byteLength(a,b);else{if("object"!==f||null===a)throw new Error("First argument needs to be a number, array or string.");"Buffer"===a.type&&E(a.data)&&(a=a.data),e=+a.length>0?Math.floor(+a.length):0}var g;T?g=d._augment(new Uint8Array(e)):(g=this,g.length=e,g._isBuffer=!0);var h;if(T&&"number"==typeof a.byteLength)g._set(a);else if(F(a))if(d.isBuffer(a))for(h=0;e>h;h++)g[h]=a.readUInt8(h);else for(h=0;e>h;h++)g[h]=(a[h]%256+256)%256;else if("string"===f)g.write(a,0,b);else if("number"===f&&!T&&!c)for(h=0;e>h;h++)g[h]=0;return g}function e(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;Q(f%2===0,"Invalid hex string"),d>f/2&&(d=f/2);for(var g=0;d>g;g++){var h=parseInt(b.substr(2*g,2),16);Q(!isNaN(h),"Invalid hex string"),a[c+g]=h}return g}function f(a,b,c,d){var e=L(H(b),a,c,d);return e}function g(a,b,c,d){var e=L(I(b),a,c,d);return e}function h(a,b,c,d){return g(a,b,c,d)}function i(a,b,c,d){var e=L(K(b),a,c,d);return e}function j(a,b,c,d){var e=L(J(b),a,c,d);return e}function k(a,b,c){return R.fromByteArray(0===b&&c===a.length?a:a.slice(b,c))}function l(a,b,c){var d="",e="";c=Math.min(a.length,c);for(var f=b;c>f;f++)a[f]<=127?(d+=M(e)+String.fromCharCode(a[f]),e=""):e+="%"+a[f].toString(16);return d+M(e)}function m(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(a[e]);return d}function n(a,b,c){return m(a,b,c)}function o(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;f++)e+=G(a[f]);return e}function p(a,b,c){for(var d=a.slice(b,c),e="",f=0;f<d.length;f+=2)e+=String.fromCharCode(d[f]+256*d[f+1]);return e}function q(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(f=a[b],e>b+1&&(f|=a[b+1]<<8)):(f=a[b]<<8,e>b+1&&(f|=a[b+1])),f}}function r(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(e>b+2&&(f=a[b+2]<<16),e>b+1&&(f|=a[b+1]<<8),f|=a[b],e>b+3&&(f+=a[b+3]<<24>>>0)):(e>b+1&&(f=a[b+1]<<16),e>b+2&&(f|=a[b+2]<<8),e>b+3&&(f|=a[b+3]),f+=a[b]<<24>>>0),f}}function s(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=q(a,b,c,!0),g=32768&f;return g?-1*(65535-f+1):f}}function t(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=r(a,b,c,!0),g=2147483648&f;return g?-1*(4294967295-f+1):f}}function u(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+3<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,23,4)}function v(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+7<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,52,8)}function w(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"trying to write beyond buffer length"),N(b,65535));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,2);h>g;g++)a[c+g]=(b&255<<8*(d?g:1-g))>>>8*(d?g:1-g);return c+2}}function x(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"trying to write beyond buffer length"),N(b,4294967295));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,4);h>g;g++)a[c+g]=b>>>8*(d?g:3-g)&255;return c+4}}function y(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"Trying to write beyond buffer length"),O(b,32767,-32768));var f=a.length;return c>=f?void 0:(b>=0?w(a,b,c,d,e):w(a,65535+b+1,c,d,e),c+2)}function z(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),O(b,2147483647,-2147483648));var f=a.length;return c>=f?void 0:(b>=0?x(a,b,c,d,e):x(a,4294967295+b+1,c,d,e),c+4)}function A(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),P(b,3.4028234663852886e38,-3.4028234663852886e38));var f=a.length;return c>=f?void 0:(S.write(a,b,c,d,23,4),c+4)}function B(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+7<a.length,"Trying to write beyond buffer length"),P(b,1.7976931348623157e308,-1.7976931348623157e308));var f=a.length;return c>=f?void 0:(S.write(a,b,c,d,52,8),c+8)}function C(a){for(a=D(a).replace(V,"");a.length%4!==0;)a+="=";return a}function D(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function E(a){return(Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)})(a)}function F(a){return E(a)||d.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length}function G(a){return 16>a?"0"+a.toString(16):a.toString(16)}function H(a){for(var b=[],c=0;c<a.length;c++){var d=a.charCodeAt(c);if(127>=d)b.push(d);else{var e=c;d>=55296&&57343>=d&&c++;for(var f=encodeURIComponent(a.slice(e,c+1)).substr(1).split("%"),g=0;g<f.length;g++)b.push(parseInt(f[g],16))}}return b}function I(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function J(a){for(var b,c,d,e=[],f=0;f<a.length;f++)b=a.charCodeAt(f),c=b>>8,d=b%256,e.push(d),e.push(c);return e}function K(a){return R.toByteArray(a)}function L(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);e++)b[e+c]=a[e];return e}function M(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function N(a,b){Q("number"==typeof a,"cannot write a non-number as a number"),Q(a>=0,"specified a negative value for writing an unsigned value"),Q(b>=a,"value is larger than maximum value for type"),Q(Math.floor(a)===a,"value has a fractional component")}function O(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value"),Q(Math.floor(a)===a,"value has a fractional component")}function P(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value")}function Q(a,b){if(!a)throw new Error(b||"Failed assertion")}var R=a("base64-js"),S=a("ieee754");c.Buffer=d,c.SlowBuffer=d,c.INSPECT_MAX_BYTES=50,d.poolSize=8192;var T=function(){try{var a=new ArrayBuffer(0),b=new Uint8Array(a);return b.foo=function(){return 42},42===b.foo()&&"function"==typeof b.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(c){return!1}}();d.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.isBuffer=function(a){return!(null==a||!a._isBuffer)},d.byteLength=function(a,b){var c;switch(a=a.toString(),b||"utf8"){case"hex":c=a.length/2;break;case"utf8":case"utf-8":c=H(a).length;break;case"ascii":case"binary":case"raw":c=a.length;break;case"base64":c=K(a).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":c=2*a.length;break;default:throw new Error("Unknown encoding")}return c},d.concat=function(a,b){if(Q(E(a),"Usage: Buffer.concat(list[, length])"),0===a.length)return new d(0);if(1===a.length)return a[0];var c;if(void 0===b)for(b=0,c=0;c<a.length;c++)b+=a[c].length;var e=new d(b),f=0;for(c=0;c<a.length;c++){var g=a[c];g.copy(e,f),f+=g.length}return e},d.compare=function(a,b){Q(d.isBuffer(a)&&d.isBuffer(b),"Arguments must be Buffers");for(var c=a.length,e=b.length,f=0,g=Math.min(c,e);g>f&&a[f]===b[f];f++);return f!==g&&(c=a[f],e=b[f]),e>c?-1:c>e?1:0},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var k=d;d=b,b=c,c=k}b=Number(b)||0;var l=this.length-b;c?(c=Number(c),c>l&&(c=l)):c=l,d=String(d||"utf8").toLowerCase();var m;switch(d){case"hex":m=e(this,a,b,c);break;case"utf8":case"utf-8":m=f(this,a,b,c);break;case"ascii":m=g(this,a,b,c);break;case"binary":m=h(this,a,b,c);break;case"base64":m=i(this,a,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":m=j(this,a,b,c);break;default:throw new Error("Unknown encoding")}return m},d.prototype.toString=function(a,b,c){var d=this;if(a=String(a||"utf8").toLowerCase(),b=Number(b)||0,c=void 0===c?d.length:Number(c),c===b)return"";var e;switch(a){case"hex":e=o(d,b,c);break;case"utf8":case"utf-8":e=l(d,b,c);break;case"ascii":e=m(d,b,c);break;case"binary":e=n(d,b,c);break;case"base64":e=k(d,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":e=p(d,b,c);break;default:throw new Error("Unknown encoding")}return e},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},d.prototype.equals=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),0===d.compare(this,a)},d.prototype.compare=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),d.compare(this,a)},d.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||0===d||(d=this.length),b||(b=0),d!==c&&0!==a.length&&0!==e.length){Q(d>=c,"sourceEnd < sourceStart"),Q(b>=0&&b<a.length,"targetStart out of bounds"),Q(c>=0&&c<e.length,"sourceStart out of bounds"),Q(d>=0&&d<=e.length,"sourceEnd out of bounds"),d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);var f=d-c;if(100>f||!T)for(var g=0;f>g;g++)a[g+b]=this[g+c];else a._set(this.subarray(c,c+f),b)}},d.prototype.slice=function(a,b){var c=this.length;if(a=~~a,b=void 0===b?c:~~b,0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c),0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c),a>b&&(b=a),T)return d._augment(this.subarray(a,b));for(var e=b-a,f=new d(e,void 0,!0),g=0;e>g;g++)f[g]=this[g+a];return f},d.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},d.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},d.prototype.readUInt8=function(a,b){return b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),a>=this.length?void 0:this[a]},d.prototype.readUInt16LE=function(a,b){return q(this,a,!0,b)},d.prototype.readUInt16BE=function(a,b){return q(this,a,!1,b)},d.prototype.readUInt32LE=function(a,b){return r(this,a,!0,b)},d.prototype.readUInt32BE=function(a,b){return r(this,a,!1,b)},d.prototype.readInt8=function(a,b){if(b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),!(a>=this.length)){var c=128&this[a];return c?-1*(255-this[a]+1):this[a]}},d.prototype.readInt16LE=function(a,b){return s(this,a,!0,b)},d.prototype.readInt16BE=function(a,b){return s(this,a,!1,b)},d.prototype.readInt32LE=function(a,b){return t(this,a,!0,b)},d.prototype.readInt32BE=function(a,b){return t(this,a,!1,b)},d.prototype.readFloatLE=function(a,b){return u(this,a,!0,b)},d.prototype.readFloatBE=function(a,b){return u(this,a,!1,b)},d.prototype.readDoubleLE=function(a,b){return v(this,a,!0,b)},d.prototype.readDoubleBE=function(a,b){return v(this,a,!1,b)},d.prototype.writeUInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"trying to write beyond buffer length"),N(a,255)),b>=this.length?void 0:(this[b]=a,b+1)},d.prototype.writeUInt16LE=function(a,b,c){return w(this,a,b,!0,c)},d.prototype.writeUInt16BE=function(a,b,c){return w(this,a,b,!1,c)},d.prototype.writeUInt32LE=function(a,b,c){return x(this,a,b,!0,c)},d.prototype.writeUInt32BE=function(a,b,c){return x(this,a,b,!1,c)},d.prototype.writeInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"Trying to write beyond buffer length"),O(a,127,-128)),b>=this.length?void 0:(a>=0?this.writeUInt8(a,b,c):this.writeUInt8(255+a+1,b,c),b+1)},d.prototype.writeInt16LE=function(a,b,c){return y(this,a,b,!0,c)},d.prototype.writeInt16BE=function(a,b,c){return y(this,a,b,!1,c)},d.prototype.writeInt32LE=function(a,b,c){return z(this,a,b,!0,c)},d.prototype.writeInt32BE=function(a,b,c){return z(this,a,b,!1,c)},d.prototype.writeFloatLE=function(a,b,c){return A(this,a,b,!0,c)},d.prototype.writeFloatBE=function(a,b,c){return A(this,a,b,!1,c)},d.prototype.writeDoubleLE=function(a,b,c){return B(this,a,b,!0,c)},d.prototype.writeDoubleBE=function(a,b,c){return B(this,a,b,!1,c)},d.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),Q(c>=b,"end < start"),c!==b&&0!==this.length){Q(b>=0&&b<this.length,"start out of bounds"),Q(c>=0&&c<=this.length,"end out of bounds");var d;if("number"==typeof a)for(d=b;c>d;d++)this[d]=a;else{var e=H(a.toString()),f=e.length;for(d=b;c>d;d++)this[d]=e[d%f]}return this}},d.prototype.inspect=function(){for(var a=[],b=this.length,d=0;b>d;d++)if(a[d]=G(this[d]),d===c.INSPECT_MAX_BYTES){a[d+1]="...";break}return"<Buffer "+a.join(" ")+">"},d.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(T)return new d(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;c>b;b+=1)a[b]=this[b];return a.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var U=d.prototype;d._augment=function(a){return a._isBuffer=!0,a._get=a.get,a._set=a.set,a.get=U.get,a.set=U.set,a.write=U.write,a.toString=U.toString,a.toLocaleString=U.toString,a.toJSON=U.toJSON,a.equals=U.equals,a.compare=U.compare,a.copy=U.copy,a.slice=U.slice,a.readUInt8=U.readUInt8,a.readUInt16LE=U.readUInt16LE,a.readUInt16BE=U.readUInt16BE,a.readUInt32LE=U.readUInt32LE,a.readUInt32BE=U.readUInt32BE,a.readInt8=U.readInt8,a.readInt16LE=U.readInt16LE,a.readInt16BE=U.readInt16BE,a.readInt32LE=U.readInt32LE,a.readInt32BE=U.readInt32BE,a.readFloatLE=U.readFloatLE,a.readFloatBE=U.readFloatBE,a.readDoubleLE=U.readDoubleLE,a.readDoubleBE=U.readDoubleBE,a.writeUInt8=U.writeUInt8,a.writeUInt16LE=U.writeUInt16LE,a.writeUInt16BE=U.writeUInt16BE,a.writeUInt32LE=U.writeUInt32LE,a.writeUInt32BE=U.writeUInt32BE,a.writeInt8=U.writeInt8,a.writeInt16LE=U.writeInt16LE,a.writeInt16BE=U.writeInt16BE,a.writeInt32LE=U.writeInt32LE,a.writeInt32BE=U.writeInt32BE,a.writeFloatLE=U.writeFloatLE,a.writeFloatBE=U.writeFloatBE,a.writeDoubleLE=U.writeDoubleLE,a.writeDoubleBE=U.writeDoubleBE,a.fill=U.fill,a.inspect=U.inspect,a.toArrayBuffer=U.toArrayBuffer,a};var V=/[^+\/0-9A-z]/g},{"base64-js":43,ieee754:44}],43:[function(a,b,c){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(a){"use strict";function b(a){var b=a.charCodeAt(0);return b===g?62:b===h?63:i>b?-1:i+10>b?b-i+26+26:k+26>b?b-k:j+26>b?b-j+26:void 0}function c(a){function c(a){j[l++]=a}var d,e,g,h,i,j;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new f(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,e=0;g>d;d+=4,e+=3)h=b(a.charAt(d))<<18|b(a.charAt(d+1))<<12|b(a.charAt(d+2))<<6|b(a.charAt(d+3)),c((16711680&h)>>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function e(a){function b(a){return d.charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var e,f,g,h=a.length%3,i="";for(e=0,g=a.length-h;g>e;e+=3)f=(a[e]<<16)+(a[e+1]<<8)+a[e+2],i+=c(f);switch(h){case 1:f=a[a.length-1],i+=b(f>>2),i+=b(f<<4&63),i+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],i+=b(f>>10),i+=b(f>>4&63),i+=b(f<<2&63),i+="="}return i}var f="undefined"!=typeof Uint8Array?Uint8Array:Array,g="+".charCodeAt(0),h="/".charCodeAt(0),i="0".charCodeAt(0),j="a".charCodeAt(0),k="A".charCodeAt(0);a.toByteArray=c,a.fromByteArray=e}("undefined"==typeof c?this.base64js={}:c)},{}],44:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],45:[function(a,b){b.exports="function"==typeof Object.create?function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],46:[function(a,b){function c(){}var d=b.exports={};d.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var d=c.shift();d()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.binding=function(){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(){throw new Error("process.chdir is not supported")}},{}],47:[function(a,b){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8}},{}],48:[function(a,b,c){(function(b,d){function e(a,b){var d={seen:[],stylize:g};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),p(b)?d.showHidden=b:b&&c._extend(d,b),v(d.showHidden)&&(d.showHidden=!1),v(d.depth)&&(d.depth=2),v(d.colors)&&(d.colors=!1),v(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=f),i(d,a,d.depth)}function f(a,b){var c=e.styles[b];return c?"["+e.colors[c][0]+"m"+a+"["+e.colors[c][1]+"m":a}function g(a){return a}function h(a){var b={};return a.forEach(function(a){b[a]=!0}),b}function i(a,b,d){if(a.customInspect&&b&&A(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return t(e)||(e=i(a,e,d)),e}var f=j(a,b);if(f)return f;var g=Object.keys(b),p=h(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),z(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return k(b);if(0===g.length){if(A(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(w(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(y(b))return a.stylize(Date.prototype.toString.call(b),"date");if(z(b))return k(b)}var r="",s=!1,u=["{","}"];if(o(b)&&(s=!0,u=["[","]"]),A(b)){var v=b.name?": "+b.name:"";r=" [Function"+v+"]"}if(w(b)&&(r=" "+RegExp.prototype.toString.call(b)),y(b)&&(r=" "+Date.prototype.toUTCString.call(b)),z(b)&&(r=" "+k(b)),0===g.length&&(!s||0==b.length))return u[0]+r+u[1];if(0>d)return w(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var x;return x=s?l(a,b,d,p,g):g.map(function(c){return m(a,b,d,p,c,s)}),a.seen.pop(),n(x,r,u)}function j(a,b){if(v(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return s(b)?a.stylize(""+b,"number"):p(b)?a.stylize(""+b,"boolean"):q(b)?a.stylize("null","null"):void 0}function k(a){return"["+Error.prototype.toString.call(a)+"]"}function l(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(F(b,String(g))?m(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(m(a,b,c,d,e,!0))}),f}function m(a,b,c,d,e,f){var g,h,j;if(j=Object.getOwnPropertyDescriptor(b,e)||{value:b[e]},j.get?h=j.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):j.set&&(h=a.stylize("[Setter]","special")),F(d,e)||(g="["+e+"]"),h||(a.seen.indexOf(j.value)<0?(h=q(c)?i(a,j.value,null):i(a,j.value,c-1),h.indexOf("\n")>-1&&(h=f?h.split("\n").map(function(a){return" "+a
|
||
}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),v(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function n(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function o(a){return Array.isArray(a)}function p(a){return"boolean"==typeof a}function q(a){return null===a}function r(a){return null==a}function s(a){return"number"==typeof a}function t(a){return"string"==typeof a}function u(a){return"symbol"==typeof a}function v(a){return void 0===a}function w(a){return x(a)&&"[object RegExp]"===C(a)}function x(a){return"object"==typeof a&&null!==a}function y(a){return x(a)&&"[object Date]"===C(a)}function z(a){return x(a)&&("[object Error]"===C(a)||a instanceof Error)}function A(a){return"function"==typeof a}function B(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function C(a){return Object.prototype.toString.call(a)}function D(a){return 10>a?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),J[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=/%[sdj%]/g;c.format=function(a){if(!t(a)){for(var b=[],c=0;c<arguments.length;c++)b.push(e(arguments[c]));return b.join(" ")}for(var c=1,d=arguments,f=d.length,g=String(a).replace(G,function(a){if("%%"===a)return"%";if(c>=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(b){return"[Circular]"}default:return a}}),h=d[c];f>c;h=d[++c])g+=q(h)||!x(h)?" "+h:" "+e(h);return g},c.deprecate=function(a,e){function f(){if(!g){if(b.throwDeprecation)throw new Error(e);b.traceDeprecation?console.trace(e):console.error(e),g=!0}return a.apply(this,arguments)}if(v(d.process))return function(){return c.deprecate(a,e).apply(this,arguments)};if(b.noDeprecation===!0)return a;var g=!1;return f};var H,I={};c.debuglog=function(a){if(v(H)&&(H=b.env.NODE_DEBUG||""),a=a.toUpperCase(),!I[a])if(new RegExp("\\b"+a+"\\b","i").test(H)){var d=b.pid;I[a]=function(){var b=c.format.apply(c,arguments);console.error("%s %d: %s",a,d,b)}}else I[a]=function(){};return I[a]},c.inspect=e,e.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},e.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},c.isArray=o,c.isBoolean=p,c.isNull=q,c.isNullOrUndefined=r,c.isNumber=s,c.isString=t,c.isSymbol=u,c.isUndefined=v,c.isRegExp=w,c.isObject=x,c.isDate=y,c.isError=z,c.isFunction=A,c.isPrimitive=B,c.isBuffer=a("./support/isBuffer");var J=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c.log=function(){console.log("%s - %s",E(),c.format.apply(c,arguments))},c.inherits=a("inherits"),c._extend=function(a,b){if(!b||!x(b))return a;for(var c=Object.keys(b),d=c.length;d--;)a[c[d]]=b[c[d]];return a}}).call(this,a("JkpR2F"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":47,JkpR2F:46,inherits:45}],49:[function(a,b,c){!function(d){"use strict";"function"==typeof a&&"object"==typeof c&&"object"==typeof b?b.exports=d:"function"==typeof define&&define.amd?define(function(){return d}):chai.use(d)}(function(a,b){"use strict";function c(a){return"function"==typeof a&&"function"==typeof a.getCall&&"function"==typeof a.calledWithExactly}function d(a){return 1===a?"once":2===a?"twice":3===a?"thrice":(a||0)+" times"}function e(a){return a&&c(a.proxy)}function f(a){if(!c(a._obj)&&!e(a._obj))throw new TypeError(b.inspect(a._obj)+" is not a spy or a call to a spy!")}function g(a,b,d,e,f){function g(b){return a.printf.apply(a,b)}var h=e?"always have ":"have ";return d=d||"",c(a.proxy)&&(a=a.proxy),{affirmative:g(["expected %n to "+h+b+d].concat(f)),negative:g(["expected %n to not "+h+b].concat(f))}}function h(c,d,e){b.addProperty(a.Assertion.prototype,c,function(){f(this);var a=g(this._obj,d,e,!1);this.assert(this._obj[c],a.affirmative,a.negative)})}function i(c,e,h){b.addMethod(a.Assertion.prototype,c,function(a){f(this);var b=g(this._obj,e,h,!1,[d(a)]);this.assert(this._obj[c]===a,b.affirmative,b.negative)})}function j(a,c,d){return function(){f(this);var e="always"+a[0].toUpperCase()+a.substring(1),h=b.flag(this,"always")&&"function"==typeof this._obj[e],i=h?e:a,j=g(this._obj,c,d,h,n.call(arguments));this.assert(this._obj[i].apply(this._obj,arguments),j.affirmative,j.negative)}}function k(c,d,e){var f=j(c,d,e);b.addProperty(a.Assertion.prototype,c,f)}function l(c,d,e,f){var g=j(d,e,f);b.addMethod(a.Assertion.prototype,c,g)}function m(a,b,c){l(a,a,b,c)}var n=Array.prototype.slice;b.addProperty(a.Assertion.prototype,"always",function(){b.flag(this,"always",!0)}),h("called","been called"," at least once, but it was never called"),i("callCount","been called exactly %1",", but it was called %c%C"),h("calledOnce","been called exactly once",", but it was called %c%C"),h("calledTwice","been called exactly twice",", but it was called %c%C"),h("calledThrice","been called exactly thrice",", but it was called %c%C"),k("calledWithNew","been called with new"),m("calledBefore","been called before %1"),m("calledAfter","been called after %1"),m("calledOn","been called with %1 as this",", but it was called with %t instead"),m("calledWith","been called with arguments %*","%C"),m("calledWithExactly","been called with exact arguments %*","%C"),m("calledWithMatch","been called with arguments matching %*","%C"),m("returned","returned %1"),l("thrown","threw","thrown %1")})},{}],50:[function(a,b,c){"use strict";!function(d){function e(a){var b=!1;try{a.appendChild(l),b=l.parentNode==a}catch(c){return!1}finally{try{a.removeChild(l)}catch(c){}}return b}function f(a){return l&&a&&1===a.nodeType&&e(a)}function g(a){return"function"==typeof a||!!(a&&a.constructor&&a.call&&a.apply)}function h(a){return"number"==typeof a&&isNaN(a)}function i(a,b){for(var c in b)m.call(a,c)||(a[c]=b[c])}function j(a){return"function"==typeof a&&"function"==typeof a.restore&&a.restore.sinon}function k(a,b,c){c.exports=n,n.spy=a("./sinon/spy"),n.spyCall=a("./sinon/call"),n.behavior=a("./sinon/behavior"),n.stub=a("./sinon/stub"),n.mock=a("./sinon/mock"),n.collection=a("./sinon/collection"),n.assert=a("./sinon/assert"),n.sandbox=a("./sinon/sandbox"),n.test=a("./sinon/test"),n.testCase=a("./sinon/test_case"),n.match=a("./sinon/match")}var l="undefined"!=typeof document&&document.createElement("div"),m=Object.prototype.hasOwnProperty,n={wrapMethod:function(a,b,c){if(!a)throw new TypeError("Should wrap property of object");if("function"!=typeof c)throw new TypeError("Method wrapper should be function");var d,e=a[b];if(g(e)){if(e.restore&&e.restore.sinon)d=new TypeError("Attempted to wrap "+b+" which is already wrapped");else if(e.calledBefore){var f=e.returns?"stubbed":"spied on";d=new TypeError("Attempted to wrap "+b+" which is already "+f)}}else d=new TypeError("Attempted to wrap "+typeof e+" property "+b+" as function");if(d)throw e&&e._stack&&(d.stack+="\n--------------\n"+e._stack),d;var h=a.hasOwnProperty?a.hasOwnProperty(b):m.call(a,b);return a[b]=c,c.displayName=b,c._stack=new Error("Stack Trace for original").stack,c.restore=function(){h||delete a[b],a[b]===c&&(a[b]=e)},c.restore.sinon=!0,i(c,e),c},extend:function(a){for(var b=1,c=arguments.length;c>b;b+=1)for(var d in arguments[b])arguments[b].hasOwnProperty(d)&&(a[d]=arguments[b][d]),arguments[b].hasOwnProperty("toString")&&arguments[b].toString!=a.toString&&(a.toString=arguments[b].toString);return a},create:function(a){var b=function(){};return b.prototype=a,new b},deepEqual:function t(a,b){if(n.match&&n.match.isMatcher(a))return a.test(b);if("object"!=typeof a||"object"!=typeof b)return h(a)&&h(b)?!0:a===b;if(f(a)||f(b))return a===b;if(a===b)return!0;if(null===a&&null!==b||null!==a&&null===b)return!1;if(a instanceof RegExp&&b instanceof RegExp)return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;var c=Object.prototype.toString.call(a);if(c!=Object.prototype.toString.call(b))return!1;if("[object Date]"==c)return a.valueOf()===b.valueOf();var d,e=0,g=0;if("[object Array]"==c&&a.length!==b.length)return!1;for(d in a){if(e+=1,!(d in b))return!1;if(!t(a[d],b[d]))return!1}for(d in b)g+=1;return e==g},functionName:function(a){var b=a.displayName||a.name;if(!b){var c=a.toString().match(/function ([^\s\(]+)/);b=c&&c[1]}return b},functionToString:function(){if(this.getCall&&this.callCount)for(var a,b,c=this.callCount;c--;){a=this.getCall(c).thisValue;for(b in a)if(a[b]===this)return b}return this.displayName||"sinon fake"},getConfig:function(a){var b={};a=a||{};var c=n.defaultConfig;for(var d in c)c.hasOwnProperty(d)&&(b[d]=a.hasOwnProperty(d)?a[d]:c[d]);return b},format:function(a){return""+a},defaultConfig:{injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},timesInWords:function(a){return 1==a&&"once"||2==a&&"twice"||3==a&&"thrice"||(a||0)+" times"},calledInOrder:function(a){for(var b=1,c=a.length;c>b;b++)if(!a[b-1].calledBefore(a[b])||!a[b].called)return!1;return!0},orderByFirstCall:function(a){return a.sort(function(a,b){var c=a.getCall(0),d=b.getCall(0),e=c&&c.callId||-1,f=d&&d.callId||-1;return f>e?-1:1})},log:function(){},logError:function(a,b){var c=a+" threw exception: ";n.log(c+"["+b.name+"] "+b.message),b.stack&&n.log(b.stack),setTimeout(function(){throw b.message=c+b.message,b},0)},typeOf:function(a){if(null===a)return"null";if(void 0===a)return"undefined";var b=Object.prototype.toString.call(a);return b.substring(8,b.length-1).toLowerCase()},createStubInstance:function(a){if("function"!=typeof a)throw new TypeError("The constructor should be a function.");return n.stub(n.create(a.prototype))},restore:function(a){if(null!==a&&"object"==typeof a)for(var b in a)j(a[b])&&a[b].restore();else j(a)&&a.restore()}},o="undefined"!=typeof b&&b.exports&&"function"==typeof a,p="function"==typeof define&&"object"==typeof define.amd&&define.amd;if(p)define(k);else if(o){try{d=a("formatio")}catch(q){}k(a,c,b)}if(d){var r=d.configure({quoteStrings:!1});n.format=function(){return r.ascii.apply(r,arguments)}}else if(o)try{var s=a("util");n.format=function(a){return"object"==typeof a&&a.toString===Object.prototype.toString?s.inspect(a):a}}catch(q){}return n}("object"==typeof formatio&&formatio)},{"./sinon/assert":51,"./sinon/behavior":52,"./sinon/call":53,"./sinon/collection":54,"./sinon/match":55,"./sinon/mock":56,"./sinon/sandbox":57,"./sinon/spy":58,"./sinon/stub":59,"./sinon/test":60,"./sinon/test_case":61,formatio:63,util:48}],51:[function(a,b){(function(c){"use strict";!function(c,d){function e(){for(var a,b=0,c=arguments.length;c>b;++b)a=arguments[b],a||i.fail("fake is not a spy"),"function"!=typeof a&&i.fail(a+" is not a function"),"function"!=typeof a.getCall&&i.fail(a+" is not stubbed")}function f(a,b){a=a||d;var c=a.fail||i.fail;c.call(a,b)}function g(a,b,c){2==arguments.length&&(c=b,b=a),i[a]=function(d){e(d);var g=k.call(arguments,1),h=!1;h="function"==typeof b?!b(d):"function"==typeof d[b]?!d[b].apply(d,g):!d[b],h?f(this,d.printf.apply(d,[c].concat(g))):i.pass(a)}}function h(a,b){return!a||/^fail/.test(b)?b:a+b.slice(0,1).toUpperCase()+b.slice(1)}var i,j="undefined"!=typeof b&&b.exports&&"function"==typeof a,k=Array.prototype.slice;!c&&j&&(c=a("../sinon")),c&&(i={failException:"AssertError",fail:function(a){var b=new Error(a);throw b.name=this.failException||i.failException,b},pass:function(){},callOrder:function(){e.apply(null,arguments);var a="",b="";if(c.calledInOrder(arguments))i.pass("callOrder");else{try{a=[].join.call(arguments,", ");for(var d=k.call(arguments),g=d.length;g;)d[--g].called||d.splice(g,1);b=c.orderByFirstCall(d).join(", ")}catch(h){}f(this,"expected "+a+" to be called in order but were called as "+b)}},callCount:function(a,b){if(e(a),a.callCount!=b){var d="expected %n to be called "+c.timesInWords(b)+" but was called %c%C";f(this,a.printf(d))}else i.pass("callCount")},expose:function(a,b){if(!a)throw new TypeError("target is null or undefined");var c=b||{},d="undefined"==typeof c.prefix&&"assert"||c.prefix,e="undefined"==typeof c.includeFail||!!c.includeFail;for(var f in this)"export"==f||!e&&/^(fail)/.test(f)||(a[h(d,f)]=this[f]);return a},match:function(a,b){var d=c.match(b);if(d.test(a))i.pass("match");else{var e=["expected value to match"," expected = "+c.format(b)," actual = "+c.format(a)];f(this,e.join("\n"))}}},g("called","expected %n to have been called at least once but was never called"),g("notCalled",function(a){return!a.called},"expected %n to not have been called but was called %c%C"),g("calledOnce","expected %n to be called once but was called %c%C"),g("calledTwice","expected %n to be called twice but was called %c%C"),g("calledThrice","expected %n to be called thrice but was called %c%C"),g("calledOn","expected %n to be called with %1 as this but was called with %t"),g("alwaysCalledOn","expected %n to always be called with %1 as this but was called with %t"),g("calledWithNew","expected %n to be called with new"),g("alwaysCalledWithNew","expected %n to always be called with new"),g("calledWith","expected %n to be called with arguments %*%C"),g("calledWithMatch","expected %n to be called with match %*%C"),g("alwaysCalledWith","expected %n to always be called with arguments %*%C"),g("alwaysCalledWithMatch","expected %n to always be called with match %*%C"),g("calledWithExactly","expected %n to be called with exact arguments %*%C"),g("alwaysCalledWithExactly","expected %n to always be called with exact arguments %*%C"),g("neverCalledWith","expected %n to never be called with arguments %*%C"),g("neverCalledWithMatch","expected %n to never be called with match %*%C"),g("threw","%n did not throw exception%C"),g("alwaysThrew","%n did not always throw exception%C"),c.assert=i,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=i}):j&&(b.exports=i))}("object"==typeof sinon&&sinon||null,"undefined"!=typeof window?window:"undefined"!=typeof self?self:c)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../sinon":50}],52:[function(a,b){(function(c){"use strict";!function(d){function e(a,b){return"string"==typeof a?(this.exception=new Error(b||""),this.exception.name=a):this.exception=a?a:new Error("Error"),this}function f(a,b){var c=a.callArgAt;if(0>c){for(var d=a.callArgProp,e=0,f=b.length;f>e;++e){if(!d&&"function"==typeof b[e])return b[e];if(d&&b[e]&&"function"==typeof b[e][d])return b[e][d]}return null}return b[c]}function g(a,b,c){if(a.callArgAt<0){var e;return e=a.callArgProp?d.functionName(a.stub)+" expected to yield to '"+a.callArgProp+"', but no object with such a property was passed.":d.functionName(a.stub)+" expected to yield, but no callback was passed.",c.length>0&&(e+=" Received ["+l.call(c,", ")+"]"),e}return"argument at index "+a.callArgAt+" is not a function: "+b}function h(a,b){if("number"==typeof a.callArgAt){var c=f(a,b);if("function"!=typeof c)throw new TypeError(g(a,c,b));a.callbackAsync?m(function(){c.apply(a.callbackContext,a.callbackArguments)}):c.apply(a.callbackContext,a.callbackArguments)}}var i="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!d&&i&&(d=a("../sinon")),d){var j,k=Array.prototype.slice,l=Array.prototype.join,m=function(){return"object"==typeof c&&"function"==typeof c.nextTick?c.nextTick:"function"==typeof setImmediate?setImmediate:function(a){setTimeout(a,0)}}();j={create:function(a){var b=d.extend({},d.behavior);return delete b.create,b.stub=a,b},isPresent:function(){return"number"==typeof this.callArgAt||this.exception||"number"==typeof this.returnArgAt||this.returnThis||this.returnValueDefined},invoke:function(a,b){if(h(this,b),this.exception)throw this.exception;return"number"==typeof this.returnArgAt?b[this.returnArgAt]:this.returnThis?a:this.returnValue},onCall:function(a){return this.stub.onCall(a)},onFirstCall:function(){return this.stub.onFirstCall()},onSecondCall:function(){return this.stub.onSecondCall()},onThirdCall:function(){return this.stub.onThirdCall()},withArgs:function(){throw new Error('Defining a stub by invoking "stub.onCall(...).withArgs(...)" is not supported. Use "stub.withArgs(...).onCall(...)" to define sequential behavior for calls with certain arguments.')},callsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOn:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgWith:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.callArgAt=a,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOnWith:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},yields:function(){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,0),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsOn:function(a){if("object"!=typeof a)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=a,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsTo:function(a){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=a,this.callbackAsync=!1,this},yieldsToOn:function(a,b){if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=a,this.callbackAsync=!1,this},"throws":e,throwsException:e,returns:function(a){return this.returnValue=a,this.returnValueDefined=!0,this},returnsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.returnArgAt=a,this},returnsThis:function(){return this.returnThis=!0,this}};for(var n in j)j.hasOwnProperty(n)&&n.match(/^(callsArg|yields)/)&&!n.match(/Async/)&&(j[n+"Async"]=function(a){return function(){var b=this[a].apply(this,arguments);return this.callbackAsync=!0,b}}(n));d.behavior=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):i&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)}).call(this,a("JkpR2F"))},{"../sinon":50,JkpR2F:46}],53:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.functionName(a)+b;throw d.length&&(e+=" Received ["+g.call(d).join(", ")+"]"),new Error(e)}function e(a,b,d,e,f,g){if("number"!=typeof g)throw new TypeError("Call id is not a number");var i=c.create(h);return i.proxy=a,i.thisValue=b,i.args=d,i.returnValue=e,i.exception=f,i.callId=g,i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&f&&(c=a("../sinon")),c){var g=Array.prototype.slice,h={calledOn:function(a){return c.match&&c.match.isMatcher(a)?a.test(this.thisValue):this.thisValue===a},calledWith:function(){for(var a=0,b=arguments.length;b>a;a+=1)if(!c.deepEqual(arguments[a],this.args[a]))return!1;return!0},calledWithMatch:function(){for(var a=0,b=arguments.length;b>a;a+=1){var d=this.args[a],e=arguments[a];if(!c.match||!c.match(e).test(d))return!1}return!0},calledWithExactly:function(){return arguments.length==this.args.length&&this.calledWith.apply(this,arguments)},notCalledWith:function(){return!this.calledWith.apply(this,arguments)},notCalledWithMatch:function(){return!this.calledWithMatch.apply(this,arguments)},returned:function(a){return c.deepEqual(a,this.returnValue)},threw:function(a){return"undefined"!=typeof a&&this.exception?this.exception===a||this.exception.name===a:!!this.exception},calledWithNew:function(){return this.proxy.prototype&&this.thisValue instanceof this.proxy},calledBefore:function(a){return this.callId<a.callId},calledAfter:function(a){return this.callId>a.callId},callArg:function(a){this.args[a]()},callArgOn:function(a,b){this.args[a].apply(b)},callArgWith:function(a){this.callArgOnWith.apply(this,[a,null].concat(g.call(arguments,1)))},callArgOnWith:function(a,b){var c=g.call(arguments,2);this.args[a].apply(b,c)},"yield":function(){this.yieldOn.apply(this,[null].concat(g.call(arguments,0)))},yieldOn:function(a){for(var b=this.args,c=0,e=b.length;e>c;++c)if("function"==typeof b[c])return void b[c].apply(a,g.call(arguments,1));d(this.proxy," cannot yield since no callback was passed.",b)},yieldTo:function(a){this.yieldToOn.apply(this,[a,null].concat(g.call(arguments,1)))},yieldToOn:function(a,b){for(var c=this.args,e=0,f=c.length;f>e;++e)if(c[e]&&"function"==typeof c[e][a])return void c[e][a].apply(b,g.call(arguments,2));d(this.proxy," cannot yield to '"+a+"' since no callback was passed.",c)},toString:function(){for(var a=this.proxy.toString()+"(",b=[],d=0,e=this.args.length;e>d;++d)b.push(c.format(this.args[d]));return a=a+b.join(", ")+")","undefined"!=typeof this.returnValue&&(a+=" => "+c.format(this.returnValue)),this.exception&&(a+=" !"+this.exception.name,this.exception.message&&(a+="("+this.exception.message+")")),a}};h.invokeCallback=h.yield,e.toString=h.toString,c.spyCall=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],54:[function(a,b){"use strict";!function(c){function d(a){return a.fakes||(a.fakes=[]),a.fakes}function e(a,b){for(var c=d(a),e=0,f=c.length;f>e;e+=1)"function"==typeof c[e][b]&&c[e][b]()}function f(a){for(var b=d(a),c=0;c<b.length;)b.splice(c,1)}var g="undefined"!=typeof b&&b.exports&&"function"==typeof a,h=[].push,i=Object.prototype.hasOwnProperty;if(!c&&g&&(c=a("../sinon")),c){var j={verify:function(){e(this,"verify")},restore:function(){e(this,"restore"),f(this)},verifyAndRestore:function(){var a;try{this.verify()}catch(b){a=b}if(this.restore(),a)throw a},add:function(a){return h.call(d(this),a),a},spy:function(){return this.add(c.spy.apply(c,arguments))},stub:function(a,b,d){if(b){var e=a[b];if("function"!=typeof e){if(!i.call(a,b))throw new TypeError("Cannot stub non-existent own property "+b);return a[b]=d,this.add({restore:function(){a[b]=e}})}}if(!b&&a&&"object"==typeof a){var f=c.stub.apply(c,arguments);for(var g in f)"function"==typeof f[g]&&this.add(f[g]);return f}return this.add(c.stub.apply(c,arguments))},mock:function(){return this.add(c.mock.apply(c,arguments))},inject:function(a){var b=this;return a.spy=function(){return b.spy.apply(b,arguments)},a.stub=function(){return b.stub.apply(b,arguments)},a.mock=function(){return b.mock.apply(b,arguments)},a}};c.collection=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):g&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],55:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.typeOf(a);if(e!==b)throw new TypeError("Expected type of "+d+" to be "+b+", but was "+e)}function e(a){return i.isPrototypeOf(a)}function f(a,b){if(null===b||void 0===b)return!1;for(var d in a)if(a.hasOwnProperty(d)){var e=a[d],g=b[d];if(j.isMatcher(e)){if(!e.test(g))return!1}else if("object"===c.typeOf(e)){if(!f(e,g))return!1}else if(!c.deepEqual(e,g))return!1}return!0}function g(a,b){return function(e,f){d(e,"string","property");var g=1===arguments.length,h=b+'("'+e+'"';return g||(h+=", "+f),h+=")",j(function(b){return void 0!==b&&null!==b&&a(b,e)?g||c.deepEqual(f,b[e]):!1},h)}}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i={toString:function(){return this.message}};i.or=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)||a.test(c)},d.message=b.message+".or("+a.message+")",d},i.and=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)&&a.test(c)},d.message=b.message+".and("+a.message+")",d};var j=function(a,b){var d=c.create(i),e=c.typeOf(a);switch(e){case"object":if("function"==typeof a.test)return d.test=function(b){return a.test(b)===!0},d.message="match("+c.functionName(a.test)+")",d;var g=[];for(var h in a)a.hasOwnProperty(h)&&g.push(h+": "+a[h]);d.test=function(b){return f(a,b)},d.message="match("+g.join(", ")+")";break;case"number":d.test=function(b){return a==b};break;case"string":d.test=function(b){return"string"!=typeof b?!1:-1!==b.indexOf(a)},d.message='match("'+a+'")';break;case"regexp":d.test=function(b){return"string"!=typeof b?!1:a.test(b)};break;case"function":d.test=a,d.message=b?b:"match("+c.functionName(a)+")";break;default:d.test=function(b){return c.deepEqual(a,b)}}return d.message||(d.message="match("+a+")"),d};j.isMatcher=e,j.any=j(function(){return!0},"any"),j.defined=j(function(a){return null!==a&&void 0!==a},"defined"),j.truthy=j(function(a){return!!a},"truthy"),j.falsy=j(function(a){return!a},"falsy"),j.same=function(a){return j(function(b){return a===b},"same("+a+")")},j.typeOf=function(a){return d(a,"string","type"),j(function(b){return c.typeOf(b)===a},'typeOf("'+a+'")')},j.instanceOf=function(a){return d(a,"function","type"),j(function(b){return b instanceof a},"instanceOf("+c.functionName(a)+")")},j.has=g(function(a,b){return"object"==typeof a?b in a:void 0!==a[b]},"has"),j.hasOwn=g(function(a,b){return a.hasOwnProperty(b)},"hasOwn"),j.bool=j.typeOf("boolean"),j.number=j.typeOf("number"),j.string=j.typeOf("string"),j.object=j.typeOf("object"),j.func=j.typeOf("function"),j.array=j.typeOf("array"),j.regexp=j.typeOf("regexp"),j.date=j.typeOf("date"),c.match=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):h&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],56:[function(a,b){"use strict";!function(c){function d(a){return a?d.create(a):c.expectation.create("Anonymous mock")}var e,f="undefined"!=typeof b&&b.exports&&"function"==typeof a,g=[].push;if(!c&&f&&(c=a("../sinon")),c){e=c.match,!e&&f&&(e=a("./match")),c.mock=d,c.extend(d,function(){function a(a,b){if(a)for(var c=0,d=a.length;d>c;c+=1)b(a[c])}return{create:function(a){if(!a)throw new TypeError("object is null");var b=c.extend({},d);return b.object=a,delete b.create,b},expects:function(a){if(!a)throw new TypeError("method is falsy");if(this.expectations||(this.expectations={},this.proxies=[]),!this.expectations[a]){this.expectations[a]=[];var b=this;c.wrapMethod(this.object,a,function(){return b.invokeMethod(a,this,arguments)}),g.call(this.proxies,a)}var d=c.expectation.create(a);return g.call(this.expectations[a],d),d},restore:function(){var b=this.object;a(this.proxies,function(a){"function"==typeof b[a].restore&&b[a].restore()})},verify:function(){var b=this.expectations||{},d=[],e=[];return a(this.proxies,function(c){a(b[c],function(a){a.met()?g.call(e,a.toString()):g.call(d,a.toString())})}),this.restore(),d.length>0?c.expectation.fail(d.concat(e).join("\n")):c.expectation.pass(d.concat(e).join("\n")),!0},invokeMethod:function(a,b,d){var e,f=this.expectations&&this.expectations[a],h=f&&f.length||0;for(e=0;h>e;e+=1)if(!f[e].met()&&f[e].allowsCall(b,d))return f[e].apply(b,d);var i,j=[],k=0;for(e=0;h>e;e+=1)f[e].allowsCall(b,d)?i=i||f[e]:k+=1,g.call(j," "+f[e].toString());return 0===k?i.apply(b,d):(j.unshift("Unexpected call: "+c.spyCall.toString.call({proxy:a,args:d})),void c.expectation.fail(j.join("\n")))}}}());var h=c.timesInWords;c.expectation=function(){function a(a){return 0==a?"never called":"called "+h(a)}function b(a){var b=a.minCalls,c=a.maxCalls;if("number"==typeof b&&"number"==typeof c){var d=h(b);return b!=c&&(d="at least "+d+" and at most "+h(c)),d}return"number"==typeof b?"at least "+h(b):"at most "+h(c)}function d(a){var b="number"==typeof a.minCalls;return!b||a.callCount>=a.minCalls}function f(a){return"number"!=typeof a.maxCalls?!1:a.callCount==a.maxCalls}function i(a,b){return e&&e.isMatcher(a)?a.test(b):!0}var j=Array.prototype.slice,k=c.spy.invoke;return{minCalls:1,maxCalls:1,create:function(a){var b=c.extend(c.stub.create(),c.expectation);return delete b.create,b.method=a,b},invoke:function(a,b,c){return this.verifyCallAllowed(b,c),k.apply(this,arguments)},atLeast:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");return this.limitsSet||(this.maxCalls=null,this.limitsSet=!0),this.minCalls=a,this},atMost:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");return this.limitsSet||(this.minCalls=null,this.limitsSet=!0),this.maxCalls=a,this},never:function(){return this.exactly(0)},once:function(){return this.exactly(1)},twice:function(){return this.exactly(2)},thrice:function(){return this.exactly(3)},exactly:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not a number");return this.atLeast(a),this.atMost(a)},met:function(){return!this.failed&&d(this)},verifyCallAllowed:function(a,b){if(f(this)&&(this.failed=!0,c.expectation.fail(this.method+" already called "+h(this.maxCalls))),"expectedThis"in this&&this.expectedThis!==a&&c.expectation.fail(this.method+" called with "+a+" as thisValue, expected "+this.expectedThis),"expectedArguments"in this){b||c.expectation.fail(this.method+" received no arguments, expected "+c.format(this.expectedArguments)),b.length<this.expectedArguments.length&&c.expectation.fail(this.method+" received too few arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments)),this.expectsExactArgCount&&b.length!=this.expectedArguments.length&&c.expectation.fail(this.method+" received too many arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments));for(var d=0,e=this.expectedArguments.length;e>d;d+=1)i(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", didn't match "+this.expectedArguments.toString()),c.deepEqual(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", expected "+c.format(this.expectedArguments))}},allowsCall:function(a,b){if(this.met()&&f(this))return!1;if("expectedThis"in this&&this.expectedThis!==a)return!1;if(!("expectedArguments"in this))return!0;if(b=b||[],b.length<this.expectedArguments.length)return!1;if(this.expectsExactArgCount&&b.length!=this.expectedArguments.length)return!1;for(var d=0,e=this.expectedArguments.length;e>d;d+=1){if(!i(this.expectedArguments[d],b[d]))return!1;if(!c.deepEqual(this.expectedArguments[d],b[d]))return!1}return!0},withArgs:function(){return this.expectedArguments=j.call(arguments),this},withExactArgs:function(){return this.withArgs.apply(this,arguments),this.expectsExactArgCount=!0,this},on:function(a){return this.expectedThis=a,this},toString:function(){var d=(this.expectedArguments||[]).slice();this.expectsExactArgCount||g.call(d,"[...]");
|
||
var e=c.spyCall.toString.call({proxy:this.method||"anonymous mock expectation",args:d}),f=e.replace(", [...","[, ...")+" "+b(this);return this.met()?"Expectation met: "+f:"Expected "+f+" ("+a(this.callCount)+")"},verify:function(){return this.met()?c.expectation.pass(this.toString()):c.expectation.fail(this.toString()),!0},pass:function(a){c.assert.pass(a)},fail:function(a){var b=new Error(a);throw b.name="ExpectationError",b}}}(),c.mock=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):f&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50,"./match":55}],57:[function(a,b){"use strict";if("undefined"!=typeof b&&b.exports&&"function"==typeof a){var c=a("../sinon");c.extend(c,a("./util/fake_timers"))}!function(){function a(a,b,c,d){d&&(!b.injectInto||c in b.injectInto?e.call(a.args,d):(b.injectInto[c]=d,a.injectedKeys.push(c)))}function d(a){var b=c.create(c.sandbox);return a.useFakeServer&&("object"==typeof a.useFakeServer&&(b.serverPrototype=a.useFakeServer),b.useFakeServer()),a.useFakeTimers&&("object"==typeof a.useFakeTimers?b.useFakeTimers.apply(b,a.useFakeTimers):b.useFakeTimers()),b}var e=[].push;c.sandbox=c.extend(c.create(c.collection),{useFakeTimers:function(){return this.clock=c.useFakeTimers.apply(c,arguments),this.add(this.clock)},serverPrototype:c.fakeServer,useFakeServer:function(){var a=this.serverPrototype||c.fakeServer;return a&&a.create?(this.server=a.create(),this.add(this.server)):null},inject:function(a){return c.collection.inject.call(this,a),this.clock&&(a.clock=this.clock),this.server&&(a.server=this.server,a.requests=this.server.requests),a},restore:function(){c.collection.restore.apply(this,arguments),this.restoreContext()},restoreContext:function(){if(this.injectedKeys){for(var a=0,b=this.injectedKeys.length;b>a;a++)delete this.injectInto[this.injectedKeys[a]];this.injectedKeys=[]}},create:function(b){if(!b)return c.create(c.sandbox);var e=d(b);e.args=e.args||[],e.injectedKeys=[],e.injectInto=b.injectInto;var f,g,h=e.inject({});if(b.properties)for(var i=0,j=b.properties.length;j>i;i++)f=b.properties[i],g=h[f]||"sandbox"==f&&e,a(e,b,f,g);else a(e,b,"sandbox",g);return e}}),c.sandbox.useFakeXMLHttpRequest=c.sandbox.useFakeServer,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=c.sandbox}):"undefined"!=typeof b&&b.exports&&(b.exports=c.sandbox)}()},{"../sinon":50,"./util/fake_timers":62}],58:[function(require,module,exports){"use strict";!function(sinon){function spy(a,b){if(!b&&"function"==typeof a)return spy.create(a);if(!a&&!b)return spy.create(function(){});var c=a[b];return sinon.wrapMethod(a,b,spy.create(c))}function matchingFake(a,b,c){if(a)for(var d=0,e=a.length;e>d;d++)if(a[d].matches(b,c))return a[d]}function incrementCallCount(){this.called=!0,this.callCount+=1,this.notCalled=!1,this.calledOnce=1==this.callCount,this.calledTwice=2==this.callCount,this.calledThrice=3==this.callCount}function createCallProperties(){this.firstCall=this.getCall(0),this.secondCall=this.getCall(1),this.thirdCall=this.getCall(2),this.lastCall=this.getCall(this.callCount-1)}function createProxy(func){var p;return func.length?eval("p = (function proxy("+vars.substring(0,2*func.length-1)+") { return p.invoke(func, this, slice.call(arguments)); });"):p=function(){return p.invoke(func,this,slice.call(arguments))},p}function delegateToCalls(a,b,c,d){spyApi[a]=function(){if(!this.called)return d?d.apply(this,arguments):!1;for(var e,f=0,g=0,h=this.callCount;h>g;g+=1)if(e=this.getCall(g),e[c||a].apply(e,arguments)&&(f+=1,b))return!0;return f===this.callCount}}var commonJSModule="undefined"!=typeof module&&module.exports&&"function"==typeof require,push=Array.prototype.push,slice=Array.prototype.slice,callId=0;if(!sinon&&commonJSModule&&(sinon=require("../sinon")),sinon){var vars="a,b,c,d,e,f,g,h,i,j,k,l",uuid=0,spyApi={reset:function(){if(this.called=!1,this.notCalled=!0,this.calledOnce=!1,this.calledTwice=!1,this.calledThrice=!1,this.callCount=0,this.firstCall=null,this.secondCall=null,this.thirdCall=null,this.lastCall=null,this.args=[],this.returnValues=[],this.thisValues=[],this.exceptions=[],this.callIds=[],this.fakes)for(var a=0;a<this.fakes.length;a++)this.fakes[a].reset()},create:function(a){var b;"function"!=typeof a?a=function(){}:b=sinon.functionName(a);var c=createProxy(a);return sinon.extend(c,spy),delete c.create,sinon.extend(c,a),c.reset(),c.prototype=a.prototype,c.displayName=b||"spy",c.toString=sinon.functionToString,c._create=sinon.spy.create,c.id="spy#"+uuid++,c},invoke:function(a,b,c){var d,e,f=matchingFake(this.fakes,c);incrementCallCount.call(this),push.call(this.thisValues,b),push.call(this.args,c),push.call(this.callIds,callId++),createCallProperties.call(this);try{e=f?f.invoke(a,b,c):(this.func||a).apply(b,c);var g=this.getCall(this.callCount-1);g.calledWithNew()&&"object"!=typeof e&&(e=b)}catch(h){d=h}if(push.call(this.exceptions,d),push.call(this.returnValues,e),createCallProperties.call(this),void 0!==d)throw d;return e},named:function(a){return this.displayName=a,this},getCall:function(a){return 0>a||a>=this.callCount?null:sinon.spyCall(this,this.thisValues[a],this.args[a],this.returnValues[a],this.exceptions[a],this.callIds[a])},getCalls:function(){var a,b=[];for(a=0;a<this.callCount;a++)b.push(this.getCall(a));return b},calledBefore:function(a){return this.called?a.called?this.callIds[0]<a.callIds[a.callIds.length-1]:!0:!1},calledAfter:function(a){return this.called&&a.called?this.callIds[this.callCount-1]>a.callIds[a.callCount-1]:!1},withArgs:function(){var a=slice.call(arguments);if(this.fakes){var b=matchingFake(this.fakes,a,!0);if(b)return b}else this.fakes=[];var c=this,d=this._create();d.matchingAguments=a,d.parent=this,push.call(this.fakes,d),d.withArgs=function(){return c.withArgs.apply(c,arguments)};for(var e=0;e<this.args.length;e++)d.matches(this.args[e])&&(incrementCallCount.call(d),push.call(d.thisValues,this.thisValues[e]),push.call(d.args,this.args[e]),push.call(d.returnValues,this.returnValues[e]),push.call(d.exceptions,this.exceptions[e]),push.call(d.callIds,this.callIds[e]));return createCallProperties.call(d),d},matches:function(a,b){var c=this.matchingAguments;return c.length<=a.length&&sinon.deepEqual(c,a.slice(0,c.length))?!b||c.length==a.length:void 0},printf:function(a){var b,c=this,d=slice.call(arguments,1);return(a||"").replace(/%(.)/g,function(a,e){return b=spyApi.formatters[e],"function"==typeof b?b.call(null,c,d):isNaN(parseInt(e,10))?"%"+e:sinon.format(d[e-1])})}};delegateToCalls("calledOn",!0),delegateToCalls("alwaysCalledOn",!1,"calledOn"),delegateToCalls("calledWith",!0),delegateToCalls("calledWithMatch",!0),delegateToCalls("alwaysCalledWith",!1,"calledWith"),delegateToCalls("alwaysCalledWithMatch",!1,"calledWithMatch"),delegateToCalls("calledWithExactly",!0),delegateToCalls("alwaysCalledWithExactly",!1,"calledWithExactly"),delegateToCalls("neverCalledWith",!1,"notCalledWith",function(){return!0}),delegateToCalls("neverCalledWithMatch",!1,"notCalledWithMatch",function(){return!0}),delegateToCalls("threw",!0),delegateToCalls("alwaysThrew",!1,"threw"),delegateToCalls("returned",!0),delegateToCalls("alwaysReturned",!1,"returned"),delegateToCalls("calledWithNew",!0),delegateToCalls("alwaysCalledWithNew",!1,"calledWithNew"),delegateToCalls("callArg",!1,"callArgWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")}),spyApi.callArgWith=spyApi.callArg,delegateToCalls("callArgOn",!1,"callArgOnWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")}),spyApi.callArgOnWith=spyApi.callArgOn,delegateToCalls("yield",!1,"yield",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),spyApi.invokeCallback=spyApi.yield,delegateToCalls("yieldOn",!1,"yieldOn",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),delegateToCalls("yieldTo",!1,"yieldTo",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),delegateToCalls("yieldToOn",!1,"yieldToOn",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),spyApi.formatters={c:function(a){return sinon.timesInWords(a.callCount)},n:function(a){return a.toString()},C:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c){var e=" "+a.getCall(c).toString();/\n/.test(b[c-1])&&(e="\n"+e),push.call(b,e)}return b.length>0?"\n"+b.join("\n"):""},t:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c)push.call(b,sinon.format(a.thisValues[c]));return b.join(", ")},"*":function(a,b){for(var c=[],d=0,e=b.length;e>d;++d)push.call(c,sinon.format(b[d]));return c.join(", ")}},sinon.extend(spy,spyApi),spy.spyCall=sinon.spyCall,sinon.spy=spy,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=spy}):commonJSModule&&(module.exports=spy)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],59:[function(a,b){"use strict";!function(c){function d(a,b,e){if(e&&"function"!=typeof e)throw new TypeError("Custom stub should be function");var f;if(f=e?c.spy&&c.spy.create?c.spy.create(e):e:d.create(),!a&&"undefined"==typeof b)return c.stub.create();if("undefined"==typeof b&&"object"==typeof a){for(var g in a)"function"==typeof a[g]&&d(a,g);return a}return c.wrapMethod(a,b,f)}function e(a){return a.defaultBehavior||f(a)||c.behavior.create(a)}function f(a){return a.parent&&g(a.parent)}function g(a){var b=a.behaviors[a.callCount-1];return b&&b.isPresent()?b:e(a)}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i=0;c.extend(d,function(){var a={create:function(){var a=function(){return g(a).invoke(this,arguments)};a.id="stub#"+i++;var b=a;return a=c.spy.create(a),a.func=b,c.extend(a,d),a._create=c.stub.create,a.displayName="stub",a.toString=c.functionToString,a.defaultBehavior=null,a.behaviors=[],a},resetBehavior:function(){var a;if(this.defaultBehavior=null,this.behaviors=[],delete this.returnValue,delete this.returnArgAt,this.returnThis=!1,this.fakes)for(a=0;a<this.fakes.length;a++)this.fakes[a].resetBehavior()},onCall:function(a){return this.behaviors[a]||(this.behaviors[a]=c.behavior.create(this)),this.behaviors[a]},onFirstCall:function(){return this.onCall(0)},onSecondCall:function(){return this.onCall(1)},onThirdCall:function(){return this.onCall(2)}};for(var b in c.behavior)c.behavior.hasOwnProperty(b)&&!a.hasOwnProperty(b)&&"create"!=b&&"withArgs"!=b&&"invoke"!=b&&(a[b]=function(a){return function(){return this.defaultBehavior=this.defaultBehavior||c.behavior.create(this),this.defaultBehavior[a].apply(this.defaultBehavior,arguments),this}}(b));return a}()),c.stub=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):h&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],60:[function(a,b){"use strict";!function(c){function d(a){function b(){var b=c.getConfig(c.config);b.injectInto=b.injectIntoThis&&this||b.injectInto;var d,e,f=c.sandbox.create(b),g=Array.prototype.slice.call(arguments).concat(f.args);try{e=a.apply(this,g)}catch(h){d=h}if("undefined"!=typeof d)throw f.restore(),d;return f.verifyAndRestore(),e}var d=typeof a;if("function"!=d)throw new TypeError("sinon.test needs to wrap a test function, got "+d);return a.length?function(){return b.apply(this,arguments)}:b}var e="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&e&&(c=a("../sinon")),c&&(d.config={injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},c.test=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):e&&(b.exports=d))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],61:[function(a,b){"use strict";!function(c){function d(a,b,c){return function(){b&&b.apply(this,arguments);var d,e;try{e=a.apply(this,arguments)}catch(f){d=f}if(c&&c.apply(this,arguments),d)throw d;return e}}function e(a,b){if(!a||"object"!=typeof a)throw new TypeError("sinon.testCase needs an object with test functions");b=b||"test";var e,f,g,h=new RegExp("^"+b),i={},j=a.setUp,k=a.tearDown;for(e in a)if(a.hasOwnProperty(e)){if(f=a[e],/^(setUp|tearDown)$/.test(e))continue;"function"==typeof f&&h.test(e)?(g=f,(j||k)&&(g=d(f,j,k)),i[e]=c.test(g)):i[e]=a[e]}return i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&f&&(c=a("../sinon")),c&&Object.prototype.hasOwnProperty&&(c.testCase=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],62:[function(require,module,exports){(function(global){"use strict";if("undefined"==typeof sinon)var sinon={};!function(global){function addTimer(a,b){if(0===a.length)throw new Error("Function requires at least 1 parameter");if("undefined"==typeof a[0])throw new Error("Callback must be provided to timer calls");var c=id++,d=a[1]||0;return this.timeouts||(this.timeouts={}),this.timeouts[c]={id:c,func:a[0],callAt:this.now+d,invokeArgs:Array.prototype.slice.call(a,2)},b===!0&&(this.timeouts[c].interval=d),addTimerReturnsObject?{id:c,ref:function(){},unref:function(){}}:c}function parseTime(a){if(!a)return 0;var b,c=a.split(":"),d=c.length,e=d,f=0;if(d>3||!/^(\d\d:){0,2}\d\d?$/.test(a))throw new Error("tick only understands numbers and 'h:m:s'");for(;e--;){if(b=parseInt(c[e],10),b>=60)throw new Error("Invalid time "+a);f+=b*Math.pow(60,d-e-1)}return 1e3*f}function createObject(a){var b;if(Object.create)b=Object.create(a);else{var c=function(){};c.prototype=a,b=new c}return b.Date.clock=b,b}function mirrorDateProperties(a,b){b.now?a.now=function(){return a.clock.now}:delete a.now,b.toSource?a.toSource=function(){return b.toSource()}:delete a.toSource,a.toString=function(){return b.toString()},a.prototype=b.prototype,a.parse=b.parse,a.UTC=b.UTC,a.prototype.toUTCString=b.prototype.toUTCString;for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function restore(){for(var a,b=0,c=this.methods.length;c>b;b++)if(a=this.methods[b],global[a].hadOwnProperty)global[a]=this["_"+a];else try{delete global[a]}catch(d){}this.methods=[]}function stubGlobal(a,b){if(b[a].hadOwnProperty=Object.prototype.hasOwnProperty.call(global,a),b["_"+a]=global[a],"Date"==a){var c=mirrorDateProperties(b[a],global[a]);global[a]=c}else{global[a]=function(){return b[a].apply(b,arguments)};for(var d in b[a])b[a].hasOwnProperty(d)&&(global[a][d]=b[a][d])}global[a].clock=b}var timeoutResult=setTimeout(function(){},0),addTimerReturnsObject="object"==typeof timeoutResult;clearTimeout(timeoutResult);var id=1;sinon.clock={now:0,create:function(a){var b=createObject(this);if("number"==typeof a&&(b.now=a),a&&"object"==typeof a)throw new TypeError("now should be milliseconds since UNIX epoch");return b},setTimeout:function(){return addTimer.call(this,arguments,!1)},clearTimeout:function(a){a&&(this.timeouts||(this.timeouts=[]),"object"==typeof a&&(a=a.id),a in this.timeouts&&delete this.timeouts[a])},setInterval:function(){return addTimer.call(this,arguments,!0)},clearInterval:function(a){this.clearTimeout(a)},setImmediate:function(a){var b=Array.prototype.slice.call(arguments,1);return addTimer.call(this,[a,0].concat(b),!1)},clearImmediate:function(a){this.clearTimeout(a)},tick:function(a){a="number"==typeof a?a:parseTime(a);for(var b,c=this.now,d=this.now+a,e=this.now,f=this.firstTimerInRange(c,d);f&&d>=c;){if(this.timeouts[f.id]){c=this.now=f.callAt;try{this.callTimer(f)}catch(g){b=b||g}}f=this.firstTimerInRange(e,d),e=c}if(this.now=d,b)throw b;return this.now},firstTimerInRange:function(a,b){var c,d,e=null;for(var f in this.timeouts)if(this.timeouts.hasOwnProperty(f)){if(this.timeouts[f].callAt<a||this.timeouts[f].callAt>b)continue;(null===e||this.timeouts[f].callAt<e)&&(d=this.timeouts[f],e=this.timeouts[f].callAt,c={func:this.timeouts[f].func,callAt:this.timeouts[f].callAt,interval:this.timeouts[f].interval,id:this.timeouts[f].id,invokeArgs:this.timeouts[f].invokeArgs})}return c||null},callTimer:function(timer){"number"==typeof timer.interval?this.timeouts[timer.id].callAt+=timer.interval:delete this.timeouts[timer.id];try{"function"==typeof timer.func?timer.func.apply(null,timer.invokeArgs):eval(timer.func)}catch(e){var exception=e}if(this.timeouts[timer.id]){if(exception)throw exception}else if(exception)throw exception},reset:function(){this.timeouts={}},Date:function(){function a(c,d,e,f,g,h,i){switch(arguments.length){case 0:return new b(a.clock.now);case 1:return new b(c);case 2:return new b(c,d);case 3:return new b(c,d,e);case 4:return new b(c,d,e,f);case 5:return new b(c,d,e,f,g);case 6:return new b(c,d,e,f,g,h);default:return new b(c,d,e,f,g,h,i)}}var b=Date;return mirrorDateProperties(a,b)}()};var methods=["Date","setTimeout","setInterval","clearTimeout","clearInterval"];"undefined"!=typeof global.setImmediate&&methods.push("setImmediate"),"undefined"!=typeof global.clearImmediate&&methods.push("clearImmediate"),sinon.useFakeTimers=function(a){var b=sinon.clock.create(a);b.restore=restore,b.methods=Array.prototype.slice.call(arguments,"number"==typeof a?1:0),0===b.methods.length&&(b.methods=methods);for(var c=0,d=b.methods.length;d>c;c++)stubGlobal(b.methods[c],b);return b}}("undefined"!=typeof global&&"function"!=typeof global?global:this),sinon.timers={setTimeout:setTimeout,clearTimeout:clearTimeout,setImmediate:"undefined"!=typeof setImmediate?setImmediate:void 0,clearImmediate:"undefined"!=typeof clearImmediate?clearImmediate:void 0,setInterval:setInterval,clearInterval:clearInterval,Date:Date},"undefined"!=typeof module&&module.exports&&(module.exports=sinon)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],63:[function(a,b){(function(c){("function"==typeof define&&define.amd&&function(a){define("formatio",["samsam"],a)}||"object"==typeof b&&function(c){b.exports=c(a("samsam"))}||function(a){this.formatio=a(this.samsam)})(function(a){"use strict";function b(a){if(!a)return"";if(a.displayName)return a.displayName;if(a.name)return a.name;var b=a.toString().match(/function\s+([^\(]+)/m);return b&&b[1]||""}function d(a,c){var d,e,f=b(c&&c.constructor),g=a.excludeConstructors||h.excludeConstructors||[];for(d=0,e=g.length;e>d;++d){if("string"==typeof g[d]&&g[d]===f)return"";if(g[d].test&&g[d].test(f))return""}return f}function e(a,b){if("object"!=typeof a)return!1;var c,d;for(c=0,d=b.length;d>c;++c)if(b[c]===a)return!0;return!1}function f(b,c,d,g){if("string"==typeof c){var h=b.quoteStrings,j="boolean"!=typeof h||h;return d||j?'"'+c+'"':c}if("function"==typeof c&&!(c instanceof RegExp))return f.func(c);if(d=d||[],e(c,d))return"[Circular]";if("[object Array]"===Object.prototype.toString.call(c))return f.array.call(b,c,d);if(!c)return String(1/c===-1/0?"-0":c);if(a.isElement(c))return f.element(c);if("function"==typeof c.toString&&c.toString!==Object.prototype.toString)return c.toString();var k,l;for(k=0,l=i.length;l>k;k++)if(c===i[k].object)return i[k].value;return f.object.call(b,c,d,g)}function g(a){for(var b in a)this[b]=a[b]}var h={excludeConstructors:["Object",/^.$/],quoteStrings:!0},i=(Object.prototype.hasOwnProperty,[]);return"undefined"!=typeof c&&i.push({object:c,value:"[object global]"}),"undefined"!=typeof document&&i.push({object:document,value:"[object HTMLDocument]"}),"undefined"!=typeof window&&i.push({object:window,value:"[object Window]"}),f.func=function(a){return"function "+b(a)+"() {}"},f.array=function(a,b){b=b||[],b.push(a);var c,d,e=[];for(c=0,d=a.length;d>c;++c)e.push(f(this,a[c],b));return"["+e.join(", ")+"]"},f.object=function(b,c,g){c=c||[],c.push(b),g=g||0;var h,i,j,k,l,m=[],n=a.keys(b).sort(),o=3;for(k=0,l=n.length;l>k;++k)h=n[k],j=b[h],i=e(j,c)?"[Circular]":f(this,j,c,g+2),i=(/\s/.test(h)?'"'+h+'"':h)+": "+i,o+=i.length,m.push(i);var p=d(this,b),q=p?"["+p+"] ":"",r="";for(k=0,l=g;l>k;++k)r+=" ";return o+g>80?q+"{\n "+r+m.join(",\n "+r)+"\n"+r+"}":q+"{ "+m.join(", ")+" }"},f.element=function(a){var b,c,d,e,f,g=a.tagName.toLowerCase(),h=a.attributes,i=[];for(d=0,e=h.length;e>d;++d)b=h.item(d),c=b.nodeName.toLowerCase().replace("html:",""),f=b.nodeValue,("contenteditable"!==c||"inherit"!==f)&&f&&i.push(c+'="'+f+'"');var j="<"+g+(i.length>0?" ":""),k=a.innerHTML;k.length>20&&(k=k.substr(0,20)+"[...]");var l=j+i.join(" ")+">"+k+"</"+g+">";return l.replace(/ contentEditable="inherit"/,"")},g.prototype={functionName:b,configure:function(a){return new g(a)},constructorName:function(a){return d(this,a)},ascii:function(a,b,c){return f(this,a,b,c)}},g.prototype})}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{samsam:64}],64:[function(a,b){("function"==typeof define&&define.amd&&function(a){define("samsam",a)}||"object"==typeof b&&function(a){b.exports=a()}||function(a){this.samsam=a()})(function(){function a(a){var b=a;return"number"==typeof a&&a!==b}function b(a){return l.toString.call(a).split(/[ \]]/)[1]}function c(a){if("Arguments"===b(a))return!0;if("object"!=typeof a||"number"!=typeof a.length||"Array"===b(a))return!1;if("function"==typeof a.callee)return!0;try{a[a.length]=6,delete a[a.length]}catch(c){return!0}return!1}function d(a){if(!a||1!==a.nodeType||!m)return!1;try{a.appendChild(m),a.removeChild(m)}catch(b){return!1}return!0}function e(a){var b,c=[];for(b in a)l.hasOwnProperty.call(a,b)&&c.push(b);return c}function f(a){return"function"==typeof a.getTime&&a.getTime()==a.valueOf()}function g(a){return 0===a&&1/a===-1/0}function h(b,c){return b===c||a(b)&&a(c)?0!==b||g(b)===g(c):void 0}function i(g,i){function j(a){return"object"!=typeof a||null===a||a instanceof Boolean||a instanceof Date||a instanceof Number||a instanceof RegExp||a instanceof String?!1:!0}function k(a,b){var c;for(c=0;c<a.length;c++)if(a[c]===b)return c;return-1}var m=[],n=[],o=[],p=[],q={};return function r(g,i,s,t){var u=typeof g,v=typeof i;if(g===i||a(g)||a(i)||null==g||null==i||"object"!==u||"object"!==v)return h(g,i);if(d(g)||d(i))return!1;var w=f(g),x=f(i);if(!(!w&&!x||w&&x&&g.getTime()===i.getTime()))return!1;if(g instanceof RegExp&&i instanceof RegExp&&g.toString()!==i.toString())return!1;var y=b(g),z=b(i),A=e(g),B=e(i);if(c(g)||c(i)){if(g.length!==i.length)return!1}else if(u!==v||y!==z||A.length!==B.length)return!1;var C,D,E,F,G,H,I,J,K,L,M;for(D=0,E=A.length;E>D;D++){if(C=A[D],!l.hasOwnProperty.call(i,C))return!1;if(F=g[C],G=i[C],H=j(F),I=j(G),J=H?k(m,F):-1,K=I?k(n,G):-1,L=-1!==J?o[J]:s+"["+JSON.stringify(C)+"]",M=-1!==K?p[K]:t+"["+JSON.stringify(C)+"]",q[L+M])return!0;if(-1===J&&H&&(m.push(F),o.push(L)),-1===K&&I&&(n.push(G),p.push(M)),H&&I&&(q[L+M]=!0),!r(F,G,L,M))return!1}return!0}(g,i,"$1","$2")}function j(a,b){if(0===b.length)return!0;var c,d,e,f;for(c=0,d=a.length;d>c;++c)if(k(a[c],b[0])){for(e=0,f=b.length;f>e;++e)if(!k(a[c+e],b[e]))return!1;return!0}return!1}var k,l=Object.prototype,m="undefined"!=typeof document&&document.createElement("div");return k=function n(a,c){if(c&&"function"==typeof c.test)return c.test(a);if("function"==typeof c)return c(a)===!0;if("string"==typeof c){c=c.toLowerCase();var d="string"==typeof a||!!a;return d&&String(a).toLowerCase().indexOf(c)>=0}if("number"==typeof c)return c===a;if("boolean"==typeof c)return c===a;if("Array"===b(a)&&"Array"===b(c))return j(a,c);if(c&&"object"==typeof c){var e;for(e in c){var f=a[e];if("undefined"==typeof f&&"function"==typeof a.getAttribute&&(f=a.getAttribute(e)),"undefined"==typeof f||!n(f,c[e]))return!1}return!0}throw new Error("Matcher was not a string, a number, a function, a boolean or an object")},{isArguments:c,isElement:d,isDate:f,isNegZero:g,identical:h,deepEqual:i,match:k,keys:e}})},{}],65:[function(a,b,c){(function(){var a=this,d=a._,e={},f=Array.prototype,g=Object.prototype,h=Function.prototype,i=f.push,j=f.slice,k=f.concat,l=g.toString,m=g.hasOwnProperty,n=f.forEach,o=f.map,p=f.reduce,q=f.reduceRight,r=f.filter,s=f.every,t=f.some,u=f.indexOf,v=f.lastIndexOf,w=Array.isArray,x=Object.keys,y=h.bind,z=function(a){return a instanceof z?a:this instanceof z?void(this._wrapped=a):new z(a)};"undefined"!=typeof c?("undefined"!=typeof b&&b.exports&&(c=b.exports=z),c._=z):a._=z,z.VERSION="1.6.0";var A=z.each=z.forEach=function(a,b,c){if(null==a)return a;if(n&&a.forEach===n)a.forEach(b,c);else if(a.length===+a.length){for(var d=0,f=a.length;f>d;d++)if(b.call(c,a[d],d,a)===e)return}else for(var g=z.keys(a),d=0,f=g.length;f>d;d++)if(b.call(c,a[g[d]],g[d],a)===e)return;return a};z.map=z.collect=function(a,b,c){var d=[];return null==a?d:o&&a.map===o?a.map(b,c):(A(a,function(a,e,f){d.push(b.call(c,a,e,f))}),d)};var B="Reduce of empty array with no initial value";z.reduce=z.foldl=z.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),p&&a.reduce===p)return d&&(b=z.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(A(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(B);return c},z.reduceRight=z.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),q&&a.reduceRight===q)return d&&(b=z.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=z.keys(a);f=g.length}if(A(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(B);return c},z.find=z.detect=function(a,b,c){var d;return C(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},z.filter=z.select=function(a,b,c){var d=[];return null==a?d:r&&a.filter===r?a.filter(b,c):(A(a,function(a,e,f){b.call(c,a,e,f)&&d.push(a)}),d)},z.reject=function(a,b,c){return z.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},z.every=z.all=function(a,b,c){b||(b=z.identity);var d=!0;return null==a?d:s&&a.every===s?a.every(b,c):(A(a,function(a,f,g){return(d=d&&b.call(c,a,f,g))?void 0:e}),!!d)};var C=z.some=z.any=function(a,b,c){b||(b=z.identity);var d=!1;return null==a?d:t&&a.some===t?a.some(b,c):(A(a,function(a,f,g){return d||(d=b.call(c,a,f,g))?e:void 0}),!!d)};z.contains=z.include=function(a,b){return null==a?!1:u&&a.indexOf===u?-1!=a.indexOf(b):C(a,function(a){return a===b})},z.invoke=function(a,b){var c=j.call(arguments,2),d=z.isFunction(b);return z.map(a,function(a){return(d?b:a[b]).apply(a,c)})},z.pluck=function(a,b){return z.map(a,z.property(b))},z.where=function(a,b){return z.filter(a,z.matches(b))},z.findWhere=function(a,b){return z.find(a,z.matches(b))},z.max=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);var d=-1/0,e=-1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;h>e&&(d=a,e=h)}),d},z.min=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);var d=1/0,e=1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;e>h&&(d=a,e=h)}),d},z.shuffle=function(a){var b,c=0,d=[];return A(a,function(a){b=z.random(c++),d[c-1]=d[b],d[b]=a}),d},z.sample=function(a,b,c){return null==b||c?(a.length!==+a.length&&(a=z.values(a)),a[z.random(a.length-1)]):z.shuffle(a).slice(0,Math.max(0,b))};var D=function(a){return null==a?z.identity:z.isFunction(a)?a:z.property(a)};z.sortBy=function(a,b,c){return b=D(b),z.pluck(z.map(a,function(a,d,e){return{value:a,index:d,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index-b.index}),"value")};var E=function(a){return function(b,c,d){var e={};return c=D(c),A(b,function(f,g){var h=c.call(d,f,g,b);a(e,h,f)}),e}};z.groupBy=E(function(a,b,c){z.has(a,b)?a[b].push(c):a[b]=[c]}),z.indexBy=E(function(a,b,c){a[b]=c}),z.countBy=E(function(a,b){z.has(a,b)?a[b]++:a[b]=1}),z.sortedIndex=function(a,b,c,d){c=D(c);for(var e=c.call(d,b),f=0,g=a.length;g>f;){var h=f+g>>>1;c.call(d,a[h])<e?f=h+1:g=h}return f},z.toArray=function(a){return a?z.isArray(a)?j.call(a):a.length===+a.length?z.map(a,z.identity):z.values(a):[]},z.size=function(a){return null==a?0:a.length===+a.length?a.length:z.keys(a).length},z.first=z.head=z.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:0>b?[]:j.call(a,0,b)},z.initial=function(a,b,c){return j.call(a,0,a.length-(null==b||c?1:b))},z.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:j.call(a,Math.max(a.length-b,0))},z.rest=z.tail=z.drop=function(a,b,c){return j.call(a,null==b||c?1:b)},z.compact=function(a){return z.filter(a,z.identity)};var F=function(a,b,c){return b&&z.every(a,z.isArray)?k.apply(c,a):(A(a,function(a){z.isArray(a)||z.isArguments(a)?b?i.apply(c,a):F(a,b,c):c.push(a)}),c)};z.flatten=function(a,b){return F(a,b,[])},z.without=function(a){return z.difference(a,j.call(arguments,1))},z.partition=function(a,b){var c=[],d=[];return A(a,function(a){(b(a)?c:d).push(a)}),[c,d]},z.uniq=z.unique=function(a,b,c,d){z.isFunction(b)&&(d=c,c=b,b=!1);var e=c?z.map(a,c,d):a,f=[],g=[];return A(e,function(c,d){(b?d&&g[g.length-1]===c:z.contains(g,c))||(g.push(c),f.push(a[d]))}),f},z.union=function(){return z.uniq(z.flatten(arguments,!0))},z.intersection=function(a){var b=j.call(arguments,1);return z.filter(z.uniq(a),function(a){return z.every(b,function(b){return z.contains(b,a)})})},z.difference=function(a){var b=k.apply(f,j.call(arguments,1));return z.filter(a,function(a){return!z.contains(b,a)})},z.zip=function(){for(var a=z.max(z.pluck(arguments,"length").concat(0)),b=new Array(a),c=0;a>c;c++)b[c]=z.pluck(arguments,""+c);return b},z.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},z.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=z.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(u&&a.indexOf===u)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},z.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(v&&a.lastIndexOf===v)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},z.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);d>e;)f[e++]=a,a+=c;return f};var G=function(){};z.bind=function(a,b){var c,d;if(y&&a.bind===y)return y.apply(a,j.call(arguments,1));if(!z.isFunction(a))throw new TypeError;return c=j.call(arguments,2),d=function(){if(!(this instanceof d))return a.apply(b,c.concat(j.call(arguments)));G.prototype=a.prototype;var e=new G;G.prototype=null;var f=a.apply(e,c.concat(j.call(arguments)));return Object(f)===f?f:e}},z.partial=function(a){var b=j.call(arguments,1);return function(){for(var c=0,d=b.slice(),e=0,f=d.length;f>e;e++)d[e]===z&&(d[e]=arguments[c++]);for(;c<arguments.length;)d.push(arguments[c++]);return a.apply(this,d)}},z.bindAll=function(a){var b=j.call(arguments,1);if(0===b.length)throw new Error("bindAll must be passed function names");return A(b,function(b){a[b]=z.bind(a[b],a)}),a},z.memoize=function(a,b){var c={};return b||(b=z.identity),function(){var d=b.apply(this,arguments);return z.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},z.delay=function(a,b){var c=j.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},z.defer=function(a){return z.delay.apply(z,[a,1].concat(j.call(arguments,1)))},z.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:z.now(),g=null,f=a.apply(d,e),d=e=null};return function(){var j=z.now();h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k?(clearTimeout(g),g=null,h=j,f=a.apply(d,e),d=e=null):g||c.trailing===!1||(g=setTimeout(i,k)),f}},z.debounce=function(a,b,c){var d,e,f,g,h,i=function(){var j=z.now()-g;b>j?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),f=e=null))};return function(){f=this,e=arguments,g=z.now();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}},z.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},z.wrap=function(a,b){return z.partial(b,a)},z.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];
|
||
return b[0]}},z.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},z.keys=function(a){if(!z.isObject(a))return[];if(x)return x(a);var b=[];for(var c in a)z.has(a,c)&&b.push(c);return b},z.values=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},z.pairs=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},z.invert=function(a){for(var b={},c=z.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},z.functions=z.methods=function(a){var b=[];for(var c in a)z.isFunction(a[c])&&b.push(c);return b.sort()},z.extend=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},z.pick=function(a){var b={},c=k.apply(f,j.call(arguments,1));return A(c,function(c){c in a&&(b[c]=a[c])}),b},z.omit=function(a){var b={},c=k.apply(f,j.call(arguments,1));for(var d in a)z.contains(c,d)||(b[d]=a[d]);return b},z.defaults=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)void 0===a[c]&&(a[c]=b[c])}),a},z.clone=function(a){return z.isObject(a)?z.isArray(a)?a.slice():z.extend({},a):a},z.tap=function(a,b){return b(a),a};var H=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof z&&(a=a._wrapped),b instanceof z&&(b=b._wrapped);var e=l.call(a);if(e!=l.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;var g=a.constructor,h=b.constructor;if(g!==h&&!(z.isFunction(g)&&g instanceof g&&z.isFunction(h)&&h instanceof h)&&"constructor"in a&&"constructor"in b)return!1;c.push(a),d.push(b);var i=0,j=!0;if("[object Array]"==e){if(i=a.length,j=i==b.length)for(;i--&&(j=H(a[i],b[i],c,d)););}else{for(var k in a)if(z.has(a,k)&&(i++,!(j=z.has(b,k)&&H(a[k],b[k],c,d))))break;if(j){for(k in b)if(z.has(b,k)&&!i--)break;j=!i}}return c.pop(),d.pop(),j};z.isEqual=function(a,b){return H(a,b,[],[])},z.isEmpty=function(a){if(null==a)return!0;if(z.isArray(a)||z.isString(a))return 0===a.length;for(var b in a)if(z.has(a,b))return!1;return!0},z.isElement=function(a){return!(!a||1!==a.nodeType)},z.isArray=w||function(a){return"[object Array]"==l.call(a)},z.isObject=function(a){return a===Object(a)},A(["Arguments","Function","String","Number","Date","RegExp"],function(a){z["is"+a]=function(b){return l.call(b)=="[object "+a+"]"}}),z.isArguments(arguments)||(z.isArguments=function(a){return!(!a||!z.has(a,"callee"))}),"function"!=typeof/./&&(z.isFunction=function(a){return"function"==typeof a}),z.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},z.isNaN=function(a){return z.isNumber(a)&&a!=+a},z.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==l.call(a)},z.isNull=function(a){return null===a},z.isUndefined=function(a){return void 0===a},z.has=function(a,b){return m.call(a,b)},z.noConflict=function(){return a._=d,this},z.identity=function(a){return a},z.constant=function(a){return function(){return a}},z.property=function(a){return function(b){return b[a]}},z.matches=function(a){return function(b){if(b===a)return!0;for(var c in a)if(a[c]!==b[c])return!1;return!0}},z.times=function(a,b,c){for(var d=Array(Math.max(0,a)),e=0;a>e;e++)d[e]=b.call(c,e);return d},z.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))},z.now=Date.now||function(){return(new Date).getTime()};var I={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};I.unescape=z.invert(I.escape);var J={escape:new RegExp("["+z.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+z.keys(I.unescape).join("|")+")","g")};z.each(["escape","unescape"],function(a){z[a]=function(b){return null==b?"":(""+b).replace(J[a],function(b){return I[a][b]})}}),z.result=function(a,b){if(null==a)return void 0;var c=a[b];return z.isFunction(c)?c.call(a):c},z.mixin=function(a){A(z.functions(a),function(b){var c=z[b]=a[b];z.prototype[b]=function(){var a=[this._wrapped];return i.apply(a,arguments),O.call(this,c.apply(z,a))}})};var K=0;z.uniqueId=function(a){var b=++K+"";return a?a+b:b},z.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var L=/(.)^/,M={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},N=/\\|'|\r|\n|\t|\u2028|\u2029/g;z.template=function(a,b,c){var d;c=z.defaults({},c,z.templateSettings);var e=new RegExp([(c.escape||L).source,(c.interpolate||L).source,(c.evaluate||L).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(N,function(a){return"\\"+M[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=new Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,z);var i=function(a){return d.call(this,a,z)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},z.chain=function(a){return z(a).chain()};var O=function(a){return this._chain?z(a).chain():a};z.mixin(z),A(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=f[a];z.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],O.call(this,c)}}),A(["concat","join","slice"],function(a){var b=f[a];z.prototype[a]=function(){return O.call(this,b.apply(this._wrapped,arguments))}}),z.extend(z.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return z})}).call(this)},{}],66:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:10,sinon:50,"sinon-chai":49,underscore:65}],67:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/TextYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/TextYatta.coffee":4,chai:10,sinon:50,"sinon-chai":49,underscore:65}],68:[function(a){var b,c,d,e,f,g,h,i,j,k=function(a,b){return function(){return a.apply(b,arguments)}};e=a("chai"),f=e.expect,g=e.should(),h=a("sinon"),i=a("sinon-chai"),j=a("underscore"),e.use(i),d=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee"),c=function(){function a(){this.applyRandomOp=k(this.applyRandomOp,this),this.generateRandomOp=k(this.generateRandomOp,this),this.generateDeleteOp=k(this.generateDeleteOp,this),this.generateReplaceOp=k(this.generateReplaceOp,this),this.generateInsertOp=k(this.generateInsertOp,this),this.number_of_test_cases_multiplier=1,this.repeat_this=1*this.number_of_test_cases_multiplier,this.doSomething_amount=5e3*this.number_of_test_cases_multiplier,this.number_of_engines=10+this.number_of_test_cases_multiplier-1,this.time=0,this.ops=0,this.time_now=0,this.reinitialize()}return a.prototype.reinitialize=function(){var a,c,e,f;for(this.users=[],this.Connector=b(this.users),this.users.push(new d(0,this.Connector)),this.users[0].val("name","initial"),f=[],a=c=1,e=this.number_of_engines;e>=1?e>c:c>e;a=e>=1?++c:--c)f.push(this.users.push(new d(a,this.Connector)));return f},a.prototype.getSomeUser=function(){var a;return a=j.random(0,this.users.length-1),this.users[a]},a.prototype.getRandomText=function(){var a,b,c,d;return a="abcdefghijklmnopqrstuvwxyz",b=j.random(0,10),c=a[j.random(0,a.length-1)],d="",j(b).times(function(){return d+=c}),d},a.prototype.generateInsertOp=function(a){var b;return b=j.random(0,this.users[a].val("name").val().length-1),this.users[a].val("name").insertText(b,this.getRandomText()),null},a.prototype.generateReplaceOp=function(a){return this.users[a].val("name").replaceText(this.getRandomText()),null},a.prototype.generateDeleteOp=function(a){var b,c,d;return void(this.users[a].val("name").val().length>0&&(d=j.random(0,this.users[a].val("name").val().length-1),b=1,c=this.users[a].val("name").deleteText(d,b)))},a.prototype.generateRandomOp=function(a){var b,c,d;return d=[this.generateDeleteOp,this.generateInsertOp,this.generateReplaceOp],b=j.random(d.length-1),c=d[b](a)},a.prototype.applyRandomOp=function(a){var b;return b=this.users[a],b.getConnector().flushOneRandom()},a.prototype.doSomething=function(){var a,b,c;return c=j.random(this.number_of_engines-1),b=[this.applyRandomOp,this.generateRandomOp],a=j.random(b.length-1),b[a](c)},a.prototype.flushAll=function(){var a,b,c,d,e,f;for(e=this.users,f=[],b=c=0,d=e.length;d>c;b=++c)a=e[b],f.push(a.getConnector().flushAll());return f},a.prototype.compareAll=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;for(this.flushAll(),this.time+=(new Date).getTime()-this.time_now,d=0,b=i=0,m=this.users.length;m>=0?m>i:i>m;b=m>=0?++i:--i)d+=this.users[b].getConnector().getOpsInExecutionOrder().length;for(this.ops+=d*this.users.length,f=Math.floor(this.ops/this.time),null!=a&&console.log(""+a+"/"+this.repeat_this+": Every collaborator ("+this.users.length+") applied "+d+" ops in a different order."+(" Over all we consumed "+this.ops+" operations in "+this.time/1e3+" seconds ("+f+" ops/msek).")),o=[],b=j=0,n=this.users.length-1;n>=0?n>j:j>n;b=n>=0?++j:--j)if(this.users[b].val("name").val()!==this.users[b+1].val("name").val()){for(g=function(a,b){var c,d,e,f,g,h,i,j;for(e=this.users[a].getConnector().getOpsInExecutionOrder(),g=0,i=e.length;i>g;g++)f=e[g],console.log(JSON.stringify(f));for(console.log(""),f="ops = [",c=h=0,j=e.length;j>h;c=++h)d=e[c],0!==c&&(f+=", "),f+="op"+c;return f+="]",console.log(f),console.log("@users[@last_user].ot.applyOps ops"),console.log("expect(@users[@last_user].ot.val('name')).to.equal(\""+users[b].val("name")+'")'),e},console.log(""),console.log("Found an OT Puzzle!"),console.log("OT states:"),c=k=0,l=users.length;l>k;c=++k)h=users[c],console.log("OT"+c+": "+h.val("name"));console.log("\nOT execution order ("+b+","+(b+1)+"):"),g(b,b+1),console.log(""),e=g(b+1,b),o.push(console.log(""))}else o.push(void 0);return o},a.prototype.run=function(){var a,b,c,d,e,f,g;for(console.log(""),g=[],b=c=1,e=this.repeat_this;e>=1?e>=c:c>=e;b=e>=1?++c:--c){for(this.time_now=(new Date).getTime(),a=d=1,f=this.doSomething_amount;f>=1?f>=d:d>=f;a=f>=1?++d:--d)this.doSomething();this.compareAll(b),g.push(this.reinitialize())}return g},a}(),describe("JsonYatta",function(){return beforeEach(function(a){return this.yTest=new c,a()}),it("has a JsonWrapper",function(){var a,b;return b=this.yTest.getSomeUser().root_element,b.val("x","dtrn","immutable"),b.val("set",{x:"x"},"immutable"),a=b.value,a.x,a.set={y:""},a.x,a.set,a.set.x,f(a.x).to.equal("dtrn"),f(a.set.x).to.equal("x")}),it("can handle creaton of complex json",function(){return this.yTest.getSomeUser().val("x",{a:"b"}),this.yTest.getSomeUser().val("a",{a:{q:"dtrndtrtdrntdrnrtdnrtdnrtdnrtdnrdnrdt"}}),this.yTest.getSomeUser().val("b",{a:{}}),this.yTest.getSomeUser().val("c",{a:"c"}),this.yTest.getSomeUser().val("c",{a:"b"}),this.yTest.compareAll(),this.yTest.getSomeUser().value.a.a.q.insertText(0,"AAA"),this.yTest.compareAll(),f(this.yTest.getSomeUser().value.a.a.q.val()).to.equal("AAAdtrndtrtdrntdrnrtdnrtdnrtdnrtdnrdnrdt")}),it("handles some immutable tests",function(){return this.yTest.getSomeUser().val("string","text","immutable"),this.yTest.getSomeUser().val("number",4,"immutable"),this.yTest.getSomeUser().val("object",{q:"rr"},"immutable"),this.yTest.compareAll(),f(this.yTest.getSomeUser().val("string")).to.equal("text"),f(this.yTest.getSomeUser().val("number")).to.equal(4),f(this.yTest.getSomeUser().val("object").val("q")).to.equal("rr")}),it("can handle many engines, many operations, concurrently (random)",function(){return this.yTest.run()})})},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:10,sinon:50,"sinon-chai":49,underscore:65}]},{},[66,67,68]),!function c(a,b,d){function e(g,h){if(!b[g]){if(!a[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=b[g]={exports:{}};a[g][0].call(j.exports,function(b){var c=a[g][1][b];return e(c?c:b)},j,j.exports,c,a,b,d)}return b[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){var c;c=a("underscore"),b.exports=function(a){var b;return b=function(){function b(b,c,d){var e,f;this.engine=b,this.HB=c,this.execution_listener=d,f=function(a){return function(b){return a.send(b)}}(this),this.execution_listener.push(f),this.applied_operations=[],e=function(a){return function(b){return a.applied_operations.push(b)}}(this),this.execution_listener.push(e),0!==(null!=a?a.length:void 0)&&this.engine.applyOps(a[0].getHistoryBuffer()._encode()),this.unexecuted={}}return b.prototype.getOpsInExecutionOrder=function(){return this.applied_operations},b.prototype.getRootElement=function(){return a.length>0?a[0].getRootElement().getUid():void 0},b.prototype.send=function(b){var c,d,e,f;if(b.uid.creator===this.HB.getUserId()&&"string"!=typeof b.uid.op_number){for(f=[],d=0,e=a.length;e>d;d++)c=a[d],f.push(c.getUserId()!==this.HB.getUserId()?c.getConnector().receive(b):void 0);return f}},b.prototype.receive=function(a){var b,c;return null==(b=this.unexecuted)[c=a.creator]&&(b[c]=[]),this.unexecuted[a.creator].push(a)},b.prototype.flushOne=function(a){var b;return(null!=(b=this.unexecuted[a])?b.length:void 0)>0?this.engine.applyOp(this.unexecuted[a].shift()):void 0},b.prototype.flushOneRandom=function(){return this.flushOne(c.random(0,a.length-1))},b.prototype.flushAll=function(){var a,b,c;c=this.unexecuted;for(a in c)b=c[a],this.engine.applyOps(b);return this.unexecuted={}},b.prototype.sync=function(){throw new Error("Can't use this a.t.m.")},b}()}},{underscore:65}],2:[function(a,b){var c;c=function(){function a(a,b){this.HB=a,this.parser=b,this.unprocessed_ops=[]}return a.prototype.parseOperation=function(a){var b;if(b=this.parser[a.type],null!=b)return b(a);throw new Error("You forgot to specify a parser for type "+a.type+". The message is "+JSON.stringify(a)+".")},a.prototype.applyOps=function(a){var b,c,d,e,f,g,h,i;for(c=[],d=0,g=a.length;g>d;d++)b=a[d],c.push(this.parseOperation(b));for(e=0,h=c.length;h>e;e++)b=c[e],this.HB.addOperation(b);for(f=0,i=c.length;i>f;f++)b=c[f],b.execute()||this.unprocessed_ops.push(b);return this.tryUnprocessed()},a.prototype.applyOp=function(a){var b;return b=this.parseOperation(a),this.HB.addOperation(b),b.execute()||this.unprocessed_ops.push(b),this.tryUnprocessed()},a.prototype.tryUnprocessed=function(){var a,b,c,d,e,f,g;for(g=[];;){for(a=this.unprocessed_ops.length,c=[],f=this.unprocessed_ops,d=0,e=f.length;e>d;d++)b=f[d],b.execute()||c.push(b);if(this.unprocessed_ops=c,this.unprocessed_ops.length===a)break;g.push(void 0)}return g},a}(),b.exports=c},{}],3:[function(a,b){var c,d,e,f;f=a("../Types/JsonTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),g=f(this.HB),this.engine=new c(this.HB,g.parser),this.connector=new b(this.engine,this.HB,g.execution_listener,this),h=this.connector.getRootElement(),null==h?(e=new g.types.JsonType(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=e):this.root_element=this.HB.getOperation(h)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.setMutableDefault=function(a){return this.root_element.setMutableDefault(a)},a.prototype.getUserId=function(){return this.HB.getUserId()},a.prototype.val=function(a,b,c){return this.root_element.val(a,b,c)},Object.defineProperty(a.prototype,"value",{get:function(){return this.root_element.value},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),a}(),"undefined"!=typeof window&&null!==window&&(window.JsonYatta=e),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/JsonTypes.coffee":7}],4:[function(a,b){var c,d,e,f;f=a("../Types/TextTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),h=f(this.HB),this.engine=new c(this.HB,h.parser),this.connector=new b(this.engine,this.HB,h.execution_listener),g=this.connector.getRootElement(),null==g?(e=new h.types.Word(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=this.HB.addOperation(new h.types.ReplaceManager(e,this.HB.getNextOperationIdentifier())).execute()):this.root_element=this.HB.getOperation(g)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.getUserId=function(){return this.HB.getUserId()},a.prototype.val=function(){return this.root_element.val().val()},a.prototype.insertText=function(a,b){return this.root_element.val().insertText(a,b)},a.prototype.deleteText=function(a,b){return this.root_element.val().deleteText(a,b)},a.prototype.replaceText=function(a){return this.root_element.val().replaceText(a)},a}(),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/TextTypes.coffee":9}],5:[function(a,b){var c;c=function(){function a(a){this.user_id=a,this.operation_counter={},this.buffer={},this.change_listeners=[]}return a.prototype.getUserId=function(){return this.user_id},a.prototype.getOperationCounter=function(){var a,b,c,d;b={},d=this.operation_counter;for(c in d)a=d[c],b[c]=a;return b},a.prototype._encode=function(){var a,b,c,d,e,f;a=[],f=this.buffer;for(d in f){e=f[d];for(c in e)b=e[c],isNaN(parseInt(c))||a.push(b._encode())}return a},a.prototype.getNextOperationIdentifier=function(a){var b;return null==a&&(a=this.user_id),null==this.operation_counter[a]&&(this.operation_counter[a]=0),b={creator:a,op_number:this.operation_counter[a]},this.operation_counter[a]++,b},a.prototype.getOperation=function(a){var b;if(a instanceof Object)return null!=(b=this.buffer[a.creator])?b[a.op_number]:void 0;if(null!=a)throw new Error("This type of uid is not defined!")},a.prototype.addOperation=function(a){if(null==this.buffer[a.creator]&&(this.buffer[a.creator]={}),null==this.operation_counter[a.creator]&&(this.operation_counter[a.creator]=0),null!=this.buffer[a.creator][a.op_number])throw new Error("You must not overwrite operations!");return this.buffer[a.creator][a.op_number]=a,"number"==typeof a.op_number&&a.creator!==this.getUserId()&&this.operation_counter[a.creator]++,a},a}(),b.exports=c},{}],6:[function(a,b){var c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};b.exports=function(a){var b,c,e,f,g,h,i;return i={},h=[],g=function(){function b(b){null==b&&(b=a.getNextOperationIdentifier()),this.creator=b.creator,this.op_number=b.op_number}return b.prototype.getUid=function(){return{creator:this.creator,op_number:this.op_number}},b.prototype.execute=function(){var a,b,c;for(this.is_executed=!0,b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this},b.prototype.saveOperation=function(a,b){return null!=(null!=b?b.execute:void 0)?this[a]=b:null!=b?(null==this.unchecked&&(this.unchecked={}),this.unchecked[a]=b):void 0},b.prototype.validateSavedOperations=function(){var b,c,d,e,f,g;f={},e=this,g=this.unchecked;for(b in g)d=g[b],c=a.getOperation(d),c?this[b]=c:(f[b]=d,e=!1);return delete this.unchecked,e||(this.unchecked=f),e},b}(),b=function(a){function b(a,c){this.saveOperation("deletes",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype._encode=function(){return{type:"Delete",uid:this.getUid(),deletes:this.deletes.getUid()}},b.prototype.execute=function(){return this.validateSavedOperations()?(this.deletes.applyDelete(this),b.__super__.execute.apply(this,arguments),this):!1},b}(g),i.Delete=function(a){var c,d;return d=a.uid,c=a.deletes,new b(d,c)},f=function(a){function b(a,c,d,e){this.saveOperation("prev_cl",c),this.saveOperation("next_cl",d),null!=e?this.saveOperation("origin",e):this.saveOperation("origin",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype.applyDelete=function(a){return null==this.deleted_by&&(this.deleted_by=[]),this.deleted_by.push(a)},b.prototype.isDeleted=function(){var a;return(null!=(a=this.deleted_by)?a.length:void 0)>0},b.prototype.getDistanceToOrigin=function(){var a,b;for(a=0,b=this.prev_cl;this.origin!==b;){if(a++,this===this.prev_cl)throw new Error("this should not happen ;) ");b=b.prev_cl}return a},b.prototype.update_sl=function(){var a;return a=this.prev_cl,update("prev_cl","prev_sl"),update("next_cl","prev_sl")},b.prototype.execute=function(){var a,c,d,e,f;if(null!=this.is_executed)return this;if(this.validateSavedOperations()){if((null!=(e=this.prev_cl)?e.validateSavedOperations():void 0)&&(null!=(f=this.next_cl)?f.validateSavedOperations():void 0)&&this.prev_cl.next_cl!==this){for(a=0,d=this.prev_cl.next_cl,c=0;null==d&&(console.log(JSON.stringify(this.prev_cl.getUid())),console.log(JSON.stringify(this.next_cl.getUid()))),d!==this.next_cl;){if(d.getDistanceToOrigin()===c)d.creator<this.creator&&(this.prev_cl=d,a=c+1);else{if(!(d.getDistanceToOrigin()<c))break;c-a<=d.getDistanceToOrigin()&&(this.prev_cl=d,a=c+1)}c++,d=d.next_cl}this.next_cl=this.prev_cl.next_cl,this.prev_cl.next_cl=this,this.next_cl.prev_cl=this}return b.__super__.execute.apply(this,arguments),this}return!1},b}(g),e=function(a){function b(a,c,d,e,f){this.content=null!=c?c:"",b.__super__.constructor.call(this,a,d,e,f)}return d(b,a),b.prototype.val=function(){return this.content},b.prototype._encode=function(){var a;return a={type:"ImmutableObject",uid:this.getUid(),content:this.content},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(f),i.ImmutableObject=function(a){var b,c,d,f,g;return g=a.uid,b=a.content,f=a.prev,c=a.next,d=a.origin,new e(g,b,f,c,d)},c=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return d(b,a),b.prototype.execute=function(){var a,b,c;if(this.validateSavedOperations()){for(b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this}return!1},b.prototype._encode=function(){var a,b;return{type:"Delimiter",uid:this.getUid(),prev:null!=(a=this.prev_cl)?a.getUid():void 0,next:null!=(b=this.next_cl)?b.getUid():void 0}},b}(f),i.Delimiter=function(a){var b,d,e;return e=a.uid,d=a.prev,b=a.next,new c(e,d,b)},{types:{Delete:b,Insert:f,Delimiter:c,Operation:g,ImmutableObject:e},parser:i,execution_listener:h}}},{}],7:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./TextTypes.coffee"),b.exports=function(a){var b,d,f,g,h;return g=c(a),h=g.types,f=g.parser,d=function(a){var c;return new(c=function(){function a(c){var e,f,g,i;i=c.map,g=function(e,f){return Object.defineProperty(a.prototype,e,{get:function(){var a;return a=f.val(),a instanceof b?d(a):a instanceof h.ImmutableObject?a.val():a},set:function(a){var b,d,f,g;if(a.constructor==={}.constructor){f=c.val(e),g=[];for(b in a)d=a[b],g.push(f.val(b,d,"immutable"));return g}return c.val(e,a,"immutable")},enumerable:!0,configurable:!1})};for(e in i)f=i[e],g(e,f)}return a}())(a)},b=function(b){function c(a,b,d){var e,f;if(c.__super__.constructor.call(this,a),null!=b){if("object"!=typeof b)throw new Error("The initial value of JsonTypes must be of type Object! (current type: "+typeof b+")");for(e in b)f=b[e],this.val(e,f,d)}}return e(c,b),c.prototype.mutable_default=!0,c.prototype.setMutableDefault=function(a){if(a===!0||"mutable"===a)c.prototype.mutable_default=!0;else{if(a!==!1&&"immutable"!==a)throw new Error('Set mutable either "mutable" or "immutable"!');c.prototype.mutable_default=!1}return"OK"},c.prototype.val=function(b,d,e){var f,g,i,j,k;if("object"==typeof b){for(i in b)g=b[i],this.val(i,g,d);return this}if(null!=b&&null!=d){if(e=null!=e?e===!0||"mutable"===e?!0:!1:this.mutable_default,"function"==typeof d)return this;if(e&&"number"!=typeof d||d.constructor===Object){if("string"==typeof d)return k=a.addOperation(new h.Word(a.getNextOperationIdentifier(),d)).execute(),c.__super__.val.call(this,b,k);if(d.constructor===Object)return f=a.addOperation(new c(a.getNextOperationIdentifier(),d,e)).execute(),c.__super__.val.call(this,b,f);throw new Error("You must not set "+typeof d+"-types in collaborative Json-objects!")}return j=a.addOperation(new h.ImmutableObject(void 0,d)).execute(),c.__super__.val.call(this,b,j)}return c.__super__.val.call(this,b,d)},Object.defineProperty(c.prototype,"value",{get:function(){return d(this)},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),c.prototype._encode=function(){return{type:"JsonType",uid:this.getUid()}},c}(h.MapManager),f.JsonType=function(a){var c;return c=a.uid,new b(c)},h.JsonType=b,g}},{"./TextTypes.coffee":9}],8:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./BasicTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i,j,k;return i=c(a),k=i.types,j=i.parser,f=function(c){function d(a){this.map={},d.__super__.constructor.call(this,a)}return e(d,c),d.prototype.val=function(c,e){var f,g,h,i,j;if(null!=e)return null==this.map[c]&&a.addOperation(new b(a.getNextOperationIdentifier(),this,c)).execute(),this.map[c].replace(e),this;if(null!=c)return g=null!=(i=this.map[c])?i.val():void 0,g instanceof k.ImmutableObject?g.val():g;h={},j=this.map;for(c in j)f=j[c],g=f.val(),(g instanceof k.ImmutableObject||g instanceof d)&&(g=g.val()),h[c]=g;return h},d}(k.Operation),b=function(b){function c(a,b,d){this.name=d,this.saveOperation("map_manager",b),c.__super__.constructor.call(this,a)}return e(c,b),c.prototype.execute=function(){var b,d,e,f,h;return this.validateSavedOperations()?(h=this.map_manager.getUid(),h.op_number="_"+h.op_number+"_RM_"+this.name,null==a.getOperation(h)&&(e=this.map_manager.getUid(),e.op_number="_"+e.op_number+"_RM_"+this.name+"_beginning",f=this.map_manager.getUid(),f.op_number="_"+f.op_number+"_RM_"+this.name+"_end",b=a.addOperation(new k.Delimiter(e,void 0,f)),d=a.addOperation(new k.Delimiter(f,b,void 0)).execute(),b.execute(),this.map_manager.map[this.name]=a.addOperation(new g(void 0,h,b,d)).execute()),c.__super__.execute.apply(this,arguments)):!1},c.prototype._encode=function(){return{type:"AddName",uid:this.getUid(),map_manager:this.map_manager.getUid(),name:this.name}},c}(k.Operation),j.AddName=function(a){var c,d,e;return c=a.map_manager,e=a.uid,d=a.name,new b(e,c,d)},d=function(b){function c(b,d,e,f,g,h){null!=d&&null!=e?(this.saveOperation("beginning",d),this.saveOperation("end",e)):(this.beginning=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),void 0,void 0)),this.end=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),this.beginning,void 0)),this.beginning.next_cl=this.end,this.beginning.execute(),this.end.execute()),c.__super__.constructor.call(this,b,f,g,h)}return e(c,b),c.prototype.getLastOperation=function(){return this.end.prev_cl},c.prototype.getFirstOperation=function(){return this.beginning.next_cl},c.prototype.toArray=function(){var a,b;for(a=this.beginning.next_cl,b=[];a!==this.end;)b.push(a),a=a.next_cl;return b},c.prototype.getOperationByPosition=function(a){var b;if(b=this.beginning.next_cl,a>0)for(;b=b.next_cl,b.isDeleted()||(a-=1),0!==a;)if(b instanceof k.Delimiter)throw new Error("position parameter exceeded the length of the document!");return b},c}(k.Insert),g=function(b){function c(a,b,d,e,f,g,h){c.__super__.constructor.call(this,b,d,e,f,g,h),null!=a&&this.replace(a)}return e(c,b),c.prototype.replace=function(b){var c,d;return c=this.getLastOperation(),d=new h(b,this,a.getNextOperationIdentifier(),c,c.next_cl),a.addOperation(d).execute()},c.prototype.val=function(){var a;if(a=this.getLastOperation(),a instanceof k.Delimiter)throw new Error("dtrn");return a.val()},c.prototype._encode=function(){var a;return a={type:"ReplaceManager",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&null!=this.next_cl&&(a.prev=this.prev_cl.getUid(),a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},c}(d),j.ReplaceManager=function(a){var b,c,d,e,f,h,i;return c=a.content,i=a.uid,h=a.prev,e=a.next,f=a.origin,b=a.beginning,d=a.end,new g(c,i,b,d,h,e,f)},h=function(a){function b(a,c,d,e,f,g){if(this.saveOperation("content",a),this.saveOperation("parent",c),null==e||null==f||null==a)throw new Error("You must define content, prev, and next for Replaceable-types!");b.__super__.constructor.call(this,d,e,f,g)}return e(b,a),b.prototype.val=function(){return this.content},b.prototype.replace=function(a){return this.parent.replace(a)},b.prototype.execute=function(){var a;return this.validateSavedOperations()?("function"==typeof(a=this.content).setReplaceManager&&a.setReplaceManager(this.parent),b.__super__.execute.apply(this,arguments),this):!1},b.prototype._encode=function(){var a;return a={type:"Replaceable",content:this.content.getUid(),ReplaceManager:this.parent.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid(),uid:this.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(k.Insert),j.Replaceable=function(a){var b,c,d,e,f,g;return b=a.content,e=a.ReplaceManager,g=a.uid,f=a.prev,c=a.next,d=a.origin,new h(b,e,g,f,c,d)},k.ListManager=d,k.MapManager=f,k.ReplaceManager=g,k.Replaceable=h,i}},{"./BasicTypes.coffee":6}],9:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./StructuredTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i;return h=c(a),i=h.types,g=h.parser,b=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return e(b,a),b}(i.Delete),g.TextDelete=g.Delete,d=function(a){function b(a,c,d,e,f){if(this.content=a,null==d||null==e)throw new Error("You must define prev, and next for TextInsert-types!");b.__super__.constructor.call(this,c,d,e,f)}return e(b,a),b.prototype.getLength=function(){return this.isDeleted()?0:this.content.length},b.prototype.val=function(){return this.isDeleted()?"":this.content},b.prototype._encode=function(){var a;return a={type:"TextInsert",content:this.content,uid:this.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(i.Insert),g.TextInsert=function(a){var b,c,e,f,g;
|
||
return b=a.content,g=a.uid,f=a.prev,c=a.next,e=a.origin,new d(b,g,f,c,e)},f=function(c){function f(a,b,c,d,e,g,h){f.__super__.constructor.call(this,a,c,d,e,g,h),null!=b&&this.insertText(0,b)}return e(f,c),f.prototype.insertText=function(b,c){var e,f,g,h,i,j;for(f=this.getOperationByPosition(b),j=[],h=0,i=c.length;i>h;h++)e=c[h],g=new d(e,a.getNextOperationIdentifier(),f.prev_cl,f),j.push(a.addOperation(g).execute());return j},f.prototype.deleteText=function(c,d){var e,f,g,h,j;for(g=this.getOperationByPosition(c),j=[],f=h=0;d>=0?d>h:h>d;f=d>=0?++h:--h){for(e=a.addOperation(new b(a.getNextOperationIdentifier(),g)).execute(),g=g.next_cl;g.isDeleted();){if(g instanceof i.Delimiter)throw new Error("You can't delete more than there is..");g=g.next_cl}j.push(e._encode())}return j},f.prototype.replaceText=function(b){var c;if(null!=this.replace_manager)return c=a.addOperation(new f(a.getNextOperationIdentifier())).execute(),c.insertText(0,b),this.replace_manager.replace(c);throw new Error("This type is currently not maintained by a ReplaceManager!")},f.prototype.val=function(){var a,b;return a=function(){var a,c,d,e;for(d=this.toArray(),e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(null!=b.val?b.val():"");return e}.call(this),a.join("")},f.prototype.setReplaceManager=function(a){return this.saveOperation("replace_manager",a),this.validateSavedOperations},f.prototype._encode=function(){var a;return a={type:"Word",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},f}(i.ListManager),g.Word=function(a){var b,c,d,e,g,h;return h=a.uid,b=a.beginning,c=a.end,g=a.prev,d=a.next,e=a.origin,new f(h,void 0,b,c,g,d,e)},i.TextInsert=d,i.TextDelete=b,i.Word=f,h}},{"./StructuredTypes.coffee":8}],10:[function(a,b){b.exports=a("./lib/chai")},{"./lib/chai":11}],11:[function(a,b,c){var d=[],c=b.exports={};c.version="1.9.1",c.AssertionError=a("assertion-error");var e=a("./chai/utils");c.use=function(a){return~d.indexOf(a)||(a(this,e),d.push(a)),this};var f=a("./chai/config");c.config=f;var g=a("./chai/assertion");c.use(g);var h=a("./chai/core/assertions");c.use(h);var i=a("./chai/interface/expect");c.use(i);var j=a("./chai/interface/should");c.use(j);var k=a("./chai/interface/assert");c.use(k)},{"./chai/assertion":12,"./chai/config":13,"./chai/core/assertions":14,"./chai/interface/assert":15,"./chai/interface/expect":16,"./chai/interface/should":17,"./chai/utils":28,"assertion-error":37}],12:[function(a,b){var c=a("./config");b.exports=function(a,b){function d(a,b,c){f(this,"ssfi",c||arguments.callee),f(this,"object",a),f(this,"message",b)}var e=a.AssertionError,f=b.flag;a.Assertion=d,Object.defineProperty(d,"includeStack",{get:function(){return console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack},set:function(a){console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack=a}}),Object.defineProperty(d,"showDiff",{get:function(){return console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff},set:function(a){console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff=a}}),d.addProperty=function(a,c){b.addProperty(this.prototype,a,c)},d.addMethod=function(a,c){b.addMethod(this.prototype,a,c)},d.addChainableMethod=function(a,c,d){b.addChainableMethod(this.prototype,a,c,d)},d.overwriteProperty=function(a,c){b.overwriteProperty(this.prototype,a,c)},d.overwriteMethod=function(a,c){b.overwriteMethod(this.prototype,a,c)},d.overwriteChainableMethod=function(a,c,d){b.overwriteChainableMethod(this.prototype,a,c,d)},d.prototype.assert=function(a,d,g,h,i,j){var k=b.test(this,arguments);if(!0!==j&&(j=!1),!0!==c.showDiff&&(j=!1),!k){var d=b.getMessage(this,arguments),l=b.getActual(this,arguments);throw new e(d,{actual:l,expected:h,showDiff:j},c.includeStack?this.assert:f(this,"ssfi"))}},Object.defineProperty(d.prototype,"_obj",{get:function(){return f(this,"object")},set:function(a){f(this,"object",a)}})}},{"./config":13}],13:[function(a,b){b.exports={includeStack:!1,showDiff:!0,truncateThreshold:40}},{}],14:[function(a,b){b.exports=function(a,b){function c(a,c){c&&u(this,"message",c),a=a.toLowerCase();var d=u(this,"object"),e=~["a","e","i","o","u"].indexOf(a.charAt(0))?"an ":"a ";this.assert(a===b.type(d),"expected #{this} to be "+e+a,"expected #{this} not to be "+e+a)}function d(){u(this,"contains",!0)}function e(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=!1;if("array"===b.type(d)&&"object"===b.type(a)){for(var f in d)if(b.eql(d[f],a)){e=!0;break}}else if("object"===b.type(a)){if(!u(this,"negate")){for(var g in a)new t(d).property(g,a[g]);return}var h={};for(var g in a)h[g]=d[g];e=b.eql(h,a)}else e=d&&~d.indexOf(a);this.assert(e,"expected #{this} to include "+b.inspect(a),"expected #{this} to not include "+b.inspect(a))}function f(){var a=u(this,"object"),b=Object.prototype.toString.call(a);this.assert("[object Arguments]"===b,"expected #{this} to be arguments but got "+b,"expected #{this} to not be arguments")}function g(a,b){b&&u(this,"message",b);var c=u(this,"object");return u(this,"deep")?this.eql(a):void this.assert(a===c,"expected #{this} to equal #{exp}","expected #{this} to not equal #{exp}",a,this._obj,!0)}function h(a,c){c&&u(this,"message",c),this.assert(b.eql(a,u(this,"object")),"expected #{this} to deeply equal #{exp}","expected #{this} to not deeply equal #{exp}",a,this._obj,!0)}function i(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>a,"expected #{this} to have a length above #{exp} but got #{act}","expected #{this} to not have a length above #{exp}",a,d)}else this.assert(c>a,"expected #{this} to be above "+a,"expected #{this} to be at most "+a)}function j(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>=a,"expected #{this} to have a length at least #{exp} but got #{act}","expected #{this} to have a length below #{exp}",a,d)}else this.assert(c>=a,"expected #{this} to be at least "+a,"expected #{this} to be below "+a)}function k(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(a>d,"expected #{this} to have a length below #{exp} but got #{act}","expected #{this} to not have a length below #{exp}",a,d)}else this.assert(a>c,"expected #{this} to be below "+a,"expected #{this} to be at least "+a)}function l(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(a>=d,"expected #{this} to have a length at most #{exp} but got #{act}","expected #{this} to have a length above #{exp}",a,d)}else this.assert(a>=c,"expected #{this} to be at most "+a,"expected #{this} to be above "+a)}function m(a,c){c&&u(this,"message",c);var d=b.getName(a);this.assert(u(this,"object")instanceof a,"expected #{this} to be an instance of "+d,"expected #{this} to not be an instance of "+d)}function n(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(d.hasOwnProperty(a),"expected #{this} to have own property "+b.inspect(a),"expected #{this} to not have own property "+b.inspect(a))}function o(){u(this,"doLength",!0)}function p(a,b){b&&u(this,"message",b);var c=u(this,"object");new t(c,b).to.have.property("length");var d=c.length;this.assert(d==a,"expected #{this} to have a length of #{exp} but got #{act}","expected #{this} to not have a length of #{act}",a,d)}function q(a){var c,d=u(this,"object"),e=!0;if(a=a instanceof Array?a:Array.prototype.slice.call(arguments),!a.length)throw new Error("keys required");var f=Object.keys(d),g=a.length;if(e=a.every(function(a){return~f.indexOf(a)}),u(this,"negate")||u(this,"contains")||(e=e&&a.length==f.length),g>1){a=a.map(function(a){return b.inspect(a)});var h=a.pop();c=a.join(", ")+", and "+h}else c=b.inspect(a[0]);c=(g>1?"keys ":"key ")+c,c=(u(this,"contains")?"contain ":"have ")+c,this.assert(e,"expected #{this} to "+c,"expected #{this} to not "+c)}function r(a,c,d){d&&u(this,"message",d);var e=u(this,"object");new t(e,d).is.a("function");var f=!1,g=null,h=null,i=null;0===arguments.length?(c=null,a=null):a&&(a instanceof RegExp||"string"==typeof a)?(c=a,a=null):a&&a instanceof Error?(g=a,a=null,c=null):"function"==typeof a?(h=a.prototype.name||a.name,"Error"===h&&a!==Error&&(h=(new a).name)):a=null;try{e()}catch(j){if(g)return this.assert(j===g,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}",g instanceof Error?g.toString():g,j instanceof Error?j.toString():j),u(this,"object",j),this;if(a&&(this.assert(j instanceof a,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp} but #{act} was thrown",h,j instanceof Error?j.toString():j),!c))return u(this,"object",j),this;var k="object"===b.type(j)&&"message"in j?j.message:""+j;if(null!=k&&c&&c instanceof RegExp)return this.assert(c.exec(k),"expected #{this} to throw error matching #{exp} but got #{act}","expected #{this} to throw error not matching #{exp}",c,k),u(this,"object",j),this;if(null!=k&&c&&"string"==typeof c)return this.assert(~k.indexOf(c),"expected #{this} to throw error including #{exp} but got #{act}","expected #{this} to throw error not including #{act}",c,k),u(this,"object",j),this;f=!0,i=j}var l="",m=null!==h?h:g?"#{exp}":"an error";f&&(l=" but #{act} was thrown"),this.assert(f===!0,"expected #{this} to throw "+m+l,"expected #{this} to not throw "+m+l,g instanceof Error?g.toString():g,i instanceof Error?i.toString():i),u(this,"object",i)}function s(a,b,c){return a.every(function(a){return c?b.some(function(b){return c(a,b)}):-1!==b.indexOf(a)})}var t=a.Assertion,u=(Object.prototype.toString,b.flag);["to","be","been","is","and","has","have","with","that","at","of","same"].forEach(function(a){t.addProperty(a,function(){return this})}),t.addProperty("not",function(){u(this,"negate",!0)}),t.addProperty("deep",function(){u(this,"deep",!0)}),t.addChainableMethod("an",c),t.addChainableMethod("a",c),t.addChainableMethod("include",e,d),t.addChainableMethod("contain",e,d),t.addProperty("ok",function(){this.assert(u(this,"object"),"expected #{this} to be truthy","expected #{this} to be falsy")}),t.addProperty("true",function(){this.assert(!0===u(this,"object"),"expected #{this} to be true","expected #{this} to be false",this.negate?!1:!0)}),t.addProperty("false",function(){this.assert(!1===u(this,"object"),"expected #{this} to be false","expected #{this} to be true",this.negate?!0:!1)}),t.addProperty("null",function(){this.assert(null===u(this,"object"),"expected #{this} to be null","expected #{this} not to be null")}),t.addProperty("undefined",function(){this.assert(void 0===u(this,"object"),"expected #{this} to be undefined","expected #{this} not to be undefined")}),t.addProperty("exist",function(){this.assert(null!=u(this,"object"),"expected #{this} to exist","expected #{this} to not exist")}),t.addProperty("empty",function(){var a=u(this,"object"),b=a;Array.isArray(a)||"string"==typeof object?b=a.length:"object"==typeof a&&(b=Object.keys(a).length),this.assert(!b,"expected #{this} to be empty","expected #{this} not to be empty")}),t.addProperty("arguments",f),t.addProperty("Arguments",f),t.addMethod("equal",g),t.addMethod("equals",g),t.addMethod("eq",g),t.addMethod("eql",h),t.addMethod("eqls",h),t.addMethod("above",i),t.addMethod("gt",i),t.addMethod("greaterThan",i),t.addMethod("least",j),t.addMethod("gte",j),t.addMethod("below",k),t.addMethod("lt",k),t.addMethod("lessThan",k),t.addMethod("most",l),t.addMethod("lte",l),t.addMethod("within",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object"),e=a+".."+b;if(u(this,"doLength")){new t(d,c).to.have.property("length");var f=d.length;this.assert(f>=a&&b>=f,"expected #{this} to have a length within "+e,"expected #{this} to not have a length within "+e)}else this.assert(d>=a&&b>=d,"expected #{this} to be within "+e,"expected #{this} to not be within "+e)}),t.addMethod("instanceof",m),t.addMethod("instanceOf",m),t.addMethod("property",function(a,c,d){d&&u(this,"message",d);var e=u(this,"deep")?"deep property ":"property ",f=u(this,"negate"),g=u(this,"object"),h=u(this,"deep")?b.getPathValue(a,g):g[a];if(f&&void 0!==c){if(void 0===h)throw d=null!=d?d+": ":"",new Error(d+b.inspect(g)+" has no "+e+b.inspect(a))}else this.assert(void 0!==h,"expected #{this} to have a "+e+b.inspect(a),"expected #{this} to not have "+e+b.inspect(a));void 0!==c&&this.assert(c===h,"expected #{this} to have a "+e+b.inspect(a)+" of #{exp}, but got #{act}","expected #{this} to not have a "+e+b.inspect(a)+" of #{act}",c,h),u(this,"object",h)}),t.addMethod("ownProperty",n),t.addMethod("haveOwnProperty",n),t.addChainableMethod("length",p,o),t.addMethod("lengthOf",p,o),t.addMethod("match",function(a,b){b&&u(this,"message",b);var c=u(this,"object");this.assert(a.exec(c),"expected #{this} to match "+a,"expected #{this} not to match "+a)}),t.addMethod("string",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d,c).is.a("string"),this.assert(~d.indexOf(a),"expected #{this} to contain "+b.inspect(a),"expected #{this} to not contain "+b.inspect(a))}),t.addMethod("keys",q),t.addMethod("key",q),t.addMethod("throw",r),t.addMethod("throws",r),t.addMethod("Throw",r),t.addMethod("respondTo",function(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=u(this,"itself"),f="function"!==b.type(d)||e?d[a]:d.prototype[a];this.assert("function"==typeof f,"expected #{this} to respond to "+b.inspect(a),"expected #{this} to not respond to "+b.inspect(a))}),t.addProperty("itself",function(){u(this,"itself",!0)}),t.addMethod("satisfy",function(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(a(d),"expected #{this} to satisfy "+b.objDisplay(a),"expected #{this} to not satisfy"+b.objDisplay(a),this.negate?!1:!0,a(d))}),t.addMethod("closeTo",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(Math.abs(d-a)<=b,"expected #{this} to be close to "+a+" +/- "+b,"expected #{this} not to be close to "+a+" +/- "+b)}),t.addMethod("members",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d).to.be.an("array"),new t(a).to.be.an("array");var e=u(this,"deep")?b.eql:void 0;return u(this,"contains")?this.assert(s(a,d,e),"expected #{this} to be a superset of #{act}","expected #{this} to not be a superset of #{act}",d,a):void this.assert(s(d,a,e)&&s(a,d,e),"expected #{this} to have the same members as #{act}","expected #{this} to not have the same members as #{act}",d,a)})}},{}],15:[function(require,module,exports){module.exports=function(chai,util){var Assertion=chai.Assertion,flag=util.flag,assert=chai.assert=function(a,b){var c=new Assertion(null,null,chai.assert);c.assert(a,b,"[ negation message unavailable ]")};assert.fail=function(a,b,c,d){throw c=c||"assert.fail()",new chai.AssertionError(c,{actual:a,expected:b,operator:d},assert.fail)},assert.ok=function(a,b){new Assertion(a,b).is.ok},assert.notOk=function(a,b){new Assertion(a,b).is.not.ok},assert.equal=function(a,b,c){var d=new Assertion(a,c,assert.equal);d.assert(b==flag(d,"object"),"expected #{this} to equal #{exp}","expected #{this} to not equal #{act}",b,a)},assert.notEqual=function(a,b,c){var d=new Assertion(a,c,assert.notEqual);d.assert(b!=flag(d,"object"),"expected #{this} to not equal #{exp}","expected #{this} to equal #{act}",b,a)},assert.strictEqual=function(a,b,c){new Assertion(a,c).to.equal(b)},assert.notStrictEqual=function(a,b,c){new Assertion(a,c).to.not.equal(b)},assert.deepEqual=function(a,b,c){new Assertion(a,c).to.eql(b)},assert.notDeepEqual=function(a,b,c){new Assertion(a,c).to.not.eql(b)},assert.isTrue=function(a,b){new Assertion(a,b).is["true"]},assert.isFalse=function(a,b){new Assertion(a,b).is["false"]},assert.isNull=function(a,b){new Assertion(a,b).to.equal(null)},assert.isNotNull=function(a,b){new Assertion(a,b).to.not.equal(null)},assert.isUndefined=function(a,b){new Assertion(a,b).to.equal(void 0)},assert.isDefined=function(a,b){new Assertion(a,b).to.not.equal(void 0)},assert.isFunction=function(a,b){new Assertion(a,b).to.be.a("function")},assert.isNotFunction=function(a,b){new Assertion(a,b).to.not.be.a("function")},assert.isObject=function(a,b){new Assertion(a,b).to.be.a("object")},assert.isNotObject=function(a,b){new Assertion(a,b).to.not.be.a("object")},assert.isArray=function(a,b){new Assertion(a,b).to.be.an("array")},assert.isNotArray=function(a,b){new Assertion(a,b).to.not.be.an("array")},assert.isString=function(a,b){new Assertion(a,b).to.be.a("string")},assert.isNotString=function(a,b){new Assertion(a,b).to.not.be.a("string")},assert.isNumber=function(a,b){new Assertion(a,b).to.be.a("number")},assert.isNotNumber=function(a,b){new Assertion(a,b).to.not.be.a("number")},assert.isBoolean=function(a,b){new Assertion(a,b).to.be.a("boolean")},assert.isNotBoolean=function(a,b){new Assertion(a,b).to.not.be.a("boolean")},assert.typeOf=function(a,b,c){new Assertion(a,c).to.be.a(b)},assert.notTypeOf=function(a,b,c){new Assertion(a,c).to.not.be.a(b)},assert.instanceOf=function(a,b,c){new Assertion(a,c).to.be.instanceOf(b)},assert.notInstanceOf=function(a,b,c){new Assertion(a,c).to.not.be.instanceOf(b)},assert.include=function(a,b,c){new Assertion(a,c,assert.include).include(b)},assert.notInclude=function(a,b,c){new Assertion(a,c,assert.notInclude).not.include(b)},assert.match=function(a,b,c){new Assertion(a,c).to.match(b)},assert.notMatch=function(a,b,c){new Assertion(a,c).to.not.match(b)},assert.property=function(a,b,c){new Assertion(a,c).to.have.property(b)},assert.notProperty=function(a,b,c){new Assertion(a,c).to.not.have.property(b)},assert.deepProperty=function(a,b,c){new Assertion(a,c).to.have.deep.property(b)},assert.notDeepProperty=function(a,b,c){new Assertion(a,c).to.not.have.deep.property(b)},assert.propertyVal=function(a,b,c,d){new Assertion(a,d).to.have.property(b,c)},assert.propertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.property(b,c)},assert.deepPropertyVal=function(a,b,c,d){new Assertion(a,d).to.have.deep.property(b,c)},assert.deepPropertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.deep.property(b,c)},assert.lengthOf=function(a,b,c){new Assertion(a,c).to.have.length(b)},assert.Throw=function(a,b,c,d){("string"==typeof b||b instanceof RegExp)&&(c=b,b=null);var e=new Assertion(a,d).to.Throw(b,c);return flag(e,"object")},assert.doesNotThrow=function(a,b,c){"string"==typeof b&&(c=b,b=null),new Assertion(a,c).to.not.Throw(b)},assert.operator=function(val,operator,val2,msg){if(!~["==","===",">",">=","<","<=","!=","!=="].indexOf(operator))throw new Error('Invalid operator "'+operator+'"');var test=new Assertion(eval(val+operator+val2),msg);test.assert(!0===flag(test,"object"),"expected "+util.inspect(val)+" to be "+operator+" "+util.inspect(val2),"expected "+util.inspect(val)+" to not be "+operator+" "+util.inspect(val2))},assert.closeTo=function(a,b,c,d){new Assertion(a,d).to.be.closeTo(b,c)},assert.sameMembers=function(a,b,c){new Assertion(a,c).to.have.same.members(b)},assert.includeMembers=function(a,b,c){new Assertion(a,c).to.include.members(b)},assert.ifError=function(a,b){new Assertion(a,b).to.not.be.ok},function a(b,c){return assert[c]=assert[b],a}("Throw","throw")("Throw","throws")}},{}],16:[function(a,b){b.exports=function(a){a.expect=function(b,c){return new a.Assertion(b,c)}}},{}],17:[function(a,b){b.exports=function(a){function b(){function a(){return this instanceof String||this instanceof Number?new c(this.constructor(this),null,a):this instanceof Boolean?new c(1==this,null,a):new c(this,null,a)}function b(a){Object.defineProperty(this,"should",{value:a,enumerable:!0,configurable:!0,writable:!0})}Object.defineProperty(Object.prototype,"should",{set:b,get:a,configurable:!0});var d={};return d.equal=function(a,b,d){new c(a,d).to.equal(b)},d.Throw=function(a,b,d,e){new c(a,e).to.Throw(b,d)},d.exist=function(a,b){new c(a,b).to.exist},d.not={},d.not.equal=function(a,b,d){new c(a,d).to.not.equal(b)},d.not.Throw=function(a,b,d,e){new c(a,e).to.not.Throw(b,d)},d.not.exist=function(a,b){new c(a,b).to.not.exist},d["throw"]=d.Throw,d.not["throw"]=d.not.Throw,d}var c=a.Assertion;a.should=b,a.Should=b}},{}],18:[function(a,b){var c=a("./transferFlags"),d=a("./flag"),e=a("../config"),f="__proto__"in Object,g=/^(?:length|name|arguments|caller)$/,h=Function.prototype.call,i=Function.prototype.apply;b.exports=function(a,b,j,k){"function"!=typeof k&&(k=function(){});var l={method:j,chainingBehavior:k};a.__methods||(a.__methods={}),a.__methods[b]=l,Object.defineProperty(a,b,{get:function(){l.chainingBehavior.call(this);var b=function m(){var a=d(this,"ssfi");a&&e.includeStack===!1&&d(this,"ssfi",m);var b=l.method.apply(this,arguments);return void 0===b?this:b};if(f){var j=b.__proto__=Object.create(this);j.call=h,j.apply=i}else{var k=Object.getOwnPropertyNames(a);k.forEach(function(c){if(!g.test(c)){var d=Object.getOwnPropertyDescriptor(a,c);Object.defineProperty(b,c,d)}})}return c(this,b),b},configurable:!0})}},{"../config":13,"./flag":21,"./transferFlags":35}],19:[function(a,b){var c=a("../config"),d=a("./flag");b.exports=function(a,b,e){a[b]=function(){var f=d(this,"ssfi");f&&c.includeStack===!1&&d(this,"ssfi",a[b]);var g=e.apply(this,arguments);return void 0===g?this:g}}},{"../config":13,"./flag":21}],20:[function(a,b){b.exports=function(a,b,c){Object.defineProperty(a,b,{get:function(){var a=c.call(this);return void 0===a?this:a},configurable:!0})}},{}],21:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));return 3!==arguments.length?d[b]:void(d[b]=c)}},{}],22:[function(a,b){b.exports=function(a,b){return b.length>4?b[4]:a._obj}},{}],23:[function(a,b){b.exports=function(a){var b=[];for(var c in a)b.push(c);return b}},{}],24:[function(a,b){var c=a("./flag"),d=a("./getActual"),e=(a("./inspect"),a("./objDisplay"));b.exports=function(a,b){var f=c(a,"negate"),g=c(a,"object"),h=b[3],i=d(a,b),j=f?b[2]:b[1],k=c(a,"message");return j=j||"",j=j.replace(/#{this}/g,e(g)).replace(/#{act}/g,e(i)).replace(/#{exp}/g,e(h)),k?k+": "+j:j}},{"./flag":21,"./getActual":22,"./inspect":29,"./objDisplay":30}],25:[function(a,b){b.exports=function(a){if(a.name)return a.name;var b=/^\s?function ([^(]*)\(/.exec(a);return b&&b[1]?b[1]:""}},{}],26:[function(a,b){function c(a){var b=a.replace(/\[/g,".["),c=b.match(/(\\\.|[^.]+?)+/g);return c.map(function(a){var b=/\[(\d+)\]$/,c=b.exec(a);return c?{i:parseFloat(c[1])}:{p:a}})}function d(a,b){for(var c,d=b,e=0,f=a.length;f>e;e++){var g=a[e];d?("undefined"!=typeof g.p?d=d[g.p]:"undefined"!=typeof g.i&&(d=d[g.i]),e==f-1&&(c=d)):c=void 0}return c}b.exports=function(a,b){var e=c(a);return d(e,b)}},{}],27:[function(a,b){b.exports=function(){function a(a){-1===b.indexOf(a)&&b.push(a)}for(var b=Object.getOwnPropertyNames(subject),c=Object.getPrototypeOf(subject);null!==c;)Object.getOwnPropertyNames(c).forEach(a),c=Object.getPrototypeOf(c);return b}},{}],28:[function(a,b,c){var c=b.exports={};c.test=a("./test"),c.type=a("./type"),c.getMessage=a("./getMessage"),c.getActual=a("./getActual"),c.inspect=a("./inspect"),c.objDisplay=a("./objDisplay"),c.flag=a("./flag"),c.transferFlags=a("./transferFlags"),c.eql=a("deep-eql"),c.getPathValue=a("./getPathValue"),c.getName=a("./getName"),c.addProperty=a("./addProperty"),c.addMethod=a("./addMethod"),c.overwriteProperty=a("./overwriteProperty"),c.overwriteMethod=a("./overwriteMethod"),c.addChainableMethod=a("./addChainableMethod"),c.overwriteChainableMethod=a("./overwriteChainableMethod")},{"./addChainableMethod":18,"./addMethod":19,"./addProperty":20,"./flag":21,"./getActual":22,"./getMessage":24,"./getName":25,"./getPathValue":26,"./inspect":29,"./objDisplay":30,"./overwriteChainableMethod":31,"./overwriteMethod":32,"./overwriteProperty":33,"./test":34,"./transferFlags":35,"./type":36,"deep-eql":38}],29:[function(a,b,c){function d(a,b,c){var d={showHidden:b,seen:[],stylize:function(a){return a}};return e(d,a,"undefined"==typeof c?2:c)}function e(a,b,d){if(b&&"function"==typeof b.inspect&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var o=b.inspect(d);return"string"!=typeof o&&(o=e(a,o,d)),o}var u=f(a,b);if(u)return u;if(t(b))return s(b);var v=r(b),w=a.showHidden?q(b):v;if(0===w.length||n(b)&&(1===w.length&&"stack"===w[0]||2===w.length&&"description"===w[0]&&"stack"===w[1])){if("function"==typeof b){var x=p(b),y=x?": "+x:"";return a.stylize("[Function"+y+"]","special")}if(l(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(m(b))return a.stylize(Date.prototype.toUTCString.call(b),"date");if(n(b))return g(b)}var z="",A=!1,B=["{","}"];if(k(b)&&(A=!0,B=["[","]"]),"function"==typeof b){var x=p(b),y=x?": "+x:"";z=" [Function"+y+"]"}if(l(b)&&(z=" "+RegExp.prototype.toString.call(b)),m(b)&&(z=" "+Date.prototype.toUTCString.call(b)),n(b))return g(b);if(0===w.length&&(!A||0==b.length))return B[0]+z+B[1];if(0>d)return l(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var C;return C=A?h(a,b,d,v,w):w.map(function(c){return i(a,b,d,v,c,A)}),a.seen.pop(),j(C,z,B)}function f(a,b){switch(typeof b){case"undefined":return a.stylize("undefined","undefined");case"string":var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string");case"number":return a.stylize(""+b,"number");case"boolean":return a.stylize(""+b,"boolean")}return null===b?a.stylize("null","null"):void 0}function g(a){return"["+Error.prototype.toString.call(a)+"]"}function h(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(Object.prototype.hasOwnProperty.call(b,String(g))?i(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(i(a,b,c,d,e,!0))}),f}function i(a,b,c,d,f,g){var h,i;if(b.__lookupGetter__&&(b.__lookupGetter__(f)?i=b.__lookupSetter__(f)?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):b.__lookupSetter__(f)&&(i=a.stylize("[Setter]","special"))),d.indexOf(f)<0&&(h="["+f+"]"),i||(a.seen.indexOf(b[f])<0?(i=null===c?e(a,b[f],null):e(a,b[f],c-1),i.indexOf("\n")>-1&&(i=g?i.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+i.split("\n").map(function(a){return" "+a}).join("\n"))):i=a.stylize("[Circular]","special")),"undefined"==typeof h){if(g&&f.match(/^\d+$/))return i;h=JSON.stringify(""+f),h.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(h=h.substr(1,h.length-2),h=a.stylize(h,"name")):(h=h.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),h=a.stylize(h,"string"))}return h+": "+i}function j(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function k(a){return Array.isArray(a)||"object"==typeof a&&"[object Array]"===o(a)}function l(a){return"object"==typeof a&&"[object RegExp]"===o(a)}function m(a){return"object"==typeof a&&"[object Date]"===o(a)}function n(a){return"object"==typeof a&&"[object Error]"===o(a)}function o(a){return Object.prototype.toString.call(a)}var p=a("./getName"),q=a("./getProperties"),r=a("./getEnumerableProperties");b.exports=d;var s=function(a){if("outerHTML"in a)return a.outerHTML;var b,c="http://www.w3.org/1999/xhtml",d=document.createElementNS(c,"_"),e=((window.HTMLElement||window.Element).prototype,new XMLSerializer);return document.xmlVersion?e.serializeToString(a):(d.appendChild(a.cloneNode(!1)),b=d.innerHTML.replace("><",">"+a.innerHTML+"<"),d.innerHTML="",b)},t=function(a){return"object"==typeof HTMLElement?a instanceof HTMLElement:a&&"object"==typeof a&&1===a.nodeType&&"string"==typeof a.nodeName}},{"./getEnumerableProperties":23,"./getName":25,"./getProperties":27}],30:[function(a,b){var c=a("./inspect"),d=a("../config");b.exports=function(a){var b=c(a),e=Object.prototype.toString.call(a);if(d.truncateThreshold&&b.length>=d.truncateThreshold){if("[object Function]"===e)return a.name&&""!==a.name?"[Function: "+a.name+"]":"[Function]";if("[object Array]"===e)return"[ Array("+a.length+") ]";if("[object Object]"===e){var f=Object.keys(a),g=f.length>2?f.splice(0,2).join(", ")+", ...":f.join(", ");return"{ Object ("+g+") }"}return b}return b}},{"../config":13,"./inspect":29}],31:[function(a,b){b.exports=function(a,b,c,d){var e=a.__methods[b],f=e.chainingBehavior;e.chainingBehavior=function(){var a=d(f).call(this);return void 0===a?this:a};var g=e.method;e.method=function(){var a=c(g).apply(this,arguments);return void 0===a?this:a}}},{}],32:[function(a,b){b.exports=function(a,b,c){var d=a[b],e=function(){return this};d&&"function"==typeof d&&(e=d),a[b]=function(){var a=c(e).apply(this,arguments);return void 0===a?this:a}}},{}],33:[function(a,b){b.exports=function(a,b,c){var d=Object.getOwnPropertyDescriptor(a,b),e=function(){};d&&"function"==typeof d.get&&(e=d.get),Object.defineProperty(a,b,{get:function(){var a=c(e).call(this);return void 0===a?this:a},configurable:!0})}},{}],34:[function(a,b){var c=a("./flag");b.exports=function(a,b){var d=c(a,"negate"),e=b[0];return d?!e:e}},{"./flag":21}],35:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));b.__flags||(b.__flags=Object.create(null)),c=3===arguments.length?c:!0;for(var e in d)(c||"object"!==e&&"ssfi"!==e&&"message"!=e)&&(b.__flags[e]=d[e])}},{}],36:[function(a,b){var c={"[object Arguments]":"arguments","[object Array]":"array","[object Date]":"date","[object Function]":"function","[object Number]":"number","[object RegExp]":"regexp","[object String]":"string"};b.exports=function(a){var b=Object.prototype.toString.call(a);return c[b]?c[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}},{}],37:[function(a,b){function c(){function a(a,c){Object.keys(c).forEach(function(d){~b.indexOf(d)||(a[d]=c[d])})}var b=[].slice.call(arguments);return function(){for(var b=[].slice.call(arguments),c=0,d={};c<b.length;c++)a(d,b[c]);return d}}function d(a,b,d){var e=c("name","message","stack","constructor","toJSON"),f=e(b||{});this.message=a||"Unspecified AssertionError",this.showDiff=!1;for(var g in f)this[g]=f[g];d=d||arguments.callee,d&&Error.captureStackTrace&&Error.captureStackTrace(this,d)}b.exports=d,d.prototype=Object.create(Error.prototype),d.prototype.name="AssertionError",d.prototype.constructor=d,d.prototype.toJSON=function(a){var b=c("constructor","toJSON","stack"),d=b({name:this.name},this);return!1!==a&&this.stack&&(d.stack=this.stack),d}},{}],38:[function(a,b){b.exports=a("./lib/eql")},{"./lib/eql":39}],39:[function(a,b){function c(a,b,c){return d(a,b)?!0:"date"===o(a)?f(a,b):"regexp"===o(a)?g(a,b):n.isBuffer(a)?k(a,b):"arguments"===o(a)?h(a,b,c):e(a,b)?"object"!==o(a)&&"object"!==o(b)&&"array"!==o(a)&&"array"!==o(b)?d(a,b):m(a,b,c):!1}function d(a,b){return a===b?0!==a||1/a===1/b:a!==a&&b!==b}function e(a,b){return o(a)===o(b)}function f(a,b){return"date"!==o(b)?!1:d(a.getTime(),b.getTime())}function g(a,b){return"regexp"!==o(b)?!1:d(a.toString(),b.toString())}function h(a,b,d){return"arguments"!==o(b)?!1:(a=[].slice.call(a),b=[].slice.call(b),c(a,b,d))}function i(a){var b=[];for(var c in a)b.push(c);return b}function j(a,b){if(a.length!==b.length)return!1;for(var c=0,d=!0;c<a.length;c++)if(a[c]!==b[c]){d=!1;break}return d}function k(a,b){return n.isBuffer(b)?j(a,b):!1}function l(a){return null!==a&&void 0!==a}function m(a,b,d){if(!l(a)||!l(b))return!1;if(a.prototype!==b.prototype)return!1;var e;if(d){for(e=0;e<d.length;e++)if(d[e][0]===a&&d[e][1]===b||d[e][0]===b&&d[e][1]===a)return!0}else d=[];try{var f=i(a),g=i(b)}catch(h){return!1}if(f.sort(),g.sort(),!j(f,g))return!1;d.push([a,b]);var k;for(e=f.length-1;e>=0;e--)if(k=f[e],!c(a[k],b[k],d))return!1;
|
||
return!0}var n,o=a("type-detect");try{n=a("buffer").Buffer}catch(p){n={},n.isBuffer=function(){return!1}}b.exports=c},{buffer:42,"type-detect":40}],40:[function(a,b){b.exports=a("./lib/type")},{"./lib/type":41}],41:[function(a,b,c){function d(a){var b=Object.prototype.toString.call(a);return f[b]?f[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}function e(){this.tests={}}var c=b.exports=d,f={"[object Array]":"array","[object RegExp]":"regexp","[object Function]":"function","[object Arguments]":"arguments","[object Date]":"date"};c.Library=e,e.prototype.of=d,e.prototype.define=function(a,b){return 1===arguments.length?this.tests[a]:(this.tests[a]=b,this)},e.prototype.test=function(a,b){if(b===d(a))return!0;var c=this.tests[b];if(c&&"regexp"===d(c))return c.test(a);if(c&&"function"===d(c))return c(a);throw new ReferenceError('Type test "'+b+'" not defined or invalid.')}},{}],42:[function(a,b,c){function d(a,b,c){if(!(this instanceof d))return new d(a,b,c);var e,f=typeof a;if("number"===f)e=a>0?a>>>0:0;else if("string"===f)"base64"===b&&(a=C(a)),e=d.byteLength(a,b);else{if("object"!==f||null===a)throw new Error("First argument needs to be a number, array or string.");"Buffer"===a.type&&E(a.data)&&(a=a.data),e=+a.length>0?Math.floor(+a.length):0}var g;T?g=d._augment(new Uint8Array(e)):(g=this,g.length=e,g._isBuffer=!0);var h;if(T&&"number"==typeof a.byteLength)g._set(a);else if(F(a))if(d.isBuffer(a))for(h=0;e>h;h++)g[h]=a.readUInt8(h);else for(h=0;e>h;h++)g[h]=(a[h]%256+256)%256;else if("string"===f)g.write(a,0,b);else if("number"===f&&!T&&!c)for(h=0;e>h;h++)g[h]=0;return g}function e(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;Q(f%2===0,"Invalid hex string"),d>f/2&&(d=f/2);for(var g=0;d>g;g++){var h=parseInt(b.substr(2*g,2),16);Q(!isNaN(h),"Invalid hex string"),a[c+g]=h}return g}function f(a,b,c,d){var e=L(H(b),a,c,d);return e}function g(a,b,c,d){var e=L(I(b),a,c,d);return e}function h(a,b,c,d){return g(a,b,c,d)}function i(a,b,c,d){var e=L(K(b),a,c,d);return e}function j(a,b,c,d){var e=L(J(b),a,c,d);return e}function k(a,b,c){return R.fromByteArray(0===b&&c===a.length?a:a.slice(b,c))}function l(a,b,c){var d="",e="";c=Math.min(a.length,c);for(var f=b;c>f;f++)a[f]<=127?(d+=M(e)+String.fromCharCode(a[f]),e=""):e+="%"+a[f].toString(16);return d+M(e)}function m(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(a[e]);return d}function n(a,b,c){return m(a,b,c)}function o(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;f++)e+=G(a[f]);return e}function p(a,b,c){for(var d=a.slice(b,c),e="",f=0;f<d.length;f+=2)e+=String.fromCharCode(d[f]+256*d[f+1]);return e}function q(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(f=a[b],e>b+1&&(f|=a[b+1]<<8)):(f=a[b]<<8,e>b+1&&(f|=a[b+1])),f}}function r(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(e>b+2&&(f=a[b+2]<<16),e>b+1&&(f|=a[b+1]<<8),f|=a[b],e>b+3&&(f+=a[b+3]<<24>>>0)):(e>b+1&&(f=a[b+1]<<16),e>b+2&&(f|=a[b+2]<<8),e>b+3&&(f|=a[b+3]),f+=a[b]<<24>>>0),f}}function s(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=q(a,b,c,!0),g=32768&f;return g?-1*(65535-f+1):f}}function t(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=r(a,b,c,!0),g=2147483648&f;return g?-1*(4294967295-f+1):f}}function u(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+3<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,23,4)}function v(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+7<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,52,8)}function w(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"trying to write beyond buffer length"),N(b,65535));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,2);h>g;g++)a[c+g]=(b&255<<8*(d?g:1-g))>>>8*(d?g:1-g);return c+2}}function x(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"trying to write beyond buffer length"),N(b,4294967295));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,4);h>g;g++)a[c+g]=b>>>8*(d?g:3-g)&255;return c+4}}function y(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"Trying to write beyond buffer length"),O(b,32767,-32768));var f=a.length;return c>=f?void 0:(b>=0?w(a,b,c,d,e):w(a,65535+b+1,c,d,e),c+2)}function z(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),O(b,2147483647,-2147483648));var f=a.length;return c>=f?void 0:(b>=0?x(a,b,c,d,e):x(a,4294967295+b+1,c,d,e),c+4)}function A(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),P(b,3.4028234663852886e38,-3.4028234663852886e38));var f=a.length;return c>=f?void 0:(S.write(a,b,c,d,23,4),c+4)}function B(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+7<a.length,"Trying to write beyond buffer length"),P(b,1.7976931348623157e308,-1.7976931348623157e308));var f=a.length;return c>=f?void 0:(S.write(a,b,c,d,52,8),c+8)}function C(a){for(a=D(a).replace(V,"");a.length%4!==0;)a+="=";return a}function D(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function E(a){return(Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)})(a)}function F(a){return E(a)||d.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length}function G(a){return 16>a?"0"+a.toString(16):a.toString(16)}function H(a){for(var b=[],c=0;c<a.length;c++){var d=a.charCodeAt(c);if(127>=d)b.push(d);else{var e=c;d>=55296&&57343>=d&&c++;for(var f=encodeURIComponent(a.slice(e,c+1)).substr(1).split("%"),g=0;g<f.length;g++)b.push(parseInt(f[g],16))}}return b}function I(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function J(a){for(var b,c,d,e=[],f=0;f<a.length;f++)b=a.charCodeAt(f),c=b>>8,d=b%256,e.push(d),e.push(c);return e}function K(a){return R.toByteArray(a)}function L(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);e++)b[e+c]=a[e];return e}function M(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function N(a,b){Q("number"==typeof a,"cannot write a non-number as a number"),Q(a>=0,"specified a negative value for writing an unsigned value"),Q(b>=a,"value is larger than maximum value for type"),Q(Math.floor(a)===a,"value has a fractional component")}function O(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value"),Q(Math.floor(a)===a,"value has a fractional component")}function P(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value")}function Q(a,b){if(!a)throw new Error(b||"Failed assertion")}var R=a("base64-js"),S=a("ieee754");c.Buffer=d,c.SlowBuffer=d,c.INSPECT_MAX_BYTES=50,d.poolSize=8192;var T=function(){try{var a=new ArrayBuffer(0),b=new Uint8Array(a);return b.foo=function(){return 42},42===b.foo()&&"function"==typeof b.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(c){return!1}}();d.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.isBuffer=function(a){return!(null==a||!a._isBuffer)},d.byteLength=function(a,b){var c;switch(a=a.toString(),b||"utf8"){case"hex":c=a.length/2;break;case"utf8":case"utf-8":c=H(a).length;break;case"ascii":case"binary":case"raw":c=a.length;break;case"base64":c=K(a).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":c=2*a.length;break;default:throw new Error("Unknown encoding")}return c},d.concat=function(a,b){if(Q(E(a),"Usage: Buffer.concat(list[, length])"),0===a.length)return new d(0);if(1===a.length)return a[0];var c;if(void 0===b)for(b=0,c=0;c<a.length;c++)b+=a[c].length;var e=new d(b),f=0;for(c=0;c<a.length;c++){var g=a[c];g.copy(e,f),f+=g.length}return e},d.compare=function(a,b){Q(d.isBuffer(a)&&d.isBuffer(b),"Arguments must be Buffers");for(var c=a.length,e=b.length,f=0,g=Math.min(c,e);g>f&&a[f]===b[f];f++);return f!==g&&(c=a[f],e=b[f]),e>c?-1:c>e?1:0},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var k=d;d=b,b=c,c=k}b=Number(b)||0;var l=this.length-b;c?(c=Number(c),c>l&&(c=l)):c=l,d=String(d||"utf8").toLowerCase();var m;switch(d){case"hex":m=e(this,a,b,c);break;case"utf8":case"utf-8":m=f(this,a,b,c);break;case"ascii":m=g(this,a,b,c);break;case"binary":m=h(this,a,b,c);break;case"base64":m=i(this,a,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":m=j(this,a,b,c);break;default:throw new Error("Unknown encoding")}return m},d.prototype.toString=function(a,b,c){var d=this;if(a=String(a||"utf8").toLowerCase(),b=Number(b)||0,c=void 0===c?d.length:Number(c),c===b)return"";var e;switch(a){case"hex":e=o(d,b,c);break;case"utf8":case"utf-8":e=l(d,b,c);break;case"ascii":e=m(d,b,c);break;case"binary":e=n(d,b,c);break;case"base64":e=k(d,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":e=p(d,b,c);break;default:throw new Error("Unknown encoding")}return e},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},d.prototype.equals=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),0===d.compare(this,a)},d.prototype.compare=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),d.compare(this,a)},d.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||0===d||(d=this.length),b||(b=0),d!==c&&0!==a.length&&0!==e.length){Q(d>=c,"sourceEnd < sourceStart"),Q(b>=0&&b<a.length,"targetStart out of bounds"),Q(c>=0&&c<e.length,"sourceStart out of bounds"),Q(d>=0&&d<=e.length,"sourceEnd out of bounds"),d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);var f=d-c;if(100>f||!T)for(var g=0;f>g;g++)a[g+b]=this[g+c];else a._set(this.subarray(c,c+f),b)}},d.prototype.slice=function(a,b){var c=this.length;if(a=~~a,b=void 0===b?c:~~b,0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c),0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c),a>b&&(b=a),T)return d._augment(this.subarray(a,b));for(var e=b-a,f=new d(e,void 0,!0),g=0;e>g;g++)f[g]=this[g+a];return f},d.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},d.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},d.prototype.readUInt8=function(a,b){return b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),a>=this.length?void 0:this[a]},d.prototype.readUInt16LE=function(a,b){return q(this,a,!0,b)},d.prototype.readUInt16BE=function(a,b){return q(this,a,!1,b)},d.prototype.readUInt32LE=function(a,b){return r(this,a,!0,b)},d.prototype.readUInt32BE=function(a,b){return r(this,a,!1,b)},d.prototype.readInt8=function(a,b){if(b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),!(a>=this.length)){var c=128&this[a];return c?-1*(255-this[a]+1):this[a]}},d.prototype.readInt16LE=function(a,b){return s(this,a,!0,b)},d.prototype.readInt16BE=function(a,b){return s(this,a,!1,b)},d.prototype.readInt32LE=function(a,b){return t(this,a,!0,b)},d.prototype.readInt32BE=function(a,b){return t(this,a,!1,b)},d.prototype.readFloatLE=function(a,b){return u(this,a,!0,b)},d.prototype.readFloatBE=function(a,b){return u(this,a,!1,b)},d.prototype.readDoubleLE=function(a,b){return v(this,a,!0,b)},d.prototype.readDoubleBE=function(a,b){return v(this,a,!1,b)},d.prototype.writeUInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"trying to write beyond buffer length"),N(a,255)),b>=this.length?void 0:(this[b]=a,b+1)},d.prototype.writeUInt16LE=function(a,b,c){return w(this,a,b,!0,c)},d.prototype.writeUInt16BE=function(a,b,c){return w(this,a,b,!1,c)},d.prototype.writeUInt32LE=function(a,b,c){return x(this,a,b,!0,c)},d.prototype.writeUInt32BE=function(a,b,c){return x(this,a,b,!1,c)},d.prototype.writeInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"Trying to write beyond buffer length"),O(a,127,-128)),b>=this.length?void 0:(a>=0?this.writeUInt8(a,b,c):this.writeUInt8(255+a+1,b,c),b+1)},d.prototype.writeInt16LE=function(a,b,c){return y(this,a,b,!0,c)},d.prototype.writeInt16BE=function(a,b,c){return y(this,a,b,!1,c)},d.prototype.writeInt32LE=function(a,b,c){return z(this,a,b,!0,c)},d.prototype.writeInt32BE=function(a,b,c){return z(this,a,b,!1,c)},d.prototype.writeFloatLE=function(a,b,c){return A(this,a,b,!0,c)},d.prototype.writeFloatBE=function(a,b,c){return A(this,a,b,!1,c)},d.prototype.writeDoubleLE=function(a,b,c){return B(this,a,b,!0,c)},d.prototype.writeDoubleBE=function(a,b,c){return B(this,a,b,!1,c)},d.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),Q(c>=b,"end < start"),c!==b&&0!==this.length){Q(b>=0&&b<this.length,"start out of bounds"),Q(c>=0&&c<=this.length,"end out of bounds");var d;if("number"==typeof a)for(d=b;c>d;d++)this[d]=a;else{var e=H(a.toString()),f=e.length;for(d=b;c>d;d++)this[d]=e[d%f]}return this}},d.prototype.inspect=function(){for(var a=[],b=this.length,d=0;b>d;d++)if(a[d]=G(this[d]),d===c.INSPECT_MAX_BYTES){a[d+1]="...";break}return"<Buffer "+a.join(" ")+">"},d.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(T)return new d(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;c>b;b+=1)a[b]=this[b];return a.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var U=d.prototype;d._augment=function(a){return a._isBuffer=!0,a._get=a.get,a._set=a.set,a.get=U.get,a.set=U.set,a.write=U.write,a.toString=U.toString,a.toLocaleString=U.toString,a.toJSON=U.toJSON,a.equals=U.equals,a.compare=U.compare,a.copy=U.copy,a.slice=U.slice,a.readUInt8=U.readUInt8,a.readUInt16LE=U.readUInt16LE,a.readUInt16BE=U.readUInt16BE,a.readUInt32LE=U.readUInt32LE,a.readUInt32BE=U.readUInt32BE,a.readInt8=U.readInt8,a.readInt16LE=U.readInt16LE,a.readInt16BE=U.readInt16BE,a.readInt32LE=U.readInt32LE,a.readInt32BE=U.readInt32BE,a.readFloatLE=U.readFloatLE,a.readFloatBE=U.readFloatBE,a.readDoubleLE=U.readDoubleLE,a.readDoubleBE=U.readDoubleBE,a.writeUInt8=U.writeUInt8,a.writeUInt16LE=U.writeUInt16LE,a.writeUInt16BE=U.writeUInt16BE,a.writeUInt32LE=U.writeUInt32LE,a.writeUInt32BE=U.writeUInt32BE,a.writeInt8=U.writeInt8,a.writeInt16LE=U.writeInt16LE,a.writeInt16BE=U.writeInt16BE,a.writeInt32LE=U.writeInt32LE,a.writeInt32BE=U.writeInt32BE,a.writeFloatLE=U.writeFloatLE,a.writeFloatBE=U.writeFloatBE,a.writeDoubleLE=U.writeDoubleLE,a.writeDoubleBE=U.writeDoubleBE,a.fill=U.fill,a.inspect=U.inspect,a.toArrayBuffer=U.toArrayBuffer,a};var V=/[^+\/0-9A-z]/g},{"base64-js":43,ieee754:44}],43:[function(a,b,c){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(a){"use strict";function b(a){var b=a.charCodeAt(0);return b===g?62:b===h?63:i>b?-1:i+10>b?b-i+26+26:k+26>b?b-k:j+26>b?b-j+26:void 0}function c(a){function c(a){j[l++]=a}var d,e,g,h,i,j;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new f(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,e=0;g>d;d+=4,e+=3)h=b(a.charAt(d))<<18|b(a.charAt(d+1))<<12|b(a.charAt(d+2))<<6|b(a.charAt(d+3)),c((16711680&h)>>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function e(a){function b(a){return d.charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var e,f,g,h=a.length%3,i="";for(e=0,g=a.length-h;g>e;e+=3)f=(a[e]<<16)+(a[e+1]<<8)+a[e+2],i+=c(f);switch(h){case 1:f=a[a.length-1],i+=b(f>>2),i+=b(f<<4&63),i+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],i+=b(f>>10),i+=b(f>>4&63),i+=b(f<<2&63),i+="="}return i}var f="undefined"!=typeof Uint8Array?Uint8Array:Array,g="+".charCodeAt(0),h="/".charCodeAt(0),i="0".charCodeAt(0),j="a".charCodeAt(0),k="A".charCodeAt(0);a.toByteArray=c,a.fromByteArray=e}("undefined"==typeof c?this.base64js={}:c)},{}],44:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],45:[function(a,b){b.exports="function"==typeof Object.create?function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],46:[function(a,b){function c(){}var d=b.exports={};d.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var d=c.shift();d()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.binding=function(){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(){throw new Error("process.chdir is not supported")}},{}],47:[function(a,b){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8}},{}],48:[function(a,b,c){(function(b,d){function e(a,b){var d={seen:[],stylize:g};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),p(b)?d.showHidden=b:b&&c._extend(d,b),v(d.showHidden)&&(d.showHidden=!1),v(d.depth)&&(d.depth=2),v(d.colors)&&(d.colors=!1),v(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=f),i(d,a,d.depth)}function f(a,b){var c=e.styles[b];return c?"["+e.colors[c][0]+"m"+a+"["+e.colors[c][1]+"m":a}function g(a){return a}function h(a){var b={};return a.forEach(function(a){b[a]=!0}),b}function i(a,b,d){if(a.customInspect&&b&&A(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return t(e)||(e=i(a,e,d)),e}var f=j(a,b);if(f)return f;var g=Object.keys(b),p=h(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),z(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return k(b);if(0===g.length){if(A(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(w(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(y(b))return a.stylize(Date.prototype.toString.call(b),"date");if(z(b))return k(b)}var r="",s=!1,u=["{","}"];if(o(b)&&(s=!0,u=["[","]"]),A(b)){var v=b.name?": "+b.name:"";r=" [Function"+v+"]"}if(w(b)&&(r=" "+RegExp.prototype.toString.call(b)),y(b)&&(r=" "+Date.prototype.toUTCString.call(b)),z(b)&&(r=" "+k(b)),0===g.length&&(!s||0==b.length))return u[0]+r+u[1];if(0>d)return w(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var x;return x=s?l(a,b,d,p,g):g.map(function(c){return m(a,b,d,p,c,s)}),a.seen.pop(),n(x,r,u)}function j(a,b){if(v(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return s(b)?a.stylize(""+b,"number"):p(b)?a.stylize(""+b,"boolean"):q(b)?a.stylize("null","null"):void 0}function k(a){return"["+Error.prototype.toString.call(a)+"]"}function l(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(F(b,String(g))?m(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(m(a,b,c,d,e,!0))}),f}function m(a,b,c,d,e,f){var g,h,j;if(j=Object.getOwnPropertyDescriptor(b,e)||{value:b[e]},j.get?h=j.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):j.set&&(h=a.stylize("[Setter]","special")),F(d,e)||(g="["+e+"]"),h||(a.seen.indexOf(j.value)<0?(h=q(c)?i(a,j.value,null):i(a,j.value,c-1),h.indexOf("\n")>-1&&(h=f?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),v(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function n(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function o(a){return Array.isArray(a)}function p(a){return"boolean"==typeof a}function q(a){return null===a}function r(a){return null==a}function s(a){return"number"==typeof a}function t(a){return"string"==typeof a}function u(a){return"symbol"==typeof a}function v(a){return void 0===a}function w(a){return x(a)&&"[object RegExp]"===C(a)}function x(a){return"object"==typeof a&&null!==a}function y(a){return x(a)&&"[object Date]"===C(a)}function z(a){return x(a)&&("[object Error]"===C(a)||a instanceof Error)}function A(a){return"function"==typeof a}function B(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function C(a){return Object.prototype.toString.call(a)}function D(a){return 10>a?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),J[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=/%[sdj%]/g;c.format=function(a){if(!t(a)){for(var b=[],c=0;c<arguments.length;c++)b.push(e(arguments[c]));return b.join(" ")}for(var c=1,d=arguments,f=d.length,g=String(a).replace(G,function(a){if("%%"===a)return"%";if(c>=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(b){return"[Circular]"}default:return a}}),h=d[c];f>c;h=d[++c])g+=q(h)||!x(h)?" "+h:" "+e(h);return g},c.deprecate=function(a,e){function f(){if(!g){if(b.throwDeprecation)throw new Error(e);b.traceDeprecation?console.trace(e):console.error(e),g=!0}return a.apply(this,arguments)}if(v(d.process))return function(){return c.deprecate(a,e).apply(this,arguments)};if(b.noDeprecation===!0)return a;var g=!1;return f};var H,I={};c.debuglog=function(a){if(v(H)&&(H=b.env.NODE_DEBUG||""),a=a.toUpperCase(),!I[a])if(new RegExp("\\b"+a+"\\b","i").test(H)){var d=b.pid;I[a]=function(){var b=c.format.apply(c,arguments);console.error("%s %d: %s",a,d,b)}}else I[a]=function(){};return I[a]},c.inspect=e,e.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},e.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},c.isArray=o,c.isBoolean=p,c.isNull=q,c.isNullOrUndefined=r,c.isNumber=s,c.isString=t,c.isSymbol=u,c.isUndefined=v,c.isRegExp=w,c.isObject=x,c.isDate=y,c.isError=z,c.isFunction=A,c.isPrimitive=B,c.isBuffer=a("./support/isBuffer");var J=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c.log=function(){console.log("%s - %s",E(),c.format.apply(c,arguments))},c.inherits=a("inherits"),c._extend=function(a,b){if(!b||!x(b))return a;for(var c=Object.keys(b),d=c.length;d--;)a[c[d]]=b[c[d]];return a}}).call(this,a("JkpR2F"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":47,JkpR2F:46,inherits:45}],49:[function(a,b,c){!function(d){"use strict";"function"==typeof a&&"object"==typeof c&&"object"==typeof b?b.exports=d:"function"==typeof define&&define.amd?define(function(){return d}):chai.use(d)}(function(a,b){"use strict";function c(a){return"function"==typeof a&&"function"==typeof a.getCall&&"function"==typeof a.calledWithExactly}function d(a){return 1===a?"once":2===a?"twice":3===a?"thrice":(a||0)+" times"}function e(a){return a&&c(a.proxy)}function f(a){if(!c(a._obj)&&!e(a._obj))throw new TypeError(b.inspect(a._obj)+" is not a spy or a call to a spy!")}function g(a,b,d,e,f){function g(b){return a.printf.apply(a,b)}var h=e?"always have ":"have ";return d=d||"",c(a.proxy)&&(a=a.proxy),{affirmative:g(["expected %n to "+h+b+d].concat(f)),negative:g(["expected %n to not "+h+b].concat(f))}}function h(c,d,e){b.addProperty(a.Assertion.prototype,c,function(){f(this);var a=g(this._obj,d,e,!1);this.assert(this._obj[c],a.affirmative,a.negative)})}function i(c,e,h){b.addMethod(a.Assertion.prototype,c,function(a){f(this);var b=g(this._obj,e,h,!1,[d(a)]);this.assert(this._obj[c]===a,b.affirmative,b.negative)})}function j(a,c,d){return function(){f(this);var e="always"+a[0].toUpperCase()+a.substring(1),h=b.flag(this,"always")&&"function"==typeof this._obj[e],i=h?e:a,j=g(this._obj,c,d,h,n.call(arguments));this.assert(this._obj[i].apply(this._obj,arguments),j.affirmative,j.negative)}}function k(c,d,e){var f=j(c,d,e);b.addProperty(a.Assertion.prototype,c,f)}function l(c,d,e,f){var g=j(d,e,f);b.addMethod(a.Assertion.prototype,c,g)}function m(a,b,c){l(a,a,b,c)}var n=Array.prototype.slice;b.addProperty(a.Assertion.prototype,"always",function(){b.flag(this,"always",!0)}),h("called","been called"," at least once, but it was never called"),i("callCount","been called exactly %1",", but it was called %c%C"),h("calledOnce","been called exactly once",", but it was called %c%C"),h("calledTwice","been called exactly twice",", but it was called %c%C"),h("calledThrice","been called exactly thrice",", but it was called %c%C"),k("calledWithNew","been called with new"),m("calledBefore","been called before %1"),m("calledAfter","been called after %1"),m("calledOn","been called with %1 as this",", but it was called with %t instead"),m("calledWith","been called with arguments %*","%C"),m("calledWithExactly","been called with exact arguments %*","%C"),m("calledWithMatch","been called with arguments matching %*","%C"),m("returned","returned %1"),l("thrown","threw","thrown %1")})},{}],50:[function(a,b,c){"use strict";!function(d){function e(a){var b=!1;try{a.appendChild(l),b=l.parentNode==a}catch(c){return!1}finally{try{a.removeChild(l)}catch(c){}}return b}function f(a){return l&&a&&1===a.nodeType&&e(a)}function g(a){return"function"==typeof a||!!(a&&a.constructor&&a.call&&a.apply)}function h(a){return"number"==typeof a&&isNaN(a)}function i(a,b){for(var c in b)m.call(a,c)||(a[c]=b[c])}function j(a){return"function"==typeof a&&"function"==typeof a.restore&&a.restore.sinon}function k(a,b,c){c.exports=n,n.spy=a("./sinon/spy"),n.spyCall=a("./sinon/call"),n.behavior=a("./sinon/behavior"),n.stub=a("./sinon/stub"),n.mock=a("./sinon/mock"),n.collection=a("./sinon/collection"),n.assert=a("./sinon/assert"),n.sandbox=a("./sinon/sandbox"),n.test=a("./sinon/test"),n.testCase=a("./sinon/test_case"),n.match=a("./sinon/match")}var l="undefined"!=typeof document&&document.createElement("div"),m=Object.prototype.hasOwnProperty,n={wrapMethod:function(a,b,c){if(!a)throw new TypeError("Should wrap property of object");if("function"!=typeof c)throw new TypeError("Method wrapper should be function");var d,e=a[b];if(g(e)){if(e.restore&&e.restore.sinon)d=new TypeError("Attempted to wrap "+b+" which is already wrapped");else if(e.calledBefore){var f=e.returns?"stubbed":"spied on";d=new TypeError("Attempted to wrap "+b+" which is already "+f)}}else d=new TypeError("Attempted to wrap "+typeof e+" property "+b+" as function");if(d)throw e&&e._stack&&(d.stack+="\n--------------\n"+e._stack),d;var h=a.hasOwnProperty?a.hasOwnProperty(b):m.call(a,b);return a[b]=c,c.displayName=b,c._stack=new Error("Stack Trace for original").stack,c.restore=function(){h||delete a[b],a[b]===c&&(a[b]=e)},c.restore.sinon=!0,i(c,e),c},extend:function(a){for(var b=1,c=arguments.length;c>b;b+=1)for(var d in arguments[b])arguments[b].hasOwnProperty(d)&&(a[d]=arguments[b][d]),arguments[b].hasOwnProperty("toString")&&arguments[b].toString!=a.toString&&(a.toString=arguments[b].toString);return a},create:function(a){var b=function(){};return b.prototype=a,new b},deepEqual:function t(a,b){if(n.match&&n.match.isMatcher(a))return a.test(b);if("object"!=typeof a||"object"!=typeof b)return h(a)&&h(b)?!0:a===b;if(f(a)||f(b))return a===b;if(a===b)return!0;if(null===a&&null!==b||null!==a&&null===b)return!1;if(a instanceof RegExp&&b instanceof RegExp)return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;var c=Object.prototype.toString.call(a);if(c!=Object.prototype.toString.call(b))return!1;if("[object Date]"==c)return a.valueOf()===b.valueOf();var d,e=0,g=0;if("[object Array]"==c&&a.length!==b.length)return!1;for(d in a){if(e+=1,!(d in b))return!1;if(!t(a[d],b[d]))return!1}for(d in b)g+=1;return e==g},functionName:function(a){var b=a.displayName||a.name;if(!b){var c=a.toString().match(/function ([^\s\(]+)/);b=c&&c[1]}return b},functionToString:function(){if(this.getCall&&this.callCount)for(var a,b,c=this.callCount;c--;){a=this.getCall(c).thisValue;for(b in a)if(a[b]===this)return b}return this.displayName||"sinon fake"},getConfig:function(a){var b={};a=a||{};var c=n.defaultConfig;for(var d in c)c.hasOwnProperty(d)&&(b[d]=a.hasOwnProperty(d)?a[d]:c[d]);return b},format:function(a){return""+a},defaultConfig:{injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},timesInWords:function(a){return 1==a&&"once"||2==a&&"twice"||3==a&&"thrice"||(a||0)+" times"},calledInOrder:function(a){for(var b=1,c=a.length;c>b;b++)if(!a[b-1].calledBefore(a[b])||!a[b].called)return!1;
|
||
return!0},orderByFirstCall:function(a){return a.sort(function(a,b){var c=a.getCall(0),d=b.getCall(0),e=c&&c.callId||-1,f=d&&d.callId||-1;return f>e?-1:1})},log:function(){},logError:function(a,b){var c=a+" threw exception: ";n.log(c+"["+b.name+"] "+b.message),b.stack&&n.log(b.stack),setTimeout(function(){throw b.message=c+b.message,b},0)},typeOf:function(a){if(null===a)return"null";if(void 0===a)return"undefined";var b=Object.prototype.toString.call(a);return b.substring(8,b.length-1).toLowerCase()},createStubInstance:function(a){if("function"!=typeof a)throw new TypeError("The constructor should be a function.");return n.stub(n.create(a.prototype))},restore:function(a){if(null!==a&&"object"==typeof a)for(var b in a)j(a[b])&&a[b].restore();else j(a)&&a.restore()}},o="undefined"!=typeof b&&b.exports&&"function"==typeof a,p="function"==typeof define&&"object"==typeof define.amd&&define.amd;if(p)define(k);else if(o){try{d=a("formatio")}catch(q){}k(a,c,b)}if(d){var r=d.configure({quoteStrings:!1});n.format=function(){return r.ascii.apply(r,arguments)}}else if(o)try{var s=a("util");n.format=function(a){return"object"==typeof a&&a.toString===Object.prototype.toString?s.inspect(a):a}}catch(q){}return n}("object"==typeof formatio&&formatio)},{"./sinon/assert":51,"./sinon/behavior":52,"./sinon/call":53,"./sinon/collection":54,"./sinon/match":55,"./sinon/mock":56,"./sinon/sandbox":57,"./sinon/spy":58,"./sinon/stub":59,"./sinon/test":60,"./sinon/test_case":61,formatio:63,util:48}],51:[function(a,b){(function(c){"use strict";!function(c,d){function e(){for(var a,b=0,c=arguments.length;c>b;++b)a=arguments[b],a||i.fail("fake is not a spy"),"function"!=typeof a&&i.fail(a+" is not a function"),"function"!=typeof a.getCall&&i.fail(a+" is not stubbed")}function f(a,b){a=a||d;var c=a.fail||i.fail;c.call(a,b)}function g(a,b,c){2==arguments.length&&(c=b,b=a),i[a]=function(d){e(d);var g=k.call(arguments,1),h=!1;h="function"==typeof b?!b(d):"function"==typeof d[b]?!d[b].apply(d,g):!d[b],h?f(this,d.printf.apply(d,[c].concat(g))):i.pass(a)}}function h(a,b){return!a||/^fail/.test(b)?b:a+b.slice(0,1).toUpperCase()+b.slice(1)}var i,j="undefined"!=typeof b&&b.exports&&"function"==typeof a,k=Array.prototype.slice;!c&&j&&(c=a("../sinon")),c&&(i={failException:"AssertError",fail:function(a){var b=new Error(a);throw b.name=this.failException||i.failException,b},pass:function(){},callOrder:function(){e.apply(null,arguments);var a="",b="";if(c.calledInOrder(arguments))i.pass("callOrder");else{try{a=[].join.call(arguments,", ");for(var d=k.call(arguments),g=d.length;g;)d[--g].called||d.splice(g,1);b=c.orderByFirstCall(d).join(", ")}catch(h){}f(this,"expected "+a+" to be called in order but were called as "+b)}},callCount:function(a,b){if(e(a),a.callCount!=b){var d="expected %n to be called "+c.timesInWords(b)+" but was called %c%C";f(this,a.printf(d))}else i.pass("callCount")},expose:function(a,b){if(!a)throw new TypeError("target is null or undefined");var c=b||{},d="undefined"==typeof c.prefix&&"assert"||c.prefix,e="undefined"==typeof c.includeFail||!!c.includeFail;for(var f in this)"export"==f||!e&&/^(fail)/.test(f)||(a[h(d,f)]=this[f]);return a},match:function(a,b){var d=c.match(b);if(d.test(a))i.pass("match");else{var e=["expected value to match"," expected = "+c.format(b)," actual = "+c.format(a)];f(this,e.join("\n"))}}},g("called","expected %n to have been called at least once but was never called"),g("notCalled",function(a){return!a.called},"expected %n to not have been called but was called %c%C"),g("calledOnce","expected %n to be called once but was called %c%C"),g("calledTwice","expected %n to be called twice but was called %c%C"),g("calledThrice","expected %n to be called thrice but was called %c%C"),g("calledOn","expected %n to be called with %1 as this but was called with %t"),g("alwaysCalledOn","expected %n to always be called with %1 as this but was called with %t"),g("calledWithNew","expected %n to be called with new"),g("alwaysCalledWithNew","expected %n to always be called with new"),g("calledWith","expected %n to be called with arguments %*%C"),g("calledWithMatch","expected %n to be called with match %*%C"),g("alwaysCalledWith","expected %n to always be called with arguments %*%C"),g("alwaysCalledWithMatch","expected %n to always be called with match %*%C"),g("calledWithExactly","expected %n to be called with exact arguments %*%C"),g("alwaysCalledWithExactly","expected %n to always be called with exact arguments %*%C"),g("neverCalledWith","expected %n to never be called with arguments %*%C"),g("neverCalledWithMatch","expected %n to never be called with match %*%C"),g("threw","%n did not throw exception%C"),g("alwaysThrew","%n did not always throw exception%C"),c.assert=i,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=i}):j&&(b.exports=i))}("object"==typeof sinon&&sinon||null,"undefined"!=typeof window?window:"undefined"!=typeof self?self:c)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../sinon":50}],52:[function(a,b){(function(c){"use strict";!function(d){function e(a,b){return"string"==typeof a?(this.exception=new Error(b||""),this.exception.name=a):this.exception=a?a:new Error("Error"),this}function f(a,b){var c=a.callArgAt;if(0>c){for(var d=a.callArgProp,e=0,f=b.length;f>e;++e){if(!d&&"function"==typeof b[e])return b[e];if(d&&b[e]&&"function"==typeof b[e][d])return b[e][d]}return null}return b[c]}function g(a,b,c){if(a.callArgAt<0){var e;return e=a.callArgProp?d.functionName(a.stub)+" expected to yield to '"+a.callArgProp+"', but no object with such a property was passed.":d.functionName(a.stub)+" expected to yield, but no callback was passed.",c.length>0&&(e+=" Received ["+l.call(c,", ")+"]"),e}return"argument at index "+a.callArgAt+" is not a function: "+b}function h(a,b){if("number"==typeof a.callArgAt){var c=f(a,b);if("function"!=typeof c)throw new TypeError(g(a,c,b));a.callbackAsync?m(function(){c.apply(a.callbackContext,a.callbackArguments)}):c.apply(a.callbackContext,a.callbackArguments)}}var i="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!d&&i&&(d=a("../sinon")),d){var j,k=Array.prototype.slice,l=Array.prototype.join,m=function(){return"object"==typeof c&&"function"==typeof c.nextTick?c.nextTick:"function"==typeof setImmediate?setImmediate:function(a){setTimeout(a,0)}}();j={create:function(a){var b=d.extend({},d.behavior);return delete b.create,b.stub=a,b},isPresent:function(){return"number"==typeof this.callArgAt||this.exception||"number"==typeof this.returnArgAt||this.returnThis||this.returnValueDefined},invoke:function(a,b){if(h(this,b),this.exception)throw this.exception;return"number"==typeof this.returnArgAt?b[this.returnArgAt]:this.returnThis?a:this.returnValue},onCall:function(a){return this.stub.onCall(a)},onFirstCall:function(){return this.stub.onFirstCall()},onSecondCall:function(){return this.stub.onSecondCall()},onThirdCall:function(){return this.stub.onThirdCall()},withArgs:function(){throw new Error('Defining a stub by invoking "stub.onCall(...).withArgs(...)" is not supported. Use "stub.withArgs(...).onCall(...)" to define sequential behavior for calls with certain arguments.')},callsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOn:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgWith:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.callArgAt=a,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOnWith:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},yields:function(){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,0),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsOn:function(a){if("object"!=typeof a)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=a,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsTo:function(a){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=a,this.callbackAsync=!1,this},yieldsToOn:function(a,b){if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=a,this.callbackAsync=!1,this},"throws":e,throwsException:e,returns:function(a){return this.returnValue=a,this.returnValueDefined=!0,this},returnsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.returnArgAt=a,this},returnsThis:function(){return this.returnThis=!0,this}};for(var n in j)j.hasOwnProperty(n)&&n.match(/^(callsArg|yields)/)&&!n.match(/Async/)&&(j[n+"Async"]=function(a){return function(){var b=this[a].apply(this,arguments);return this.callbackAsync=!0,b}}(n));d.behavior=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):i&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)}).call(this,a("JkpR2F"))},{"../sinon":50,JkpR2F:46}],53:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.functionName(a)+b;throw d.length&&(e+=" Received ["+g.call(d).join(", ")+"]"),new Error(e)}function e(a,b,d,e,f,g){if("number"!=typeof g)throw new TypeError("Call id is not a number");var i=c.create(h);return i.proxy=a,i.thisValue=b,i.args=d,i.returnValue=e,i.exception=f,i.callId=g,i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&f&&(c=a("../sinon")),c){var g=Array.prototype.slice,h={calledOn:function(a){return c.match&&c.match.isMatcher(a)?a.test(this.thisValue):this.thisValue===a},calledWith:function(){for(var a=0,b=arguments.length;b>a;a+=1)if(!c.deepEqual(arguments[a],this.args[a]))return!1;return!0},calledWithMatch:function(){for(var a=0,b=arguments.length;b>a;a+=1){var d=this.args[a],e=arguments[a];if(!c.match||!c.match(e).test(d))return!1}return!0},calledWithExactly:function(){return arguments.length==this.args.length&&this.calledWith.apply(this,arguments)},notCalledWith:function(){return!this.calledWith.apply(this,arguments)},notCalledWithMatch:function(){return!this.calledWithMatch.apply(this,arguments)},returned:function(a){return c.deepEqual(a,this.returnValue)},threw:function(a){return"undefined"!=typeof a&&this.exception?this.exception===a||this.exception.name===a:!!this.exception},calledWithNew:function(){return this.proxy.prototype&&this.thisValue instanceof this.proxy},calledBefore:function(a){return this.callId<a.callId},calledAfter:function(a){return this.callId>a.callId},callArg:function(a){this.args[a]()},callArgOn:function(a,b){this.args[a].apply(b)},callArgWith:function(a){this.callArgOnWith.apply(this,[a,null].concat(g.call(arguments,1)))},callArgOnWith:function(a,b){var c=g.call(arguments,2);this.args[a].apply(b,c)},"yield":function(){this.yieldOn.apply(this,[null].concat(g.call(arguments,0)))},yieldOn:function(a){for(var b=this.args,c=0,e=b.length;e>c;++c)if("function"==typeof b[c])return void b[c].apply(a,g.call(arguments,1));d(this.proxy," cannot yield since no callback was passed.",b)},yieldTo:function(a){this.yieldToOn.apply(this,[a,null].concat(g.call(arguments,1)))},yieldToOn:function(a,b){for(var c=this.args,e=0,f=c.length;f>e;++e)if(c[e]&&"function"==typeof c[e][a])return void c[e][a].apply(b,g.call(arguments,2));d(this.proxy," cannot yield to '"+a+"' since no callback was passed.",c)},toString:function(){for(var a=this.proxy.toString()+"(",b=[],d=0,e=this.args.length;e>d;++d)b.push(c.format(this.args[d]));return a=a+b.join(", ")+")","undefined"!=typeof this.returnValue&&(a+=" => "+c.format(this.returnValue)),this.exception&&(a+=" !"+this.exception.name,this.exception.message&&(a+="("+this.exception.message+")")),a}};h.invokeCallback=h.yield,e.toString=h.toString,c.spyCall=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],54:[function(a,b){"use strict";!function(c){function d(a){return a.fakes||(a.fakes=[]),a.fakes}function e(a,b){for(var c=d(a),e=0,f=c.length;f>e;e+=1)"function"==typeof c[e][b]&&c[e][b]()}function f(a){for(var b=d(a),c=0;c<b.length;)b.splice(c,1)}var g="undefined"!=typeof b&&b.exports&&"function"==typeof a,h=[].push,i=Object.prototype.hasOwnProperty;if(!c&&g&&(c=a("../sinon")),c){var j={verify:function(){e(this,"verify")},restore:function(){e(this,"restore"),f(this)},verifyAndRestore:function(){var a;try{this.verify()}catch(b){a=b}if(this.restore(),a)throw a},add:function(a){return h.call(d(this),a),a},spy:function(){return this.add(c.spy.apply(c,arguments))},stub:function(a,b,d){if(b){var e=a[b];if("function"!=typeof e){if(!i.call(a,b))throw new TypeError("Cannot stub non-existent own property "+b);return a[b]=d,this.add({restore:function(){a[b]=e}})}}if(!b&&a&&"object"==typeof a){var f=c.stub.apply(c,arguments);for(var g in f)"function"==typeof f[g]&&this.add(f[g]);return f}return this.add(c.stub.apply(c,arguments))},mock:function(){return this.add(c.mock.apply(c,arguments))},inject:function(a){var b=this;return a.spy=function(){return b.spy.apply(b,arguments)},a.stub=function(){return b.stub.apply(b,arguments)},a.mock=function(){return b.mock.apply(b,arguments)},a}};c.collection=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):g&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],55:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.typeOf(a);if(e!==b)throw new TypeError("Expected type of "+d+" to be "+b+", but was "+e)}function e(a){return i.isPrototypeOf(a)}function f(a,b){if(null===b||void 0===b)return!1;for(var d in a)if(a.hasOwnProperty(d)){var e=a[d],g=b[d];if(j.isMatcher(e)){if(!e.test(g))return!1}else if("object"===c.typeOf(e)){if(!f(e,g))return!1}else if(!c.deepEqual(e,g))return!1}return!0}function g(a,b){return function(e,f){d(e,"string","property");var g=1===arguments.length,h=b+'("'+e+'"';return g||(h+=", "+f),h+=")",j(function(b){return void 0!==b&&null!==b&&a(b,e)?g||c.deepEqual(f,b[e]):!1},h)}}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i={toString:function(){return this.message}};i.or=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)||a.test(c)},d.message=b.message+".or("+a.message+")",d},i.and=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)&&a.test(c)},d.message=b.message+".and("+a.message+")",d};var j=function(a,b){var d=c.create(i),e=c.typeOf(a);switch(e){case"object":if("function"==typeof a.test)return d.test=function(b){return a.test(b)===!0},d.message="match("+c.functionName(a.test)+")",d;var g=[];for(var h in a)a.hasOwnProperty(h)&&g.push(h+": "+a[h]);d.test=function(b){return f(a,b)},d.message="match("+g.join(", ")+")";break;case"number":d.test=function(b){return a==b};break;case"string":d.test=function(b){return"string"!=typeof b?!1:-1!==b.indexOf(a)},d.message='match("'+a+'")';break;case"regexp":d.test=function(b){return"string"!=typeof b?!1:a.test(b)};break;case"function":d.test=a,d.message=b?b:"match("+c.functionName(a)+")";break;default:d.test=function(b){return c.deepEqual(a,b)}}return d.message||(d.message="match("+a+")"),d};j.isMatcher=e,j.any=j(function(){return!0},"any"),j.defined=j(function(a){return null!==a&&void 0!==a},"defined"),j.truthy=j(function(a){return!!a},"truthy"),j.falsy=j(function(a){return!a},"falsy"),j.same=function(a){return j(function(b){return a===b},"same("+a+")")},j.typeOf=function(a){return d(a,"string","type"),j(function(b){return c.typeOf(b)===a},'typeOf("'+a+'")')},j.instanceOf=function(a){return d(a,"function","type"),j(function(b){return b instanceof a},"instanceOf("+c.functionName(a)+")")},j.has=g(function(a,b){return"object"==typeof a?b in a:void 0!==a[b]},"has"),j.hasOwn=g(function(a,b){return a.hasOwnProperty(b)},"hasOwn"),j.bool=j.typeOf("boolean"),j.number=j.typeOf("number"),j.string=j.typeOf("string"),j.object=j.typeOf("object"),j.func=j.typeOf("function"),j.array=j.typeOf("array"),j.regexp=j.typeOf("regexp"),j.date=j.typeOf("date"),c.match=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):h&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],56:[function(a,b){"use strict";!function(c){function d(a){return a?d.create(a):c.expectation.create("Anonymous mock")}var e,f="undefined"!=typeof b&&b.exports&&"function"==typeof a,g=[].push;if(!c&&f&&(c=a("../sinon")),c){e=c.match,!e&&f&&(e=a("./match")),c.mock=d,c.extend(d,function(){function a(a,b){if(a)for(var c=0,d=a.length;d>c;c+=1)b(a[c])}return{create:function(a){if(!a)throw new TypeError("object is null");var b=c.extend({},d);return b.object=a,delete b.create,b},expects:function(a){if(!a)throw new TypeError("method is falsy");if(this.expectations||(this.expectations={},this.proxies=[]),!this.expectations[a]){this.expectations[a]=[];var b=this;c.wrapMethod(this.object,a,function(){return b.invokeMethod(a,this,arguments)}),g.call(this.proxies,a)}var d=c.expectation.create(a);return g.call(this.expectations[a],d),d},restore:function(){var b=this.object;a(this.proxies,function(a){"function"==typeof b[a].restore&&b[a].restore()})},verify:function(){var b=this.expectations||{},d=[],e=[];return a(this.proxies,function(c){a(b[c],function(a){a.met()?g.call(e,a.toString()):g.call(d,a.toString())})}),this.restore(),d.length>0?c.expectation.fail(d.concat(e).join("\n")):c.expectation.pass(d.concat(e).join("\n")),!0},invokeMethod:function(a,b,d){var e,f=this.expectations&&this.expectations[a],h=f&&f.length||0;for(e=0;h>e;e+=1)if(!f[e].met()&&f[e].allowsCall(b,d))return f[e].apply(b,d);var i,j=[],k=0;for(e=0;h>e;e+=1)f[e].allowsCall(b,d)?i=i||f[e]:k+=1,g.call(j," "+f[e].toString());return 0===k?i.apply(b,d):(j.unshift("Unexpected call: "+c.spyCall.toString.call({proxy:a,args:d})),void c.expectation.fail(j.join("\n")))}}}());var h=c.timesInWords;c.expectation=function(){function a(a){return 0==a?"never called":"called "+h(a)}function b(a){var b=a.minCalls,c=a.maxCalls;if("number"==typeof b&&"number"==typeof c){var d=h(b);return b!=c&&(d="at least "+d+" and at most "+h(c)),d}return"number"==typeof b?"at least "+h(b):"at most "+h(c)}function d(a){var b="number"==typeof a.minCalls;return!b||a.callCount>=a.minCalls}function f(a){return"number"!=typeof a.maxCalls?!1:a.callCount==a.maxCalls}function i(a,b){return e&&e.isMatcher(a)?a.test(b):!0}var j=Array.prototype.slice,k=c.spy.invoke;return{minCalls:1,maxCalls:1,create:function(a){var b=c.extend(c.stub.create(),c.expectation);return delete b.create,b.method=a,b},invoke:function(a,b,c){return this.verifyCallAllowed(b,c),k.apply(this,arguments)},atLeast:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");return this.limitsSet||(this.maxCalls=null,this.limitsSet=!0),this.minCalls=a,this},atMost:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");return this.limitsSet||(this.minCalls=null,this.limitsSet=!0),this.maxCalls=a,this},never:function(){return this.exactly(0)},once:function(){return this.exactly(1)},twice:function(){return this.exactly(2)},thrice:function(){return this.exactly(3)},exactly:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not a number");return this.atLeast(a),this.atMost(a)},met:function(){return!this.failed&&d(this)},verifyCallAllowed:function(a,b){if(f(this)&&(this.failed=!0,c.expectation.fail(this.method+" already called "+h(this.maxCalls))),"expectedThis"in this&&this.expectedThis!==a&&c.expectation.fail(this.method+" called with "+a+" as thisValue, expected "+this.expectedThis),"expectedArguments"in this){b||c.expectation.fail(this.method+" received no arguments, expected "+c.format(this.expectedArguments)),b.length<this.expectedArguments.length&&c.expectation.fail(this.method+" received too few arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments)),this.expectsExactArgCount&&b.length!=this.expectedArguments.length&&c.expectation.fail(this.method+" received too many arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments));for(var d=0,e=this.expectedArguments.length;e>d;d+=1)i(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", didn't match "+this.expectedArguments.toString()),c.deepEqual(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", expected "+c.format(this.expectedArguments))}},allowsCall:function(a,b){if(this.met()&&f(this))return!1;if("expectedThis"in this&&this.expectedThis!==a)return!1;if(!("expectedArguments"in this))return!0;if(b=b||[],b.length<this.expectedArguments.length)return!1;if(this.expectsExactArgCount&&b.length!=this.expectedArguments.length)return!1;for(var d=0,e=this.expectedArguments.length;e>d;d+=1){if(!i(this.expectedArguments[d],b[d]))return!1;if(!c.deepEqual(this.expectedArguments[d],b[d]))return!1}return!0},withArgs:function(){return this.expectedArguments=j.call(arguments),this},withExactArgs:function(){return this.withArgs.apply(this,arguments),this.expectsExactArgCount=!0,this},on:function(a){return this.expectedThis=a,this},toString:function(){var d=(this.expectedArguments||[]).slice();this.expectsExactArgCount||g.call(d,"[...]");var e=c.spyCall.toString.call({proxy:this.method||"anonymous mock expectation",args:d}),f=e.replace(", [...","[, ...")+" "+b(this);return this.met()?"Expectation met: "+f:"Expected "+f+" ("+a(this.callCount)+")"},verify:function(){return this.met()?c.expectation.pass(this.toString()):c.expectation.fail(this.toString()),!0},pass:function(a){c.assert.pass(a)},fail:function(a){var b=new Error(a);throw b.name="ExpectationError",b}}}(),c.mock=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):f&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50,"./match":55}],57:[function(a,b){"use strict";if("undefined"!=typeof b&&b.exports&&"function"==typeof a){var c=a("../sinon");c.extend(c,a("./util/fake_timers"))}!function(){function a(a,b,c,d){d&&(!b.injectInto||c in b.injectInto?e.call(a.args,d):(b.injectInto[c]=d,a.injectedKeys.push(c)))}function d(a){var b=c.create(c.sandbox);return a.useFakeServer&&("object"==typeof a.useFakeServer&&(b.serverPrototype=a.useFakeServer),b.useFakeServer()),a.useFakeTimers&&("object"==typeof a.useFakeTimers?b.useFakeTimers.apply(b,a.useFakeTimers):b.useFakeTimers()),b}var e=[].push;c.sandbox=c.extend(c.create(c.collection),{useFakeTimers:function(){return this.clock=c.useFakeTimers.apply(c,arguments),this.add(this.clock)},serverPrototype:c.fakeServer,useFakeServer:function(){var a=this.serverPrototype||c.fakeServer;return a&&a.create?(this.server=a.create(),this.add(this.server)):null},inject:function(a){return c.collection.inject.call(this,a),this.clock&&(a.clock=this.clock),this.server&&(a.server=this.server,a.requests=this.server.requests),a},restore:function(){c.collection.restore.apply(this,arguments),this.restoreContext()},restoreContext:function(){if(this.injectedKeys){for(var a=0,b=this.injectedKeys.length;b>a;a++)delete this.injectInto[this.injectedKeys[a]];this.injectedKeys=[]}},create:function(b){if(!b)return c.create(c.sandbox);var e=d(b);e.args=e.args||[],e.injectedKeys=[],e.injectInto=b.injectInto;var f,g,h=e.inject({});if(b.properties)for(var i=0,j=b.properties.length;j>i;i++)f=b.properties[i],g=h[f]||"sandbox"==f&&e,a(e,b,f,g);else a(e,b,"sandbox",g);return e}}),c.sandbox.useFakeXMLHttpRequest=c.sandbox.useFakeServer,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=c.sandbox}):"undefined"!=typeof b&&b.exports&&(b.exports=c.sandbox)}()},{"../sinon":50,"./util/fake_timers":62}],58:[function(require,module,exports){"use strict";!function(sinon){function spy(a,b){if(!b&&"function"==typeof a)return spy.create(a);if(!a&&!b)return spy.create(function(){});var c=a[b];return sinon.wrapMethod(a,b,spy.create(c))}function matchingFake(a,b,c){if(a)for(var d=0,e=a.length;e>d;d++)if(a[d].matches(b,c))return a[d]}function incrementCallCount(){this.called=!0,this.callCount+=1,this.notCalled=!1,this.calledOnce=1==this.callCount,this.calledTwice=2==this.callCount,this.calledThrice=3==this.callCount}function createCallProperties(){this.firstCall=this.getCall(0),this.secondCall=this.getCall(1),this.thirdCall=this.getCall(2),this.lastCall=this.getCall(this.callCount-1)}function createProxy(func){var p;return func.length?eval("p = (function proxy("+vars.substring(0,2*func.length-1)+") { return p.invoke(func, this, slice.call(arguments)); });"):p=function(){return p.invoke(func,this,slice.call(arguments))},p}function delegateToCalls(a,b,c,d){spyApi[a]=function(){if(!this.called)return d?d.apply(this,arguments):!1;for(var e,f=0,g=0,h=this.callCount;h>g;g+=1)if(e=this.getCall(g),e[c||a].apply(e,arguments)&&(f+=1,b))return!0;return f===this.callCount}}var commonJSModule="undefined"!=typeof module&&module.exports&&"function"==typeof require,push=Array.prototype.push,slice=Array.prototype.slice,callId=0;if(!sinon&&commonJSModule&&(sinon=require("../sinon")),sinon){var vars="a,b,c,d,e,f,g,h,i,j,k,l",uuid=0,spyApi={reset:function(){if(this.called=!1,this.notCalled=!0,this.calledOnce=!1,this.calledTwice=!1,this.calledThrice=!1,this.callCount=0,this.firstCall=null,this.secondCall=null,this.thirdCall=null,this.lastCall=null,this.args=[],this.returnValues=[],this.thisValues=[],this.exceptions=[],this.callIds=[],this.fakes)for(var a=0;a<this.fakes.length;a++)this.fakes[a].reset()},create:function(a){var b;"function"!=typeof a?a=function(){}:b=sinon.functionName(a);var c=createProxy(a);return sinon.extend(c,spy),delete c.create,sinon.extend(c,a),c.reset(),c.prototype=a.prototype,c.displayName=b||"spy",c.toString=sinon.functionToString,c._create=sinon.spy.create,c.id="spy#"+uuid++,c},invoke:function(a,b,c){var d,e,f=matchingFake(this.fakes,c);incrementCallCount.call(this),push.call(this.thisValues,b),push.call(this.args,c),push.call(this.callIds,callId++),createCallProperties.call(this);try{e=f?f.invoke(a,b,c):(this.func||a).apply(b,c);var g=this.getCall(this.callCount-1);g.calledWithNew()&&"object"!=typeof e&&(e=b)}catch(h){d=h}if(push.call(this.exceptions,d),push.call(this.returnValues,e),createCallProperties.call(this),void 0!==d)throw d;return e},named:function(a){return this.displayName=a,this},getCall:function(a){return 0>a||a>=this.callCount?null:sinon.spyCall(this,this.thisValues[a],this.args[a],this.returnValues[a],this.exceptions[a],this.callIds[a])},getCalls:function(){var a,b=[];for(a=0;a<this.callCount;a++)b.push(this.getCall(a));return b},calledBefore:function(a){return this.called?a.called?this.callIds[0]<a.callIds[a.callIds.length-1]:!0:!1},calledAfter:function(a){return this.called&&a.called?this.callIds[this.callCount-1]>a.callIds[a.callCount-1]:!1},withArgs:function(){var a=slice.call(arguments);if(this.fakes){var b=matchingFake(this.fakes,a,!0);if(b)return b}else this.fakes=[];var c=this,d=this._create();d.matchingAguments=a,d.parent=this,push.call(this.fakes,d),d.withArgs=function(){return c.withArgs.apply(c,arguments)};for(var e=0;e<this.args.length;e++)d.matches(this.args[e])&&(incrementCallCount.call(d),push.call(d.thisValues,this.thisValues[e]),push.call(d.args,this.args[e]),push.call(d.returnValues,this.returnValues[e]),push.call(d.exceptions,this.exceptions[e]),push.call(d.callIds,this.callIds[e]));return createCallProperties.call(d),d},matches:function(a,b){var c=this.matchingAguments;return c.length<=a.length&&sinon.deepEqual(c,a.slice(0,c.length))?!b||c.length==a.length:void 0},printf:function(a){var b,c=this,d=slice.call(arguments,1);return(a||"").replace(/%(.)/g,function(a,e){return b=spyApi.formatters[e],"function"==typeof b?b.call(null,c,d):isNaN(parseInt(e,10))?"%"+e:sinon.format(d[e-1])})}};delegateToCalls("calledOn",!0),delegateToCalls("alwaysCalledOn",!1,"calledOn"),delegateToCalls("calledWith",!0),delegateToCalls("calledWithMatch",!0),delegateToCalls("alwaysCalledWith",!1,"calledWith"),delegateToCalls("alwaysCalledWithMatch",!1,"calledWithMatch"),delegateToCalls("calledWithExactly",!0),delegateToCalls("alwaysCalledWithExactly",!1,"calledWithExactly"),delegateToCalls("neverCalledWith",!1,"notCalledWith",function(){return!0}),delegateToCalls("neverCalledWithMatch",!1,"notCalledWithMatch",function(){return!0}),delegateToCalls("threw",!0),delegateToCalls("alwaysThrew",!1,"threw"),delegateToCalls("returned",!0),delegateToCalls("alwaysReturned",!1,"returned"),delegateToCalls("calledWithNew",!0),delegateToCalls("alwaysCalledWithNew",!1,"calledWithNew"),delegateToCalls("callArg",!1,"callArgWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")}),spyApi.callArgWith=spyApi.callArg,delegateToCalls("callArgOn",!1,"callArgOnWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")}),spyApi.callArgOnWith=spyApi.callArgOn,delegateToCalls("yield",!1,"yield",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),spyApi.invokeCallback=spyApi.yield,delegateToCalls("yieldOn",!1,"yieldOn",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),delegateToCalls("yieldTo",!1,"yieldTo",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),delegateToCalls("yieldToOn",!1,"yieldToOn",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),spyApi.formatters={c:function(a){return sinon.timesInWords(a.callCount)},n:function(a){return a.toString()},C:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c){var e=" "+a.getCall(c).toString();/\n/.test(b[c-1])&&(e="\n"+e),push.call(b,e)}return b.length>0?"\n"+b.join("\n"):""},t:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c)push.call(b,sinon.format(a.thisValues[c]));return b.join(", ")},"*":function(a,b){for(var c=[],d=0,e=b.length;e>d;++d)push.call(c,sinon.format(b[d]));return c.join(", ")}},sinon.extend(spy,spyApi),spy.spyCall=sinon.spyCall,sinon.spy=spy,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=spy}):commonJSModule&&(module.exports=spy)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],59:[function(a,b){"use strict";!function(c){function d(a,b,e){if(e&&"function"!=typeof e)throw new TypeError("Custom stub should be function");var f;if(f=e?c.spy&&c.spy.create?c.spy.create(e):e:d.create(),!a&&"undefined"==typeof b)return c.stub.create();if("undefined"==typeof b&&"object"==typeof a){for(var g in a)"function"==typeof a[g]&&d(a,g);return a}return c.wrapMethod(a,b,f)}function e(a){return a.defaultBehavior||f(a)||c.behavior.create(a)}function f(a){return a.parent&&g(a.parent)}function g(a){var b=a.behaviors[a.callCount-1];return b&&b.isPresent()?b:e(a)}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i=0;c.extend(d,function(){var a={create:function(){var a=function(){return g(a).invoke(this,arguments)
|
||
};a.id="stub#"+i++;var b=a;return a=c.spy.create(a),a.func=b,c.extend(a,d),a._create=c.stub.create,a.displayName="stub",a.toString=c.functionToString,a.defaultBehavior=null,a.behaviors=[],a},resetBehavior:function(){var a;if(this.defaultBehavior=null,this.behaviors=[],delete this.returnValue,delete this.returnArgAt,this.returnThis=!1,this.fakes)for(a=0;a<this.fakes.length;a++)this.fakes[a].resetBehavior()},onCall:function(a){return this.behaviors[a]||(this.behaviors[a]=c.behavior.create(this)),this.behaviors[a]},onFirstCall:function(){return this.onCall(0)},onSecondCall:function(){return this.onCall(1)},onThirdCall:function(){return this.onCall(2)}};for(var b in c.behavior)c.behavior.hasOwnProperty(b)&&!a.hasOwnProperty(b)&&"create"!=b&&"withArgs"!=b&&"invoke"!=b&&(a[b]=function(a){return function(){return this.defaultBehavior=this.defaultBehavior||c.behavior.create(this),this.defaultBehavior[a].apply(this.defaultBehavior,arguments),this}}(b));return a}()),c.stub=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):h&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],60:[function(a,b){"use strict";!function(c){function d(a){function b(){var b=c.getConfig(c.config);b.injectInto=b.injectIntoThis&&this||b.injectInto;var d,e,f=c.sandbox.create(b),g=Array.prototype.slice.call(arguments).concat(f.args);try{e=a.apply(this,g)}catch(h){d=h}if("undefined"!=typeof d)throw f.restore(),d;return f.verifyAndRestore(),e}var d=typeof a;if("function"!=d)throw new TypeError("sinon.test needs to wrap a test function, got "+d);return a.length?function(){return b.apply(this,arguments)}:b}var e="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&e&&(c=a("../sinon")),c&&(d.config={injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},c.test=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):e&&(b.exports=d))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],61:[function(a,b){"use strict";!function(c){function d(a,b,c){return function(){b&&b.apply(this,arguments);var d,e;try{e=a.apply(this,arguments)}catch(f){d=f}if(c&&c.apply(this,arguments),d)throw d;return e}}function e(a,b){if(!a||"object"!=typeof a)throw new TypeError("sinon.testCase needs an object with test functions");b=b||"test";var e,f,g,h=new RegExp("^"+b),i={},j=a.setUp,k=a.tearDown;for(e in a)if(a.hasOwnProperty(e)){if(f=a[e],/^(setUp|tearDown)$/.test(e))continue;"function"==typeof f&&h.test(e)?(g=f,(j||k)&&(g=d(f,j,k)),i[e]=c.test(g)):i[e]=a[e]}return i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&f&&(c=a("../sinon")),c&&Object.prototype.hasOwnProperty&&(c.testCase=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],62:[function(require,module,exports){(function(global){"use strict";if("undefined"==typeof sinon)var sinon={};!function(global){function addTimer(a,b){if(0===a.length)throw new Error("Function requires at least 1 parameter");if("undefined"==typeof a[0])throw new Error("Callback must be provided to timer calls");var c=id++,d=a[1]||0;return this.timeouts||(this.timeouts={}),this.timeouts[c]={id:c,func:a[0],callAt:this.now+d,invokeArgs:Array.prototype.slice.call(a,2)},b===!0&&(this.timeouts[c].interval=d),addTimerReturnsObject?{id:c,ref:function(){},unref:function(){}}:c}function parseTime(a){if(!a)return 0;var b,c=a.split(":"),d=c.length,e=d,f=0;if(d>3||!/^(\d\d:){0,2}\d\d?$/.test(a))throw new Error("tick only understands numbers and 'h:m:s'");for(;e--;){if(b=parseInt(c[e],10),b>=60)throw new Error("Invalid time "+a);f+=b*Math.pow(60,d-e-1)}return 1e3*f}function createObject(a){var b;if(Object.create)b=Object.create(a);else{var c=function(){};c.prototype=a,b=new c}return b.Date.clock=b,b}function mirrorDateProperties(a,b){b.now?a.now=function(){return a.clock.now}:delete a.now,b.toSource?a.toSource=function(){return b.toSource()}:delete a.toSource,a.toString=function(){return b.toString()},a.prototype=b.prototype,a.parse=b.parse,a.UTC=b.UTC,a.prototype.toUTCString=b.prototype.toUTCString;for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function restore(){for(var a,b=0,c=this.methods.length;c>b;b++)if(a=this.methods[b],global[a].hadOwnProperty)global[a]=this["_"+a];else try{delete global[a]}catch(d){}this.methods=[]}function stubGlobal(a,b){if(b[a].hadOwnProperty=Object.prototype.hasOwnProperty.call(global,a),b["_"+a]=global[a],"Date"==a){var c=mirrorDateProperties(b[a],global[a]);global[a]=c}else{global[a]=function(){return b[a].apply(b,arguments)};for(var d in b[a])b[a].hasOwnProperty(d)&&(global[a][d]=b[a][d])}global[a].clock=b}var timeoutResult=setTimeout(function(){},0),addTimerReturnsObject="object"==typeof timeoutResult;clearTimeout(timeoutResult);var id=1;sinon.clock={now:0,create:function(a){var b=createObject(this);if("number"==typeof a&&(b.now=a),a&&"object"==typeof a)throw new TypeError("now should be milliseconds since UNIX epoch");return b},setTimeout:function(){return addTimer.call(this,arguments,!1)},clearTimeout:function(a){a&&(this.timeouts||(this.timeouts=[]),"object"==typeof a&&(a=a.id),a in this.timeouts&&delete this.timeouts[a])},setInterval:function(){return addTimer.call(this,arguments,!0)},clearInterval:function(a){this.clearTimeout(a)},setImmediate:function(a){var b=Array.prototype.slice.call(arguments,1);return addTimer.call(this,[a,0].concat(b),!1)},clearImmediate:function(a){this.clearTimeout(a)},tick:function(a){a="number"==typeof a?a:parseTime(a);for(var b,c=this.now,d=this.now+a,e=this.now,f=this.firstTimerInRange(c,d);f&&d>=c;){if(this.timeouts[f.id]){c=this.now=f.callAt;try{this.callTimer(f)}catch(g){b=b||g}}f=this.firstTimerInRange(e,d),e=c}if(this.now=d,b)throw b;return this.now},firstTimerInRange:function(a,b){var c,d,e=null;for(var f in this.timeouts)if(this.timeouts.hasOwnProperty(f)){if(this.timeouts[f].callAt<a||this.timeouts[f].callAt>b)continue;(null===e||this.timeouts[f].callAt<e)&&(d=this.timeouts[f],e=this.timeouts[f].callAt,c={func:this.timeouts[f].func,callAt:this.timeouts[f].callAt,interval:this.timeouts[f].interval,id:this.timeouts[f].id,invokeArgs:this.timeouts[f].invokeArgs})}return c||null},callTimer:function(timer){"number"==typeof timer.interval?this.timeouts[timer.id].callAt+=timer.interval:delete this.timeouts[timer.id];try{"function"==typeof timer.func?timer.func.apply(null,timer.invokeArgs):eval(timer.func)}catch(e){var exception=e}if(this.timeouts[timer.id]){if(exception)throw exception}else if(exception)throw exception},reset:function(){this.timeouts={}},Date:function(){function a(c,d,e,f,g,h,i){switch(arguments.length){case 0:return new b(a.clock.now);case 1:return new b(c);case 2:return new b(c,d);case 3:return new b(c,d,e);case 4:return new b(c,d,e,f);case 5:return new b(c,d,e,f,g);case 6:return new b(c,d,e,f,g,h);default:return new b(c,d,e,f,g,h,i)}}var b=Date;return mirrorDateProperties(a,b)}()};var methods=["Date","setTimeout","setInterval","clearTimeout","clearInterval"];"undefined"!=typeof global.setImmediate&&methods.push("setImmediate"),"undefined"!=typeof global.clearImmediate&&methods.push("clearImmediate"),sinon.useFakeTimers=function(a){var b=sinon.clock.create(a);b.restore=restore,b.methods=Array.prototype.slice.call(arguments,"number"==typeof a?1:0),0===b.methods.length&&(b.methods=methods);for(var c=0,d=b.methods.length;d>c;c++)stubGlobal(b.methods[c],b);return b}}("undefined"!=typeof global&&"function"!=typeof global?global:this),sinon.timers={setTimeout:setTimeout,clearTimeout:clearTimeout,setImmediate:"undefined"!=typeof setImmediate?setImmediate:void 0,clearImmediate:"undefined"!=typeof clearImmediate?clearImmediate:void 0,setInterval:setInterval,clearInterval:clearInterval,Date:Date},"undefined"!=typeof module&&module.exports&&(module.exports=sinon)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],63:[function(a,b){(function(c){("function"==typeof define&&define.amd&&function(a){define("formatio",["samsam"],a)}||"object"==typeof b&&function(c){b.exports=c(a("samsam"))}||function(a){this.formatio=a(this.samsam)})(function(a){"use strict";function b(a){if(!a)return"";if(a.displayName)return a.displayName;if(a.name)return a.name;var b=a.toString().match(/function\s+([^\(]+)/m);return b&&b[1]||""}function d(a,c){var d,e,f=b(c&&c.constructor),g=a.excludeConstructors||h.excludeConstructors||[];for(d=0,e=g.length;e>d;++d){if("string"==typeof g[d]&&g[d]===f)return"";if(g[d].test&&g[d].test(f))return""}return f}function e(a,b){if("object"!=typeof a)return!1;var c,d;for(c=0,d=b.length;d>c;++c)if(b[c]===a)return!0;return!1}function f(b,c,d,g){if("string"==typeof c){var h=b.quoteStrings,j="boolean"!=typeof h||h;return d||j?'"'+c+'"':c}if("function"==typeof c&&!(c instanceof RegExp))return f.func(c);if(d=d||[],e(c,d))return"[Circular]";if("[object Array]"===Object.prototype.toString.call(c))return f.array.call(b,c,d);if(!c)return String(1/c===-1/0?"-0":c);if(a.isElement(c))return f.element(c);if("function"==typeof c.toString&&c.toString!==Object.prototype.toString)return c.toString();var k,l;for(k=0,l=i.length;l>k;k++)if(c===i[k].object)return i[k].value;return f.object.call(b,c,d,g)}function g(a){for(var b in a)this[b]=a[b]}var h={excludeConstructors:["Object",/^.$/],quoteStrings:!0},i=(Object.prototype.hasOwnProperty,[]);return"undefined"!=typeof c&&i.push({object:c,value:"[object global]"}),"undefined"!=typeof document&&i.push({object:document,value:"[object HTMLDocument]"}),"undefined"!=typeof window&&i.push({object:window,value:"[object Window]"}),f.func=function(a){return"function "+b(a)+"() {}"},f.array=function(a,b){b=b||[],b.push(a);var c,d,e=[];for(c=0,d=a.length;d>c;++c)e.push(f(this,a[c],b));return"["+e.join(", ")+"]"},f.object=function(b,c,g){c=c||[],c.push(b),g=g||0;var h,i,j,k,l,m=[],n=a.keys(b).sort(),o=3;for(k=0,l=n.length;l>k;++k)h=n[k],j=b[h],i=e(j,c)?"[Circular]":f(this,j,c,g+2),i=(/\s/.test(h)?'"'+h+'"':h)+": "+i,o+=i.length,m.push(i);var p=d(this,b),q=p?"["+p+"] ":"",r="";for(k=0,l=g;l>k;++k)r+=" ";return o+g>80?q+"{\n "+r+m.join(",\n "+r)+"\n"+r+"}":q+"{ "+m.join(", ")+" }"},f.element=function(a){var b,c,d,e,f,g=a.tagName.toLowerCase(),h=a.attributes,i=[];for(d=0,e=h.length;e>d;++d)b=h.item(d),c=b.nodeName.toLowerCase().replace("html:",""),f=b.nodeValue,("contenteditable"!==c||"inherit"!==f)&&f&&i.push(c+'="'+f+'"');var j="<"+g+(i.length>0?" ":""),k=a.innerHTML;k.length>20&&(k=k.substr(0,20)+"[...]");var l=j+i.join(" ")+">"+k+"</"+g+">";return l.replace(/ contentEditable="inherit"/,"")},g.prototype={functionName:b,configure:function(a){return new g(a)},constructorName:function(a){return d(this,a)},ascii:function(a,b,c){return f(this,a,b,c)}},g.prototype})}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{samsam:64}],64:[function(a,b){("function"==typeof define&&define.amd&&function(a){define("samsam",a)}||"object"==typeof b&&function(a){b.exports=a()}||function(a){this.samsam=a()})(function(){function a(a){var b=a;return"number"==typeof a&&a!==b}function b(a){return l.toString.call(a).split(/[ \]]/)[1]}function c(a){if("Arguments"===b(a))return!0;if("object"!=typeof a||"number"!=typeof a.length||"Array"===b(a))return!1;if("function"==typeof a.callee)return!0;try{a[a.length]=6,delete a[a.length]}catch(c){return!0}return!1}function d(a){if(!a||1!==a.nodeType||!m)return!1;try{a.appendChild(m),a.removeChild(m)}catch(b){return!1}return!0}function e(a){var b,c=[];for(b in a)l.hasOwnProperty.call(a,b)&&c.push(b);return c}function f(a){return"function"==typeof a.getTime&&a.getTime()==a.valueOf()}function g(a){return 0===a&&1/a===-1/0}function h(b,c){return b===c||a(b)&&a(c)?0!==b||g(b)===g(c):void 0}function i(g,i){function j(a){return"object"!=typeof a||null===a||a instanceof Boolean||a instanceof Date||a instanceof Number||a instanceof RegExp||a instanceof String?!1:!0}function k(a,b){var c;for(c=0;c<a.length;c++)if(a[c]===b)return c;return-1}var m=[],n=[],o=[],p=[],q={};return function r(g,i,s,t){var u=typeof g,v=typeof i;if(g===i||a(g)||a(i)||null==g||null==i||"object"!==u||"object"!==v)return h(g,i);if(d(g)||d(i))return!1;var w=f(g),x=f(i);if(!(!w&&!x||w&&x&&g.getTime()===i.getTime()))return!1;if(g instanceof RegExp&&i instanceof RegExp&&g.toString()!==i.toString())return!1;var y=b(g),z=b(i),A=e(g),B=e(i);if(c(g)||c(i)){if(g.length!==i.length)return!1}else if(u!==v||y!==z||A.length!==B.length)return!1;var C,D,E,F,G,H,I,J,K,L,M;for(D=0,E=A.length;E>D;D++){if(C=A[D],!l.hasOwnProperty.call(i,C))return!1;if(F=g[C],G=i[C],H=j(F),I=j(G),J=H?k(m,F):-1,K=I?k(n,G):-1,L=-1!==J?o[J]:s+"["+JSON.stringify(C)+"]",M=-1!==K?p[K]:t+"["+JSON.stringify(C)+"]",q[L+M])return!0;if(-1===J&&H&&(m.push(F),o.push(L)),-1===K&&I&&(n.push(G),p.push(M)),H&&I&&(q[L+M]=!0),!r(F,G,L,M))return!1}return!0}(g,i,"$1","$2")}function j(a,b){if(0===b.length)return!0;var c,d,e,f;for(c=0,d=a.length;d>c;++c)if(k(a[c],b[0])){for(e=0,f=b.length;f>e;++e)if(!k(a[c+e],b[e]))return!1;return!0}return!1}var k,l=Object.prototype,m="undefined"!=typeof document&&document.createElement("div");return k=function n(a,c){if(c&&"function"==typeof c.test)return c.test(a);if("function"==typeof c)return c(a)===!0;if("string"==typeof c){c=c.toLowerCase();var d="string"==typeof a||!!a;return d&&String(a).toLowerCase().indexOf(c)>=0}if("number"==typeof c)return c===a;if("boolean"==typeof c)return c===a;if("Array"===b(a)&&"Array"===b(c))return j(a,c);if(c&&"object"==typeof c){var e;for(e in c){var f=a[e];if("undefined"==typeof f&&"function"==typeof a.getAttribute&&(f=a.getAttribute(e)),"undefined"==typeof f||!n(f,c[e]))return!1}return!0}throw new Error("Matcher was not a string, a number, a function, a boolean or an object")},{isArguments:c,isElement:d,isDate:f,isNegZero:g,identical:h,deepEqual:i,match:k,keys:e}})},{}],65:[function(a,b,c){(function(){var a=this,d=a._,e={},f=Array.prototype,g=Object.prototype,h=Function.prototype,i=f.push,j=f.slice,k=f.concat,l=g.toString,m=g.hasOwnProperty,n=f.forEach,o=f.map,p=f.reduce,q=f.reduceRight,r=f.filter,s=f.every,t=f.some,u=f.indexOf,v=f.lastIndexOf,w=Array.isArray,x=Object.keys,y=h.bind,z=function(a){return a instanceof z?a:this instanceof z?void(this._wrapped=a):new z(a)};"undefined"!=typeof c?("undefined"!=typeof b&&b.exports&&(c=b.exports=z),c._=z):a._=z,z.VERSION="1.6.0";var A=z.each=z.forEach=function(a,b,c){if(null==a)return a;if(n&&a.forEach===n)a.forEach(b,c);else if(a.length===+a.length){for(var d=0,f=a.length;f>d;d++)if(b.call(c,a[d],d,a)===e)return}else for(var g=z.keys(a),d=0,f=g.length;f>d;d++)if(b.call(c,a[g[d]],g[d],a)===e)return;return a};z.map=z.collect=function(a,b,c){var d=[];return null==a?d:o&&a.map===o?a.map(b,c):(A(a,function(a,e,f){d.push(b.call(c,a,e,f))}),d)};var B="Reduce of empty array with no initial value";z.reduce=z.foldl=z.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),p&&a.reduce===p)return d&&(b=z.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(A(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(B);return c},z.reduceRight=z.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),q&&a.reduceRight===q)return d&&(b=z.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=z.keys(a);f=g.length}if(A(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(B);return c},z.find=z.detect=function(a,b,c){var d;return C(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},z.filter=z.select=function(a,b,c){var d=[];return null==a?d:r&&a.filter===r?a.filter(b,c):(A(a,function(a,e,f){b.call(c,a,e,f)&&d.push(a)}),d)},z.reject=function(a,b,c){return z.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},z.every=z.all=function(a,b,c){b||(b=z.identity);var d=!0;return null==a?d:s&&a.every===s?a.every(b,c):(A(a,function(a,f,g){return(d=d&&b.call(c,a,f,g))?void 0:e}),!!d)};var C=z.some=z.any=function(a,b,c){b||(b=z.identity);var d=!1;return null==a?d:t&&a.some===t?a.some(b,c):(A(a,function(a,f,g){return d||(d=b.call(c,a,f,g))?e:void 0}),!!d)};z.contains=z.include=function(a,b){return null==a?!1:u&&a.indexOf===u?-1!=a.indexOf(b):C(a,function(a){return a===b})},z.invoke=function(a,b){var c=j.call(arguments,2),d=z.isFunction(b);return z.map(a,function(a){return(d?b:a[b]).apply(a,c)})},z.pluck=function(a,b){return z.map(a,z.property(b))},z.where=function(a,b){return z.filter(a,z.matches(b))},z.findWhere=function(a,b){return z.find(a,z.matches(b))},z.max=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);var d=-1/0,e=-1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;h>e&&(d=a,e=h)}),d},z.min=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);var d=1/0,e=1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;e>h&&(d=a,e=h)}),d},z.shuffle=function(a){var b,c=0,d=[];return A(a,function(a){b=z.random(c++),d[c-1]=d[b],d[b]=a}),d},z.sample=function(a,b,c){return null==b||c?(a.length!==+a.length&&(a=z.values(a)),a[z.random(a.length-1)]):z.shuffle(a).slice(0,Math.max(0,b))};var D=function(a){return null==a?z.identity:z.isFunction(a)?a:z.property(a)};z.sortBy=function(a,b,c){return b=D(b),z.pluck(z.map(a,function(a,d,e){return{value:a,index:d,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index-b.index}),"value")};var E=function(a){return function(b,c,d){var e={};return c=D(c),A(b,function(f,g){var h=c.call(d,f,g,b);a(e,h,f)}),e}};z.groupBy=E(function(a,b,c){z.has(a,b)?a[b].push(c):a[b]=[c]}),z.indexBy=E(function(a,b,c){a[b]=c}),z.countBy=E(function(a,b){z.has(a,b)?a[b]++:a[b]=1}),z.sortedIndex=function(a,b,c,d){c=D(c);for(var e=c.call(d,b),f=0,g=a.length;g>f;){var h=f+g>>>1;c.call(d,a[h])<e?f=h+1:g=h}return f},z.toArray=function(a){return a?z.isArray(a)?j.call(a):a.length===+a.length?z.map(a,z.identity):z.values(a):[]},z.size=function(a){return null==a?0:a.length===+a.length?a.length:z.keys(a).length},z.first=z.head=z.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:0>b?[]:j.call(a,0,b)},z.initial=function(a,b,c){return j.call(a,0,a.length-(null==b||c?1:b))},z.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:j.call(a,Math.max(a.length-b,0))},z.rest=z.tail=z.drop=function(a,b,c){return j.call(a,null==b||c?1:b)},z.compact=function(a){return z.filter(a,z.identity)};var F=function(a,b,c){return b&&z.every(a,z.isArray)?k.apply(c,a):(A(a,function(a){z.isArray(a)||z.isArguments(a)?b?i.apply(c,a):F(a,b,c):c.push(a)}),c)};z.flatten=function(a,b){return F(a,b,[])},z.without=function(a){return z.difference(a,j.call(arguments,1))},z.partition=function(a,b){var c=[],d=[];return A(a,function(a){(b(a)?c:d).push(a)}),[c,d]},z.uniq=z.unique=function(a,b,c,d){z.isFunction(b)&&(d=c,c=b,b=!1);var e=c?z.map(a,c,d):a,f=[],g=[];return A(e,function(c,d){(b?d&&g[g.length-1]===c:z.contains(g,c))||(g.push(c),f.push(a[d]))}),f},z.union=function(){return z.uniq(z.flatten(arguments,!0))},z.intersection=function(a){var b=j.call(arguments,1);return z.filter(z.uniq(a),function(a){return z.every(b,function(b){return z.contains(b,a)})})},z.difference=function(a){var b=k.apply(f,j.call(arguments,1));return z.filter(a,function(a){return!z.contains(b,a)})},z.zip=function(){for(var a=z.max(z.pluck(arguments,"length").concat(0)),b=new Array(a),c=0;a>c;c++)b[c]=z.pluck(arguments,""+c);return b},z.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},z.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=z.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(u&&a.indexOf===u)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},z.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(v&&a.lastIndexOf===v)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},z.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);d>e;)f[e++]=a,a+=c;return f};var G=function(){};z.bind=function(a,b){var c,d;if(y&&a.bind===y)return y.apply(a,j.call(arguments,1));if(!z.isFunction(a))throw new TypeError;return c=j.call(arguments,2),d=function(){if(!(this instanceof d))return a.apply(b,c.concat(j.call(arguments)));G.prototype=a.prototype;var e=new G;G.prototype=null;var f=a.apply(e,c.concat(j.call(arguments)));return Object(f)===f?f:e}},z.partial=function(a){var b=j.call(arguments,1);return function(){for(var c=0,d=b.slice(),e=0,f=d.length;f>e;e++)d[e]===z&&(d[e]=arguments[c++]);for(;c<arguments.length;)d.push(arguments[c++]);return a.apply(this,d)}},z.bindAll=function(a){var b=j.call(arguments,1);if(0===b.length)throw new Error("bindAll must be passed function names");return A(b,function(b){a[b]=z.bind(a[b],a)}),a},z.memoize=function(a,b){var c={};return b||(b=z.identity),function(){var d=b.apply(this,arguments);return z.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},z.delay=function(a,b){var c=j.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},z.defer=function(a){return z.delay.apply(z,[a,1].concat(j.call(arguments,1)))},z.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:z.now(),g=null,f=a.apply(d,e),d=e=null};return function(){var j=z.now();h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k?(clearTimeout(g),g=null,h=j,f=a.apply(d,e),d=e=null):g||c.trailing===!1||(g=setTimeout(i,k)),f}},z.debounce=function(a,b,c){var d,e,f,g,h,i=function(){var j=z.now()-g;b>j?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),f=e=null))};return function(){f=this,e=arguments,g=z.now();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}},z.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},z.wrap=function(a,b){return z.partial(b,a)},z.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},z.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},z.keys=function(a){if(!z.isObject(a))return[];if(x)return x(a);var b=[];for(var c in a)z.has(a,c)&&b.push(c);return b},z.values=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},z.pairs=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},z.invert=function(a){for(var b={},c=z.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},z.functions=z.methods=function(a){var b=[];for(var c in a)z.isFunction(a[c])&&b.push(c);return b.sort()},z.extend=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},z.pick=function(a){var b={},c=k.apply(f,j.call(arguments,1));return A(c,function(c){c in a&&(b[c]=a[c])}),b},z.omit=function(a){var b={},c=k.apply(f,j.call(arguments,1));for(var d in a)z.contains(c,d)||(b[d]=a[d]);return b},z.defaults=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)void 0===a[c]&&(a[c]=b[c])}),a},z.clone=function(a){return z.isObject(a)?z.isArray(a)?a.slice():z.extend({},a):a},z.tap=function(a,b){return b(a),a};var H=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof z&&(a=a._wrapped),b instanceof z&&(b=b._wrapped);var e=l.call(a);if(e!=l.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;var g=a.constructor,h=b.constructor;if(g!==h&&!(z.isFunction(g)&&g instanceof g&&z.isFunction(h)&&h instanceof h)&&"constructor"in a&&"constructor"in b)return!1;c.push(a),d.push(b);var i=0,j=!0;if("[object Array]"==e){if(i=a.length,j=i==b.length)for(;i--&&(j=H(a[i],b[i],c,d)););}else{for(var k in a)if(z.has(a,k)&&(i++,!(j=z.has(b,k)&&H(a[k],b[k],c,d))))break;if(j){for(k in b)if(z.has(b,k)&&!i--)break;j=!i}}return c.pop(),d.pop(),j};z.isEqual=function(a,b){return H(a,b,[],[])},z.isEmpty=function(a){if(null==a)return!0;if(z.isArray(a)||z.isString(a))return 0===a.length;for(var b in a)if(z.has(a,b))return!1;return!0},z.isElement=function(a){return!(!a||1!==a.nodeType)},z.isArray=w||function(a){return"[object Array]"==l.call(a)},z.isObject=function(a){return a===Object(a)},A(["Arguments","Function","String","Number","Date","RegExp"],function(a){z["is"+a]=function(b){return l.call(b)=="[object "+a+"]"}}),z.isArguments(arguments)||(z.isArguments=function(a){return!(!a||!z.has(a,"callee"))}),"function"!=typeof/./&&(z.isFunction=function(a){return"function"==typeof a}),z.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},z.isNaN=function(a){return z.isNumber(a)&&a!=+a},z.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==l.call(a)},z.isNull=function(a){return null===a},z.isUndefined=function(a){return void 0===a},z.has=function(a,b){return m.call(a,b)},z.noConflict=function(){return a._=d,this},z.identity=function(a){return a},z.constant=function(a){return function(){return a}},z.property=function(a){return function(b){return b[a]}},z.matches=function(a){return function(b){if(b===a)return!0;for(var c in a)if(a[c]!==b[c])return!1;return!0}},z.times=function(a,b,c){for(var d=Array(Math.max(0,a)),e=0;a>e;e++)d[e]=b.call(c,e);return d},z.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))},z.now=Date.now||function(){return(new Date).getTime()};var I={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};I.unescape=z.invert(I.escape);var J={escape:new RegExp("["+z.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+z.keys(I.unescape).join("|")+")","g")};z.each(["escape","unescape"],function(a){z[a]=function(b){return null==b?"":(""+b).replace(J[a],function(b){return I[a][b]})}}),z.result=function(a,b){if(null==a)return void 0;var c=a[b];return z.isFunction(c)?c.call(a):c},z.mixin=function(a){A(z.functions(a),function(b){var c=z[b]=a[b];z.prototype[b]=function(){var a=[this._wrapped];return i.apply(a,arguments),O.call(this,c.apply(z,a))}})};var K=0;z.uniqueId=function(a){var b=++K+"";return a?a+b:b},z.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var L=/(.)^/,M={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},N=/\\|'|\r|\n|\t|\u2028|\u2029/g;z.template=function(a,b,c){var d;c=z.defaults({},c,z.templateSettings);var e=new RegExp([(c.escape||L).source,(c.interpolate||L).source,(c.evaluate||L).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(N,function(a){return"\\"+M[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=new Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,z);var i=function(a){return d.call(this,a,z)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},z.chain=function(a){return z(a).chain()};var O=function(a){return this._chain?z(a).chain():a};z.mixin(z),A(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=f[a];z.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],O.call(this,c)}}),A(["concat","join","slice"],function(a){var b=f[a];z.prototype[a]=function(){return O.call(this,b.apply(this._wrapped,arguments))}}),z.extend(z.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return z})}).call(this)},{}],66:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:10,sinon:50,"sinon-chai":49,underscore:65}],67:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/TextYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/TextYatta.coffee":4,chai:10,sinon:50,"sinon-chai":49,underscore:65}],68:[function(a){var b,c,d,e,f,g,h,i,j,k=function(a,b){return function(){return a.apply(b,arguments)}};e=a("chai"),f=e.expect,g=e.should(),h=a("sinon"),i=a("sinon-chai"),j=a("underscore"),e.use(i),d=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee"),c=function(){function a(){this.applyRandomOp=k(this.applyRandomOp,this),this.generateRandomOp=k(this.generateRandomOp,this),this.generateDeleteOp=k(this.generateDeleteOp,this),this.generateReplaceOp=k(this.generateReplaceOp,this),this.generateInsertOp=k(this.generateInsertOp,this),this.number_of_test_cases_multiplier=1,this.repeat_this=1*this.number_of_test_cases_multiplier,this.doSomething_amount=5e3*this.number_of_test_cases_multiplier,this.number_of_engines=10+this.number_of_test_cases_multiplier-1,this.time=0,this.ops=0,this.time_now=0,this.reinitialize()}return a.prototype.reinitialize=function(){var a,c,e,f;for(this.users=[],this.Connector=b(this.users),this.users.push(new d(0,this.Connector)),this.users[0].val("name","initial"),f=[],a=c=1,e=this.number_of_engines;e>=1?e>c:c>e;a=e>=1?++c:--c)f.push(this.users.push(new d(a,this.Connector)));return f},a.prototype.getSomeUser=function(){var a;return a=j.random(0,this.users.length-1),this.users[a]},a.prototype.getRandomText=function(){var a,b,c,d;return a="abcdefghijklmnopqrstuvwxyz",b=j.random(0,10),c=a[j.random(0,a.length-1)],d="",j(b).times(function(){return d+=c}),d},a.prototype.generateInsertOp=function(a){var b;return b=j.random(0,this.users[a].val("name").val().length-1),this.users[a].val("name").insertText(b,this.getRandomText()),null},a.prototype.generateReplaceOp=function(a){return this.users[a].val("name").replaceText(this.getRandomText()),null},a.prototype.generateDeleteOp=function(a){var b,c,d;return void(this.users[a].val("name").val().length>0&&(d=j.random(0,this.users[a].val("name").val().length-1),b=1,c=this.users[a].val("name").deleteText(d,b)))},a.prototype.generateRandomOp=function(a){var b,c,d;return d=[this.generateDeleteOp,this.generateInsertOp,this.generateReplaceOp],b=j.random(d.length-1),c=d[b](a)},a.prototype.applyRandomOp=function(a){var b;return b=this.users[a],b.getConnector().flushOneRandom()},a.prototype.doSomething=function(){var a,b,c;return c=j.random(this.number_of_engines-1),b=[this.applyRandomOp,this.generateRandomOp],a=j.random(b.length-1),b[a](c)},a.prototype.flushAll=function(){var a,b,c,d,e,f;for(e=this.users,f=[],b=c=0,d=e.length;d>c;b=++c)a=e[b],f.push(a.getConnector().flushAll());return f},a.prototype.compareAll=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;for(this.flushAll(),this.time+=(new Date).getTime()-this.time_now,d=0,b=i=0,m=this.users.length;m>=0?m>i:i>m;b=m>=0?++i:--i)d+=this.users[b].getConnector().getOpsInExecutionOrder().length;for(this.ops+=d*this.users.length,f=Math.floor(this.ops/this.time),null!=a&&console.log(""+a+"/"+this.repeat_this+": Every collaborator ("+this.users.length+") applied "+this.number_of_created_operations+" ops in a different order."+(" Over all we consumed "+this.ops+" operations in "+this.time/1e3+" seconds ("+f+" ops/msek).")),o=[],b=j=0,n=this.users.length-1;n>=0?n>j:j>n;b=n>=0?++j:--j)if(this.users[b].val("name").val()!==this.users[b+1].val("name").val()){for(g=function(a,b){var c,d,e,f,g,h,i,j;
|
||
for(e=this.users[a].getConnector().getOpsInExecutionOrder(),g=0,i=e.length;i>g;g++)f=e[g],console.log(JSON.stringify(f));for(console.log(""),f="ops = [",c=h=0,j=e.length;j>h;c=++h)d=e[c],0!==c&&(f+=", "),f+="op"+c;return f+="]",console.log(f),console.log("@users[@last_user].ot.applyOps ops"),console.log("expect(@users[@last_user].ot.val('name')).to.equal(\""+users[b].val("name")+'")'),e},console.log(""),console.log("Found an OT Puzzle!"),console.log("OT states:"),c=k=0,l=users.length;l>k;c=++k)h=users[c],console.log("OT"+c+": "+h.val("name"));console.log("\nOT execution order ("+b+","+(b+1)+"):"),g(b,b+1),console.log(""),e=g(b+1,b),o.push(console.log(""))}else o.push(void 0);return o},a.prototype.run=function(){var a,b,c,d,e,f,g;for(console.log(""),g=[],b=c=1,e=this.repeat_this;e>=1?e>=c:c>=e;b=e>=1?++c:--c){for(this.time_now=(new Date).getTime(),a=d=1,f=this.doSomething_amount;f>=1?f>=d:d>=f;a=f>=1?++d:--d)this.doSomething();this.compareAll(b),g.push(this.reinitialize())}return g},a}(),describe("JsonYatta",function(){return beforeEach(function(a){return this.yTest=new c,a()}),it("has a JsonWrapper",function(){var a,b;return b=this.yTest.getSomeUser().root_element,b.val("x","dtrn","immutable"),b.val("set",{x:"x"},"immutable"),a=b.value,a.x,a.set={y:""},a.x,a.set,a.set.x,f(a.x).to.equal("dtrn"),f(a.set.x).to.equal("x")}),it("can handle creaton of complex json",function(){return this.yTest.getSomeUser().val("x",{a:"b"}),this.yTest.getSomeUser().val("a",{a:{q:"dtrndtrtdrntdrnrtdnrtdnrtdnrtdnrdnrdt"}}),this.yTest.getSomeUser().val("b",{a:{}}),this.yTest.getSomeUser().val("c",{a:"c"}),this.yTest.getSomeUser().val("c",{a:"b"}),this.yTest.compareAll(),this.yTest.getSomeUser().value.a.a.q.insertText(0,"AAA"),this.yTest.compareAll(),f(this.yTest.getSomeUser().value.a.a.q.val()).to.equal("AAAdtrndtrtdrntdrnrtdnrtdnrtdnrtdnrdnrdt")}),it("handles some immutable tests",function(){return this.yTest.getSomeUser().val("string","text","immutable"),this.yTest.getSomeUser().val("number",4,"immutable"),this.yTest.getSomeUser().val("object",{q:"rr"},"immutable"),this.yTest.compareAll(),f(this.yTest.getSomeUser().val("string")).to.equal("text"),f(this.yTest.getSomeUser().val("number")).to.equal(4),f(this.yTest.getSomeUser().val("object").val("q")).to.equal("rr")}),it("can handle many engines, many operations, concurrently (random)",function(){return this.yTest.run()})})},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:10,sinon:50,"sinon-chai":49,underscore:65}]},{},[66,67,68]),!function d(a,b,c){function e(g,h){if(!b[g]){if(!a[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=b[g]={exports:{}};a[g][0].call(j.exports,function(b){var c=a[g][1][b];return e(c?c:b)},j,j.exports,d,a,b,c)}return b[g].exports}for(var f="function"==typeof require&&require,g=0;g<c.length;g++)e(c[g]);return e}({1:[function(a,b){var c;c=a("underscore"),b.exports=function(a){var b;return b=function(){function b(b,c,d){var e,f;this.engine=b,this.HB=c,this.execution_listener=d,f=function(a){return function(b){return a.send(b)}}(this),this.execution_listener.push(f),this.applied_operations=[],e=function(a){return function(b){return a.applied_operations.push(b)}}(this),this.execution_listener.push(e),0!==(null!=a?a.length:void 0)&&this.engine.applyOps(a[0].getHistoryBuffer()._encode()),this.unexecuted={}}return b.prototype.getOpsInExecutionOrder=function(){return this.applied_operations},b.prototype.getRootElement=function(){return a.length>0?a[0].getRootElement().getUid():void 0},b.prototype.send=function(b){var c,d,e,f;if(b.uid.creator===this.HB.getUserId()&&"string"!=typeof b.uid.op_number){for(f=[],d=0,e=a.length;e>d;d++)c=a[d],f.push(c.getUserId()!==this.HB.getUserId()?c.getConnector().receive(b):void 0);return f}},b.prototype.receive=function(a){var b,c;return null==(b=this.unexecuted)[c=a.creator]&&(b[c]=[]),this.unexecuted[a.creator].push(a)},b.prototype.flushOne=function(a){var b;return(null!=(b=this.unexecuted[a])?b.length:void 0)>0?this.engine.applyOp(this.unexecuted[a].shift()):void 0},b.prototype.flushOneRandom=function(){return this.flushOne(c.random(0,a.length-1))},b.prototype.flushAll=function(){var a,b,c;c=this.unexecuted;for(a in c)b=c[a],this.engine.applyOps(b);return this.unexecuted={}},b.prototype.sync=function(){throw new Error("Can't use this a.t.m.")},b}()}},{underscore:65}],2:[function(a,b){var c;c=function(){function a(a,b){this.HB=a,this.parser=b,this.unprocessed_ops=[]}return a.prototype.parseOperation=function(a){var b;if(b=this.parser[a.type],null!=b)return b(a);throw new Error("You forgot to specify a parser for type "+a.type+". The message is "+JSON.stringify(a)+".")},a.prototype.applyOps=function(a){var b,c,d,e,f,g,h,i;for(c=[],d=0,g=a.length;g>d;d++)b=a[d],c.push(this.parseOperation(b));for(e=0,h=c.length;h>e;e++)b=c[e],this.HB.addOperation(b);for(f=0,i=c.length;i>f;f++)b=c[f],b.execute()||this.unprocessed_ops.push(b);return this.tryUnprocessed()},a.prototype.applyOp=function(a){var b;return b=this.parseOperation(a),this.HB.addOperation(b),b.execute()||this.unprocessed_ops.push(b),this.tryUnprocessed()},a.prototype.tryUnprocessed=function(){var a,b,c,d,e,f,g;for(g=[];;){for(a=this.unprocessed_ops.length,c=[],f=this.unprocessed_ops,d=0,e=f.length;e>d;d++)b=f[d],b.execute()||c.push(b);if(this.unprocessed_ops=c,this.unprocessed_ops.length===a)break;g.push(void 0)}return g},a}(),b.exports=c},{}],3:[function(a,b){var c,d,e,f;f=a("../Types/JsonTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),g=f(this.HB),this.engine=new c(this.HB,g.parser),this.connector=new b(this.engine,this.HB,g.execution_listener,this),h=this.connector.getRootElement(),null==h?(e=new g.types.JsonType(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=e):this.root_element=this.HB.getOperation(h)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.setMutableDefault=function(a){return this.root_element.setMutableDefault(a)},a.prototype.getUserId=function(){return this.HB.getUserId()},a.prototype.val=function(a,b,c){return this.root_element.val(a,b,c)},Object.defineProperty(a.prototype,"value",{get:function(){return this.root_element.value},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),a}(),"undefined"!=typeof window&&null!==window&&(window.JsonYatta=e),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/JsonTypes.coffee":7}],4:[function(a,b){var c,d,e,f;f=a("../Types/TextTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),h=f(this.HB),this.engine=new c(this.HB,h.parser),this.connector=new b(this.engine,this.HB,h.execution_listener),g=this.connector.getRootElement(),null==g?(e=new h.types.Word(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=this.HB.addOperation(new h.types.ReplaceManager(e,this.HB.getNextOperationIdentifier())).execute()):this.root_element=this.HB.getOperation(g)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.getUserId=function(){return this.HB.getUserId()},a.prototype.val=function(){return this.root_element.val().val()},a.prototype.insertText=function(a,b){return this.root_element.val().insertText(a,b)},a.prototype.deleteText=function(a,b){return this.root_element.val().deleteText(a,b)},a.prototype.replaceText=function(a){return this.root_element.val().replaceText(a)},a}(),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/TextTypes.coffee":9}],5:[function(a,b){var c;c=function(){function a(a){this.user_id=a,this.operation_counter={},this.buffer={},this.change_listeners=[]}return a.prototype.getUserId=function(){return this.user_id},a.prototype.getOperationCounter=function(){var a,b,c,d;b={},d=this.operation_counter;for(c in d)a=d[c],b[c]=a;return b},a.prototype._encode=function(){var a,b,c,d,e,f;a=[],f=this.buffer;for(d in f){e=f[d];for(c in e)b=e[c],isNaN(parseInt(c))||a.push(b._encode())}return a},a.prototype.getNextOperationIdentifier=function(a){var b;return null==a&&(a=this.user_id),null==this.operation_counter[a]&&(this.operation_counter[a]=0),b={creator:a,op_number:this.operation_counter[a]},this.operation_counter[a]++,b},a.prototype.getOperation=function(a){var b;if(a instanceof Object)return null!=(b=this.buffer[a.creator])?b[a.op_number]:void 0;if(null!=a)throw new Error("This type of uid is not defined!")},a.prototype.addOperation=function(a){if(null==this.buffer[a.creator]&&(this.buffer[a.creator]={}),null==this.operation_counter[a.creator]&&(this.operation_counter[a.creator]=0),null!=this.buffer[a.creator][a.op_number])throw new Error("You must not overwrite operations!");return this.buffer[a.creator][a.op_number]=a,"number"==typeof a.op_number&&a.creator!==this.getUserId()&&this.operation_counter[a.creator]++,a},a}(),b.exports=c},{}],6:[function(a,b){var c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};b.exports=function(a){var b,c,e,f,g,h,i;return i={},h=[],g=function(){function b(b){null==b&&(b=a.getNextOperationIdentifier()),this.creator=b.creator,this.op_number=b.op_number}return b.prototype.getUid=function(){return{creator:this.creator,op_number:this.op_number}},b.prototype.execute=function(){var a,b,c;for(this.is_executed=!0,b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this},b.prototype.saveOperation=function(a,b){return null!=(null!=b?b.execute:void 0)?this[a]=b:null!=b?(null==this.unchecked&&(this.unchecked={}),this.unchecked[a]=b):void 0},b.prototype.validateSavedOperations=function(){var b,c,d,e,f,g;f={},e=this,g=this.unchecked;for(b in g)d=g[b],c=a.getOperation(d),c?this[b]=c:(f[b]=d,e=!1);return delete this.unchecked,e||(this.unchecked=f),e},b}(),b=function(a){function b(a,c){this.saveOperation("deletes",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype._encode=function(){return{type:"Delete",uid:this.getUid(),deletes:this.deletes.getUid()}},b.prototype.execute=function(){return this.validateSavedOperations()?(this.deletes.applyDelete(this),b.__super__.execute.apply(this,arguments),this):!1},b}(g),i.Delete=function(a){var c,d;return d=a.uid,c=a.deletes,new b(d,c)},f=function(a){function b(a,c,d,e){this.saveOperation("prev_cl",c),this.saveOperation("next_cl",d),null!=e?this.saveOperation("origin",e):this.saveOperation("origin",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype.applyDelete=function(a){return null==this.deleted_by&&(this.deleted_by=[]),this.deleted_by.push(a)},b.prototype.isDeleted=function(){var a;return(null!=(a=this.deleted_by)?a.length:void 0)>0},b.prototype.getDistanceToOrigin=function(){var a,b;for(a=0,b=this.prev_cl;this.origin!==b;){if(a++,this===this.prev_cl)throw new Error("this should not happen ;) ");b=b.prev_cl}return a},b.prototype.update_sl=function(){var a;return a=this.prev_cl,update("prev_cl","prev_sl"),update("next_cl","prev_sl")},b.prototype.execute=function(){var a,c,d,e,f;if(null!=this.is_executed)return this;if(this.validateSavedOperations()){if((null!=(e=this.prev_cl)?e.validateSavedOperations():void 0)&&(null!=(f=this.next_cl)?f.validateSavedOperations():void 0)&&this.prev_cl.next_cl!==this){for(a=0,d=this.prev_cl.next_cl,c=0;null==d&&(console.log(JSON.stringify(this.prev_cl.getUid())),console.log(JSON.stringify(this.next_cl.getUid()))),d!==this.next_cl;){if(d.getDistanceToOrigin()===c)d.creator<this.creator&&(this.prev_cl=d,a=c+1);else{if(!(d.getDistanceToOrigin()<c))break;c-a<=d.getDistanceToOrigin()&&(this.prev_cl=d,a=c+1)}c++,d=d.next_cl}this.next_cl=this.prev_cl.next_cl,this.prev_cl.next_cl=this,this.next_cl.prev_cl=this}return b.__super__.execute.apply(this,arguments),this}return!1},b}(g),e=function(a){function b(a,c,d,e,f){this.content=null!=c?c:"",b.__super__.constructor.call(this,a,d,e,f)}return d(b,a),b.prototype.val=function(){return this.content},b.prototype._encode=function(){var a;return a={type:"ImmutableObject",uid:this.getUid(),content:this.content},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(f),i.ImmutableObject=function(a){var b,c,d,f,g;return g=a.uid,b=a.content,f=a.prev,c=a.next,d=a.origin,new e(g,b,f,c,d)},c=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return d(b,a),b.prototype.execute=function(){var a,b,c;if(this.validateSavedOperations()){for(b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this}return!1},b.prototype._encode=function(){var a,b;return{type:"Delimiter",uid:this.getUid(),prev:null!=(a=this.prev_cl)?a.getUid():void 0,next:null!=(b=this.next_cl)?b.getUid():void 0}},b}(f),i.Delimiter=function(a){var b,d,e;return e=a.uid,d=a.prev,b=a.next,new c(e,d,b)},{types:{Delete:b,Insert:f,Delimiter:c,Operation:g,ImmutableObject:e},parser:i,execution_listener:h}}},{}],7:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./TextTypes.coffee"),b.exports=function(a){var b,d,f,g,h;return g=c(a),h=g.types,f=g.parser,d=function(a){var c;return new(c=function(){function a(c){var e,f,g,i;i=c.map,g=function(e,f){return Object.defineProperty(a.prototype,e,{get:function(){var a;return a=f.val(),a instanceof b?d(a):a instanceof h.ImmutableObject?a.val():a},set:function(a){var b,d,f,g;if(a.constructor==={}.constructor){f=c.val(e),g=[];for(b in a)d=a[b],g.push(f.val(b,d,"immutable"));return g}return c.val(e,a,"immutable")},enumerable:!0,configurable:!1})};for(e in i)f=i[e],g(e,f)}return a}())(a)},b=function(b){function c(a,b,d){var e,f;if(c.__super__.constructor.call(this,a),null!=b){if("object"!=typeof b)throw new Error("The initial value of JsonTypes must be of type Object! (current type: "+typeof b+")");for(e in b)f=b[e],this.val(e,f,d)}}return e(c,b),c.prototype.mutable_default=!0,c.prototype.setMutableDefault=function(a){if(a===!0||"mutable"===a)c.prototype.mutable_default=!0;else{if(a!==!1&&"immutable"!==a)throw new Error('Set mutable either "mutable" or "immutable"!');c.prototype.mutable_default=!1}return"OK"},c.prototype.val=function(b,d,e){var f,g,i,j,k;if("object"==typeof b){for(i in b)g=b[i],this.val(i,g,d);return this}if(null!=b&&null!=d){if(e=null!=e?e===!0||"mutable"===e?!0:!1:this.mutable_default,"function"==typeof d)return this;if(e&&"number"!=typeof d||d.constructor===Object){if("string"==typeof d)return k=a.addOperation(new h.Word(a.getNextOperationIdentifier(),d)).execute(),c.__super__.val.call(this,b,k);if(d.constructor===Object)return f=a.addOperation(new c(a.getNextOperationIdentifier(),d,e)).execute(),c.__super__.val.call(this,b,f);throw new Error("You must not set "+typeof d+"-types in collaborative Json-objects!")}return j=a.addOperation(new h.ImmutableObject(void 0,d)).execute(),c.__super__.val.call(this,b,j)}return c.__super__.val.call(this,b,d)},Object.defineProperty(c.prototype,"value",{get:function(){return d(this)},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),c.prototype._encode=function(){return{type:"JsonType",uid:this.getUid()}},c}(h.MapManager),f.JsonType=function(a){var c;return c=a.uid,new b(c)},h.JsonType=b,g}},{"./TextTypes.coffee":9}],8:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./BasicTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i,j,k;return i=c(a),k=i.types,j=i.parser,f=function(c){function d(a){this.map={},d.__super__.constructor.call(this,a)}return e(d,c),d.prototype.val=function(c,e){var f,g,h,i,j;if(null!=e)return null==this.map[c]&&a.addOperation(new b(a.getNextOperationIdentifier(),this,c)).execute(),this.map[c].replace(e),this;if(null!=c)return g=null!=(i=this.map[c])?i.val():void 0,g instanceof k.ImmutableObject?g.val():g;h={},j=this.map;for(c in j)f=j[c],g=f.val(),(g instanceof k.ImmutableObject||g instanceof d)&&(g=g.val()),h[c]=g;return h},d}(k.Operation),b=function(b){function c(a,b,d){this.name=d,this.saveOperation("map_manager",b),c.__super__.constructor.call(this,a)}return e(c,b),c.prototype.execute=function(){var b,d,e,f,h;return this.validateSavedOperations()?(h=this.map_manager.getUid(),h.op_number="_"+h.op_number+"_RM_"+this.name,null==a.getOperation(h)&&(e=this.map_manager.getUid(),e.op_number="_"+e.op_number+"_RM_"+this.name+"_beginning",f=this.map_manager.getUid(),f.op_number="_"+f.op_number+"_RM_"+this.name+"_end",b=a.addOperation(new k.Delimiter(e,void 0,f)),d=a.addOperation(new k.Delimiter(f,b,void 0)).execute(),b.execute(),this.map_manager.map[this.name]=a.addOperation(new g(void 0,h,b,d)).execute()),c.__super__.execute.apply(this,arguments)):!1},c.prototype._encode=function(){return{type:"AddName",uid:this.getUid(),map_manager:this.map_manager.getUid(),name:this.name}},c}(k.Operation),j.AddName=function(a){var c,d,e;return c=a.map_manager,e=a.uid,d=a.name,new b(e,c,d)},d=function(b){function c(b,d,e,f,g,h){null!=d&&null!=e?(this.saveOperation("beginning",d),this.saveOperation("end",e)):(this.beginning=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),void 0,void 0)),this.end=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),this.beginning,void 0)),this.beginning.next_cl=this.end,this.beginning.execute(),this.end.execute()),c.__super__.constructor.call(this,b,f,g,h)}return e(c,b),c.prototype.getLastOperation=function(){return this.end.prev_cl},c.prototype.getFirstOperation=function(){return this.beginning.next_cl},c.prototype.toArray=function(){var a,b;for(a=this.beginning.next_cl,b=[];a!==this.end;)b.push(a),a=a.next_cl;return b},c.prototype.getOperationByPosition=function(a){var b;if(b=this.beginning.next_cl,a>0)for(;b=b.next_cl,b.isDeleted()||(a-=1),0!==a;)if(b instanceof k.Delimiter)throw new Error("position parameter exceeded the length of the document!");return b},c}(k.Insert),g=function(b){function c(a,b,d,e,f,g,h){c.__super__.constructor.call(this,b,d,e,f,g,h),null!=a&&this.replace(a)}return e(c,b),c.prototype.replace=function(b){var c,d;return c=this.getLastOperation(),d=new h(b,this,a.getNextOperationIdentifier(),c,c.next_cl),a.addOperation(d).execute()},c.prototype.val=function(){var a;if(a=this.getLastOperation(),a instanceof k.Delimiter)throw new Error("dtrn");return a.val()},c.prototype._encode=function(){var a;return a={type:"ReplaceManager",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&null!=this.next_cl&&(a.prev=this.prev_cl.getUid(),a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},c}(d),j.ReplaceManager=function(a){var b,c,d,e,f,h,i;return c=a.content,i=a.uid,h=a.prev,e=a.next,f=a.origin,b=a.beginning,d=a.end,new g(c,i,b,d,h,e,f)},h=function(a){function b(a,c,d,e,f,g){if(this.saveOperation("content",a),this.saveOperation("parent",c),null==e||null==f||null==a)throw new Error("You must define content, prev, and next for Replaceable-types!");b.__super__.constructor.call(this,d,e,f,g)}return e(b,a),b.prototype.val=function(){return this.content},b.prototype.replace=function(a){return this.parent.replace(a)},b.prototype.execute=function(){var a;return this.validateSavedOperations()?("function"==typeof(a=this.content).setReplaceManager&&a.setReplaceManager(this.parent),b.__super__.execute.apply(this,arguments),this):!1},b.prototype._encode=function(){var a;return a={type:"Replaceable",content:this.content.getUid(),ReplaceManager:this.parent.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid(),uid:this.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(k.Insert),j.Replaceable=function(a){var b,c,d,e,f,g;return b=a.content,e=a.ReplaceManager,g=a.uid,f=a.prev,c=a.next,d=a.origin,new h(b,e,g,f,c,d)},k.ListManager=d,k.MapManager=f,k.ReplaceManager=g,k.Replaceable=h,i}},{"./BasicTypes.coffee":6}],9:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./StructuredTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i;return h=c(a),i=h.types,g=h.parser,b=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return e(b,a),b}(i.Delete),g.TextDelete=g.Delete,d=function(a){function b(a,c,d,e,f){if(this.content=a,null==d||null==e)throw new Error("You must define prev, and next for TextInsert-types!");b.__super__.constructor.call(this,c,d,e,f)}return e(b,a),b.prototype.getLength=function(){return this.isDeleted()?0:this.content.length},b.prototype.val=function(){return this.isDeleted()?"":this.content},b.prototype._encode=function(){var a;return a={type:"TextInsert",content:this.content,uid:this.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(i.Insert),g.TextInsert=function(a){var b,c,e,f,g;return b=a.content,g=a.uid,f=a.prev,c=a.next,e=a.origin,new d(b,g,f,c,e)},f=function(c){function f(a,b,c,d,e,g,h){f.__super__.constructor.call(this,a,c,d,e,g,h),null!=b&&this.insertText(0,b)}return e(f,c),f.prototype.insertText=function(b,c){var e,f,g,h,i,j;for(f=this.getOperationByPosition(b),j=[],h=0,i=c.length;i>h;h++)e=c[h],g=new d(e,a.getNextOperationIdentifier(),f.prev_cl,f),j.push(a.addOperation(g).execute());return j},f.prototype.deleteText=function(c,d){var e,f,g,h,j;for(g=this.getOperationByPosition(c),j=[],f=h=0;d>=0?d>h:h>d;f=d>=0?++h:--h){for(e=a.addOperation(new b(a.getNextOperationIdentifier(),g)).execute(),g=g.next_cl;g.isDeleted();){if(g instanceof i.Delimiter)throw new Error("You can't delete more than there is..");g=g.next_cl}j.push(e._encode())}return j},f.prototype.replaceText=function(b){var c;if(null!=this.replace_manager)return c=a.addOperation(new f(a.getNextOperationIdentifier())).execute(),c.insertText(0,b),this.replace_manager.replace(c);throw new Error("This type is currently not maintained by a ReplaceManager!")},f.prototype.val=function(){var a,b;return a=function(){var a,c,d,e;for(d=this.toArray(),e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(null!=b.val?b.val():"");return e}.call(this),a.join("")},f.prototype.setReplaceManager=function(a){return this.saveOperation("replace_manager",a),this.validateSavedOperations},f.prototype._encode=function(){var a;return a={type:"Word",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},f}(i.ListManager),g.Word=function(a){var b,c,d,e,g,h;return h=a.uid,b=a.beginning,c=a.end,g=a.prev,d=a.next,e=a.origin,new f(h,void 0,b,c,g,d,e)},i.TextInsert=d,i.TextDelete=b,i.Word=f,h}},{"./StructuredTypes.coffee":8}],10:[function(a,b){b.exports=a("./lib/chai")},{"./lib/chai":11}],11:[function(a,b,c){var d=[],c=b.exports={};c.version="1.9.1",c.AssertionError=a("assertion-error");var e=a("./chai/utils");c.use=function(a){return~d.indexOf(a)||(a(this,e),d.push(a)),this};var f=a("./chai/config");c.config=f;var g=a("./chai/assertion");c.use(g);var h=a("./chai/core/assertions");c.use(h);var i=a("./chai/interface/expect");c.use(i);var j=a("./chai/interface/should");c.use(j);var k=a("./chai/interface/assert");c.use(k)},{"./chai/assertion":12,"./chai/config":13,"./chai/core/assertions":14,"./chai/interface/assert":15,"./chai/interface/expect":16,"./chai/interface/should":17,"./chai/utils":28,"assertion-error":37}],12:[function(a,b){var c=a("./config");b.exports=function(a,b){function d(a,b,c){f(this,"ssfi",c||arguments.callee),f(this,"object",a),f(this,"message",b)}var e=a.AssertionError,f=b.flag;a.Assertion=d,Object.defineProperty(d,"includeStack",{get:function(){return console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack},set:function(a){console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack=a}}),Object.defineProperty(d,"showDiff",{get:function(){return console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff},set:function(a){console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff=a}}),d.addProperty=function(a,c){b.addProperty(this.prototype,a,c)},d.addMethod=function(a,c){b.addMethod(this.prototype,a,c)},d.addChainableMethod=function(a,c,d){b.addChainableMethod(this.prototype,a,c,d)},d.overwriteProperty=function(a,c){b.overwriteProperty(this.prototype,a,c)},d.overwriteMethod=function(a,c){b.overwriteMethod(this.prototype,a,c)},d.overwriteChainableMethod=function(a,c,d){b.overwriteChainableMethod(this.prototype,a,c,d)},d.prototype.assert=function(a,d,g,h,i,j){var k=b.test(this,arguments);if(!0!==j&&(j=!1),!0!==c.showDiff&&(j=!1),!k){var d=b.getMessage(this,arguments),l=b.getActual(this,arguments);throw new e(d,{actual:l,expected:h,showDiff:j},c.includeStack?this.assert:f(this,"ssfi"))}},Object.defineProperty(d.prototype,"_obj",{get:function(){return f(this,"object")},set:function(a){f(this,"object",a)}})}},{"./config":13}],13:[function(a,b){b.exports={includeStack:!1,showDiff:!0,truncateThreshold:40}},{}],14:[function(a,b){b.exports=function(a,b){function c(a,c){c&&u(this,"message",c),a=a.toLowerCase();var d=u(this,"object"),e=~["a","e","i","o","u"].indexOf(a.charAt(0))?"an ":"a ";this.assert(a===b.type(d),"expected #{this} to be "+e+a,"expected #{this} not to be "+e+a)}function d(){u(this,"contains",!0)}function e(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=!1;if("array"===b.type(d)&&"object"===b.type(a)){for(var f in d)if(b.eql(d[f],a)){e=!0;break}}else if("object"===b.type(a)){if(!u(this,"negate")){for(var g in a)new t(d).property(g,a[g]);return}var h={};for(var g in a)h[g]=d[g];e=b.eql(h,a)}else e=d&&~d.indexOf(a);this.assert(e,"expected #{this} to include "+b.inspect(a),"expected #{this} to not include "+b.inspect(a))}function f(){var a=u(this,"object"),b=Object.prototype.toString.call(a);this.assert("[object Arguments]"===b,"expected #{this} to be arguments but got "+b,"expected #{this} to not be arguments")}function g(a,b){b&&u(this,"message",b);var c=u(this,"object");return u(this,"deep")?this.eql(a):void this.assert(a===c,"expected #{this} to equal #{exp}","expected #{this} to not equal #{exp}",a,this._obj,!0)}function h(a,c){c&&u(this,"message",c),this.assert(b.eql(a,u(this,"object")),"expected #{this} to deeply equal #{exp}","expected #{this} to not deeply equal #{exp}",a,this._obj,!0)}function i(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>a,"expected #{this} to have a length above #{exp} but got #{act}","expected #{this} to not have a length above #{exp}",a,d)}else this.assert(c>a,"expected #{this} to be above "+a,"expected #{this} to be at most "+a)}function j(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>=a,"expected #{this} to have a length at least #{exp} but got #{act}","expected #{this} to have a length below #{exp}",a,d)}else this.assert(c>=a,"expected #{this} to be at least "+a,"expected #{this} to be below "+a)}function k(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(a>d,"expected #{this} to have a length below #{exp} but got #{act}","expected #{this} to not have a length below #{exp}",a,d)}else this.assert(a>c,"expected #{this} to be below "+a,"expected #{this} to be at least "+a)}function l(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(a>=d,"expected #{this} to have a length at most #{exp} but got #{act}","expected #{this} to have a length above #{exp}",a,d)}else this.assert(a>=c,"expected #{this} to be at most "+a,"expected #{this} to be above "+a)}function m(a,c){c&&u(this,"message",c);var d=b.getName(a);this.assert(u(this,"object")instanceof a,"expected #{this} to be an instance of "+d,"expected #{this} to not be an instance of "+d)}function n(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(d.hasOwnProperty(a),"expected #{this} to have own property "+b.inspect(a),"expected #{this} to not have own property "+b.inspect(a))}function o(){u(this,"doLength",!0)}function p(a,b){b&&u(this,"message",b);var c=u(this,"object");new t(c,b).to.have.property("length");var d=c.length;this.assert(d==a,"expected #{this} to have a length of #{exp} but got #{act}","expected #{this} to not have a length of #{act}",a,d)}function q(a){var c,d=u(this,"object"),e=!0;if(a=a instanceof Array?a:Array.prototype.slice.call(arguments),!a.length)throw new Error("keys required");var f=Object.keys(d),g=a.length;if(e=a.every(function(a){return~f.indexOf(a)}),u(this,"negate")||u(this,"contains")||(e=e&&a.length==f.length),g>1){a=a.map(function(a){return b.inspect(a)});var h=a.pop();c=a.join(", ")+", and "+h}else c=b.inspect(a[0]);c=(g>1?"keys ":"key ")+c,c=(u(this,"contains")?"contain ":"have ")+c,this.assert(e,"expected #{this} to "+c,"expected #{this} to not "+c)}function r(a,c,d){d&&u(this,"message",d);var e=u(this,"object");new t(e,d).is.a("function");var f=!1,g=null,h=null,i=null;0===arguments.length?(c=null,a=null):a&&(a instanceof RegExp||"string"==typeof a)?(c=a,a=null):a&&a instanceof Error?(g=a,a=null,c=null):"function"==typeof a?(h=a.prototype.name||a.name,"Error"===h&&a!==Error&&(h=(new a).name)):a=null;try{e()}catch(j){if(g)return this.assert(j===g,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}",g instanceof Error?g.toString():g,j instanceof Error?j.toString():j),u(this,"object",j),this;if(a&&(this.assert(j instanceof a,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp} but #{act} was thrown",h,j instanceof Error?j.toString():j),!c))return u(this,"object",j),this;var k="object"===b.type(j)&&"message"in j?j.message:""+j;if(null!=k&&c&&c instanceof RegExp)return this.assert(c.exec(k),"expected #{this} to throw error matching #{exp} but got #{act}","expected #{this} to throw error not matching #{exp}",c,k),u(this,"object",j),this;if(null!=k&&c&&"string"==typeof c)return this.assert(~k.indexOf(c),"expected #{this} to throw error including #{exp} but got #{act}","expected #{this} to throw error not including #{act}",c,k),u(this,"object",j),this;f=!0,i=j}var l="",m=null!==h?h:g?"#{exp}":"an error";f&&(l=" but #{act} was thrown"),this.assert(f===!0,"expected #{this} to throw "+m+l,"expected #{this} to not throw "+m+l,g instanceof Error?g.toString():g,i instanceof Error?i.toString():i),u(this,"object",i)}function s(a,b,c){return a.every(function(a){return c?b.some(function(b){return c(a,b)}):-1!==b.indexOf(a)
|
||
})}var t=a.Assertion,u=(Object.prototype.toString,b.flag);["to","be","been","is","and","has","have","with","that","at","of","same"].forEach(function(a){t.addProperty(a,function(){return this})}),t.addProperty("not",function(){u(this,"negate",!0)}),t.addProperty("deep",function(){u(this,"deep",!0)}),t.addChainableMethod("an",c),t.addChainableMethod("a",c),t.addChainableMethod("include",e,d),t.addChainableMethod("contain",e,d),t.addProperty("ok",function(){this.assert(u(this,"object"),"expected #{this} to be truthy","expected #{this} to be falsy")}),t.addProperty("true",function(){this.assert(!0===u(this,"object"),"expected #{this} to be true","expected #{this} to be false",this.negate?!1:!0)}),t.addProperty("false",function(){this.assert(!1===u(this,"object"),"expected #{this} to be false","expected #{this} to be true",this.negate?!0:!1)}),t.addProperty("null",function(){this.assert(null===u(this,"object"),"expected #{this} to be null","expected #{this} not to be null")}),t.addProperty("undefined",function(){this.assert(void 0===u(this,"object"),"expected #{this} to be undefined","expected #{this} not to be undefined")}),t.addProperty("exist",function(){this.assert(null!=u(this,"object"),"expected #{this} to exist","expected #{this} to not exist")}),t.addProperty("empty",function(){var a=u(this,"object"),b=a;Array.isArray(a)||"string"==typeof object?b=a.length:"object"==typeof a&&(b=Object.keys(a).length),this.assert(!b,"expected #{this} to be empty","expected #{this} not to be empty")}),t.addProperty("arguments",f),t.addProperty("Arguments",f),t.addMethod("equal",g),t.addMethod("equals",g),t.addMethod("eq",g),t.addMethod("eql",h),t.addMethod("eqls",h),t.addMethod("above",i),t.addMethod("gt",i),t.addMethod("greaterThan",i),t.addMethod("least",j),t.addMethod("gte",j),t.addMethod("below",k),t.addMethod("lt",k),t.addMethod("lessThan",k),t.addMethod("most",l),t.addMethod("lte",l),t.addMethod("within",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object"),e=a+".."+b;if(u(this,"doLength")){new t(d,c).to.have.property("length");var f=d.length;this.assert(f>=a&&b>=f,"expected #{this} to have a length within "+e,"expected #{this} to not have a length within "+e)}else this.assert(d>=a&&b>=d,"expected #{this} to be within "+e,"expected #{this} to not be within "+e)}),t.addMethod("instanceof",m),t.addMethod("instanceOf",m),t.addMethod("property",function(a,c,d){d&&u(this,"message",d);var e=u(this,"deep")?"deep property ":"property ",f=u(this,"negate"),g=u(this,"object"),h=u(this,"deep")?b.getPathValue(a,g):g[a];if(f&&void 0!==c){if(void 0===h)throw d=null!=d?d+": ":"",new Error(d+b.inspect(g)+" has no "+e+b.inspect(a))}else this.assert(void 0!==h,"expected #{this} to have a "+e+b.inspect(a),"expected #{this} to not have "+e+b.inspect(a));void 0!==c&&this.assert(c===h,"expected #{this} to have a "+e+b.inspect(a)+" of #{exp}, but got #{act}","expected #{this} to not have a "+e+b.inspect(a)+" of #{act}",c,h),u(this,"object",h)}),t.addMethod("ownProperty",n),t.addMethod("haveOwnProperty",n),t.addChainableMethod("length",p,o),t.addMethod("lengthOf",p,o),t.addMethod("match",function(a,b){b&&u(this,"message",b);var c=u(this,"object");this.assert(a.exec(c),"expected #{this} to match "+a,"expected #{this} not to match "+a)}),t.addMethod("string",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d,c).is.a("string"),this.assert(~d.indexOf(a),"expected #{this} to contain "+b.inspect(a),"expected #{this} to not contain "+b.inspect(a))}),t.addMethod("keys",q),t.addMethod("key",q),t.addMethod("throw",r),t.addMethod("throws",r),t.addMethod("Throw",r),t.addMethod("respondTo",function(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=u(this,"itself"),f="function"!==b.type(d)||e?d[a]:d.prototype[a];this.assert("function"==typeof f,"expected #{this} to respond to "+b.inspect(a),"expected #{this} to not respond to "+b.inspect(a))}),t.addProperty("itself",function(){u(this,"itself",!0)}),t.addMethod("satisfy",function(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(a(d),"expected #{this} to satisfy "+b.objDisplay(a),"expected #{this} to not satisfy"+b.objDisplay(a),this.negate?!1:!0,a(d))}),t.addMethod("closeTo",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(Math.abs(d-a)<=b,"expected #{this} to be close to "+a+" +/- "+b,"expected #{this} not to be close to "+a+" +/- "+b)}),t.addMethod("members",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d).to.be.an("array"),new t(a).to.be.an("array");var e=u(this,"deep")?b.eql:void 0;return u(this,"contains")?this.assert(s(a,d,e),"expected #{this} to be a superset of #{act}","expected #{this} to not be a superset of #{act}",d,a):void this.assert(s(d,a,e)&&s(a,d,e),"expected #{this} to have the same members as #{act}","expected #{this} to not have the same members as #{act}",d,a)})}},{}],15:[function(require,module,exports){module.exports=function(chai,util){var Assertion=chai.Assertion,flag=util.flag,assert=chai.assert=function(a,b){var c=new Assertion(null,null,chai.assert);c.assert(a,b,"[ negation message unavailable ]")};assert.fail=function(a,b,c,d){throw c=c||"assert.fail()",new chai.AssertionError(c,{actual:a,expected:b,operator:d},assert.fail)},assert.ok=function(a,b){new Assertion(a,b).is.ok},assert.notOk=function(a,b){new Assertion(a,b).is.not.ok},assert.equal=function(a,b,c){var d=new Assertion(a,c,assert.equal);d.assert(b==flag(d,"object"),"expected #{this} to equal #{exp}","expected #{this} to not equal #{act}",b,a)},assert.notEqual=function(a,b,c){var d=new Assertion(a,c,assert.notEqual);d.assert(b!=flag(d,"object"),"expected #{this} to not equal #{exp}","expected #{this} to equal #{act}",b,a)},assert.strictEqual=function(a,b,c){new Assertion(a,c).to.equal(b)},assert.notStrictEqual=function(a,b,c){new Assertion(a,c).to.not.equal(b)},assert.deepEqual=function(a,b,c){new Assertion(a,c).to.eql(b)},assert.notDeepEqual=function(a,b,c){new Assertion(a,c).to.not.eql(b)},assert.isTrue=function(a,b){new Assertion(a,b).is["true"]},assert.isFalse=function(a,b){new Assertion(a,b).is["false"]},assert.isNull=function(a,b){new Assertion(a,b).to.equal(null)},assert.isNotNull=function(a,b){new Assertion(a,b).to.not.equal(null)},assert.isUndefined=function(a,b){new Assertion(a,b).to.equal(void 0)},assert.isDefined=function(a,b){new Assertion(a,b).to.not.equal(void 0)},assert.isFunction=function(a,b){new Assertion(a,b).to.be.a("function")},assert.isNotFunction=function(a,b){new Assertion(a,b).to.not.be.a("function")},assert.isObject=function(a,b){new Assertion(a,b).to.be.a("object")},assert.isNotObject=function(a,b){new Assertion(a,b).to.not.be.a("object")},assert.isArray=function(a,b){new Assertion(a,b).to.be.an("array")},assert.isNotArray=function(a,b){new Assertion(a,b).to.not.be.an("array")},assert.isString=function(a,b){new Assertion(a,b).to.be.a("string")},assert.isNotString=function(a,b){new Assertion(a,b).to.not.be.a("string")},assert.isNumber=function(a,b){new Assertion(a,b).to.be.a("number")},assert.isNotNumber=function(a,b){new Assertion(a,b).to.not.be.a("number")},assert.isBoolean=function(a,b){new Assertion(a,b).to.be.a("boolean")},assert.isNotBoolean=function(a,b){new Assertion(a,b).to.not.be.a("boolean")},assert.typeOf=function(a,b,c){new Assertion(a,c).to.be.a(b)},assert.notTypeOf=function(a,b,c){new Assertion(a,c).to.not.be.a(b)},assert.instanceOf=function(a,b,c){new Assertion(a,c).to.be.instanceOf(b)},assert.notInstanceOf=function(a,b,c){new Assertion(a,c).to.not.be.instanceOf(b)},assert.include=function(a,b,c){new Assertion(a,c,assert.include).include(b)},assert.notInclude=function(a,b,c){new Assertion(a,c,assert.notInclude).not.include(b)},assert.match=function(a,b,c){new Assertion(a,c).to.match(b)},assert.notMatch=function(a,b,c){new Assertion(a,c).to.not.match(b)},assert.property=function(a,b,c){new Assertion(a,c).to.have.property(b)},assert.notProperty=function(a,b,c){new Assertion(a,c).to.not.have.property(b)},assert.deepProperty=function(a,b,c){new Assertion(a,c).to.have.deep.property(b)},assert.notDeepProperty=function(a,b,c){new Assertion(a,c).to.not.have.deep.property(b)},assert.propertyVal=function(a,b,c,d){new Assertion(a,d).to.have.property(b,c)},assert.propertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.property(b,c)},assert.deepPropertyVal=function(a,b,c,d){new Assertion(a,d).to.have.deep.property(b,c)},assert.deepPropertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.deep.property(b,c)},assert.lengthOf=function(a,b,c){new Assertion(a,c).to.have.length(b)},assert.Throw=function(a,b,c,d){("string"==typeof b||b instanceof RegExp)&&(c=b,b=null);var e=new Assertion(a,d).to.Throw(b,c);return flag(e,"object")},assert.doesNotThrow=function(a,b,c){"string"==typeof b&&(c=b,b=null),new Assertion(a,c).to.not.Throw(b)},assert.operator=function(val,operator,val2,msg){if(!~["==","===",">",">=","<","<=","!=","!=="].indexOf(operator))throw new Error('Invalid operator "'+operator+'"');var test=new Assertion(eval(val+operator+val2),msg);test.assert(!0===flag(test,"object"),"expected "+util.inspect(val)+" to be "+operator+" "+util.inspect(val2),"expected "+util.inspect(val)+" to not be "+operator+" "+util.inspect(val2))},assert.closeTo=function(a,b,c,d){new Assertion(a,d).to.be.closeTo(b,c)},assert.sameMembers=function(a,b,c){new Assertion(a,c).to.have.same.members(b)},assert.includeMembers=function(a,b,c){new Assertion(a,c).to.include.members(b)},assert.ifError=function(a,b){new Assertion(a,b).to.not.be.ok},function a(b,c){return assert[c]=assert[b],a}("Throw","throw")("Throw","throws")}},{}],16:[function(a,b){b.exports=function(a){a.expect=function(b,c){return new a.Assertion(b,c)}}},{}],17:[function(a,b){b.exports=function(a){function b(){function a(){return this instanceof String||this instanceof Number?new c(this.constructor(this),null,a):this instanceof Boolean?new c(1==this,null,a):new c(this,null,a)}function b(a){Object.defineProperty(this,"should",{value:a,enumerable:!0,configurable:!0,writable:!0})}Object.defineProperty(Object.prototype,"should",{set:b,get:a,configurable:!0});var d={};return d.equal=function(a,b,d){new c(a,d).to.equal(b)},d.Throw=function(a,b,d,e){new c(a,e).to.Throw(b,d)},d.exist=function(a,b){new c(a,b).to.exist},d.not={},d.not.equal=function(a,b,d){new c(a,d).to.not.equal(b)},d.not.Throw=function(a,b,d,e){new c(a,e).to.not.Throw(b,d)},d.not.exist=function(a,b){new c(a,b).to.not.exist},d["throw"]=d.Throw,d.not["throw"]=d.not.Throw,d}var c=a.Assertion;a.should=b,a.Should=b}},{}],18:[function(a,b){var c=a("./transferFlags"),d=a("./flag"),e=a("../config"),f="__proto__"in Object,g=/^(?:length|name|arguments|caller)$/,h=Function.prototype.call,i=Function.prototype.apply;b.exports=function(a,b,j,k){"function"!=typeof k&&(k=function(){});var l={method:j,chainingBehavior:k};a.__methods||(a.__methods={}),a.__methods[b]=l,Object.defineProperty(a,b,{get:function(){l.chainingBehavior.call(this);var b=function m(){var a=d(this,"ssfi");a&&e.includeStack===!1&&d(this,"ssfi",m);var b=l.method.apply(this,arguments);return void 0===b?this:b};if(f){var j=b.__proto__=Object.create(this);j.call=h,j.apply=i}else{var k=Object.getOwnPropertyNames(a);k.forEach(function(c){if(!g.test(c)){var d=Object.getOwnPropertyDescriptor(a,c);Object.defineProperty(b,c,d)}})}return c(this,b),b},configurable:!0})}},{"../config":13,"./flag":21,"./transferFlags":35}],19:[function(a,b){var c=a("../config"),d=a("./flag");b.exports=function(a,b,e){a[b]=function(){var f=d(this,"ssfi");f&&c.includeStack===!1&&d(this,"ssfi",a[b]);var g=e.apply(this,arguments);return void 0===g?this:g}}},{"../config":13,"./flag":21}],20:[function(a,b){b.exports=function(a,b,c){Object.defineProperty(a,b,{get:function(){var a=c.call(this);return void 0===a?this:a},configurable:!0})}},{}],21:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));return 3!==arguments.length?d[b]:void(d[b]=c)}},{}],22:[function(a,b){b.exports=function(a,b){return b.length>4?b[4]:a._obj}},{}],23:[function(a,b){b.exports=function(a){var b=[];for(var c in a)b.push(c);return b}},{}],24:[function(a,b){var c=a("./flag"),d=a("./getActual"),e=(a("./inspect"),a("./objDisplay"));b.exports=function(a,b){var f=c(a,"negate"),g=c(a,"object"),h=b[3],i=d(a,b),j=f?b[2]:b[1],k=c(a,"message");return j=j||"",j=j.replace(/#{this}/g,e(g)).replace(/#{act}/g,e(i)).replace(/#{exp}/g,e(h)),k?k+": "+j:j}},{"./flag":21,"./getActual":22,"./inspect":29,"./objDisplay":30}],25:[function(a,b){b.exports=function(a){if(a.name)return a.name;var b=/^\s?function ([^(]*)\(/.exec(a);return b&&b[1]?b[1]:""}},{}],26:[function(a,b){function c(a){var b=a.replace(/\[/g,".["),c=b.match(/(\\\.|[^.]+?)+/g);return c.map(function(a){var b=/\[(\d+)\]$/,c=b.exec(a);return c?{i:parseFloat(c[1])}:{p:a}})}function d(a,b){for(var c,d=b,e=0,f=a.length;f>e;e++){var g=a[e];d?("undefined"!=typeof g.p?d=d[g.p]:"undefined"!=typeof g.i&&(d=d[g.i]),e==f-1&&(c=d)):c=void 0}return c}b.exports=function(a,b){var e=c(a);return d(e,b)}},{}],27:[function(a,b){b.exports=function(){function a(a){-1===b.indexOf(a)&&b.push(a)}for(var b=Object.getOwnPropertyNames(subject),c=Object.getPrototypeOf(subject);null!==c;)Object.getOwnPropertyNames(c).forEach(a),c=Object.getPrototypeOf(c);return b}},{}],28:[function(a,b,c){var c=b.exports={};c.test=a("./test"),c.type=a("./type"),c.getMessage=a("./getMessage"),c.getActual=a("./getActual"),c.inspect=a("./inspect"),c.objDisplay=a("./objDisplay"),c.flag=a("./flag"),c.transferFlags=a("./transferFlags"),c.eql=a("deep-eql"),c.getPathValue=a("./getPathValue"),c.getName=a("./getName"),c.addProperty=a("./addProperty"),c.addMethod=a("./addMethod"),c.overwriteProperty=a("./overwriteProperty"),c.overwriteMethod=a("./overwriteMethod"),c.addChainableMethod=a("./addChainableMethod"),c.overwriteChainableMethod=a("./overwriteChainableMethod")},{"./addChainableMethod":18,"./addMethod":19,"./addProperty":20,"./flag":21,"./getActual":22,"./getMessage":24,"./getName":25,"./getPathValue":26,"./inspect":29,"./objDisplay":30,"./overwriteChainableMethod":31,"./overwriteMethod":32,"./overwriteProperty":33,"./test":34,"./transferFlags":35,"./type":36,"deep-eql":38}],29:[function(a,b,c){function d(a,b,c){var d={showHidden:b,seen:[],stylize:function(a){return a}};return e(d,a,"undefined"==typeof c?2:c)}function e(a,b,d){if(b&&"function"==typeof b.inspect&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var o=b.inspect(d);return"string"!=typeof o&&(o=e(a,o,d)),o}var u=f(a,b);if(u)return u;if(t(b))return s(b);var v=r(b),w=a.showHidden?q(b):v;if(0===w.length||n(b)&&(1===w.length&&"stack"===w[0]||2===w.length&&"description"===w[0]&&"stack"===w[1])){if("function"==typeof b){var x=p(b),y=x?": "+x:"";return a.stylize("[Function"+y+"]","special")}if(l(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(m(b))return a.stylize(Date.prototype.toUTCString.call(b),"date");if(n(b))return g(b)}var z="",A=!1,B=["{","}"];if(k(b)&&(A=!0,B=["[","]"]),"function"==typeof b){var x=p(b),y=x?": "+x:"";z=" [Function"+y+"]"}if(l(b)&&(z=" "+RegExp.prototype.toString.call(b)),m(b)&&(z=" "+Date.prototype.toUTCString.call(b)),n(b))return g(b);if(0===w.length&&(!A||0==b.length))return B[0]+z+B[1];if(0>d)return l(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var C;return C=A?h(a,b,d,v,w):w.map(function(c){return i(a,b,d,v,c,A)}),a.seen.pop(),j(C,z,B)}function f(a,b){switch(typeof b){case"undefined":return a.stylize("undefined","undefined");case"string":var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string");case"number":return a.stylize(""+b,"number");case"boolean":return a.stylize(""+b,"boolean")}return null===b?a.stylize("null","null"):void 0}function g(a){return"["+Error.prototype.toString.call(a)+"]"}function h(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(Object.prototype.hasOwnProperty.call(b,String(g))?i(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(i(a,b,c,d,e,!0))}),f}function i(a,b,c,d,f,g){var h,i;if(b.__lookupGetter__&&(b.__lookupGetter__(f)?i=b.__lookupSetter__(f)?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):b.__lookupSetter__(f)&&(i=a.stylize("[Setter]","special"))),d.indexOf(f)<0&&(h="["+f+"]"),i||(a.seen.indexOf(b[f])<0?(i=null===c?e(a,b[f],null):e(a,b[f],c-1),i.indexOf("\n")>-1&&(i=g?i.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+i.split("\n").map(function(a){return" "+a}).join("\n"))):i=a.stylize("[Circular]","special")),"undefined"==typeof h){if(g&&f.match(/^\d+$/))return i;h=JSON.stringify(""+f),h.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(h=h.substr(1,h.length-2),h=a.stylize(h,"name")):(h=h.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),h=a.stylize(h,"string"))}return h+": "+i}function j(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function k(a){return Array.isArray(a)||"object"==typeof a&&"[object Array]"===o(a)}function l(a){return"object"==typeof a&&"[object RegExp]"===o(a)}function m(a){return"object"==typeof a&&"[object Date]"===o(a)}function n(a){return"object"==typeof a&&"[object Error]"===o(a)}function o(a){return Object.prototype.toString.call(a)}var p=a("./getName"),q=a("./getProperties"),r=a("./getEnumerableProperties");b.exports=d;var s=function(a){if("outerHTML"in a)return a.outerHTML;var b,c="http://www.w3.org/1999/xhtml",d=document.createElementNS(c,"_"),e=((window.HTMLElement||window.Element).prototype,new XMLSerializer);return document.xmlVersion?e.serializeToString(a):(d.appendChild(a.cloneNode(!1)),b=d.innerHTML.replace("><",">"+a.innerHTML+"<"),d.innerHTML="",b)},t=function(a){return"object"==typeof HTMLElement?a instanceof HTMLElement:a&&"object"==typeof a&&1===a.nodeType&&"string"==typeof a.nodeName}},{"./getEnumerableProperties":23,"./getName":25,"./getProperties":27}],30:[function(a,b){var c=a("./inspect"),d=a("../config");b.exports=function(a){var b=c(a),e=Object.prototype.toString.call(a);if(d.truncateThreshold&&b.length>=d.truncateThreshold){if("[object Function]"===e)return a.name&&""!==a.name?"[Function: "+a.name+"]":"[Function]";if("[object Array]"===e)return"[ Array("+a.length+") ]";if("[object Object]"===e){var f=Object.keys(a),g=f.length>2?f.splice(0,2).join(", ")+", ...":f.join(", ");return"{ Object ("+g+") }"}return b}return b}},{"../config":13,"./inspect":29}],31:[function(a,b){b.exports=function(a,b,c,d){var e=a.__methods[b],f=e.chainingBehavior;e.chainingBehavior=function(){var a=d(f).call(this);return void 0===a?this:a};var g=e.method;e.method=function(){var a=c(g).apply(this,arguments);return void 0===a?this:a}}},{}],32:[function(a,b){b.exports=function(a,b,c){var d=a[b],e=function(){return this};d&&"function"==typeof d&&(e=d),a[b]=function(){var a=c(e).apply(this,arguments);return void 0===a?this:a}}},{}],33:[function(a,b){b.exports=function(a,b,c){var d=Object.getOwnPropertyDescriptor(a,b),e=function(){};d&&"function"==typeof d.get&&(e=d.get),Object.defineProperty(a,b,{get:function(){var a=c(e).call(this);return void 0===a?this:a},configurable:!0})}},{}],34:[function(a,b){var c=a("./flag");b.exports=function(a,b){var d=c(a,"negate"),e=b[0];return d?!e:e}},{"./flag":21}],35:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));b.__flags||(b.__flags=Object.create(null)),c=3===arguments.length?c:!0;for(var e in d)(c||"object"!==e&&"ssfi"!==e&&"message"!=e)&&(b.__flags[e]=d[e])}},{}],36:[function(a,b){var c={"[object Arguments]":"arguments","[object Array]":"array","[object Date]":"date","[object Function]":"function","[object Number]":"number","[object RegExp]":"regexp","[object String]":"string"};b.exports=function(a){var b=Object.prototype.toString.call(a);return c[b]?c[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}},{}],37:[function(a,b){function c(){function a(a,c){Object.keys(c).forEach(function(d){~b.indexOf(d)||(a[d]=c[d])})}var b=[].slice.call(arguments);return function(){for(var b=[].slice.call(arguments),c=0,d={};c<b.length;c++)a(d,b[c]);return d}}function d(a,b,d){var e=c("name","message","stack","constructor","toJSON"),f=e(b||{});this.message=a||"Unspecified AssertionError",this.showDiff=!1;for(var g in f)this[g]=f[g];d=d||arguments.callee,d&&Error.captureStackTrace&&Error.captureStackTrace(this,d)}b.exports=d,d.prototype=Object.create(Error.prototype),d.prototype.name="AssertionError",d.prototype.constructor=d,d.prototype.toJSON=function(a){var b=c("constructor","toJSON","stack"),d=b({name:this.name},this);return!1!==a&&this.stack&&(d.stack=this.stack),d}},{}],38:[function(a,b){b.exports=a("./lib/eql")},{"./lib/eql":39}],39:[function(a,b){function c(a,b,c){return d(a,b)?!0:"date"===o(a)?f(a,b):"regexp"===o(a)?g(a,b):n.isBuffer(a)?k(a,b):"arguments"===o(a)?h(a,b,c):e(a,b)?"object"!==o(a)&&"object"!==o(b)&&"array"!==o(a)&&"array"!==o(b)?d(a,b):m(a,b,c):!1}function d(a,b){return a===b?0!==a||1/a===1/b:a!==a&&b!==b}function e(a,b){return o(a)===o(b)}function f(a,b){return"date"!==o(b)?!1:d(a.getTime(),b.getTime())}function g(a,b){return"regexp"!==o(b)?!1:d(a.toString(),b.toString())}function h(a,b,d){return"arguments"!==o(b)?!1:(a=[].slice.call(a),b=[].slice.call(b),c(a,b,d))}function i(a){var b=[];for(var c in a)b.push(c);return b}function j(a,b){if(a.length!==b.length)return!1;for(var c=0,d=!0;c<a.length;c++)if(a[c]!==b[c]){d=!1;break}return d}function k(a,b){return n.isBuffer(b)?j(a,b):!1}function l(a){return null!==a&&void 0!==a}function m(a,b,d){if(!l(a)||!l(b))return!1;if(a.prototype!==b.prototype)return!1;var e;if(d){for(e=0;e<d.length;e++)if(d[e][0]===a&&d[e][1]===b||d[e][0]===b&&d[e][1]===a)return!0}else d=[];try{var f=i(a),g=i(b)}catch(h){return!1}if(f.sort(),g.sort(),!j(f,g))return!1;d.push([a,b]);var k;for(e=f.length-1;e>=0;e--)if(k=f[e],!c(a[k],b[k],d))return!1;return!0}var n,o=a("type-detect");try{n=a("buffer").Buffer}catch(p){n={},n.isBuffer=function(){return!1}}b.exports=c},{buffer:42,"type-detect":40}],40:[function(a,b){b.exports=a("./lib/type")},{"./lib/type":41}],41:[function(a,b,c){function d(a){var b=Object.prototype.toString.call(a);return f[b]?f[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}function e(){this.tests={}}var c=b.exports=d,f={"[object Array]":"array","[object RegExp]":"regexp","[object Function]":"function","[object Arguments]":"arguments","[object Date]":"date"};c.Library=e,e.prototype.of=d,e.prototype.define=function(a,b){return 1===arguments.length?this.tests[a]:(this.tests[a]=b,this)},e.prototype.test=function(a,b){if(b===d(a))return!0;var c=this.tests[b];if(c&&"regexp"===d(c))return c.test(a);if(c&&"function"===d(c))return c(a);throw new ReferenceError('Type test "'+b+'" not defined or invalid.')}},{}],42:[function(a,b,c){function d(a,b,c){if(!(this instanceof d))return new d(a,b,c);var e,f=typeof a;if("number"===f)e=a>0?a>>>0:0;else if("string"===f)"base64"===b&&(a=C(a)),e=d.byteLength(a,b);else{if("object"!==f||null===a)throw new Error("First argument needs to be a number, array or string.");"Buffer"===a.type&&E(a.data)&&(a=a.data),e=+a.length>0?Math.floor(+a.length):0}var g;T?g=d._augment(new Uint8Array(e)):(g=this,g.length=e,g._isBuffer=!0);var h;if(T&&"number"==typeof a.byteLength)g._set(a);else if(F(a))if(d.isBuffer(a))for(h=0;e>h;h++)g[h]=a.readUInt8(h);else for(h=0;e>h;h++)g[h]=(a[h]%256+256)%256;else if("string"===f)g.write(a,0,b);else if("number"===f&&!T&&!c)for(h=0;e>h;h++)g[h]=0;return g}function e(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;Q(f%2===0,"Invalid hex string"),d>f/2&&(d=f/2);for(var g=0;d>g;g++){var h=parseInt(b.substr(2*g,2),16);Q(!isNaN(h),"Invalid hex string"),a[c+g]=h}return g}function f(a,b,c,d){var e=L(H(b),a,c,d);return e}function g(a,b,c,d){var e=L(I(b),a,c,d);return e}function h(a,b,c,d){return g(a,b,c,d)}function i(a,b,c,d){var e=L(K(b),a,c,d);return e}function j(a,b,c,d){var e=L(J(b),a,c,d);return e}function k(a,b,c){return R.fromByteArray(0===b&&c===a.length?a:a.slice(b,c))}function l(a,b,c){var d="",e="";c=Math.min(a.length,c);for(var f=b;c>f;f++)a[f]<=127?(d+=M(e)+String.fromCharCode(a[f]),e=""):e+="%"+a[f].toString(16);return d+M(e)}function m(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(a[e]);return d}function n(a,b,c){return m(a,b,c)}function o(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;f++)e+=G(a[f]);return e}function p(a,b,c){for(var d=a.slice(b,c),e="",f=0;f<d.length;f+=2)e+=String.fromCharCode(d[f]+256*d[f+1]);return e}function q(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(f=a[b],e>b+1&&(f|=a[b+1]<<8)):(f=a[b]<<8,e>b+1&&(f|=a[b+1])),f}}function r(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(e>b+2&&(f=a[b+2]<<16),e>b+1&&(f|=a[b+1]<<8),f|=a[b],e>b+3&&(f+=a[b+3]<<24>>>0)):(e>b+1&&(f=a[b+1]<<16),e>b+2&&(f|=a[b+2]<<8),e>b+3&&(f|=a[b+3]),f+=a[b]<<24>>>0),f}}function s(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=q(a,b,c,!0),g=32768&f;return g?-1*(65535-f+1):f}}function t(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=r(a,b,c,!0),g=2147483648&f;return g?-1*(4294967295-f+1):f}}function u(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+3<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,23,4)}function v(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+7<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,52,8)}function w(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"trying to write beyond buffer length"),N(b,65535));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,2);h>g;g++)a[c+g]=(b&255<<8*(d?g:1-g))>>>8*(d?g:1-g);return c+2}}function x(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"trying to write beyond buffer length"),N(b,4294967295));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,4);h>g;g++)a[c+g]=b>>>8*(d?g:3-g)&255;return c+4}}function y(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"Trying to write beyond buffer length"),O(b,32767,-32768));var f=a.length;return c>=f?void 0:(b>=0?w(a,b,c,d,e):w(a,65535+b+1,c,d,e),c+2)}function z(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),O(b,2147483647,-2147483648));var f=a.length;return c>=f?void 0:(b>=0?x(a,b,c,d,e):x(a,4294967295+b+1,c,d,e),c+4)}function A(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),P(b,3.4028234663852886e38,-3.4028234663852886e38));var f=a.length;return c>=f?void 0:(S.write(a,b,c,d,23,4),c+4)}function B(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+7<a.length,"Trying to write beyond buffer length"),P(b,1.7976931348623157e308,-1.7976931348623157e308));var f=a.length;return c>=f?void 0:(S.write(a,b,c,d,52,8),c+8)}function C(a){for(a=D(a).replace(V,"");a.length%4!==0;)a+="=";return a}function D(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function E(a){return(Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)})(a)}function F(a){return E(a)||d.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length}function G(a){return 16>a?"0"+a.toString(16):a.toString(16)}function H(a){for(var b=[],c=0;c<a.length;c++){var d=a.charCodeAt(c);if(127>=d)b.push(d);else{var e=c;d>=55296&&57343>=d&&c++;for(var f=encodeURIComponent(a.slice(e,c+1)).substr(1).split("%"),g=0;g<f.length;g++)b.push(parseInt(f[g],16))}}return b}function I(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function J(a){for(var b,c,d,e=[],f=0;f<a.length;f++)b=a.charCodeAt(f),c=b>>8,d=b%256,e.push(d),e.push(c);return e}function K(a){return R.toByteArray(a)}function L(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);e++)b[e+c]=a[e];return e}function M(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function N(a,b){Q("number"==typeof a,"cannot write a non-number as a number"),Q(a>=0,"specified a negative value for writing an unsigned value"),Q(b>=a,"value is larger than maximum value for type"),Q(Math.floor(a)===a,"value has a fractional component")}function O(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value"),Q(Math.floor(a)===a,"value has a fractional component")}function P(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value")}function Q(a,b){if(!a)throw new Error(b||"Failed assertion")}var R=a("base64-js"),S=a("ieee754");c.Buffer=d,c.SlowBuffer=d,c.INSPECT_MAX_BYTES=50,d.poolSize=8192;var T=function(){try{var a=new ArrayBuffer(0),b=new Uint8Array(a);return b.foo=function(){return 42},42===b.foo()&&"function"==typeof b.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(c){return!1}}();d.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.isBuffer=function(a){return!(null==a||!a._isBuffer)},d.byteLength=function(a,b){var c;switch(a=a.toString(),b||"utf8"){case"hex":c=a.length/2;break;case"utf8":case"utf-8":c=H(a).length;break;case"ascii":case"binary":case"raw":c=a.length;break;case"base64":c=K(a).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":c=2*a.length;break;default:throw new Error("Unknown encoding")}return c},d.concat=function(a,b){if(Q(E(a),"Usage: Buffer.concat(list[, length])"),0===a.length)return new d(0);if(1===a.length)return a[0];var c;if(void 0===b)for(b=0,c=0;c<a.length;c++)b+=a[c].length;var e=new d(b),f=0;for(c=0;c<a.length;c++){var g=a[c];g.copy(e,f),f+=g.length}return e},d.compare=function(a,b){Q(d.isBuffer(a)&&d.isBuffer(b),"Arguments must be Buffers");for(var c=a.length,e=b.length,f=0,g=Math.min(c,e);g>f&&a[f]===b[f];f++);return f!==g&&(c=a[f],e=b[f]),e>c?-1:c>e?1:0},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var k=d;d=b,b=c,c=k}b=Number(b)||0;var l=this.length-b;c?(c=Number(c),c>l&&(c=l)):c=l,d=String(d||"utf8").toLowerCase();var m;switch(d){case"hex":m=e(this,a,b,c);break;case"utf8":case"utf-8":m=f(this,a,b,c);break;case"ascii":m=g(this,a,b,c);break;case"binary":m=h(this,a,b,c);break;case"base64":m=i(this,a,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":m=j(this,a,b,c);break;default:throw new Error("Unknown encoding")}return m},d.prototype.toString=function(a,b,c){var d=this;
|
||
if(a=String(a||"utf8").toLowerCase(),b=Number(b)||0,c=void 0===c?d.length:Number(c),c===b)return"";var e;switch(a){case"hex":e=o(d,b,c);break;case"utf8":case"utf-8":e=l(d,b,c);break;case"ascii":e=m(d,b,c);break;case"binary":e=n(d,b,c);break;case"base64":e=k(d,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":e=p(d,b,c);break;default:throw new Error("Unknown encoding")}return e},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},d.prototype.equals=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),0===d.compare(this,a)},d.prototype.compare=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),d.compare(this,a)},d.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||0===d||(d=this.length),b||(b=0),d!==c&&0!==a.length&&0!==e.length){Q(d>=c,"sourceEnd < sourceStart"),Q(b>=0&&b<a.length,"targetStart out of bounds"),Q(c>=0&&c<e.length,"sourceStart out of bounds"),Q(d>=0&&d<=e.length,"sourceEnd out of bounds"),d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);var f=d-c;if(100>f||!T)for(var g=0;f>g;g++)a[g+b]=this[g+c];else a._set(this.subarray(c,c+f),b)}},d.prototype.slice=function(a,b){var c=this.length;if(a=~~a,b=void 0===b?c:~~b,0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c),0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c),a>b&&(b=a),T)return d._augment(this.subarray(a,b));for(var e=b-a,f=new d(e,void 0,!0),g=0;e>g;g++)f[g]=this[g+a];return f},d.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},d.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},d.prototype.readUInt8=function(a,b){return b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),a>=this.length?void 0:this[a]},d.prototype.readUInt16LE=function(a,b){return q(this,a,!0,b)},d.prototype.readUInt16BE=function(a,b){return q(this,a,!1,b)},d.prototype.readUInt32LE=function(a,b){return r(this,a,!0,b)},d.prototype.readUInt32BE=function(a,b){return r(this,a,!1,b)},d.prototype.readInt8=function(a,b){if(b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),!(a>=this.length)){var c=128&this[a];return c?-1*(255-this[a]+1):this[a]}},d.prototype.readInt16LE=function(a,b){return s(this,a,!0,b)},d.prototype.readInt16BE=function(a,b){return s(this,a,!1,b)},d.prototype.readInt32LE=function(a,b){return t(this,a,!0,b)},d.prototype.readInt32BE=function(a,b){return t(this,a,!1,b)},d.prototype.readFloatLE=function(a,b){return u(this,a,!0,b)},d.prototype.readFloatBE=function(a,b){return u(this,a,!1,b)},d.prototype.readDoubleLE=function(a,b){return v(this,a,!0,b)},d.prototype.readDoubleBE=function(a,b){return v(this,a,!1,b)},d.prototype.writeUInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"trying to write beyond buffer length"),N(a,255)),b>=this.length?void 0:(this[b]=a,b+1)},d.prototype.writeUInt16LE=function(a,b,c){return w(this,a,b,!0,c)},d.prototype.writeUInt16BE=function(a,b,c){return w(this,a,b,!1,c)},d.prototype.writeUInt32LE=function(a,b,c){return x(this,a,b,!0,c)},d.prototype.writeUInt32BE=function(a,b,c){return x(this,a,b,!1,c)},d.prototype.writeInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"Trying to write beyond buffer length"),O(a,127,-128)),b>=this.length?void 0:(a>=0?this.writeUInt8(a,b,c):this.writeUInt8(255+a+1,b,c),b+1)},d.prototype.writeInt16LE=function(a,b,c){return y(this,a,b,!0,c)},d.prototype.writeInt16BE=function(a,b,c){return y(this,a,b,!1,c)},d.prototype.writeInt32LE=function(a,b,c){return z(this,a,b,!0,c)},d.prototype.writeInt32BE=function(a,b,c){return z(this,a,b,!1,c)},d.prototype.writeFloatLE=function(a,b,c){return A(this,a,b,!0,c)},d.prototype.writeFloatBE=function(a,b,c){return A(this,a,b,!1,c)},d.prototype.writeDoubleLE=function(a,b,c){return B(this,a,b,!0,c)},d.prototype.writeDoubleBE=function(a,b,c){return B(this,a,b,!1,c)},d.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),Q(c>=b,"end < start"),c!==b&&0!==this.length){Q(b>=0&&b<this.length,"start out of bounds"),Q(c>=0&&c<=this.length,"end out of bounds");var d;if("number"==typeof a)for(d=b;c>d;d++)this[d]=a;else{var e=H(a.toString()),f=e.length;for(d=b;c>d;d++)this[d]=e[d%f]}return this}},d.prototype.inspect=function(){for(var a=[],b=this.length,d=0;b>d;d++)if(a[d]=G(this[d]),d===c.INSPECT_MAX_BYTES){a[d+1]="...";break}return"<Buffer "+a.join(" ")+">"},d.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(T)return new d(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;c>b;b+=1)a[b]=this[b];return a.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var U=d.prototype;d._augment=function(a){return a._isBuffer=!0,a._get=a.get,a._set=a.set,a.get=U.get,a.set=U.set,a.write=U.write,a.toString=U.toString,a.toLocaleString=U.toString,a.toJSON=U.toJSON,a.equals=U.equals,a.compare=U.compare,a.copy=U.copy,a.slice=U.slice,a.readUInt8=U.readUInt8,a.readUInt16LE=U.readUInt16LE,a.readUInt16BE=U.readUInt16BE,a.readUInt32LE=U.readUInt32LE,a.readUInt32BE=U.readUInt32BE,a.readInt8=U.readInt8,a.readInt16LE=U.readInt16LE,a.readInt16BE=U.readInt16BE,a.readInt32LE=U.readInt32LE,a.readInt32BE=U.readInt32BE,a.readFloatLE=U.readFloatLE,a.readFloatBE=U.readFloatBE,a.readDoubleLE=U.readDoubleLE,a.readDoubleBE=U.readDoubleBE,a.writeUInt8=U.writeUInt8,a.writeUInt16LE=U.writeUInt16LE,a.writeUInt16BE=U.writeUInt16BE,a.writeUInt32LE=U.writeUInt32LE,a.writeUInt32BE=U.writeUInt32BE,a.writeInt8=U.writeInt8,a.writeInt16LE=U.writeInt16LE,a.writeInt16BE=U.writeInt16BE,a.writeInt32LE=U.writeInt32LE,a.writeInt32BE=U.writeInt32BE,a.writeFloatLE=U.writeFloatLE,a.writeFloatBE=U.writeFloatBE,a.writeDoubleLE=U.writeDoubleLE,a.writeDoubleBE=U.writeDoubleBE,a.fill=U.fill,a.inspect=U.inspect,a.toArrayBuffer=U.toArrayBuffer,a};var V=/[^+\/0-9A-z]/g},{"base64-js":43,ieee754:44}],43:[function(a,b,c){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(a){"use strict";function b(a){var b=a.charCodeAt(0);return b===g?62:b===h?63:i>b?-1:i+10>b?b-i+26+26:k+26>b?b-k:j+26>b?b-j+26:void 0}function c(a){function c(a){j[l++]=a}var d,e,g,h,i,j;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new f(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,e=0;g>d;d+=4,e+=3)h=b(a.charAt(d))<<18|b(a.charAt(d+1))<<12|b(a.charAt(d+2))<<6|b(a.charAt(d+3)),c((16711680&h)>>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function e(a){function b(a){return d.charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var e,f,g,h=a.length%3,i="";for(e=0,g=a.length-h;g>e;e+=3)f=(a[e]<<16)+(a[e+1]<<8)+a[e+2],i+=c(f);switch(h){case 1:f=a[a.length-1],i+=b(f>>2),i+=b(f<<4&63),i+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],i+=b(f>>10),i+=b(f>>4&63),i+=b(f<<2&63),i+="="}return i}var f="undefined"!=typeof Uint8Array?Uint8Array:Array,g="+".charCodeAt(0),h="/".charCodeAt(0),i="0".charCodeAt(0),j="a".charCodeAt(0),k="A".charCodeAt(0);a.toByteArray=c,a.fromByteArray=e}("undefined"==typeof c?this.base64js={}:c)},{}],44:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],45:[function(a,b){b.exports="function"==typeof Object.create?function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],46:[function(a,b){function c(){}var d=b.exports={};d.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var d=c.shift();d()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.binding=function(){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(){throw new Error("process.chdir is not supported")}},{}],47:[function(a,b){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8}},{}],48:[function(a,b,c){(function(b,d){function e(a,b){var d={seen:[],stylize:g};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),p(b)?d.showHidden=b:b&&c._extend(d,b),v(d.showHidden)&&(d.showHidden=!1),v(d.depth)&&(d.depth=2),v(d.colors)&&(d.colors=!1),v(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=f),i(d,a,d.depth)}function f(a,b){var c=e.styles[b];return c?"["+e.colors[c][0]+"m"+a+"["+e.colors[c][1]+"m":a}function g(a){return a}function h(a){var b={};return a.forEach(function(a){b[a]=!0}),b}function i(a,b,d){if(a.customInspect&&b&&A(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return t(e)||(e=i(a,e,d)),e}var f=j(a,b);if(f)return f;var g=Object.keys(b),p=h(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),z(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return k(b);if(0===g.length){if(A(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(w(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(y(b))return a.stylize(Date.prototype.toString.call(b),"date");if(z(b))return k(b)}var r="",s=!1,u=["{","}"];if(o(b)&&(s=!0,u=["[","]"]),A(b)){var v=b.name?": "+b.name:"";r=" [Function"+v+"]"}if(w(b)&&(r=" "+RegExp.prototype.toString.call(b)),y(b)&&(r=" "+Date.prototype.toUTCString.call(b)),z(b)&&(r=" "+k(b)),0===g.length&&(!s||0==b.length))return u[0]+r+u[1];if(0>d)return w(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var x;return x=s?l(a,b,d,p,g):g.map(function(c){return m(a,b,d,p,c,s)}),a.seen.pop(),n(x,r,u)}function j(a,b){if(v(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return s(b)?a.stylize(""+b,"number"):p(b)?a.stylize(""+b,"boolean"):q(b)?a.stylize("null","null"):void 0}function k(a){return"["+Error.prototype.toString.call(a)+"]"}function l(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(F(b,String(g))?m(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(m(a,b,c,d,e,!0))}),f}function m(a,b,c,d,e,f){var g,h,j;if(j=Object.getOwnPropertyDescriptor(b,e)||{value:b[e]},j.get?h=j.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):j.set&&(h=a.stylize("[Setter]","special")),F(d,e)||(g="["+e+"]"),h||(a.seen.indexOf(j.value)<0?(h=q(c)?i(a,j.value,null):i(a,j.value,c-1),h.indexOf("\n")>-1&&(h=f?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),v(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function n(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function o(a){return Array.isArray(a)}function p(a){return"boolean"==typeof a}function q(a){return null===a}function r(a){return null==a}function s(a){return"number"==typeof a}function t(a){return"string"==typeof a}function u(a){return"symbol"==typeof a}function v(a){return void 0===a}function w(a){return x(a)&&"[object RegExp]"===C(a)}function x(a){return"object"==typeof a&&null!==a}function y(a){return x(a)&&"[object Date]"===C(a)}function z(a){return x(a)&&("[object Error]"===C(a)||a instanceof Error)}function A(a){return"function"==typeof a}function B(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function C(a){return Object.prototype.toString.call(a)}function D(a){return 10>a?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),J[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=/%[sdj%]/g;c.format=function(a){if(!t(a)){for(var b=[],c=0;c<arguments.length;c++)b.push(e(arguments[c]));return b.join(" ")}for(var c=1,d=arguments,f=d.length,g=String(a).replace(G,function(a){if("%%"===a)return"%";if(c>=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(b){return"[Circular]"}default:return a}}),h=d[c];f>c;h=d[++c])g+=q(h)||!x(h)?" "+h:" "+e(h);return g},c.deprecate=function(a,e){function f(){if(!g){if(b.throwDeprecation)throw new Error(e);b.traceDeprecation?console.trace(e):console.error(e),g=!0}return a.apply(this,arguments)}if(v(d.process))return function(){return c.deprecate(a,e).apply(this,arguments)};if(b.noDeprecation===!0)return a;var g=!1;return f};var H,I={};c.debuglog=function(a){if(v(H)&&(H=b.env.NODE_DEBUG||""),a=a.toUpperCase(),!I[a])if(new RegExp("\\b"+a+"\\b","i").test(H)){var d=b.pid;I[a]=function(){var b=c.format.apply(c,arguments);console.error("%s %d: %s",a,d,b)}}else I[a]=function(){};return I[a]},c.inspect=e,e.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},e.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},c.isArray=o,c.isBoolean=p,c.isNull=q,c.isNullOrUndefined=r,c.isNumber=s,c.isString=t,c.isSymbol=u,c.isUndefined=v,c.isRegExp=w,c.isObject=x,c.isDate=y,c.isError=z,c.isFunction=A,c.isPrimitive=B,c.isBuffer=a("./support/isBuffer");var J=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c.log=function(){console.log("%s - %s",E(),c.format.apply(c,arguments))},c.inherits=a("inherits"),c._extend=function(a,b){if(!b||!x(b))return a;for(var c=Object.keys(b),d=c.length;d--;)a[c[d]]=b[c[d]];return a}}).call(this,a("JkpR2F"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":47,JkpR2F:46,inherits:45}],49:[function(a,b,c){!function(d){"use strict";"function"==typeof a&&"object"==typeof c&&"object"==typeof b?b.exports=d:"function"==typeof define&&define.amd?define(function(){return d}):chai.use(d)}(function(a,b){"use strict";function c(a){return"function"==typeof a&&"function"==typeof a.getCall&&"function"==typeof a.calledWithExactly}function d(a){return 1===a?"once":2===a?"twice":3===a?"thrice":(a||0)+" times"}function e(a){return a&&c(a.proxy)}function f(a){if(!c(a._obj)&&!e(a._obj))throw new TypeError(b.inspect(a._obj)+" is not a spy or a call to a spy!")}function g(a,b,d,e,f){function g(b){return a.printf.apply(a,b)}var h=e?"always have ":"have ";return d=d||"",c(a.proxy)&&(a=a.proxy),{affirmative:g(["expected %n to "+h+b+d].concat(f)),negative:g(["expected %n to not "+h+b].concat(f))}}function h(c,d,e){b.addProperty(a.Assertion.prototype,c,function(){f(this);var a=g(this._obj,d,e,!1);this.assert(this._obj[c],a.affirmative,a.negative)})}function i(c,e,h){b.addMethod(a.Assertion.prototype,c,function(a){f(this);var b=g(this._obj,e,h,!1,[d(a)]);this.assert(this._obj[c]===a,b.affirmative,b.negative)})}function j(a,c,d){return function(){f(this);var e="always"+a[0].toUpperCase()+a.substring(1),h=b.flag(this,"always")&&"function"==typeof this._obj[e],i=h?e:a,j=g(this._obj,c,d,h,n.call(arguments));this.assert(this._obj[i].apply(this._obj,arguments),j.affirmative,j.negative)}}function k(c,d,e){var f=j(c,d,e);b.addProperty(a.Assertion.prototype,c,f)}function l(c,d,e,f){var g=j(d,e,f);b.addMethod(a.Assertion.prototype,c,g)}function m(a,b,c){l(a,a,b,c)}var n=Array.prototype.slice;b.addProperty(a.Assertion.prototype,"always",function(){b.flag(this,"always",!0)}),h("called","been called"," at least once, but it was never called"),i("callCount","been called exactly %1",", but it was called %c%C"),h("calledOnce","been called exactly once",", but it was called %c%C"),h("calledTwice","been called exactly twice",", but it was called %c%C"),h("calledThrice","been called exactly thrice",", but it was called %c%C"),k("calledWithNew","been called with new"),m("calledBefore","been called before %1"),m("calledAfter","been called after %1"),m("calledOn","been called with %1 as this",", but it was called with %t instead"),m("calledWith","been called with arguments %*","%C"),m("calledWithExactly","been called with exact arguments %*","%C"),m("calledWithMatch","been called with arguments matching %*","%C"),m("returned","returned %1"),l("thrown","threw","thrown %1")})},{}],50:[function(a,b,c){"use strict";!function(d){function e(a){var b=!1;try{a.appendChild(l),b=l.parentNode==a}catch(c){return!1}finally{try{a.removeChild(l)}catch(c){}}return b}function f(a){return l&&a&&1===a.nodeType&&e(a)}function g(a){return"function"==typeof a||!!(a&&a.constructor&&a.call&&a.apply)}function h(a){return"number"==typeof a&&isNaN(a)}function i(a,b){for(var c in b)m.call(a,c)||(a[c]=b[c])}function j(a){return"function"==typeof a&&"function"==typeof a.restore&&a.restore.sinon}function k(a,b,c){c.exports=n,n.spy=a("./sinon/spy"),n.spyCall=a("./sinon/call"),n.behavior=a("./sinon/behavior"),n.stub=a("./sinon/stub"),n.mock=a("./sinon/mock"),n.collection=a("./sinon/collection"),n.assert=a("./sinon/assert"),n.sandbox=a("./sinon/sandbox"),n.test=a("./sinon/test"),n.testCase=a("./sinon/test_case"),n.match=a("./sinon/match")}var l="undefined"!=typeof document&&document.createElement("div"),m=Object.prototype.hasOwnProperty,n={wrapMethod:function(a,b,c){if(!a)throw new TypeError("Should wrap property of object");if("function"!=typeof c)throw new TypeError("Method wrapper should be function");var d,e=a[b];if(g(e)){if(e.restore&&e.restore.sinon)d=new TypeError("Attempted to wrap "+b+" which is already wrapped");else if(e.calledBefore){var f=e.returns?"stubbed":"spied on";d=new TypeError("Attempted to wrap "+b+" which is already "+f)}}else d=new TypeError("Attempted to wrap "+typeof e+" property "+b+" as function");if(d)throw e&&e._stack&&(d.stack+="\n--------------\n"+e._stack),d;var h=a.hasOwnProperty?a.hasOwnProperty(b):m.call(a,b);return a[b]=c,c.displayName=b,c._stack=new Error("Stack Trace for original").stack,c.restore=function(){h||delete a[b],a[b]===c&&(a[b]=e)},c.restore.sinon=!0,i(c,e),c},extend:function(a){for(var b=1,c=arguments.length;c>b;b+=1)for(var d in arguments[b])arguments[b].hasOwnProperty(d)&&(a[d]=arguments[b][d]),arguments[b].hasOwnProperty("toString")&&arguments[b].toString!=a.toString&&(a.toString=arguments[b].toString);return a},create:function(a){var b=function(){};return b.prototype=a,new b},deepEqual:function t(a,b){if(n.match&&n.match.isMatcher(a))return a.test(b);if("object"!=typeof a||"object"!=typeof b)return h(a)&&h(b)?!0:a===b;if(f(a)||f(b))return a===b;if(a===b)return!0;if(null===a&&null!==b||null!==a&&null===b)return!1;if(a instanceof RegExp&&b instanceof RegExp)return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;var c=Object.prototype.toString.call(a);if(c!=Object.prototype.toString.call(b))return!1;if("[object Date]"==c)return a.valueOf()===b.valueOf();var d,e=0,g=0;if("[object Array]"==c&&a.length!==b.length)return!1;for(d in a){if(e+=1,!(d in b))return!1;if(!t(a[d],b[d]))return!1}for(d in b)g+=1;return e==g},functionName:function(a){var b=a.displayName||a.name;if(!b){var c=a.toString().match(/function ([^\s\(]+)/);b=c&&c[1]}return b},functionToString:function(){if(this.getCall&&this.callCount)for(var a,b,c=this.callCount;c--;){a=this.getCall(c).thisValue;for(b in a)if(a[b]===this)return b}return this.displayName||"sinon fake"},getConfig:function(a){var b={};a=a||{};var c=n.defaultConfig;for(var d in c)c.hasOwnProperty(d)&&(b[d]=a.hasOwnProperty(d)?a[d]:c[d]);return b},format:function(a){return""+a},defaultConfig:{injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},timesInWords:function(a){return 1==a&&"once"||2==a&&"twice"||3==a&&"thrice"||(a||0)+" times"},calledInOrder:function(a){for(var b=1,c=a.length;c>b;b++)if(!a[b-1].calledBefore(a[b])||!a[b].called)return!1;return!0},orderByFirstCall:function(a){return a.sort(function(a,b){var c=a.getCall(0),d=b.getCall(0),e=c&&c.callId||-1,f=d&&d.callId||-1;return f>e?-1:1})},log:function(){},logError:function(a,b){var c=a+" threw exception: ";n.log(c+"["+b.name+"] "+b.message),b.stack&&n.log(b.stack),setTimeout(function(){throw b.message=c+b.message,b},0)},typeOf:function(a){if(null===a)return"null";if(void 0===a)return"undefined";var b=Object.prototype.toString.call(a);return b.substring(8,b.length-1).toLowerCase()},createStubInstance:function(a){if("function"!=typeof a)throw new TypeError("The constructor should be a function.");return n.stub(n.create(a.prototype))},restore:function(a){if(null!==a&&"object"==typeof a)for(var b in a)j(a[b])&&a[b].restore();else j(a)&&a.restore()}},o="undefined"!=typeof b&&b.exports&&"function"==typeof a,p="function"==typeof define&&"object"==typeof define.amd&&define.amd;if(p)define(k);else if(o){try{d=a("formatio")}catch(q){}k(a,c,b)}if(d){var r=d.configure({quoteStrings:!1});n.format=function(){return r.ascii.apply(r,arguments)}}else if(o)try{var s=a("util");n.format=function(a){return"object"==typeof a&&a.toString===Object.prototype.toString?s.inspect(a):a}}catch(q){}return n}("object"==typeof formatio&&formatio)},{"./sinon/assert":51,"./sinon/behavior":52,"./sinon/call":53,"./sinon/collection":54,"./sinon/match":55,"./sinon/mock":56,"./sinon/sandbox":57,"./sinon/spy":58,"./sinon/stub":59,"./sinon/test":60,"./sinon/test_case":61,formatio:63,util:48}],51:[function(a,b){(function(c){"use strict";!function(c,d){function e(){for(var a,b=0,c=arguments.length;c>b;++b)a=arguments[b],a||i.fail("fake is not a spy"),"function"!=typeof a&&i.fail(a+" is not a function"),"function"!=typeof a.getCall&&i.fail(a+" is not stubbed")}function f(a,b){a=a||d;var c=a.fail||i.fail;c.call(a,b)}function g(a,b,c){2==arguments.length&&(c=b,b=a),i[a]=function(d){e(d);var g=k.call(arguments,1),h=!1;h="function"==typeof b?!b(d):"function"==typeof d[b]?!d[b].apply(d,g):!d[b],h?f(this,d.printf.apply(d,[c].concat(g))):i.pass(a)}}function h(a,b){return!a||/^fail/.test(b)?b:a+b.slice(0,1).toUpperCase()+b.slice(1)}var i,j="undefined"!=typeof b&&b.exports&&"function"==typeof a,k=Array.prototype.slice;!c&&j&&(c=a("../sinon")),c&&(i={failException:"AssertError",fail:function(a){var b=new Error(a);throw b.name=this.failException||i.failException,b},pass:function(){},callOrder:function(){e.apply(null,arguments);var a="",b="";if(c.calledInOrder(arguments))i.pass("callOrder");else{try{a=[].join.call(arguments,", ");for(var d=k.call(arguments),g=d.length;g;)d[--g].called||d.splice(g,1);b=c.orderByFirstCall(d).join(", ")}catch(h){}f(this,"expected "+a+" to be called in order but were called as "+b)}},callCount:function(a,b){if(e(a),a.callCount!=b){var d="expected %n to be called "+c.timesInWords(b)+" but was called %c%C";f(this,a.printf(d))}else i.pass("callCount")},expose:function(a,b){if(!a)throw new TypeError("target is null or undefined");var c=b||{},d="undefined"==typeof c.prefix&&"assert"||c.prefix,e="undefined"==typeof c.includeFail||!!c.includeFail;for(var f in this)"export"==f||!e&&/^(fail)/.test(f)||(a[h(d,f)]=this[f]);return a},match:function(a,b){var d=c.match(b);if(d.test(a))i.pass("match");else{var e=["expected value to match"," expected = "+c.format(b)," actual = "+c.format(a)];f(this,e.join("\n"))}}},g("called","expected %n to have been called at least once but was never called"),g("notCalled",function(a){return!a.called},"expected %n to not have been called but was called %c%C"),g("calledOnce","expected %n to be called once but was called %c%C"),g("calledTwice","expected %n to be called twice but was called %c%C"),g("calledThrice","expected %n to be called thrice but was called %c%C"),g("calledOn","expected %n to be called with %1 as this but was called with %t"),g("alwaysCalledOn","expected %n to always be called with %1 as this but was called with %t"),g("calledWithNew","expected %n to be called with new"),g("alwaysCalledWithNew","expected %n to always be called with new"),g("calledWith","expected %n to be called with arguments %*%C"),g("calledWithMatch","expected %n to be called with match %*%C"),g("alwaysCalledWith","expected %n to always be called with arguments %*%C"),g("alwaysCalledWithMatch","expected %n to always be called with match %*%C"),g("calledWithExactly","expected %n to be called with exact arguments %*%C"),g("alwaysCalledWithExactly","expected %n to always be called with exact arguments %*%C"),g("neverCalledWith","expected %n to never be called with arguments %*%C"),g("neverCalledWithMatch","expected %n to never be called with match %*%C"),g("threw","%n did not throw exception%C"),g("alwaysThrew","%n did not always throw exception%C"),c.assert=i,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=i}):j&&(b.exports=i))}("object"==typeof sinon&&sinon||null,"undefined"!=typeof window?window:"undefined"!=typeof self?self:c)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../sinon":50}],52:[function(a,b){(function(c){"use strict";!function(d){function e(a,b){return"string"==typeof a?(this.exception=new Error(b||""),this.exception.name=a):this.exception=a?a:new Error("Error"),this}function f(a,b){var c=a.callArgAt;if(0>c){for(var d=a.callArgProp,e=0,f=b.length;f>e;++e){if(!d&&"function"==typeof b[e])return b[e];if(d&&b[e]&&"function"==typeof b[e][d])return b[e][d]}return null}return b[c]}function g(a,b,c){if(a.callArgAt<0){var e;return e=a.callArgProp?d.functionName(a.stub)+" expected to yield to '"+a.callArgProp+"', but no object with such a property was passed.":d.functionName(a.stub)+" expected to yield, but no callback was passed.",c.length>0&&(e+=" Received ["+l.call(c,", ")+"]"),e}return"argument at index "+a.callArgAt+" is not a function: "+b}function h(a,b){if("number"==typeof a.callArgAt){var c=f(a,b);if("function"!=typeof c)throw new TypeError(g(a,c,b));a.callbackAsync?m(function(){c.apply(a.callbackContext,a.callbackArguments)}):c.apply(a.callbackContext,a.callbackArguments)}}var i="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!d&&i&&(d=a("../sinon")),d){var j,k=Array.prototype.slice,l=Array.prototype.join,m=function(){return"object"==typeof c&&"function"==typeof c.nextTick?c.nextTick:"function"==typeof setImmediate?setImmediate:function(a){setTimeout(a,0)}}();j={create:function(a){var b=d.extend({},d.behavior);return delete b.create,b.stub=a,b},isPresent:function(){return"number"==typeof this.callArgAt||this.exception||"number"==typeof this.returnArgAt||this.returnThis||this.returnValueDefined},invoke:function(a,b){if(h(this,b),this.exception)throw this.exception;return"number"==typeof this.returnArgAt?b[this.returnArgAt]:this.returnThis?a:this.returnValue},onCall:function(a){return this.stub.onCall(a)},onFirstCall:function(){return this.stub.onFirstCall()},onSecondCall:function(){return this.stub.onSecondCall()},onThirdCall:function(){return this.stub.onThirdCall()},withArgs:function(){throw new Error('Defining a stub by invoking "stub.onCall(...).withArgs(...)" is not supported. Use "stub.withArgs(...).onCall(...)" to define sequential behavior for calls with certain arguments.')},callsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOn:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgWith:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.callArgAt=a,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOnWith:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},yields:function(){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,0),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsOn:function(a){if("object"!=typeof a)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=a,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsTo:function(a){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=a,this.callbackAsync=!1,this},yieldsToOn:function(a,b){if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=a,this.callbackAsync=!1,this},"throws":e,throwsException:e,returns:function(a){return this.returnValue=a,this.returnValueDefined=!0,this},returnsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.returnArgAt=a,this},returnsThis:function(){return this.returnThis=!0,this}};for(var n in j)j.hasOwnProperty(n)&&n.match(/^(callsArg|yields)/)&&!n.match(/Async/)&&(j[n+"Async"]=function(a){return function(){var b=this[a].apply(this,arguments);return this.callbackAsync=!0,b}}(n));d.behavior=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):i&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)}).call(this,a("JkpR2F"))},{"../sinon":50,JkpR2F:46}],53:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.functionName(a)+b;
|
||
throw d.length&&(e+=" Received ["+g.call(d).join(", ")+"]"),new Error(e)}function e(a,b,d,e,f,g){if("number"!=typeof g)throw new TypeError("Call id is not a number");var i=c.create(h);return i.proxy=a,i.thisValue=b,i.args=d,i.returnValue=e,i.exception=f,i.callId=g,i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&f&&(c=a("../sinon")),c){var g=Array.prototype.slice,h={calledOn:function(a){return c.match&&c.match.isMatcher(a)?a.test(this.thisValue):this.thisValue===a},calledWith:function(){for(var a=0,b=arguments.length;b>a;a+=1)if(!c.deepEqual(arguments[a],this.args[a]))return!1;return!0},calledWithMatch:function(){for(var a=0,b=arguments.length;b>a;a+=1){var d=this.args[a],e=arguments[a];if(!c.match||!c.match(e).test(d))return!1}return!0},calledWithExactly:function(){return arguments.length==this.args.length&&this.calledWith.apply(this,arguments)},notCalledWith:function(){return!this.calledWith.apply(this,arguments)},notCalledWithMatch:function(){return!this.calledWithMatch.apply(this,arguments)},returned:function(a){return c.deepEqual(a,this.returnValue)},threw:function(a){return"undefined"!=typeof a&&this.exception?this.exception===a||this.exception.name===a:!!this.exception},calledWithNew:function(){return this.proxy.prototype&&this.thisValue instanceof this.proxy},calledBefore:function(a){return this.callId<a.callId},calledAfter:function(a){return this.callId>a.callId},callArg:function(a){this.args[a]()},callArgOn:function(a,b){this.args[a].apply(b)},callArgWith:function(a){this.callArgOnWith.apply(this,[a,null].concat(g.call(arguments,1)))},callArgOnWith:function(a,b){var c=g.call(arguments,2);this.args[a].apply(b,c)},"yield":function(){this.yieldOn.apply(this,[null].concat(g.call(arguments,0)))},yieldOn:function(a){for(var b=this.args,c=0,e=b.length;e>c;++c)if("function"==typeof b[c])return void b[c].apply(a,g.call(arguments,1));d(this.proxy," cannot yield since no callback was passed.",b)},yieldTo:function(a){this.yieldToOn.apply(this,[a,null].concat(g.call(arguments,1)))},yieldToOn:function(a,b){for(var c=this.args,e=0,f=c.length;f>e;++e)if(c[e]&&"function"==typeof c[e][a])return void c[e][a].apply(b,g.call(arguments,2));d(this.proxy," cannot yield to '"+a+"' since no callback was passed.",c)},toString:function(){for(var a=this.proxy.toString()+"(",b=[],d=0,e=this.args.length;e>d;++d)b.push(c.format(this.args[d]));return a=a+b.join(", ")+")","undefined"!=typeof this.returnValue&&(a+=" => "+c.format(this.returnValue)),this.exception&&(a+=" !"+this.exception.name,this.exception.message&&(a+="("+this.exception.message+")")),a}};h.invokeCallback=h.yield,e.toString=h.toString,c.spyCall=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],54:[function(a,b){"use strict";!function(c){function d(a){return a.fakes||(a.fakes=[]),a.fakes}function e(a,b){for(var c=d(a),e=0,f=c.length;f>e;e+=1)"function"==typeof c[e][b]&&c[e][b]()}function f(a){for(var b=d(a),c=0;c<b.length;)b.splice(c,1)}var g="undefined"!=typeof b&&b.exports&&"function"==typeof a,h=[].push,i=Object.prototype.hasOwnProperty;if(!c&&g&&(c=a("../sinon")),c){var j={verify:function(){e(this,"verify")},restore:function(){e(this,"restore"),f(this)},verifyAndRestore:function(){var a;try{this.verify()}catch(b){a=b}if(this.restore(),a)throw a},add:function(a){return h.call(d(this),a),a},spy:function(){return this.add(c.spy.apply(c,arguments))},stub:function(a,b,d){if(b){var e=a[b];if("function"!=typeof e){if(!i.call(a,b))throw new TypeError("Cannot stub non-existent own property "+b);return a[b]=d,this.add({restore:function(){a[b]=e}})}}if(!b&&a&&"object"==typeof a){var f=c.stub.apply(c,arguments);for(var g in f)"function"==typeof f[g]&&this.add(f[g]);return f}return this.add(c.stub.apply(c,arguments))},mock:function(){return this.add(c.mock.apply(c,arguments))},inject:function(a){var b=this;return a.spy=function(){return b.spy.apply(b,arguments)},a.stub=function(){return b.stub.apply(b,arguments)},a.mock=function(){return b.mock.apply(b,arguments)},a}};c.collection=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):g&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],55:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.typeOf(a);if(e!==b)throw new TypeError("Expected type of "+d+" to be "+b+", but was "+e)}function e(a){return i.isPrototypeOf(a)}function f(a,b){if(null===b||void 0===b)return!1;for(var d in a)if(a.hasOwnProperty(d)){var e=a[d],g=b[d];if(j.isMatcher(e)){if(!e.test(g))return!1}else if("object"===c.typeOf(e)){if(!f(e,g))return!1}else if(!c.deepEqual(e,g))return!1}return!0}function g(a,b){return function(e,f){d(e,"string","property");var g=1===arguments.length,h=b+'("'+e+'"';return g||(h+=", "+f),h+=")",j(function(b){return void 0!==b&&null!==b&&a(b,e)?g||c.deepEqual(f,b[e]):!1},h)}}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i={toString:function(){return this.message}};i.or=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)||a.test(c)},d.message=b.message+".or("+a.message+")",d},i.and=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)&&a.test(c)},d.message=b.message+".and("+a.message+")",d};var j=function(a,b){var d=c.create(i),e=c.typeOf(a);switch(e){case"object":if("function"==typeof a.test)return d.test=function(b){return a.test(b)===!0},d.message="match("+c.functionName(a.test)+")",d;var g=[];for(var h in a)a.hasOwnProperty(h)&&g.push(h+": "+a[h]);d.test=function(b){return f(a,b)},d.message="match("+g.join(", ")+")";break;case"number":d.test=function(b){return a==b};break;case"string":d.test=function(b){return"string"!=typeof b?!1:-1!==b.indexOf(a)},d.message='match("'+a+'")';break;case"regexp":d.test=function(b){return"string"!=typeof b?!1:a.test(b)};break;case"function":d.test=a,d.message=b?b:"match("+c.functionName(a)+")";break;default:d.test=function(b){return c.deepEqual(a,b)}}return d.message||(d.message="match("+a+")"),d};j.isMatcher=e,j.any=j(function(){return!0},"any"),j.defined=j(function(a){return null!==a&&void 0!==a},"defined"),j.truthy=j(function(a){return!!a},"truthy"),j.falsy=j(function(a){return!a},"falsy"),j.same=function(a){return j(function(b){return a===b},"same("+a+")")},j.typeOf=function(a){return d(a,"string","type"),j(function(b){return c.typeOf(b)===a},'typeOf("'+a+'")')},j.instanceOf=function(a){return d(a,"function","type"),j(function(b){return b instanceof a},"instanceOf("+c.functionName(a)+")")},j.has=g(function(a,b){return"object"==typeof a?b in a:void 0!==a[b]},"has"),j.hasOwn=g(function(a,b){return a.hasOwnProperty(b)},"hasOwn"),j.bool=j.typeOf("boolean"),j.number=j.typeOf("number"),j.string=j.typeOf("string"),j.object=j.typeOf("object"),j.func=j.typeOf("function"),j.array=j.typeOf("array"),j.regexp=j.typeOf("regexp"),j.date=j.typeOf("date"),c.match=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):h&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],56:[function(a,b){"use strict";!function(c){function d(a){return a?d.create(a):c.expectation.create("Anonymous mock")}var e,f="undefined"!=typeof b&&b.exports&&"function"==typeof a,g=[].push;if(!c&&f&&(c=a("../sinon")),c){e=c.match,!e&&f&&(e=a("./match")),c.mock=d,c.extend(d,function(){function a(a,b){if(a)for(var c=0,d=a.length;d>c;c+=1)b(a[c])}return{create:function(a){if(!a)throw new TypeError("object is null");var b=c.extend({},d);return b.object=a,delete b.create,b},expects:function(a){if(!a)throw new TypeError("method is falsy");if(this.expectations||(this.expectations={},this.proxies=[]),!this.expectations[a]){this.expectations[a]=[];var b=this;c.wrapMethod(this.object,a,function(){return b.invokeMethod(a,this,arguments)}),g.call(this.proxies,a)}var d=c.expectation.create(a);return g.call(this.expectations[a],d),d},restore:function(){var b=this.object;a(this.proxies,function(a){"function"==typeof b[a].restore&&b[a].restore()})},verify:function(){var b=this.expectations||{},d=[],e=[];return a(this.proxies,function(c){a(b[c],function(a){a.met()?g.call(e,a.toString()):g.call(d,a.toString())})}),this.restore(),d.length>0?c.expectation.fail(d.concat(e).join("\n")):c.expectation.pass(d.concat(e).join("\n")),!0},invokeMethod:function(a,b,d){var e,f=this.expectations&&this.expectations[a],h=f&&f.length||0;for(e=0;h>e;e+=1)if(!f[e].met()&&f[e].allowsCall(b,d))return f[e].apply(b,d);var i,j=[],k=0;for(e=0;h>e;e+=1)f[e].allowsCall(b,d)?i=i||f[e]:k+=1,g.call(j," "+f[e].toString());return 0===k?i.apply(b,d):(j.unshift("Unexpected call: "+c.spyCall.toString.call({proxy:a,args:d})),void c.expectation.fail(j.join("\n")))}}}());var h=c.timesInWords;c.expectation=function(){function a(a){return 0==a?"never called":"called "+h(a)}function b(a){var b=a.minCalls,c=a.maxCalls;if("number"==typeof b&&"number"==typeof c){var d=h(b);return b!=c&&(d="at least "+d+" and at most "+h(c)),d}return"number"==typeof b?"at least "+h(b):"at most "+h(c)}function d(a){var b="number"==typeof a.minCalls;return!b||a.callCount>=a.minCalls}function f(a){return"number"!=typeof a.maxCalls?!1:a.callCount==a.maxCalls}function i(a,b){return e&&e.isMatcher(a)?a.test(b):!0}var j=Array.prototype.slice,k=c.spy.invoke;return{minCalls:1,maxCalls:1,create:function(a){var b=c.extend(c.stub.create(),c.expectation);return delete b.create,b.method=a,b},invoke:function(a,b,c){return this.verifyCallAllowed(b,c),k.apply(this,arguments)},atLeast:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");return this.limitsSet||(this.maxCalls=null,this.limitsSet=!0),this.minCalls=a,this},atMost:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");return this.limitsSet||(this.minCalls=null,this.limitsSet=!0),this.maxCalls=a,this},never:function(){return this.exactly(0)},once:function(){return this.exactly(1)},twice:function(){return this.exactly(2)},thrice:function(){return this.exactly(3)},exactly:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not a number");return this.atLeast(a),this.atMost(a)},met:function(){return!this.failed&&d(this)},verifyCallAllowed:function(a,b){if(f(this)&&(this.failed=!0,c.expectation.fail(this.method+" already called "+h(this.maxCalls))),"expectedThis"in this&&this.expectedThis!==a&&c.expectation.fail(this.method+" called with "+a+" as thisValue, expected "+this.expectedThis),"expectedArguments"in this){b||c.expectation.fail(this.method+" received no arguments, expected "+c.format(this.expectedArguments)),b.length<this.expectedArguments.length&&c.expectation.fail(this.method+" received too few arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments)),this.expectsExactArgCount&&b.length!=this.expectedArguments.length&&c.expectation.fail(this.method+" received too many arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments));for(var d=0,e=this.expectedArguments.length;e>d;d+=1)i(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", didn't match "+this.expectedArguments.toString()),c.deepEqual(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", expected "+c.format(this.expectedArguments))}},allowsCall:function(a,b){if(this.met()&&f(this))return!1;if("expectedThis"in this&&this.expectedThis!==a)return!1;if(!("expectedArguments"in this))return!0;if(b=b||[],b.length<this.expectedArguments.length)return!1;if(this.expectsExactArgCount&&b.length!=this.expectedArguments.length)return!1;for(var d=0,e=this.expectedArguments.length;e>d;d+=1){if(!i(this.expectedArguments[d],b[d]))return!1;if(!c.deepEqual(this.expectedArguments[d],b[d]))return!1}return!0},withArgs:function(){return this.expectedArguments=j.call(arguments),this},withExactArgs:function(){return this.withArgs.apply(this,arguments),this.expectsExactArgCount=!0,this},on:function(a){return this.expectedThis=a,this},toString:function(){var d=(this.expectedArguments||[]).slice();this.expectsExactArgCount||g.call(d,"[...]");var e=c.spyCall.toString.call({proxy:this.method||"anonymous mock expectation",args:d}),f=e.replace(", [...","[, ...")+" "+b(this);return this.met()?"Expectation met: "+f:"Expected "+f+" ("+a(this.callCount)+")"},verify:function(){return this.met()?c.expectation.pass(this.toString()):c.expectation.fail(this.toString()),!0},pass:function(a){c.assert.pass(a)},fail:function(a){var b=new Error(a);throw b.name="ExpectationError",b}}}(),c.mock=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):f&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50,"./match":55}],57:[function(a,b){"use strict";if("undefined"!=typeof b&&b.exports&&"function"==typeof a){var c=a("../sinon");c.extend(c,a("./util/fake_timers"))}!function(){function a(a,b,c,d){d&&(!b.injectInto||c in b.injectInto?e.call(a.args,d):(b.injectInto[c]=d,a.injectedKeys.push(c)))}function d(a){var b=c.create(c.sandbox);return a.useFakeServer&&("object"==typeof a.useFakeServer&&(b.serverPrototype=a.useFakeServer),b.useFakeServer()),a.useFakeTimers&&("object"==typeof a.useFakeTimers?b.useFakeTimers.apply(b,a.useFakeTimers):b.useFakeTimers()),b}var e=[].push;c.sandbox=c.extend(c.create(c.collection),{useFakeTimers:function(){return this.clock=c.useFakeTimers.apply(c,arguments),this.add(this.clock)},serverPrototype:c.fakeServer,useFakeServer:function(){var a=this.serverPrototype||c.fakeServer;return a&&a.create?(this.server=a.create(),this.add(this.server)):null},inject:function(a){return c.collection.inject.call(this,a),this.clock&&(a.clock=this.clock),this.server&&(a.server=this.server,a.requests=this.server.requests),a},restore:function(){c.collection.restore.apply(this,arguments),this.restoreContext()},restoreContext:function(){if(this.injectedKeys){for(var a=0,b=this.injectedKeys.length;b>a;a++)delete this.injectInto[this.injectedKeys[a]];this.injectedKeys=[]}},create:function(b){if(!b)return c.create(c.sandbox);var e=d(b);e.args=e.args||[],e.injectedKeys=[],e.injectInto=b.injectInto;var f,g,h=e.inject({});if(b.properties)for(var i=0,j=b.properties.length;j>i;i++)f=b.properties[i],g=h[f]||"sandbox"==f&&e,a(e,b,f,g);else a(e,b,"sandbox",g);return e}}),c.sandbox.useFakeXMLHttpRequest=c.sandbox.useFakeServer,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=c.sandbox}):"undefined"!=typeof b&&b.exports&&(b.exports=c.sandbox)}()},{"../sinon":50,"./util/fake_timers":62}],58:[function(require,module,exports){"use strict";!function(sinon){function spy(a,b){if(!b&&"function"==typeof a)return spy.create(a);if(!a&&!b)return spy.create(function(){});var c=a[b];return sinon.wrapMethod(a,b,spy.create(c))}function matchingFake(a,b,c){if(a)for(var d=0,e=a.length;e>d;d++)if(a[d].matches(b,c))return a[d]}function incrementCallCount(){this.called=!0,this.callCount+=1,this.notCalled=!1,this.calledOnce=1==this.callCount,this.calledTwice=2==this.callCount,this.calledThrice=3==this.callCount}function createCallProperties(){this.firstCall=this.getCall(0),this.secondCall=this.getCall(1),this.thirdCall=this.getCall(2),this.lastCall=this.getCall(this.callCount-1)}function createProxy(func){var p;return func.length?eval("p = (function proxy("+vars.substring(0,2*func.length-1)+") { return p.invoke(func, this, slice.call(arguments)); });"):p=function(){return p.invoke(func,this,slice.call(arguments))},p}function delegateToCalls(a,b,c,d){spyApi[a]=function(){if(!this.called)return d?d.apply(this,arguments):!1;for(var e,f=0,g=0,h=this.callCount;h>g;g+=1)if(e=this.getCall(g),e[c||a].apply(e,arguments)&&(f+=1,b))return!0;return f===this.callCount}}var commonJSModule="undefined"!=typeof module&&module.exports&&"function"==typeof require,push=Array.prototype.push,slice=Array.prototype.slice,callId=0;if(!sinon&&commonJSModule&&(sinon=require("../sinon")),sinon){var vars="a,b,c,d,e,f,g,h,i,j,k,l",uuid=0,spyApi={reset:function(){if(this.called=!1,this.notCalled=!0,this.calledOnce=!1,this.calledTwice=!1,this.calledThrice=!1,this.callCount=0,this.firstCall=null,this.secondCall=null,this.thirdCall=null,this.lastCall=null,this.args=[],this.returnValues=[],this.thisValues=[],this.exceptions=[],this.callIds=[],this.fakes)for(var a=0;a<this.fakes.length;a++)this.fakes[a].reset()},create:function(a){var b;"function"!=typeof a?a=function(){}:b=sinon.functionName(a);var c=createProxy(a);return sinon.extend(c,spy),delete c.create,sinon.extend(c,a),c.reset(),c.prototype=a.prototype,c.displayName=b||"spy",c.toString=sinon.functionToString,c._create=sinon.spy.create,c.id="spy#"+uuid++,c},invoke:function(a,b,c){var d,e,f=matchingFake(this.fakes,c);incrementCallCount.call(this),push.call(this.thisValues,b),push.call(this.args,c),push.call(this.callIds,callId++),createCallProperties.call(this);try{e=f?f.invoke(a,b,c):(this.func||a).apply(b,c);var g=this.getCall(this.callCount-1);g.calledWithNew()&&"object"!=typeof e&&(e=b)}catch(h){d=h}if(push.call(this.exceptions,d),push.call(this.returnValues,e),createCallProperties.call(this),void 0!==d)throw d;return e},named:function(a){return this.displayName=a,this},getCall:function(a){return 0>a||a>=this.callCount?null:sinon.spyCall(this,this.thisValues[a],this.args[a],this.returnValues[a],this.exceptions[a],this.callIds[a])},getCalls:function(){var a,b=[];for(a=0;a<this.callCount;a++)b.push(this.getCall(a));return b},calledBefore:function(a){return this.called?a.called?this.callIds[0]<a.callIds[a.callIds.length-1]:!0:!1},calledAfter:function(a){return this.called&&a.called?this.callIds[this.callCount-1]>a.callIds[a.callCount-1]:!1},withArgs:function(){var a=slice.call(arguments);if(this.fakes){var b=matchingFake(this.fakes,a,!0);if(b)return b}else this.fakes=[];var c=this,d=this._create();d.matchingAguments=a,d.parent=this,push.call(this.fakes,d),d.withArgs=function(){return c.withArgs.apply(c,arguments)};for(var e=0;e<this.args.length;e++)d.matches(this.args[e])&&(incrementCallCount.call(d),push.call(d.thisValues,this.thisValues[e]),push.call(d.args,this.args[e]),push.call(d.returnValues,this.returnValues[e]),push.call(d.exceptions,this.exceptions[e]),push.call(d.callIds,this.callIds[e]));return createCallProperties.call(d),d},matches:function(a,b){var c=this.matchingAguments;return c.length<=a.length&&sinon.deepEqual(c,a.slice(0,c.length))?!b||c.length==a.length:void 0},printf:function(a){var b,c=this,d=slice.call(arguments,1);return(a||"").replace(/%(.)/g,function(a,e){return b=spyApi.formatters[e],"function"==typeof b?b.call(null,c,d):isNaN(parseInt(e,10))?"%"+e:sinon.format(d[e-1])})}};delegateToCalls("calledOn",!0),delegateToCalls("alwaysCalledOn",!1,"calledOn"),delegateToCalls("calledWith",!0),delegateToCalls("calledWithMatch",!0),delegateToCalls("alwaysCalledWith",!1,"calledWith"),delegateToCalls("alwaysCalledWithMatch",!1,"calledWithMatch"),delegateToCalls("calledWithExactly",!0),delegateToCalls("alwaysCalledWithExactly",!1,"calledWithExactly"),delegateToCalls("neverCalledWith",!1,"notCalledWith",function(){return!0}),delegateToCalls("neverCalledWithMatch",!1,"notCalledWithMatch",function(){return!0}),delegateToCalls("threw",!0),delegateToCalls("alwaysThrew",!1,"threw"),delegateToCalls("returned",!0),delegateToCalls("alwaysReturned",!1,"returned"),delegateToCalls("calledWithNew",!0),delegateToCalls("alwaysCalledWithNew",!1,"calledWithNew"),delegateToCalls("callArg",!1,"callArgWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")}),spyApi.callArgWith=spyApi.callArg,delegateToCalls("callArgOn",!1,"callArgOnWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")}),spyApi.callArgOnWith=spyApi.callArgOn,delegateToCalls("yield",!1,"yield",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),spyApi.invokeCallback=spyApi.yield,delegateToCalls("yieldOn",!1,"yieldOn",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),delegateToCalls("yieldTo",!1,"yieldTo",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),delegateToCalls("yieldToOn",!1,"yieldToOn",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),spyApi.formatters={c:function(a){return sinon.timesInWords(a.callCount)},n:function(a){return a.toString()},C:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c){var e=" "+a.getCall(c).toString();/\n/.test(b[c-1])&&(e="\n"+e),push.call(b,e)}return b.length>0?"\n"+b.join("\n"):""},t:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c)push.call(b,sinon.format(a.thisValues[c]));return b.join(", ")},"*":function(a,b){for(var c=[],d=0,e=b.length;e>d;++d)push.call(c,sinon.format(b[d]));return c.join(", ")}},sinon.extend(spy,spyApi),spy.spyCall=sinon.spyCall,sinon.spy=spy,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=spy}):commonJSModule&&(module.exports=spy)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],59:[function(a,b){"use strict";!function(c){function d(a,b,e){if(e&&"function"!=typeof e)throw new TypeError("Custom stub should be function");var f;if(f=e?c.spy&&c.spy.create?c.spy.create(e):e:d.create(),!a&&"undefined"==typeof b)return c.stub.create();if("undefined"==typeof b&&"object"==typeof a){for(var g in a)"function"==typeof a[g]&&d(a,g);return a}return c.wrapMethod(a,b,f)}function e(a){return a.defaultBehavior||f(a)||c.behavior.create(a)}function f(a){return a.parent&&g(a.parent)}function g(a){var b=a.behaviors[a.callCount-1];return b&&b.isPresent()?b:e(a)}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i=0;c.extend(d,function(){var a={create:function(){var a=function(){return g(a).invoke(this,arguments)};a.id="stub#"+i++;var b=a;return a=c.spy.create(a),a.func=b,c.extend(a,d),a._create=c.stub.create,a.displayName="stub",a.toString=c.functionToString,a.defaultBehavior=null,a.behaviors=[],a},resetBehavior:function(){var a;if(this.defaultBehavior=null,this.behaviors=[],delete this.returnValue,delete this.returnArgAt,this.returnThis=!1,this.fakes)for(a=0;a<this.fakes.length;a++)this.fakes[a].resetBehavior()},onCall:function(a){return this.behaviors[a]||(this.behaviors[a]=c.behavior.create(this)),this.behaviors[a]},onFirstCall:function(){return this.onCall(0)},onSecondCall:function(){return this.onCall(1)},onThirdCall:function(){return this.onCall(2)}};for(var b in c.behavior)c.behavior.hasOwnProperty(b)&&!a.hasOwnProperty(b)&&"create"!=b&&"withArgs"!=b&&"invoke"!=b&&(a[b]=function(a){return function(){return this.defaultBehavior=this.defaultBehavior||c.behavior.create(this),this.defaultBehavior[a].apply(this.defaultBehavior,arguments),this}}(b));return a}()),c.stub=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):h&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],60:[function(a,b){"use strict";!function(c){function d(a){function b(){var b=c.getConfig(c.config);b.injectInto=b.injectIntoThis&&this||b.injectInto;var d,e,f=c.sandbox.create(b),g=Array.prototype.slice.call(arguments).concat(f.args);try{e=a.apply(this,g)}catch(h){d=h}if("undefined"!=typeof d)throw f.restore(),d;return f.verifyAndRestore(),e}var d=typeof a;if("function"!=d)throw new TypeError("sinon.test needs to wrap a test function, got "+d);return a.length?function(){return b.apply(this,arguments)}:b}var e="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&e&&(c=a("../sinon")),c&&(d.config={injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},c.test=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):e&&(b.exports=d))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],61:[function(a,b){"use strict";!function(c){function d(a,b,c){return function(){b&&b.apply(this,arguments);var d,e;try{e=a.apply(this,arguments)}catch(f){d=f}if(c&&c.apply(this,arguments),d)throw d;return e}}function e(a,b){if(!a||"object"!=typeof a)throw new TypeError("sinon.testCase needs an object with test functions");b=b||"test";var e,f,g,h=new RegExp("^"+b),i={},j=a.setUp,k=a.tearDown;for(e in a)if(a.hasOwnProperty(e)){if(f=a[e],/^(setUp|tearDown)$/.test(e))continue;"function"==typeof f&&h.test(e)?(g=f,(j||k)&&(g=d(f,j,k)),i[e]=c.test(g)):i[e]=a[e]}return i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&f&&(c=a("../sinon")),c&&Object.prototype.hasOwnProperty&&(c.testCase=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],62:[function(require,module,exports){(function(global){"use strict";if("undefined"==typeof sinon)var sinon={};!function(global){function addTimer(a,b){if(0===a.length)throw new Error("Function requires at least 1 parameter");if("undefined"==typeof a[0])throw new Error("Callback must be provided to timer calls");var c=id++,d=a[1]||0;return this.timeouts||(this.timeouts={}),this.timeouts[c]={id:c,func:a[0],callAt:this.now+d,invokeArgs:Array.prototype.slice.call(a,2)},b===!0&&(this.timeouts[c].interval=d),addTimerReturnsObject?{id:c,ref:function(){},unref:function(){}}:c}function parseTime(a){if(!a)return 0;var b,c=a.split(":"),d=c.length,e=d,f=0;if(d>3||!/^(\d\d:){0,2}\d\d?$/.test(a))throw new Error("tick only understands numbers and 'h:m:s'");for(;e--;){if(b=parseInt(c[e],10),b>=60)throw new Error("Invalid time "+a);f+=b*Math.pow(60,d-e-1)}return 1e3*f}function createObject(a){var b;if(Object.create)b=Object.create(a);else{var c=function(){};c.prototype=a,b=new c}return b.Date.clock=b,b}function mirrorDateProperties(a,b){b.now?a.now=function(){return a.clock.now}:delete a.now,b.toSource?a.toSource=function(){return b.toSource()}:delete a.toSource,a.toString=function(){return b.toString()},a.prototype=b.prototype,a.parse=b.parse,a.UTC=b.UTC,a.prototype.toUTCString=b.prototype.toUTCString;for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function restore(){for(var a,b=0,c=this.methods.length;c>b;b++)if(a=this.methods[b],global[a].hadOwnProperty)global[a]=this["_"+a];else try{delete global[a]}catch(d){}this.methods=[]}function stubGlobal(a,b){if(b[a].hadOwnProperty=Object.prototype.hasOwnProperty.call(global,a),b["_"+a]=global[a],"Date"==a){var c=mirrorDateProperties(b[a],global[a]);global[a]=c}else{global[a]=function(){return b[a].apply(b,arguments)};for(var d in b[a])b[a].hasOwnProperty(d)&&(global[a][d]=b[a][d])}global[a].clock=b}var timeoutResult=setTimeout(function(){},0),addTimerReturnsObject="object"==typeof timeoutResult;clearTimeout(timeoutResult);var id=1;sinon.clock={now:0,create:function(a){var b=createObject(this);if("number"==typeof a&&(b.now=a),a&&"object"==typeof a)throw new TypeError("now should be milliseconds since UNIX epoch");return b},setTimeout:function(){return addTimer.call(this,arguments,!1)},clearTimeout:function(a){a&&(this.timeouts||(this.timeouts=[]),"object"==typeof a&&(a=a.id),a in this.timeouts&&delete this.timeouts[a])},setInterval:function(){return addTimer.call(this,arguments,!0)},clearInterval:function(a){this.clearTimeout(a)},setImmediate:function(a){var b=Array.prototype.slice.call(arguments,1);return addTimer.call(this,[a,0].concat(b),!1)},clearImmediate:function(a){this.clearTimeout(a)},tick:function(a){a="number"==typeof a?a:parseTime(a);for(var b,c=this.now,d=this.now+a,e=this.now,f=this.firstTimerInRange(c,d);f&&d>=c;){if(this.timeouts[f.id]){c=this.now=f.callAt;try{this.callTimer(f)}catch(g){b=b||g}}f=this.firstTimerInRange(e,d),e=c}if(this.now=d,b)throw b;return this.now},firstTimerInRange:function(a,b){var c,d,e=null;for(var f in this.timeouts)if(this.timeouts.hasOwnProperty(f)){if(this.timeouts[f].callAt<a||this.timeouts[f].callAt>b)continue;(null===e||this.timeouts[f].callAt<e)&&(d=this.timeouts[f],e=this.timeouts[f].callAt,c={func:this.timeouts[f].func,callAt:this.timeouts[f].callAt,interval:this.timeouts[f].interval,id:this.timeouts[f].id,invokeArgs:this.timeouts[f].invokeArgs})}return c||null},callTimer:function(timer){"number"==typeof timer.interval?this.timeouts[timer.id].callAt+=timer.interval:delete this.timeouts[timer.id];try{"function"==typeof timer.func?timer.func.apply(null,timer.invokeArgs):eval(timer.func)}catch(e){var exception=e}if(this.timeouts[timer.id]){if(exception)throw exception}else if(exception)throw exception},reset:function(){this.timeouts={}},Date:function(){function a(c,d,e,f,g,h,i){switch(arguments.length){case 0:return new b(a.clock.now);case 1:return new b(c);case 2:return new b(c,d);case 3:return new b(c,d,e);case 4:return new b(c,d,e,f);case 5:return new b(c,d,e,f,g);case 6:return new b(c,d,e,f,g,h);default:return new b(c,d,e,f,g,h,i)}}var b=Date;return mirrorDateProperties(a,b)}()};var methods=["Date","setTimeout","setInterval","clearTimeout","clearInterval"];"undefined"!=typeof global.setImmediate&&methods.push("setImmediate"),"undefined"!=typeof global.clearImmediate&&methods.push("clearImmediate"),sinon.useFakeTimers=function(a){var b=sinon.clock.create(a);b.restore=restore,b.methods=Array.prototype.slice.call(arguments,"number"==typeof a?1:0),0===b.methods.length&&(b.methods=methods);for(var c=0,d=b.methods.length;d>c;c++)stubGlobal(b.methods[c],b);return b}}("undefined"!=typeof global&&"function"!=typeof global?global:this),sinon.timers={setTimeout:setTimeout,clearTimeout:clearTimeout,setImmediate:"undefined"!=typeof setImmediate?setImmediate:void 0,clearImmediate:"undefined"!=typeof clearImmediate?clearImmediate:void 0,setInterval:setInterval,clearInterval:clearInterval,Date:Date},"undefined"!=typeof module&&module.exports&&(module.exports=sinon)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],63:[function(a,b){(function(c){("function"==typeof define&&define.amd&&function(a){define("formatio",["samsam"],a)}||"object"==typeof b&&function(c){b.exports=c(a("samsam"))}||function(a){this.formatio=a(this.samsam)})(function(a){"use strict";function b(a){if(!a)return"";if(a.displayName)return a.displayName;if(a.name)return a.name;var b=a.toString().match(/function\s+([^\(]+)/m);return b&&b[1]||""}function d(a,c){var d,e,f=b(c&&c.constructor),g=a.excludeConstructors||h.excludeConstructors||[];for(d=0,e=g.length;e>d;++d){if("string"==typeof g[d]&&g[d]===f)return"";if(g[d].test&&g[d].test(f))return""}return f}function e(a,b){if("object"!=typeof a)return!1;var c,d;for(c=0,d=b.length;d>c;++c)if(b[c]===a)return!0;return!1}function f(b,c,d,g){if("string"==typeof c){var h=b.quoteStrings,j="boolean"!=typeof h||h;return d||j?'"'+c+'"':c}if("function"==typeof c&&!(c instanceof RegExp))return f.func(c);if(d=d||[],e(c,d))return"[Circular]";if("[object Array]"===Object.prototype.toString.call(c))return f.array.call(b,c,d);if(!c)return String(1/c===-1/0?"-0":c);if(a.isElement(c))return f.element(c);if("function"==typeof c.toString&&c.toString!==Object.prototype.toString)return c.toString();var k,l;for(k=0,l=i.length;l>k;k++)if(c===i[k].object)return i[k].value;return f.object.call(b,c,d,g)}function g(a){for(var b in a)this[b]=a[b]}var h={excludeConstructors:["Object",/^.$/],quoteStrings:!0},i=(Object.prototype.hasOwnProperty,[]);return"undefined"!=typeof c&&i.push({object:c,value:"[object global]"}),"undefined"!=typeof document&&i.push({object:document,value:"[object HTMLDocument]"}),"undefined"!=typeof window&&i.push({object:window,value:"[object Window]"}),f.func=function(a){return"function "+b(a)+"() {}"},f.array=function(a,b){b=b||[],b.push(a);var c,d,e=[];for(c=0,d=a.length;d>c;++c)e.push(f(this,a[c],b));return"["+e.join(", ")+"]"},f.object=function(b,c,g){c=c||[],c.push(b),g=g||0;
|
||
var h,i,j,k,l,m=[],n=a.keys(b).sort(),o=3;for(k=0,l=n.length;l>k;++k)h=n[k],j=b[h],i=e(j,c)?"[Circular]":f(this,j,c,g+2),i=(/\s/.test(h)?'"'+h+'"':h)+": "+i,o+=i.length,m.push(i);var p=d(this,b),q=p?"["+p+"] ":"",r="";for(k=0,l=g;l>k;++k)r+=" ";return o+g>80?q+"{\n "+r+m.join(",\n "+r)+"\n"+r+"}":q+"{ "+m.join(", ")+" }"},f.element=function(a){var b,c,d,e,f,g=a.tagName.toLowerCase(),h=a.attributes,i=[];for(d=0,e=h.length;e>d;++d)b=h.item(d),c=b.nodeName.toLowerCase().replace("html:",""),f=b.nodeValue,("contenteditable"!==c||"inherit"!==f)&&f&&i.push(c+'="'+f+'"');var j="<"+g+(i.length>0?" ":""),k=a.innerHTML;k.length>20&&(k=k.substr(0,20)+"[...]");var l=j+i.join(" ")+">"+k+"</"+g+">";return l.replace(/ contentEditable="inherit"/,"")},g.prototype={functionName:b,configure:function(a){return new g(a)},constructorName:function(a){return d(this,a)},ascii:function(a,b,c){return f(this,a,b,c)}},g.prototype})}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{samsam:64}],64:[function(a,b){("function"==typeof define&&define.amd&&function(a){define("samsam",a)}||"object"==typeof b&&function(a){b.exports=a()}||function(a){this.samsam=a()})(function(){function a(a){var b=a;return"number"==typeof a&&a!==b}function b(a){return l.toString.call(a).split(/[ \]]/)[1]}function c(a){if("Arguments"===b(a))return!0;if("object"!=typeof a||"number"!=typeof a.length||"Array"===b(a))return!1;if("function"==typeof a.callee)return!0;try{a[a.length]=6,delete a[a.length]}catch(c){return!0}return!1}function d(a){if(!a||1!==a.nodeType||!m)return!1;try{a.appendChild(m),a.removeChild(m)}catch(b){return!1}return!0}function e(a){var b,c=[];for(b in a)l.hasOwnProperty.call(a,b)&&c.push(b);return c}function f(a){return"function"==typeof a.getTime&&a.getTime()==a.valueOf()}function g(a){return 0===a&&1/a===-1/0}function h(b,c){return b===c||a(b)&&a(c)?0!==b||g(b)===g(c):void 0}function i(g,i){function j(a){return"object"!=typeof a||null===a||a instanceof Boolean||a instanceof Date||a instanceof Number||a instanceof RegExp||a instanceof String?!1:!0}function k(a,b){var c;for(c=0;c<a.length;c++)if(a[c]===b)return c;return-1}var m=[],n=[],o=[],p=[],q={};return function r(g,i,s,t){var u=typeof g,v=typeof i;if(g===i||a(g)||a(i)||null==g||null==i||"object"!==u||"object"!==v)return h(g,i);if(d(g)||d(i))return!1;var w=f(g),x=f(i);if(!(!w&&!x||w&&x&&g.getTime()===i.getTime()))return!1;if(g instanceof RegExp&&i instanceof RegExp&&g.toString()!==i.toString())return!1;var y=b(g),z=b(i),A=e(g),B=e(i);if(c(g)||c(i)){if(g.length!==i.length)return!1}else if(u!==v||y!==z||A.length!==B.length)return!1;var C,D,E,F,G,H,I,J,K,L,M;for(D=0,E=A.length;E>D;D++){if(C=A[D],!l.hasOwnProperty.call(i,C))return!1;if(F=g[C],G=i[C],H=j(F),I=j(G),J=H?k(m,F):-1,K=I?k(n,G):-1,L=-1!==J?o[J]:s+"["+JSON.stringify(C)+"]",M=-1!==K?p[K]:t+"["+JSON.stringify(C)+"]",q[L+M])return!0;if(-1===J&&H&&(m.push(F),o.push(L)),-1===K&&I&&(n.push(G),p.push(M)),H&&I&&(q[L+M]=!0),!r(F,G,L,M))return!1}return!0}(g,i,"$1","$2")}function j(a,b){if(0===b.length)return!0;var c,d,e,f;for(c=0,d=a.length;d>c;++c)if(k(a[c],b[0])){for(e=0,f=b.length;f>e;++e)if(!k(a[c+e],b[e]))return!1;return!0}return!1}var k,l=Object.prototype,m="undefined"!=typeof document&&document.createElement("div");return k=function n(a,c){if(c&&"function"==typeof c.test)return c.test(a);if("function"==typeof c)return c(a)===!0;if("string"==typeof c){c=c.toLowerCase();var d="string"==typeof a||!!a;return d&&String(a).toLowerCase().indexOf(c)>=0}if("number"==typeof c)return c===a;if("boolean"==typeof c)return c===a;if("Array"===b(a)&&"Array"===b(c))return j(a,c);if(c&&"object"==typeof c){var e;for(e in c){var f=a[e];if("undefined"==typeof f&&"function"==typeof a.getAttribute&&(f=a.getAttribute(e)),"undefined"==typeof f||!n(f,c[e]))return!1}return!0}throw new Error("Matcher was not a string, a number, a function, a boolean or an object")},{isArguments:c,isElement:d,isDate:f,isNegZero:g,identical:h,deepEqual:i,match:k,keys:e}})},{}],65:[function(a,b,c){(function(){var a=this,d=a._,e={},f=Array.prototype,g=Object.prototype,h=Function.prototype,i=f.push,j=f.slice,k=f.concat,l=g.toString,m=g.hasOwnProperty,n=f.forEach,o=f.map,p=f.reduce,q=f.reduceRight,r=f.filter,s=f.every,t=f.some,u=f.indexOf,v=f.lastIndexOf,w=Array.isArray,x=Object.keys,y=h.bind,z=function(a){return a instanceof z?a:this instanceof z?void(this._wrapped=a):new z(a)};"undefined"!=typeof c?("undefined"!=typeof b&&b.exports&&(c=b.exports=z),c._=z):a._=z,z.VERSION="1.6.0";var A=z.each=z.forEach=function(a,b,c){if(null==a)return a;if(n&&a.forEach===n)a.forEach(b,c);else if(a.length===+a.length){for(var d=0,f=a.length;f>d;d++)if(b.call(c,a[d],d,a)===e)return}else for(var g=z.keys(a),d=0,f=g.length;f>d;d++)if(b.call(c,a[g[d]],g[d],a)===e)return;return a};z.map=z.collect=function(a,b,c){var d=[];return null==a?d:o&&a.map===o?a.map(b,c):(A(a,function(a,e,f){d.push(b.call(c,a,e,f))}),d)};var B="Reduce of empty array with no initial value";z.reduce=z.foldl=z.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),p&&a.reduce===p)return d&&(b=z.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(A(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(B);return c},z.reduceRight=z.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),q&&a.reduceRight===q)return d&&(b=z.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=z.keys(a);f=g.length}if(A(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(B);return c},z.find=z.detect=function(a,b,c){var d;return C(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},z.filter=z.select=function(a,b,c){var d=[];return null==a?d:r&&a.filter===r?a.filter(b,c):(A(a,function(a,e,f){b.call(c,a,e,f)&&d.push(a)}),d)},z.reject=function(a,b,c){return z.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},z.every=z.all=function(a,b,c){b||(b=z.identity);var d=!0;return null==a?d:s&&a.every===s?a.every(b,c):(A(a,function(a,f,g){return(d=d&&b.call(c,a,f,g))?void 0:e}),!!d)};var C=z.some=z.any=function(a,b,c){b||(b=z.identity);var d=!1;return null==a?d:t&&a.some===t?a.some(b,c):(A(a,function(a,f,g){return d||(d=b.call(c,a,f,g))?e:void 0}),!!d)};z.contains=z.include=function(a,b){return null==a?!1:u&&a.indexOf===u?-1!=a.indexOf(b):C(a,function(a){return a===b})},z.invoke=function(a,b){var c=j.call(arguments,2),d=z.isFunction(b);return z.map(a,function(a){return(d?b:a[b]).apply(a,c)})},z.pluck=function(a,b){return z.map(a,z.property(b))},z.where=function(a,b){return z.filter(a,z.matches(b))},z.findWhere=function(a,b){return z.find(a,z.matches(b))},z.max=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);var d=-1/0,e=-1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;h>e&&(d=a,e=h)}),d},z.min=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);var d=1/0,e=1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;e>h&&(d=a,e=h)}),d},z.shuffle=function(a){var b,c=0,d=[];return A(a,function(a){b=z.random(c++),d[c-1]=d[b],d[b]=a}),d},z.sample=function(a,b,c){return null==b||c?(a.length!==+a.length&&(a=z.values(a)),a[z.random(a.length-1)]):z.shuffle(a).slice(0,Math.max(0,b))};var D=function(a){return null==a?z.identity:z.isFunction(a)?a:z.property(a)};z.sortBy=function(a,b,c){return b=D(b),z.pluck(z.map(a,function(a,d,e){return{value:a,index:d,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index-b.index}),"value")};var E=function(a){return function(b,c,d){var e={};return c=D(c),A(b,function(f,g){var h=c.call(d,f,g,b);a(e,h,f)}),e}};z.groupBy=E(function(a,b,c){z.has(a,b)?a[b].push(c):a[b]=[c]}),z.indexBy=E(function(a,b,c){a[b]=c}),z.countBy=E(function(a,b){z.has(a,b)?a[b]++:a[b]=1}),z.sortedIndex=function(a,b,c,d){c=D(c);for(var e=c.call(d,b),f=0,g=a.length;g>f;){var h=f+g>>>1;c.call(d,a[h])<e?f=h+1:g=h}return f},z.toArray=function(a){return a?z.isArray(a)?j.call(a):a.length===+a.length?z.map(a,z.identity):z.values(a):[]},z.size=function(a){return null==a?0:a.length===+a.length?a.length:z.keys(a).length},z.first=z.head=z.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:0>b?[]:j.call(a,0,b)},z.initial=function(a,b,c){return j.call(a,0,a.length-(null==b||c?1:b))},z.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:j.call(a,Math.max(a.length-b,0))},z.rest=z.tail=z.drop=function(a,b,c){return j.call(a,null==b||c?1:b)},z.compact=function(a){return z.filter(a,z.identity)};var F=function(a,b,c){return b&&z.every(a,z.isArray)?k.apply(c,a):(A(a,function(a){z.isArray(a)||z.isArguments(a)?b?i.apply(c,a):F(a,b,c):c.push(a)}),c)};z.flatten=function(a,b){return F(a,b,[])},z.without=function(a){return z.difference(a,j.call(arguments,1))},z.partition=function(a,b){var c=[],d=[];return A(a,function(a){(b(a)?c:d).push(a)}),[c,d]},z.uniq=z.unique=function(a,b,c,d){z.isFunction(b)&&(d=c,c=b,b=!1);var e=c?z.map(a,c,d):a,f=[],g=[];return A(e,function(c,d){(b?d&&g[g.length-1]===c:z.contains(g,c))||(g.push(c),f.push(a[d]))}),f},z.union=function(){return z.uniq(z.flatten(arguments,!0))},z.intersection=function(a){var b=j.call(arguments,1);return z.filter(z.uniq(a),function(a){return z.every(b,function(b){return z.contains(b,a)})})},z.difference=function(a){var b=k.apply(f,j.call(arguments,1));return z.filter(a,function(a){return!z.contains(b,a)})},z.zip=function(){for(var a=z.max(z.pluck(arguments,"length").concat(0)),b=new Array(a),c=0;a>c;c++)b[c]=z.pluck(arguments,""+c);return b},z.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},z.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=z.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(u&&a.indexOf===u)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},z.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(v&&a.lastIndexOf===v)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},z.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);d>e;)f[e++]=a,a+=c;return f};var G=function(){};z.bind=function(a,b){var c,d;if(y&&a.bind===y)return y.apply(a,j.call(arguments,1));if(!z.isFunction(a))throw new TypeError;return c=j.call(arguments,2),d=function(){if(!(this instanceof d))return a.apply(b,c.concat(j.call(arguments)));G.prototype=a.prototype;var e=new G;G.prototype=null;var f=a.apply(e,c.concat(j.call(arguments)));return Object(f)===f?f:e}},z.partial=function(a){var b=j.call(arguments,1);return function(){for(var c=0,d=b.slice(),e=0,f=d.length;f>e;e++)d[e]===z&&(d[e]=arguments[c++]);for(;c<arguments.length;)d.push(arguments[c++]);return a.apply(this,d)}},z.bindAll=function(a){var b=j.call(arguments,1);if(0===b.length)throw new Error("bindAll must be passed function names");return A(b,function(b){a[b]=z.bind(a[b],a)}),a},z.memoize=function(a,b){var c={};return b||(b=z.identity),function(){var d=b.apply(this,arguments);return z.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},z.delay=function(a,b){var c=j.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},z.defer=function(a){return z.delay.apply(z,[a,1].concat(j.call(arguments,1)))},z.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:z.now(),g=null,f=a.apply(d,e),d=e=null};return function(){var j=z.now();h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k?(clearTimeout(g),g=null,h=j,f=a.apply(d,e),d=e=null):g||c.trailing===!1||(g=setTimeout(i,k)),f}},z.debounce=function(a,b,c){var d,e,f,g,h,i=function(){var j=z.now()-g;b>j?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),f=e=null))};return function(){f=this,e=arguments,g=z.now();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}},z.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},z.wrap=function(a,b){return z.partial(b,a)},z.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},z.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},z.keys=function(a){if(!z.isObject(a))return[];if(x)return x(a);var b=[];for(var c in a)z.has(a,c)&&b.push(c);return b},z.values=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},z.pairs=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},z.invert=function(a){for(var b={},c=z.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},z.functions=z.methods=function(a){var b=[];for(var c in a)z.isFunction(a[c])&&b.push(c);return b.sort()},z.extend=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},z.pick=function(a){var b={},c=k.apply(f,j.call(arguments,1));return A(c,function(c){c in a&&(b[c]=a[c])}),b},z.omit=function(a){var b={},c=k.apply(f,j.call(arguments,1));for(var d in a)z.contains(c,d)||(b[d]=a[d]);return b},z.defaults=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)void 0===a[c]&&(a[c]=b[c])}),a},z.clone=function(a){return z.isObject(a)?z.isArray(a)?a.slice():z.extend({},a):a},z.tap=function(a,b){return b(a),a};var H=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof z&&(a=a._wrapped),b instanceof z&&(b=b._wrapped);var e=l.call(a);if(e!=l.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;var g=a.constructor,h=b.constructor;if(g!==h&&!(z.isFunction(g)&&g instanceof g&&z.isFunction(h)&&h instanceof h)&&"constructor"in a&&"constructor"in b)return!1;c.push(a),d.push(b);var i=0,j=!0;if("[object Array]"==e){if(i=a.length,j=i==b.length)for(;i--&&(j=H(a[i],b[i],c,d)););}else{for(var k in a)if(z.has(a,k)&&(i++,!(j=z.has(b,k)&&H(a[k],b[k],c,d))))break;if(j){for(k in b)if(z.has(b,k)&&!i--)break;j=!i}}return c.pop(),d.pop(),j};z.isEqual=function(a,b){return H(a,b,[],[])},z.isEmpty=function(a){if(null==a)return!0;if(z.isArray(a)||z.isString(a))return 0===a.length;for(var b in a)if(z.has(a,b))return!1;return!0},z.isElement=function(a){return!(!a||1!==a.nodeType)},z.isArray=w||function(a){return"[object Array]"==l.call(a)},z.isObject=function(a){return a===Object(a)},A(["Arguments","Function","String","Number","Date","RegExp"],function(a){z["is"+a]=function(b){return l.call(b)=="[object "+a+"]"}}),z.isArguments(arguments)||(z.isArguments=function(a){return!(!a||!z.has(a,"callee"))}),"function"!=typeof/./&&(z.isFunction=function(a){return"function"==typeof a}),z.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},z.isNaN=function(a){return z.isNumber(a)&&a!=+a},z.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==l.call(a)},z.isNull=function(a){return null===a},z.isUndefined=function(a){return void 0===a},z.has=function(a,b){return m.call(a,b)},z.noConflict=function(){return a._=d,this},z.identity=function(a){return a},z.constant=function(a){return function(){return a}},z.property=function(a){return function(b){return b[a]}},z.matches=function(a){return function(b){if(b===a)return!0;for(var c in a)if(a[c]!==b[c])return!1;return!0}},z.times=function(a,b,c){for(var d=Array(Math.max(0,a)),e=0;a>e;e++)d[e]=b.call(c,e);return d},z.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))},z.now=Date.now||function(){return(new Date).getTime()};var I={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};I.unescape=z.invert(I.escape);var J={escape:new RegExp("["+z.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+z.keys(I.unescape).join("|")+")","g")};z.each(["escape","unescape"],function(a){z[a]=function(b){return null==b?"":(""+b).replace(J[a],function(b){return I[a][b]})}}),z.result=function(a,b){if(null==a)return void 0;var c=a[b];return z.isFunction(c)?c.call(a):c},z.mixin=function(a){A(z.functions(a),function(b){var c=z[b]=a[b];z.prototype[b]=function(){var a=[this._wrapped];return i.apply(a,arguments),O.call(this,c.apply(z,a))}})};var K=0;z.uniqueId=function(a){var b=++K+"";return a?a+b:b},z.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var L=/(.)^/,M={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},N=/\\|'|\r|\n|\t|\u2028|\u2029/g;z.template=function(a,b,c){var d;c=z.defaults({},c,z.templateSettings);var e=new RegExp([(c.escape||L).source,(c.interpolate||L).source,(c.evaluate||L).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(N,function(a){return"\\"+M[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=new Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,z);var i=function(a){return d.call(this,a,z)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},z.chain=function(a){return z(a).chain()};var O=function(a){return this._chain?z(a).chain():a};z.mixin(z),A(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=f[a];z.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],O.call(this,c)}}),A(["concat","join","slice"],function(a){var b=f[a];z.prototype[a]=function(){return O.call(this,b.apply(this._wrapped,arguments))}}),z.extend(z.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return z})}).call(this)},{}],66:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:10,sinon:50,"sinon-chai":49,underscore:65}],67:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/TextYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/TextYatta.coffee":4,chai:10,sinon:50,"sinon-chai":49,underscore:65}],68:[function(a){var b,c,d,e,f,g,h,i,j,k=function(a,b){return function(){return a.apply(b,arguments)}};e=a("chai"),f=e.expect,g=e.should(),h=a("sinon"),i=a("sinon-chai"),j=a("underscore"),e.use(i),d=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee"),c=function(){function a(){this.applyRandomOp=k(this.applyRandomOp,this),this.generateRandomOp=k(this.generateRandomOp,this),this.generateDeleteOp=k(this.generateDeleteOp,this),this.generateReplaceOp=k(this.generateReplaceOp,this),this.generateInsertOp=k(this.generateInsertOp,this),this.number_of_test_cases_multiplier=1,this.repeat_this=1*this.number_of_test_cases_multiplier,this.doSomething_amount=5e3*this.number_of_test_cases_multiplier,this.number_of_engines=10+this.number_of_test_cases_multiplier-1,this.time=0,this.ops=0,this.time_now=0,this.reinitialize()}return a.prototype.reinitialize=function(){var a,c,e,f;for(this.users=[],this.Connector=b(this.users),this.users.push(new d(0,this.Connector)),this.users[0].val("name","initial"),f=[],a=c=1,e=this.number_of_engines;e>=1?e>c:c>e;a=e>=1?++c:--c)f.push(this.users.push(new d(a,this.Connector)));return f},a.prototype.getSomeUser=function(){var a;return a=j.random(0,this.users.length-1),this.users[a]},a.prototype.getRandomText=function(){var a,b,c,d;return a="abcdefghijklmnopqrstuvwxyz",b=j.random(0,10),c=a[j.random(0,a.length-1)],d="",j(b).times(function(){return d+=c}),d},a.prototype.generateInsertOp=function(a){var b;return b=j.random(0,this.users[a].val("name").val().length-1),this.users[a].val("name").insertText(b,this.getRandomText()),null},a.prototype.generateReplaceOp=function(a){return this.users[a].val("name").replaceText(this.getRandomText()),null},a.prototype.generateDeleteOp=function(a){var b,c,d;return void(this.users[a].val("name").val().length>0&&(d=j.random(0,this.users[a].val("name").val().length-1),b=1,c=this.users[a].val("name").deleteText(d,b)))},a.prototype.generateRandomOp=function(a){var b,c,d;return d=[this.generateDeleteOp,this.generateInsertOp,this.generateReplaceOp],b=j.random(d.length-1),c=d[b](a)},a.prototype.applyRandomOp=function(a){var b;return b=this.users[a],b.getConnector().flushOneRandom()},a.prototype.doSomething=function(){var a,b,c;return c=j.random(this.number_of_engines-1),b=[this.applyRandomOp,this.generateRandomOp],a=j.random(b.length-1),b[a](c)},a.prototype.flushAll=function(){var a,b,c,d,e,f;for(e=this.users,f=[],b=c=0,d=e.length;d>c;b=++c)a=e[b],f.push(a.getConnector().flushAll());return f},a.prototype.compareAll=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;for(this.flushAll(),this.time+=(new Date).getTime()-this.time_now,d=0,b=i=0,m=this.users.length;m>=0?m>i:i>m;b=m>=0?++i:--i)d+=this.users[b].getConnector().getOpsInExecutionOrder().length;for(this.ops+=d*this.users.length,f=Math.floor(this.ops/this.time),null!=a&&console.log(""+a+"/"+this.repeat_this+": Every collaborator ("+this.users.length+") applied "+this.number_of_created_operations+" ops in a different order."+(" Over all we consumed "+this.ops+" operations in "+this.time/1e3+" seconds ("+f+" ops/msek).")),o=[],b=j=0,n=this.users.length-1;n>=0?n>j:j>n;b=n>=0?++j:--j)if(this.users[b].val("name").val()!==this.users[b+1].val("name").val()){for(g=function(a,b){var c,d,e,f,g,h,i,j;for(e=this.users[a].getConnector().getOpsInExecutionOrder(),g=0,i=e.length;i>g;g++)f=e[g],console.log(JSON.stringify(f));for(console.log(""),f="ops = [",c=h=0,j=e.length;j>h;c=++h)d=e[c],0!==c&&(f+=", "),f+="op"+c;return f+="]",console.log(f),console.log("@users[@last_user].ot.applyOps ops"),console.log("expect(@users[@last_user].ot.val('name')).to.equal(\""+users[b].val("name")+'")'),e},console.log(""),console.log("Found an OT Puzzle!"),console.log("OT states:"),c=k=0,l=users.length;l>k;c=++k)h=users[c],console.log("OT"+c+": "+h.val("name"));console.log("\nOT execution order ("+b+","+(b+1)+"):"),g(b,b+1),console.log(""),e=g(b+1,b),o.push(console.log(""))}else o.push(void 0);return o},a.prototype.run=function(){var a,b,c,d,e,f,g;for(console.log(""),g=[],b=c=1,e=this.repeat_this;e>=1?e>=c:c>=e;b=e>=1?++c:--c){for(this.time_now=(new Date).getTime(),a=d=1,f=this.doSomething_amount;f>=1?f>=d:d>=f;a=f>=1?++d:--d)this.doSomething();this.compareAll(b),g.push(this.reinitialize())}return g},a}(),describe("JsonYatta",function(){return beforeEach(function(a){return this.yTest=new c,a()}),it("has a JsonWrapper",function(){var a,b;return b=this.yTest.getSomeUser().root_element,b.val("x","dtrn","immutable"),b.val("set",{x:"x"},"immutable"),a=b.value,a.x,a.set={y:""},a.x,a.set,a.set.x,f(a.x).to.equal("dtrn"),f(a.set.x).to.equal("x")}),it("can handle creaton of complex json",function(){return this.yTest.getSomeUser().val("x",{a:"b"}),this.yTest.getSomeUser().val("a",{a:{q:"dtrndtrtdrntdrnrtdnrtdnrtdnrtdnrdnrdt"}}),this.yTest.getSomeUser().val("b",{a:{}}),this.yTest.getSomeUser().val("c",{a:"c"}),this.yTest.getSomeUser().val("c",{a:"b"}),this.yTest.compareAll(),this.yTest.getSomeUser().value.a.a.q.insertText(0,"AAA"),this.yTest.compareAll(),f(this.yTest.getSomeUser().value.a.a.q.val()).to.equal("AAAdtrndtrtdrntdrnrtdnrtdnrtdnrtdnrdnrdt")}),it("handles some immutable tests",function(){return this.yTest.getSomeUser().val("string","text","immutable"),this.yTest.getSomeUser().val("number",4,"immutable"),this.yTest.getSomeUser().val("object",{q:"rr"},"immutable"),this.yTest.compareAll(),f(this.yTest.getSomeUser().val("string")).to.equal("text"),f(this.yTest.getSomeUser().val("number")).to.equal(4),f(this.yTest.getSomeUser().val("object").val("q")).to.equal("rr")}),it("can handle many engines, many operations, concurrently (random)",function(){return this.yTest.run()})})},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:10,sinon:50,"sinon-chai":49,underscore:65}]},{},[66,67,68]),!function e(a,b,c){function d(g,h){if(!b[g]){if(!a[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=b[g]={exports:{}};a[g][0].call(j.exports,function(b){var c=a[g][1][b];return d(c?c:b)},j,j.exports,e,a,b,c)}return b[g].exports}for(var f="function"==typeof require&&require,g=0;g<c.length;g++)d(c[g]);return d}({1:[function(a,b){var c;c=a("underscore"),b.exports=function(a){var b;return b=function(){function b(b,c,d){var e,f;this.engine=b,this.HB=c,this.execution_listener=d,f=function(a){return function(b){return a.send(b)}}(this),this.execution_listener.push(f),this.applied_operations=[],e=function(a){return function(b){return a.applied_operations.push(b)}}(this),this.execution_listener.push(e),0!==(null!=a?a.length:void 0)&&this.engine.applyOps(a[0].getHistoryBuffer()._encode()),this.unexecuted={}}return b.prototype.getOpsInExecutionOrder=function(){return this.applied_operations},b.prototype.getRootElement=function(){return a.length>0?a[0].getRootElement().getUid():void 0},b.prototype.send=function(b){var c,d,e,f;if(b.uid.creator===this.HB.getUserId()&&"string"!=typeof b.uid.op_number){for(f=[],d=0,e=a.length;e>d;d++)c=a[d],f.push(c.getUserId()!==this.HB.getUserId()?c.getConnector().receive(b):void 0);return f}},b.prototype.receive=function(a){var b,c;return null==(b=this.unexecuted)[c=a.creator]&&(b[c]=[]),this.unexecuted[a.creator].push(a)},b.prototype.flushOne=function(a){var b;return(null!=(b=this.unexecuted[a])?b.length:void 0)>0?this.engine.applyOp(this.unexecuted[a].shift()):void 0},b.prototype.flushOneRandom=function(){return this.flushOne(c.random(0,a.length-1))},b.prototype.flushAll=function(){var a,b,c;c=this.unexecuted;for(a in c)b=c[a],this.engine.applyOps(b);return this.unexecuted={}},b.prototype.sync=function(){throw new Error("Can't use this a.t.m.")},b}()}},{underscore:65}],2:[function(a,b){var c;c=function(){function a(a,b){this.HB=a,this.parser=b,this.unprocessed_ops=[]}return a.prototype.parseOperation=function(a){var b;if(b=this.parser[a.type],null!=b)return b(a);throw new Error("You forgot to specify a parser for type "+a.type+". The message is "+JSON.stringify(a)+".")},a.prototype.applyOps=function(a){var b,c,d,e,f,g,h,i;for(c=[],d=0,g=a.length;g>d;d++)b=a[d],c.push(this.parseOperation(b));for(e=0,h=c.length;h>e;e++)b=c[e],this.HB.addOperation(b);for(f=0,i=c.length;i>f;f++)b=c[f],b.execute()||this.unprocessed_ops.push(b);return this.tryUnprocessed()},a.prototype.applyOp=function(a){var b;return b=this.parseOperation(a),this.HB.addOperation(b),b.execute()||this.unprocessed_ops.push(b),this.tryUnprocessed()},a.prototype.tryUnprocessed=function(){var a,b,c,d,e,f,g;for(g=[];;){for(a=this.unprocessed_ops.length,c=[],f=this.unprocessed_ops,d=0,e=f.length;e>d;d++)b=f[d],b.execute()||c.push(b);if(this.unprocessed_ops=c,this.unprocessed_ops.length===a)break;g.push(void 0)}return g},a}(),b.exports=c},{}],3:[function(a,b){var c,d,e,f;f=a("../Types/JsonTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),g=f(this.HB),this.engine=new c(this.HB,g.parser),this.connector=new b(this.engine,this.HB,g.execution_listener,this),h=this.connector.getRootElement(),null==h?(e=new g.types.JsonType(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=e):this.root_element=this.HB.getOperation(h)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.setMutableDefault=function(a){return this.root_element.setMutableDefault(a)},a.prototype.getUserId=function(){return this.HB.getUserId()},a.prototype.val=function(a,b,c){return this.root_element.val(a,b,c)},Object.defineProperty(a.prototype,"value",{get:function(){return this.root_element.value},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),a}(),"undefined"!=typeof window&&null!==window&&(window.JsonYatta=e),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/JsonTypes.coffee":7}],4:[function(a,b){var c,d,e,f;f=a("../Types/TextTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),h=f(this.HB),this.engine=new c(this.HB,h.parser),this.connector=new b(this.engine,this.HB,h.execution_listener),g=this.connector.getRootElement(),null==g?(e=new h.types.Word(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=this.HB.addOperation(new h.types.ReplaceManager(e,this.HB.getNextOperationIdentifier())).execute()):this.root_element=this.HB.getOperation(g)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.getUserId=function(){return this.HB.getUserId()},a.prototype.val=function(){return this.root_element.val().val()},a.prototype.insertText=function(a,b){return this.root_element.val().insertText(a,b)},a.prototype.deleteText=function(a,b){return this.root_element.val().deleteText(a,b)},a.prototype.replaceText=function(a){return this.root_element.val().replaceText(a)},a}(),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/TextTypes.coffee":9}],5:[function(a,b){var c;c=function(){function a(a){this.user_id=a,this.operation_counter={},this.buffer={},this.change_listeners=[]}return a.prototype.getUserId=function(){return this.user_id},a.prototype.getOperationCounter=function(){var a,b,c,d;b={},d=this.operation_counter;for(c in d)a=d[c],b[c]=a;return b},a.prototype._encode=function(){var a,b,c,d,e,f;a=[],f=this.buffer;for(d in f){e=f[d];for(c in e)b=e[c],isNaN(parseInt(c))||a.push(b._encode())}return a},a.prototype.getNextOperationIdentifier=function(a){var b;return null==a&&(a=this.user_id),null==this.operation_counter[a]&&(this.operation_counter[a]=0),b={creator:a,op_number:this.operation_counter[a]},this.operation_counter[a]++,b},a.prototype.getOperation=function(a){var b;if(a instanceof Object)return null!=(b=this.buffer[a.creator])?b[a.op_number]:void 0;if(null!=a)throw new Error("This type of uid is not defined!")},a.prototype.addOperation=function(a){if(null==this.buffer[a.creator]&&(this.buffer[a.creator]={}),null==this.operation_counter[a.creator]&&(this.operation_counter[a.creator]=0),null!=this.buffer[a.creator][a.op_number])throw new Error("You must not overwrite operations!");return this.buffer[a.creator][a.op_number]=a,"number"==typeof a.op_number&&a.creator!==this.getUserId()&&this.operation_counter[a.creator]++,a},a}(),b.exports=c},{}],6:[function(a,b){var c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);
|
||
return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};b.exports=function(a){var b,c,e,f,g,h,i;return i={},h=[],g=function(){function b(b){null==b&&(b=a.getNextOperationIdentifier()),this.creator=b.creator,this.op_number=b.op_number}return b.prototype.getUid=function(){return{creator:this.creator,op_number:this.op_number}},b.prototype.execute=function(){var a,b,c;for(this.is_executed=!0,b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this},b.prototype.saveOperation=function(a,b){return null!=(null!=b?b.execute:void 0)?this[a]=b:null!=b?(null==this.unchecked&&(this.unchecked={}),this.unchecked[a]=b):void 0},b.prototype.validateSavedOperations=function(){var b,c,d,e,f,g;f={},e=this,g=this.unchecked;for(b in g)d=g[b],c=a.getOperation(d),c?this[b]=c:(f[b]=d,e=!1);return delete this.unchecked,e||(this.unchecked=f),e},b}(),b=function(a){function b(a,c){this.saveOperation("deletes",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype._encode=function(){return{type:"Delete",uid:this.getUid(),deletes:this.deletes.getUid()}},b.prototype.execute=function(){return this.validateSavedOperations()?(this.deletes.applyDelete(this),b.__super__.execute.apply(this,arguments),this):!1},b}(g),i.Delete=function(a){var c,d;return d=a.uid,c=a.deletes,new b(d,c)},f=function(a){function b(a,c,d,e){this.saveOperation("prev_cl",c),this.saveOperation("next_cl",d),null!=e?this.saveOperation("origin",e):this.saveOperation("origin",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype.applyDelete=function(a){return null==this.deleted_by&&(this.deleted_by=[]),this.deleted_by.push(a)},b.prototype.isDeleted=function(){var a;return(null!=(a=this.deleted_by)?a.length:void 0)>0},b.prototype.getDistanceToOrigin=function(){var a,b;for(a=0,b=this.prev_cl;this.origin!==b;){if(a++,this===this.prev_cl)throw new Error("this should not happen ;) ");b=b.prev_cl}return a},b.prototype.update_sl=function(){var a;return a=this.prev_cl,update("prev_cl","prev_sl"),update("next_cl","prev_sl")},b.prototype.execute=function(){var a,c,d,e,f;if(null!=this.is_executed)return this;if(this.validateSavedOperations()){if((null!=(e=this.prev_cl)?e.validateSavedOperations():void 0)&&(null!=(f=this.next_cl)?f.validateSavedOperations():void 0)&&this.prev_cl.next_cl!==this){for(a=0,d=this.prev_cl.next_cl,c=0;null==d&&(console.log(JSON.stringify(this.prev_cl.getUid())),console.log(JSON.stringify(this.next_cl.getUid()))),d!==this.next_cl;){if(d.getDistanceToOrigin()===c)d.creator<this.creator&&(this.prev_cl=d,a=c+1);else{if(!(d.getDistanceToOrigin()<c))break;c-a<=d.getDistanceToOrigin()&&(this.prev_cl=d,a=c+1)}c++,d=d.next_cl}this.next_cl=this.prev_cl.next_cl,this.prev_cl.next_cl=this,this.next_cl.prev_cl=this}return b.__super__.execute.apply(this,arguments),this}return!1},b}(g),e=function(a){function b(a,c,d,e,f){this.content=null!=c?c:"",b.__super__.constructor.call(this,a,d,e,f)}return d(b,a),b.prototype.val=function(){return this.content},b.prototype._encode=function(){var a;return a={type:"ImmutableObject",uid:this.getUid(),content:this.content},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(f),i.ImmutableObject=function(a){var b,c,d,f,g;return g=a.uid,b=a.content,f=a.prev,c=a.next,d=a.origin,new e(g,b,f,c,d)},c=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return d(b,a),b.prototype.execute=function(){var a,b,c;if(this.validateSavedOperations()){for(b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this}return!1},b.prototype._encode=function(){var a,b;return{type:"Delimiter",uid:this.getUid(),prev:null!=(a=this.prev_cl)?a.getUid():void 0,next:null!=(b=this.next_cl)?b.getUid():void 0}},b}(f),i.Delimiter=function(a){var b,d,e;return e=a.uid,d=a.prev,b=a.next,new c(e,d,b)},{types:{Delete:b,Insert:f,Delimiter:c,Operation:g,ImmutableObject:e},parser:i,execution_listener:h}}},{}],7:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./TextTypes.coffee"),b.exports=function(a){var b,d,f,g,h;return g=c(a),h=g.types,f=g.parser,d=function(a){var c;return new(c=function(){function a(c){var e,f,g,i;i=c.map,g=function(e,f){return Object.defineProperty(a.prototype,e,{get:function(){var a;return a=f.val(),a instanceof b?d(a):a instanceof h.ImmutableObject?a.val():a},set:function(a){var b,d,f,g;if(a.constructor==={}.constructor){f=c.val(e),g=[];for(b in a)d=a[b],g.push(f.val(b,d,"immutable"));return g}return c.val(e,a,"immutable")},enumerable:!0,configurable:!1})};for(e in i)f=i[e],g(e,f)}return a}())(a)},b=function(b){function c(a,b,d){var e,f;if(c.__super__.constructor.call(this,a),null!=b){if("object"!=typeof b)throw new Error("The initial value of JsonTypes must be of type Object! (current type: "+typeof b+")");for(e in b)f=b[e],this.val(e,f,d)}}return e(c,b),c.prototype.mutable_default=!0,c.prototype.setMutableDefault=function(a){if(a===!0||"mutable"===a)c.prototype.mutable_default=!0;else{if(a!==!1&&"immutable"!==a)throw new Error('Set mutable either "mutable" or "immutable"!');c.prototype.mutable_default=!1}return"OK"},c.prototype.val=function(b,d,e){var f,g,i,j,k;if("object"==typeof b){for(i in b)g=b[i],this.val(i,g,d);return this}if(null!=b&&null!=d){if(e=null!=e?e===!0||"mutable"===e?!0:!1:this.mutable_default,"function"==typeof d)return this;if(e&&"number"!=typeof d||d.constructor===Object){if("string"==typeof d)return k=a.addOperation(new h.Word(a.getNextOperationIdentifier(),d)).execute(),c.__super__.val.call(this,b,k);if(d.constructor===Object)return f=a.addOperation(new c(a.getNextOperationIdentifier(),d,e)).execute(),c.__super__.val.call(this,b,f);throw new Error("You must not set "+typeof d+"-types in collaborative Json-objects!")}return j=a.addOperation(new h.ImmutableObject(void 0,d)).execute(),c.__super__.val.call(this,b,j)}return c.__super__.val.call(this,b,d)},Object.defineProperty(c.prototype,"value",{get:function(){return d(this)},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),c.prototype._encode=function(){return{type:"JsonType",uid:this.getUid()}},c}(h.MapManager),f.JsonType=function(a){var c;return c=a.uid,new b(c)},h.JsonType=b,g}},{"./TextTypes.coffee":9}],8:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./BasicTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i,j,k;return i=c(a),k=i.types,j=i.parser,f=function(c){function d(a){this.map={},d.__super__.constructor.call(this,a)}return e(d,c),d.prototype.val=function(c,e){var f,g,h,i,j;if(null!=e)return null==this.map[c]&&a.addOperation(new b(a.getNextOperationIdentifier(),this,c)).execute(),this.map[c].replace(e),this;if(null!=c)return g=null!=(i=this.map[c])?i.val():void 0,g instanceof k.ImmutableObject?g.val():g;h={},j=this.map;for(c in j)f=j[c],g=f.val(),(g instanceof k.ImmutableObject||g instanceof d)&&(g=g.val()),h[c]=g;return h},d}(k.Operation),b=function(b){function c(a,b,d){this.name=d,this.saveOperation("map_manager",b),c.__super__.constructor.call(this,a)}return e(c,b),c.prototype.execute=function(){var b,d,e,f,h;return this.validateSavedOperations()?(h=this.map_manager.getUid(),h.op_number="_"+h.op_number+"_RM_"+this.name,null==a.getOperation(h)&&(e=this.map_manager.getUid(),e.op_number="_"+e.op_number+"_RM_"+this.name+"_beginning",f=this.map_manager.getUid(),f.op_number="_"+f.op_number+"_RM_"+this.name+"_end",b=a.addOperation(new k.Delimiter(e,void 0,f)),d=a.addOperation(new k.Delimiter(f,b,void 0)).execute(),b.execute(),this.map_manager.map[this.name]=a.addOperation(new g(void 0,h,b,d)).execute()),c.__super__.execute.apply(this,arguments)):!1},c.prototype._encode=function(){return{type:"AddName",uid:this.getUid(),map_manager:this.map_manager.getUid(),name:this.name}},c}(k.Operation),j.AddName=function(a){var c,d,e;return c=a.map_manager,e=a.uid,d=a.name,new b(e,c,d)},d=function(b){function c(b,d,e,f,g,h){null!=d&&null!=e?(this.saveOperation("beginning",d),this.saveOperation("end",e)):(this.beginning=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),void 0,void 0)),this.end=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),this.beginning,void 0)),this.beginning.next_cl=this.end,this.beginning.execute(),this.end.execute()),c.__super__.constructor.call(this,b,f,g,h)}return e(c,b),c.prototype.getLastOperation=function(){return this.end.prev_cl},c.prototype.getFirstOperation=function(){return this.beginning.next_cl},c.prototype.toArray=function(){var a,b;for(a=this.beginning.next_cl,b=[];a!==this.end;)b.push(a),a=a.next_cl;return b},c.prototype.getOperationByPosition=function(a){var b;if(b=this.beginning.next_cl,a>0)for(;b=b.next_cl,b.isDeleted()||(a-=1),0!==a;)if(b instanceof k.Delimiter)throw new Error("position parameter exceeded the length of the document!");return b},c}(k.Insert),g=function(b){function c(a,b,d,e,f,g,h){c.__super__.constructor.call(this,b,d,e,f,g,h),null!=a&&this.replace(a)}return e(c,b),c.prototype.replace=function(b){var c,d;return c=this.getLastOperation(),d=new h(b,this,a.getNextOperationIdentifier(),c,c.next_cl),a.addOperation(d).execute()},c.prototype.val=function(){var a;if(a=this.getLastOperation(),a instanceof k.Delimiter)throw new Error("dtrn");return a.val()},c.prototype._encode=function(){var a;return a={type:"ReplaceManager",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&null!=this.next_cl&&(a.prev=this.prev_cl.getUid(),a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},c}(d),j.ReplaceManager=function(a){var b,c,d,e,f,h,i;return c=a.content,i=a.uid,h=a.prev,e=a.next,f=a.origin,b=a.beginning,d=a.end,new g(c,i,b,d,h,e,f)},h=function(a){function b(a,c,d,e,f,g){if(this.saveOperation("content",a),this.saveOperation("parent",c),null==e||null==f||null==a)throw new Error("You must define content, prev, and next for Replaceable-types!");b.__super__.constructor.call(this,d,e,f,g)}return e(b,a),b.prototype.val=function(){return this.content},b.prototype.replace=function(a){return this.parent.replace(a)},b.prototype.execute=function(){var a;return this.validateSavedOperations()?("function"==typeof(a=this.content).setReplaceManager&&a.setReplaceManager(this.parent),b.__super__.execute.apply(this,arguments),this):!1},b.prototype._encode=function(){var a;return a={type:"Replaceable",content:this.content.getUid(),ReplaceManager:this.parent.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid(),uid:this.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(k.Insert),j.Replaceable=function(a){var b,c,d,e,f,g;return b=a.content,e=a.ReplaceManager,g=a.uid,f=a.prev,c=a.next,d=a.origin,new h(b,e,g,f,c,d)},k.ListManager=d,k.MapManager=f,k.ReplaceManager=g,k.Replaceable=h,i}},{"./BasicTypes.coffee":6}],9:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./StructuredTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i;return h=c(a),i=h.types,g=h.parser,b=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return e(b,a),b}(i.Delete),g.TextDelete=g.Delete,d=function(a){function b(a,c,d,e,f){if(this.content=a,null==d||null==e)throw new Error("You must define prev, and next for TextInsert-types!");b.__super__.constructor.call(this,c,d,e,f)}return e(b,a),b.prototype.getLength=function(){return this.isDeleted()?0:this.content.length},b.prototype.val=function(){return this.isDeleted()?"":this.content},b.prototype._encode=function(){var a;return a={type:"TextInsert",content:this.content,uid:this.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(i.Insert),g.TextInsert=function(a){var b,c,e,f,g;return b=a.content,g=a.uid,f=a.prev,c=a.next,e=a.origin,new d(b,g,f,c,e)},f=function(c){function f(a,b,c,d,e,g,h){f.__super__.constructor.call(this,a,c,d,e,g,h),null!=b&&this.insertText(0,b)}return e(f,c),f.prototype.insertText=function(b,c){var e,f,g,h,i,j;for(f=this.getOperationByPosition(b),j=[],h=0,i=c.length;i>h;h++)e=c[h],g=new d(e,a.getNextOperationIdentifier(),f.prev_cl,f),j.push(a.addOperation(g).execute());return j},f.prototype.deleteText=function(c,d){var e,f,g,h,j;for(g=this.getOperationByPosition(c),j=[],f=h=0;d>=0?d>h:h>d;f=d>=0?++h:--h){for(e=a.addOperation(new b(a.getNextOperationIdentifier(),g)).execute(),g=g.next_cl;g.isDeleted();){if(g instanceof i.Delimiter)throw new Error("You can't delete more than there is..");g=g.next_cl}j.push(e._encode())}return j},f.prototype.replaceText=function(b){var c;if(null!=this.replace_manager)return c=a.addOperation(new f(a.getNextOperationIdentifier())).execute(),c.insertText(0,b),this.replace_manager.replace(c);throw new Error("This type is currently not maintained by a ReplaceManager!")},f.prototype.val=function(){var a,b;return a=function(){var a,c,d,e;for(d=this.toArray(),e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(null!=b.val?b.val():"");return e}.call(this),a.join("")},f.prototype.setReplaceManager=function(a){return this.saveOperation("replace_manager",a),this.validateSavedOperations},f.prototype._encode=function(){var a;return a={type:"Word",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},f}(i.ListManager),g.Word=function(a){var b,c,d,e,g,h;return h=a.uid,b=a.beginning,c=a.end,g=a.prev,d=a.next,e=a.origin,new f(h,void 0,b,c,g,d,e)},i.TextInsert=d,i.TextDelete=b,i.Word=f,h}},{"./StructuredTypes.coffee":8}],10:[function(a,b){b.exports=a("./lib/chai")},{"./lib/chai":11}],11:[function(a,b,c){var d=[],c=b.exports={};c.version="1.9.1",c.AssertionError=a("assertion-error");var e=a("./chai/utils");c.use=function(a){return~d.indexOf(a)||(a(this,e),d.push(a)),this};var f=a("./chai/config");c.config=f;var g=a("./chai/assertion");c.use(g);var h=a("./chai/core/assertions");c.use(h);var i=a("./chai/interface/expect");c.use(i);var j=a("./chai/interface/should");c.use(j);var k=a("./chai/interface/assert");c.use(k)},{"./chai/assertion":12,"./chai/config":13,"./chai/core/assertions":14,"./chai/interface/assert":15,"./chai/interface/expect":16,"./chai/interface/should":17,"./chai/utils":28,"assertion-error":37}],12:[function(a,b){var c=a("./config");b.exports=function(a,b){function d(a,b,c){f(this,"ssfi",c||arguments.callee),f(this,"object",a),f(this,"message",b)}var e=a.AssertionError,f=b.flag;a.Assertion=d,Object.defineProperty(d,"includeStack",{get:function(){return console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack},set:function(a){console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack=a}}),Object.defineProperty(d,"showDiff",{get:function(){return console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff},set:function(a){console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff=a}}),d.addProperty=function(a,c){b.addProperty(this.prototype,a,c)},d.addMethod=function(a,c){b.addMethod(this.prototype,a,c)},d.addChainableMethod=function(a,c,d){b.addChainableMethod(this.prototype,a,c,d)},d.overwriteProperty=function(a,c){b.overwriteProperty(this.prototype,a,c)},d.overwriteMethod=function(a,c){b.overwriteMethod(this.prototype,a,c)},d.overwriteChainableMethod=function(a,c,d){b.overwriteChainableMethod(this.prototype,a,c,d)},d.prototype.assert=function(a,d,g,h,i,j){var k=b.test(this,arguments);if(!0!==j&&(j=!1),!0!==c.showDiff&&(j=!1),!k){var d=b.getMessage(this,arguments),l=b.getActual(this,arguments);throw new e(d,{actual:l,expected:h,showDiff:j},c.includeStack?this.assert:f(this,"ssfi"))}},Object.defineProperty(d.prototype,"_obj",{get:function(){return f(this,"object")},set:function(a){f(this,"object",a)}})}},{"./config":13}],13:[function(a,b){b.exports={includeStack:!1,showDiff:!0,truncateThreshold:40}},{}],14:[function(a,b){b.exports=function(a,b){function c(a,c){c&&u(this,"message",c),a=a.toLowerCase();var d=u(this,"object"),e=~["a","e","i","o","u"].indexOf(a.charAt(0))?"an ":"a ";this.assert(a===b.type(d),"expected #{this} to be "+e+a,"expected #{this} not to be "+e+a)}function d(){u(this,"contains",!0)}function e(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=!1;if("array"===b.type(d)&&"object"===b.type(a)){for(var f in d)if(b.eql(d[f],a)){e=!0;break}}else if("object"===b.type(a)){if(!u(this,"negate")){for(var g in a)new t(d).property(g,a[g]);return}var h={};for(var g in a)h[g]=d[g];e=b.eql(h,a)}else e=d&&~d.indexOf(a);this.assert(e,"expected #{this} to include "+b.inspect(a),"expected #{this} to not include "+b.inspect(a))}function f(){var a=u(this,"object"),b=Object.prototype.toString.call(a);this.assert("[object Arguments]"===b,"expected #{this} to be arguments but got "+b,"expected #{this} to not be arguments")}function g(a,b){b&&u(this,"message",b);var c=u(this,"object");return u(this,"deep")?this.eql(a):void this.assert(a===c,"expected #{this} to equal #{exp}","expected #{this} to not equal #{exp}",a,this._obj,!0)}function h(a,c){c&&u(this,"message",c),this.assert(b.eql(a,u(this,"object")),"expected #{this} to deeply equal #{exp}","expected #{this} to not deeply equal #{exp}",a,this._obj,!0)}function i(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>a,"expected #{this} to have a length above #{exp} but got #{act}","expected #{this} to not have a length above #{exp}",a,d)}else this.assert(c>a,"expected #{this} to be above "+a,"expected #{this} to be at most "+a)}function j(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>=a,"expected #{this} to have a length at least #{exp} but got #{act}","expected #{this} to have a length below #{exp}",a,d)}else this.assert(c>=a,"expected #{this} to be at least "+a,"expected #{this} to be below "+a)}function k(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(a>d,"expected #{this} to have a length below #{exp} but got #{act}","expected #{this} to not have a length below #{exp}",a,d)}else this.assert(a>c,"expected #{this} to be below "+a,"expected #{this} to be at least "+a)}function l(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(a>=d,"expected #{this} to have a length at most #{exp} but got #{act}","expected #{this} to have a length above #{exp}",a,d)}else this.assert(a>=c,"expected #{this} to be at most "+a,"expected #{this} to be above "+a)}function m(a,c){c&&u(this,"message",c);var d=b.getName(a);this.assert(u(this,"object")instanceof a,"expected #{this} to be an instance of "+d,"expected #{this} to not be an instance of "+d)}function n(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(d.hasOwnProperty(a),"expected #{this} to have own property "+b.inspect(a),"expected #{this} to not have own property "+b.inspect(a))}function o(){u(this,"doLength",!0)}function p(a,b){b&&u(this,"message",b);var c=u(this,"object");new t(c,b).to.have.property("length");var d=c.length;this.assert(d==a,"expected #{this} to have a length of #{exp} but got #{act}","expected #{this} to not have a length of #{act}",a,d)}function q(a){var c,d=u(this,"object"),e=!0;if(a=a instanceof Array?a:Array.prototype.slice.call(arguments),!a.length)throw new Error("keys required");var f=Object.keys(d),g=a.length;if(e=a.every(function(a){return~f.indexOf(a)}),u(this,"negate")||u(this,"contains")||(e=e&&a.length==f.length),g>1){a=a.map(function(a){return b.inspect(a)});var h=a.pop();c=a.join(", ")+", and "+h}else c=b.inspect(a[0]);c=(g>1?"keys ":"key ")+c,c=(u(this,"contains")?"contain ":"have ")+c,this.assert(e,"expected #{this} to "+c,"expected #{this} to not "+c)}function r(a,c,d){d&&u(this,"message",d);var e=u(this,"object");new t(e,d).is.a("function");var f=!1,g=null,h=null,i=null;0===arguments.length?(c=null,a=null):a&&(a instanceof RegExp||"string"==typeof a)?(c=a,a=null):a&&a instanceof Error?(g=a,a=null,c=null):"function"==typeof a?(h=a.prototype.name||a.name,"Error"===h&&a!==Error&&(h=(new a).name)):a=null;try{e()}catch(j){if(g)return this.assert(j===g,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}",g instanceof Error?g.toString():g,j instanceof Error?j.toString():j),u(this,"object",j),this;if(a&&(this.assert(j instanceof a,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp} but #{act} was thrown",h,j instanceof Error?j.toString():j),!c))return u(this,"object",j),this;var k="object"===b.type(j)&&"message"in j?j.message:""+j;if(null!=k&&c&&c instanceof RegExp)return this.assert(c.exec(k),"expected #{this} to throw error matching #{exp} but got #{act}","expected #{this} to throw error not matching #{exp}",c,k),u(this,"object",j),this;if(null!=k&&c&&"string"==typeof c)return this.assert(~k.indexOf(c),"expected #{this} to throw error including #{exp} but got #{act}","expected #{this} to throw error not including #{act}",c,k),u(this,"object",j),this;f=!0,i=j}var l="",m=null!==h?h:g?"#{exp}":"an error";f&&(l=" but #{act} was thrown"),this.assert(f===!0,"expected #{this} to throw "+m+l,"expected #{this} to not throw "+m+l,g instanceof Error?g.toString():g,i instanceof Error?i.toString():i),u(this,"object",i)}function s(a,b,c){return a.every(function(a){return c?b.some(function(b){return c(a,b)}):-1!==b.indexOf(a)})}var t=a.Assertion,u=(Object.prototype.toString,b.flag);["to","be","been","is","and","has","have","with","that","at","of","same"].forEach(function(a){t.addProperty(a,function(){return this})}),t.addProperty("not",function(){u(this,"negate",!0)}),t.addProperty("deep",function(){u(this,"deep",!0)}),t.addChainableMethod("an",c),t.addChainableMethod("a",c),t.addChainableMethod("include",e,d),t.addChainableMethod("contain",e,d),t.addProperty("ok",function(){this.assert(u(this,"object"),"expected #{this} to be truthy","expected #{this} to be falsy")}),t.addProperty("true",function(){this.assert(!0===u(this,"object"),"expected #{this} to be true","expected #{this} to be false",this.negate?!1:!0)}),t.addProperty("false",function(){this.assert(!1===u(this,"object"),"expected #{this} to be false","expected #{this} to be true",this.negate?!0:!1)}),t.addProperty("null",function(){this.assert(null===u(this,"object"),"expected #{this} to be null","expected #{this} not to be null")}),t.addProperty("undefined",function(){this.assert(void 0===u(this,"object"),"expected #{this} to be undefined","expected #{this} not to be undefined")}),t.addProperty("exist",function(){this.assert(null!=u(this,"object"),"expected #{this} to exist","expected #{this} to not exist")}),t.addProperty("empty",function(){var a=u(this,"object"),b=a;Array.isArray(a)||"string"==typeof object?b=a.length:"object"==typeof a&&(b=Object.keys(a).length),this.assert(!b,"expected #{this} to be empty","expected #{this} not to be empty")}),t.addProperty("arguments",f),t.addProperty("Arguments",f),t.addMethod("equal",g),t.addMethod("equals",g),t.addMethod("eq",g),t.addMethod("eql",h),t.addMethod("eqls",h),t.addMethod("above",i),t.addMethod("gt",i),t.addMethod("greaterThan",i),t.addMethod("least",j),t.addMethod("gte",j),t.addMethod("below",k),t.addMethod("lt",k),t.addMethod("lessThan",k),t.addMethod("most",l),t.addMethod("lte",l),t.addMethod("within",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object"),e=a+".."+b;if(u(this,"doLength")){new t(d,c).to.have.property("length");var f=d.length;this.assert(f>=a&&b>=f,"expected #{this} to have a length within "+e,"expected #{this} to not have a length within "+e)}else this.assert(d>=a&&b>=d,"expected #{this} to be within "+e,"expected #{this} to not be within "+e)}),t.addMethod("instanceof",m),t.addMethod("instanceOf",m),t.addMethod("property",function(a,c,d){d&&u(this,"message",d);var e=u(this,"deep")?"deep property ":"property ",f=u(this,"negate"),g=u(this,"object"),h=u(this,"deep")?b.getPathValue(a,g):g[a];if(f&&void 0!==c){if(void 0===h)throw d=null!=d?d+": ":"",new Error(d+b.inspect(g)+" has no "+e+b.inspect(a))}else this.assert(void 0!==h,"expected #{this} to have a "+e+b.inspect(a),"expected #{this} to not have "+e+b.inspect(a));void 0!==c&&this.assert(c===h,"expected #{this} to have a "+e+b.inspect(a)+" of #{exp}, but got #{act}","expected #{this} to not have a "+e+b.inspect(a)+" of #{act}",c,h),u(this,"object",h)}),t.addMethod("ownProperty",n),t.addMethod("haveOwnProperty",n),t.addChainableMethod("length",p,o),t.addMethod("lengthOf",p,o),t.addMethod("match",function(a,b){b&&u(this,"message",b);var c=u(this,"object");this.assert(a.exec(c),"expected #{this} to match "+a,"expected #{this} not to match "+a)}),t.addMethod("string",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d,c).is.a("string"),this.assert(~d.indexOf(a),"expected #{this} to contain "+b.inspect(a),"expected #{this} to not contain "+b.inspect(a))}),t.addMethod("keys",q),t.addMethod("key",q),t.addMethod("throw",r),t.addMethod("throws",r),t.addMethod("Throw",r),t.addMethod("respondTo",function(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=u(this,"itself"),f="function"!==b.type(d)||e?d[a]:d.prototype[a];this.assert("function"==typeof f,"expected #{this} to respond to "+b.inspect(a),"expected #{this} to not respond to "+b.inspect(a))}),t.addProperty("itself",function(){u(this,"itself",!0)}),t.addMethod("satisfy",function(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(a(d),"expected #{this} to satisfy "+b.objDisplay(a),"expected #{this} to not satisfy"+b.objDisplay(a),this.negate?!1:!0,a(d))}),t.addMethod("closeTo",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(Math.abs(d-a)<=b,"expected #{this} to be close to "+a+" +/- "+b,"expected #{this} not to be close to "+a+" +/- "+b)}),t.addMethod("members",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d).to.be.an("array"),new t(a).to.be.an("array");var e=u(this,"deep")?b.eql:void 0;return u(this,"contains")?this.assert(s(a,d,e),"expected #{this} to be a superset of #{act}","expected #{this} to not be a superset of #{act}",d,a):void this.assert(s(d,a,e)&&s(a,d,e),"expected #{this} to have the same members as #{act}","expected #{this} to not have the same members as #{act}",d,a)})}},{}],15:[function(require,module,exports){module.exports=function(chai,util){var Assertion=chai.Assertion,flag=util.flag,assert=chai.assert=function(a,b){var c=new Assertion(null,null,chai.assert);c.assert(a,b,"[ negation message unavailable ]")};assert.fail=function(a,b,c,d){throw c=c||"assert.fail()",new chai.AssertionError(c,{actual:a,expected:b,operator:d},assert.fail)},assert.ok=function(a,b){new Assertion(a,b).is.ok},assert.notOk=function(a,b){new Assertion(a,b).is.not.ok},assert.equal=function(a,b,c){var d=new Assertion(a,c,assert.equal);d.assert(b==flag(d,"object"),"expected #{this} to equal #{exp}","expected #{this} to not equal #{act}",b,a)},assert.notEqual=function(a,b,c){var d=new Assertion(a,c,assert.notEqual);d.assert(b!=flag(d,"object"),"expected #{this} to not equal #{exp}","expected #{this} to equal #{act}",b,a)},assert.strictEqual=function(a,b,c){new Assertion(a,c).to.equal(b)},assert.notStrictEqual=function(a,b,c){new Assertion(a,c).to.not.equal(b)},assert.deepEqual=function(a,b,c){new Assertion(a,c).to.eql(b)},assert.notDeepEqual=function(a,b,c){new Assertion(a,c).to.not.eql(b)},assert.isTrue=function(a,b){new Assertion(a,b).is["true"]},assert.isFalse=function(a,b){new Assertion(a,b).is["false"]},assert.isNull=function(a,b){new Assertion(a,b).to.equal(null)},assert.isNotNull=function(a,b){new Assertion(a,b).to.not.equal(null)},assert.isUndefined=function(a,b){new Assertion(a,b).to.equal(void 0)},assert.isDefined=function(a,b){new Assertion(a,b).to.not.equal(void 0)},assert.isFunction=function(a,b){new Assertion(a,b).to.be.a("function")},assert.isNotFunction=function(a,b){new Assertion(a,b).to.not.be.a("function")},assert.isObject=function(a,b){new Assertion(a,b).to.be.a("object")},assert.isNotObject=function(a,b){new Assertion(a,b).to.not.be.a("object")},assert.isArray=function(a,b){new Assertion(a,b).to.be.an("array")},assert.isNotArray=function(a,b){new Assertion(a,b).to.not.be.an("array")},assert.isString=function(a,b){new Assertion(a,b).to.be.a("string")},assert.isNotString=function(a,b){new Assertion(a,b).to.not.be.a("string")},assert.isNumber=function(a,b){new Assertion(a,b).to.be.a("number")},assert.isNotNumber=function(a,b){new Assertion(a,b).to.not.be.a("number")},assert.isBoolean=function(a,b){new Assertion(a,b).to.be.a("boolean")},assert.isNotBoolean=function(a,b){new Assertion(a,b).to.not.be.a("boolean")},assert.typeOf=function(a,b,c){new Assertion(a,c).to.be.a(b)},assert.notTypeOf=function(a,b,c){new Assertion(a,c).to.not.be.a(b)},assert.instanceOf=function(a,b,c){new Assertion(a,c).to.be.instanceOf(b)},assert.notInstanceOf=function(a,b,c){new Assertion(a,c).to.not.be.instanceOf(b)},assert.include=function(a,b,c){new Assertion(a,c,assert.include).include(b)},assert.notInclude=function(a,b,c){new Assertion(a,c,assert.notInclude).not.include(b)},assert.match=function(a,b,c){new Assertion(a,c).to.match(b)},assert.notMatch=function(a,b,c){new Assertion(a,c).to.not.match(b)},assert.property=function(a,b,c){new Assertion(a,c).to.have.property(b)},assert.notProperty=function(a,b,c){new Assertion(a,c).to.not.have.property(b)},assert.deepProperty=function(a,b,c){new Assertion(a,c).to.have.deep.property(b)},assert.notDeepProperty=function(a,b,c){new Assertion(a,c).to.not.have.deep.property(b)},assert.propertyVal=function(a,b,c,d){new Assertion(a,d).to.have.property(b,c)},assert.propertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.property(b,c)},assert.deepPropertyVal=function(a,b,c,d){new Assertion(a,d).to.have.deep.property(b,c)},assert.deepPropertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.deep.property(b,c)},assert.lengthOf=function(a,b,c){new Assertion(a,c).to.have.length(b)},assert.Throw=function(a,b,c,d){("string"==typeof b||b instanceof RegExp)&&(c=b,b=null);var e=new Assertion(a,d).to.Throw(b,c);return flag(e,"object")},assert.doesNotThrow=function(a,b,c){"string"==typeof b&&(c=b,b=null),new Assertion(a,c).to.not.Throw(b)},assert.operator=function(val,operator,val2,msg){if(!~["==","===",">",">=","<","<=","!=","!=="].indexOf(operator))throw new Error('Invalid operator "'+operator+'"');var test=new Assertion(eval(val+operator+val2),msg);test.assert(!0===flag(test,"object"),"expected "+util.inspect(val)+" to be "+operator+" "+util.inspect(val2),"expected "+util.inspect(val)+" to not be "+operator+" "+util.inspect(val2))},assert.closeTo=function(a,b,c,d){new Assertion(a,d).to.be.closeTo(b,c)},assert.sameMembers=function(a,b,c){new Assertion(a,c).to.have.same.members(b)},assert.includeMembers=function(a,b,c){new Assertion(a,c).to.include.members(b)},assert.ifError=function(a,b){new Assertion(a,b).to.not.be.ok},function a(b,c){return assert[c]=assert[b],a}("Throw","throw")("Throw","throws")}},{}],16:[function(a,b){b.exports=function(a){a.expect=function(b,c){return new a.Assertion(b,c)
|
||
}}},{}],17:[function(a,b){b.exports=function(a){function b(){function a(){return this instanceof String||this instanceof Number?new c(this.constructor(this),null,a):this instanceof Boolean?new c(1==this,null,a):new c(this,null,a)}function b(a){Object.defineProperty(this,"should",{value:a,enumerable:!0,configurable:!0,writable:!0})}Object.defineProperty(Object.prototype,"should",{set:b,get:a,configurable:!0});var d={};return d.equal=function(a,b,d){new c(a,d).to.equal(b)},d.Throw=function(a,b,d,e){new c(a,e).to.Throw(b,d)},d.exist=function(a,b){new c(a,b).to.exist},d.not={},d.not.equal=function(a,b,d){new c(a,d).to.not.equal(b)},d.not.Throw=function(a,b,d,e){new c(a,e).to.not.Throw(b,d)},d.not.exist=function(a,b){new c(a,b).to.not.exist},d["throw"]=d.Throw,d.not["throw"]=d.not.Throw,d}var c=a.Assertion;a.should=b,a.Should=b}},{}],18:[function(a,b){var c=a("./transferFlags"),d=a("./flag"),e=a("../config"),f="__proto__"in Object,g=/^(?:length|name|arguments|caller)$/,h=Function.prototype.call,i=Function.prototype.apply;b.exports=function(a,b,j,k){"function"!=typeof k&&(k=function(){});var l={method:j,chainingBehavior:k};a.__methods||(a.__methods={}),a.__methods[b]=l,Object.defineProperty(a,b,{get:function(){l.chainingBehavior.call(this);var b=function m(){var a=d(this,"ssfi");a&&e.includeStack===!1&&d(this,"ssfi",m);var b=l.method.apply(this,arguments);return void 0===b?this:b};if(f){var j=b.__proto__=Object.create(this);j.call=h,j.apply=i}else{var k=Object.getOwnPropertyNames(a);k.forEach(function(c){if(!g.test(c)){var d=Object.getOwnPropertyDescriptor(a,c);Object.defineProperty(b,c,d)}})}return c(this,b),b},configurable:!0})}},{"../config":13,"./flag":21,"./transferFlags":35}],19:[function(a,b){var c=a("../config"),d=a("./flag");b.exports=function(a,b,e){a[b]=function(){var f=d(this,"ssfi");f&&c.includeStack===!1&&d(this,"ssfi",a[b]);var g=e.apply(this,arguments);return void 0===g?this:g}}},{"../config":13,"./flag":21}],20:[function(a,b){b.exports=function(a,b,c){Object.defineProperty(a,b,{get:function(){var a=c.call(this);return void 0===a?this:a},configurable:!0})}},{}],21:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));return 3!==arguments.length?d[b]:void(d[b]=c)}},{}],22:[function(a,b){b.exports=function(a,b){return b.length>4?b[4]:a._obj}},{}],23:[function(a,b){b.exports=function(a){var b=[];for(var c in a)b.push(c);return b}},{}],24:[function(a,b){var c=a("./flag"),d=a("./getActual"),e=(a("./inspect"),a("./objDisplay"));b.exports=function(a,b){var f=c(a,"negate"),g=c(a,"object"),h=b[3],i=d(a,b),j=f?b[2]:b[1],k=c(a,"message");return j=j||"",j=j.replace(/#{this}/g,e(g)).replace(/#{act}/g,e(i)).replace(/#{exp}/g,e(h)),k?k+": "+j:j}},{"./flag":21,"./getActual":22,"./inspect":29,"./objDisplay":30}],25:[function(a,b){b.exports=function(a){if(a.name)return a.name;var b=/^\s?function ([^(]*)\(/.exec(a);return b&&b[1]?b[1]:""}},{}],26:[function(a,b){function c(a){var b=a.replace(/\[/g,".["),c=b.match(/(\\\.|[^.]+?)+/g);return c.map(function(a){var b=/\[(\d+)\]$/,c=b.exec(a);return c?{i:parseFloat(c[1])}:{p:a}})}function d(a,b){for(var c,d=b,e=0,f=a.length;f>e;e++){var g=a[e];d?("undefined"!=typeof g.p?d=d[g.p]:"undefined"!=typeof g.i&&(d=d[g.i]),e==f-1&&(c=d)):c=void 0}return c}b.exports=function(a,b){var e=c(a);return d(e,b)}},{}],27:[function(a,b){b.exports=function(){function a(a){-1===b.indexOf(a)&&b.push(a)}for(var b=Object.getOwnPropertyNames(subject),c=Object.getPrototypeOf(subject);null!==c;)Object.getOwnPropertyNames(c).forEach(a),c=Object.getPrototypeOf(c);return b}},{}],28:[function(a,b,c){var c=b.exports={};c.test=a("./test"),c.type=a("./type"),c.getMessage=a("./getMessage"),c.getActual=a("./getActual"),c.inspect=a("./inspect"),c.objDisplay=a("./objDisplay"),c.flag=a("./flag"),c.transferFlags=a("./transferFlags"),c.eql=a("deep-eql"),c.getPathValue=a("./getPathValue"),c.getName=a("./getName"),c.addProperty=a("./addProperty"),c.addMethod=a("./addMethod"),c.overwriteProperty=a("./overwriteProperty"),c.overwriteMethod=a("./overwriteMethod"),c.addChainableMethod=a("./addChainableMethod"),c.overwriteChainableMethod=a("./overwriteChainableMethod")},{"./addChainableMethod":18,"./addMethod":19,"./addProperty":20,"./flag":21,"./getActual":22,"./getMessage":24,"./getName":25,"./getPathValue":26,"./inspect":29,"./objDisplay":30,"./overwriteChainableMethod":31,"./overwriteMethod":32,"./overwriteProperty":33,"./test":34,"./transferFlags":35,"./type":36,"deep-eql":38}],29:[function(a,b,c){function d(a,b,c){var d={showHidden:b,seen:[],stylize:function(a){return a}};return e(d,a,"undefined"==typeof c?2:c)}function e(a,b,d){if(b&&"function"==typeof b.inspect&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var o=b.inspect(d);return"string"!=typeof o&&(o=e(a,o,d)),o}var u=f(a,b);if(u)return u;if(t(b))return s(b);var v=r(b),w=a.showHidden?q(b):v;if(0===w.length||n(b)&&(1===w.length&&"stack"===w[0]||2===w.length&&"description"===w[0]&&"stack"===w[1])){if("function"==typeof b){var x=p(b),y=x?": "+x:"";return a.stylize("[Function"+y+"]","special")}if(l(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(m(b))return a.stylize(Date.prototype.toUTCString.call(b),"date");if(n(b))return g(b)}var z="",A=!1,B=["{","}"];if(k(b)&&(A=!0,B=["[","]"]),"function"==typeof b){var x=p(b),y=x?": "+x:"";z=" [Function"+y+"]"}if(l(b)&&(z=" "+RegExp.prototype.toString.call(b)),m(b)&&(z=" "+Date.prototype.toUTCString.call(b)),n(b))return g(b);if(0===w.length&&(!A||0==b.length))return B[0]+z+B[1];if(0>d)return l(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var C;return C=A?h(a,b,d,v,w):w.map(function(c){return i(a,b,d,v,c,A)}),a.seen.pop(),j(C,z,B)}function f(a,b){switch(typeof b){case"undefined":return a.stylize("undefined","undefined");case"string":var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string");case"number":return a.stylize(""+b,"number");case"boolean":return a.stylize(""+b,"boolean")}return null===b?a.stylize("null","null"):void 0}function g(a){return"["+Error.prototype.toString.call(a)+"]"}function h(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(Object.prototype.hasOwnProperty.call(b,String(g))?i(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(i(a,b,c,d,e,!0))}),f}function i(a,b,c,d,f,g){var h,i;if(b.__lookupGetter__&&(b.__lookupGetter__(f)?i=b.__lookupSetter__(f)?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):b.__lookupSetter__(f)&&(i=a.stylize("[Setter]","special"))),d.indexOf(f)<0&&(h="["+f+"]"),i||(a.seen.indexOf(b[f])<0?(i=null===c?e(a,b[f],null):e(a,b[f],c-1),i.indexOf("\n")>-1&&(i=g?i.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+i.split("\n").map(function(a){return" "+a}).join("\n"))):i=a.stylize("[Circular]","special")),"undefined"==typeof h){if(g&&f.match(/^\d+$/))return i;h=JSON.stringify(""+f),h.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(h=h.substr(1,h.length-2),h=a.stylize(h,"name")):(h=h.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),h=a.stylize(h,"string"))}return h+": "+i}function j(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function k(a){return Array.isArray(a)||"object"==typeof a&&"[object Array]"===o(a)}function l(a){return"object"==typeof a&&"[object RegExp]"===o(a)}function m(a){return"object"==typeof a&&"[object Date]"===o(a)}function n(a){return"object"==typeof a&&"[object Error]"===o(a)}function o(a){return Object.prototype.toString.call(a)}var p=a("./getName"),q=a("./getProperties"),r=a("./getEnumerableProperties");b.exports=d;var s=function(a){if("outerHTML"in a)return a.outerHTML;var b,c="http://www.w3.org/1999/xhtml",d=document.createElementNS(c,"_"),e=((window.HTMLElement||window.Element).prototype,new XMLSerializer);return document.xmlVersion?e.serializeToString(a):(d.appendChild(a.cloneNode(!1)),b=d.innerHTML.replace("><",">"+a.innerHTML+"<"),d.innerHTML="",b)},t=function(a){return"object"==typeof HTMLElement?a instanceof HTMLElement:a&&"object"==typeof a&&1===a.nodeType&&"string"==typeof a.nodeName}},{"./getEnumerableProperties":23,"./getName":25,"./getProperties":27}],30:[function(a,b){var c=a("./inspect"),d=a("../config");b.exports=function(a){var b=c(a),e=Object.prototype.toString.call(a);if(d.truncateThreshold&&b.length>=d.truncateThreshold){if("[object Function]"===e)return a.name&&""!==a.name?"[Function: "+a.name+"]":"[Function]";if("[object Array]"===e)return"[ Array("+a.length+") ]";if("[object Object]"===e){var f=Object.keys(a),g=f.length>2?f.splice(0,2).join(", ")+", ...":f.join(", ");return"{ Object ("+g+") }"}return b}return b}},{"../config":13,"./inspect":29}],31:[function(a,b){b.exports=function(a,b,c,d){var e=a.__methods[b],f=e.chainingBehavior;e.chainingBehavior=function(){var a=d(f).call(this);return void 0===a?this:a};var g=e.method;e.method=function(){var a=c(g).apply(this,arguments);return void 0===a?this:a}}},{}],32:[function(a,b){b.exports=function(a,b,c){var d=a[b],e=function(){return this};d&&"function"==typeof d&&(e=d),a[b]=function(){var a=c(e).apply(this,arguments);return void 0===a?this:a}}},{}],33:[function(a,b){b.exports=function(a,b,c){var d=Object.getOwnPropertyDescriptor(a,b),e=function(){};d&&"function"==typeof d.get&&(e=d.get),Object.defineProperty(a,b,{get:function(){var a=c(e).call(this);return void 0===a?this:a},configurable:!0})}},{}],34:[function(a,b){var c=a("./flag");b.exports=function(a,b){var d=c(a,"negate"),e=b[0];return d?!e:e}},{"./flag":21}],35:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));b.__flags||(b.__flags=Object.create(null)),c=3===arguments.length?c:!0;for(var e in d)(c||"object"!==e&&"ssfi"!==e&&"message"!=e)&&(b.__flags[e]=d[e])}},{}],36:[function(a,b){var c={"[object Arguments]":"arguments","[object Array]":"array","[object Date]":"date","[object Function]":"function","[object Number]":"number","[object RegExp]":"regexp","[object String]":"string"};b.exports=function(a){var b=Object.prototype.toString.call(a);return c[b]?c[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}},{}],37:[function(a,b){function c(){function a(a,c){Object.keys(c).forEach(function(d){~b.indexOf(d)||(a[d]=c[d])})}var b=[].slice.call(arguments);return function(){for(var b=[].slice.call(arguments),c=0,d={};c<b.length;c++)a(d,b[c]);return d}}function d(a,b,d){var e=c("name","message","stack","constructor","toJSON"),f=e(b||{});this.message=a||"Unspecified AssertionError",this.showDiff=!1;for(var g in f)this[g]=f[g];d=d||arguments.callee,d&&Error.captureStackTrace&&Error.captureStackTrace(this,d)}b.exports=d,d.prototype=Object.create(Error.prototype),d.prototype.name="AssertionError",d.prototype.constructor=d,d.prototype.toJSON=function(a){var b=c("constructor","toJSON","stack"),d=b({name:this.name},this);return!1!==a&&this.stack&&(d.stack=this.stack),d}},{}],38:[function(a,b){b.exports=a("./lib/eql")},{"./lib/eql":39}],39:[function(a,b){function c(a,b,c){return d(a,b)?!0:"date"===o(a)?f(a,b):"regexp"===o(a)?g(a,b):n.isBuffer(a)?k(a,b):"arguments"===o(a)?h(a,b,c):e(a,b)?"object"!==o(a)&&"object"!==o(b)&&"array"!==o(a)&&"array"!==o(b)?d(a,b):m(a,b,c):!1}function d(a,b){return a===b?0!==a||1/a===1/b:a!==a&&b!==b}function e(a,b){return o(a)===o(b)}function f(a,b){return"date"!==o(b)?!1:d(a.getTime(),b.getTime())}function g(a,b){return"regexp"!==o(b)?!1:d(a.toString(),b.toString())}function h(a,b,d){return"arguments"!==o(b)?!1:(a=[].slice.call(a),b=[].slice.call(b),c(a,b,d))}function i(a){var b=[];for(var c in a)b.push(c);return b}function j(a,b){if(a.length!==b.length)return!1;for(var c=0,d=!0;c<a.length;c++)if(a[c]!==b[c]){d=!1;break}return d}function k(a,b){return n.isBuffer(b)?j(a,b):!1}function l(a){return null!==a&&void 0!==a}function m(a,b,d){if(!l(a)||!l(b))return!1;if(a.prototype!==b.prototype)return!1;var e;if(d){for(e=0;e<d.length;e++)if(d[e][0]===a&&d[e][1]===b||d[e][0]===b&&d[e][1]===a)return!0}else d=[];try{var f=i(a),g=i(b)}catch(h){return!1}if(f.sort(),g.sort(),!j(f,g))return!1;d.push([a,b]);var k;for(e=f.length-1;e>=0;e--)if(k=f[e],!c(a[k],b[k],d))return!1;return!0}var n,o=a("type-detect");try{n=a("buffer").Buffer}catch(p){n={},n.isBuffer=function(){return!1}}b.exports=c},{buffer:42,"type-detect":40}],40:[function(a,b){b.exports=a("./lib/type")},{"./lib/type":41}],41:[function(a,b,c){function d(a){var b=Object.prototype.toString.call(a);return f[b]?f[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}function e(){this.tests={}}var c=b.exports=d,f={"[object Array]":"array","[object RegExp]":"regexp","[object Function]":"function","[object Arguments]":"arguments","[object Date]":"date"};c.Library=e,e.prototype.of=d,e.prototype.define=function(a,b){return 1===arguments.length?this.tests[a]:(this.tests[a]=b,this)},e.prototype.test=function(a,b){if(b===d(a))return!0;var c=this.tests[b];if(c&&"regexp"===d(c))return c.test(a);if(c&&"function"===d(c))return c(a);throw new ReferenceError('Type test "'+b+'" not defined or invalid.')}},{}],42:[function(a,b,c){function d(a,b,c){if(!(this instanceof d))return new d(a,b,c);var e,f=typeof a;if("number"===f)e=a>0?a>>>0:0;else if("string"===f)"base64"===b&&(a=C(a)),e=d.byteLength(a,b);else{if("object"!==f||null===a)throw new Error("First argument needs to be a number, array or string.");"Buffer"===a.type&&E(a.data)&&(a=a.data),e=+a.length>0?Math.floor(+a.length):0}var g;T?g=d._augment(new Uint8Array(e)):(g=this,g.length=e,g._isBuffer=!0);var h;if(T&&"number"==typeof a.byteLength)g._set(a);else if(F(a))if(d.isBuffer(a))for(h=0;e>h;h++)g[h]=a.readUInt8(h);else for(h=0;e>h;h++)g[h]=(a[h]%256+256)%256;else if("string"===f)g.write(a,0,b);else if("number"===f&&!T&&!c)for(h=0;e>h;h++)g[h]=0;return g}function e(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;Q(f%2===0,"Invalid hex string"),d>f/2&&(d=f/2);for(var g=0;d>g;g++){var h=parseInt(b.substr(2*g,2),16);Q(!isNaN(h),"Invalid hex string"),a[c+g]=h}return g}function f(a,b,c,d){var e=L(H(b),a,c,d);return e}function g(a,b,c,d){var e=L(I(b),a,c,d);return e}function h(a,b,c,d){return g(a,b,c,d)}function i(a,b,c,d){var e=L(K(b),a,c,d);return e}function j(a,b,c,d){var e=L(J(b),a,c,d);return e}function k(a,b,c){return R.fromByteArray(0===b&&c===a.length?a:a.slice(b,c))}function l(a,b,c){var d="",e="";c=Math.min(a.length,c);for(var f=b;c>f;f++)a[f]<=127?(d+=M(e)+String.fromCharCode(a[f]),e=""):e+="%"+a[f].toString(16);return d+M(e)}function m(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(a[e]);return d}function n(a,b,c){return m(a,b,c)}function o(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;f++)e+=G(a[f]);return e}function p(a,b,c){for(var d=a.slice(b,c),e="",f=0;f<d.length;f+=2)e+=String.fromCharCode(d[f]+256*d[f+1]);return e}function q(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(f=a[b],e>b+1&&(f|=a[b+1]<<8)):(f=a[b]<<8,e>b+1&&(f|=a[b+1])),f}}function r(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(e>b+2&&(f=a[b+2]<<16),e>b+1&&(f|=a[b+1]<<8),f|=a[b],e>b+3&&(f+=a[b+3]<<24>>>0)):(e>b+1&&(f=a[b+1]<<16),e>b+2&&(f|=a[b+2]<<8),e>b+3&&(f|=a[b+3]),f+=a[b]<<24>>>0),f}}function s(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=q(a,b,c,!0),g=32768&f;return g?-1*(65535-f+1):f}}function t(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=r(a,b,c,!0),g=2147483648&f;return g?-1*(4294967295-f+1):f}}function u(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+3<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,23,4)}function v(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+7<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,52,8)}function w(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"trying to write beyond buffer length"),N(b,65535));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,2);h>g;g++)a[c+g]=(b&255<<8*(d?g:1-g))>>>8*(d?g:1-g);return c+2}}function x(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"trying to write beyond buffer length"),N(b,4294967295));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,4);h>g;g++)a[c+g]=b>>>8*(d?g:3-g)&255;return c+4}}function y(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"Trying to write beyond buffer length"),O(b,32767,-32768));var f=a.length;return c>=f?void 0:(b>=0?w(a,b,c,d,e):w(a,65535+b+1,c,d,e),c+2)}function z(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),O(b,2147483647,-2147483648));var f=a.length;return c>=f?void 0:(b>=0?x(a,b,c,d,e):x(a,4294967295+b+1,c,d,e),c+4)}function A(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),P(b,3.4028234663852886e38,-3.4028234663852886e38));var f=a.length;return c>=f?void 0:(S.write(a,b,c,d,23,4),c+4)}function B(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+7<a.length,"Trying to write beyond buffer length"),P(b,1.7976931348623157e308,-1.7976931348623157e308));var f=a.length;return c>=f?void 0:(S.write(a,b,c,d,52,8),c+8)}function C(a){for(a=D(a).replace(V,"");a.length%4!==0;)a+="=";return a}function D(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function E(a){return(Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)})(a)}function F(a){return E(a)||d.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length}function G(a){return 16>a?"0"+a.toString(16):a.toString(16)}function H(a){for(var b=[],c=0;c<a.length;c++){var d=a.charCodeAt(c);if(127>=d)b.push(d);else{var e=c;d>=55296&&57343>=d&&c++;for(var f=encodeURIComponent(a.slice(e,c+1)).substr(1).split("%"),g=0;g<f.length;g++)b.push(parseInt(f[g],16))}}return b}function I(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function J(a){for(var b,c,d,e=[],f=0;f<a.length;f++)b=a.charCodeAt(f),c=b>>8,d=b%256,e.push(d),e.push(c);return e}function K(a){return R.toByteArray(a)}function L(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);e++)b[e+c]=a[e];return e}function M(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function N(a,b){Q("number"==typeof a,"cannot write a non-number as a number"),Q(a>=0,"specified a negative value for writing an unsigned value"),Q(b>=a,"value is larger than maximum value for type"),Q(Math.floor(a)===a,"value has a fractional component")}function O(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value"),Q(Math.floor(a)===a,"value has a fractional component")}function P(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value")}function Q(a,b){if(!a)throw new Error(b||"Failed assertion")}var R=a("base64-js"),S=a("ieee754");c.Buffer=d,c.SlowBuffer=d,c.INSPECT_MAX_BYTES=50,d.poolSize=8192;var T=function(){try{var a=new ArrayBuffer(0),b=new Uint8Array(a);return b.foo=function(){return 42},42===b.foo()&&"function"==typeof b.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(c){return!1}}();d.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.isBuffer=function(a){return!(null==a||!a._isBuffer)},d.byteLength=function(a,b){var c;switch(a=a.toString(),b||"utf8"){case"hex":c=a.length/2;break;case"utf8":case"utf-8":c=H(a).length;break;case"ascii":case"binary":case"raw":c=a.length;break;case"base64":c=K(a).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":c=2*a.length;break;default:throw new Error("Unknown encoding")}return c},d.concat=function(a,b){if(Q(E(a),"Usage: Buffer.concat(list[, length])"),0===a.length)return new d(0);if(1===a.length)return a[0];var c;if(void 0===b)for(b=0,c=0;c<a.length;c++)b+=a[c].length;var e=new d(b),f=0;for(c=0;c<a.length;c++){var g=a[c];g.copy(e,f),f+=g.length}return e},d.compare=function(a,b){Q(d.isBuffer(a)&&d.isBuffer(b),"Arguments must be Buffers");for(var c=a.length,e=b.length,f=0,g=Math.min(c,e);g>f&&a[f]===b[f];f++);return f!==g&&(c=a[f],e=b[f]),e>c?-1:c>e?1:0},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var k=d;d=b,b=c,c=k}b=Number(b)||0;var l=this.length-b;c?(c=Number(c),c>l&&(c=l)):c=l,d=String(d||"utf8").toLowerCase();var m;switch(d){case"hex":m=e(this,a,b,c);break;case"utf8":case"utf-8":m=f(this,a,b,c);break;case"ascii":m=g(this,a,b,c);break;case"binary":m=h(this,a,b,c);break;case"base64":m=i(this,a,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":m=j(this,a,b,c);break;default:throw new Error("Unknown encoding")}return m},d.prototype.toString=function(a,b,c){var d=this;if(a=String(a||"utf8").toLowerCase(),b=Number(b)||0,c=void 0===c?d.length:Number(c),c===b)return"";var e;switch(a){case"hex":e=o(d,b,c);break;case"utf8":case"utf-8":e=l(d,b,c);break;case"ascii":e=m(d,b,c);break;case"binary":e=n(d,b,c);break;case"base64":e=k(d,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":e=p(d,b,c);break;default:throw new Error("Unknown encoding")}return e},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},d.prototype.equals=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),0===d.compare(this,a)},d.prototype.compare=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),d.compare(this,a)},d.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||0===d||(d=this.length),b||(b=0),d!==c&&0!==a.length&&0!==e.length){Q(d>=c,"sourceEnd < sourceStart"),Q(b>=0&&b<a.length,"targetStart out of bounds"),Q(c>=0&&c<e.length,"sourceStart out of bounds"),Q(d>=0&&d<=e.length,"sourceEnd out of bounds"),d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);var f=d-c;if(100>f||!T)for(var g=0;f>g;g++)a[g+b]=this[g+c];else a._set(this.subarray(c,c+f),b)}},d.prototype.slice=function(a,b){var c=this.length;if(a=~~a,b=void 0===b?c:~~b,0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c),0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c),a>b&&(b=a),T)return d._augment(this.subarray(a,b));for(var e=b-a,f=new d(e,void 0,!0),g=0;e>g;g++)f[g]=this[g+a];return f},d.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},d.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},d.prototype.readUInt8=function(a,b){return b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),a>=this.length?void 0:this[a]},d.prototype.readUInt16LE=function(a,b){return q(this,a,!0,b)},d.prototype.readUInt16BE=function(a,b){return q(this,a,!1,b)},d.prototype.readUInt32LE=function(a,b){return r(this,a,!0,b)},d.prototype.readUInt32BE=function(a,b){return r(this,a,!1,b)},d.prototype.readInt8=function(a,b){if(b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),!(a>=this.length)){var c=128&this[a];return c?-1*(255-this[a]+1):this[a]}},d.prototype.readInt16LE=function(a,b){return s(this,a,!0,b)},d.prototype.readInt16BE=function(a,b){return s(this,a,!1,b)},d.prototype.readInt32LE=function(a,b){return t(this,a,!0,b)},d.prototype.readInt32BE=function(a,b){return t(this,a,!1,b)},d.prototype.readFloatLE=function(a,b){return u(this,a,!0,b)},d.prototype.readFloatBE=function(a,b){return u(this,a,!1,b)},d.prototype.readDoubleLE=function(a,b){return v(this,a,!0,b)},d.prototype.readDoubleBE=function(a,b){return v(this,a,!1,b)},d.prototype.writeUInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"trying to write beyond buffer length"),N(a,255)),b>=this.length?void 0:(this[b]=a,b+1)},d.prototype.writeUInt16LE=function(a,b,c){return w(this,a,b,!0,c)},d.prototype.writeUInt16BE=function(a,b,c){return w(this,a,b,!1,c)},d.prototype.writeUInt32LE=function(a,b,c){return x(this,a,b,!0,c)},d.prototype.writeUInt32BE=function(a,b,c){return x(this,a,b,!1,c)},d.prototype.writeInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"Trying to write beyond buffer length"),O(a,127,-128)),b>=this.length?void 0:(a>=0?this.writeUInt8(a,b,c):this.writeUInt8(255+a+1,b,c),b+1)},d.prototype.writeInt16LE=function(a,b,c){return y(this,a,b,!0,c)},d.prototype.writeInt16BE=function(a,b,c){return y(this,a,b,!1,c)},d.prototype.writeInt32LE=function(a,b,c){return z(this,a,b,!0,c)},d.prototype.writeInt32BE=function(a,b,c){return z(this,a,b,!1,c)},d.prototype.writeFloatLE=function(a,b,c){return A(this,a,b,!0,c)},d.prototype.writeFloatBE=function(a,b,c){return A(this,a,b,!1,c)},d.prototype.writeDoubleLE=function(a,b,c){return B(this,a,b,!0,c)},d.prototype.writeDoubleBE=function(a,b,c){return B(this,a,b,!1,c)},d.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),Q(c>=b,"end < start"),c!==b&&0!==this.length){Q(b>=0&&b<this.length,"start out of bounds"),Q(c>=0&&c<=this.length,"end out of bounds");var d;if("number"==typeof a)for(d=b;c>d;d++)this[d]=a;else{var e=H(a.toString()),f=e.length;for(d=b;c>d;d++)this[d]=e[d%f]}return this}},d.prototype.inspect=function(){for(var a=[],b=this.length,d=0;b>d;d++)if(a[d]=G(this[d]),d===c.INSPECT_MAX_BYTES){a[d+1]="...";break}return"<Buffer "+a.join(" ")+">"},d.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(T)return new d(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;c>b;b+=1)a[b]=this[b];return a.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var U=d.prototype;d._augment=function(a){return a._isBuffer=!0,a._get=a.get,a._set=a.set,a.get=U.get,a.set=U.set,a.write=U.write,a.toString=U.toString,a.toLocaleString=U.toString,a.toJSON=U.toJSON,a.equals=U.equals,a.compare=U.compare,a.copy=U.copy,a.slice=U.slice,a.readUInt8=U.readUInt8,a.readUInt16LE=U.readUInt16LE,a.readUInt16BE=U.readUInt16BE,a.readUInt32LE=U.readUInt32LE,a.readUInt32BE=U.readUInt32BE,a.readInt8=U.readInt8,a.readInt16LE=U.readInt16LE,a.readInt16BE=U.readInt16BE,a.readInt32LE=U.readInt32LE,a.readInt32BE=U.readInt32BE,a.readFloatLE=U.readFloatLE,a.readFloatBE=U.readFloatBE,a.readDoubleLE=U.readDoubleLE,a.readDoubleBE=U.readDoubleBE,a.writeUInt8=U.writeUInt8,a.writeUInt16LE=U.writeUInt16LE,a.writeUInt16BE=U.writeUInt16BE,a.writeUInt32LE=U.writeUInt32LE,a.writeUInt32BE=U.writeUInt32BE,a.writeInt8=U.writeInt8,a.writeInt16LE=U.writeInt16LE,a.writeInt16BE=U.writeInt16BE,a.writeInt32LE=U.writeInt32LE,a.writeInt32BE=U.writeInt32BE,a.writeFloatLE=U.writeFloatLE,a.writeFloatBE=U.writeFloatBE,a.writeDoubleLE=U.writeDoubleLE,a.writeDoubleBE=U.writeDoubleBE,a.fill=U.fill,a.inspect=U.inspect,a.toArrayBuffer=U.toArrayBuffer,a};var V=/[^+\/0-9A-z]/g},{"base64-js":43,ieee754:44}],43:[function(a,b,c){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(a){"use strict";function b(a){var b=a.charCodeAt(0);return b===g?62:b===h?63:i>b?-1:i+10>b?b-i+26+26:k+26>b?b-k:j+26>b?b-j+26:void 0}function c(a){function c(a){j[l++]=a}var d,e,g,h,i,j;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new f(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,e=0;g>d;d+=4,e+=3)h=b(a.charAt(d))<<18|b(a.charAt(d+1))<<12|b(a.charAt(d+2))<<6|b(a.charAt(d+3)),c((16711680&h)>>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function e(a){function b(a){return d.charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var e,f,g,h=a.length%3,i="";for(e=0,g=a.length-h;g>e;e+=3)f=(a[e]<<16)+(a[e+1]<<8)+a[e+2],i+=c(f);switch(h){case 1:f=a[a.length-1],i+=b(f>>2),i+=b(f<<4&63),i+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],i+=b(f>>10),i+=b(f>>4&63),i+=b(f<<2&63),i+="="}return i}var f="undefined"!=typeof Uint8Array?Uint8Array:Array,g="+".charCodeAt(0),h="/".charCodeAt(0),i="0".charCodeAt(0),j="a".charCodeAt(0),k="A".charCodeAt(0);a.toByteArray=c,a.fromByteArray=e}("undefined"==typeof c?this.base64js={}:c)},{}],44:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],45:[function(a,b){b.exports="function"==typeof Object.create?function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],46:[function(a,b){function c(){}var d=b.exports={};d.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var d=c.shift();d()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.binding=function(){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(){throw new Error("process.chdir is not supported")}},{}],47:[function(a,b){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8
|
||
}},{}],48:[function(a,b,c){(function(b,d){function e(a,b){var d={seen:[],stylize:g};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),p(b)?d.showHidden=b:b&&c._extend(d,b),v(d.showHidden)&&(d.showHidden=!1),v(d.depth)&&(d.depth=2),v(d.colors)&&(d.colors=!1),v(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=f),i(d,a,d.depth)}function f(a,b){var c=e.styles[b];return c?"["+e.colors[c][0]+"m"+a+"["+e.colors[c][1]+"m":a}function g(a){return a}function h(a){var b={};return a.forEach(function(a){b[a]=!0}),b}function i(a,b,d){if(a.customInspect&&b&&A(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return t(e)||(e=i(a,e,d)),e}var f=j(a,b);if(f)return f;var g=Object.keys(b),p=h(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),z(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return k(b);if(0===g.length){if(A(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(w(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(y(b))return a.stylize(Date.prototype.toString.call(b),"date");if(z(b))return k(b)}var r="",s=!1,u=["{","}"];if(o(b)&&(s=!0,u=["[","]"]),A(b)){var v=b.name?": "+b.name:"";r=" [Function"+v+"]"}if(w(b)&&(r=" "+RegExp.prototype.toString.call(b)),y(b)&&(r=" "+Date.prototype.toUTCString.call(b)),z(b)&&(r=" "+k(b)),0===g.length&&(!s||0==b.length))return u[0]+r+u[1];if(0>d)return w(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var x;return x=s?l(a,b,d,p,g):g.map(function(c){return m(a,b,d,p,c,s)}),a.seen.pop(),n(x,r,u)}function j(a,b){if(v(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return s(b)?a.stylize(""+b,"number"):p(b)?a.stylize(""+b,"boolean"):q(b)?a.stylize("null","null"):void 0}function k(a){return"["+Error.prototype.toString.call(a)+"]"}function l(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(F(b,String(g))?m(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(m(a,b,c,d,e,!0))}),f}function m(a,b,c,d,e,f){var g,h,j;if(j=Object.getOwnPropertyDescriptor(b,e)||{value:b[e]},j.get?h=j.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):j.set&&(h=a.stylize("[Setter]","special")),F(d,e)||(g="["+e+"]"),h||(a.seen.indexOf(j.value)<0?(h=q(c)?i(a,j.value,null):i(a,j.value,c-1),h.indexOf("\n")>-1&&(h=f?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),v(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function n(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function o(a){return Array.isArray(a)}function p(a){return"boolean"==typeof a}function q(a){return null===a}function r(a){return null==a}function s(a){return"number"==typeof a}function t(a){return"string"==typeof a}function u(a){return"symbol"==typeof a}function v(a){return void 0===a}function w(a){return x(a)&&"[object RegExp]"===C(a)}function x(a){return"object"==typeof a&&null!==a}function y(a){return x(a)&&"[object Date]"===C(a)}function z(a){return x(a)&&("[object Error]"===C(a)||a instanceof Error)}function A(a){return"function"==typeof a}function B(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function C(a){return Object.prototype.toString.call(a)}function D(a){return 10>a?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),J[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=/%[sdj%]/g;c.format=function(a){if(!t(a)){for(var b=[],c=0;c<arguments.length;c++)b.push(e(arguments[c]));return b.join(" ")}for(var c=1,d=arguments,f=d.length,g=String(a).replace(G,function(a){if("%%"===a)return"%";if(c>=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(b){return"[Circular]"}default:return a}}),h=d[c];f>c;h=d[++c])g+=q(h)||!x(h)?" "+h:" "+e(h);return g},c.deprecate=function(a,e){function f(){if(!g){if(b.throwDeprecation)throw new Error(e);b.traceDeprecation?console.trace(e):console.error(e),g=!0}return a.apply(this,arguments)}if(v(d.process))return function(){return c.deprecate(a,e).apply(this,arguments)};if(b.noDeprecation===!0)return a;var g=!1;return f};var H,I={};c.debuglog=function(a){if(v(H)&&(H=b.env.NODE_DEBUG||""),a=a.toUpperCase(),!I[a])if(new RegExp("\\b"+a+"\\b","i").test(H)){var d=b.pid;I[a]=function(){var b=c.format.apply(c,arguments);console.error("%s %d: %s",a,d,b)}}else I[a]=function(){};return I[a]},c.inspect=e,e.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},e.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},c.isArray=o,c.isBoolean=p,c.isNull=q,c.isNullOrUndefined=r,c.isNumber=s,c.isString=t,c.isSymbol=u,c.isUndefined=v,c.isRegExp=w,c.isObject=x,c.isDate=y,c.isError=z,c.isFunction=A,c.isPrimitive=B,c.isBuffer=a("./support/isBuffer");var J=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c.log=function(){console.log("%s - %s",E(),c.format.apply(c,arguments))},c.inherits=a("inherits"),c._extend=function(a,b){if(!b||!x(b))return a;for(var c=Object.keys(b),d=c.length;d--;)a[c[d]]=b[c[d]];return a}}).call(this,a("JkpR2F"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":47,JkpR2F:46,inherits:45}],49:[function(a,b,c){!function(d){"use strict";"function"==typeof a&&"object"==typeof c&&"object"==typeof b?b.exports=d:"function"==typeof define&&define.amd?define(function(){return d}):chai.use(d)}(function(a,b){"use strict";function c(a){return"function"==typeof a&&"function"==typeof a.getCall&&"function"==typeof a.calledWithExactly}function d(a){return 1===a?"once":2===a?"twice":3===a?"thrice":(a||0)+" times"}function e(a){return a&&c(a.proxy)}function f(a){if(!c(a._obj)&&!e(a._obj))throw new TypeError(b.inspect(a._obj)+" is not a spy or a call to a spy!")}function g(a,b,d,e,f){function g(b){return a.printf.apply(a,b)}var h=e?"always have ":"have ";return d=d||"",c(a.proxy)&&(a=a.proxy),{affirmative:g(["expected %n to "+h+b+d].concat(f)),negative:g(["expected %n to not "+h+b].concat(f))}}function h(c,d,e){b.addProperty(a.Assertion.prototype,c,function(){f(this);var a=g(this._obj,d,e,!1);this.assert(this._obj[c],a.affirmative,a.negative)})}function i(c,e,h){b.addMethod(a.Assertion.prototype,c,function(a){f(this);var b=g(this._obj,e,h,!1,[d(a)]);this.assert(this._obj[c]===a,b.affirmative,b.negative)})}function j(a,c,d){return function(){f(this);var e="always"+a[0].toUpperCase()+a.substring(1),h=b.flag(this,"always")&&"function"==typeof this._obj[e],i=h?e:a,j=g(this._obj,c,d,h,n.call(arguments));this.assert(this._obj[i].apply(this._obj,arguments),j.affirmative,j.negative)}}function k(c,d,e){var f=j(c,d,e);b.addProperty(a.Assertion.prototype,c,f)}function l(c,d,e,f){var g=j(d,e,f);b.addMethod(a.Assertion.prototype,c,g)}function m(a,b,c){l(a,a,b,c)}var n=Array.prototype.slice;b.addProperty(a.Assertion.prototype,"always",function(){b.flag(this,"always",!0)}),h("called","been called"," at least once, but it was never called"),i("callCount","been called exactly %1",", but it was called %c%C"),h("calledOnce","been called exactly once",", but it was called %c%C"),h("calledTwice","been called exactly twice",", but it was called %c%C"),h("calledThrice","been called exactly thrice",", but it was called %c%C"),k("calledWithNew","been called with new"),m("calledBefore","been called before %1"),m("calledAfter","been called after %1"),m("calledOn","been called with %1 as this",", but it was called with %t instead"),m("calledWith","been called with arguments %*","%C"),m("calledWithExactly","been called with exact arguments %*","%C"),m("calledWithMatch","been called with arguments matching %*","%C"),m("returned","returned %1"),l("thrown","threw","thrown %1")})},{}],50:[function(a,b,c){"use strict";!function(d){function e(a){var b=!1;try{a.appendChild(l),b=l.parentNode==a}catch(c){return!1}finally{try{a.removeChild(l)}catch(c){}}return b}function f(a){return l&&a&&1===a.nodeType&&e(a)}function g(a){return"function"==typeof a||!!(a&&a.constructor&&a.call&&a.apply)}function h(a){return"number"==typeof a&&isNaN(a)}function i(a,b){for(var c in b)m.call(a,c)||(a[c]=b[c])}function j(a){return"function"==typeof a&&"function"==typeof a.restore&&a.restore.sinon}function k(a,b,c){c.exports=n,n.spy=a("./sinon/spy"),n.spyCall=a("./sinon/call"),n.behavior=a("./sinon/behavior"),n.stub=a("./sinon/stub"),n.mock=a("./sinon/mock"),n.collection=a("./sinon/collection"),n.assert=a("./sinon/assert"),n.sandbox=a("./sinon/sandbox"),n.test=a("./sinon/test"),n.testCase=a("./sinon/test_case"),n.match=a("./sinon/match")}var l="undefined"!=typeof document&&document.createElement("div"),m=Object.prototype.hasOwnProperty,n={wrapMethod:function(a,b,c){if(!a)throw new TypeError("Should wrap property of object");if("function"!=typeof c)throw new TypeError("Method wrapper should be function");var d,e=a[b];if(g(e)){if(e.restore&&e.restore.sinon)d=new TypeError("Attempted to wrap "+b+" which is already wrapped");else if(e.calledBefore){var f=e.returns?"stubbed":"spied on";d=new TypeError("Attempted to wrap "+b+" which is already "+f)}}else d=new TypeError("Attempted to wrap "+typeof e+" property "+b+" as function");if(d)throw e&&e._stack&&(d.stack+="\n--------------\n"+e._stack),d;var h=a.hasOwnProperty?a.hasOwnProperty(b):m.call(a,b);return a[b]=c,c.displayName=b,c._stack=new Error("Stack Trace for original").stack,c.restore=function(){h||delete a[b],a[b]===c&&(a[b]=e)},c.restore.sinon=!0,i(c,e),c},extend:function(a){for(var b=1,c=arguments.length;c>b;b+=1)for(var d in arguments[b])arguments[b].hasOwnProperty(d)&&(a[d]=arguments[b][d]),arguments[b].hasOwnProperty("toString")&&arguments[b].toString!=a.toString&&(a.toString=arguments[b].toString);return a},create:function(a){var b=function(){};return b.prototype=a,new b},deepEqual:function t(a,b){if(n.match&&n.match.isMatcher(a))return a.test(b);if("object"!=typeof a||"object"!=typeof b)return h(a)&&h(b)?!0:a===b;if(f(a)||f(b))return a===b;if(a===b)return!0;if(null===a&&null!==b||null!==a&&null===b)return!1;if(a instanceof RegExp&&b instanceof RegExp)return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;var c=Object.prototype.toString.call(a);if(c!=Object.prototype.toString.call(b))return!1;if("[object Date]"==c)return a.valueOf()===b.valueOf();var d,e=0,g=0;if("[object Array]"==c&&a.length!==b.length)return!1;for(d in a){if(e+=1,!(d in b))return!1;if(!t(a[d],b[d]))return!1}for(d in b)g+=1;return e==g},functionName:function(a){var b=a.displayName||a.name;if(!b){var c=a.toString().match(/function ([^\s\(]+)/);b=c&&c[1]}return b},functionToString:function(){if(this.getCall&&this.callCount)for(var a,b,c=this.callCount;c--;){a=this.getCall(c).thisValue;for(b in a)if(a[b]===this)return b}return this.displayName||"sinon fake"},getConfig:function(a){var b={};a=a||{};var c=n.defaultConfig;for(var d in c)c.hasOwnProperty(d)&&(b[d]=a.hasOwnProperty(d)?a[d]:c[d]);return b},format:function(a){return""+a},defaultConfig:{injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},timesInWords:function(a){return 1==a&&"once"||2==a&&"twice"||3==a&&"thrice"||(a||0)+" times"},calledInOrder:function(a){for(var b=1,c=a.length;c>b;b++)if(!a[b-1].calledBefore(a[b])||!a[b].called)return!1;return!0},orderByFirstCall:function(a){return a.sort(function(a,b){var c=a.getCall(0),d=b.getCall(0),e=c&&c.callId||-1,f=d&&d.callId||-1;return f>e?-1:1})},log:function(){},logError:function(a,b){var c=a+" threw exception: ";n.log(c+"["+b.name+"] "+b.message),b.stack&&n.log(b.stack),setTimeout(function(){throw b.message=c+b.message,b},0)},typeOf:function(a){if(null===a)return"null";if(void 0===a)return"undefined";var b=Object.prototype.toString.call(a);return b.substring(8,b.length-1).toLowerCase()},createStubInstance:function(a){if("function"!=typeof a)throw new TypeError("The constructor should be a function.");return n.stub(n.create(a.prototype))},restore:function(a){if(null!==a&&"object"==typeof a)for(var b in a)j(a[b])&&a[b].restore();else j(a)&&a.restore()}},o="undefined"!=typeof b&&b.exports&&"function"==typeof a,p="function"==typeof define&&"object"==typeof define.amd&&define.amd;if(p)define(k);else if(o){try{d=a("formatio")}catch(q){}k(a,c,b)}if(d){var r=d.configure({quoteStrings:!1});n.format=function(){return r.ascii.apply(r,arguments)}}else if(o)try{var s=a("util");n.format=function(a){return"object"==typeof a&&a.toString===Object.prototype.toString?s.inspect(a):a}}catch(q){}return n}("object"==typeof formatio&&formatio)},{"./sinon/assert":51,"./sinon/behavior":52,"./sinon/call":53,"./sinon/collection":54,"./sinon/match":55,"./sinon/mock":56,"./sinon/sandbox":57,"./sinon/spy":58,"./sinon/stub":59,"./sinon/test":60,"./sinon/test_case":61,formatio:63,util:48}],51:[function(a,b){(function(c){"use strict";!function(c,d){function e(){for(var a,b=0,c=arguments.length;c>b;++b)a=arguments[b],a||i.fail("fake is not a spy"),"function"!=typeof a&&i.fail(a+" is not a function"),"function"!=typeof a.getCall&&i.fail(a+" is not stubbed")}function f(a,b){a=a||d;var c=a.fail||i.fail;c.call(a,b)}function g(a,b,c){2==arguments.length&&(c=b,b=a),i[a]=function(d){e(d);var g=k.call(arguments,1),h=!1;h="function"==typeof b?!b(d):"function"==typeof d[b]?!d[b].apply(d,g):!d[b],h?f(this,d.printf.apply(d,[c].concat(g))):i.pass(a)}}function h(a,b){return!a||/^fail/.test(b)?b:a+b.slice(0,1).toUpperCase()+b.slice(1)}var i,j="undefined"!=typeof b&&b.exports&&"function"==typeof a,k=Array.prototype.slice;!c&&j&&(c=a("../sinon")),c&&(i={failException:"AssertError",fail:function(a){var b=new Error(a);throw b.name=this.failException||i.failException,b},pass:function(){},callOrder:function(){e.apply(null,arguments);var a="",b="";if(c.calledInOrder(arguments))i.pass("callOrder");else{try{a=[].join.call(arguments,", ");for(var d=k.call(arguments),g=d.length;g;)d[--g].called||d.splice(g,1);b=c.orderByFirstCall(d).join(", ")}catch(h){}f(this,"expected "+a+" to be called in order but were called as "+b)}},callCount:function(a,b){if(e(a),a.callCount!=b){var d="expected %n to be called "+c.timesInWords(b)+" but was called %c%C";f(this,a.printf(d))}else i.pass("callCount")},expose:function(a,b){if(!a)throw new TypeError("target is null or undefined");var c=b||{},d="undefined"==typeof c.prefix&&"assert"||c.prefix,e="undefined"==typeof c.includeFail||!!c.includeFail;for(var f in this)"export"==f||!e&&/^(fail)/.test(f)||(a[h(d,f)]=this[f]);return a},match:function(a,b){var d=c.match(b);if(d.test(a))i.pass("match");else{var e=["expected value to match"," expected = "+c.format(b)," actual = "+c.format(a)];f(this,e.join("\n"))}}},g("called","expected %n to have been called at least once but was never called"),g("notCalled",function(a){return!a.called},"expected %n to not have been called but was called %c%C"),g("calledOnce","expected %n to be called once but was called %c%C"),g("calledTwice","expected %n to be called twice but was called %c%C"),g("calledThrice","expected %n to be called thrice but was called %c%C"),g("calledOn","expected %n to be called with %1 as this but was called with %t"),g("alwaysCalledOn","expected %n to always be called with %1 as this but was called with %t"),g("calledWithNew","expected %n to be called with new"),g("alwaysCalledWithNew","expected %n to always be called with new"),g("calledWith","expected %n to be called with arguments %*%C"),g("calledWithMatch","expected %n to be called with match %*%C"),g("alwaysCalledWith","expected %n to always be called with arguments %*%C"),g("alwaysCalledWithMatch","expected %n to always be called with match %*%C"),g("calledWithExactly","expected %n to be called with exact arguments %*%C"),g("alwaysCalledWithExactly","expected %n to always be called with exact arguments %*%C"),g("neverCalledWith","expected %n to never be called with arguments %*%C"),g("neverCalledWithMatch","expected %n to never be called with match %*%C"),g("threw","%n did not throw exception%C"),g("alwaysThrew","%n did not always throw exception%C"),c.assert=i,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=i}):j&&(b.exports=i))}("object"==typeof sinon&&sinon||null,"undefined"!=typeof window?window:"undefined"!=typeof self?self:c)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../sinon":50}],52:[function(a,b){(function(c){"use strict";!function(d){function e(a,b){return"string"==typeof a?(this.exception=new Error(b||""),this.exception.name=a):this.exception=a?a:new Error("Error"),this}function f(a,b){var c=a.callArgAt;if(0>c){for(var d=a.callArgProp,e=0,f=b.length;f>e;++e){if(!d&&"function"==typeof b[e])return b[e];if(d&&b[e]&&"function"==typeof b[e][d])return b[e][d]}return null}return b[c]}function g(a,b,c){if(a.callArgAt<0){var e;return e=a.callArgProp?d.functionName(a.stub)+" expected to yield to '"+a.callArgProp+"', but no object with such a property was passed.":d.functionName(a.stub)+" expected to yield, but no callback was passed.",c.length>0&&(e+=" Received ["+l.call(c,", ")+"]"),e}return"argument at index "+a.callArgAt+" is not a function: "+b}function h(a,b){if("number"==typeof a.callArgAt){var c=f(a,b);if("function"!=typeof c)throw new TypeError(g(a,c,b));a.callbackAsync?m(function(){c.apply(a.callbackContext,a.callbackArguments)}):c.apply(a.callbackContext,a.callbackArguments)}}var i="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!d&&i&&(d=a("../sinon")),d){var j,k=Array.prototype.slice,l=Array.prototype.join,m=function(){return"object"==typeof c&&"function"==typeof c.nextTick?c.nextTick:"function"==typeof setImmediate?setImmediate:function(a){setTimeout(a,0)}}();j={create:function(a){var b=d.extend({},d.behavior);return delete b.create,b.stub=a,b},isPresent:function(){return"number"==typeof this.callArgAt||this.exception||"number"==typeof this.returnArgAt||this.returnThis||this.returnValueDefined},invoke:function(a,b){if(h(this,b),this.exception)throw this.exception;return"number"==typeof this.returnArgAt?b[this.returnArgAt]:this.returnThis?a:this.returnValue},onCall:function(a){return this.stub.onCall(a)},onFirstCall:function(){return this.stub.onFirstCall()},onSecondCall:function(){return this.stub.onSecondCall()},onThirdCall:function(){return this.stub.onThirdCall()},withArgs:function(){throw new Error('Defining a stub by invoking "stub.onCall(...).withArgs(...)" is not supported. Use "stub.withArgs(...).onCall(...)" to define sequential behavior for calls with certain arguments.')},callsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOn:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgWith:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.callArgAt=a,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOnWith:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},yields:function(){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,0),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsOn:function(a){if("object"!=typeof a)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=a,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsTo:function(a){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=a,this.callbackAsync=!1,this},yieldsToOn:function(a,b){if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=a,this.callbackAsync=!1,this},"throws":e,throwsException:e,returns:function(a){return this.returnValue=a,this.returnValueDefined=!0,this},returnsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.returnArgAt=a,this},returnsThis:function(){return this.returnThis=!0,this}};for(var n in j)j.hasOwnProperty(n)&&n.match(/^(callsArg|yields)/)&&!n.match(/Async/)&&(j[n+"Async"]=function(a){return function(){var b=this[a].apply(this,arguments);return this.callbackAsync=!0,b}}(n));d.behavior=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):i&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)}).call(this,a("JkpR2F"))},{"../sinon":50,JkpR2F:46}],53:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.functionName(a)+b;throw d.length&&(e+=" Received ["+g.call(d).join(", ")+"]"),new Error(e)}function e(a,b,d,e,f,g){if("number"!=typeof g)throw new TypeError("Call id is not a number");var i=c.create(h);return i.proxy=a,i.thisValue=b,i.args=d,i.returnValue=e,i.exception=f,i.callId=g,i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&f&&(c=a("../sinon")),c){var g=Array.prototype.slice,h={calledOn:function(a){return c.match&&c.match.isMatcher(a)?a.test(this.thisValue):this.thisValue===a},calledWith:function(){for(var a=0,b=arguments.length;b>a;a+=1)if(!c.deepEqual(arguments[a],this.args[a]))return!1;return!0},calledWithMatch:function(){for(var a=0,b=arguments.length;b>a;a+=1){var d=this.args[a],e=arguments[a];if(!c.match||!c.match(e).test(d))return!1}return!0},calledWithExactly:function(){return arguments.length==this.args.length&&this.calledWith.apply(this,arguments)},notCalledWith:function(){return!this.calledWith.apply(this,arguments)},notCalledWithMatch:function(){return!this.calledWithMatch.apply(this,arguments)},returned:function(a){return c.deepEqual(a,this.returnValue)},threw:function(a){return"undefined"!=typeof a&&this.exception?this.exception===a||this.exception.name===a:!!this.exception},calledWithNew:function(){return this.proxy.prototype&&this.thisValue instanceof this.proxy},calledBefore:function(a){return this.callId<a.callId},calledAfter:function(a){return this.callId>a.callId},callArg:function(a){this.args[a]()},callArgOn:function(a,b){this.args[a].apply(b)},callArgWith:function(a){this.callArgOnWith.apply(this,[a,null].concat(g.call(arguments,1)))},callArgOnWith:function(a,b){var c=g.call(arguments,2);this.args[a].apply(b,c)},"yield":function(){this.yieldOn.apply(this,[null].concat(g.call(arguments,0)))},yieldOn:function(a){for(var b=this.args,c=0,e=b.length;e>c;++c)if("function"==typeof b[c])return void b[c].apply(a,g.call(arguments,1));d(this.proxy," cannot yield since no callback was passed.",b)},yieldTo:function(a){this.yieldToOn.apply(this,[a,null].concat(g.call(arguments,1)))},yieldToOn:function(a,b){for(var c=this.args,e=0,f=c.length;f>e;++e)if(c[e]&&"function"==typeof c[e][a])return void c[e][a].apply(b,g.call(arguments,2));d(this.proxy," cannot yield to '"+a+"' since no callback was passed.",c)},toString:function(){for(var a=this.proxy.toString()+"(",b=[],d=0,e=this.args.length;e>d;++d)b.push(c.format(this.args[d]));return a=a+b.join(", ")+")","undefined"!=typeof this.returnValue&&(a+=" => "+c.format(this.returnValue)),this.exception&&(a+=" !"+this.exception.name,this.exception.message&&(a+="("+this.exception.message+")")),a}};h.invokeCallback=h.yield,e.toString=h.toString,c.spyCall=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],54:[function(a,b){"use strict";!function(c){function d(a){return a.fakes||(a.fakes=[]),a.fakes}function e(a,b){for(var c=d(a),e=0,f=c.length;f>e;e+=1)"function"==typeof c[e][b]&&c[e][b]()}function f(a){for(var b=d(a),c=0;c<b.length;)b.splice(c,1)}var g="undefined"!=typeof b&&b.exports&&"function"==typeof a,h=[].push,i=Object.prototype.hasOwnProperty;if(!c&&g&&(c=a("../sinon")),c){var j={verify:function(){e(this,"verify")},restore:function(){e(this,"restore"),f(this)},verifyAndRestore:function(){var a;try{this.verify()}catch(b){a=b}if(this.restore(),a)throw a},add:function(a){return h.call(d(this),a),a},spy:function(){return this.add(c.spy.apply(c,arguments))},stub:function(a,b,d){if(b){var e=a[b];if("function"!=typeof e){if(!i.call(a,b))throw new TypeError("Cannot stub non-existent own property "+b);return a[b]=d,this.add({restore:function(){a[b]=e}})}}if(!b&&a&&"object"==typeof a){var f=c.stub.apply(c,arguments);for(var g in f)"function"==typeof f[g]&&this.add(f[g]);return f}return this.add(c.stub.apply(c,arguments))},mock:function(){return this.add(c.mock.apply(c,arguments))},inject:function(a){var b=this;return a.spy=function(){return b.spy.apply(b,arguments)},a.stub=function(){return b.stub.apply(b,arguments)},a.mock=function(){return b.mock.apply(b,arguments)},a}};c.collection=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):g&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],55:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.typeOf(a);if(e!==b)throw new TypeError("Expected type of "+d+" to be "+b+", but was "+e)}function e(a){return i.isPrototypeOf(a)}function f(a,b){if(null===b||void 0===b)return!1;for(var d in a)if(a.hasOwnProperty(d)){var e=a[d],g=b[d];if(j.isMatcher(e)){if(!e.test(g))return!1}else if("object"===c.typeOf(e)){if(!f(e,g))return!1}else if(!c.deepEqual(e,g))return!1}return!0}function g(a,b){return function(e,f){d(e,"string","property");var g=1===arguments.length,h=b+'("'+e+'"';return g||(h+=", "+f),h+=")",j(function(b){return void 0!==b&&null!==b&&a(b,e)?g||c.deepEqual(f,b[e]):!1},h)}}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i={toString:function(){return this.message}};i.or=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)||a.test(c)},d.message=b.message+".or("+a.message+")",d},i.and=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)&&a.test(c)},d.message=b.message+".and("+a.message+")",d};var j=function(a,b){var d=c.create(i),e=c.typeOf(a);switch(e){case"object":if("function"==typeof a.test)return d.test=function(b){return a.test(b)===!0},d.message="match("+c.functionName(a.test)+")",d;var g=[];for(var h in a)a.hasOwnProperty(h)&&g.push(h+": "+a[h]);d.test=function(b){return f(a,b)},d.message="match("+g.join(", ")+")";break;case"number":d.test=function(b){return a==b};break;case"string":d.test=function(b){return"string"!=typeof b?!1:-1!==b.indexOf(a)},d.message='match("'+a+'")';break;case"regexp":d.test=function(b){return"string"!=typeof b?!1:a.test(b)};break;case"function":d.test=a,d.message=b?b:"match("+c.functionName(a)+")";break;default:d.test=function(b){return c.deepEqual(a,b)}}return d.message||(d.message="match("+a+")"),d};j.isMatcher=e,j.any=j(function(){return!0},"any"),j.defined=j(function(a){return null!==a&&void 0!==a},"defined"),j.truthy=j(function(a){return!!a},"truthy"),j.falsy=j(function(a){return!a},"falsy"),j.same=function(a){return j(function(b){return a===b},"same("+a+")")},j.typeOf=function(a){return d(a,"string","type"),j(function(b){return c.typeOf(b)===a},'typeOf("'+a+'")')},j.instanceOf=function(a){return d(a,"function","type"),j(function(b){return b instanceof a},"instanceOf("+c.functionName(a)+")")},j.has=g(function(a,b){return"object"==typeof a?b in a:void 0!==a[b]},"has"),j.hasOwn=g(function(a,b){return a.hasOwnProperty(b)},"hasOwn"),j.bool=j.typeOf("boolean"),j.number=j.typeOf("number"),j.string=j.typeOf("string"),j.object=j.typeOf("object"),j.func=j.typeOf("function"),j.array=j.typeOf("array"),j.regexp=j.typeOf("regexp"),j.date=j.typeOf("date"),c.match=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):h&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],56:[function(a,b){"use strict";!function(c){function d(a){return a?d.create(a):c.expectation.create("Anonymous mock")}var e,f="undefined"!=typeof b&&b.exports&&"function"==typeof a,g=[].push;if(!c&&f&&(c=a("../sinon")),c){e=c.match,!e&&f&&(e=a("./match")),c.mock=d,c.extend(d,function(){function a(a,b){if(a)for(var c=0,d=a.length;d>c;c+=1)b(a[c])}return{create:function(a){if(!a)throw new TypeError("object is null");var b=c.extend({},d);return b.object=a,delete b.create,b},expects:function(a){if(!a)throw new TypeError("method is falsy");if(this.expectations||(this.expectations={},this.proxies=[]),!this.expectations[a]){this.expectations[a]=[];var b=this;c.wrapMethod(this.object,a,function(){return b.invokeMethod(a,this,arguments)}),g.call(this.proxies,a)}var d=c.expectation.create(a);return g.call(this.expectations[a],d),d},restore:function(){var b=this.object;a(this.proxies,function(a){"function"==typeof b[a].restore&&b[a].restore()})},verify:function(){var b=this.expectations||{},d=[],e=[];return a(this.proxies,function(c){a(b[c],function(a){a.met()?g.call(e,a.toString()):g.call(d,a.toString())})}),this.restore(),d.length>0?c.expectation.fail(d.concat(e).join("\n")):c.expectation.pass(d.concat(e).join("\n")),!0},invokeMethod:function(a,b,d){var e,f=this.expectations&&this.expectations[a],h=f&&f.length||0;for(e=0;h>e;e+=1)if(!f[e].met()&&f[e].allowsCall(b,d))return f[e].apply(b,d);var i,j=[],k=0;for(e=0;h>e;e+=1)f[e].allowsCall(b,d)?i=i||f[e]:k+=1,g.call(j," "+f[e].toString());return 0===k?i.apply(b,d):(j.unshift("Unexpected call: "+c.spyCall.toString.call({proxy:a,args:d})),void c.expectation.fail(j.join("\n")))}}}());var h=c.timesInWords;c.expectation=function(){function a(a){return 0==a?"never called":"called "+h(a)}function b(a){var b=a.minCalls,c=a.maxCalls;if("number"==typeof b&&"number"==typeof c){var d=h(b);return b!=c&&(d="at least "+d+" and at most "+h(c)),d}return"number"==typeof b?"at least "+h(b):"at most "+h(c)}function d(a){var b="number"==typeof a.minCalls;return!b||a.callCount>=a.minCalls}function f(a){return"number"!=typeof a.maxCalls?!1:a.callCount==a.maxCalls}function i(a,b){return e&&e.isMatcher(a)?a.test(b):!0}var j=Array.prototype.slice,k=c.spy.invoke;return{minCalls:1,maxCalls:1,create:function(a){var b=c.extend(c.stub.create(),c.expectation);return delete b.create,b.method=a,b},invoke:function(a,b,c){return this.verifyCallAllowed(b,c),k.apply(this,arguments)},atLeast:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");
|
||
return this.limitsSet||(this.maxCalls=null,this.limitsSet=!0),this.minCalls=a,this},atMost:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");return this.limitsSet||(this.minCalls=null,this.limitsSet=!0),this.maxCalls=a,this},never:function(){return this.exactly(0)},once:function(){return this.exactly(1)},twice:function(){return this.exactly(2)},thrice:function(){return this.exactly(3)},exactly:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not a number");return this.atLeast(a),this.atMost(a)},met:function(){return!this.failed&&d(this)},verifyCallAllowed:function(a,b){if(f(this)&&(this.failed=!0,c.expectation.fail(this.method+" already called "+h(this.maxCalls))),"expectedThis"in this&&this.expectedThis!==a&&c.expectation.fail(this.method+" called with "+a+" as thisValue, expected "+this.expectedThis),"expectedArguments"in this){b||c.expectation.fail(this.method+" received no arguments, expected "+c.format(this.expectedArguments)),b.length<this.expectedArguments.length&&c.expectation.fail(this.method+" received too few arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments)),this.expectsExactArgCount&&b.length!=this.expectedArguments.length&&c.expectation.fail(this.method+" received too many arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments));for(var d=0,e=this.expectedArguments.length;e>d;d+=1)i(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", didn't match "+this.expectedArguments.toString()),c.deepEqual(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", expected "+c.format(this.expectedArguments))}},allowsCall:function(a,b){if(this.met()&&f(this))return!1;if("expectedThis"in this&&this.expectedThis!==a)return!1;if(!("expectedArguments"in this))return!0;if(b=b||[],b.length<this.expectedArguments.length)return!1;if(this.expectsExactArgCount&&b.length!=this.expectedArguments.length)return!1;for(var d=0,e=this.expectedArguments.length;e>d;d+=1){if(!i(this.expectedArguments[d],b[d]))return!1;if(!c.deepEqual(this.expectedArguments[d],b[d]))return!1}return!0},withArgs:function(){return this.expectedArguments=j.call(arguments),this},withExactArgs:function(){return this.withArgs.apply(this,arguments),this.expectsExactArgCount=!0,this},on:function(a){return this.expectedThis=a,this},toString:function(){var d=(this.expectedArguments||[]).slice();this.expectsExactArgCount||g.call(d,"[...]");var e=c.spyCall.toString.call({proxy:this.method||"anonymous mock expectation",args:d}),f=e.replace(", [...","[, ...")+" "+b(this);return this.met()?"Expectation met: "+f:"Expected "+f+" ("+a(this.callCount)+")"},verify:function(){return this.met()?c.expectation.pass(this.toString()):c.expectation.fail(this.toString()),!0},pass:function(a){c.assert.pass(a)},fail:function(a){var b=new Error(a);throw b.name="ExpectationError",b}}}(),c.mock=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):f&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50,"./match":55}],57:[function(a,b){"use strict";if("undefined"!=typeof b&&b.exports&&"function"==typeof a){var c=a("../sinon");c.extend(c,a("./util/fake_timers"))}!function(){function a(a,b,c,d){d&&(!b.injectInto||c in b.injectInto?e.call(a.args,d):(b.injectInto[c]=d,a.injectedKeys.push(c)))}function d(a){var b=c.create(c.sandbox);return a.useFakeServer&&("object"==typeof a.useFakeServer&&(b.serverPrototype=a.useFakeServer),b.useFakeServer()),a.useFakeTimers&&("object"==typeof a.useFakeTimers?b.useFakeTimers.apply(b,a.useFakeTimers):b.useFakeTimers()),b}var e=[].push;c.sandbox=c.extend(c.create(c.collection),{useFakeTimers:function(){return this.clock=c.useFakeTimers.apply(c,arguments),this.add(this.clock)},serverPrototype:c.fakeServer,useFakeServer:function(){var a=this.serverPrototype||c.fakeServer;return a&&a.create?(this.server=a.create(),this.add(this.server)):null},inject:function(a){return c.collection.inject.call(this,a),this.clock&&(a.clock=this.clock),this.server&&(a.server=this.server,a.requests=this.server.requests),a},restore:function(){c.collection.restore.apply(this,arguments),this.restoreContext()},restoreContext:function(){if(this.injectedKeys){for(var a=0,b=this.injectedKeys.length;b>a;a++)delete this.injectInto[this.injectedKeys[a]];this.injectedKeys=[]}},create:function(b){if(!b)return c.create(c.sandbox);var e=d(b);e.args=e.args||[],e.injectedKeys=[],e.injectInto=b.injectInto;var f,g,h=e.inject({});if(b.properties)for(var i=0,j=b.properties.length;j>i;i++)f=b.properties[i],g=h[f]||"sandbox"==f&&e,a(e,b,f,g);else a(e,b,"sandbox",g);return e}}),c.sandbox.useFakeXMLHttpRequest=c.sandbox.useFakeServer,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=c.sandbox}):"undefined"!=typeof b&&b.exports&&(b.exports=c.sandbox)}()},{"../sinon":50,"./util/fake_timers":62}],58:[function(require,module,exports){"use strict";!function(sinon){function spy(a,b){if(!b&&"function"==typeof a)return spy.create(a);if(!a&&!b)return spy.create(function(){});var c=a[b];return sinon.wrapMethod(a,b,spy.create(c))}function matchingFake(a,b,c){if(a)for(var d=0,e=a.length;e>d;d++)if(a[d].matches(b,c))return a[d]}function incrementCallCount(){this.called=!0,this.callCount+=1,this.notCalled=!1,this.calledOnce=1==this.callCount,this.calledTwice=2==this.callCount,this.calledThrice=3==this.callCount}function createCallProperties(){this.firstCall=this.getCall(0),this.secondCall=this.getCall(1),this.thirdCall=this.getCall(2),this.lastCall=this.getCall(this.callCount-1)}function createProxy(func){var p;return func.length?eval("p = (function proxy("+vars.substring(0,2*func.length-1)+") { return p.invoke(func, this, slice.call(arguments)); });"):p=function(){return p.invoke(func,this,slice.call(arguments))},p}function delegateToCalls(a,b,c,d){spyApi[a]=function(){if(!this.called)return d?d.apply(this,arguments):!1;for(var e,f=0,g=0,h=this.callCount;h>g;g+=1)if(e=this.getCall(g),e[c||a].apply(e,arguments)&&(f+=1,b))return!0;return f===this.callCount}}var commonJSModule="undefined"!=typeof module&&module.exports&&"function"==typeof require,push=Array.prototype.push,slice=Array.prototype.slice,callId=0;if(!sinon&&commonJSModule&&(sinon=require("../sinon")),sinon){var vars="a,b,c,d,e,f,g,h,i,j,k,l",uuid=0,spyApi={reset:function(){if(this.called=!1,this.notCalled=!0,this.calledOnce=!1,this.calledTwice=!1,this.calledThrice=!1,this.callCount=0,this.firstCall=null,this.secondCall=null,this.thirdCall=null,this.lastCall=null,this.args=[],this.returnValues=[],this.thisValues=[],this.exceptions=[],this.callIds=[],this.fakes)for(var a=0;a<this.fakes.length;a++)this.fakes[a].reset()},create:function(a){var b;"function"!=typeof a?a=function(){}:b=sinon.functionName(a);var c=createProxy(a);return sinon.extend(c,spy),delete c.create,sinon.extend(c,a),c.reset(),c.prototype=a.prototype,c.displayName=b||"spy",c.toString=sinon.functionToString,c._create=sinon.spy.create,c.id="spy#"+uuid++,c},invoke:function(a,b,c){var d,e,f=matchingFake(this.fakes,c);incrementCallCount.call(this),push.call(this.thisValues,b),push.call(this.args,c),push.call(this.callIds,callId++),createCallProperties.call(this);try{e=f?f.invoke(a,b,c):(this.func||a).apply(b,c);var g=this.getCall(this.callCount-1);g.calledWithNew()&&"object"!=typeof e&&(e=b)}catch(h){d=h}if(push.call(this.exceptions,d),push.call(this.returnValues,e),createCallProperties.call(this),void 0!==d)throw d;return e},named:function(a){return this.displayName=a,this},getCall:function(a){return 0>a||a>=this.callCount?null:sinon.spyCall(this,this.thisValues[a],this.args[a],this.returnValues[a],this.exceptions[a],this.callIds[a])},getCalls:function(){var a,b=[];for(a=0;a<this.callCount;a++)b.push(this.getCall(a));return b},calledBefore:function(a){return this.called?a.called?this.callIds[0]<a.callIds[a.callIds.length-1]:!0:!1},calledAfter:function(a){return this.called&&a.called?this.callIds[this.callCount-1]>a.callIds[a.callCount-1]:!1},withArgs:function(){var a=slice.call(arguments);if(this.fakes){var b=matchingFake(this.fakes,a,!0);if(b)return b}else this.fakes=[];var c=this,d=this._create();d.matchingAguments=a,d.parent=this,push.call(this.fakes,d),d.withArgs=function(){return c.withArgs.apply(c,arguments)};for(var e=0;e<this.args.length;e++)d.matches(this.args[e])&&(incrementCallCount.call(d),push.call(d.thisValues,this.thisValues[e]),push.call(d.args,this.args[e]),push.call(d.returnValues,this.returnValues[e]),push.call(d.exceptions,this.exceptions[e]),push.call(d.callIds,this.callIds[e]));return createCallProperties.call(d),d},matches:function(a,b){var c=this.matchingAguments;return c.length<=a.length&&sinon.deepEqual(c,a.slice(0,c.length))?!b||c.length==a.length:void 0},printf:function(a){var b,c=this,d=slice.call(arguments,1);return(a||"").replace(/%(.)/g,function(a,e){return b=spyApi.formatters[e],"function"==typeof b?b.call(null,c,d):isNaN(parseInt(e,10))?"%"+e:sinon.format(d[e-1])})}};delegateToCalls("calledOn",!0),delegateToCalls("alwaysCalledOn",!1,"calledOn"),delegateToCalls("calledWith",!0),delegateToCalls("calledWithMatch",!0),delegateToCalls("alwaysCalledWith",!1,"calledWith"),delegateToCalls("alwaysCalledWithMatch",!1,"calledWithMatch"),delegateToCalls("calledWithExactly",!0),delegateToCalls("alwaysCalledWithExactly",!1,"calledWithExactly"),delegateToCalls("neverCalledWith",!1,"notCalledWith",function(){return!0}),delegateToCalls("neverCalledWithMatch",!1,"notCalledWithMatch",function(){return!0}),delegateToCalls("threw",!0),delegateToCalls("alwaysThrew",!1,"threw"),delegateToCalls("returned",!0),delegateToCalls("alwaysReturned",!1,"returned"),delegateToCalls("calledWithNew",!0),delegateToCalls("alwaysCalledWithNew",!1,"calledWithNew"),delegateToCalls("callArg",!1,"callArgWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")}),spyApi.callArgWith=spyApi.callArg,delegateToCalls("callArgOn",!1,"callArgOnWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")}),spyApi.callArgOnWith=spyApi.callArgOn,delegateToCalls("yield",!1,"yield",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),spyApi.invokeCallback=spyApi.yield,delegateToCalls("yieldOn",!1,"yieldOn",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),delegateToCalls("yieldTo",!1,"yieldTo",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),delegateToCalls("yieldToOn",!1,"yieldToOn",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),spyApi.formatters={c:function(a){return sinon.timesInWords(a.callCount)},n:function(a){return a.toString()},C:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c){var e=" "+a.getCall(c).toString();/\n/.test(b[c-1])&&(e="\n"+e),push.call(b,e)}return b.length>0?"\n"+b.join("\n"):""},t:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c)push.call(b,sinon.format(a.thisValues[c]));return b.join(", ")},"*":function(a,b){for(var c=[],d=0,e=b.length;e>d;++d)push.call(c,sinon.format(b[d]));return c.join(", ")}},sinon.extend(spy,spyApi),spy.spyCall=sinon.spyCall,sinon.spy=spy,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=spy}):commonJSModule&&(module.exports=spy)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],59:[function(a,b){"use strict";!function(c){function d(a,b,e){if(e&&"function"!=typeof e)throw new TypeError("Custom stub should be function");var f;if(f=e?c.spy&&c.spy.create?c.spy.create(e):e:d.create(),!a&&"undefined"==typeof b)return c.stub.create();if("undefined"==typeof b&&"object"==typeof a){for(var g in a)"function"==typeof a[g]&&d(a,g);return a}return c.wrapMethod(a,b,f)}function e(a){return a.defaultBehavior||f(a)||c.behavior.create(a)}function f(a){return a.parent&&g(a.parent)}function g(a){var b=a.behaviors[a.callCount-1];return b&&b.isPresent()?b:e(a)}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i=0;c.extend(d,function(){var a={create:function(){var a=function(){return g(a).invoke(this,arguments)};a.id="stub#"+i++;var b=a;return a=c.spy.create(a),a.func=b,c.extend(a,d),a._create=c.stub.create,a.displayName="stub",a.toString=c.functionToString,a.defaultBehavior=null,a.behaviors=[],a},resetBehavior:function(){var a;if(this.defaultBehavior=null,this.behaviors=[],delete this.returnValue,delete this.returnArgAt,this.returnThis=!1,this.fakes)for(a=0;a<this.fakes.length;a++)this.fakes[a].resetBehavior()},onCall:function(a){return this.behaviors[a]||(this.behaviors[a]=c.behavior.create(this)),this.behaviors[a]},onFirstCall:function(){return this.onCall(0)},onSecondCall:function(){return this.onCall(1)},onThirdCall:function(){return this.onCall(2)}};for(var b in c.behavior)c.behavior.hasOwnProperty(b)&&!a.hasOwnProperty(b)&&"create"!=b&&"withArgs"!=b&&"invoke"!=b&&(a[b]=function(a){return function(){return this.defaultBehavior=this.defaultBehavior||c.behavior.create(this),this.defaultBehavior[a].apply(this.defaultBehavior,arguments),this}}(b));return a}()),c.stub=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):h&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],60:[function(a,b){"use strict";!function(c){function d(a){function b(){var b=c.getConfig(c.config);b.injectInto=b.injectIntoThis&&this||b.injectInto;var d,e,f=c.sandbox.create(b),g=Array.prototype.slice.call(arguments).concat(f.args);try{e=a.apply(this,g)}catch(h){d=h}if("undefined"!=typeof d)throw f.restore(),d;return f.verifyAndRestore(),e}var d=typeof a;if("function"!=d)throw new TypeError("sinon.test needs to wrap a test function, got "+d);return a.length?function(){return b.apply(this,arguments)}:b}var e="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&e&&(c=a("../sinon")),c&&(d.config={injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},c.test=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):e&&(b.exports=d))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],61:[function(a,b){"use strict";!function(c){function d(a,b,c){return function(){b&&b.apply(this,arguments);var d,e;try{e=a.apply(this,arguments)}catch(f){d=f}if(c&&c.apply(this,arguments),d)throw d;return e}}function e(a,b){if(!a||"object"!=typeof a)throw new TypeError("sinon.testCase needs an object with test functions");b=b||"test";var e,f,g,h=new RegExp("^"+b),i={},j=a.setUp,k=a.tearDown;for(e in a)if(a.hasOwnProperty(e)){if(f=a[e],/^(setUp|tearDown)$/.test(e))continue;"function"==typeof f&&h.test(e)?(g=f,(j||k)&&(g=d(f,j,k)),i[e]=c.test(g)):i[e]=a[e]}return i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&f&&(c=a("../sinon")),c&&Object.prototype.hasOwnProperty&&(c.testCase=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],62:[function(require,module,exports){(function(global){"use strict";if("undefined"==typeof sinon)var sinon={};!function(global){function addTimer(a,b){if(0===a.length)throw new Error("Function requires at least 1 parameter");if("undefined"==typeof a[0])throw new Error("Callback must be provided to timer calls");var c=id++,d=a[1]||0;return this.timeouts||(this.timeouts={}),this.timeouts[c]={id:c,func:a[0],callAt:this.now+d,invokeArgs:Array.prototype.slice.call(a,2)},b===!0&&(this.timeouts[c].interval=d),addTimerReturnsObject?{id:c,ref:function(){},unref:function(){}}:c}function parseTime(a){if(!a)return 0;var b,c=a.split(":"),d=c.length,e=d,f=0;if(d>3||!/^(\d\d:){0,2}\d\d?$/.test(a))throw new Error("tick only understands numbers and 'h:m:s'");for(;e--;){if(b=parseInt(c[e],10),b>=60)throw new Error("Invalid time "+a);f+=b*Math.pow(60,d-e-1)}return 1e3*f}function createObject(a){var b;if(Object.create)b=Object.create(a);else{var c=function(){};c.prototype=a,b=new c}return b.Date.clock=b,b}function mirrorDateProperties(a,b){b.now?a.now=function(){return a.clock.now}:delete a.now,b.toSource?a.toSource=function(){return b.toSource()}:delete a.toSource,a.toString=function(){return b.toString()},a.prototype=b.prototype,a.parse=b.parse,a.UTC=b.UTC,a.prototype.toUTCString=b.prototype.toUTCString;for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function restore(){for(var a,b=0,c=this.methods.length;c>b;b++)if(a=this.methods[b],global[a].hadOwnProperty)global[a]=this["_"+a];else try{delete global[a]}catch(d){}this.methods=[]}function stubGlobal(a,b){if(b[a].hadOwnProperty=Object.prototype.hasOwnProperty.call(global,a),b["_"+a]=global[a],"Date"==a){var c=mirrorDateProperties(b[a],global[a]);global[a]=c}else{global[a]=function(){return b[a].apply(b,arguments)};for(var d in b[a])b[a].hasOwnProperty(d)&&(global[a][d]=b[a][d])}global[a].clock=b}var timeoutResult=setTimeout(function(){},0),addTimerReturnsObject="object"==typeof timeoutResult;clearTimeout(timeoutResult);var id=1;sinon.clock={now:0,create:function(a){var b=createObject(this);if("number"==typeof a&&(b.now=a),a&&"object"==typeof a)throw new TypeError("now should be milliseconds since UNIX epoch");return b},setTimeout:function(){return addTimer.call(this,arguments,!1)},clearTimeout:function(a){a&&(this.timeouts||(this.timeouts=[]),"object"==typeof a&&(a=a.id),a in this.timeouts&&delete this.timeouts[a])},setInterval:function(){return addTimer.call(this,arguments,!0)},clearInterval:function(a){this.clearTimeout(a)},setImmediate:function(a){var b=Array.prototype.slice.call(arguments,1);return addTimer.call(this,[a,0].concat(b),!1)},clearImmediate:function(a){this.clearTimeout(a)},tick:function(a){a="number"==typeof a?a:parseTime(a);for(var b,c=this.now,d=this.now+a,e=this.now,f=this.firstTimerInRange(c,d);f&&d>=c;){if(this.timeouts[f.id]){c=this.now=f.callAt;try{this.callTimer(f)}catch(g){b=b||g}}f=this.firstTimerInRange(e,d),e=c}if(this.now=d,b)throw b;return this.now},firstTimerInRange:function(a,b){var c,d,e=null;for(var f in this.timeouts)if(this.timeouts.hasOwnProperty(f)){if(this.timeouts[f].callAt<a||this.timeouts[f].callAt>b)continue;(null===e||this.timeouts[f].callAt<e)&&(d=this.timeouts[f],e=this.timeouts[f].callAt,c={func:this.timeouts[f].func,callAt:this.timeouts[f].callAt,interval:this.timeouts[f].interval,id:this.timeouts[f].id,invokeArgs:this.timeouts[f].invokeArgs})}return c||null},callTimer:function(timer){"number"==typeof timer.interval?this.timeouts[timer.id].callAt+=timer.interval:delete this.timeouts[timer.id];try{"function"==typeof timer.func?timer.func.apply(null,timer.invokeArgs):eval(timer.func)}catch(e){var exception=e}if(this.timeouts[timer.id]){if(exception)throw exception}else if(exception)throw exception},reset:function(){this.timeouts={}},Date:function(){function a(c,d,e,f,g,h,i){switch(arguments.length){case 0:return new b(a.clock.now);case 1:return new b(c);case 2:return new b(c,d);case 3:return new b(c,d,e);case 4:return new b(c,d,e,f);case 5:return new b(c,d,e,f,g);case 6:return new b(c,d,e,f,g,h);default:return new b(c,d,e,f,g,h,i)}}var b=Date;return mirrorDateProperties(a,b)}()};var methods=["Date","setTimeout","setInterval","clearTimeout","clearInterval"];"undefined"!=typeof global.setImmediate&&methods.push("setImmediate"),"undefined"!=typeof global.clearImmediate&&methods.push("clearImmediate"),sinon.useFakeTimers=function(a){var b=sinon.clock.create(a);b.restore=restore,b.methods=Array.prototype.slice.call(arguments,"number"==typeof a?1:0),0===b.methods.length&&(b.methods=methods);for(var c=0,d=b.methods.length;d>c;c++)stubGlobal(b.methods[c],b);return b}}("undefined"!=typeof global&&"function"!=typeof global?global:this),sinon.timers={setTimeout:setTimeout,clearTimeout:clearTimeout,setImmediate:"undefined"!=typeof setImmediate?setImmediate:void 0,clearImmediate:"undefined"!=typeof clearImmediate?clearImmediate:void 0,setInterval:setInterval,clearInterval:clearInterval,Date:Date},"undefined"!=typeof module&&module.exports&&(module.exports=sinon)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],63:[function(a,b){(function(c){("function"==typeof define&&define.amd&&function(a){define("formatio",["samsam"],a)}||"object"==typeof b&&function(c){b.exports=c(a("samsam"))}||function(a){this.formatio=a(this.samsam)})(function(a){"use strict";function b(a){if(!a)return"";if(a.displayName)return a.displayName;if(a.name)return a.name;var b=a.toString().match(/function\s+([^\(]+)/m);return b&&b[1]||""}function d(a,c){var d,e,f=b(c&&c.constructor),g=a.excludeConstructors||h.excludeConstructors||[];for(d=0,e=g.length;e>d;++d){if("string"==typeof g[d]&&g[d]===f)return"";if(g[d].test&&g[d].test(f))return""}return f}function e(a,b){if("object"!=typeof a)return!1;var c,d;for(c=0,d=b.length;d>c;++c)if(b[c]===a)return!0;return!1}function f(b,c,d,g){if("string"==typeof c){var h=b.quoteStrings,j="boolean"!=typeof h||h;return d||j?'"'+c+'"':c}if("function"==typeof c&&!(c instanceof RegExp))return f.func(c);if(d=d||[],e(c,d))return"[Circular]";if("[object Array]"===Object.prototype.toString.call(c))return f.array.call(b,c,d);if(!c)return String(1/c===-1/0?"-0":c);if(a.isElement(c))return f.element(c);if("function"==typeof c.toString&&c.toString!==Object.prototype.toString)return c.toString();var k,l;for(k=0,l=i.length;l>k;k++)if(c===i[k].object)return i[k].value;return f.object.call(b,c,d,g)}function g(a){for(var b in a)this[b]=a[b]}var h={excludeConstructors:["Object",/^.$/],quoteStrings:!0},i=(Object.prototype.hasOwnProperty,[]);return"undefined"!=typeof c&&i.push({object:c,value:"[object global]"}),"undefined"!=typeof document&&i.push({object:document,value:"[object HTMLDocument]"}),"undefined"!=typeof window&&i.push({object:window,value:"[object Window]"}),f.func=function(a){return"function "+b(a)+"() {}"},f.array=function(a,b){b=b||[],b.push(a);var c,d,e=[];for(c=0,d=a.length;d>c;++c)e.push(f(this,a[c],b));return"["+e.join(", ")+"]"},f.object=function(b,c,g){c=c||[],c.push(b),g=g||0;var h,i,j,k,l,m=[],n=a.keys(b).sort(),o=3;for(k=0,l=n.length;l>k;++k)h=n[k],j=b[h],i=e(j,c)?"[Circular]":f(this,j,c,g+2),i=(/\s/.test(h)?'"'+h+'"':h)+": "+i,o+=i.length,m.push(i);var p=d(this,b),q=p?"["+p+"] ":"",r="";for(k=0,l=g;l>k;++k)r+=" ";return o+g>80?q+"{\n "+r+m.join(",\n "+r)+"\n"+r+"}":q+"{ "+m.join(", ")+" }"},f.element=function(a){var b,c,d,e,f,g=a.tagName.toLowerCase(),h=a.attributes,i=[];for(d=0,e=h.length;e>d;++d)b=h.item(d),c=b.nodeName.toLowerCase().replace("html:",""),f=b.nodeValue,("contenteditable"!==c||"inherit"!==f)&&f&&i.push(c+'="'+f+'"');var j="<"+g+(i.length>0?" ":""),k=a.innerHTML;k.length>20&&(k=k.substr(0,20)+"[...]");var l=j+i.join(" ")+">"+k+"</"+g+">";return l.replace(/ contentEditable="inherit"/,"")},g.prototype={functionName:b,configure:function(a){return new g(a)},constructorName:function(a){return d(this,a)},ascii:function(a,b,c){return f(this,a,b,c)}},g.prototype})}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{samsam:64}],64:[function(a,b){("function"==typeof define&&define.amd&&function(a){define("samsam",a)}||"object"==typeof b&&function(a){b.exports=a()}||function(a){this.samsam=a()})(function(){function a(a){var b=a;return"number"==typeof a&&a!==b}function b(a){return l.toString.call(a).split(/[ \]]/)[1]}function c(a){if("Arguments"===b(a))return!0;if("object"!=typeof a||"number"!=typeof a.length||"Array"===b(a))return!1;if("function"==typeof a.callee)return!0;try{a[a.length]=6,delete a[a.length]}catch(c){return!0}return!1}function d(a){if(!a||1!==a.nodeType||!m)return!1;try{a.appendChild(m),a.removeChild(m)}catch(b){return!1}return!0}function e(a){var b,c=[];for(b in a)l.hasOwnProperty.call(a,b)&&c.push(b);return c}function f(a){return"function"==typeof a.getTime&&a.getTime()==a.valueOf()}function g(a){return 0===a&&1/a===-1/0}function h(b,c){return b===c||a(b)&&a(c)?0!==b||g(b)===g(c):void 0}function i(g,i){function j(a){return"object"!=typeof a||null===a||a instanceof Boolean||a instanceof Date||a instanceof Number||a instanceof RegExp||a instanceof String?!1:!0}function k(a,b){var c;for(c=0;c<a.length;c++)if(a[c]===b)return c;return-1}var m=[],n=[],o=[],p=[],q={};return function r(g,i,s,t){var u=typeof g,v=typeof i;if(g===i||a(g)||a(i)||null==g||null==i||"object"!==u||"object"!==v)return h(g,i);if(d(g)||d(i))return!1;var w=f(g),x=f(i);if(!(!w&&!x||w&&x&&g.getTime()===i.getTime()))return!1;if(g instanceof RegExp&&i instanceof RegExp&&g.toString()!==i.toString())return!1;var y=b(g),z=b(i),A=e(g),B=e(i);if(c(g)||c(i)){if(g.length!==i.length)return!1}else if(u!==v||y!==z||A.length!==B.length)return!1;var C,D,E,F,G,H,I,J,K,L,M;for(D=0,E=A.length;E>D;D++){if(C=A[D],!l.hasOwnProperty.call(i,C))return!1;if(F=g[C],G=i[C],H=j(F),I=j(G),J=H?k(m,F):-1,K=I?k(n,G):-1,L=-1!==J?o[J]:s+"["+JSON.stringify(C)+"]",M=-1!==K?p[K]:t+"["+JSON.stringify(C)+"]",q[L+M])return!0;if(-1===J&&H&&(m.push(F),o.push(L)),-1===K&&I&&(n.push(G),p.push(M)),H&&I&&(q[L+M]=!0),!r(F,G,L,M))return!1}return!0}(g,i,"$1","$2")}function j(a,b){if(0===b.length)return!0;var c,d,e,f;for(c=0,d=a.length;d>c;++c)if(k(a[c],b[0])){for(e=0,f=b.length;f>e;++e)if(!k(a[c+e],b[e]))return!1;return!0}return!1}var k,l=Object.prototype,m="undefined"!=typeof document&&document.createElement("div");return k=function n(a,c){if(c&&"function"==typeof c.test)return c.test(a);if("function"==typeof c)return c(a)===!0;if("string"==typeof c){c=c.toLowerCase();var d="string"==typeof a||!!a;return d&&String(a).toLowerCase().indexOf(c)>=0}if("number"==typeof c)return c===a;if("boolean"==typeof c)return c===a;if("Array"===b(a)&&"Array"===b(c))return j(a,c);if(c&&"object"==typeof c){var e;for(e in c){var f=a[e];if("undefined"==typeof f&&"function"==typeof a.getAttribute&&(f=a.getAttribute(e)),"undefined"==typeof f||!n(f,c[e]))return!1}return!0}throw new Error("Matcher was not a string, a number, a function, a boolean or an object")},{isArguments:c,isElement:d,isDate:f,isNegZero:g,identical:h,deepEqual:i,match:k,keys:e}})},{}],65:[function(a,b,c){(function(){var a=this,d=a._,e={},f=Array.prototype,g=Object.prototype,h=Function.prototype,i=f.push,j=f.slice,k=f.concat,l=g.toString,m=g.hasOwnProperty,n=f.forEach,o=f.map,p=f.reduce,q=f.reduceRight,r=f.filter,s=f.every,t=f.some,u=f.indexOf,v=f.lastIndexOf,w=Array.isArray,x=Object.keys,y=h.bind,z=function(a){return a instanceof z?a:this instanceof z?void(this._wrapped=a):new z(a)};"undefined"!=typeof c?("undefined"!=typeof b&&b.exports&&(c=b.exports=z),c._=z):a._=z,z.VERSION="1.6.0";var A=z.each=z.forEach=function(a,b,c){if(null==a)return a;if(n&&a.forEach===n)a.forEach(b,c);else if(a.length===+a.length){for(var d=0,f=a.length;f>d;d++)if(b.call(c,a[d],d,a)===e)return}else for(var g=z.keys(a),d=0,f=g.length;f>d;d++)if(b.call(c,a[g[d]],g[d],a)===e)return;return a};z.map=z.collect=function(a,b,c){var d=[];return null==a?d:o&&a.map===o?a.map(b,c):(A(a,function(a,e,f){d.push(b.call(c,a,e,f))}),d)};var B="Reduce of empty array with no initial value";z.reduce=z.foldl=z.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),p&&a.reduce===p)return d&&(b=z.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(A(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(B);return c},z.reduceRight=z.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),q&&a.reduceRight===q)return d&&(b=z.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=z.keys(a);f=g.length}if(A(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(B);return c},z.find=z.detect=function(a,b,c){var d;return C(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},z.filter=z.select=function(a,b,c){var d=[];return null==a?d:r&&a.filter===r?a.filter(b,c):(A(a,function(a,e,f){b.call(c,a,e,f)&&d.push(a)}),d)},z.reject=function(a,b,c){return z.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},z.every=z.all=function(a,b,c){b||(b=z.identity);var d=!0;return null==a?d:s&&a.every===s?a.every(b,c):(A(a,function(a,f,g){return(d=d&&b.call(c,a,f,g))?void 0:e}),!!d)};var C=z.some=z.any=function(a,b,c){b||(b=z.identity);var d=!1;return null==a?d:t&&a.some===t?a.some(b,c):(A(a,function(a,f,g){return d||(d=b.call(c,a,f,g))?e:void 0}),!!d)};z.contains=z.include=function(a,b){return null==a?!1:u&&a.indexOf===u?-1!=a.indexOf(b):C(a,function(a){return a===b})},z.invoke=function(a,b){var c=j.call(arguments,2),d=z.isFunction(b);return z.map(a,function(a){return(d?b:a[b]).apply(a,c)})},z.pluck=function(a,b){return z.map(a,z.property(b))},z.where=function(a,b){return z.filter(a,z.matches(b))},z.findWhere=function(a,b){return z.find(a,z.matches(b))},z.max=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);var d=-1/0,e=-1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;h>e&&(d=a,e=h)}),d},z.min=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);var d=1/0,e=1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;e>h&&(d=a,e=h)}),d},z.shuffle=function(a){var b,c=0,d=[];return A(a,function(a){b=z.random(c++),d[c-1]=d[b],d[b]=a}),d},z.sample=function(a,b,c){return null==b||c?(a.length!==+a.length&&(a=z.values(a)),a[z.random(a.length-1)]):z.shuffle(a).slice(0,Math.max(0,b))};var D=function(a){return null==a?z.identity:z.isFunction(a)?a:z.property(a)};z.sortBy=function(a,b,c){return b=D(b),z.pluck(z.map(a,function(a,d,e){return{value:a,index:d,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index-b.index}),"value")};var E=function(a){return function(b,c,d){var e={};return c=D(c),A(b,function(f,g){var h=c.call(d,f,g,b);a(e,h,f)}),e}};z.groupBy=E(function(a,b,c){z.has(a,b)?a[b].push(c):a[b]=[c]}),z.indexBy=E(function(a,b,c){a[b]=c}),z.countBy=E(function(a,b){z.has(a,b)?a[b]++:a[b]=1}),z.sortedIndex=function(a,b,c,d){c=D(c);for(var e=c.call(d,b),f=0,g=a.length;g>f;){var h=f+g>>>1;c.call(d,a[h])<e?f=h+1:g=h}return f},z.toArray=function(a){return a?z.isArray(a)?j.call(a):a.length===+a.length?z.map(a,z.identity):z.values(a):[]},z.size=function(a){return null==a?0:a.length===+a.length?a.length:z.keys(a).length},z.first=z.head=z.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:0>b?[]:j.call(a,0,b)},z.initial=function(a,b,c){return j.call(a,0,a.length-(null==b||c?1:b))},z.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:j.call(a,Math.max(a.length-b,0))},z.rest=z.tail=z.drop=function(a,b,c){return j.call(a,null==b||c?1:b)},z.compact=function(a){return z.filter(a,z.identity)};var F=function(a,b,c){return b&&z.every(a,z.isArray)?k.apply(c,a):(A(a,function(a){z.isArray(a)||z.isArguments(a)?b?i.apply(c,a):F(a,b,c):c.push(a)}),c)};z.flatten=function(a,b){return F(a,b,[])},z.without=function(a){return z.difference(a,j.call(arguments,1))},z.partition=function(a,b){var c=[],d=[];return A(a,function(a){(b(a)?c:d).push(a)}),[c,d]},z.uniq=z.unique=function(a,b,c,d){z.isFunction(b)&&(d=c,c=b,b=!1);var e=c?z.map(a,c,d):a,f=[],g=[];return A(e,function(c,d){(b?d&&g[g.length-1]===c:z.contains(g,c))||(g.push(c),f.push(a[d]))}),f},z.union=function(){return z.uniq(z.flatten(arguments,!0))},z.intersection=function(a){var b=j.call(arguments,1);return z.filter(z.uniq(a),function(a){return z.every(b,function(b){return z.contains(b,a)})})},z.difference=function(a){var b=k.apply(f,j.call(arguments,1));return z.filter(a,function(a){return!z.contains(b,a)})},z.zip=function(){for(var a=z.max(z.pluck(arguments,"length").concat(0)),b=new Array(a),c=0;a>c;c++)b[c]=z.pluck(arguments,""+c);return b},z.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},z.indexOf=function(a,b,c){if(null==a)return-1;
|
||
var d=0,e=a.length;if(c){if("number"!=typeof c)return d=z.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(u&&a.indexOf===u)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},z.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(v&&a.lastIndexOf===v)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},z.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);d>e;)f[e++]=a,a+=c;return f};var G=function(){};z.bind=function(a,b){var c,d;if(y&&a.bind===y)return y.apply(a,j.call(arguments,1));if(!z.isFunction(a))throw new TypeError;return c=j.call(arguments,2),d=function(){if(!(this instanceof d))return a.apply(b,c.concat(j.call(arguments)));G.prototype=a.prototype;var e=new G;G.prototype=null;var f=a.apply(e,c.concat(j.call(arguments)));return Object(f)===f?f:e}},z.partial=function(a){var b=j.call(arguments,1);return function(){for(var c=0,d=b.slice(),e=0,f=d.length;f>e;e++)d[e]===z&&(d[e]=arguments[c++]);for(;c<arguments.length;)d.push(arguments[c++]);return a.apply(this,d)}},z.bindAll=function(a){var b=j.call(arguments,1);if(0===b.length)throw new Error("bindAll must be passed function names");return A(b,function(b){a[b]=z.bind(a[b],a)}),a},z.memoize=function(a,b){var c={};return b||(b=z.identity),function(){var d=b.apply(this,arguments);return z.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},z.delay=function(a,b){var c=j.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},z.defer=function(a){return z.delay.apply(z,[a,1].concat(j.call(arguments,1)))},z.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:z.now(),g=null,f=a.apply(d,e),d=e=null};return function(){var j=z.now();h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k?(clearTimeout(g),g=null,h=j,f=a.apply(d,e),d=e=null):g||c.trailing===!1||(g=setTimeout(i,k)),f}},z.debounce=function(a,b,c){var d,e,f,g,h,i=function(){var j=z.now()-g;b>j?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),f=e=null))};return function(){f=this,e=arguments,g=z.now();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}},z.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},z.wrap=function(a,b){return z.partial(b,a)},z.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},z.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},z.keys=function(a){if(!z.isObject(a))return[];if(x)return x(a);var b=[];for(var c in a)z.has(a,c)&&b.push(c);return b},z.values=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},z.pairs=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},z.invert=function(a){for(var b={},c=z.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},z.functions=z.methods=function(a){var b=[];for(var c in a)z.isFunction(a[c])&&b.push(c);return b.sort()},z.extend=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},z.pick=function(a){var b={},c=k.apply(f,j.call(arguments,1));return A(c,function(c){c in a&&(b[c]=a[c])}),b},z.omit=function(a){var b={},c=k.apply(f,j.call(arguments,1));for(var d in a)z.contains(c,d)||(b[d]=a[d]);return b},z.defaults=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)void 0===a[c]&&(a[c]=b[c])}),a},z.clone=function(a){return z.isObject(a)?z.isArray(a)?a.slice():z.extend({},a):a},z.tap=function(a,b){return b(a),a};var H=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof z&&(a=a._wrapped),b instanceof z&&(b=b._wrapped);var e=l.call(a);if(e!=l.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;var g=a.constructor,h=b.constructor;if(g!==h&&!(z.isFunction(g)&&g instanceof g&&z.isFunction(h)&&h instanceof h)&&"constructor"in a&&"constructor"in b)return!1;c.push(a),d.push(b);var i=0,j=!0;if("[object Array]"==e){if(i=a.length,j=i==b.length)for(;i--&&(j=H(a[i],b[i],c,d)););}else{for(var k in a)if(z.has(a,k)&&(i++,!(j=z.has(b,k)&&H(a[k],b[k],c,d))))break;if(j){for(k in b)if(z.has(b,k)&&!i--)break;j=!i}}return c.pop(),d.pop(),j};z.isEqual=function(a,b){return H(a,b,[],[])},z.isEmpty=function(a){if(null==a)return!0;if(z.isArray(a)||z.isString(a))return 0===a.length;for(var b in a)if(z.has(a,b))return!1;return!0},z.isElement=function(a){return!(!a||1!==a.nodeType)},z.isArray=w||function(a){return"[object Array]"==l.call(a)},z.isObject=function(a){return a===Object(a)},A(["Arguments","Function","String","Number","Date","RegExp"],function(a){z["is"+a]=function(b){return l.call(b)=="[object "+a+"]"}}),z.isArguments(arguments)||(z.isArguments=function(a){return!(!a||!z.has(a,"callee"))}),"function"!=typeof/./&&(z.isFunction=function(a){return"function"==typeof a}),z.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},z.isNaN=function(a){return z.isNumber(a)&&a!=+a},z.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==l.call(a)},z.isNull=function(a){return null===a},z.isUndefined=function(a){return void 0===a},z.has=function(a,b){return m.call(a,b)},z.noConflict=function(){return a._=d,this},z.identity=function(a){return a},z.constant=function(a){return function(){return a}},z.property=function(a){return function(b){return b[a]}},z.matches=function(a){return function(b){if(b===a)return!0;for(var c in a)if(a[c]!==b[c])return!1;return!0}},z.times=function(a,b,c){for(var d=Array(Math.max(0,a)),e=0;a>e;e++)d[e]=b.call(c,e);return d},z.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))},z.now=Date.now||function(){return(new Date).getTime()};var I={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};I.unescape=z.invert(I.escape);var J={escape:new RegExp("["+z.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+z.keys(I.unescape).join("|")+")","g")};z.each(["escape","unescape"],function(a){z[a]=function(b){return null==b?"":(""+b).replace(J[a],function(b){return I[a][b]})}}),z.result=function(a,b){if(null==a)return void 0;var c=a[b];return z.isFunction(c)?c.call(a):c},z.mixin=function(a){A(z.functions(a),function(b){var c=z[b]=a[b];z.prototype[b]=function(){var a=[this._wrapped];return i.apply(a,arguments),O.call(this,c.apply(z,a))}})};var K=0;z.uniqueId=function(a){var b=++K+"";return a?a+b:b},z.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var L=/(.)^/,M={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},N=/\\|'|\r|\n|\t|\u2028|\u2029/g;z.template=function(a,b,c){var d;c=z.defaults({},c,z.templateSettings);var e=new RegExp([(c.escape||L).source,(c.interpolate||L).source,(c.evaluate||L).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(N,function(a){return"\\"+M[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=new Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,z);var i=function(a){return d.call(this,a,z)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},z.chain=function(a){return z(a).chain()};var O=function(a){return this._chain?z(a).chain():a};z.mixin(z),A(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=f[a];z.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],O.call(this,c)}}),A(["concat","join","slice"],function(a){var b=f[a];z.prototype[a]=function(){return O.call(this,b.apply(this._wrapped,arguments))}}),z.extend(z.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return z})}).call(this)},{}],66:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:10,sinon:50,"sinon-chai":49,underscore:65}],67:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/TextYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/TextYatta.coffee":4,chai:10,sinon:50,"sinon-chai":49,underscore:65}],68:[function(a){var b,c,d,e,f,g,h,i,j,k=function(a,b){return function(){return a.apply(b,arguments)}};e=a("chai"),f=e.expect,g=e.should(),h=a("sinon"),i=a("sinon-chai"),j=a("underscore"),e.use(i),d=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee"),c=function(){function a(){this.applyRandomOp=k(this.applyRandomOp,this),this.generateRandomOp=k(this.generateRandomOp,this),this.generateDeleteOp=k(this.generateDeleteOp,this),this.generateReplaceOp=k(this.generateReplaceOp,this),this.generateInsertOp=k(this.generateInsertOp,this),this.number_of_test_cases_multiplier=1,this.repeat_this=10*this.number_of_test_cases_multiplier,this.doSomething_amount=200*this.number_of_test_cases_multiplier,this.number_of_engines=12+this.number_of_test_cases_multiplier-1,this.time=0,this.ops=0,this.time_now=0,this.reinitialize()}return a.prototype.reinitialize=function(){var a,c,e,f;for(this.users=[],this.Connector=b(this.users),this.users.push(new d(0,this.Connector)),this.users[0].val("name","initial"),f=[],a=c=1,e=this.number_of_engines;e>=1?e>c:c>e;a=e>=1?++c:--c)f.push(this.users.push(new d(a,this.Connector)));return f},a.prototype.getSomeUser=function(){var a;return a=j.random(0,this.users.length-1),this.users[a]},a.prototype.getRandomText=function(){var a,b,c,d;return a="abcdefghijklmnopqrstuvwxyz",b=j.random(0,10),c=a[j.random(0,a.length-1)],d="",j(b).times(function(){return d+=c}),d},a.prototype.generateInsertOp=function(a){var b;return b=j.random(0,this.users[a].val("name").val().length-1),this.users[a].val("name").insertText(b,this.getRandomText()),null},a.prototype.generateReplaceOp=function(a){return this.users[a].val("name").replaceText(this.getRandomText()),null},a.prototype.generateDeleteOp=function(a){var b,c,d;return void(this.users[a].val("name").val().length>0&&(d=j.random(0,this.users[a].val("name").val().length-1),b=1,c=this.users[a].val("name").deleteText(d,b)))},a.prototype.generateRandomOp=function(a){var b,c,d;return d=[this.generateDeleteOp,this.generateInsertOp,this.generateReplaceOp],b=j.random(d.length-1),c=d[b](a)},a.prototype.applyRandomOp=function(a){var b;return b=this.users[a],b.getConnector().flushOneRandom()},a.prototype.doSomething=function(){var a,b,c;return c=j.random(this.number_of_engines-1),b=[this.applyRandomOp,this.generateRandomOp],a=j.random(b.length-1),b[a](c)},a.prototype.flushAll=function(){var a,b,c,d,e,f;for(e=this.users,f=[],b=c=0,d=e.length;d>c;b=++c)a=e[b],f.push(a.getConnector().flushAll());return f},a.prototype.compareAll=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;for(this.flushAll(),this.time+=(new Date).getTime()-this.time_now,d=0,b=i=0,m=this.users.length;m>=0?m>i:i>m;b=m>=0?++i:--i)d+=this.users[b].getConnector().getOpsInExecutionOrder().length;for(this.ops+=d*this.users.length,f=Math.floor(this.ops/this.time),null!=a&&console.log(""+a+"/"+this.repeat_this+": Every collaborator ("+this.users.length+") applied "+this.number_of_created_operations+" ops in a different order."+(" Over all we consumed "+this.ops+" operations in "+this.time/1e3+" seconds ("+f+" ops/msek).")),o=[],b=j=0,n=this.users.length-1;n>=0?n>j:j>n;b=n>=0?++j:--j)if(this.users[b].val("name").val()!==this.users[b+1].val("name").val()){for(g=function(a,b){var c,d,e,f,g,h,i,j;for(e=this.users[a].getConnector().getOpsInExecutionOrder(),g=0,i=e.length;i>g;g++)f=e[g],console.log(JSON.stringify(f));for(console.log(""),f="ops = [",c=h=0,j=e.length;j>h;c=++h)d=e[c],0!==c&&(f+=", "),f+="op"+c;return f+="]",console.log(f),console.log("@users[@last_user].ot.applyOps ops"),console.log("expect(@users[@last_user].ot.val('name')).to.equal(\""+users[b].val("name")+'")'),e},console.log(""),console.log("Found an OT Puzzle!"),console.log("OT states:"),c=k=0,l=users.length;l>k;c=++k)h=users[c],console.log("OT"+c+": "+h.val("name"));console.log("\nOT execution order ("+b+","+(b+1)+"):"),g(b,b+1),console.log(""),e=g(b+1,b),o.push(console.log(""))}else o.push(void 0);return o},a.prototype.run=function(){var a,b,c,d,e,f,g;for(console.log(""),g=[],b=c=1,e=this.repeat_this;e>=1?e>=c:c>=e;b=e>=1?++c:--c){for(this.time_now=(new Date).getTime(),a=d=1,f=this.doSomething_amount;f>=1?f>=d:d>=f;a=f>=1?++d:--d)this.doSomething();this.compareAll(b),g.push(this.reinitialize())}return g},a}(),describe("JsonYatta",function(){return beforeEach(function(a){return this.yTest=new c,a()}),it("has a JsonWrapper",function(){var a,b;return b=this.yTest.getSomeUser().root_element,b.val("x","dtrn","immutable"),b.val("set",{x:"x"},"immutable"),a=b.value,a.x,a.set={y:""},a.x,a.set,a.set.x,f(a.x).to.equal("dtrn"),f(a.set.x).to.equal("x")}),it("can handle creaton of complex json",function(){return this.yTest.getSomeUser().val("x",{a:"b"}),this.yTest.getSomeUser().val("a",{a:{q:"dtrndtrtdrntdrnrtdnrtdnrtdnrtdnrdnrdt"}}),this.yTest.getSomeUser().val("b",{a:{}}),this.yTest.getSomeUser().val("c",{a:"c"}),this.yTest.getSomeUser().val("c",{a:"b"}),this.yTest.compareAll(),this.yTest.getSomeUser().value.a.a.q.insertText(0,"AAA"),this.yTest.compareAll(),f(this.yTest.getSomeUser().value.a.a.q.val()).to.equal("AAAdtrndtrtdrntdrnrtdnrtdnrtdnrtdnrdnrdt")}),it("handles some immutable tests",function(){return this.yTest.getSomeUser().val("string","text","immutable"),this.yTest.getSomeUser().val("number",4,"immutable"),this.yTest.getSomeUser().val("object",{q:"rr"},"immutable"),this.yTest.compareAll(),f(this.yTest.getSomeUser().val("string")).to.equal("text"),f(this.yTest.getSomeUser().val("number")).to.equal(4),f(this.yTest.getSomeUser().val("object").val("q")).to.equal("rr")}),it("can handle many engines, many operations, concurrently (random)",function(){return this.yTest.run()})})},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:10,sinon:50,"sinon-chai":49,underscore:65}]},{},[66,67,68]),!function f(a,b,c){function d(g,h){if(!b[g]){if(!a[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(e)return e(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=b[g]={exports:{}};a[g][0].call(j.exports,function(b){var c=a[g][1][b];return d(c?c:b)},j,j.exports,f,a,b,c)}return b[g].exports}for(var e="function"==typeof require&&require,g=0;g<c.length;g++)d(c[g]);return d}({1:[function(a,b){var c;c=a("underscore"),b.exports=function(a){var b;return b=function(){function b(b,c,d){var e,f;this.engine=b,this.HB=c,this.execution_listener=d,f=function(a){return function(b){return a.send(b)}}(this),this.execution_listener.push(f),this.applied_operations=[],e=function(a){return function(b){return a.applied_operations.push(b)}}(this),this.execution_listener.push(e),0!==(null!=a?a.length:void 0)&&this.engine.applyOps(a[0].getHistoryBuffer()._encode()),this.unexecuted={}}return b.prototype.getOpsInExecutionOrder=function(){return this.applied_operations},b.prototype.getRootElement=function(){return a.length>0?a[0].getRootElement().getUid():void 0},b.prototype.send=function(b){var c,d,e,f;if(b.uid.creator===this.HB.getUserId()&&"string"!=typeof b.uid.op_number){for(f=[],d=0,e=a.length;e>d;d++)c=a[d],f.push(c.getUserId()!==this.HB.getUserId()?c.getConnector().receive(b):void 0);return f}},b.prototype.receive=function(a){var b,c;return null==(b=this.unexecuted)[c=a.creator]&&(b[c]=[]),this.unexecuted[a.creator].push(a)},b.prototype.flushOne=function(a){var b;return(null!=(b=this.unexecuted[a])?b.length:void 0)>0?this.engine.applyOp(this.unexecuted[a].shift()):void 0},b.prototype.flushOneRandom=function(){return this.flushOne(c.random(0,a.length-1))},b.prototype.flushAll=function(){var a,b,c;c=this.unexecuted;for(a in c)b=c[a],this.engine.applyOps(b);return this.unexecuted={}},b.prototype.sync=function(){throw new Error("Can't use this a.t.m.")},b}()}},{underscore:65}],2:[function(a,b){var c;c=function(){function a(a,b){this.HB=a,this.parser=b,this.unprocessed_ops=[]}return a.prototype.parseOperation=function(a){var b;if(b=this.parser[a.type],null!=b)return b(a);throw new Error("You forgot to specify a parser for type "+a.type+". The message is "+JSON.stringify(a)+".")},a.prototype.applyOps=function(a){var b,c,d,e,f,g,h,i;for(c=[],d=0,g=a.length;g>d;d++)b=a[d],c.push(this.parseOperation(b));for(e=0,h=c.length;h>e;e++)b=c[e],this.HB.addOperation(b);for(f=0,i=c.length;i>f;f++)b=c[f],b.execute()||this.unprocessed_ops.push(b);return this.tryUnprocessed()},a.prototype.applyOp=function(a){var b;return b=this.parseOperation(a),this.HB.addOperation(b),b.execute()||this.unprocessed_ops.push(b),this.tryUnprocessed()},a.prototype.tryUnprocessed=function(){var a,b,c,d,e,f,g;for(g=[];;){for(a=this.unprocessed_ops.length,c=[],f=this.unprocessed_ops,d=0,e=f.length;e>d;d++)b=f[d],b.execute()||c.push(b);if(this.unprocessed_ops=c,this.unprocessed_ops.length===a)break;g.push(void 0)}return g},a}(),b.exports=c},{}],3:[function(a,b){var c,d,e,f;f=a("../Types/JsonTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),g=f(this.HB),this.engine=new c(this.HB,g.parser),this.connector=new b(this.engine,this.HB,g.execution_listener,this),h=this.connector.getRootElement(),null==h?(e=new g.types.JsonType(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=e):this.root_element=this.HB.getOperation(h)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.setMutableDefault=function(a){return this.root_element.setMutableDefault(a)},a.prototype.getUserId=function(){return this.HB.getUserId()},a.prototype.val=function(a,b,c){return this.root_element.val(a,b,c)},Object.defineProperty(a.prototype,"value",{get:function(){return this.root_element.value},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),a}(),"undefined"!=typeof window&&null!==window&&(window.JsonYatta=e),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/JsonTypes.coffee":7}],4:[function(a,b){var c,d,e,f;f=a("../Types/TextTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),h=f(this.HB),this.engine=new c(this.HB,h.parser),this.connector=new b(this.engine,this.HB,h.execution_listener),g=this.connector.getRootElement(),null==g?(e=new h.types.Word(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=this.HB.addOperation(new h.types.ReplaceManager(e,this.HB.getNextOperationIdentifier())).execute()):this.root_element=this.HB.getOperation(g)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.getUserId=function(){return this.HB.getUserId()},a.prototype.val=function(){return this.root_element.val().val()},a.prototype.insertText=function(a,b){return this.root_element.val().insertText(a,b)},a.prototype.deleteText=function(a,b){return this.root_element.val().deleteText(a,b)},a.prototype.replaceText=function(a){return this.root_element.val().replaceText(a)},a}(),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/TextTypes.coffee":9}],5:[function(a,b){var c;c=function(){function a(a){this.user_id=a,this.operation_counter={},this.buffer={},this.change_listeners=[]}return a.prototype.getUserId=function(){return this.user_id},a.prototype.getOperationCounter=function(){var a,b,c,d;b={},d=this.operation_counter;for(c in d)a=d[c],b[c]=a;return b},a.prototype._encode=function(){var a,b,c,d,e,f;a=[],f=this.buffer;for(d in f){e=f[d];for(c in e)b=e[c],isNaN(parseInt(c))||a.push(b._encode())}return a},a.prototype.getNextOperationIdentifier=function(a){var b;return null==a&&(a=this.user_id),null==this.operation_counter[a]&&(this.operation_counter[a]=0),b={creator:a,op_number:this.operation_counter[a]},this.operation_counter[a]++,b},a.prototype.getOperation=function(a){var b;if(a instanceof Object)return null!=(b=this.buffer[a.creator])?b[a.op_number]:void 0;if(null!=a)throw new Error("This type of uid is not defined!")},a.prototype.addOperation=function(a){if(null==this.buffer[a.creator]&&(this.buffer[a.creator]={}),null==this.operation_counter[a.creator]&&(this.operation_counter[a.creator]=0),null!=this.buffer[a.creator][a.op_number])throw new Error("You must not overwrite operations!");return this.buffer[a.creator][a.op_number]=a,"number"==typeof a.op_number&&a.creator!==this.getUserId()&&this.operation_counter[a.creator]++,a},a}(),b.exports=c},{}],6:[function(a,b){var c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};b.exports=function(a){var b,c,e,f,g,h,i;return i={},h=[],g=function(){function b(b){null==b&&(b=a.getNextOperationIdentifier()),this.creator=b.creator,this.op_number=b.op_number}return b.prototype.getUid=function(){return{creator:this.creator,op_number:this.op_number}},b.prototype.execute=function(){var a,b,c;for(this.is_executed=!0,b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this},b.prototype.saveOperation=function(a,b){return null!=(null!=b?b.execute:void 0)?this[a]=b:null!=b?(null==this.unchecked&&(this.unchecked={}),this.unchecked[a]=b):void 0},b.prototype.validateSavedOperations=function(){var b,c,d,e,f,g;f={},e=this,g=this.unchecked;for(b in g)d=g[b],c=a.getOperation(d),c?this[b]=c:(f[b]=d,e=!1);return delete this.unchecked,e||(this.unchecked=f),e},b}(),b=function(a){function b(a,c){this.saveOperation("deletes",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype._encode=function(){return{type:"Delete",uid:this.getUid(),deletes:this.deletes.getUid()}},b.prototype.execute=function(){return this.validateSavedOperations()?(this.deletes.applyDelete(this),b.__super__.execute.apply(this,arguments),this):!1},b}(g),i.Delete=function(a){var c,d;return d=a.uid,c=a.deletes,new b(d,c)},f=function(a){function b(a,c,d,e){this.saveOperation("prev_cl",c),this.saveOperation("next_cl",d),null!=e?this.saveOperation("origin",e):this.saveOperation("origin",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype.applyDelete=function(a){return null==this.deleted_by&&(this.deleted_by=[]),this.deleted_by.push(a)},b.prototype.isDeleted=function(){var a;return(null!=(a=this.deleted_by)?a.length:void 0)>0},b.prototype.getDistanceToOrigin=function(){var a,b;for(a=0,b=this.prev_cl;this.origin!==b;){if(a++,this===this.prev_cl)throw new Error("this should not happen ;) ");b=b.prev_cl}return a},b.prototype.update_sl=function(){var a;return a=this.prev_cl,update("prev_cl","prev_sl"),update("next_cl","prev_sl")},b.prototype.execute=function(){var a,c,d,e,f;if(null!=this.is_executed)return this;if(this.validateSavedOperations()){if((null!=(e=this.prev_cl)?e.validateSavedOperations():void 0)&&(null!=(f=this.next_cl)?f.validateSavedOperations():void 0)&&this.prev_cl.next_cl!==this){for(a=0,d=this.prev_cl.next_cl,c=0;null==d&&(console.log(JSON.stringify(this.prev_cl.getUid())),console.log(JSON.stringify(this.next_cl.getUid()))),d!==this.next_cl;){if(d.getDistanceToOrigin()===c)d.creator<this.creator&&(this.prev_cl=d,a=c+1);else{if(!(d.getDistanceToOrigin()<c))break;c-a<=d.getDistanceToOrigin()&&(this.prev_cl=d,a=c+1)}c++,d=d.next_cl}this.next_cl=this.prev_cl.next_cl,this.prev_cl.next_cl=this,this.next_cl.prev_cl=this}return b.__super__.execute.apply(this,arguments),this}return!1},b}(g),e=function(a){function b(a,c,d,e,f){this.content=null!=c?c:"",b.__super__.constructor.call(this,a,d,e,f)}return d(b,a),b.prototype.val=function(){return this.content},b.prototype._encode=function(){var a;return a={type:"ImmutableObject",uid:this.getUid(),content:this.content},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(f),i.ImmutableObject=function(a){var b,c,d,f,g;return g=a.uid,b=a.content,f=a.prev,c=a.next,d=a.origin,new e(g,b,f,c,d)},c=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return d(b,a),b.prototype.execute=function(){var a,b,c;if(this.validateSavedOperations()){for(b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this}return!1},b.prototype._encode=function(){var a,b;return{type:"Delimiter",uid:this.getUid(),prev:null!=(a=this.prev_cl)?a.getUid():void 0,next:null!=(b=this.next_cl)?b.getUid():void 0}},b}(f),i.Delimiter=function(a){var b,d,e;return e=a.uid,d=a.prev,b=a.next,new c(e,d,b)},{types:{Delete:b,Insert:f,Delimiter:c,Operation:g,ImmutableObject:e},parser:i,execution_listener:h}}},{}],7:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./TextTypes.coffee"),b.exports=function(a){var b,d,f,g,h;return g=c(a),h=g.types,f=g.parser,d=function(a){var c;return new(c=function(){function a(c){var e,f,g,i;i=c.map,g=function(e,f){return Object.defineProperty(a.prototype,e,{get:function(){var a;return a=f.val(),a instanceof b?d(a):a instanceof h.ImmutableObject?a.val():a},set:function(a){var b,d,f,g;if(a.constructor==={}.constructor){f=c.val(e),g=[];for(b in a)d=a[b],g.push(f.val(b,d,"immutable"));return g}return c.val(e,a,"immutable")},enumerable:!0,configurable:!1})};for(e in i)f=i[e],g(e,f)}return a}())(a)},b=function(b){function c(a,b,d){var e,f;if(c.__super__.constructor.call(this,a),null!=b){if("object"!=typeof b)throw new Error("The initial value of JsonTypes must be of type Object! (current type: "+typeof b+")");for(e in b)f=b[e],this.val(e,f,d)}}return e(c,b),c.prototype.mutable_default=!0,c.prototype.setMutableDefault=function(a){if(a===!0||"mutable"===a)c.prototype.mutable_default=!0;else{if(a!==!1&&"immutable"!==a)throw new Error('Set mutable either "mutable" or "immutable"!');c.prototype.mutable_default=!1}return"OK"},c.prototype.val=function(b,d,e){var f,g,i,j,k;if("object"==typeof b){for(i in b)g=b[i],this.val(i,g,d);return this}if(null!=b&&null!=d){if(e=null!=e?e===!0||"mutable"===e?!0:!1:this.mutable_default,"function"==typeof d)return this;if(e&&"number"!=typeof d||d.constructor===Object){if("string"==typeof d)return k=a.addOperation(new h.Word(a.getNextOperationIdentifier(),d)).execute(),c.__super__.val.call(this,b,k);if(d.constructor===Object)return f=a.addOperation(new c(a.getNextOperationIdentifier(),d,e)).execute(),c.__super__.val.call(this,b,f);throw new Error("You must not set "+typeof d+"-types in collaborative Json-objects!")}return j=a.addOperation(new h.ImmutableObject(void 0,d)).execute(),c.__super__.val.call(this,b,j)}return c.__super__.val.call(this,b,d)},Object.defineProperty(c.prototype,"value",{get:function(){return d(this)},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),c.prototype._encode=function(){return{type:"JsonType",uid:this.getUid()}},c}(h.MapManager),f.JsonType=function(a){var c;return c=a.uid,new b(c)},h.JsonType=b,g}},{"./TextTypes.coffee":9}],8:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./BasicTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i,j,k;return i=c(a),k=i.types,j=i.parser,f=function(c){function d(a){this.map={},d.__super__.constructor.call(this,a)}return e(d,c),d.prototype.val=function(c,e){var f,g,h,i,j;if(null!=e)return null==this.map[c]&&a.addOperation(new b(a.getNextOperationIdentifier(),this,c)).execute(),this.map[c].replace(e),this;if(null!=c)return g=null!=(i=this.map[c])?i.val():void 0,g instanceof k.ImmutableObject?g.val():g;h={},j=this.map;for(c in j)f=j[c],g=f.val(),(g instanceof k.ImmutableObject||g instanceof d)&&(g=g.val()),h[c]=g;return h},d}(k.Operation),b=function(b){function c(a,b,d){this.name=d,this.saveOperation("map_manager",b),c.__super__.constructor.call(this,a)}return e(c,b),c.prototype.execute=function(){var b,d,e,f,h;return this.validateSavedOperations()?(h=this.map_manager.getUid(),h.op_number="_"+h.op_number+"_RM_"+this.name,null==a.getOperation(h)&&(e=this.map_manager.getUid(),e.op_number="_"+e.op_number+"_RM_"+this.name+"_beginning",f=this.map_manager.getUid(),f.op_number="_"+f.op_number+"_RM_"+this.name+"_end",b=a.addOperation(new k.Delimiter(e,void 0,f)),d=a.addOperation(new k.Delimiter(f,b,void 0)).execute(),b.execute(),this.map_manager.map[this.name]=a.addOperation(new g(void 0,h,b,d)).execute()),c.__super__.execute.apply(this,arguments)):!1},c.prototype._encode=function(){return{type:"AddName",uid:this.getUid(),map_manager:this.map_manager.getUid(),name:this.name}},c}(k.Operation),j.AddName=function(a){var c,d,e;return c=a.map_manager,e=a.uid,d=a.name,new b(e,c,d)},d=function(b){function c(b,d,e,f,g,h){null!=d&&null!=e?(this.saveOperation("beginning",d),this.saveOperation("end",e)):(this.beginning=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),void 0,void 0)),this.end=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),this.beginning,void 0)),this.beginning.next_cl=this.end,this.beginning.execute(),this.end.execute()),c.__super__.constructor.call(this,b,f,g,h)}return e(c,b),c.prototype.getLastOperation=function(){return this.end.prev_cl},c.prototype.getFirstOperation=function(){return this.beginning.next_cl},c.prototype.toArray=function(){var a,b;for(a=this.beginning.next_cl,b=[];a!==this.end;)b.push(a),a=a.next_cl;return b},c.prototype.getOperationByPosition=function(a){var b;if(b=this.beginning.next_cl,a>0)for(;b=b.next_cl,b.isDeleted()||(a-=1),0!==a;)if(b instanceof k.Delimiter)throw new Error("position parameter exceeded the length of the document!");return b},c}(k.Insert),g=function(b){function c(a,b,d,e,f,g,h){c.__super__.constructor.call(this,b,d,e,f,g,h),null!=a&&this.replace(a)}return e(c,b),c.prototype.replace=function(b){var c,d;return c=this.getLastOperation(),d=new h(b,this,a.getNextOperationIdentifier(),c,c.next_cl),a.addOperation(d).execute()},c.prototype.val=function(){var a;if(a=this.getLastOperation(),a instanceof k.Delimiter)throw new Error("dtrn");return a.val()},c.prototype._encode=function(){var a;return a={type:"ReplaceManager",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&null!=this.next_cl&&(a.prev=this.prev_cl.getUid(),a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a
|
||
},c}(d),j.ReplaceManager=function(a){var b,c,d,e,f,h,i;return c=a.content,i=a.uid,h=a.prev,e=a.next,f=a.origin,b=a.beginning,d=a.end,new g(c,i,b,d,h,e,f)},h=function(a){function b(a,c,d,e,f,g){if(this.saveOperation("content",a),this.saveOperation("parent",c),null==e||null==f||null==a)throw new Error("You must define content, prev, and next for Replaceable-types!");b.__super__.constructor.call(this,d,e,f,g)}return e(b,a),b.prototype.val=function(){return this.content},b.prototype.replace=function(a){return this.parent.replace(a)},b.prototype.execute=function(){var a;return this.validateSavedOperations()?("function"==typeof(a=this.content).setReplaceManager&&a.setReplaceManager(this.parent),b.__super__.execute.apply(this,arguments),this):!1},b.prototype._encode=function(){var a;return a={type:"Replaceable",content:this.content.getUid(),ReplaceManager:this.parent.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid(),uid:this.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(k.Insert),j.Replaceable=function(a){var b,c,d,e,f,g;return b=a.content,e=a.ReplaceManager,g=a.uid,f=a.prev,c=a.next,d=a.origin,new h(b,e,g,f,c,d)},k.ListManager=d,k.MapManager=f,k.ReplaceManager=g,k.Replaceable=h,i}},{"./BasicTypes.coffee":6}],9:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./StructuredTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i;return h=c(a),i=h.types,g=h.parser,b=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return e(b,a),b}(i.Delete),g.TextDelete=g.Delete,d=function(a){function b(a,c,d,e,f){if(this.content=a,null==d||null==e)throw new Error("You must define prev, and next for TextInsert-types!");b.__super__.constructor.call(this,c,d,e,f)}return e(b,a),b.prototype.getLength=function(){return this.isDeleted()?0:this.content.length},b.prototype.val=function(){return this.isDeleted()?"":this.content},b.prototype._encode=function(){var a;return a={type:"TextInsert",content:this.content,uid:this.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(i.Insert),g.TextInsert=function(a){var b,c,e,f,g;return b=a.content,g=a.uid,f=a.prev,c=a.next,e=a.origin,new d(b,g,f,c,e)},f=function(c){function f(a,b,c,d,e,g,h){f.__super__.constructor.call(this,a,c,d,e,g,h),null!=b&&this.insertText(0,b)}return e(f,c),f.prototype.insertText=function(b,c){var e,f,g,h,i,j;for(f=this.getOperationByPosition(b),j=[],h=0,i=c.length;i>h;h++)e=c[h],g=new d(e,a.getNextOperationIdentifier(),f.prev_cl,f),j.push(a.addOperation(g).execute());return j},f.prototype.deleteText=function(c,d){var e,f,g,h,j;for(g=this.getOperationByPosition(c),j=[],f=h=0;d>=0?d>h:h>d;f=d>=0?++h:--h){for(e=a.addOperation(new b(a.getNextOperationIdentifier(),g)).execute(),g=g.next_cl;g.isDeleted();){if(g instanceof i.Delimiter)throw new Error("You can't delete more than there is..");g=g.next_cl}j.push(e._encode())}return j},f.prototype.replaceText=function(b){var c;if(null!=this.replace_manager)return c=a.addOperation(new f(a.getNextOperationIdentifier())).execute(),c.insertText(0,b),this.replace_manager.replace(c);throw new Error("This type is currently not maintained by a ReplaceManager!")},f.prototype.val=function(){var a,b;return a=function(){var a,c,d,e;for(d=this.toArray(),e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(null!=b.val?b.val():"");return e}.call(this),a.join("")},f.prototype.setReplaceManager=function(a){return this.saveOperation("replace_manager",a),this.validateSavedOperations},f.prototype._encode=function(){var a;return a={type:"Word",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},f}(i.ListManager),g.Word=function(a){var b,c,d,e,g,h;return h=a.uid,b=a.beginning,c=a.end,g=a.prev,d=a.next,e=a.origin,new f(h,void 0,b,c,g,d,e)},i.TextInsert=d,i.TextDelete=b,i.Word=f,h}},{"./StructuredTypes.coffee":8}],10:[function(a,b){b.exports=a("./lib/chai")},{"./lib/chai":11}],11:[function(a,b,c){var d=[],c=b.exports={};c.version="1.9.1",c.AssertionError=a("assertion-error");var e=a("./chai/utils");c.use=function(a){return~d.indexOf(a)||(a(this,e),d.push(a)),this};var f=a("./chai/config");c.config=f;var g=a("./chai/assertion");c.use(g);var h=a("./chai/core/assertions");c.use(h);var i=a("./chai/interface/expect");c.use(i);var j=a("./chai/interface/should");c.use(j);var k=a("./chai/interface/assert");c.use(k)},{"./chai/assertion":12,"./chai/config":13,"./chai/core/assertions":14,"./chai/interface/assert":15,"./chai/interface/expect":16,"./chai/interface/should":17,"./chai/utils":28,"assertion-error":37}],12:[function(a,b){var c=a("./config");b.exports=function(a,b){function d(a,b,c){f(this,"ssfi",c||arguments.callee),f(this,"object",a),f(this,"message",b)}var e=a.AssertionError,f=b.flag;a.Assertion=d,Object.defineProperty(d,"includeStack",{get:function(){return console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack},set:function(a){console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack=a}}),Object.defineProperty(d,"showDiff",{get:function(){return console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff},set:function(a){console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff=a}}),d.addProperty=function(a,c){b.addProperty(this.prototype,a,c)},d.addMethod=function(a,c){b.addMethod(this.prototype,a,c)},d.addChainableMethod=function(a,c,d){b.addChainableMethod(this.prototype,a,c,d)},d.overwriteProperty=function(a,c){b.overwriteProperty(this.prototype,a,c)},d.overwriteMethod=function(a,c){b.overwriteMethod(this.prototype,a,c)},d.overwriteChainableMethod=function(a,c,d){b.overwriteChainableMethod(this.prototype,a,c,d)},d.prototype.assert=function(a,d,g,h,i,j){var k=b.test(this,arguments);if(!0!==j&&(j=!1),!0!==c.showDiff&&(j=!1),!k){var d=b.getMessage(this,arguments),l=b.getActual(this,arguments);throw new e(d,{actual:l,expected:h,showDiff:j},c.includeStack?this.assert:f(this,"ssfi"))}},Object.defineProperty(d.prototype,"_obj",{get:function(){return f(this,"object")},set:function(a){f(this,"object",a)}})}},{"./config":13}],13:[function(a,b){b.exports={includeStack:!1,showDiff:!0,truncateThreshold:40}},{}],14:[function(a,b){b.exports=function(a,b){function c(a,c){c&&u(this,"message",c),a=a.toLowerCase();var d=u(this,"object"),e=~["a","e","i","o","u"].indexOf(a.charAt(0))?"an ":"a ";this.assert(a===b.type(d),"expected #{this} to be "+e+a,"expected #{this} not to be "+e+a)}function d(){u(this,"contains",!0)}function e(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=!1;if("array"===b.type(d)&&"object"===b.type(a)){for(var f in d)if(b.eql(d[f],a)){e=!0;break}}else if("object"===b.type(a)){if(!u(this,"negate")){for(var g in a)new t(d).property(g,a[g]);return}var h={};for(var g in a)h[g]=d[g];e=b.eql(h,a)}else e=d&&~d.indexOf(a);this.assert(e,"expected #{this} to include "+b.inspect(a),"expected #{this} to not include "+b.inspect(a))}function f(){var a=u(this,"object"),b=Object.prototype.toString.call(a);this.assert("[object Arguments]"===b,"expected #{this} to be arguments but got "+b,"expected #{this} to not be arguments")}function g(a,b){b&&u(this,"message",b);var c=u(this,"object");return u(this,"deep")?this.eql(a):void this.assert(a===c,"expected #{this} to equal #{exp}","expected #{this} to not equal #{exp}",a,this._obj,!0)}function h(a,c){c&&u(this,"message",c),this.assert(b.eql(a,u(this,"object")),"expected #{this} to deeply equal #{exp}","expected #{this} to not deeply equal #{exp}",a,this._obj,!0)}function i(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>a,"expected #{this} to have a length above #{exp} but got #{act}","expected #{this} to not have a length above #{exp}",a,d)}else this.assert(c>a,"expected #{this} to be above "+a,"expected #{this} to be at most "+a)}function j(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>=a,"expected #{this} to have a length at least #{exp} but got #{act}","expected #{this} to have a length below #{exp}",a,d)}else this.assert(c>=a,"expected #{this} to be at least "+a,"expected #{this} to be below "+a)}function k(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(a>d,"expected #{this} to have a length below #{exp} but got #{act}","expected #{this} to not have a length below #{exp}",a,d)}else this.assert(a>c,"expected #{this} to be below "+a,"expected #{this} to be at least "+a)}function l(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(a>=d,"expected #{this} to have a length at most #{exp} but got #{act}","expected #{this} to have a length above #{exp}",a,d)}else this.assert(a>=c,"expected #{this} to be at most "+a,"expected #{this} to be above "+a)}function m(a,c){c&&u(this,"message",c);var d=b.getName(a);this.assert(u(this,"object")instanceof a,"expected #{this} to be an instance of "+d,"expected #{this} to not be an instance of "+d)}function n(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(d.hasOwnProperty(a),"expected #{this} to have own property "+b.inspect(a),"expected #{this} to not have own property "+b.inspect(a))}function o(){u(this,"doLength",!0)}function p(a,b){b&&u(this,"message",b);var c=u(this,"object");new t(c,b).to.have.property("length");var d=c.length;this.assert(d==a,"expected #{this} to have a length of #{exp} but got #{act}","expected #{this} to not have a length of #{act}",a,d)}function q(a){var c,d=u(this,"object"),e=!0;if(a=a instanceof Array?a:Array.prototype.slice.call(arguments),!a.length)throw new Error("keys required");var f=Object.keys(d),g=a.length;if(e=a.every(function(a){return~f.indexOf(a)}),u(this,"negate")||u(this,"contains")||(e=e&&a.length==f.length),g>1){a=a.map(function(a){return b.inspect(a)});var h=a.pop();c=a.join(", ")+", and "+h}else c=b.inspect(a[0]);c=(g>1?"keys ":"key ")+c,c=(u(this,"contains")?"contain ":"have ")+c,this.assert(e,"expected #{this} to "+c,"expected #{this} to not "+c)}function r(a,c,d){d&&u(this,"message",d);var e=u(this,"object");new t(e,d).is.a("function");var f=!1,g=null,h=null,i=null;0===arguments.length?(c=null,a=null):a&&(a instanceof RegExp||"string"==typeof a)?(c=a,a=null):a&&a instanceof Error?(g=a,a=null,c=null):"function"==typeof a?(h=a.prototype.name||a.name,"Error"===h&&a!==Error&&(h=(new a).name)):a=null;try{e()}catch(j){if(g)return this.assert(j===g,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}",g instanceof Error?g.toString():g,j instanceof Error?j.toString():j),u(this,"object",j),this;if(a&&(this.assert(j instanceof a,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp} but #{act} was thrown",h,j instanceof Error?j.toString():j),!c))return u(this,"object",j),this;var k="object"===b.type(j)&&"message"in j?j.message:""+j;if(null!=k&&c&&c instanceof RegExp)return this.assert(c.exec(k),"expected #{this} to throw error matching #{exp} but got #{act}","expected #{this} to throw error not matching #{exp}",c,k),u(this,"object",j),this;if(null!=k&&c&&"string"==typeof c)return this.assert(~k.indexOf(c),"expected #{this} to throw error including #{exp} but got #{act}","expected #{this} to throw error not including #{act}",c,k),u(this,"object",j),this;f=!0,i=j}var l="",m=null!==h?h:g?"#{exp}":"an error";f&&(l=" but #{act} was thrown"),this.assert(f===!0,"expected #{this} to throw "+m+l,"expected #{this} to not throw "+m+l,g instanceof Error?g.toString():g,i instanceof Error?i.toString():i),u(this,"object",i)}function s(a,b,c){return a.every(function(a){return c?b.some(function(b){return c(a,b)}):-1!==b.indexOf(a)})}var t=a.Assertion,u=(Object.prototype.toString,b.flag);["to","be","been","is","and","has","have","with","that","at","of","same"].forEach(function(a){t.addProperty(a,function(){return this})}),t.addProperty("not",function(){u(this,"negate",!0)}),t.addProperty("deep",function(){u(this,"deep",!0)}),t.addChainableMethod("an",c),t.addChainableMethod("a",c),t.addChainableMethod("include",e,d),t.addChainableMethod("contain",e,d),t.addProperty("ok",function(){this.assert(u(this,"object"),"expected #{this} to be truthy","expected #{this} to be falsy")}),t.addProperty("true",function(){this.assert(!0===u(this,"object"),"expected #{this} to be true","expected #{this} to be false",this.negate?!1:!0)}),t.addProperty("false",function(){this.assert(!1===u(this,"object"),"expected #{this} to be false","expected #{this} to be true",this.negate?!0:!1)}),t.addProperty("null",function(){this.assert(null===u(this,"object"),"expected #{this} to be null","expected #{this} not to be null")}),t.addProperty("undefined",function(){this.assert(void 0===u(this,"object"),"expected #{this} to be undefined","expected #{this} not to be undefined")}),t.addProperty("exist",function(){this.assert(null!=u(this,"object"),"expected #{this} to exist","expected #{this} to not exist")}),t.addProperty("empty",function(){var a=u(this,"object"),b=a;Array.isArray(a)||"string"==typeof object?b=a.length:"object"==typeof a&&(b=Object.keys(a).length),this.assert(!b,"expected #{this} to be empty","expected #{this} not to be empty")}),t.addProperty("arguments",f),t.addProperty("Arguments",f),t.addMethod("equal",g),t.addMethod("equals",g),t.addMethod("eq",g),t.addMethod("eql",h),t.addMethod("eqls",h),t.addMethod("above",i),t.addMethod("gt",i),t.addMethod("greaterThan",i),t.addMethod("least",j),t.addMethod("gte",j),t.addMethod("below",k),t.addMethod("lt",k),t.addMethod("lessThan",k),t.addMethod("most",l),t.addMethod("lte",l),t.addMethod("within",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object"),e=a+".."+b;if(u(this,"doLength")){new t(d,c).to.have.property("length");var f=d.length;this.assert(f>=a&&b>=f,"expected #{this} to have a length within "+e,"expected #{this} to not have a length within "+e)}else this.assert(d>=a&&b>=d,"expected #{this} to be within "+e,"expected #{this} to not be within "+e)}),t.addMethod("instanceof",m),t.addMethod("instanceOf",m),t.addMethod("property",function(a,c,d){d&&u(this,"message",d);var e=u(this,"deep")?"deep property ":"property ",f=u(this,"negate"),g=u(this,"object"),h=u(this,"deep")?b.getPathValue(a,g):g[a];if(f&&void 0!==c){if(void 0===h)throw d=null!=d?d+": ":"",new Error(d+b.inspect(g)+" has no "+e+b.inspect(a))}else this.assert(void 0!==h,"expected #{this} to have a "+e+b.inspect(a),"expected #{this} to not have "+e+b.inspect(a));void 0!==c&&this.assert(c===h,"expected #{this} to have a "+e+b.inspect(a)+" of #{exp}, but got #{act}","expected #{this} to not have a "+e+b.inspect(a)+" of #{act}",c,h),u(this,"object",h)}),t.addMethod("ownProperty",n),t.addMethod("haveOwnProperty",n),t.addChainableMethod("length",p,o),t.addMethod("lengthOf",p,o),t.addMethod("match",function(a,b){b&&u(this,"message",b);var c=u(this,"object");this.assert(a.exec(c),"expected #{this} to match "+a,"expected #{this} not to match "+a)}),t.addMethod("string",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d,c).is.a("string"),this.assert(~d.indexOf(a),"expected #{this} to contain "+b.inspect(a),"expected #{this} to not contain "+b.inspect(a))}),t.addMethod("keys",q),t.addMethod("key",q),t.addMethod("throw",r),t.addMethod("throws",r),t.addMethod("Throw",r),t.addMethod("respondTo",function(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=u(this,"itself"),f="function"!==b.type(d)||e?d[a]:d.prototype[a];this.assert("function"==typeof f,"expected #{this} to respond to "+b.inspect(a),"expected #{this} to not respond to "+b.inspect(a))}),t.addProperty("itself",function(){u(this,"itself",!0)}),t.addMethod("satisfy",function(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(a(d),"expected #{this} to satisfy "+b.objDisplay(a),"expected #{this} to not satisfy"+b.objDisplay(a),this.negate?!1:!0,a(d))}),t.addMethod("closeTo",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(Math.abs(d-a)<=b,"expected #{this} to be close to "+a+" +/- "+b,"expected #{this} not to be close to "+a+" +/- "+b)}),t.addMethod("members",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d).to.be.an("array"),new t(a).to.be.an("array");var e=u(this,"deep")?b.eql:void 0;return u(this,"contains")?this.assert(s(a,d,e),"expected #{this} to be a superset of #{act}","expected #{this} to not be a superset of #{act}",d,a):void this.assert(s(d,a,e)&&s(a,d,e),"expected #{this} to have the same members as #{act}","expected #{this} to not have the same members as #{act}",d,a)})}},{}],15:[function(require,module,exports){module.exports=function(chai,util){var Assertion=chai.Assertion,flag=util.flag,assert=chai.assert=function(a,b){var c=new Assertion(null,null,chai.assert);c.assert(a,b,"[ negation message unavailable ]")};assert.fail=function(a,b,c,d){throw c=c||"assert.fail()",new chai.AssertionError(c,{actual:a,expected:b,operator:d},assert.fail)},assert.ok=function(a,b){new Assertion(a,b).is.ok},assert.notOk=function(a,b){new Assertion(a,b).is.not.ok},assert.equal=function(a,b,c){var d=new Assertion(a,c,assert.equal);d.assert(b==flag(d,"object"),"expected #{this} to equal #{exp}","expected #{this} to not equal #{act}",b,a)},assert.notEqual=function(a,b,c){var d=new Assertion(a,c,assert.notEqual);d.assert(b!=flag(d,"object"),"expected #{this} to not equal #{exp}","expected #{this} to equal #{act}",b,a)},assert.strictEqual=function(a,b,c){new Assertion(a,c).to.equal(b)},assert.notStrictEqual=function(a,b,c){new Assertion(a,c).to.not.equal(b)},assert.deepEqual=function(a,b,c){new Assertion(a,c).to.eql(b)},assert.notDeepEqual=function(a,b,c){new Assertion(a,c).to.not.eql(b)},assert.isTrue=function(a,b){new Assertion(a,b).is["true"]},assert.isFalse=function(a,b){new Assertion(a,b).is["false"]},assert.isNull=function(a,b){new Assertion(a,b).to.equal(null)},assert.isNotNull=function(a,b){new Assertion(a,b).to.not.equal(null)},assert.isUndefined=function(a,b){new Assertion(a,b).to.equal(void 0)},assert.isDefined=function(a,b){new Assertion(a,b).to.not.equal(void 0)},assert.isFunction=function(a,b){new Assertion(a,b).to.be.a("function")},assert.isNotFunction=function(a,b){new Assertion(a,b).to.not.be.a("function")},assert.isObject=function(a,b){new Assertion(a,b).to.be.a("object")},assert.isNotObject=function(a,b){new Assertion(a,b).to.not.be.a("object")},assert.isArray=function(a,b){new Assertion(a,b).to.be.an("array")},assert.isNotArray=function(a,b){new Assertion(a,b).to.not.be.an("array")},assert.isString=function(a,b){new Assertion(a,b).to.be.a("string")},assert.isNotString=function(a,b){new Assertion(a,b).to.not.be.a("string")},assert.isNumber=function(a,b){new Assertion(a,b).to.be.a("number")},assert.isNotNumber=function(a,b){new Assertion(a,b).to.not.be.a("number")},assert.isBoolean=function(a,b){new Assertion(a,b).to.be.a("boolean")},assert.isNotBoolean=function(a,b){new Assertion(a,b).to.not.be.a("boolean")},assert.typeOf=function(a,b,c){new Assertion(a,c).to.be.a(b)},assert.notTypeOf=function(a,b,c){new Assertion(a,c).to.not.be.a(b)},assert.instanceOf=function(a,b,c){new Assertion(a,c).to.be.instanceOf(b)},assert.notInstanceOf=function(a,b,c){new Assertion(a,c).to.not.be.instanceOf(b)},assert.include=function(a,b,c){new Assertion(a,c,assert.include).include(b)},assert.notInclude=function(a,b,c){new Assertion(a,c,assert.notInclude).not.include(b)},assert.match=function(a,b,c){new Assertion(a,c).to.match(b)},assert.notMatch=function(a,b,c){new Assertion(a,c).to.not.match(b)},assert.property=function(a,b,c){new Assertion(a,c).to.have.property(b)},assert.notProperty=function(a,b,c){new Assertion(a,c).to.not.have.property(b)},assert.deepProperty=function(a,b,c){new Assertion(a,c).to.have.deep.property(b)},assert.notDeepProperty=function(a,b,c){new Assertion(a,c).to.not.have.deep.property(b)},assert.propertyVal=function(a,b,c,d){new Assertion(a,d).to.have.property(b,c)},assert.propertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.property(b,c)},assert.deepPropertyVal=function(a,b,c,d){new Assertion(a,d).to.have.deep.property(b,c)},assert.deepPropertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.deep.property(b,c)},assert.lengthOf=function(a,b,c){new Assertion(a,c).to.have.length(b)},assert.Throw=function(a,b,c,d){("string"==typeof b||b instanceof RegExp)&&(c=b,b=null);var e=new Assertion(a,d).to.Throw(b,c);return flag(e,"object")},assert.doesNotThrow=function(a,b,c){"string"==typeof b&&(c=b,b=null),new Assertion(a,c).to.not.Throw(b)},assert.operator=function(val,operator,val2,msg){if(!~["==","===",">",">=","<","<=","!=","!=="].indexOf(operator))throw new Error('Invalid operator "'+operator+'"');var test=new Assertion(eval(val+operator+val2),msg);test.assert(!0===flag(test,"object"),"expected "+util.inspect(val)+" to be "+operator+" "+util.inspect(val2),"expected "+util.inspect(val)+" to not be "+operator+" "+util.inspect(val2))},assert.closeTo=function(a,b,c,d){new Assertion(a,d).to.be.closeTo(b,c)},assert.sameMembers=function(a,b,c){new Assertion(a,c).to.have.same.members(b)},assert.includeMembers=function(a,b,c){new Assertion(a,c).to.include.members(b)},assert.ifError=function(a,b){new Assertion(a,b).to.not.be.ok},function a(b,c){return assert[c]=assert[b],a}("Throw","throw")("Throw","throws")}},{}],16:[function(a,b){b.exports=function(a){a.expect=function(b,c){return new a.Assertion(b,c)}}},{}],17:[function(a,b){b.exports=function(a){function b(){function a(){return this instanceof String||this instanceof Number?new c(this.constructor(this),null,a):this instanceof Boolean?new c(1==this,null,a):new c(this,null,a)}function b(a){Object.defineProperty(this,"should",{value:a,enumerable:!0,configurable:!0,writable:!0})}Object.defineProperty(Object.prototype,"should",{set:b,get:a,configurable:!0});var d={};return d.equal=function(a,b,d){new c(a,d).to.equal(b)},d.Throw=function(a,b,d,e){new c(a,e).to.Throw(b,d)},d.exist=function(a,b){new c(a,b).to.exist},d.not={},d.not.equal=function(a,b,d){new c(a,d).to.not.equal(b)},d.not.Throw=function(a,b,d,e){new c(a,e).to.not.Throw(b,d)},d.not.exist=function(a,b){new c(a,b).to.not.exist},d["throw"]=d.Throw,d.not["throw"]=d.not.Throw,d}var c=a.Assertion;a.should=b,a.Should=b}},{}],18:[function(a,b){var c=a("./transferFlags"),d=a("./flag"),e=a("../config"),f="__proto__"in Object,g=/^(?:length|name|arguments|caller)$/,h=Function.prototype.call,i=Function.prototype.apply;b.exports=function(a,b,j,k){"function"!=typeof k&&(k=function(){});var l={method:j,chainingBehavior:k};a.__methods||(a.__methods={}),a.__methods[b]=l,Object.defineProperty(a,b,{get:function(){l.chainingBehavior.call(this);var b=function m(){var a=d(this,"ssfi");a&&e.includeStack===!1&&d(this,"ssfi",m);var b=l.method.apply(this,arguments);return void 0===b?this:b};if(f){var j=b.__proto__=Object.create(this);j.call=h,j.apply=i}else{var k=Object.getOwnPropertyNames(a);k.forEach(function(c){if(!g.test(c)){var d=Object.getOwnPropertyDescriptor(a,c);Object.defineProperty(b,c,d)}})}return c(this,b),b},configurable:!0})}},{"../config":13,"./flag":21,"./transferFlags":35}],19:[function(a,b){var c=a("../config"),d=a("./flag");b.exports=function(a,b,e){a[b]=function(){var f=d(this,"ssfi");f&&c.includeStack===!1&&d(this,"ssfi",a[b]);var g=e.apply(this,arguments);return void 0===g?this:g}}},{"../config":13,"./flag":21}],20:[function(a,b){b.exports=function(a,b,c){Object.defineProperty(a,b,{get:function(){var a=c.call(this);return void 0===a?this:a},configurable:!0})}},{}],21:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));return 3!==arguments.length?d[b]:void(d[b]=c)}},{}],22:[function(a,b){b.exports=function(a,b){return b.length>4?b[4]:a._obj}},{}],23:[function(a,b){b.exports=function(a){var b=[];for(var c in a)b.push(c);return b}},{}],24:[function(a,b){var c=a("./flag"),d=a("./getActual"),e=(a("./inspect"),a("./objDisplay"));b.exports=function(a,b){var f=c(a,"negate"),g=c(a,"object"),h=b[3],i=d(a,b),j=f?b[2]:b[1],k=c(a,"message");return j=j||"",j=j.replace(/#{this}/g,e(g)).replace(/#{act}/g,e(i)).replace(/#{exp}/g,e(h)),k?k+": "+j:j}},{"./flag":21,"./getActual":22,"./inspect":29,"./objDisplay":30}],25:[function(a,b){b.exports=function(a){if(a.name)return a.name;var b=/^\s?function ([^(]*)\(/.exec(a);return b&&b[1]?b[1]:""}},{}],26:[function(a,b){function c(a){var b=a.replace(/\[/g,".["),c=b.match(/(\\\.|[^.]+?)+/g);return c.map(function(a){var b=/\[(\d+)\]$/,c=b.exec(a);return c?{i:parseFloat(c[1])}:{p:a}})}function d(a,b){for(var c,d=b,e=0,f=a.length;f>e;e++){var g=a[e];d?("undefined"!=typeof g.p?d=d[g.p]:"undefined"!=typeof g.i&&(d=d[g.i]),e==f-1&&(c=d)):c=void 0}return c}b.exports=function(a,b){var e=c(a);return d(e,b)}},{}],27:[function(a,b){b.exports=function(){function a(a){-1===b.indexOf(a)&&b.push(a)}for(var b=Object.getOwnPropertyNames(subject),c=Object.getPrototypeOf(subject);null!==c;)Object.getOwnPropertyNames(c).forEach(a),c=Object.getPrototypeOf(c);return b}},{}],28:[function(a,b,c){var c=b.exports={};c.test=a("./test"),c.type=a("./type"),c.getMessage=a("./getMessage"),c.getActual=a("./getActual"),c.inspect=a("./inspect"),c.objDisplay=a("./objDisplay"),c.flag=a("./flag"),c.transferFlags=a("./transferFlags"),c.eql=a("deep-eql"),c.getPathValue=a("./getPathValue"),c.getName=a("./getName"),c.addProperty=a("./addProperty"),c.addMethod=a("./addMethod"),c.overwriteProperty=a("./overwriteProperty"),c.overwriteMethod=a("./overwriteMethod"),c.addChainableMethod=a("./addChainableMethod"),c.overwriteChainableMethod=a("./overwriteChainableMethod")},{"./addChainableMethod":18,"./addMethod":19,"./addProperty":20,"./flag":21,"./getActual":22,"./getMessage":24,"./getName":25,"./getPathValue":26,"./inspect":29,"./objDisplay":30,"./overwriteChainableMethod":31,"./overwriteMethod":32,"./overwriteProperty":33,"./test":34,"./transferFlags":35,"./type":36,"deep-eql":38}],29:[function(a,b,c){function d(a,b,c){var d={showHidden:b,seen:[],stylize:function(a){return a}};return e(d,a,"undefined"==typeof c?2:c)}function e(a,b,d){if(b&&"function"==typeof b.inspect&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var o=b.inspect(d);return"string"!=typeof o&&(o=e(a,o,d)),o}var u=f(a,b);if(u)return u;if(t(b))return s(b);var v=r(b),w=a.showHidden?q(b):v;if(0===w.length||n(b)&&(1===w.length&&"stack"===w[0]||2===w.length&&"description"===w[0]&&"stack"===w[1])){if("function"==typeof b){var x=p(b),y=x?": "+x:"";return a.stylize("[Function"+y+"]","special")}if(l(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(m(b))return a.stylize(Date.prototype.toUTCString.call(b),"date");if(n(b))return g(b)}var z="",A=!1,B=["{","}"];if(k(b)&&(A=!0,B=["[","]"]),"function"==typeof b){var x=p(b),y=x?": "+x:"";z=" [Function"+y+"]"}if(l(b)&&(z=" "+RegExp.prototype.toString.call(b)),m(b)&&(z=" "+Date.prototype.toUTCString.call(b)),n(b))return g(b);if(0===w.length&&(!A||0==b.length))return B[0]+z+B[1];if(0>d)return l(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var C;return C=A?h(a,b,d,v,w):w.map(function(c){return i(a,b,d,v,c,A)}),a.seen.pop(),j(C,z,B)}function f(a,b){switch(typeof b){case"undefined":return a.stylize("undefined","undefined");case"string":var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string");case"number":return a.stylize(""+b,"number");case"boolean":return a.stylize(""+b,"boolean")}return null===b?a.stylize("null","null"):void 0}function g(a){return"["+Error.prototype.toString.call(a)+"]"}function h(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(Object.prototype.hasOwnProperty.call(b,String(g))?i(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(i(a,b,c,d,e,!0))}),f}function i(a,b,c,d,f,g){var h,i;if(b.__lookupGetter__&&(b.__lookupGetter__(f)?i=b.__lookupSetter__(f)?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):b.__lookupSetter__(f)&&(i=a.stylize("[Setter]","special"))),d.indexOf(f)<0&&(h="["+f+"]"),i||(a.seen.indexOf(b[f])<0?(i=null===c?e(a,b[f],null):e(a,b[f],c-1),i.indexOf("\n")>-1&&(i=g?i.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+i.split("\n").map(function(a){return" "+a}).join("\n"))):i=a.stylize("[Circular]","special")),"undefined"==typeof h){if(g&&f.match(/^\d+$/))return i;h=JSON.stringify(""+f),h.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(h=h.substr(1,h.length-2),h=a.stylize(h,"name")):(h=h.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),h=a.stylize(h,"string"))}return h+": "+i}function j(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function k(a){return Array.isArray(a)||"object"==typeof a&&"[object Array]"===o(a)}function l(a){return"object"==typeof a&&"[object RegExp]"===o(a)}function m(a){return"object"==typeof a&&"[object Date]"===o(a)}function n(a){return"object"==typeof a&&"[object Error]"===o(a)}function o(a){return Object.prototype.toString.call(a)}var p=a("./getName"),q=a("./getProperties"),r=a("./getEnumerableProperties");b.exports=d;var s=function(a){if("outerHTML"in a)return a.outerHTML;var b,c="http://www.w3.org/1999/xhtml",d=document.createElementNS(c,"_"),e=((window.HTMLElement||window.Element).prototype,new XMLSerializer);return document.xmlVersion?e.serializeToString(a):(d.appendChild(a.cloneNode(!1)),b=d.innerHTML.replace("><",">"+a.innerHTML+"<"),d.innerHTML="",b)},t=function(a){return"object"==typeof HTMLElement?a instanceof HTMLElement:a&&"object"==typeof a&&1===a.nodeType&&"string"==typeof a.nodeName}},{"./getEnumerableProperties":23,"./getName":25,"./getProperties":27}],30:[function(a,b){var c=a("./inspect"),d=a("../config");b.exports=function(a){var b=c(a),e=Object.prototype.toString.call(a);if(d.truncateThreshold&&b.length>=d.truncateThreshold){if("[object Function]"===e)return a.name&&""!==a.name?"[Function: "+a.name+"]":"[Function]";if("[object Array]"===e)return"[ Array("+a.length+") ]";if("[object Object]"===e){var f=Object.keys(a),g=f.length>2?f.splice(0,2).join(", ")+", ...":f.join(", ");return"{ Object ("+g+") }"}return b}return b}},{"../config":13,"./inspect":29}],31:[function(a,b){b.exports=function(a,b,c,d){var e=a.__methods[b],f=e.chainingBehavior;e.chainingBehavior=function(){var a=d(f).call(this);return void 0===a?this:a};var g=e.method;e.method=function(){var a=c(g).apply(this,arguments);return void 0===a?this:a}}},{}],32:[function(a,b){b.exports=function(a,b,c){var d=a[b],e=function(){return this};d&&"function"==typeof d&&(e=d),a[b]=function(){var a=c(e).apply(this,arguments);return void 0===a?this:a}}},{}],33:[function(a,b){b.exports=function(a,b,c){var d=Object.getOwnPropertyDescriptor(a,b),e=function(){};d&&"function"==typeof d.get&&(e=d.get),Object.defineProperty(a,b,{get:function(){var a=c(e).call(this);return void 0===a?this:a},configurable:!0})}},{}],34:[function(a,b){var c=a("./flag");b.exports=function(a,b){var d=c(a,"negate"),e=b[0];return d?!e:e}},{"./flag":21}],35:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));b.__flags||(b.__flags=Object.create(null)),c=3===arguments.length?c:!0;for(var e in d)(c||"object"!==e&&"ssfi"!==e&&"message"!=e)&&(b.__flags[e]=d[e])
|
||
}},{}],36:[function(a,b){var c={"[object Arguments]":"arguments","[object Array]":"array","[object Date]":"date","[object Function]":"function","[object Number]":"number","[object RegExp]":"regexp","[object String]":"string"};b.exports=function(a){var b=Object.prototype.toString.call(a);return c[b]?c[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}},{}],37:[function(a,b){function c(){function a(a,c){Object.keys(c).forEach(function(d){~b.indexOf(d)||(a[d]=c[d])})}var b=[].slice.call(arguments);return function(){for(var b=[].slice.call(arguments),c=0,d={};c<b.length;c++)a(d,b[c]);return d}}function d(a,b,d){var e=c("name","message","stack","constructor","toJSON"),f=e(b||{});this.message=a||"Unspecified AssertionError",this.showDiff=!1;for(var g in f)this[g]=f[g];d=d||arguments.callee,d&&Error.captureStackTrace&&Error.captureStackTrace(this,d)}b.exports=d,d.prototype=Object.create(Error.prototype),d.prototype.name="AssertionError",d.prototype.constructor=d,d.prototype.toJSON=function(a){var b=c("constructor","toJSON","stack"),d=b({name:this.name},this);return!1!==a&&this.stack&&(d.stack=this.stack),d}},{}],38:[function(a,b){b.exports=a("./lib/eql")},{"./lib/eql":39}],39:[function(a,b){function c(a,b,c){return d(a,b)?!0:"date"===o(a)?f(a,b):"regexp"===o(a)?g(a,b):n.isBuffer(a)?k(a,b):"arguments"===o(a)?h(a,b,c):e(a,b)?"object"!==o(a)&&"object"!==o(b)&&"array"!==o(a)&&"array"!==o(b)?d(a,b):m(a,b,c):!1}function d(a,b){return a===b?0!==a||1/a===1/b:a!==a&&b!==b}function e(a,b){return o(a)===o(b)}function f(a,b){return"date"!==o(b)?!1:d(a.getTime(),b.getTime())}function g(a,b){return"regexp"!==o(b)?!1:d(a.toString(),b.toString())}function h(a,b,d){return"arguments"!==o(b)?!1:(a=[].slice.call(a),b=[].slice.call(b),c(a,b,d))}function i(a){var b=[];for(var c in a)b.push(c);return b}function j(a,b){if(a.length!==b.length)return!1;for(var c=0,d=!0;c<a.length;c++)if(a[c]!==b[c]){d=!1;break}return d}function k(a,b){return n.isBuffer(b)?j(a,b):!1}function l(a){return null!==a&&void 0!==a}function m(a,b,d){if(!l(a)||!l(b))return!1;if(a.prototype!==b.prototype)return!1;var e;if(d){for(e=0;e<d.length;e++)if(d[e][0]===a&&d[e][1]===b||d[e][0]===b&&d[e][1]===a)return!0}else d=[];try{var f=i(a),g=i(b)}catch(h){return!1}if(f.sort(),g.sort(),!j(f,g))return!1;d.push([a,b]);var k;for(e=f.length-1;e>=0;e--)if(k=f[e],!c(a[k],b[k],d))return!1;return!0}var n,o=a("type-detect");try{n=a("buffer").Buffer}catch(p){n={},n.isBuffer=function(){return!1}}b.exports=c},{buffer:42,"type-detect":40}],40:[function(a,b){b.exports=a("./lib/type")},{"./lib/type":41}],41:[function(a,b,c){function d(a){var b=Object.prototype.toString.call(a);return f[b]?f[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}function e(){this.tests={}}var c=b.exports=d,f={"[object Array]":"array","[object RegExp]":"regexp","[object Function]":"function","[object Arguments]":"arguments","[object Date]":"date"};c.Library=e,e.prototype.of=d,e.prototype.define=function(a,b){return 1===arguments.length?this.tests[a]:(this.tests[a]=b,this)},e.prototype.test=function(a,b){if(b===d(a))return!0;var c=this.tests[b];if(c&&"regexp"===d(c))return c.test(a);if(c&&"function"===d(c))return c(a);throw new ReferenceError('Type test "'+b+'" not defined or invalid.')}},{}],42:[function(a,b,c){function d(a,b,c){if(!(this instanceof d))return new d(a,b,c);var e,f=typeof a;if("number"===f)e=a>0?a>>>0:0;else if("string"===f)"base64"===b&&(a=C(a)),e=d.byteLength(a,b);else{if("object"!==f||null===a)throw new Error("First argument needs to be a number, array or string.");"Buffer"===a.type&&E(a.data)&&(a=a.data),e=+a.length>0?Math.floor(+a.length):0}var g;T?g=d._augment(new Uint8Array(e)):(g=this,g.length=e,g._isBuffer=!0);var h;if(T&&"number"==typeof a.byteLength)g._set(a);else if(F(a))if(d.isBuffer(a))for(h=0;e>h;h++)g[h]=a.readUInt8(h);else for(h=0;e>h;h++)g[h]=(a[h]%256+256)%256;else if("string"===f)g.write(a,0,b);else if("number"===f&&!T&&!c)for(h=0;e>h;h++)g[h]=0;return g}function e(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;Q(f%2===0,"Invalid hex string"),d>f/2&&(d=f/2);for(var g=0;d>g;g++){var h=parseInt(b.substr(2*g,2),16);Q(!isNaN(h),"Invalid hex string"),a[c+g]=h}return g}function f(a,b,c,d){var e=L(H(b),a,c,d);return e}function g(a,b,c,d){var e=L(I(b),a,c,d);return e}function h(a,b,c,d){return g(a,b,c,d)}function i(a,b,c,d){var e=L(K(b),a,c,d);return e}function j(a,b,c,d){var e=L(J(b),a,c,d);return e}function k(a,b,c){return R.fromByteArray(0===b&&c===a.length?a:a.slice(b,c))}function l(a,b,c){var d="",e="";c=Math.min(a.length,c);for(var f=b;c>f;f++)a[f]<=127?(d+=M(e)+String.fromCharCode(a[f]),e=""):e+="%"+a[f].toString(16);return d+M(e)}function m(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(a[e]);return d}function n(a,b,c){return m(a,b,c)}function o(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;f++)e+=G(a[f]);return e}function p(a,b,c){for(var d=a.slice(b,c),e="",f=0;f<d.length;f+=2)e+=String.fromCharCode(d[f]+256*d[f+1]);return e}function q(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(f=a[b],e>b+1&&(f|=a[b+1]<<8)):(f=a[b]<<8,e>b+1&&(f|=a[b+1])),f}}function r(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(e>b+2&&(f=a[b+2]<<16),e>b+1&&(f|=a[b+1]<<8),f|=a[b],e>b+3&&(f+=a[b+3]<<24>>>0)):(e>b+1&&(f=a[b+1]<<16),e>b+2&&(f|=a[b+2]<<8),e>b+3&&(f|=a[b+3]),f+=a[b]<<24>>>0),f}}function s(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=q(a,b,c,!0),g=32768&f;return g?-1*(65535-f+1):f}}function t(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=r(a,b,c,!0),g=2147483648&f;return g?-1*(4294967295-f+1):f}}function u(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+3<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,23,4)}function v(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+7<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,52,8)}function w(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"trying to write beyond buffer length"),N(b,65535));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,2);h>g;g++)a[c+g]=(b&255<<8*(d?g:1-g))>>>8*(d?g:1-g);return c+2}}function x(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"trying to write beyond buffer length"),N(b,4294967295));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,4);h>g;g++)a[c+g]=b>>>8*(d?g:3-g)&255;return c+4}}function y(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"Trying to write beyond buffer length"),O(b,32767,-32768));var f=a.length;return c>=f?void 0:(b>=0?w(a,b,c,d,e):w(a,65535+b+1,c,d,e),c+2)}function z(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),O(b,2147483647,-2147483648));var f=a.length;return c>=f?void 0:(b>=0?x(a,b,c,d,e):x(a,4294967295+b+1,c,d,e),c+4)}function A(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),P(b,3.4028234663852886e38,-3.4028234663852886e38));var f=a.length;return c>=f?void 0:(S.write(a,b,c,d,23,4),c+4)}function B(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+7<a.length,"Trying to write beyond buffer length"),P(b,1.7976931348623157e308,-1.7976931348623157e308));var f=a.length;return c>=f?void 0:(S.write(a,b,c,d,52,8),c+8)}function C(a){for(a=D(a).replace(V,"");a.length%4!==0;)a+="=";return a}function D(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function E(a){return(Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)})(a)}function F(a){return E(a)||d.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length}function G(a){return 16>a?"0"+a.toString(16):a.toString(16)}function H(a){for(var b=[],c=0;c<a.length;c++){var d=a.charCodeAt(c);if(127>=d)b.push(d);else{var e=c;d>=55296&&57343>=d&&c++;for(var f=encodeURIComponent(a.slice(e,c+1)).substr(1).split("%"),g=0;g<f.length;g++)b.push(parseInt(f[g],16))}}return b}function I(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function J(a){for(var b,c,d,e=[],f=0;f<a.length;f++)b=a.charCodeAt(f),c=b>>8,d=b%256,e.push(d),e.push(c);return e}function K(a){return R.toByteArray(a)}function L(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);e++)b[e+c]=a[e];return e}function M(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function N(a,b){Q("number"==typeof a,"cannot write a non-number as a number"),Q(a>=0,"specified a negative value for writing an unsigned value"),Q(b>=a,"value is larger than maximum value for type"),Q(Math.floor(a)===a,"value has a fractional component")}function O(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value"),Q(Math.floor(a)===a,"value has a fractional component")}function P(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value")}function Q(a,b){if(!a)throw new Error(b||"Failed assertion")}var R=a("base64-js"),S=a("ieee754");c.Buffer=d,c.SlowBuffer=d,c.INSPECT_MAX_BYTES=50,d.poolSize=8192;var T=function(){try{var a=new ArrayBuffer(0),b=new Uint8Array(a);return b.foo=function(){return 42},42===b.foo()&&"function"==typeof b.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(c){return!1}}();d.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.isBuffer=function(a){return!(null==a||!a._isBuffer)},d.byteLength=function(a,b){var c;switch(a=a.toString(),b||"utf8"){case"hex":c=a.length/2;break;case"utf8":case"utf-8":c=H(a).length;break;case"ascii":case"binary":case"raw":c=a.length;break;case"base64":c=K(a).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":c=2*a.length;break;default:throw new Error("Unknown encoding")}return c},d.concat=function(a,b){if(Q(E(a),"Usage: Buffer.concat(list[, length])"),0===a.length)return new d(0);if(1===a.length)return a[0];var c;if(void 0===b)for(b=0,c=0;c<a.length;c++)b+=a[c].length;var e=new d(b),f=0;for(c=0;c<a.length;c++){var g=a[c];g.copy(e,f),f+=g.length}return e},d.compare=function(a,b){Q(d.isBuffer(a)&&d.isBuffer(b),"Arguments must be Buffers");for(var c=a.length,e=b.length,f=0,g=Math.min(c,e);g>f&&a[f]===b[f];f++);return f!==g&&(c=a[f],e=b[f]),e>c?-1:c>e?1:0},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var k=d;d=b,b=c,c=k}b=Number(b)||0;var l=this.length-b;c?(c=Number(c),c>l&&(c=l)):c=l,d=String(d||"utf8").toLowerCase();var m;switch(d){case"hex":m=e(this,a,b,c);break;case"utf8":case"utf-8":m=f(this,a,b,c);break;case"ascii":m=g(this,a,b,c);break;case"binary":m=h(this,a,b,c);break;case"base64":m=i(this,a,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":m=j(this,a,b,c);break;default:throw new Error("Unknown encoding")}return m},d.prototype.toString=function(a,b,c){var d=this;if(a=String(a||"utf8").toLowerCase(),b=Number(b)||0,c=void 0===c?d.length:Number(c),c===b)return"";var e;switch(a){case"hex":e=o(d,b,c);break;case"utf8":case"utf-8":e=l(d,b,c);break;case"ascii":e=m(d,b,c);break;case"binary":e=n(d,b,c);break;case"base64":e=k(d,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":e=p(d,b,c);break;default:throw new Error("Unknown encoding")}return e},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},d.prototype.equals=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),0===d.compare(this,a)},d.prototype.compare=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),d.compare(this,a)},d.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||0===d||(d=this.length),b||(b=0),d!==c&&0!==a.length&&0!==e.length){Q(d>=c,"sourceEnd < sourceStart"),Q(b>=0&&b<a.length,"targetStart out of bounds"),Q(c>=0&&c<e.length,"sourceStart out of bounds"),Q(d>=0&&d<=e.length,"sourceEnd out of bounds"),d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);var f=d-c;if(100>f||!T)for(var g=0;f>g;g++)a[g+b]=this[g+c];else a._set(this.subarray(c,c+f),b)}},d.prototype.slice=function(a,b){var c=this.length;if(a=~~a,b=void 0===b?c:~~b,0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c),0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c),a>b&&(b=a),T)return d._augment(this.subarray(a,b));for(var e=b-a,f=new d(e,void 0,!0),g=0;e>g;g++)f[g]=this[g+a];return f},d.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},d.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},d.prototype.readUInt8=function(a,b){return b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),a>=this.length?void 0:this[a]},d.prototype.readUInt16LE=function(a,b){return q(this,a,!0,b)},d.prototype.readUInt16BE=function(a,b){return q(this,a,!1,b)},d.prototype.readUInt32LE=function(a,b){return r(this,a,!0,b)},d.prototype.readUInt32BE=function(a,b){return r(this,a,!1,b)},d.prototype.readInt8=function(a,b){if(b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),!(a>=this.length)){var c=128&this[a];return c?-1*(255-this[a]+1):this[a]}},d.prototype.readInt16LE=function(a,b){return s(this,a,!0,b)},d.prototype.readInt16BE=function(a,b){return s(this,a,!1,b)},d.prototype.readInt32LE=function(a,b){return t(this,a,!0,b)},d.prototype.readInt32BE=function(a,b){return t(this,a,!1,b)},d.prototype.readFloatLE=function(a,b){return u(this,a,!0,b)},d.prototype.readFloatBE=function(a,b){return u(this,a,!1,b)},d.prototype.readDoubleLE=function(a,b){return v(this,a,!0,b)},d.prototype.readDoubleBE=function(a,b){return v(this,a,!1,b)},d.prototype.writeUInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"trying to write beyond buffer length"),N(a,255)),b>=this.length?void 0:(this[b]=a,b+1)},d.prototype.writeUInt16LE=function(a,b,c){return w(this,a,b,!0,c)},d.prototype.writeUInt16BE=function(a,b,c){return w(this,a,b,!1,c)},d.prototype.writeUInt32LE=function(a,b,c){return x(this,a,b,!0,c)},d.prototype.writeUInt32BE=function(a,b,c){return x(this,a,b,!1,c)},d.prototype.writeInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"Trying to write beyond buffer length"),O(a,127,-128)),b>=this.length?void 0:(a>=0?this.writeUInt8(a,b,c):this.writeUInt8(255+a+1,b,c),b+1)},d.prototype.writeInt16LE=function(a,b,c){return y(this,a,b,!0,c)},d.prototype.writeInt16BE=function(a,b,c){return y(this,a,b,!1,c)},d.prototype.writeInt32LE=function(a,b,c){return z(this,a,b,!0,c)},d.prototype.writeInt32BE=function(a,b,c){return z(this,a,b,!1,c)},d.prototype.writeFloatLE=function(a,b,c){return A(this,a,b,!0,c)},d.prototype.writeFloatBE=function(a,b,c){return A(this,a,b,!1,c)},d.prototype.writeDoubleLE=function(a,b,c){return B(this,a,b,!0,c)},d.prototype.writeDoubleBE=function(a,b,c){return B(this,a,b,!1,c)},d.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),Q(c>=b,"end < start"),c!==b&&0!==this.length){Q(b>=0&&b<this.length,"start out of bounds"),Q(c>=0&&c<=this.length,"end out of bounds");var d;if("number"==typeof a)for(d=b;c>d;d++)this[d]=a;else{var e=H(a.toString()),f=e.length;for(d=b;c>d;d++)this[d]=e[d%f]}return this}},d.prototype.inspect=function(){for(var a=[],b=this.length,d=0;b>d;d++)if(a[d]=G(this[d]),d===c.INSPECT_MAX_BYTES){a[d+1]="...";break}return"<Buffer "+a.join(" ")+">"},d.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(T)return new d(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;c>b;b+=1)a[b]=this[b];return a.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var U=d.prototype;d._augment=function(a){return a._isBuffer=!0,a._get=a.get,a._set=a.set,a.get=U.get,a.set=U.set,a.write=U.write,a.toString=U.toString,a.toLocaleString=U.toString,a.toJSON=U.toJSON,a.equals=U.equals,a.compare=U.compare,a.copy=U.copy,a.slice=U.slice,a.readUInt8=U.readUInt8,a.readUInt16LE=U.readUInt16LE,a.readUInt16BE=U.readUInt16BE,a.readUInt32LE=U.readUInt32LE,a.readUInt32BE=U.readUInt32BE,a.readInt8=U.readInt8,a.readInt16LE=U.readInt16LE,a.readInt16BE=U.readInt16BE,a.readInt32LE=U.readInt32LE,a.readInt32BE=U.readInt32BE,a.readFloatLE=U.readFloatLE,a.readFloatBE=U.readFloatBE,a.readDoubleLE=U.readDoubleLE,a.readDoubleBE=U.readDoubleBE,a.writeUInt8=U.writeUInt8,a.writeUInt16LE=U.writeUInt16LE,a.writeUInt16BE=U.writeUInt16BE,a.writeUInt32LE=U.writeUInt32LE,a.writeUInt32BE=U.writeUInt32BE,a.writeInt8=U.writeInt8,a.writeInt16LE=U.writeInt16LE,a.writeInt16BE=U.writeInt16BE,a.writeInt32LE=U.writeInt32LE,a.writeInt32BE=U.writeInt32BE,a.writeFloatLE=U.writeFloatLE,a.writeFloatBE=U.writeFloatBE,a.writeDoubleLE=U.writeDoubleLE,a.writeDoubleBE=U.writeDoubleBE,a.fill=U.fill,a.inspect=U.inspect,a.toArrayBuffer=U.toArrayBuffer,a};var V=/[^+\/0-9A-z]/g},{"base64-js":43,ieee754:44}],43:[function(a,b,c){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(a){"use strict";function b(a){var b=a.charCodeAt(0);return b===g?62:b===h?63:i>b?-1:i+10>b?b-i+26+26:k+26>b?b-k:j+26>b?b-j+26:void 0}function c(a){function c(a){j[l++]=a}var d,e,g,h,i,j;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new f(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,e=0;g>d;d+=4,e+=3)h=b(a.charAt(d))<<18|b(a.charAt(d+1))<<12|b(a.charAt(d+2))<<6|b(a.charAt(d+3)),c((16711680&h)>>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function e(a){function b(a){return d.charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var e,f,g,h=a.length%3,i="";for(e=0,g=a.length-h;g>e;e+=3)f=(a[e]<<16)+(a[e+1]<<8)+a[e+2],i+=c(f);switch(h){case 1:f=a[a.length-1],i+=b(f>>2),i+=b(f<<4&63),i+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],i+=b(f>>10),i+=b(f>>4&63),i+=b(f<<2&63),i+="="}return i}var f="undefined"!=typeof Uint8Array?Uint8Array:Array,g="+".charCodeAt(0),h="/".charCodeAt(0),i="0".charCodeAt(0),j="a".charCodeAt(0),k="A".charCodeAt(0);a.toByteArray=c,a.fromByteArray=e}("undefined"==typeof c?this.base64js={}:c)},{}],44:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],45:[function(a,b){b.exports="function"==typeof Object.create?function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],46:[function(a,b){function c(){}var d=b.exports={};d.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var d=c.shift();d()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.binding=function(){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(){throw new Error("process.chdir is not supported")}},{}],47:[function(a,b){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8}},{}],48:[function(a,b,c){(function(b,d){function e(a,b){var d={seen:[],stylize:g};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),p(b)?d.showHidden=b:b&&c._extend(d,b),v(d.showHidden)&&(d.showHidden=!1),v(d.depth)&&(d.depth=2),v(d.colors)&&(d.colors=!1),v(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=f),i(d,a,d.depth)}function f(a,b){var c=e.styles[b];return c?"["+e.colors[c][0]+"m"+a+"["+e.colors[c][1]+"m":a}function g(a){return a}function h(a){var b={};return a.forEach(function(a){b[a]=!0}),b}function i(a,b,d){if(a.customInspect&&b&&A(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return t(e)||(e=i(a,e,d)),e}var f=j(a,b);if(f)return f;var g=Object.keys(b),p=h(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),z(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return k(b);if(0===g.length){if(A(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(w(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(y(b))return a.stylize(Date.prototype.toString.call(b),"date");if(z(b))return k(b)}var r="",s=!1,u=["{","}"];if(o(b)&&(s=!0,u=["[","]"]),A(b)){var v=b.name?": "+b.name:"";r=" [Function"+v+"]"}if(w(b)&&(r=" "+RegExp.prototype.toString.call(b)),y(b)&&(r=" "+Date.prototype.toUTCString.call(b)),z(b)&&(r=" "+k(b)),0===g.length&&(!s||0==b.length))return u[0]+r+u[1];if(0>d)return w(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var x;return x=s?l(a,b,d,p,g):g.map(function(c){return m(a,b,d,p,c,s)}),a.seen.pop(),n(x,r,u)}function j(a,b){if(v(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return s(b)?a.stylize(""+b,"number"):p(b)?a.stylize(""+b,"boolean"):q(b)?a.stylize("null","null"):void 0}function k(a){return"["+Error.prototype.toString.call(a)+"]"}function l(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(F(b,String(g))?m(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(m(a,b,c,d,e,!0))}),f}function m(a,b,c,d,e,f){var g,h,j;if(j=Object.getOwnPropertyDescriptor(b,e)||{value:b[e]},j.get?h=j.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):j.set&&(h=a.stylize("[Setter]","special")),F(d,e)||(g="["+e+"]"),h||(a.seen.indexOf(j.value)<0?(h=q(c)?i(a,j.value,null):i(a,j.value,c-1),h.indexOf("\n")>-1&&(h=f?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),v(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function n(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function o(a){return Array.isArray(a)}function p(a){return"boolean"==typeof a}function q(a){return null===a}function r(a){return null==a}function s(a){return"number"==typeof a}function t(a){return"string"==typeof a}function u(a){return"symbol"==typeof a}function v(a){return void 0===a}function w(a){return x(a)&&"[object RegExp]"===C(a)}function x(a){return"object"==typeof a&&null!==a}function y(a){return x(a)&&"[object Date]"===C(a)}function z(a){return x(a)&&("[object Error]"===C(a)||a instanceof Error)}function A(a){return"function"==typeof a}function B(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function C(a){return Object.prototype.toString.call(a)}function D(a){return 10>a?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),J[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=/%[sdj%]/g;c.format=function(a){if(!t(a)){for(var b=[],c=0;c<arguments.length;c++)b.push(e(arguments[c]));return b.join(" ")}for(var c=1,d=arguments,f=d.length,g=String(a).replace(G,function(a){if("%%"===a)return"%";if(c>=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(b){return"[Circular]"}default:return a}}),h=d[c];f>c;h=d[++c])g+=q(h)||!x(h)?" "+h:" "+e(h);return g},c.deprecate=function(a,e){function f(){if(!g){if(b.throwDeprecation)throw new Error(e);b.traceDeprecation?console.trace(e):console.error(e),g=!0}return a.apply(this,arguments)}if(v(d.process))return function(){return c.deprecate(a,e).apply(this,arguments)};if(b.noDeprecation===!0)return a;var g=!1;return f};var H,I={};c.debuglog=function(a){if(v(H)&&(H=b.env.NODE_DEBUG||""),a=a.toUpperCase(),!I[a])if(new RegExp("\\b"+a+"\\b","i").test(H)){var d=b.pid;I[a]=function(){var b=c.format.apply(c,arguments);console.error("%s %d: %s",a,d,b)}}else I[a]=function(){};return I[a]},c.inspect=e,e.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},e.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},c.isArray=o,c.isBoolean=p,c.isNull=q,c.isNullOrUndefined=r,c.isNumber=s,c.isString=t,c.isSymbol=u,c.isUndefined=v,c.isRegExp=w,c.isObject=x,c.isDate=y,c.isError=z,c.isFunction=A,c.isPrimitive=B,c.isBuffer=a("./support/isBuffer");var J=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c.log=function(){console.log("%s - %s",E(),c.format.apply(c,arguments))},c.inherits=a("inherits"),c._extend=function(a,b){if(!b||!x(b))return a;for(var c=Object.keys(b),d=c.length;d--;)a[c[d]]=b[c[d]];return a}}).call(this,a("JkpR2F"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":47,JkpR2F:46,inherits:45}],49:[function(a,b,c){!function(d){"use strict";"function"==typeof a&&"object"==typeof c&&"object"==typeof b?b.exports=d:"function"==typeof define&&define.amd?define(function(){return d}):chai.use(d)}(function(a,b){"use strict";function c(a){return"function"==typeof a&&"function"==typeof a.getCall&&"function"==typeof a.calledWithExactly}function d(a){return 1===a?"once":2===a?"twice":3===a?"thrice":(a||0)+" times"}function e(a){return a&&c(a.proxy)}function f(a){if(!c(a._obj)&&!e(a._obj))throw new TypeError(b.inspect(a._obj)+" is not a spy or a call to a spy!")}function g(a,b,d,e,f){function g(b){return a.printf.apply(a,b)}var h=e?"always have ":"have ";return d=d||"",c(a.proxy)&&(a=a.proxy),{affirmative:g(["expected %n to "+h+b+d].concat(f)),negative:g(["expected %n to not "+h+b].concat(f))}}function h(c,d,e){b.addProperty(a.Assertion.prototype,c,function(){f(this);var a=g(this._obj,d,e,!1);this.assert(this._obj[c],a.affirmative,a.negative)})}function i(c,e,h){b.addMethod(a.Assertion.prototype,c,function(a){f(this);var b=g(this._obj,e,h,!1,[d(a)]);this.assert(this._obj[c]===a,b.affirmative,b.negative)})}function j(a,c,d){return function(){f(this);var e="always"+a[0].toUpperCase()+a.substring(1),h=b.flag(this,"always")&&"function"==typeof this._obj[e],i=h?e:a,j=g(this._obj,c,d,h,n.call(arguments));this.assert(this._obj[i].apply(this._obj,arguments),j.affirmative,j.negative)}}function k(c,d,e){var f=j(c,d,e);b.addProperty(a.Assertion.prototype,c,f)}function l(c,d,e,f){var g=j(d,e,f);b.addMethod(a.Assertion.prototype,c,g)}function m(a,b,c){l(a,a,b,c)}var n=Array.prototype.slice;b.addProperty(a.Assertion.prototype,"always",function(){b.flag(this,"always",!0)}),h("called","been called"," at least once, but it was never called"),i("callCount","been called exactly %1",", but it was called %c%C"),h("calledOnce","been called exactly once",", but it was called %c%C"),h("calledTwice","been called exactly twice",", but it was called %c%C"),h("calledThrice","been called exactly thrice",", but it was called %c%C"),k("calledWithNew","been called with new"),m("calledBefore","been called before %1"),m("calledAfter","been called after %1"),m("calledOn","been called with %1 as this",", but it was called with %t instead"),m("calledWith","been called with arguments %*","%C"),m("calledWithExactly","been called with exact arguments %*","%C"),m("calledWithMatch","been called with arguments matching %*","%C"),m("returned","returned %1"),l("thrown","threw","thrown %1")})},{}],50:[function(a,b,c){"use strict";!function(d){function e(a){var b=!1;try{a.appendChild(l),b=l.parentNode==a}catch(c){return!1}finally{try{a.removeChild(l)}catch(c){}}return b}function f(a){return l&&a&&1===a.nodeType&&e(a)}function g(a){return"function"==typeof a||!!(a&&a.constructor&&a.call&&a.apply)}function h(a){return"number"==typeof a&&isNaN(a)}function i(a,b){for(var c in b)m.call(a,c)||(a[c]=b[c])}function j(a){return"function"==typeof a&&"function"==typeof a.restore&&a.restore.sinon}function k(a,b,c){c.exports=n,n.spy=a("./sinon/spy"),n.spyCall=a("./sinon/call"),n.behavior=a("./sinon/behavior"),n.stub=a("./sinon/stub"),n.mock=a("./sinon/mock"),n.collection=a("./sinon/collection"),n.assert=a("./sinon/assert"),n.sandbox=a("./sinon/sandbox"),n.test=a("./sinon/test"),n.testCase=a("./sinon/test_case"),n.match=a("./sinon/match")}var l="undefined"!=typeof document&&document.createElement("div"),m=Object.prototype.hasOwnProperty,n={wrapMethod:function(a,b,c){if(!a)throw new TypeError("Should wrap property of object");if("function"!=typeof c)throw new TypeError("Method wrapper should be function");var d,e=a[b];if(g(e)){if(e.restore&&e.restore.sinon)d=new TypeError("Attempted to wrap "+b+" which is already wrapped");
|
||
else if(e.calledBefore){var f=e.returns?"stubbed":"spied on";d=new TypeError("Attempted to wrap "+b+" which is already "+f)}}else d=new TypeError("Attempted to wrap "+typeof e+" property "+b+" as function");if(d)throw e&&e._stack&&(d.stack+="\n--------------\n"+e._stack),d;var h=a.hasOwnProperty?a.hasOwnProperty(b):m.call(a,b);return a[b]=c,c.displayName=b,c._stack=new Error("Stack Trace for original").stack,c.restore=function(){h||delete a[b],a[b]===c&&(a[b]=e)},c.restore.sinon=!0,i(c,e),c},extend:function(a){for(var b=1,c=arguments.length;c>b;b+=1)for(var d in arguments[b])arguments[b].hasOwnProperty(d)&&(a[d]=arguments[b][d]),arguments[b].hasOwnProperty("toString")&&arguments[b].toString!=a.toString&&(a.toString=arguments[b].toString);return a},create:function(a){var b=function(){};return b.prototype=a,new b},deepEqual:function t(a,b){if(n.match&&n.match.isMatcher(a))return a.test(b);if("object"!=typeof a||"object"!=typeof b)return h(a)&&h(b)?!0:a===b;if(f(a)||f(b))return a===b;if(a===b)return!0;if(null===a&&null!==b||null!==a&&null===b)return!1;if(a instanceof RegExp&&b instanceof RegExp)return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;var c=Object.prototype.toString.call(a);if(c!=Object.prototype.toString.call(b))return!1;if("[object Date]"==c)return a.valueOf()===b.valueOf();var d,e=0,g=0;if("[object Array]"==c&&a.length!==b.length)return!1;for(d in a){if(e+=1,!(d in b))return!1;if(!t(a[d],b[d]))return!1}for(d in b)g+=1;return e==g},functionName:function(a){var b=a.displayName||a.name;if(!b){var c=a.toString().match(/function ([^\s\(]+)/);b=c&&c[1]}return b},functionToString:function(){if(this.getCall&&this.callCount)for(var a,b,c=this.callCount;c--;){a=this.getCall(c).thisValue;for(b in a)if(a[b]===this)return b}return this.displayName||"sinon fake"},getConfig:function(a){var b={};a=a||{};var c=n.defaultConfig;for(var d in c)c.hasOwnProperty(d)&&(b[d]=a.hasOwnProperty(d)?a[d]:c[d]);return b},format:function(a){return""+a},defaultConfig:{injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},timesInWords:function(a){return 1==a&&"once"||2==a&&"twice"||3==a&&"thrice"||(a||0)+" times"},calledInOrder:function(a){for(var b=1,c=a.length;c>b;b++)if(!a[b-1].calledBefore(a[b])||!a[b].called)return!1;return!0},orderByFirstCall:function(a){return a.sort(function(a,b){var c=a.getCall(0),d=b.getCall(0),e=c&&c.callId||-1,f=d&&d.callId||-1;return f>e?-1:1})},log:function(){},logError:function(a,b){var c=a+" threw exception: ";n.log(c+"["+b.name+"] "+b.message),b.stack&&n.log(b.stack),setTimeout(function(){throw b.message=c+b.message,b},0)},typeOf:function(a){if(null===a)return"null";if(void 0===a)return"undefined";var b=Object.prototype.toString.call(a);return b.substring(8,b.length-1).toLowerCase()},createStubInstance:function(a){if("function"!=typeof a)throw new TypeError("The constructor should be a function.");return n.stub(n.create(a.prototype))},restore:function(a){if(null!==a&&"object"==typeof a)for(var b in a)j(a[b])&&a[b].restore();else j(a)&&a.restore()}},o="undefined"!=typeof b&&b.exports&&"function"==typeof a,p="function"==typeof define&&"object"==typeof define.amd&&define.amd;if(p)define(k);else if(o){try{d=a("formatio")}catch(q){}k(a,c,b)}if(d){var r=d.configure({quoteStrings:!1});n.format=function(){return r.ascii.apply(r,arguments)}}else if(o)try{var s=a("util");n.format=function(a){return"object"==typeof a&&a.toString===Object.prototype.toString?s.inspect(a):a}}catch(q){}return n}("object"==typeof formatio&&formatio)},{"./sinon/assert":51,"./sinon/behavior":52,"./sinon/call":53,"./sinon/collection":54,"./sinon/match":55,"./sinon/mock":56,"./sinon/sandbox":57,"./sinon/spy":58,"./sinon/stub":59,"./sinon/test":60,"./sinon/test_case":61,formatio:63,util:48}],51:[function(a,b){(function(c){"use strict";!function(c,d){function e(){for(var a,b=0,c=arguments.length;c>b;++b)a=arguments[b],a||i.fail("fake is not a spy"),"function"!=typeof a&&i.fail(a+" is not a function"),"function"!=typeof a.getCall&&i.fail(a+" is not stubbed")}function f(a,b){a=a||d;var c=a.fail||i.fail;c.call(a,b)}function g(a,b,c){2==arguments.length&&(c=b,b=a),i[a]=function(d){e(d);var g=k.call(arguments,1),h=!1;h="function"==typeof b?!b(d):"function"==typeof d[b]?!d[b].apply(d,g):!d[b],h?f(this,d.printf.apply(d,[c].concat(g))):i.pass(a)}}function h(a,b){return!a||/^fail/.test(b)?b:a+b.slice(0,1).toUpperCase()+b.slice(1)}var i,j="undefined"!=typeof b&&b.exports&&"function"==typeof a,k=Array.prototype.slice;!c&&j&&(c=a("../sinon")),c&&(i={failException:"AssertError",fail:function(a){var b=new Error(a);throw b.name=this.failException||i.failException,b},pass:function(){},callOrder:function(){e.apply(null,arguments);var a="",b="";if(c.calledInOrder(arguments))i.pass("callOrder");else{try{a=[].join.call(arguments,", ");for(var d=k.call(arguments),g=d.length;g;)d[--g].called||d.splice(g,1);b=c.orderByFirstCall(d).join(", ")}catch(h){}f(this,"expected "+a+" to be called in order but were called as "+b)}},callCount:function(a,b){if(e(a),a.callCount!=b){var d="expected %n to be called "+c.timesInWords(b)+" but was called %c%C";f(this,a.printf(d))}else i.pass("callCount")},expose:function(a,b){if(!a)throw new TypeError("target is null or undefined");var c=b||{},d="undefined"==typeof c.prefix&&"assert"||c.prefix,e="undefined"==typeof c.includeFail||!!c.includeFail;for(var f in this)"export"==f||!e&&/^(fail)/.test(f)||(a[h(d,f)]=this[f]);return a},match:function(a,b){var d=c.match(b);if(d.test(a))i.pass("match");else{var e=["expected value to match"," expected = "+c.format(b)," actual = "+c.format(a)];f(this,e.join("\n"))}}},g("called","expected %n to have been called at least once but was never called"),g("notCalled",function(a){return!a.called},"expected %n to not have been called but was called %c%C"),g("calledOnce","expected %n to be called once but was called %c%C"),g("calledTwice","expected %n to be called twice but was called %c%C"),g("calledThrice","expected %n to be called thrice but was called %c%C"),g("calledOn","expected %n to be called with %1 as this but was called with %t"),g("alwaysCalledOn","expected %n to always be called with %1 as this but was called with %t"),g("calledWithNew","expected %n to be called with new"),g("alwaysCalledWithNew","expected %n to always be called with new"),g("calledWith","expected %n to be called with arguments %*%C"),g("calledWithMatch","expected %n to be called with match %*%C"),g("alwaysCalledWith","expected %n to always be called with arguments %*%C"),g("alwaysCalledWithMatch","expected %n to always be called with match %*%C"),g("calledWithExactly","expected %n to be called with exact arguments %*%C"),g("alwaysCalledWithExactly","expected %n to always be called with exact arguments %*%C"),g("neverCalledWith","expected %n to never be called with arguments %*%C"),g("neverCalledWithMatch","expected %n to never be called with match %*%C"),g("threw","%n did not throw exception%C"),g("alwaysThrew","%n did not always throw exception%C"),c.assert=i,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=i}):j&&(b.exports=i))}("object"==typeof sinon&&sinon||null,"undefined"!=typeof window?window:"undefined"!=typeof self?self:c)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../sinon":50}],52:[function(a,b){(function(c){"use strict";!function(d){function e(a,b){return"string"==typeof a?(this.exception=new Error(b||""),this.exception.name=a):this.exception=a?a:new Error("Error"),this}function f(a,b){var c=a.callArgAt;if(0>c){for(var d=a.callArgProp,e=0,f=b.length;f>e;++e){if(!d&&"function"==typeof b[e])return b[e];if(d&&b[e]&&"function"==typeof b[e][d])return b[e][d]}return null}return b[c]}function g(a,b,c){if(a.callArgAt<0){var e;return e=a.callArgProp?d.functionName(a.stub)+" expected to yield to '"+a.callArgProp+"', but no object with such a property was passed.":d.functionName(a.stub)+" expected to yield, but no callback was passed.",c.length>0&&(e+=" Received ["+l.call(c,", ")+"]"),e}return"argument at index "+a.callArgAt+" is not a function: "+b}function h(a,b){if("number"==typeof a.callArgAt){var c=f(a,b);if("function"!=typeof c)throw new TypeError(g(a,c,b));a.callbackAsync?m(function(){c.apply(a.callbackContext,a.callbackArguments)}):c.apply(a.callbackContext,a.callbackArguments)}}var i="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!d&&i&&(d=a("../sinon")),d){var j,k=Array.prototype.slice,l=Array.prototype.join,m=function(){return"object"==typeof c&&"function"==typeof c.nextTick?c.nextTick:"function"==typeof setImmediate?setImmediate:function(a){setTimeout(a,0)}}();j={create:function(a){var b=d.extend({},d.behavior);return delete b.create,b.stub=a,b},isPresent:function(){return"number"==typeof this.callArgAt||this.exception||"number"==typeof this.returnArgAt||this.returnThis||this.returnValueDefined},invoke:function(a,b){if(h(this,b),this.exception)throw this.exception;return"number"==typeof this.returnArgAt?b[this.returnArgAt]:this.returnThis?a:this.returnValue},onCall:function(a){return this.stub.onCall(a)},onFirstCall:function(){return this.stub.onFirstCall()},onSecondCall:function(){return this.stub.onSecondCall()},onThirdCall:function(){return this.stub.onThirdCall()},withArgs:function(){throw new Error('Defining a stub by invoking "stub.onCall(...).withArgs(...)" is not supported. Use "stub.withArgs(...).onCall(...)" to define sequential behavior for calls with certain arguments.')},callsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOn:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgWith:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.callArgAt=a,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOnWith:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},yields:function(){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,0),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsOn:function(a){if("object"!=typeof a)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=a,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsTo:function(a){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=a,this.callbackAsync=!1,this},yieldsToOn:function(a,b){if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=a,this.callbackAsync=!1,this},"throws":e,throwsException:e,returns:function(a){return this.returnValue=a,this.returnValueDefined=!0,this},returnsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.returnArgAt=a,this},returnsThis:function(){return this.returnThis=!0,this}};for(var n in j)j.hasOwnProperty(n)&&n.match(/^(callsArg|yields)/)&&!n.match(/Async/)&&(j[n+"Async"]=function(a){return function(){var b=this[a].apply(this,arguments);return this.callbackAsync=!0,b}}(n));d.behavior=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):i&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)}).call(this,a("JkpR2F"))},{"../sinon":50,JkpR2F:46}],53:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.functionName(a)+b;throw d.length&&(e+=" Received ["+g.call(d).join(", ")+"]"),new Error(e)}function e(a,b,d,e,f,g){if("number"!=typeof g)throw new TypeError("Call id is not a number");var i=c.create(h);return i.proxy=a,i.thisValue=b,i.args=d,i.returnValue=e,i.exception=f,i.callId=g,i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&f&&(c=a("../sinon")),c){var g=Array.prototype.slice,h={calledOn:function(a){return c.match&&c.match.isMatcher(a)?a.test(this.thisValue):this.thisValue===a},calledWith:function(){for(var a=0,b=arguments.length;b>a;a+=1)if(!c.deepEqual(arguments[a],this.args[a]))return!1;return!0},calledWithMatch:function(){for(var a=0,b=arguments.length;b>a;a+=1){var d=this.args[a],e=arguments[a];if(!c.match||!c.match(e).test(d))return!1}return!0},calledWithExactly:function(){return arguments.length==this.args.length&&this.calledWith.apply(this,arguments)},notCalledWith:function(){return!this.calledWith.apply(this,arguments)},notCalledWithMatch:function(){return!this.calledWithMatch.apply(this,arguments)},returned:function(a){return c.deepEqual(a,this.returnValue)},threw:function(a){return"undefined"!=typeof a&&this.exception?this.exception===a||this.exception.name===a:!!this.exception},calledWithNew:function(){return this.proxy.prototype&&this.thisValue instanceof this.proxy},calledBefore:function(a){return this.callId<a.callId},calledAfter:function(a){return this.callId>a.callId},callArg:function(a){this.args[a]()},callArgOn:function(a,b){this.args[a].apply(b)},callArgWith:function(a){this.callArgOnWith.apply(this,[a,null].concat(g.call(arguments,1)))},callArgOnWith:function(a,b){var c=g.call(arguments,2);this.args[a].apply(b,c)},"yield":function(){this.yieldOn.apply(this,[null].concat(g.call(arguments,0)))},yieldOn:function(a){for(var b=this.args,c=0,e=b.length;e>c;++c)if("function"==typeof b[c])return void b[c].apply(a,g.call(arguments,1));d(this.proxy," cannot yield since no callback was passed.",b)},yieldTo:function(a){this.yieldToOn.apply(this,[a,null].concat(g.call(arguments,1)))},yieldToOn:function(a,b){for(var c=this.args,e=0,f=c.length;f>e;++e)if(c[e]&&"function"==typeof c[e][a])return void c[e][a].apply(b,g.call(arguments,2));d(this.proxy," cannot yield to '"+a+"' since no callback was passed.",c)},toString:function(){for(var a=this.proxy.toString()+"(",b=[],d=0,e=this.args.length;e>d;++d)b.push(c.format(this.args[d]));return a=a+b.join(", ")+")","undefined"!=typeof this.returnValue&&(a+=" => "+c.format(this.returnValue)),this.exception&&(a+=" !"+this.exception.name,this.exception.message&&(a+="("+this.exception.message+")")),a}};h.invokeCallback=h.yield,e.toString=h.toString,c.spyCall=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],54:[function(a,b){"use strict";!function(c){function d(a){return a.fakes||(a.fakes=[]),a.fakes}function e(a,b){for(var c=d(a),e=0,f=c.length;f>e;e+=1)"function"==typeof c[e][b]&&c[e][b]()}function f(a){for(var b=d(a),c=0;c<b.length;)b.splice(c,1)}var g="undefined"!=typeof b&&b.exports&&"function"==typeof a,h=[].push,i=Object.prototype.hasOwnProperty;if(!c&&g&&(c=a("../sinon")),c){var j={verify:function(){e(this,"verify")},restore:function(){e(this,"restore"),f(this)},verifyAndRestore:function(){var a;try{this.verify()}catch(b){a=b}if(this.restore(),a)throw a},add:function(a){return h.call(d(this),a),a},spy:function(){return this.add(c.spy.apply(c,arguments))},stub:function(a,b,d){if(b){var e=a[b];if("function"!=typeof e){if(!i.call(a,b))throw new TypeError("Cannot stub non-existent own property "+b);return a[b]=d,this.add({restore:function(){a[b]=e}})}}if(!b&&a&&"object"==typeof a){var f=c.stub.apply(c,arguments);for(var g in f)"function"==typeof f[g]&&this.add(f[g]);return f}return this.add(c.stub.apply(c,arguments))},mock:function(){return this.add(c.mock.apply(c,arguments))},inject:function(a){var b=this;return a.spy=function(){return b.spy.apply(b,arguments)},a.stub=function(){return b.stub.apply(b,arguments)},a.mock=function(){return b.mock.apply(b,arguments)},a}};c.collection=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):g&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],55:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.typeOf(a);if(e!==b)throw new TypeError("Expected type of "+d+" to be "+b+", but was "+e)}function e(a){return i.isPrototypeOf(a)}function f(a,b){if(null===b||void 0===b)return!1;for(var d in a)if(a.hasOwnProperty(d)){var e=a[d],g=b[d];if(j.isMatcher(e)){if(!e.test(g))return!1}else if("object"===c.typeOf(e)){if(!f(e,g))return!1}else if(!c.deepEqual(e,g))return!1}return!0}function g(a,b){return function(e,f){d(e,"string","property");var g=1===arguments.length,h=b+'("'+e+'"';return g||(h+=", "+f),h+=")",j(function(b){return void 0!==b&&null!==b&&a(b,e)?g||c.deepEqual(f,b[e]):!1},h)}}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i={toString:function(){return this.message}};i.or=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)||a.test(c)},d.message=b.message+".or("+a.message+")",d},i.and=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)&&a.test(c)},d.message=b.message+".and("+a.message+")",d};var j=function(a,b){var d=c.create(i),e=c.typeOf(a);switch(e){case"object":if("function"==typeof a.test)return d.test=function(b){return a.test(b)===!0},d.message="match("+c.functionName(a.test)+")",d;var g=[];for(var h in a)a.hasOwnProperty(h)&&g.push(h+": "+a[h]);d.test=function(b){return f(a,b)},d.message="match("+g.join(", ")+")";break;case"number":d.test=function(b){return a==b};break;case"string":d.test=function(b){return"string"!=typeof b?!1:-1!==b.indexOf(a)},d.message='match("'+a+'")';break;case"regexp":d.test=function(b){return"string"!=typeof b?!1:a.test(b)};break;case"function":d.test=a,d.message=b?b:"match("+c.functionName(a)+")";break;default:d.test=function(b){return c.deepEqual(a,b)}}return d.message||(d.message="match("+a+")"),d};j.isMatcher=e,j.any=j(function(){return!0},"any"),j.defined=j(function(a){return null!==a&&void 0!==a},"defined"),j.truthy=j(function(a){return!!a},"truthy"),j.falsy=j(function(a){return!a},"falsy"),j.same=function(a){return j(function(b){return a===b},"same("+a+")")},j.typeOf=function(a){return d(a,"string","type"),j(function(b){return c.typeOf(b)===a},'typeOf("'+a+'")')},j.instanceOf=function(a){return d(a,"function","type"),j(function(b){return b instanceof a},"instanceOf("+c.functionName(a)+")")},j.has=g(function(a,b){return"object"==typeof a?b in a:void 0!==a[b]},"has"),j.hasOwn=g(function(a,b){return a.hasOwnProperty(b)},"hasOwn"),j.bool=j.typeOf("boolean"),j.number=j.typeOf("number"),j.string=j.typeOf("string"),j.object=j.typeOf("object"),j.func=j.typeOf("function"),j.array=j.typeOf("array"),j.regexp=j.typeOf("regexp"),j.date=j.typeOf("date"),c.match=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):h&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],56:[function(a,b){"use strict";!function(c){function d(a){return a?d.create(a):c.expectation.create("Anonymous mock")}var e,f="undefined"!=typeof b&&b.exports&&"function"==typeof a,g=[].push;if(!c&&f&&(c=a("../sinon")),c){e=c.match,!e&&f&&(e=a("./match")),c.mock=d,c.extend(d,function(){function a(a,b){if(a)for(var c=0,d=a.length;d>c;c+=1)b(a[c])}return{create:function(a){if(!a)throw new TypeError("object is null");var b=c.extend({},d);return b.object=a,delete b.create,b},expects:function(a){if(!a)throw new TypeError("method is falsy");if(this.expectations||(this.expectations={},this.proxies=[]),!this.expectations[a]){this.expectations[a]=[];var b=this;c.wrapMethod(this.object,a,function(){return b.invokeMethod(a,this,arguments)}),g.call(this.proxies,a)}var d=c.expectation.create(a);return g.call(this.expectations[a],d),d},restore:function(){var b=this.object;a(this.proxies,function(a){"function"==typeof b[a].restore&&b[a].restore()})},verify:function(){var b=this.expectations||{},d=[],e=[];return a(this.proxies,function(c){a(b[c],function(a){a.met()?g.call(e,a.toString()):g.call(d,a.toString())})}),this.restore(),d.length>0?c.expectation.fail(d.concat(e).join("\n")):c.expectation.pass(d.concat(e).join("\n")),!0},invokeMethod:function(a,b,d){var e,f=this.expectations&&this.expectations[a],h=f&&f.length||0;for(e=0;h>e;e+=1)if(!f[e].met()&&f[e].allowsCall(b,d))return f[e].apply(b,d);var i,j=[],k=0;for(e=0;h>e;e+=1)f[e].allowsCall(b,d)?i=i||f[e]:k+=1,g.call(j," "+f[e].toString());return 0===k?i.apply(b,d):(j.unshift("Unexpected call: "+c.spyCall.toString.call({proxy:a,args:d})),void c.expectation.fail(j.join("\n")))}}}());var h=c.timesInWords;c.expectation=function(){function a(a){return 0==a?"never called":"called "+h(a)}function b(a){var b=a.minCalls,c=a.maxCalls;if("number"==typeof b&&"number"==typeof c){var d=h(b);return b!=c&&(d="at least "+d+" and at most "+h(c)),d}return"number"==typeof b?"at least "+h(b):"at most "+h(c)}function d(a){var b="number"==typeof a.minCalls;return!b||a.callCount>=a.minCalls}function f(a){return"number"!=typeof a.maxCalls?!1:a.callCount==a.maxCalls}function i(a,b){return e&&e.isMatcher(a)?a.test(b):!0}var j=Array.prototype.slice,k=c.spy.invoke;return{minCalls:1,maxCalls:1,create:function(a){var b=c.extend(c.stub.create(),c.expectation);return delete b.create,b.method=a,b},invoke:function(a,b,c){return this.verifyCallAllowed(b,c),k.apply(this,arguments)},atLeast:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");return this.limitsSet||(this.maxCalls=null,this.limitsSet=!0),this.minCalls=a,this},atMost:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");return this.limitsSet||(this.minCalls=null,this.limitsSet=!0),this.maxCalls=a,this},never:function(){return this.exactly(0)},once:function(){return this.exactly(1)},twice:function(){return this.exactly(2)},thrice:function(){return this.exactly(3)},exactly:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not a number");return this.atLeast(a),this.atMost(a)},met:function(){return!this.failed&&d(this)},verifyCallAllowed:function(a,b){if(f(this)&&(this.failed=!0,c.expectation.fail(this.method+" already called "+h(this.maxCalls))),"expectedThis"in this&&this.expectedThis!==a&&c.expectation.fail(this.method+" called with "+a+" as thisValue, expected "+this.expectedThis),"expectedArguments"in this){b||c.expectation.fail(this.method+" received no arguments, expected "+c.format(this.expectedArguments)),b.length<this.expectedArguments.length&&c.expectation.fail(this.method+" received too few arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments)),this.expectsExactArgCount&&b.length!=this.expectedArguments.length&&c.expectation.fail(this.method+" received too many arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments));for(var d=0,e=this.expectedArguments.length;e>d;d+=1)i(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", didn't match "+this.expectedArguments.toString()),c.deepEqual(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", expected "+c.format(this.expectedArguments))}},allowsCall:function(a,b){if(this.met()&&f(this))return!1;if("expectedThis"in this&&this.expectedThis!==a)return!1;if(!("expectedArguments"in this))return!0;if(b=b||[],b.length<this.expectedArguments.length)return!1;if(this.expectsExactArgCount&&b.length!=this.expectedArguments.length)return!1;for(var d=0,e=this.expectedArguments.length;e>d;d+=1){if(!i(this.expectedArguments[d],b[d]))return!1;if(!c.deepEqual(this.expectedArguments[d],b[d]))return!1}return!0},withArgs:function(){return this.expectedArguments=j.call(arguments),this},withExactArgs:function(){return this.withArgs.apply(this,arguments),this.expectsExactArgCount=!0,this},on:function(a){return this.expectedThis=a,this},toString:function(){var d=(this.expectedArguments||[]).slice();this.expectsExactArgCount||g.call(d,"[...]");var e=c.spyCall.toString.call({proxy:this.method||"anonymous mock expectation",args:d}),f=e.replace(", [...","[, ...")+" "+b(this);return this.met()?"Expectation met: "+f:"Expected "+f+" ("+a(this.callCount)+")"},verify:function(){return this.met()?c.expectation.pass(this.toString()):c.expectation.fail(this.toString()),!0},pass:function(a){c.assert.pass(a)},fail:function(a){var b=new Error(a);throw b.name="ExpectationError",b}}}(),c.mock=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):f&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50,"./match":55}],57:[function(a,b){"use strict";if("undefined"!=typeof b&&b.exports&&"function"==typeof a){var c=a("../sinon");c.extend(c,a("./util/fake_timers"))}!function(){function a(a,b,c,d){d&&(!b.injectInto||c in b.injectInto?e.call(a.args,d):(b.injectInto[c]=d,a.injectedKeys.push(c)))}function d(a){var b=c.create(c.sandbox);return a.useFakeServer&&("object"==typeof a.useFakeServer&&(b.serverPrototype=a.useFakeServer),b.useFakeServer()),a.useFakeTimers&&("object"==typeof a.useFakeTimers?b.useFakeTimers.apply(b,a.useFakeTimers):b.useFakeTimers()),b}var e=[].push;c.sandbox=c.extend(c.create(c.collection),{useFakeTimers:function(){return this.clock=c.useFakeTimers.apply(c,arguments),this.add(this.clock)},serverPrototype:c.fakeServer,useFakeServer:function(){var a=this.serverPrototype||c.fakeServer;return a&&a.create?(this.server=a.create(),this.add(this.server)):null},inject:function(a){return c.collection.inject.call(this,a),this.clock&&(a.clock=this.clock),this.server&&(a.server=this.server,a.requests=this.server.requests),a},restore:function(){c.collection.restore.apply(this,arguments),this.restoreContext()},restoreContext:function(){if(this.injectedKeys){for(var a=0,b=this.injectedKeys.length;b>a;a++)delete this.injectInto[this.injectedKeys[a]];this.injectedKeys=[]}},create:function(b){if(!b)return c.create(c.sandbox);var e=d(b);e.args=e.args||[],e.injectedKeys=[],e.injectInto=b.injectInto;var f,g,h=e.inject({});if(b.properties)for(var i=0,j=b.properties.length;j>i;i++)f=b.properties[i],g=h[f]||"sandbox"==f&&e,a(e,b,f,g);else a(e,b,"sandbox",g);return e}}),c.sandbox.useFakeXMLHttpRequest=c.sandbox.useFakeServer,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=c.sandbox}):"undefined"!=typeof b&&b.exports&&(b.exports=c.sandbox)}()},{"../sinon":50,"./util/fake_timers":62}],58:[function(require,module,exports){"use strict";!function(sinon){function spy(a,b){if(!b&&"function"==typeof a)return spy.create(a);if(!a&&!b)return spy.create(function(){});var c=a[b];return sinon.wrapMethod(a,b,spy.create(c))}function matchingFake(a,b,c){if(a)for(var d=0,e=a.length;e>d;d++)if(a[d].matches(b,c))return a[d]}function incrementCallCount(){this.called=!0,this.callCount+=1,this.notCalled=!1,this.calledOnce=1==this.callCount,this.calledTwice=2==this.callCount,this.calledThrice=3==this.callCount}function createCallProperties(){this.firstCall=this.getCall(0),this.secondCall=this.getCall(1),this.thirdCall=this.getCall(2),this.lastCall=this.getCall(this.callCount-1)}function createProxy(func){var p;return func.length?eval("p = (function proxy("+vars.substring(0,2*func.length-1)+") { return p.invoke(func, this, slice.call(arguments)); });"):p=function(){return p.invoke(func,this,slice.call(arguments))},p}function delegateToCalls(a,b,c,d){spyApi[a]=function(){if(!this.called)return d?d.apply(this,arguments):!1;for(var e,f=0,g=0,h=this.callCount;h>g;g+=1)if(e=this.getCall(g),e[c||a].apply(e,arguments)&&(f+=1,b))return!0;return f===this.callCount}}var commonJSModule="undefined"!=typeof module&&module.exports&&"function"==typeof require,push=Array.prototype.push,slice=Array.prototype.slice,callId=0;if(!sinon&&commonJSModule&&(sinon=require("../sinon")),sinon){var vars="a,b,c,d,e,f,g,h,i,j,k,l",uuid=0,spyApi={reset:function(){if(this.called=!1,this.notCalled=!0,this.calledOnce=!1,this.calledTwice=!1,this.calledThrice=!1,this.callCount=0,this.firstCall=null,this.secondCall=null,this.thirdCall=null,this.lastCall=null,this.args=[],this.returnValues=[],this.thisValues=[],this.exceptions=[],this.callIds=[],this.fakes)for(var a=0;a<this.fakes.length;a++)this.fakes[a].reset()},create:function(a){var b;"function"!=typeof a?a=function(){}:b=sinon.functionName(a);var c=createProxy(a);return sinon.extend(c,spy),delete c.create,sinon.extend(c,a),c.reset(),c.prototype=a.prototype,c.displayName=b||"spy",c.toString=sinon.functionToString,c._create=sinon.spy.create,c.id="spy#"+uuid++,c},invoke:function(a,b,c){var d,e,f=matchingFake(this.fakes,c);incrementCallCount.call(this),push.call(this.thisValues,b),push.call(this.args,c),push.call(this.callIds,callId++),createCallProperties.call(this);try{e=f?f.invoke(a,b,c):(this.func||a).apply(b,c);var g=this.getCall(this.callCount-1);g.calledWithNew()&&"object"!=typeof e&&(e=b)}catch(h){d=h}if(push.call(this.exceptions,d),push.call(this.returnValues,e),createCallProperties.call(this),void 0!==d)throw d;return e},named:function(a){return this.displayName=a,this},getCall:function(a){return 0>a||a>=this.callCount?null:sinon.spyCall(this,this.thisValues[a],this.args[a],this.returnValues[a],this.exceptions[a],this.callIds[a])},getCalls:function(){var a,b=[];for(a=0;a<this.callCount;a++)b.push(this.getCall(a));return b},calledBefore:function(a){return this.called?a.called?this.callIds[0]<a.callIds[a.callIds.length-1]:!0:!1},calledAfter:function(a){return this.called&&a.called?this.callIds[this.callCount-1]>a.callIds[a.callCount-1]:!1},withArgs:function(){var a=slice.call(arguments);if(this.fakes){var b=matchingFake(this.fakes,a,!0);if(b)return b}else this.fakes=[];var c=this,d=this._create();d.matchingAguments=a,d.parent=this,push.call(this.fakes,d),d.withArgs=function(){return c.withArgs.apply(c,arguments)};for(var e=0;e<this.args.length;e++)d.matches(this.args[e])&&(incrementCallCount.call(d),push.call(d.thisValues,this.thisValues[e]),push.call(d.args,this.args[e]),push.call(d.returnValues,this.returnValues[e]),push.call(d.exceptions,this.exceptions[e]),push.call(d.callIds,this.callIds[e]));return createCallProperties.call(d),d},matches:function(a,b){var c=this.matchingAguments;return c.length<=a.length&&sinon.deepEqual(c,a.slice(0,c.length))?!b||c.length==a.length:void 0},printf:function(a){var b,c=this,d=slice.call(arguments,1);return(a||"").replace(/%(.)/g,function(a,e){return b=spyApi.formatters[e],"function"==typeof b?b.call(null,c,d):isNaN(parseInt(e,10))?"%"+e:sinon.format(d[e-1])})}};delegateToCalls("calledOn",!0),delegateToCalls("alwaysCalledOn",!1,"calledOn"),delegateToCalls("calledWith",!0),delegateToCalls("calledWithMatch",!0),delegateToCalls("alwaysCalledWith",!1,"calledWith"),delegateToCalls("alwaysCalledWithMatch",!1,"calledWithMatch"),delegateToCalls("calledWithExactly",!0),delegateToCalls("alwaysCalledWithExactly",!1,"calledWithExactly"),delegateToCalls("neverCalledWith",!1,"notCalledWith",function(){return!0}),delegateToCalls("neverCalledWithMatch",!1,"notCalledWithMatch",function(){return!0}),delegateToCalls("threw",!0),delegateToCalls("alwaysThrew",!1,"threw"),delegateToCalls("returned",!0),delegateToCalls("alwaysReturned",!1,"returned"),delegateToCalls("calledWithNew",!0),delegateToCalls("alwaysCalledWithNew",!1,"calledWithNew"),delegateToCalls("callArg",!1,"callArgWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")
|
||
}),spyApi.callArgWith=spyApi.callArg,delegateToCalls("callArgOn",!1,"callArgOnWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")}),spyApi.callArgOnWith=spyApi.callArgOn,delegateToCalls("yield",!1,"yield",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),spyApi.invokeCallback=spyApi.yield,delegateToCalls("yieldOn",!1,"yieldOn",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),delegateToCalls("yieldTo",!1,"yieldTo",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),delegateToCalls("yieldToOn",!1,"yieldToOn",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),spyApi.formatters={c:function(a){return sinon.timesInWords(a.callCount)},n:function(a){return a.toString()},C:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c){var e=" "+a.getCall(c).toString();/\n/.test(b[c-1])&&(e="\n"+e),push.call(b,e)}return b.length>0?"\n"+b.join("\n"):""},t:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c)push.call(b,sinon.format(a.thisValues[c]));return b.join(", ")},"*":function(a,b){for(var c=[],d=0,e=b.length;e>d;++d)push.call(c,sinon.format(b[d]));return c.join(", ")}},sinon.extend(spy,spyApi),spy.spyCall=sinon.spyCall,sinon.spy=spy,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=spy}):commonJSModule&&(module.exports=spy)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],59:[function(a,b){"use strict";!function(c){function d(a,b,e){if(e&&"function"!=typeof e)throw new TypeError("Custom stub should be function");var f;if(f=e?c.spy&&c.spy.create?c.spy.create(e):e:d.create(),!a&&"undefined"==typeof b)return c.stub.create();if("undefined"==typeof b&&"object"==typeof a){for(var g in a)"function"==typeof a[g]&&d(a,g);return a}return c.wrapMethod(a,b,f)}function e(a){return a.defaultBehavior||f(a)||c.behavior.create(a)}function f(a){return a.parent&&g(a.parent)}function g(a){var b=a.behaviors[a.callCount-1];return b&&b.isPresent()?b:e(a)}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i=0;c.extend(d,function(){var a={create:function(){var a=function(){return g(a).invoke(this,arguments)};a.id="stub#"+i++;var b=a;return a=c.spy.create(a),a.func=b,c.extend(a,d),a._create=c.stub.create,a.displayName="stub",a.toString=c.functionToString,a.defaultBehavior=null,a.behaviors=[],a},resetBehavior:function(){var a;if(this.defaultBehavior=null,this.behaviors=[],delete this.returnValue,delete this.returnArgAt,this.returnThis=!1,this.fakes)for(a=0;a<this.fakes.length;a++)this.fakes[a].resetBehavior()},onCall:function(a){return this.behaviors[a]||(this.behaviors[a]=c.behavior.create(this)),this.behaviors[a]},onFirstCall:function(){return this.onCall(0)},onSecondCall:function(){return this.onCall(1)},onThirdCall:function(){return this.onCall(2)}};for(var b in c.behavior)c.behavior.hasOwnProperty(b)&&!a.hasOwnProperty(b)&&"create"!=b&&"withArgs"!=b&&"invoke"!=b&&(a[b]=function(a){return function(){return this.defaultBehavior=this.defaultBehavior||c.behavior.create(this),this.defaultBehavior[a].apply(this.defaultBehavior,arguments),this}}(b));return a}()),c.stub=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):h&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],60:[function(a,b){"use strict";!function(c){function d(a){function b(){var b=c.getConfig(c.config);b.injectInto=b.injectIntoThis&&this||b.injectInto;var d,e,f=c.sandbox.create(b),g=Array.prototype.slice.call(arguments).concat(f.args);try{e=a.apply(this,g)}catch(h){d=h}if("undefined"!=typeof d)throw f.restore(),d;return f.verifyAndRestore(),e}var d=typeof a;if("function"!=d)throw new TypeError("sinon.test needs to wrap a test function, got "+d);return a.length?function(){return b.apply(this,arguments)}:b}var e="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&e&&(c=a("../sinon")),c&&(d.config={injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},c.test=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):e&&(b.exports=d))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],61:[function(a,b){"use strict";!function(c){function d(a,b,c){return function(){b&&b.apply(this,arguments);var d,e;try{e=a.apply(this,arguments)}catch(f){d=f}if(c&&c.apply(this,arguments),d)throw d;return e}}function e(a,b){if(!a||"object"!=typeof a)throw new TypeError("sinon.testCase needs an object with test functions");b=b||"test";var e,f,g,h=new RegExp("^"+b),i={},j=a.setUp,k=a.tearDown;for(e in a)if(a.hasOwnProperty(e)){if(f=a[e],/^(setUp|tearDown)$/.test(e))continue;"function"==typeof f&&h.test(e)?(g=f,(j||k)&&(g=d(f,j,k)),i[e]=c.test(g)):i[e]=a[e]}return i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&f&&(c=a("../sinon")),c&&Object.prototype.hasOwnProperty&&(c.testCase=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],62:[function(require,module,exports){(function(global){"use strict";if("undefined"==typeof sinon)var sinon={};!function(global){function addTimer(a,b){if(0===a.length)throw new Error("Function requires at least 1 parameter");if("undefined"==typeof a[0])throw new Error("Callback must be provided to timer calls");var c=id++,d=a[1]||0;return this.timeouts||(this.timeouts={}),this.timeouts[c]={id:c,func:a[0],callAt:this.now+d,invokeArgs:Array.prototype.slice.call(a,2)},b===!0&&(this.timeouts[c].interval=d),addTimerReturnsObject?{id:c,ref:function(){},unref:function(){}}:c}function parseTime(a){if(!a)return 0;var b,c=a.split(":"),d=c.length,e=d,f=0;if(d>3||!/^(\d\d:){0,2}\d\d?$/.test(a))throw new Error("tick only understands numbers and 'h:m:s'");for(;e--;){if(b=parseInt(c[e],10),b>=60)throw new Error("Invalid time "+a);f+=b*Math.pow(60,d-e-1)}return 1e3*f}function createObject(a){var b;if(Object.create)b=Object.create(a);else{var c=function(){};c.prototype=a,b=new c}return b.Date.clock=b,b}function mirrorDateProperties(a,b){b.now?a.now=function(){return a.clock.now}:delete a.now,b.toSource?a.toSource=function(){return b.toSource()}:delete a.toSource,a.toString=function(){return b.toString()},a.prototype=b.prototype,a.parse=b.parse,a.UTC=b.UTC,a.prototype.toUTCString=b.prototype.toUTCString;for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function restore(){for(var a,b=0,c=this.methods.length;c>b;b++)if(a=this.methods[b],global[a].hadOwnProperty)global[a]=this["_"+a];else try{delete global[a]}catch(d){}this.methods=[]}function stubGlobal(a,b){if(b[a].hadOwnProperty=Object.prototype.hasOwnProperty.call(global,a),b["_"+a]=global[a],"Date"==a){var c=mirrorDateProperties(b[a],global[a]);global[a]=c}else{global[a]=function(){return b[a].apply(b,arguments)};for(var d in b[a])b[a].hasOwnProperty(d)&&(global[a][d]=b[a][d])}global[a].clock=b}var timeoutResult=setTimeout(function(){},0),addTimerReturnsObject="object"==typeof timeoutResult;clearTimeout(timeoutResult);var id=1;sinon.clock={now:0,create:function(a){var b=createObject(this);if("number"==typeof a&&(b.now=a),a&&"object"==typeof a)throw new TypeError("now should be milliseconds since UNIX epoch");return b},setTimeout:function(){return addTimer.call(this,arguments,!1)},clearTimeout:function(a){a&&(this.timeouts||(this.timeouts=[]),"object"==typeof a&&(a=a.id),a in this.timeouts&&delete this.timeouts[a])},setInterval:function(){return addTimer.call(this,arguments,!0)},clearInterval:function(a){this.clearTimeout(a)},setImmediate:function(a){var b=Array.prototype.slice.call(arguments,1);return addTimer.call(this,[a,0].concat(b),!1)},clearImmediate:function(a){this.clearTimeout(a)},tick:function(a){a="number"==typeof a?a:parseTime(a);for(var b,c=this.now,d=this.now+a,e=this.now,f=this.firstTimerInRange(c,d);f&&d>=c;){if(this.timeouts[f.id]){c=this.now=f.callAt;try{this.callTimer(f)}catch(g){b=b||g}}f=this.firstTimerInRange(e,d),e=c}if(this.now=d,b)throw b;return this.now},firstTimerInRange:function(a,b){var c,d,e=null;for(var f in this.timeouts)if(this.timeouts.hasOwnProperty(f)){if(this.timeouts[f].callAt<a||this.timeouts[f].callAt>b)continue;(null===e||this.timeouts[f].callAt<e)&&(d=this.timeouts[f],e=this.timeouts[f].callAt,c={func:this.timeouts[f].func,callAt:this.timeouts[f].callAt,interval:this.timeouts[f].interval,id:this.timeouts[f].id,invokeArgs:this.timeouts[f].invokeArgs})}return c||null},callTimer:function(timer){"number"==typeof timer.interval?this.timeouts[timer.id].callAt+=timer.interval:delete this.timeouts[timer.id];try{"function"==typeof timer.func?timer.func.apply(null,timer.invokeArgs):eval(timer.func)}catch(e){var exception=e}if(this.timeouts[timer.id]){if(exception)throw exception}else if(exception)throw exception},reset:function(){this.timeouts={}},Date:function(){function a(c,d,e,f,g,h,i){switch(arguments.length){case 0:return new b(a.clock.now);case 1:return new b(c);case 2:return new b(c,d);case 3:return new b(c,d,e);case 4:return new b(c,d,e,f);case 5:return new b(c,d,e,f,g);case 6:return new b(c,d,e,f,g,h);default:return new b(c,d,e,f,g,h,i)}}var b=Date;return mirrorDateProperties(a,b)}()};var methods=["Date","setTimeout","setInterval","clearTimeout","clearInterval"];"undefined"!=typeof global.setImmediate&&methods.push("setImmediate"),"undefined"!=typeof global.clearImmediate&&methods.push("clearImmediate"),sinon.useFakeTimers=function(a){var b=sinon.clock.create(a);b.restore=restore,b.methods=Array.prototype.slice.call(arguments,"number"==typeof a?1:0),0===b.methods.length&&(b.methods=methods);for(var c=0,d=b.methods.length;d>c;c++)stubGlobal(b.methods[c],b);return b}}("undefined"!=typeof global&&"function"!=typeof global?global:this),sinon.timers={setTimeout:setTimeout,clearTimeout:clearTimeout,setImmediate:"undefined"!=typeof setImmediate?setImmediate:void 0,clearImmediate:"undefined"!=typeof clearImmediate?clearImmediate:void 0,setInterval:setInterval,clearInterval:clearInterval,Date:Date},"undefined"!=typeof module&&module.exports&&(module.exports=sinon)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],63:[function(a,b){(function(c){("function"==typeof define&&define.amd&&function(a){define("formatio",["samsam"],a)}||"object"==typeof b&&function(c){b.exports=c(a("samsam"))}||function(a){this.formatio=a(this.samsam)})(function(a){"use strict";function b(a){if(!a)return"";if(a.displayName)return a.displayName;if(a.name)return a.name;var b=a.toString().match(/function\s+([^\(]+)/m);return b&&b[1]||""}function d(a,c){var d,e,f=b(c&&c.constructor),g=a.excludeConstructors||h.excludeConstructors||[];for(d=0,e=g.length;e>d;++d){if("string"==typeof g[d]&&g[d]===f)return"";if(g[d].test&&g[d].test(f))return""}return f}function e(a,b){if("object"!=typeof a)return!1;var c,d;for(c=0,d=b.length;d>c;++c)if(b[c]===a)return!0;return!1}function f(b,c,d,g){if("string"==typeof c){var h=b.quoteStrings,j="boolean"!=typeof h||h;return d||j?'"'+c+'"':c}if("function"==typeof c&&!(c instanceof RegExp))return f.func(c);if(d=d||[],e(c,d))return"[Circular]";if("[object Array]"===Object.prototype.toString.call(c))return f.array.call(b,c,d);if(!c)return String(1/c===-1/0?"-0":c);if(a.isElement(c))return f.element(c);if("function"==typeof c.toString&&c.toString!==Object.prototype.toString)return c.toString();var k,l;for(k=0,l=i.length;l>k;k++)if(c===i[k].object)return i[k].value;return f.object.call(b,c,d,g)}function g(a){for(var b in a)this[b]=a[b]}var h={excludeConstructors:["Object",/^.$/],quoteStrings:!0},i=(Object.prototype.hasOwnProperty,[]);return"undefined"!=typeof c&&i.push({object:c,value:"[object global]"}),"undefined"!=typeof document&&i.push({object:document,value:"[object HTMLDocument]"}),"undefined"!=typeof window&&i.push({object:window,value:"[object Window]"}),f.func=function(a){return"function "+b(a)+"() {}"},f.array=function(a,b){b=b||[],b.push(a);var c,d,e=[];for(c=0,d=a.length;d>c;++c)e.push(f(this,a[c],b));return"["+e.join(", ")+"]"},f.object=function(b,c,g){c=c||[],c.push(b),g=g||0;var h,i,j,k,l,m=[],n=a.keys(b).sort(),o=3;for(k=0,l=n.length;l>k;++k)h=n[k],j=b[h],i=e(j,c)?"[Circular]":f(this,j,c,g+2),i=(/\s/.test(h)?'"'+h+'"':h)+": "+i,o+=i.length,m.push(i);var p=d(this,b),q=p?"["+p+"] ":"",r="";for(k=0,l=g;l>k;++k)r+=" ";return o+g>80?q+"{\n "+r+m.join(",\n "+r)+"\n"+r+"}":q+"{ "+m.join(", ")+" }"},f.element=function(a){var b,c,d,e,f,g=a.tagName.toLowerCase(),h=a.attributes,i=[];for(d=0,e=h.length;e>d;++d)b=h.item(d),c=b.nodeName.toLowerCase().replace("html:",""),f=b.nodeValue,("contenteditable"!==c||"inherit"!==f)&&f&&i.push(c+'="'+f+'"');var j="<"+g+(i.length>0?" ":""),k=a.innerHTML;k.length>20&&(k=k.substr(0,20)+"[...]");var l=j+i.join(" ")+">"+k+"</"+g+">";return l.replace(/ contentEditable="inherit"/,"")},g.prototype={functionName:b,configure:function(a){return new g(a)},constructorName:function(a){return d(this,a)},ascii:function(a,b,c){return f(this,a,b,c)}},g.prototype})}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{samsam:64}],64:[function(a,b){("function"==typeof define&&define.amd&&function(a){define("samsam",a)}||"object"==typeof b&&function(a){b.exports=a()}||function(a){this.samsam=a()})(function(){function a(a){var b=a;return"number"==typeof a&&a!==b}function b(a){return l.toString.call(a).split(/[ \]]/)[1]}function c(a){if("Arguments"===b(a))return!0;if("object"!=typeof a||"number"!=typeof a.length||"Array"===b(a))return!1;if("function"==typeof a.callee)return!0;try{a[a.length]=6,delete a[a.length]}catch(c){return!0}return!1}function d(a){if(!a||1!==a.nodeType||!m)return!1;try{a.appendChild(m),a.removeChild(m)}catch(b){return!1}return!0}function e(a){var b,c=[];for(b in a)l.hasOwnProperty.call(a,b)&&c.push(b);return c}function f(a){return"function"==typeof a.getTime&&a.getTime()==a.valueOf()}function g(a){return 0===a&&1/a===-1/0}function h(b,c){return b===c||a(b)&&a(c)?0!==b||g(b)===g(c):void 0}function i(g,i){function j(a){return"object"!=typeof a||null===a||a instanceof Boolean||a instanceof Date||a instanceof Number||a instanceof RegExp||a instanceof String?!1:!0}function k(a,b){var c;for(c=0;c<a.length;c++)if(a[c]===b)return c;return-1}var m=[],n=[],o=[],p=[],q={};return function r(g,i,s,t){var u=typeof g,v=typeof i;if(g===i||a(g)||a(i)||null==g||null==i||"object"!==u||"object"!==v)return h(g,i);if(d(g)||d(i))return!1;var w=f(g),x=f(i);if(!(!w&&!x||w&&x&&g.getTime()===i.getTime()))return!1;if(g instanceof RegExp&&i instanceof RegExp&&g.toString()!==i.toString())return!1;var y=b(g),z=b(i),A=e(g),B=e(i);if(c(g)||c(i)){if(g.length!==i.length)return!1}else if(u!==v||y!==z||A.length!==B.length)return!1;var C,D,E,F,G,H,I,J,K,L,M;for(D=0,E=A.length;E>D;D++){if(C=A[D],!l.hasOwnProperty.call(i,C))return!1;if(F=g[C],G=i[C],H=j(F),I=j(G),J=H?k(m,F):-1,K=I?k(n,G):-1,L=-1!==J?o[J]:s+"["+JSON.stringify(C)+"]",M=-1!==K?p[K]:t+"["+JSON.stringify(C)+"]",q[L+M])return!0;if(-1===J&&H&&(m.push(F),o.push(L)),-1===K&&I&&(n.push(G),p.push(M)),H&&I&&(q[L+M]=!0),!r(F,G,L,M))return!1}return!0}(g,i,"$1","$2")}function j(a,b){if(0===b.length)return!0;var c,d,e,f;for(c=0,d=a.length;d>c;++c)if(k(a[c],b[0])){for(e=0,f=b.length;f>e;++e)if(!k(a[c+e],b[e]))return!1;return!0}return!1}var k,l=Object.prototype,m="undefined"!=typeof document&&document.createElement("div");return k=function n(a,c){if(c&&"function"==typeof c.test)return c.test(a);if("function"==typeof c)return c(a)===!0;if("string"==typeof c){c=c.toLowerCase();var d="string"==typeof a||!!a;return d&&String(a).toLowerCase().indexOf(c)>=0}if("number"==typeof c)return c===a;if("boolean"==typeof c)return c===a;if("Array"===b(a)&&"Array"===b(c))return j(a,c);if(c&&"object"==typeof c){var e;for(e in c){var f=a[e];if("undefined"==typeof f&&"function"==typeof a.getAttribute&&(f=a.getAttribute(e)),"undefined"==typeof f||!n(f,c[e]))return!1}return!0}throw new Error("Matcher was not a string, a number, a function, a boolean or an object")},{isArguments:c,isElement:d,isDate:f,isNegZero:g,identical:h,deepEqual:i,match:k,keys:e}})},{}],65:[function(a,b,c){(function(){var a=this,d=a._,e={},f=Array.prototype,g=Object.prototype,h=Function.prototype,i=f.push,j=f.slice,k=f.concat,l=g.toString,m=g.hasOwnProperty,n=f.forEach,o=f.map,p=f.reduce,q=f.reduceRight,r=f.filter,s=f.every,t=f.some,u=f.indexOf,v=f.lastIndexOf,w=Array.isArray,x=Object.keys,y=h.bind,z=function(a){return a instanceof z?a:this instanceof z?void(this._wrapped=a):new z(a)};"undefined"!=typeof c?("undefined"!=typeof b&&b.exports&&(c=b.exports=z),c._=z):a._=z,z.VERSION="1.6.0";var A=z.each=z.forEach=function(a,b,c){if(null==a)return a;if(n&&a.forEach===n)a.forEach(b,c);else if(a.length===+a.length){for(var d=0,f=a.length;f>d;d++)if(b.call(c,a[d],d,a)===e)return}else for(var g=z.keys(a),d=0,f=g.length;f>d;d++)if(b.call(c,a[g[d]],g[d],a)===e)return;return a};z.map=z.collect=function(a,b,c){var d=[];return null==a?d:o&&a.map===o?a.map(b,c):(A(a,function(a,e,f){d.push(b.call(c,a,e,f))}),d)};var B="Reduce of empty array with no initial value";z.reduce=z.foldl=z.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),p&&a.reduce===p)return d&&(b=z.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(A(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(B);return c},z.reduceRight=z.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),q&&a.reduceRight===q)return d&&(b=z.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=z.keys(a);f=g.length}if(A(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(B);return c},z.find=z.detect=function(a,b,c){var d;return C(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},z.filter=z.select=function(a,b,c){var d=[];return null==a?d:r&&a.filter===r?a.filter(b,c):(A(a,function(a,e,f){b.call(c,a,e,f)&&d.push(a)}),d)},z.reject=function(a,b,c){return z.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},z.every=z.all=function(a,b,c){b||(b=z.identity);var d=!0;return null==a?d:s&&a.every===s?a.every(b,c):(A(a,function(a,f,g){return(d=d&&b.call(c,a,f,g))?void 0:e}),!!d)};var C=z.some=z.any=function(a,b,c){b||(b=z.identity);var d=!1;return null==a?d:t&&a.some===t?a.some(b,c):(A(a,function(a,f,g){return d||(d=b.call(c,a,f,g))?e:void 0}),!!d)};z.contains=z.include=function(a,b){return null==a?!1:u&&a.indexOf===u?-1!=a.indexOf(b):C(a,function(a){return a===b})},z.invoke=function(a,b){var c=j.call(arguments,2),d=z.isFunction(b);return z.map(a,function(a){return(d?b:a[b]).apply(a,c)})},z.pluck=function(a,b){return z.map(a,z.property(b))},z.where=function(a,b){return z.filter(a,z.matches(b))},z.findWhere=function(a,b){return z.find(a,z.matches(b))},z.max=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);var d=-1/0,e=-1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;h>e&&(d=a,e=h)}),d},z.min=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);var d=1/0,e=1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;e>h&&(d=a,e=h)}),d},z.shuffle=function(a){var b,c=0,d=[];return A(a,function(a){b=z.random(c++),d[c-1]=d[b],d[b]=a}),d},z.sample=function(a,b,c){return null==b||c?(a.length!==+a.length&&(a=z.values(a)),a[z.random(a.length-1)]):z.shuffle(a).slice(0,Math.max(0,b))};var D=function(a){return null==a?z.identity:z.isFunction(a)?a:z.property(a)};z.sortBy=function(a,b,c){return b=D(b),z.pluck(z.map(a,function(a,d,e){return{value:a,index:d,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index-b.index}),"value")};var E=function(a){return function(b,c,d){var e={};return c=D(c),A(b,function(f,g){var h=c.call(d,f,g,b);a(e,h,f)}),e}};z.groupBy=E(function(a,b,c){z.has(a,b)?a[b].push(c):a[b]=[c]}),z.indexBy=E(function(a,b,c){a[b]=c}),z.countBy=E(function(a,b){z.has(a,b)?a[b]++:a[b]=1}),z.sortedIndex=function(a,b,c,d){c=D(c);for(var e=c.call(d,b),f=0,g=a.length;g>f;){var h=f+g>>>1;c.call(d,a[h])<e?f=h+1:g=h}return f},z.toArray=function(a){return a?z.isArray(a)?j.call(a):a.length===+a.length?z.map(a,z.identity):z.values(a):[]},z.size=function(a){return null==a?0:a.length===+a.length?a.length:z.keys(a).length},z.first=z.head=z.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:0>b?[]:j.call(a,0,b)},z.initial=function(a,b,c){return j.call(a,0,a.length-(null==b||c?1:b))},z.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:j.call(a,Math.max(a.length-b,0))},z.rest=z.tail=z.drop=function(a,b,c){return j.call(a,null==b||c?1:b)},z.compact=function(a){return z.filter(a,z.identity)};var F=function(a,b,c){return b&&z.every(a,z.isArray)?k.apply(c,a):(A(a,function(a){z.isArray(a)||z.isArguments(a)?b?i.apply(c,a):F(a,b,c):c.push(a)}),c)};z.flatten=function(a,b){return F(a,b,[])},z.without=function(a){return z.difference(a,j.call(arguments,1))},z.partition=function(a,b){var c=[],d=[];return A(a,function(a){(b(a)?c:d).push(a)}),[c,d]},z.uniq=z.unique=function(a,b,c,d){z.isFunction(b)&&(d=c,c=b,b=!1);var e=c?z.map(a,c,d):a,f=[],g=[];return A(e,function(c,d){(b?d&&g[g.length-1]===c:z.contains(g,c))||(g.push(c),f.push(a[d]))}),f},z.union=function(){return z.uniq(z.flatten(arguments,!0))},z.intersection=function(a){var b=j.call(arguments,1);return z.filter(z.uniq(a),function(a){return z.every(b,function(b){return z.contains(b,a)})})},z.difference=function(a){var b=k.apply(f,j.call(arguments,1));return z.filter(a,function(a){return!z.contains(b,a)})},z.zip=function(){for(var a=z.max(z.pluck(arguments,"length").concat(0)),b=new Array(a),c=0;a>c;c++)b[c]=z.pluck(arguments,""+c);return b},z.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},z.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=z.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(u&&a.indexOf===u)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},z.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(v&&a.lastIndexOf===v)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},z.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);d>e;)f[e++]=a,a+=c;return f};var G=function(){};z.bind=function(a,b){var c,d;if(y&&a.bind===y)return y.apply(a,j.call(arguments,1));if(!z.isFunction(a))throw new TypeError;return c=j.call(arguments,2),d=function(){if(!(this instanceof d))return a.apply(b,c.concat(j.call(arguments)));G.prototype=a.prototype;var e=new G;G.prototype=null;var f=a.apply(e,c.concat(j.call(arguments)));return Object(f)===f?f:e}},z.partial=function(a){var b=j.call(arguments,1);return function(){for(var c=0,d=b.slice(),e=0,f=d.length;f>e;e++)d[e]===z&&(d[e]=arguments[c++]);for(;c<arguments.length;)d.push(arguments[c++]);return a.apply(this,d)}},z.bindAll=function(a){var b=j.call(arguments,1);if(0===b.length)throw new Error("bindAll must be passed function names");return A(b,function(b){a[b]=z.bind(a[b],a)}),a},z.memoize=function(a,b){var c={};return b||(b=z.identity),function(){var d=b.apply(this,arguments);return z.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},z.delay=function(a,b){var c=j.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},z.defer=function(a){return z.delay.apply(z,[a,1].concat(j.call(arguments,1)))},z.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:z.now(),g=null,f=a.apply(d,e),d=e=null};return function(){var j=z.now();h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k?(clearTimeout(g),g=null,h=j,f=a.apply(d,e),d=e=null):g||c.trailing===!1||(g=setTimeout(i,k)),f}},z.debounce=function(a,b,c){var d,e,f,g,h,i=function(){var j=z.now()-g;b>j?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),f=e=null))};return function(){f=this,e=arguments,g=z.now();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}},z.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},z.wrap=function(a,b){return z.partial(b,a)},z.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},z.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},z.keys=function(a){if(!z.isObject(a))return[];if(x)return x(a);var b=[];for(var c in a)z.has(a,c)&&b.push(c);return b},z.values=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},z.pairs=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},z.invert=function(a){for(var b={},c=z.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},z.functions=z.methods=function(a){var b=[];for(var c in a)z.isFunction(a[c])&&b.push(c);return b.sort()},z.extend=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},z.pick=function(a){var b={},c=k.apply(f,j.call(arguments,1));return A(c,function(c){c in a&&(b[c]=a[c])}),b},z.omit=function(a){var b={},c=k.apply(f,j.call(arguments,1));for(var d in a)z.contains(c,d)||(b[d]=a[d]);return b},z.defaults=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)void 0===a[c]&&(a[c]=b[c])}),a},z.clone=function(a){return z.isObject(a)?z.isArray(a)?a.slice():z.extend({},a):a},z.tap=function(a,b){return b(a),a};var H=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof z&&(a=a._wrapped),b instanceof z&&(b=b._wrapped);var e=l.call(a);if(e!=l.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;var g=a.constructor,h=b.constructor;if(g!==h&&!(z.isFunction(g)&&g instanceof g&&z.isFunction(h)&&h instanceof h)&&"constructor"in a&&"constructor"in b)return!1;c.push(a),d.push(b);var i=0,j=!0;if("[object Array]"==e){if(i=a.length,j=i==b.length)for(;i--&&(j=H(a[i],b[i],c,d)););}else{for(var k in a)if(z.has(a,k)&&(i++,!(j=z.has(b,k)&&H(a[k],b[k],c,d))))break;if(j){for(k in b)if(z.has(b,k)&&!i--)break;j=!i}}return c.pop(),d.pop(),j};z.isEqual=function(a,b){return H(a,b,[],[])},z.isEmpty=function(a){if(null==a)return!0;if(z.isArray(a)||z.isString(a))return 0===a.length;for(var b in a)if(z.has(a,b))return!1;return!0},z.isElement=function(a){return!(!a||1!==a.nodeType)},z.isArray=w||function(a){return"[object Array]"==l.call(a)},z.isObject=function(a){return a===Object(a)},A(["Arguments","Function","String","Number","Date","RegExp"],function(a){z["is"+a]=function(b){return l.call(b)=="[object "+a+"]"}}),z.isArguments(arguments)||(z.isArguments=function(a){return!(!a||!z.has(a,"callee"))}),"function"!=typeof/./&&(z.isFunction=function(a){return"function"==typeof a}),z.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},z.isNaN=function(a){return z.isNumber(a)&&a!=+a},z.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==l.call(a)},z.isNull=function(a){return null===a},z.isUndefined=function(a){return void 0===a},z.has=function(a,b){return m.call(a,b)},z.noConflict=function(){return a._=d,this},z.identity=function(a){return a},z.constant=function(a){return function(){return a}},z.property=function(a){return function(b){return b[a]}},z.matches=function(a){return function(b){if(b===a)return!0;for(var c in a)if(a[c]!==b[c])return!1;return!0}},z.times=function(a,b,c){for(var d=Array(Math.max(0,a)),e=0;a>e;e++)d[e]=b.call(c,e);return d},z.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))},z.now=Date.now||function(){return(new Date).getTime()};var I={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};I.unescape=z.invert(I.escape);var J={escape:new RegExp("["+z.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+z.keys(I.unescape).join("|")+")","g")};z.each(["escape","unescape"],function(a){z[a]=function(b){return null==b?"":(""+b).replace(J[a],function(b){return I[a][b]})}}),z.result=function(a,b){if(null==a)return void 0;var c=a[b];return z.isFunction(c)?c.call(a):c},z.mixin=function(a){A(z.functions(a),function(b){var c=z[b]=a[b];z.prototype[b]=function(){var a=[this._wrapped];return i.apply(a,arguments),O.call(this,c.apply(z,a))}})};var K=0;z.uniqueId=function(a){var b=++K+"";return a?a+b:b},z.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var L=/(.)^/,M={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},N=/\\|'|\r|\n|\t|\u2028|\u2029/g;z.template=function(a,b,c){var d;c=z.defaults({},c,z.templateSettings);var e=new RegExp([(c.escape||L).source,(c.interpolate||L).source,(c.evaluate||L).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(N,function(a){return"\\"+M[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=new Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,z);var i=function(a){return d.call(this,a,z)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},z.chain=function(a){return z(a).chain()};var O=function(a){return this._chain?z(a).chain():a};z.mixin(z),A(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=f[a];z.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],O.call(this,c)}}),A(["concat","join","slice"],function(a){var b=f[a];z.prototype[a]=function(){return O.call(this,b.apply(this._wrapped,arguments))}}),z.extend(z.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return z})}).call(this)},{}],66:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:10,sinon:50,"sinon-chai":49,underscore:65}],67:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/TextYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/TextYatta.coffee":4,chai:10,sinon:50,"sinon-chai":49,underscore:65}],68:[function(a){var b,c,d,e,f,g,h,i,j,k=function(a,b){return function(){return a.apply(b,arguments)}};e=a("chai"),f=e.expect,g=e.should(),h=a("sinon"),i=a("sinon-chai"),j=a("underscore"),e.use(i),d=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee"),c=function(){function a(){this.applyRandomOp=k(this.applyRandomOp,this),this.generateRandomOp=k(this.generateRandomOp,this),this.generateDeleteOp=k(this.generateDeleteOp,this),this.generateReplaceOp=k(this.generateReplaceOp,this),this.generateInsertOp=k(this.generateInsertOp,this),this.number_of_test_cases_multiplier=1,this.repeat_this=10*this.number_of_test_cases_multiplier,this.doSomething_amount=200*this.number_of_test_cases_multiplier,this.number_of_engines=12+this.number_of_test_cases_multiplier-1,this.time=0,this.ops=0,this.time_now=0,this.reinitialize()
|
||
}return a.prototype.reinitialize=function(){var a,c,e,f;for(this.users=[],this.Connector=b(this.users),this.users.push(new d(0,this.Connector)),this.users[0].val("name","initial"),f=[],a=c=1,e=this.number_of_engines;e>=1?e>c:c>e;a=e>=1?++c:--c)f.push(this.users.push(new d(a,this.Connector)));return f},a.prototype.getSomeUser=function(){var a;return a=j.random(0,this.users.length-1),this.users[a]},a.prototype.getRandomText=function(){var a,b,c,d;return a="abcdefghijklmnopqrstuvwxyz",b=j.random(0,10),c=a[j.random(0,a.length-1)],d="",j(b).times(function(){return d+=c}),d},a.prototype.generateInsertOp=function(a){var b;return b=j.random(0,this.users[a].val("name").val().length-1),this.users[a].val("name").insertText(b,this.getRandomText()),null},a.prototype.generateReplaceOp=function(a){return this.users[a].val("name").replaceText(this.getRandomText()),null},a.prototype.generateDeleteOp=function(a){var b,c,d;return void(this.users[a].val("name").val().length>0&&(d=j.random(0,this.users[a].val("name").val().length-1),b=1,c=this.users[a].val("name").deleteText(d,b)))},a.prototype.generateRandomOp=function(a){var b,c,d;return d=[this.generateDeleteOp,this.generateInsertOp,this.generateReplaceOp],b=j.random(d.length-1),c=d[b](a)},a.prototype.applyRandomOp=function(a){var b;return b=this.users[a],b.getConnector().flushOneRandom()},a.prototype.doSomething=function(){var a,b,c;return c=j.random(this.number_of_engines-1),b=[this.applyRandomOp,this.generateRandomOp],a=j.random(b.length-1),b[a](c)},a.prototype.flushAll=function(){var a,b,c,d,e,f;for(e=this.users,f=[],b=c=0,d=e.length;d>c;b=++c)a=e[b],f.push(a.getConnector().flushAll());return f},a.prototype.compareAll=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;for(this.flushAll(),this.time+=(new Date).getTime()-this.time_now,d=0,b=i=0,m=this.users.length;m>=0?m>i:i>m;b=m>=0?++i:--i)d+=this.users[b].getConnector().getOpsInExecutionOrder().length;for(this.ops+=d*this.users.length,f=Math.floor(this.ops/this.time),null!=a&&console.log(""+a+"/"+this.repeat_this+": Every collaborator ("+this.users.length+") applied "+this.number_of_created_operations+" ops in a different order."+(" Over all we consumed "+this.ops+" operations in "+this.time/1e3+" seconds ("+f+" ops/msek).")),o=[],b=j=0,n=this.users.length-1;n>=0?n>j:j>n;b=n>=0?++j:--j)if(this.users[b].val("name").val()!==this.users[b+1].val("name").val()){for(g=function(a,b){var c,d,e,f,g,h,i,j;for(e=this.users[a].getConnector().getOpsInExecutionOrder(),g=0,i=e.length;i>g;g++)f=e[g],console.log(JSON.stringify(f));for(console.log(""),f="ops = [",c=h=0,j=e.length;j>h;c=++h)d=e[c],0!==c&&(f+=", "),f+="op"+c;return f+="]",console.log(f),console.log("@users[@last_user].ot.applyOps ops"),console.log("expect(@users[@last_user].ot.val('name')).to.equal(\""+users[b].val("name")+'")'),e},console.log(""),console.log("Found an OT Puzzle!"),console.log("OT states:"),c=k=0,l=users.length;l>k;c=++k)h=users[c],console.log("OT"+c+": "+h.val("name"));console.log("\nOT execution order ("+b+","+(b+1)+"):"),g(b,b+1),console.log(""),e=g(b+1,b),o.push(console.log(""))}else o.push(void 0);return o},a.prototype.run=function(){var a,b,c,d,e,f,g;for(console.log(""),g=[],b=c=1,e=this.repeat_this;e>=1?e>=c:c>=e;b=e>=1?++c:--c){for(this.time_now=(new Date).getTime(),a=d=1,f=this.doSomething_amount;f>=1?f>=d:d>=f;a=f>=1?++d:--d)this.doSomething();this.compareAll(b),g.push(this.reinitialize())}return g},a}(),describe("JsonYatta",function(){return beforeEach(function(a){return this.yTest=new c,a()}),it("has a JsonWrapper",function(){var a,b;return b=this.yTest.getSomeUser().root_element,b.val("x","dtrn","immutable"),b.val("set",{x:"x"},"immutable"),a=b.value,a.x,a.set={y:""},a.x,a.set,a.set.x,f(a.x).to.equal("dtrn"),f(a.set.x).to.equal("x")}),it("can handle creaton of complex json",function(){return this.yTest.getSomeUser().val("x",{a:"b"}),this.yTest.getSomeUser().val("a",{a:{q:"dtrndtrtdrntdrnrtdnrtdnrtdnrtdnrdnrdt"}}),this.yTest.getSomeUser().val("b",{a:{}}),this.yTest.getSomeUser().val("c",{a:"c"}),this.yTest.getSomeUser().val("c",{a:"b"}),this.yTest.compareAll(),console.log(this.yTest.getSomeUser().value.a.a.q.val())}),it("handles some immutable tests",function(){return this.yTest.getSomeUser().val("string","text","immutable"),this.yTest.getSomeUser().val("number",4,"immutable"),this.yTest.getSomeUser().val("object",{q:"rr"},"immutable"),this.yTest.compareAll(),f(this.yTest.getSomeUser().val("string")).to.equal("text"),f(this.yTest.getSomeUser().val("number")).to.equal(4),f(this.yTest.getSomeUser().val("object").val("q")).to.equal("rr")}),it("can handle many engines, many operations, concurrently (random)",function(){return this.yTest.run()})})},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:10,sinon:50,"sinon-chai":49,underscore:65}]},{},[66,67,68]),!function g(a,b,c){function d(f,h){if(!b[f]){if(!a[f]){var i="function"==typeof require&&require;if(!h&&i)return i(f,!0);if(e)return e(f,!0);throw new Error("Cannot find module '"+f+"'")}var j=b[f]={exports:{}};a[f][0].call(j.exports,function(b){var c=a[f][1][b];return d(c?c:b)},j,j.exports,g,a,b,c)}return b[f].exports}for(var e="function"==typeof require&&require,f=0;f<c.length;f++)d(c[f]);return d}({1:[function(a,b){var c;c=a("underscore"),b.exports=function(a){var b;return b=function(){function b(b,c,d){var e,f;this.engine=b,this.HB=c,this.execution_listener=d,f=function(a){return function(b){return a.send(b)}}(this),this.execution_listener.push(f),this.applied_operations=[],e=function(a){return function(b){return a.applied_operations.push(b)}}(this),this.execution_listener.push(e),0!==(null!=a?a.length:void 0)&&this.engine.applyOps(a[0].getHistoryBuffer()._encode()),this.unexecuted={}}return b.prototype.getOpsInExecutionOrder=function(){return this.applied_operations},b.prototype.getRootElement=function(){return a.length>0?a[0].getRootElement().getUid():void 0},b.prototype.send=function(b){var c,d,e,f;if(b.uid.creator===this.HB.getUserId()&&"string"!=typeof b.uid.op_number){for(f=[],d=0,e=a.length;e>d;d++)c=a[d],f.push(c.getUserId()!==this.HB.getUserId()?c.getConnector().receive(b):void 0);return f}},b.prototype.receive=function(a){var b,c;return null==(b=this.unexecuted)[c=a.creator]&&(b[c]=[]),this.unexecuted[a.creator].push(a)},b.prototype.flushOne=function(a){var b;return(null!=(b=this.unexecuted[a])?b.length:void 0)>0?this.engine.applyOp(this.unexecuted[a].shift()):void 0},b.prototype.flushOneRandom=function(){return this.flushOne(c.random(0,a.length-1))},b.prototype.flushAll=function(){var a,b,c;c=this.unexecuted;for(a in c)b=c[a],this.engine.applyOps(b);return this.unexecuted={}},b.prototype.sync=function(){throw new Error("Can't use this a.t.m.")},b}()}},{underscore:65}],2:[function(a,b){var c;c=function(){function a(a,b){this.HB=a,this.parser=b,this.unprocessed_ops=[]}return a.prototype.parseOperation=function(a){var b;if(b=this.parser[a.type],null!=b)return b(a);throw new Error("You forgot to specify a parser for type "+a.type+". The message is "+JSON.stringify(a)+".")},a.prototype.applyOps=function(a){var b,c,d,e,f,g,h,i;for(c=[],d=0,g=a.length;g>d;d++)b=a[d],c.push(this.parseOperation(b));for(e=0,h=c.length;h>e;e++)b=c[e],this.HB.addOperation(b);for(f=0,i=c.length;i>f;f++)b=c[f],b.execute()||this.unprocessed_ops.push(b);return this.tryUnprocessed()},a.prototype.applyOp=function(a){var b;return b=this.parseOperation(a),this.HB.addOperation(b),b.execute()||this.unprocessed_ops.push(b),this.tryUnprocessed()},a.prototype.tryUnprocessed=function(){var a,b,c,d,e,f,g;for(g=[];;){for(a=this.unprocessed_ops.length,c=[],f=this.unprocessed_ops,d=0,e=f.length;e>d;d++)b=f[d],b.execute()||c.push(b);if(this.unprocessed_ops=c,this.unprocessed_ops.length===a)break;g.push(void 0)}return g},a}(),b.exports=c},{}],3:[function(a,b){var c,d,e,f;f=a("../Types/JsonTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),g=f(this.HB),this.engine=new c(this.HB,g.parser),this.connector=new b(this.engine,this.HB,g.execution_listener,this),h=this.connector.getRootElement(),null==h?(e=new g.types.JsonType(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=e):this.root_element=this.HB.getOperation(h)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.setMutableDefault=function(a){return this.root_element.setMutableDefault(a)},a.prototype.getUserId=function(){return this.HB.getUserId()},a.prototype.val=function(a,b,c){return this.root_element.val(a,b,c)},Object.defineProperty(a.prototype,"value",{get:function(){return this.root_element.value},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),a}(),"undefined"!=typeof window&&null!==window&&(window.JsonYatta=e),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/JsonTypes.coffee":7}],4:[function(a,b){var c,d,e,f;f=a("../Types/TextTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),h=f(this.HB),this.engine=new c(this.HB,h.parser),this.connector=new b(this.engine,this.HB,h.execution_listener),g=this.connector.getRootElement(),null==g?(e=new h.types.Word(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=this.HB.addOperation(new h.types.ReplaceManager(e,this.HB.getNextOperationIdentifier())).execute()):this.root_element=this.HB.getOperation(g)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.getUserId=function(){return this.HB.getUserId()},a.prototype.val=function(){return this.root_element.val().val()},a.prototype.insertText=function(a,b){return this.root_element.val().insertText(a,b)},a.prototype.deleteText=function(a,b){return this.root_element.val().deleteText(a,b)},a.prototype.replaceText=function(a){return this.root_element.val().replaceText(a)},a}(),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/TextTypes.coffee":9}],5:[function(a,b){var c;c=function(){function a(a){this.user_id=a,this.operation_counter={},this.buffer={},this.change_listeners=[]}return a.prototype.getUserId=function(){return this.user_id},a.prototype.getOperationCounter=function(){var a,b,c,d;b={},d=this.operation_counter;for(c in d)a=d[c],b[c]=a;return b},a.prototype._encode=function(){var a,b,c,d,e,f;a=[],f=this.buffer;for(d in f){e=f[d];for(c in e)b=e[c],isNaN(parseInt(c))||a.push(b._encode())}return a},a.prototype.getNextOperationIdentifier=function(a){var b;return null==a&&(a=this.user_id),null==this.operation_counter[a]&&(this.operation_counter[a]=0),b={creator:a,op_number:this.operation_counter[a]},this.operation_counter[a]++,b},a.prototype.getOperation=function(a){var b;if(a instanceof Object)return null!=(b=this.buffer[a.creator])?b[a.op_number]:void 0;if(null!=a)throw new Error("This type of uid is not defined!")},a.prototype.addOperation=function(a){if(null==this.buffer[a.creator]&&(this.buffer[a.creator]={}),null==this.operation_counter[a.creator]&&(this.operation_counter[a.creator]=0),null!=this.buffer[a.creator][a.op_number])throw new Error("You must not overwrite operations!");return this.buffer[a.creator][a.op_number]=a,"number"==typeof a.op_number&&a.creator!==this.getUserId()&&this.operation_counter[a.creator]++,a},a}(),b.exports=c},{}],6:[function(a,b){var c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};b.exports=function(a){var b,c,e,f,g,h,i;return i={},h=[],g=function(){function b(b){null==b&&(b=a.getNextOperationIdentifier()),this.creator=b.creator,this.op_number=b.op_number}return b.prototype.getUid=function(){return{creator:this.creator,op_number:this.op_number}},b.prototype.execute=function(){var a,b,c;for(this.is_executed=!0,b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this},b.prototype.saveOperation=function(a,b){return null!=(null!=b?b.execute:void 0)?this[a]=b:null!=b?(null==this.unchecked&&(this.unchecked={}),this.unchecked[a]=b):void 0},b.prototype.validateSavedOperations=function(){var b,c,d,e,f,g;f={},e=this,g=this.unchecked;for(b in g)d=g[b],c=a.getOperation(d),c?this[b]=c:(f[b]=d,e=!1);return delete this.unchecked,e||(this.unchecked=f),e},b}(),b=function(a){function b(a,c){this.saveOperation("deletes",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype._encode=function(){return{type:"Delete",uid:this.getUid(),deletes:this.deletes.getUid()}},b.prototype.execute=function(){return this.validateSavedOperations()?(this.deletes.applyDelete(this),b.__super__.execute.apply(this,arguments),this):!1},b}(g),i.Delete=function(a){var c,d;return d=a.uid,c=a.deletes,new b(d,c)},f=function(a){function b(a,c,d,e){this.saveOperation("prev_cl",c),this.saveOperation("next_cl",d),null!=e?this.saveOperation("origin",e):this.saveOperation("origin",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype.applyDelete=function(a){return null==this.deleted_by&&(this.deleted_by=[]),this.deleted_by.push(a)},b.prototype.isDeleted=function(){var a;return(null!=(a=this.deleted_by)?a.length:void 0)>0},b.prototype.getDistanceToOrigin=function(){var a,b;for(a=0,b=this.prev_cl;this.origin!==b;){if(a++,this===this.prev_cl)throw new Error("this should not happen ;) ");b=b.prev_cl}return a},b.prototype.update_sl=function(){var a;return a=this.prev_cl,update("prev_cl","prev_sl"),update("next_cl","prev_sl")},b.prototype.execute=function(){var a,c,d,e,f;if(null!=this.is_executed)return this;if(this.validateSavedOperations()){if((null!=(e=this.prev_cl)?e.validateSavedOperations():void 0)&&(null!=(f=this.next_cl)?f.validateSavedOperations():void 0)&&this.prev_cl.next_cl!==this){for(a=0,d=this.prev_cl.next_cl,c=0;null==d&&(console.log(JSON.stringify(this.prev_cl.getUid())),console.log(JSON.stringify(this.next_cl.getUid()))),d!==this.next_cl;){if(d.getDistanceToOrigin()===c)d.creator<this.creator&&(this.prev_cl=d,a=c+1);else{if(!(d.getDistanceToOrigin()<c))break;c-a<=d.getDistanceToOrigin()&&(this.prev_cl=d,a=c+1)}c++,d=d.next_cl}this.next_cl=this.prev_cl.next_cl,this.prev_cl.next_cl=this,this.next_cl.prev_cl=this}return b.__super__.execute.apply(this,arguments),this}return!1},b}(g),e=function(a){function b(a,c,d,e,f){this.content=null!=c?c:"",b.__super__.constructor.call(this,a,d,e,f)}return d(b,a),b.prototype.val=function(){return this.content},b.prototype._encode=function(){var a;return a={type:"ImmutableObject",uid:this.getUid(),content:this.content},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(f),i.ImmutableObject=function(a){var b,c,d,f,g;return g=a.uid,b=a.content,f=a.prev,c=a.next,d=a.origin,new e(g,b,f,c,d)},c=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return d(b,a),b.prototype.execute=function(){var a,b,c;if(this.validateSavedOperations()){for(b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this}return!1},b.prototype._encode=function(){var a,b;return{type:"Delimiter",uid:this.getUid(),prev:null!=(a=this.prev_cl)?a.getUid():void 0,next:null!=(b=this.next_cl)?b.getUid():void 0}},b}(f),i.Delimiter=function(a){var b,d,e;return e=a.uid,d=a.prev,b=a.next,new c(e,d,b)},{types:{Delete:b,Insert:f,Delimiter:c,Operation:g,ImmutableObject:e},parser:i,execution_listener:h}}},{}],7:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./TextTypes.coffee"),b.exports=function(a){var b,d,f,g,h;return g=c(a),h=g.types,f=g.parser,d=function(a){var c;return new(c=function(){function a(c){var e,f,g,i;i=c.map,g=function(e,f){return Object.defineProperty(a.prototype,e,{get:function(){var a;return a=f.val(),a instanceof b?d(a):a instanceof h.ImmutableObject?a.val():a},set:function(a){var b,d,f,g;if(a.constructor==={}.constructor){f=c.val(e),g=[];for(b in a)d=a[b],g.push(f.val(b,d,"immutable"));return g}return c.val(e,a,"immutable")},enumerable:!0,configurable:!1})};for(e in i)f=i[e],g(e,f)}return a}())(a)},b=function(b){function c(a,b,d){var e,f;if(c.__super__.constructor.call(this,a),null!=b){if("object"!=typeof b)throw new Error("The initial value of JsonTypes must be of type Object! (current type: "+typeof b+")");for(e in b)f=b[e],this.val(e,f,d)}}return e(c,b),c.prototype.mutable_default=!0,c.prototype.setMutableDefault=function(a){if(a===!0||"mutable"===a)c.prototype.mutable_default=!0;else{if(a!==!1&&"immutable"!==a)throw new Error('Set mutable either "mutable" or "immutable"!');c.prototype.mutable_default=!1}return"OK"},c.prototype.val=function(b,d,e){var f,g,i,j,k;if("object"==typeof b){for(i in b)g=b[i],this.val(i,g,d);return this}if(null!=b&&null!=d){if(e=null!=e?e===!0||"mutable"===e?!0:!1:this.mutable_default,"function"==typeof d)return this;if(e&&"number"!=typeof d||d.constructor===Object){if("string"==typeof d)return k=a.addOperation(new h.Word(a.getNextOperationIdentifier(),d)).execute(),c.__super__.val.call(this,b,k);if(d.constructor===Object)return f=a.addOperation(new c(a.getNextOperationIdentifier(),d,e)).execute(),c.__super__.val.call(this,b,f);throw new Error("You must not set "+typeof d+"-types in collaborative Json-objects!")}return j=a.addOperation(new h.ImmutableObject(void 0,d)).execute(),c.__super__.val.call(this,b,j)}return c.__super__.val.call(this,b,d)},Object.defineProperty(c.prototype,"value",{get:function(){return d(this)},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),c.prototype._encode=function(){return{type:"JsonType",uid:this.getUid()}},c}(h.MapManager),f.JsonType=function(a){var c;return c=a.uid,new b(c)},h.JsonType=b,g}},{"./TextTypes.coffee":9}],8:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./BasicTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i,j,k;return i=c(a),k=i.types,j=i.parser,f=function(c){function d(a){this.map={},d.__super__.constructor.call(this,a)}return e(d,c),d.prototype.val=function(c,e){var f,g,h,i,j;if(null!=e)return null==this.map[c]&&a.addOperation(new b(a.getNextOperationIdentifier(),this,c)).execute(),this.map[c].replace(e),this;if(null!=c)return g=null!=(i=this.map[c])?i.val():void 0,g instanceof k.ImmutableObject?g.val():g;h={},j=this.map;for(c in j)f=j[c],g=f.val(),(g instanceof k.ImmutableObject||g instanceof d)&&(g=g.val()),h[c]=g;return h},d}(k.Operation),b=function(b){function c(a,b,d){this.name=d,this.saveOperation("map_manager",b),c.__super__.constructor.call(this,a)}return e(c,b),c.prototype.execute=function(){var b,d,e,f,h;return this.validateSavedOperations()?(h=this.map_manager.getUid(),h.op_number="_"+h.op_number+"_RM_"+this.name,null==a.getOperation(h)&&(e=this.map_manager.getUid(),e.op_number="_"+e.op_number+"_RM_"+this.name+"_beginning",f=this.map_manager.getUid(),f.op_number="_"+f.op_number+"_RM_"+this.name+"_end",b=a.addOperation(new k.Delimiter(e,void 0,f)),d=a.addOperation(new k.Delimiter(f,b,void 0)).execute(),b.execute(),this.map_manager.map[this.name]=a.addOperation(new g(void 0,h,b,d)).execute()),c.__super__.execute.apply(this,arguments)):!1},c.prototype._encode=function(){return{type:"AddName",uid:this.getUid(),map_manager:this.map_manager.getUid(),name:this.name}},c}(k.Operation),j.AddName=function(a){var c,d,e;return c=a.map_manager,e=a.uid,d=a.name,new b(e,c,d)},d=function(b){function c(b,d,e,f,g,h){null!=d&&null!=e?(this.saveOperation("beginning",d),this.saveOperation("end",e)):(this.beginning=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),void 0,void 0)),this.end=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),this.beginning,void 0)),this.beginning.next_cl=this.end,this.beginning.execute(),this.end.execute()),c.__super__.constructor.call(this,b,f,g,h)}return e(c,b),c.prototype.getLastOperation=function(){return this.end.prev_cl},c.prototype.getFirstOperation=function(){return this.beginning.next_cl},c.prototype.toArray=function(){var a,b;for(a=this.beginning.next_cl,b=[];a!==this.end;)b.push(a),a=a.next_cl;return b},c.prototype.getOperationByPosition=function(a){var b;if(b=this.beginning.next_cl,a>0)for(;b=b.next_cl,b.isDeleted()||(a-=1),0!==a;)if(b instanceof k.Delimiter)throw new Error("position parameter exceeded the length of the document!");return b},c}(k.Insert),g=function(b){function c(a,b,d,e,f,g,h){c.__super__.constructor.call(this,b,d,e,f,g,h),null!=a&&this.replace(a)}return e(c,b),c.prototype.replace=function(b){var c,d;return c=this.getLastOperation(),d=new h(b,this,a.getNextOperationIdentifier(),c,c.next_cl),a.addOperation(d).execute()},c.prototype.val=function(){var a;if(a=this.getLastOperation(),a instanceof k.Delimiter)throw new Error("dtrn");return a.val()},c.prototype._encode=function(){var a;return a={type:"ReplaceManager",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&null!=this.next_cl&&(a.prev=this.prev_cl.getUid(),a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},c}(d),j.ReplaceManager=function(a){var b,c,d,e,f,h,i;return c=a.content,i=a.uid,h=a.prev,e=a.next,f=a.origin,b=a.beginning,d=a.end,new g(c,i,b,d,h,e,f)},h=function(a){function b(a,c,d,e,f,g){if(this.saveOperation("content",a),this.saveOperation("parent",c),null==e||null==f||null==a)throw new Error("You must define content, prev, and next for Replaceable-types!");b.__super__.constructor.call(this,d,e,f,g)}return e(b,a),b.prototype.val=function(){return this.content},b.prototype.replace=function(a){return this.parent.replace(a)},b.prototype.execute=function(){var a;return this.validateSavedOperations()?("function"==typeof(a=this.content).setReplaceManager&&a.setReplaceManager(this.parent),b.__super__.execute.apply(this,arguments),this):!1},b.prototype._encode=function(){var a;return a={type:"Replaceable",content:this.content.getUid(),ReplaceManager:this.parent.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid(),uid:this.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(k.Insert),j.Replaceable=function(a){var b,c,d,e,f,g;return b=a.content,e=a.ReplaceManager,g=a.uid,f=a.prev,c=a.next,d=a.origin,new h(b,e,g,f,c,d)},k.ListManager=d,k.MapManager=f,k.ReplaceManager=g,k.Replaceable=h,i}},{"./BasicTypes.coffee":6}],9:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./StructuredTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i;return h=c(a),i=h.types,g=h.parser,b=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return e(b,a),b}(i.Delete),g.TextDelete=g.Delete,d=function(a){function b(a,c,d,e,f){if(this.content=a,null==d||null==e)throw new Error("You must define prev, and next for TextInsert-types!");b.__super__.constructor.call(this,c,d,e,f)}return e(b,a),b.prototype.getLength=function(){return this.isDeleted()?0:this.content.length},b.prototype.val=function(){return this.isDeleted()?"":this.content},b.prototype._encode=function(){var a;return a={type:"TextInsert",content:this.content,uid:this.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(i.Insert),g.TextInsert=function(a){var b,c,e,f,g;return b=a.content,g=a.uid,f=a.prev,c=a.next,e=a.origin,new d(b,g,f,c,e)},f=function(c){function f(a,b,c,d,e,g,h){f.__super__.constructor.call(this,a,c,d,e,g,h),null!=b&&this.insertText(0,b)}return e(f,c),f.prototype.insertText=function(b,c){var e,f,g,h,i,j;for(f=this.getOperationByPosition(b),j=[],h=0,i=c.length;i>h;h++)e=c[h],g=new d(e,a.getNextOperationIdentifier(),f.prev_cl,f),j.push(a.addOperation(g).execute());return j},f.prototype.deleteText=function(c,d){var e,f,g,h,j;for(g=this.getOperationByPosition(c),j=[],f=h=0;d>=0?d>h:h>d;f=d>=0?++h:--h){for(e=a.addOperation(new b(a.getNextOperationIdentifier(),g)).execute(),g=g.next_cl;g.isDeleted();){if(g instanceof i.Delimiter)throw new Error("You can't delete more than there is..");g=g.next_cl}j.push(e._encode())}return j},f.prototype.replaceText=function(b){var c;if(null!=this.replace_manager)return c=a.addOperation(new f(a.getNextOperationIdentifier())).execute(),c.insertText(0,b),this.replace_manager.replace(c);throw new Error("This type is currently not maintained by a ReplaceManager!")},f.prototype.val=function(){var a,b;return a=function(){var a,c,d,e;for(d=this.toArray(),e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(null!=b.val?b.val():"");return e}.call(this),a.join("")},f.prototype.setReplaceManager=function(a){return this.saveOperation("replace_manager",a),this.validateSavedOperations},f.prototype._encode=function(){var a;return a={type:"Word",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},f}(i.ListManager),g.Word=function(a){var b,c,d,e,g,h;return h=a.uid,b=a.beginning,c=a.end,g=a.prev,d=a.next,e=a.origin,new f(h,void 0,b,c,g,d,e)},i.TextInsert=d,i.TextDelete=b,i.Word=f,h}},{"./StructuredTypes.coffee":8}],10:[function(a,b){b.exports=a("./lib/chai")},{"./lib/chai":11}],11:[function(a,b,c){var d=[],c=b.exports={};c.version="1.9.1",c.AssertionError=a("assertion-error");var e=a("./chai/utils");c.use=function(a){return~d.indexOf(a)||(a(this,e),d.push(a)),this};var f=a("./chai/config");c.config=f;var g=a("./chai/assertion");c.use(g);var h=a("./chai/core/assertions");c.use(h);var i=a("./chai/interface/expect");c.use(i);var j=a("./chai/interface/should");c.use(j);var k=a("./chai/interface/assert");c.use(k)},{"./chai/assertion":12,"./chai/config":13,"./chai/core/assertions":14,"./chai/interface/assert":15,"./chai/interface/expect":16,"./chai/interface/should":17,"./chai/utils":28,"assertion-error":37}],12:[function(a,b){var c=a("./config");b.exports=function(a,b){function d(a,b,c){f(this,"ssfi",c||arguments.callee),f(this,"object",a),f(this,"message",b)}var e=a.AssertionError,f=b.flag;a.Assertion=d,Object.defineProperty(d,"includeStack",{get:function(){return console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack},set:function(a){console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack=a}}),Object.defineProperty(d,"showDiff",{get:function(){return console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff},set:function(a){console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff=a}}),d.addProperty=function(a,c){b.addProperty(this.prototype,a,c)},d.addMethod=function(a,c){b.addMethod(this.prototype,a,c)},d.addChainableMethod=function(a,c,d){b.addChainableMethod(this.prototype,a,c,d)},d.overwriteProperty=function(a,c){b.overwriteProperty(this.prototype,a,c)},d.overwriteMethod=function(a,c){b.overwriteMethod(this.prototype,a,c)},d.overwriteChainableMethod=function(a,c,d){b.overwriteChainableMethod(this.prototype,a,c,d)},d.prototype.assert=function(a,d,g,h,i,j){var k=b.test(this,arguments);if(!0!==j&&(j=!1),!0!==c.showDiff&&(j=!1),!k){var d=b.getMessage(this,arguments),l=b.getActual(this,arguments);throw new e(d,{actual:l,expected:h,showDiff:j},c.includeStack?this.assert:f(this,"ssfi"))}},Object.defineProperty(d.prototype,"_obj",{get:function(){return f(this,"object")},set:function(a){f(this,"object",a)}})}},{"./config":13}],13:[function(a,b){b.exports={includeStack:!1,showDiff:!0,truncateThreshold:40}},{}],14:[function(a,b){b.exports=function(a,b){function c(a,c){c&&u(this,"message",c),a=a.toLowerCase();var d=u(this,"object"),e=~["a","e","i","o","u"].indexOf(a.charAt(0))?"an ":"a ";this.assert(a===b.type(d),"expected #{this} to be "+e+a,"expected #{this} not to be "+e+a)}function d(){u(this,"contains",!0)}function e(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=!1;if("array"===b.type(d)&&"object"===b.type(a)){for(var f in d)if(b.eql(d[f],a)){e=!0;break}}else if("object"===b.type(a)){if(!u(this,"negate")){for(var g in a)new t(d).property(g,a[g]);return}var h={};for(var g in a)h[g]=d[g];e=b.eql(h,a)}else e=d&&~d.indexOf(a);this.assert(e,"expected #{this} to include "+b.inspect(a),"expected #{this} to not include "+b.inspect(a))}function f(){var a=u(this,"object"),b=Object.prototype.toString.call(a);this.assert("[object Arguments]"===b,"expected #{this} to be arguments but got "+b,"expected #{this} to not be arguments")}function g(a,b){b&&u(this,"message",b);var c=u(this,"object");return u(this,"deep")?this.eql(a):void this.assert(a===c,"expected #{this} to equal #{exp}","expected #{this} to not equal #{exp}",a,this._obj,!0)}function h(a,c){c&&u(this,"message",c),this.assert(b.eql(a,u(this,"object")),"expected #{this} to deeply equal #{exp}","expected #{this} to not deeply equal #{exp}",a,this._obj,!0)}function i(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>a,"expected #{this} to have a length above #{exp} but got #{act}","expected #{this} to not have a length above #{exp}",a,d)}else this.assert(c>a,"expected #{this} to be above "+a,"expected #{this} to be at most "+a)}function j(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>=a,"expected #{this} to have a length at least #{exp} but got #{act}","expected #{this} to have a length below #{exp}",a,d)}else this.assert(c>=a,"expected #{this} to be at least "+a,"expected #{this} to be below "+a)}function k(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(a>d,"expected #{this} to have a length below #{exp} but got #{act}","expected #{this} to not have a length below #{exp}",a,d)}else this.assert(a>c,"expected #{this} to be below "+a,"expected #{this} to be at least "+a)}function l(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(a>=d,"expected #{this} to have a length at most #{exp} but got #{act}","expected #{this} to have a length above #{exp}",a,d)}else this.assert(a>=c,"expected #{this} to be at most "+a,"expected #{this} to be above "+a)}function m(a,c){c&&u(this,"message",c);var d=b.getName(a);this.assert(u(this,"object")instanceof a,"expected #{this} to be an instance of "+d,"expected #{this} to not be an instance of "+d)}function n(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(d.hasOwnProperty(a),"expected #{this} to have own property "+b.inspect(a),"expected #{this} to not have own property "+b.inspect(a))}function o(){u(this,"doLength",!0)}function p(a,b){b&&u(this,"message",b);var c=u(this,"object");new t(c,b).to.have.property("length");var d=c.length;this.assert(d==a,"expected #{this} to have a length of #{exp} but got #{act}","expected #{this} to not have a length of #{act}",a,d)
|
||
}function q(a){var c,d=u(this,"object"),e=!0;if(a=a instanceof Array?a:Array.prototype.slice.call(arguments),!a.length)throw new Error("keys required");var f=Object.keys(d),g=a.length;if(e=a.every(function(a){return~f.indexOf(a)}),u(this,"negate")||u(this,"contains")||(e=e&&a.length==f.length),g>1){a=a.map(function(a){return b.inspect(a)});var h=a.pop();c=a.join(", ")+", and "+h}else c=b.inspect(a[0]);c=(g>1?"keys ":"key ")+c,c=(u(this,"contains")?"contain ":"have ")+c,this.assert(e,"expected #{this} to "+c,"expected #{this} to not "+c)}function r(a,c,d){d&&u(this,"message",d);var e=u(this,"object");new t(e,d).is.a("function");var f=!1,g=null,h=null,i=null;0===arguments.length?(c=null,a=null):a&&(a instanceof RegExp||"string"==typeof a)?(c=a,a=null):a&&a instanceof Error?(g=a,a=null,c=null):"function"==typeof a?(h=a.prototype.name||a.name,"Error"===h&&a!==Error&&(h=(new a).name)):a=null;try{e()}catch(j){if(g)return this.assert(j===g,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}",g instanceof Error?g.toString():g,j instanceof Error?j.toString():j),u(this,"object",j),this;if(a&&(this.assert(j instanceof a,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp} but #{act} was thrown",h,j instanceof Error?j.toString():j),!c))return u(this,"object",j),this;var k="object"===b.type(j)&&"message"in j?j.message:""+j;if(null!=k&&c&&c instanceof RegExp)return this.assert(c.exec(k),"expected #{this} to throw error matching #{exp} but got #{act}","expected #{this} to throw error not matching #{exp}",c,k),u(this,"object",j),this;if(null!=k&&c&&"string"==typeof c)return this.assert(~k.indexOf(c),"expected #{this} to throw error including #{exp} but got #{act}","expected #{this} to throw error not including #{act}",c,k),u(this,"object",j),this;f=!0,i=j}var l="",m=null!==h?h:g?"#{exp}":"an error";f&&(l=" but #{act} was thrown"),this.assert(f===!0,"expected #{this} to throw "+m+l,"expected #{this} to not throw "+m+l,g instanceof Error?g.toString():g,i instanceof Error?i.toString():i),u(this,"object",i)}function s(a,b,c){return a.every(function(a){return c?b.some(function(b){return c(a,b)}):-1!==b.indexOf(a)})}var t=a.Assertion,u=(Object.prototype.toString,b.flag);["to","be","been","is","and","has","have","with","that","at","of","same"].forEach(function(a){t.addProperty(a,function(){return this})}),t.addProperty("not",function(){u(this,"negate",!0)}),t.addProperty("deep",function(){u(this,"deep",!0)}),t.addChainableMethod("an",c),t.addChainableMethod("a",c),t.addChainableMethod("include",e,d),t.addChainableMethod("contain",e,d),t.addProperty("ok",function(){this.assert(u(this,"object"),"expected #{this} to be truthy","expected #{this} to be falsy")}),t.addProperty("true",function(){this.assert(!0===u(this,"object"),"expected #{this} to be true","expected #{this} to be false",this.negate?!1:!0)}),t.addProperty("false",function(){this.assert(!1===u(this,"object"),"expected #{this} to be false","expected #{this} to be true",this.negate?!0:!1)}),t.addProperty("null",function(){this.assert(null===u(this,"object"),"expected #{this} to be null","expected #{this} not to be null")}),t.addProperty("undefined",function(){this.assert(void 0===u(this,"object"),"expected #{this} to be undefined","expected #{this} not to be undefined")}),t.addProperty("exist",function(){this.assert(null!=u(this,"object"),"expected #{this} to exist","expected #{this} to not exist")}),t.addProperty("empty",function(){var a=u(this,"object"),b=a;Array.isArray(a)||"string"==typeof object?b=a.length:"object"==typeof a&&(b=Object.keys(a).length),this.assert(!b,"expected #{this} to be empty","expected #{this} not to be empty")}),t.addProperty("arguments",f),t.addProperty("Arguments",f),t.addMethod("equal",g),t.addMethod("equals",g),t.addMethod("eq",g),t.addMethod("eql",h),t.addMethod("eqls",h),t.addMethod("above",i),t.addMethod("gt",i),t.addMethod("greaterThan",i),t.addMethod("least",j),t.addMethod("gte",j),t.addMethod("below",k),t.addMethod("lt",k),t.addMethod("lessThan",k),t.addMethod("most",l),t.addMethod("lte",l),t.addMethod("within",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object"),e=a+".."+b;if(u(this,"doLength")){new t(d,c).to.have.property("length");var f=d.length;this.assert(f>=a&&b>=f,"expected #{this} to have a length within "+e,"expected #{this} to not have a length within "+e)}else this.assert(d>=a&&b>=d,"expected #{this} to be within "+e,"expected #{this} to not be within "+e)}),t.addMethod("instanceof",m),t.addMethod("instanceOf",m),t.addMethod("property",function(a,c,d){d&&u(this,"message",d);var e=u(this,"deep")?"deep property ":"property ",f=u(this,"negate"),g=u(this,"object"),h=u(this,"deep")?b.getPathValue(a,g):g[a];if(f&&void 0!==c){if(void 0===h)throw d=null!=d?d+": ":"",new Error(d+b.inspect(g)+" has no "+e+b.inspect(a))}else this.assert(void 0!==h,"expected #{this} to have a "+e+b.inspect(a),"expected #{this} to not have "+e+b.inspect(a));void 0!==c&&this.assert(c===h,"expected #{this} to have a "+e+b.inspect(a)+" of #{exp}, but got #{act}","expected #{this} to not have a "+e+b.inspect(a)+" of #{act}",c,h),u(this,"object",h)}),t.addMethod("ownProperty",n),t.addMethod("haveOwnProperty",n),t.addChainableMethod("length",p,o),t.addMethod("lengthOf",p,o),t.addMethod("match",function(a,b){b&&u(this,"message",b);var c=u(this,"object");this.assert(a.exec(c),"expected #{this} to match "+a,"expected #{this} not to match "+a)}),t.addMethod("string",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d,c).is.a("string"),this.assert(~d.indexOf(a),"expected #{this} to contain "+b.inspect(a),"expected #{this} to not contain "+b.inspect(a))}),t.addMethod("keys",q),t.addMethod("key",q),t.addMethod("throw",r),t.addMethod("throws",r),t.addMethod("Throw",r),t.addMethod("respondTo",function(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=u(this,"itself"),f="function"!==b.type(d)||e?d[a]:d.prototype[a];this.assert("function"==typeof f,"expected #{this} to respond to "+b.inspect(a),"expected #{this} to not respond to "+b.inspect(a))}),t.addProperty("itself",function(){u(this,"itself",!0)}),t.addMethod("satisfy",function(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(a(d),"expected #{this} to satisfy "+b.objDisplay(a),"expected #{this} to not satisfy"+b.objDisplay(a),this.negate?!1:!0,a(d))}),t.addMethod("closeTo",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(Math.abs(d-a)<=b,"expected #{this} to be close to "+a+" +/- "+b,"expected #{this} not to be close to "+a+" +/- "+b)}),t.addMethod("members",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d).to.be.an("array"),new t(a).to.be.an("array");var e=u(this,"deep")?b.eql:void 0;return u(this,"contains")?this.assert(s(a,d,e),"expected #{this} to be a superset of #{act}","expected #{this} to not be a superset of #{act}",d,a):void this.assert(s(d,a,e)&&s(a,d,e),"expected #{this} to have the same members as #{act}","expected #{this} to not have the same members as #{act}",d,a)})}},{}],15:[function(require,module,exports){module.exports=function(chai,util){var Assertion=chai.Assertion,flag=util.flag,assert=chai.assert=function(a,b){var c=new Assertion(null,null,chai.assert);c.assert(a,b,"[ negation message unavailable ]")};assert.fail=function(a,b,c,d){throw c=c||"assert.fail()",new chai.AssertionError(c,{actual:a,expected:b,operator:d},assert.fail)},assert.ok=function(a,b){new Assertion(a,b).is.ok},assert.notOk=function(a,b){new Assertion(a,b).is.not.ok},assert.equal=function(a,b,c){var d=new Assertion(a,c,assert.equal);d.assert(b==flag(d,"object"),"expected #{this} to equal #{exp}","expected #{this} to not equal #{act}",b,a)},assert.notEqual=function(a,b,c){var d=new Assertion(a,c,assert.notEqual);d.assert(b!=flag(d,"object"),"expected #{this} to not equal #{exp}","expected #{this} to equal #{act}",b,a)},assert.strictEqual=function(a,b,c){new Assertion(a,c).to.equal(b)},assert.notStrictEqual=function(a,b,c){new Assertion(a,c).to.not.equal(b)},assert.deepEqual=function(a,b,c){new Assertion(a,c).to.eql(b)},assert.notDeepEqual=function(a,b,c){new Assertion(a,c).to.not.eql(b)},assert.isTrue=function(a,b){new Assertion(a,b).is["true"]},assert.isFalse=function(a,b){new Assertion(a,b).is["false"]},assert.isNull=function(a,b){new Assertion(a,b).to.equal(null)},assert.isNotNull=function(a,b){new Assertion(a,b).to.not.equal(null)},assert.isUndefined=function(a,b){new Assertion(a,b).to.equal(void 0)},assert.isDefined=function(a,b){new Assertion(a,b).to.not.equal(void 0)},assert.isFunction=function(a,b){new Assertion(a,b).to.be.a("function")},assert.isNotFunction=function(a,b){new Assertion(a,b).to.not.be.a("function")},assert.isObject=function(a,b){new Assertion(a,b).to.be.a("object")},assert.isNotObject=function(a,b){new Assertion(a,b).to.not.be.a("object")},assert.isArray=function(a,b){new Assertion(a,b).to.be.an("array")},assert.isNotArray=function(a,b){new Assertion(a,b).to.not.be.an("array")},assert.isString=function(a,b){new Assertion(a,b).to.be.a("string")},assert.isNotString=function(a,b){new Assertion(a,b).to.not.be.a("string")},assert.isNumber=function(a,b){new Assertion(a,b).to.be.a("number")},assert.isNotNumber=function(a,b){new Assertion(a,b).to.not.be.a("number")},assert.isBoolean=function(a,b){new Assertion(a,b).to.be.a("boolean")},assert.isNotBoolean=function(a,b){new Assertion(a,b).to.not.be.a("boolean")},assert.typeOf=function(a,b,c){new Assertion(a,c).to.be.a(b)},assert.notTypeOf=function(a,b,c){new Assertion(a,c).to.not.be.a(b)},assert.instanceOf=function(a,b,c){new Assertion(a,c).to.be.instanceOf(b)},assert.notInstanceOf=function(a,b,c){new Assertion(a,c).to.not.be.instanceOf(b)},assert.include=function(a,b,c){new Assertion(a,c,assert.include).include(b)},assert.notInclude=function(a,b,c){new Assertion(a,c,assert.notInclude).not.include(b)},assert.match=function(a,b,c){new Assertion(a,c).to.match(b)},assert.notMatch=function(a,b,c){new Assertion(a,c).to.not.match(b)},assert.property=function(a,b,c){new Assertion(a,c).to.have.property(b)},assert.notProperty=function(a,b,c){new Assertion(a,c).to.not.have.property(b)},assert.deepProperty=function(a,b,c){new Assertion(a,c).to.have.deep.property(b)},assert.notDeepProperty=function(a,b,c){new Assertion(a,c).to.not.have.deep.property(b)},assert.propertyVal=function(a,b,c,d){new Assertion(a,d).to.have.property(b,c)},assert.propertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.property(b,c)},assert.deepPropertyVal=function(a,b,c,d){new Assertion(a,d).to.have.deep.property(b,c)},assert.deepPropertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.deep.property(b,c)},assert.lengthOf=function(a,b,c){new Assertion(a,c).to.have.length(b)},assert.Throw=function(a,b,c,d){("string"==typeof b||b instanceof RegExp)&&(c=b,b=null);var e=new Assertion(a,d).to.Throw(b,c);return flag(e,"object")},assert.doesNotThrow=function(a,b,c){"string"==typeof b&&(c=b,b=null),new Assertion(a,c).to.not.Throw(b)},assert.operator=function(val,operator,val2,msg){if(!~["==","===",">",">=","<","<=","!=","!=="].indexOf(operator))throw new Error('Invalid operator "'+operator+'"');var test=new Assertion(eval(val+operator+val2),msg);test.assert(!0===flag(test,"object"),"expected "+util.inspect(val)+" to be "+operator+" "+util.inspect(val2),"expected "+util.inspect(val)+" to not be "+operator+" "+util.inspect(val2))},assert.closeTo=function(a,b,c,d){new Assertion(a,d).to.be.closeTo(b,c)},assert.sameMembers=function(a,b,c){new Assertion(a,c).to.have.same.members(b)},assert.includeMembers=function(a,b,c){new Assertion(a,c).to.include.members(b)},assert.ifError=function(a,b){new Assertion(a,b).to.not.be.ok},function a(b,c){return assert[c]=assert[b],a}("Throw","throw")("Throw","throws")}},{}],16:[function(a,b){b.exports=function(a){a.expect=function(b,c){return new a.Assertion(b,c)}}},{}],17:[function(a,b){b.exports=function(a){function b(){function a(){return this instanceof String||this instanceof Number?new c(this.constructor(this),null,a):this instanceof Boolean?new c(1==this,null,a):new c(this,null,a)}function b(a){Object.defineProperty(this,"should",{value:a,enumerable:!0,configurable:!0,writable:!0})}Object.defineProperty(Object.prototype,"should",{set:b,get:a,configurable:!0});var d={};return d.equal=function(a,b,d){new c(a,d).to.equal(b)},d.Throw=function(a,b,d,e){new c(a,e).to.Throw(b,d)},d.exist=function(a,b){new c(a,b).to.exist},d.not={},d.not.equal=function(a,b,d){new c(a,d).to.not.equal(b)},d.not.Throw=function(a,b,d,e){new c(a,e).to.not.Throw(b,d)},d.not.exist=function(a,b){new c(a,b).to.not.exist},d["throw"]=d.Throw,d.not["throw"]=d.not.Throw,d}var c=a.Assertion;a.should=b,a.Should=b}},{}],18:[function(a,b){var c=a("./transferFlags"),d=a("./flag"),e=a("../config"),f="__proto__"in Object,g=/^(?:length|name|arguments|caller)$/,h=Function.prototype.call,i=Function.prototype.apply;b.exports=function(a,b,j,k){"function"!=typeof k&&(k=function(){});var l={method:j,chainingBehavior:k};a.__methods||(a.__methods={}),a.__methods[b]=l,Object.defineProperty(a,b,{get:function(){l.chainingBehavior.call(this);var b=function m(){var a=d(this,"ssfi");a&&e.includeStack===!1&&d(this,"ssfi",m);var b=l.method.apply(this,arguments);return void 0===b?this:b};if(f){var j=b.__proto__=Object.create(this);j.call=h,j.apply=i}else{var k=Object.getOwnPropertyNames(a);k.forEach(function(c){if(!g.test(c)){var d=Object.getOwnPropertyDescriptor(a,c);Object.defineProperty(b,c,d)}})}return c(this,b),b},configurable:!0})}},{"../config":13,"./flag":21,"./transferFlags":35}],19:[function(a,b){var c=a("../config"),d=a("./flag");b.exports=function(a,b,e){a[b]=function(){var f=d(this,"ssfi");f&&c.includeStack===!1&&d(this,"ssfi",a[b]);var g=e.apply(this,arguments);return void 0===g?this:g}}},{"../config":13,"./flag":21}],20:[function(a,b){b.exports=function(a,b,c){Object.defineProperty(a,b,{get:function(){var a=c.call(this);return void 0===a?this:a},configurable:!0})}},{}],21:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));return 3!==arguments.length?d[b]:void(d[b]=c)}},{}],22:[function(a,b){b.exports=function(a,b){return b.length>4?b[4]:a._obj}},{}],23:[function(a,b){b.exports=function(a){var b=[];for(var c in a)b.push(c);return b}},{}],24:[function(a,b){var c=a("./flag"),d=a("./getActual"),e=(a("./inspect"),a("./objDisplay"));b.exports=function(a,b){var f=c(a,"negate"),g=c(a,"object"),h=b[3],i=d(a,b),j=f?b[2]:b[1],k=c(a,"message");return j=j||"",j=j.replace(/#{this}/g,e(g)).replace(/#{act}/g,e(i)).replace(/#{exp}/g,e(h)),k?k+": "+j:j}},{"./flag":21,"./getActual":22,"./inspect":29,"./objDisplay":30}],25:[function(a,b){b.exports=function(a){if(a.name)return a.name;var b=/^\s?function ([^(]*)\(/.exec(a);return b&&b[1]?b[1]:""}},{}],26:[function(a,b){function c(a){var b=a.replace(/\[/g,".["),c=b.match(/(\\\.|[^.]+?)+/g);return c.map(function(a){var b=/\[(\d+)\]$/,c=b.exec(a);return c?{i:parseFloat(c[1])}:{p:a}})}function d(a,b){for(var c,d=b,e=0,f=a.length;f>e;e++){var g=a[e];d?("undefined"!=typeof g.p?d=d[g.p]:"undefined"!=typeof g.i&&(d=d[g.i]),e==f-1&&(c=d)):c=void 0}return c}b.exports=function(a,b){var e=c(a);return d(e,b)}},{}],27:[function(a,b){b.exports=function(){function a(a){-1===b.indexOf(a)&&b.push(a)}for(var b=Object.getOwnPropertyNames(subject),c=Object.getPrototypeOf(subject);null!==c;)Object.getOwnPropertyNames(c).forEach(a),c=Object.getPrototypeOf(c);return b}},{}],28:[function(a,b,c){var c=b.exports={};c.test=a("./test"),c.type=a("./type"),c.getMessage=a("./getMessage"),c.getActual=a("./getActual"),c.inspect=a("./inspect"),c.objDisplay=a("./objDisplay"),c.flag=a("./flag"),c.transferFlags=a("./transferFlags"),c.eql=a("deep-eql"),c.getPathValue=a("./getPathValue"),c.getName=a("./getName"),c.addProperty=a("./addProperty"),c.addMethod=a("./addMethod"),c.overwriteProperty=a("./overwriteProperty"),c.overwriteMethod=a("./overwriteMethod"),c.addChainableMethod=a("./addChainableMethod"),c.overwriteChainableMethod=a("./overwriteChainableMethod")},{"./addChainableMethod":18,"./addMethod":19,"./addProperty":20,"./flag":21,"./getActual":22,"./getMessage":24,"./getName":25,"./getPathValue":26,"./inspect":29,"./objDisplay":30,"./overwriteChainableMethod":31,"./overwriteMethod":32,"./overwriteProperty":33,"./test":34,"./transferFlags":35,"./type":36,"deep-eql":38}],29:[function(a,b,c){function d(a,b,c){var d={showHidden:b,seen:[],stylize:function(a){return a}};return e(d,a,"undefined"==typeof c?2:c)}function e(a,b,d){if(b&&"function"==typeof b.inspect&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var o=b.inspect(d);return"string"!=typeof o&&(o=e(a,o,d)),o}var u=f(a,b);if(u)return u;if(t(b))return s(b);var v=r(b),w=a.showHidden?q(b):v;if(0===w.length||n(b)&&(1===w.length&&"stack"===w[0]||2===w.length&&"description"===w[0]&&"stack"===w[1])){if("function"==typeof b){var x=p(b),y=x?": "+x:"";return a.stylize("[Function"+y+"]","special")}if(l(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(m(b))return a.stylize(Date.prototype.toUTCString.call(b),"date");if(n(b))return g(b)}var z="",A=!1,B=["{","}"];if(k(b)&&(A=!0,B=["[","]"]),"function"==typeof b){var x=p(b),y=x?": "+x:"";z=" [Function"+y+"]"}if(l(b)&&(z=" "+RegExp.prototype.toString.call(b)),m(b)&&(z=" "+Date.prototype.toUTCString.call(b)),n(b))return g(b);if(0===w.length&&(!A||0==b.length))return B[0]+z+B[1];if(0>d)return l(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var C;return C=A?h(a,b,d,v,w):w.map(function(c){return i(a,b,d,v,c,A)}),a.seen.pop(),j(C,z,B)}function f(a,b){switch(typeof b){case"undefined":return a.stylize("undefined","undefined");case"string":var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string");case"number":return a.stylize(""+b,"number");case"boolean":return a.stylize(""+b,"boolean")}return null===b?a.stylize("null","null"):void 0}function g(a){return"["+Error.prototype.toString.call(a)+"]"}function h(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(Object.prototype.hasOwnProperty.call(b,String(g))?i(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(i(a,b,c,d,e,!0))}),f}function i(a,b,c,d,f,g){var h,i;if(b.__lookupGetter__&&(b.__lookupGetter__(f)?i=b.__lookupSetter__(f)?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):b.__lookupSetter__(f)&&(i=a.stylize("[Setter]","special"))),d.indexOf(f)<0&&(h="["+f+"]"),i||(a.seen.indexOf(b[f])<0?(i=null===c?e(a,b[f],null):e(a,b[f],c-1),i.indexOf("\n")>-1&&(i=g?i.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+i.split("\n").map(function(a){return" "+a}).join("\n"))):i=a.stylize("[Circular]","special")),"undefined"==typeof h){if(g&&f.match(/^\d+$/))return i;h=JSON.stringify(""+f),h.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(h=h.substr(1,h.length-2),h=a.stylize(h,"name")):(h=h.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),h=a.stylize(h,"string"))}return h+": "+i}function j(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function k(a){return Array.isArray(a)||"object"==typeof a&&"[object Array]"===o(a)}function l(a){return"object"==typeof a&&"[object RegExp]"===o(a)}function m(a){return"object"==typeof a&&"[object Date]"===o(a)}function n(a){return"object"==typeof a&&"[object Error]"===o(a)}function o(a){return Object.prototype.toString.call(a)}var p=a("./getName"),q=a("./getProperties"),r=a("./getEnumerableProperties");b.exports=d;var s=function(a){if("outerHTML"in a)return a.outerHTML;var b,c="http://www.w3.org/1999/xhtml",d=document.createElementNS(c,"_"),e=((window.HTMLElement||window.Element).prototype,new XMLSerializer);return document.xmlVersion?e.serializeToString(a):(d.appendChild(a.cloneNode(!1)),b=d.innerHTML.replace("><",">"+a.innerHTML+"<"),d.innerHTML="",b)},t=function(a){return"object"==typeof HTMLElement?a instanceof HTMLElement:a&&"object"==typeof a&&1===a.nodeType&&"string"==typeof a.nodeName}},{"./getEnumerableProperties":23,"./getName":25,"./getProperties":27}],30:[function(a,b){var c=a("./inspect"),d=a("../config");b.exports=function(a){var b=c(a),e=Object.prototype.toString.call(a);if(d.truncateThreshold&&b.length>=d.truncateThreshold){if("[object Function]"===e)return a.name&&""!==a.name?"[Function: "+a.name+"]":"[Function]";if("[object Array]"===e)return"[ Array("+a.length+") ]";if("[object Object]"===e){var f=Object.keys(a),g=f.length>2?f.splice(0,2).join(", ")+", ...":f.join(", ");return"{ Object ("+g+") }"}return b}return b}},{"../config":13,"./inspect":29}],31:[function(a,b){b.exports=function(a,b,c,d){var e=a.__methods[b],f=e.chainingBehavior;e.chainingBehavior=function(){var a=d(f).call(this);return void 0===a?this:a};var g=e.method;e.method=function(){var a=c(g).apply(this,arguments);return void 0===a?this:a}}},{}],32:[function(a,b){b.exports=function(a,b,c){var d=a[b],e=function(){return this};d&&"function"==typeof d&&(e=d),a[b]=function(){var a=c(e).apply(this,arguments);return void 0===a?this:a}}},{}],33:[function(a,b){b.exports=function(a,b,c){var d=Object.getOwnPropertyDescriptor(a,b),e=function(){};d&&"function"==typeof d.get&&(e=d.get),Object.defineProperty(a,b,{get:function(){var a=c(e).call(this);return void 0===a?this:a},configurable:!0})}},{}],34:[function(a,b){var c=a("./flag");b.exports=function(a,b){var d=c(a,"negate"),e=b[0];return d?!e:e}},{"./flag":21}],35:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));b.__flags||(b.__flags=Object.create(null)),c=3===arguments.length?c:!0;for(var e in d)(c||"object"!==e&&"ssfi"!==e&&"message"!=e)&&(b.__flags[e]=d[e])}},{}],36:[function(a,b){var c={"[object Arguments]":"arguments","[object Array]":"array","[object Date]":"date","[object Function]":"function","[object Number]":"number","[object RegExp]":"regexp","[object String]":"string"};b.exports=function(a){var b=Object.prototype.toString.call(a);return c[b]?c[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}},{}],37:[function(a,b){function c(){function a(a,c){Object.keys(c).forEach(function(d){~b.indexOf(d)||(a[d]=c[d])})}var b=[].slice.call(arguments);return function(){for(var b=[].slice.call(arguments),c=0,d={};c<b.length;c++)a(d,b[c]);return d}}function d(a,b,d){var e=c("name","message","stack","constructor","toJSON"),f=e(b||{});this.message=a||"Unspecified AssertionError",this.showDiff=!1;for(var g in f)this[g]=f[g];d=d||arguments.callee,d&&Error.captureStackTrace&&Error.captureStackTrace(this,d)}b.exports=d,d.prototype=Object.create(Error.prototype),d.prototype.name="AssertionError",d.prototype.constructor=d,d.prototype.toJSON=function(a){var b=c("constructor","toJSON","stack"),d=b({name:this.name},this);return!1!==a&&this.stack&&(d.stack=this.stack),d}},{}],38:[function(a,b){b.exports=a("./lib/eql")},{"./lib/eql":39}],39:[function(a,b){function c(a,b,c){return d(a,b)?!0:"date"===o(a)?f(a,b):"regexp"===o(a)?g(a,b):n.isBuffer(a)?k(a,b):"arguments"===o(a)?h(a,b,c):e(a,b)?"object"!==o(a)&&"object"!==o(b)&&"array"!==o(a)&&"array"!==o(b)?d(a,b):m(a,b,c):!1}function d(a,b){return a===b?0!==a||1/a===1/b:a!==a&&b!==b}function e(a,b){return o(a)===o(b)}function f(a,b){return"date"!==o(b)?!1:d(a.getTime(),b.getTime())}function g(a,b){return"regexp"!==o(b)?!1:d(a.toString(),b.toString())}function h(a,b,d){return"arguments"!==o(b)?!1:(a=[].slice.call(a),b=[].slice.call(b),c(a,b,d))}function i(a){var b=[];for(var c in a)b.push(c);return b}function j(a,b){if(a.length!==b.length)return!1;for(var c=0,d=!0;c<a.length;c++)if(a[c]!==b[c]){d=!1;break}return d}function k(a,b){return n.isBuffer(b)?j(a,b):!1}function l(a){return null!==a&&void 0!==a}function m(a,b,d){if(!l(a)||!l(b))return!1;if(a.prototype!==b.prototype)return!1;var e;if(d){for(e=0;e<d.length;e++)if(d[e][0]===a&&d[e][1]===b||d[e][0]===b&&d[e][1]===a)return!0}else d=[];try{var f=i(a),g=i(b)}catch(h){return!1}if(f.sort(),g.sort(),!j(f,g))return!1;d.push([a,b]);var k;for(e=f.length-1;e>=0;e--)if(k=f[e],!c(a[k],b[k],d))return!1;return!0}var n,o=a("type-detect");try{n=a("buffer").Buffer}catch(p){n={},n.isBuffer=function(){return!1}}b.exports=c},{buffer:42,"type-detect":40}],40:[function(a,b){b.exports=a("./lib/type")},{"./lib/type":41}],41:[function(a,b,c){function d(a){var b=Object.prototype.toString.call(a);return f[b]?f[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}function e(){this.tests={}}var c=b.exports=d,f={"[object Array]":"array","[object RegExp]":"regexp","[object Function]":"function","[object Arguments]":"arguments","[object Date]":"date"};c.Library=e,e.prototype.of=d,e.prototype.define=function(a,b){return 1===arguments.length?this.tests[a]:(this.tests[a]=b,this)},e.prototype.test=function(a,b){if(b===d(a))return!0;var c=this.tests[b];if(c&&"regexp"===d(c))return c.test(a);if(c&&"function"===d(c))return c(a);throw new ReferenceError('Type test "'+b+'" not defined or invalid.')}},{}],42:[function(a,b,c){function d(a,b,c){if(!(this instanceof d))return new d(a,b,c);var e,f=typeof a;if("number"===f)e=a>0?a>>>0:0;else if("string"===f)"base64"===b&&(a=C(a)),e=d.byteLength(a,b);else{if("object"!==f||null===a)throw new Error("First argument needs to be a number, array or string.");"Buffer"===a.type&&E(a.data)&&(a=a.data),e=+a.length>0?Math.floor(+a.length):0}var g;T?g=d._augment(new Uint8Array(e)):(g=this,g.length=e,g._isBuffer=!0);var h;if(T&&"number"==typeof a.byteLength)g._set(a);else if(F(a))if(d.isBuffer(a))for(h=0;e>h;h++)g[h]=a.readUInt8(h);else for(h=0;e>h;h++)g[h]=(a[h]%256+256)%256;else if("string"===f)g.write(a,0,b);else if("number"===f&&!T&&!c)for(h=0;e>h;h++)g[h]=0;return g}function e(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;Q(f%2===0,"Invalid hex string"),d>f/2&&(d=f/2);for(var g=0;d>g;g++){var h=parseInt(b.substr(2*g,2),16);Q(!isNaN(h),"Invalid hex string"),a[c+g]=h}return g}function f(a,b,c,d){var e=L(H(b),a,c,d);return e}function g(a,b,c,d){var e=L(I(b),a,c,d);return e}function h(a,b,c,d){return g(a,b,c,d)}function i(a,b,c,d){var e=L(K(b),a,c,d);return e}function j(a,b,c,d){var e=L(J(b),a,c,d);return e}function k(a,b,c){return R.fromByteArray(0===b&&c===a.length?a:a.slice(b,c))}function l(a,b,c){var d="",e="";c=Math.min(a.length,c);for(var f=b;c>f;f++)a[f]<=127?(d+=M(e)+String.fromCharCode(a[f]),e=""):e+="%"+a[f].toString(16);return d+M(e)}function m(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(a[e]);return d}function n(a,b,c){return m(a,b,c)}function o(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;f++)e+=G(a[f]);return e}function p(a,b,c){for(var d=a.slice(b,c),e="",f=0;f<d.length;f+=2)e+=String.fromCharCode(d[f]+256*d[f+1]);return e}function q(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(f=a[b],e>b+1&&(f|=a[b+1]<<8)):(f=a[b]<<8,e>b+1&&(f|=a[b+1])),f}}function r(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(e>b+2&&(f=a[b+2]<<16),e>b+1&&(f|=a[b+1]<<8),f|=a[b],e>b+3&&(f+=a[b+3]<<24>>>0)):(e>b+1&&(f=a[b+1]<<16),e>b+2&&(f|=a[b+2]<<8),e>b+3&&(f|=a[b+3]),f+=a[b]<<24>>>0),f}}function s(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=q(a,b,c,!0),g=32768&f;return g?-1*(65535-f+1):f}}function t(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=r(a,b,c,!0),g=2147483648&f;return g?-1*(4294967295-f+1):f}}function u(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+3<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,23,4)}function v(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+7<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,52,8)}function w(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"trying to write beyond buffer length"),N(b,65535));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,2);h>g;g++)a[c+g]=(b&255<<8*(d?g:1-g))>>>8*(d?g:1-g);return c+2}}function x(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"trying to write beyond buffer length"),N(b,4294967295));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,4);h>g;g++)a[c+g]=b>>>8*(d?g:3-g)&255;return c+4}}function y(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"Trying to write beyond buffer length"),O(b,32767,-32768));var f=a.length;return c>=f?void 0:(b>=0?w(a,b,c,d,e):w(a,65535+b+1,c,d,e),c+2)}function z(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),O(b,2147483647,-2147483648));var f=a.length;return c>=f?void 0:(b>=0?x(a,b,c,d,e):x(a,4294967295+b+1,c,d,e),c+4)}function A(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),P(b,3.4028234663852886e38,-3.4028234663852886e38));var f=a.length;return c>=f?void 0:(S.write(a,b,c,d,23,4),c+4)}function B(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+7<a.length,"Trying to write beyond buffer length"),P(b,1.7976931348623157e308,-1.7976931348623157e308));var f=a.length;return c>=f?void 0:(S.write(a,b,c,d,52,8),c+8)}function C(a){for(a=D(a).replace(V,"");a.length%4!==0;)a+="=";return a}function D(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function E(a){return(Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)})(a)}function F(a){return E(a)||d.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length}function G(a){return 16>a?"0"+a.toString(16):a.toString(16)}function H(a){for(var b=[],c=0;c<a.length;c++){var d=a.charCodeAt(c);if(127>=d)b.push(d);else{var e=c;d>=55296&&57343>=d&&c++;for(var f=encodeURIComponent(a.slice(e,c+1)).substr(1).split("%"),g=0;g<f.length;g++)b.push(parseInt(f[g],16))}}return b}function I(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function J(a){for(var b,c,d,e=[],f=0;f<a.length;f++)b=a.charCodeAt(f),c=b>>8,d=b%256,e.push(d),e.push(c);return e}function K(a){return R.toByteArray(a)}function L(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);e++)b[e+c]=a[e];return e}function M(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function N(a,b){Q("number"==typeof a,"cannot write a non-number as a number"),Q(a>=0,"specified a negative value for writing an unsigned value"),Q(b>=a,"value is larger than maximum value for type"),Q(Math.floor(a)===a,"value has a fractional component")}function O(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value"),Q(Math.floor(a)===a,"value has a fractional component")}function P(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value")
|
||
}function Q(a,b){if(!a)throw new Error(b||"Failed assertion")}var R=a("base64-js"),S=a("ieee754");c.Buffer=d,c.SlowBuffer=d,c.INSPECT_MAX_BYTES=50,d.poolSize=8192;var T=function(){try{var a=new ArrayBuffer(0),b=new Uint8Array(a);return b.foo=function(){return 42},42===b.foo()&&"function"==typeof b.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(c){return!1}}();d.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.isBuffer=function(a){return!(null==a||!a._isBuffer)},d.byteLength=function(a,b){var c;switch(a=a.toString(),b||"utf8"){case"hex":c=a.length/2;break;case"utf8":case"utf-8":c=H(a).length;break;case"ascii":case"binary":case"raw":c=a.length;break;case"base64":c=K(a).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":c=2*a.length;break;default:throw new Error("Unknown encoding")}return c},d.concat=function(a,b){if(Q(E(a),"Usage: Buffer.concat(list[, length])"),0===a.length)return new d(0);if(1===a.length)return a[0];var c;if(void 0===b)for(b=0,c=0;c<a.length;c++)b+=a[c].length;var e=new d(b),f=0;for(c=0;c<a.length;c++){var g=a[c];g.copy(e,f),f+=g.length}return e},d.compare=function(a,b){Q(d.isBuffer(a)&&d.isBuffer(b),"Arguments must be Buffers");for(var c=a.length,e=b.length,f=0,g=Math.min(c,e);g>f&&a[f]===b[f];f++);return f!==g&&(c=a[f],e=b[f]),e>c?-1:c>e?1:0},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var k=d;d=b,b=c,c=k}b=Number(b)||0;var l=this.length-b;c?(c=Number(c),c>l&&(c=l)):c=l,d=String(d||"utf8").toLowerCase();var m;switch(d){case"hex":m=e(this,a,b,c);break;case"utf8":case"utf-8":m=f(this,a,b,c);break;case"ascii":m=g(this,a,b,c);break;case"binary":m=h(this,a,b,c);break;case"base64":m=i(this,a,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":m=j(this,a,b,c);break;default:throw new Error("Unknown encoding")}return m},d.prototype.toString=function(a,b,c){var d=this;if(a=String(a||"utf8").toLowerCase(),b=Number(b)||0,c=void 0===c?d.length:Number(c),c===b)return"";var e;switch(a){case"hex":e=o(d,b,c);break;case"utf8":case"utf-8":e=l(d,b,c);break;case"ascii":e=m(d,b,c);break;case"binary":e=n(d,b,c);break;case"base64":e=k(d,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":e=p(d,b,c);break;default:throw new Error("Unknown encoding")}return e},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},d.prototype.equals=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),0===d.compare(this,a)},d.prototype.compare=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),d.compare(this,a)},d.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||0===d||(d=this.length),b||(b=0),d!==c&&0!==a.length&&0!==e.length){Q(d>=c,"sourceEnd < sourceStart"),Q(b>=0&&b<a.length,"targetStart out of bounds"),Q(c>=0&&c<e.length,"sourceStart out of bounds"),Q(d>=0&&d<=e.length,"sourceEnd out of bounds"),d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);var f=d-c;if(100>f||!T)for(var g=0;f>g;g++)a[g+b]=this[g+c];else a._set(this.subarray(c,c+f),b)}},d.prototype.slice=function(a,b){var c=this.length;if(a=~~a,b=void 0===b?c:~~b,0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c),0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c),a>b&&(b=a),T)return d._augment(this.subarray(a,b));for(var e=b-a,f=new d(e,void 0,!0),g=0;e>g;g++)f[g]=this[g+a];return f},d.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},d.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},d.prototype.readUInt8=function(a,b){return b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),a>=this.length?void 0:this[a]},d.prototype.readUInt16LE=function(a,b){return q(this,a,!0,b)},d.prototype.readUInt16BE=function(a,b){return q(this,a,!1,b)},d.prototype.readUInt32LE=function(a,b){return r(this,a,!0,b)},d.prototype.readUInt32BE=function(a,b){return r(this,a,!1,b)},d.prototype.readInt8=function(a,b){if(b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),!(a>=this.length)){var c=128&this[a];return c?-1*(255-this[a]+1):this[a]}},d.prototype.readInt16LE=function(a,b){return s(this,a,!0,b)},d.prototype.readInt16BE=function(a,b){return s(this,a,!1,b)},d.prototype.readInt32LE=function(a,b){return t(this,a,!0,b)},d.prototype.readInt32BE=function(a,b){return t(this,a,!1,b)},d.prototype.readFloatLE=function(a,b){return u(this,a,!0,b)},d.prototype.readFloatBE=function(a,b){return u(this,a,!1,b)},d.prototype.readDoubleLE=function(a,b){return v(this,a,!0,b)},d.prototype.readDoubleBE=function(a,b){return v(this,a,!1,b)},d.prototype.writeUInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"trying to write beyond buffer length"),N(a,255)),b>=this.length?void 0:(this[b]=a,b+1)},d.prototype.writeUInt16LE=function(a,b,c){return w(this,a,b,!0,c)},d.prototype.writeUInt16BE=function(a,b,c){return w(this,a,b,!1,c)},d.prototype.writeUInt32LE=function(a,b,c){return x(this,a,b,!0,c)},d.prototype.writeUInt32BE=function(a,b,c){return x(this,a,b,!1,c)},d.prototype.writeInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"Trying to write beyond buffer length"),O(a,127,-128)),b>=this.length?void 0:(a>=0?this.writeUInt8(a,b,c):this.writeUInt8(255+a+1,b,c),b+1)},d.prototype.writeInt16LE=function(a,b,c){return y(this,a,b,!0,c)},d.prototype.writeInt16BE=function(a,b,c){return y(this,a,b,!1,c)},d.prototype.writeInt32LE=function(a,b,c){return z(this,a,b,!0,c)},d.prototype.writeInt32BE=function(a,b,c){return z(this,a,b,!1,c)},d.prototype.writeFloatLE=function(a,b,c){return A(this,a,b,!0,c)},d.prototype.writeFloatBE=function(a,b,c){return A(this,a,b,!1,c)},d.prototype.writeDoubleLE=function(a,b,c){return B(this,a,b,!0,c)},d.prototype.writeDoubleBE=function(a,b,c){return B(this,a,b,!1,c)},d.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),Q(c>=b,"end < start"),c!==b&&0!==this.length){Q(b>=0&&b<this.length,"start out of bounds"),Q(c>=0&&c<=this.length,"end out of bounds");var d;if("number"==typeof a)for(d=b;c>d;d++)this[d]=a;else{var e=H(a.toString()),f=e.length;for(d=b;c>d;d++)this[d]=e[d%f]}return this}},d.prototype.inspect=function(){for(var a=[],b=this.length,d=0;b>d;d++)if(a[d]=G(this[d]),d===c.INSPECT_MAX_BYTES){a[d+1]="...";break}return"<Buffer "+a.join(" ")+">"},d.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(T)return new d(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;c>b;b+=1)a[b]=this[b];return a.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var U=d.prototype;d._augment=function(a){return a._isBuffer=!0,a._get=a.get,a._set=a.set,a.get=U.get,a.set=U.set,a.write=U.write,a.toString=U.toString,a.toLocaleString=U.toString,a.toJSON=U.toJSON,a.equals=U.equals,a.compare=U.compare,a.copy=U.copy,a.slice=U.slice,a.readUInt8=U.readUInt8,a.readUInt16LE=U.readUInt16LE,a.readUInt16BE=U.readUInt16BE,a.readUInt32LE=U.readUInt32LE,a.readUInt32BE=U.readUInt32BE,a.readInt8=U.readInt8,a.readInt16LE=U.readInt16LE,a.readInt16BE=U.readInt16BE,a.readInt32LE=U.readInt32LE,a.readInt32BE=U.readInt32BE,a.readFloatLE=U.readFloatLE,a.readFloatBE=U.readFloatBE,a.readDoubleLE=U.readDoubleLE,a.readDoubleBE=U.readDoubleBE,a.writeUInt8=U.writeUInt8,a.writeUInt16LE=U.writeUInt16LE,a.writeUInt16BE=U.writeUInt16BE,a.writeUInt32LE=U.writeUInt32LE,a.writeUInt32BE=U.writeUInt32BE,a.writeInt8=U.writeInt8,a.writeInt16LE=U.writeInt16LE,a.writeInt16BE=U.writeInt16BE,a.writeInt32LE=U.writeInt32LE,a.writeInt32BE=U.writeInt32BE,a.writeFloatLE=U.writeFloatLE,a.writeFloatBE=U.writeFloatBE,a.writeDoubleLE=U.writeDoubleLE,a.writeDoubleBE=U.writeDoubleBE,a.fill=U.fill,a.inspect=U.inspect,a.toArrayBuffer=U.toArrayBuffer,a};var V=/[^+\/0-9A-z]/g},{"base64-js":43,ieee754:44}],43:[function(a,b,c){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(a){"use strict";function b(a){var b=a.charCodeAt(0);return b===g?62:b===h?63:i>b?-1:i+10>b?b-i+26+26:k+26>b?b-k:j+26>b?b-j+26:void 0}function c(a){function c(a){j[l++]=a}var d,e,g,h,i,j;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new f(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,e=0;g>d;d+=4,e+=3)h=b(a.charAt(d))<<18|b(a.charAt(d+1))<<12|b(a.charAt(d+2))<<6|b(a.charAt(d+3)),c((16711680&h)>>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function e(a){function b(a){return d.charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var e,f,g,h=a.length%3,i="";for(e=0,g=a.length-h;g>e;e+=3)f=(a[e]<<16)+(a[e+1]<<8)+a[e+2],i+=c(f);switch(h){case 1:f=a[a.length-1],i+=b(f>>2),i+=b(f<<4&63),i+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],i+=b(f>>10),i+=b(f>>4&63),i+=b(f<<2&63),i+="="}return i}var f="undefined"!=typeof Uint8Array?Uint8Array:Array,g="+".charCodeAt(0),h="/".charCodeAt(0),i="0".charCodeAt(0),j="a".charCodeAt(0),k="A".charCodeAt(0);a.toByteArray=c,a.fromByteArray=e}("undefined"==typeof c?this.base64js={}:c)},{}],44:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],45:[function(a,b){b.exports="function"==typeof Object.create?function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],46:[function(a,b){function c(){}var d=b.exports={};d.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var d=c.shift();d()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.binding=function(){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(){throw new Error("process.chdir is not supported")}},{}],47:[function(a,b){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8}},{}],48:[function(a,b,c){(function(b,d){function e(a,b){var d={seen:[],stylize:g};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),p(b)?d.showHidden=b:b&&c._extend(d,b),v(d.showHidden)&&(d.showHidden=!1),v(d.depth)&&(d.depth=2),v(d.colors)&&(d.colors=!1),v(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=f),i(d,a,d.depth)}function f(a,b){var c=e.styles[b];return c?"["+e.colors[c][0]+"m"+a+"["+e.colors[c][1]+"m":a}function g(a){return a}function h(a){var b={};return a.forEach(function(a){b[a]=!0}),b}function i(a,b,d){if(a.customInspect&&b&&A(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return t(e)||(e=i(a,e,d)),e}var f=j(a,b);if(f)return f;var g=Object.keys(b),p=h(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),z(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return k(b);if(0===g.length){if(A(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(w(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(y(b))return a.stylize(Date.prototype.toString.call(b),"date");if(z(b))return k(b)}var r="",s=!1,u=["{","}"];if(o(b)&&(s=!0,u=["[","]"]),A(b)){var v=b.name?": "+b.name:"";r=" [Function"+v+"]"}if(w(b)&&(r=" "+RegExp.prototype.toString.call(b)),y(b)&&(r=" "+Date.prototype.toUTCString.call(b)),z(b)&&(r=" "+k(b)),0===g.length&&(!s||0==b.length))return u[0]+r+u[1];if(0>d)return w(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var x;return x=s?l(a,b,d,p,g):g.map(function(c){return m(a,b,d,p,c,s)}),a.seen.pop(),n(x,r,u)}function j(a,b){if(v(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return s(b)?a.stylize(""+b,"number"):p(b)?a.stylize(""+b,"boolean"):q(b)?a.stylize("null","null"):void 0}function k(a){return"["+Error.prototype.toString.call(a)+"]"}function l(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(F(b,String(g))?m(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(m(a,b,c,d,e,!0))}),f}function m(a,b,c,d,e,f){var g,h,j;if(j=Object.getOwnPropertyDescriptor(b,e)||{value:b[e]},j.get?h=j.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):j.set&&(h=a.stylize("[Setter]","special")),F(d,e)||(g="["+e+"]"),h||(a.seen.indexOf(j.value)<0?(h=q(c)?i(a,j.value,null):i(a,j.value,c-1),h.indexOf("\n")>-1&&(h=f?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),v(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function n(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function o(a){return Array.isArray(a)}function p(a){return"boolean"==typeof a}function q(a){return null===a}function r(a){return null==a}function s(a){return"number"==typeof a}function t(a){return"string"==typeof a}function u(a){return"symbol"==typeof a}function v(a){return void 0===a}function w(a){return x(a)&&"[object RegExp]"===C(a)}function x(a){return"object"==typeof a&&null!==a}function y(a){return x(a)&&"[object Date]"===C(a)}function z(a){return x(a)&&("[object Error]"===C(a)||a instanceof Error)}function A(a){return"function"==typeof a}function B(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function C(a){return Object.prototype.toString.call(a)}function D(a){return 10>a?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),J[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=/%[sdj%]/g;c.format=function(a){if(!t(a)){for(var b=[],c=0;c<arguments.length;c++)b.push(e(arguments[c]));return b.join(" ")}for(var c=1,d=arguments,f=d.length,g=String(a).replace(G,function(a){if("%%"===a)return"%";if(c>=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(b){return"[Circular]"}default:return a}}),h=d[c];f>c;h=d[++c])g+=q(h)||!x(h)?" "+h:" "+e(h);return g},c.deprecate=function(a,e){function f(){if(!g){if(b.throwDeprecation)throw new Error(e);b.traceDeprecation?console.trace(e):console.error(e),g=!0}return a.apply(this,arguments)}if(v(d.process))return function(){return c.deprecate(a,e).apply(this,arguments)};if(b.noDeprecation===!0)return a;var g=!1;return f};var H,I={};c.debuglog=function(a){if(v(H)&&(H=b.env.NODE_DEBUG||""),a=a.toUpperCase(),!I[a])if(new RegExp("\\b"+a+"\\b","i").test(H)){var d=b.pid;I[a]=function(){var b=c.format.apply(c,arguments);console.error("%s %d: %s",a,d,b)}}else I[a]=function(){};return I[a]},c.inspect=e,e.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},e.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},c.isArray=o,c.isBoolean=p,c.isNull=q,c.isNullOrUndefined=r,c.isNumber=s,c.isString=t,c.isSymbol=u,c.isUndefined=v,c.isRegExp=w,c.isObject=x,c.isDate=y,c.isError=z,c.isFunction=A,c.isPrimitive=B,c.isBuffer=a("./support/isBuffer");var J=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c.log=function(){console.log("%s - %s",E(),c.format.apply(c,arguments))},c.inherits=a("inherits"),c._extend=function(a,b){if(!b||!x(b))return a;for(var c=Object.keys(b),d=c.length;d--;)a[c[d]]=b[c[d]];return a}}).call(this,a("JkpR2F"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":47,JkpR2F:46,inherits:45}],49:[function(a,b,c){!function(d){"use strict";"function"==typeof a&&"object"==typeof c&&"object"==typeof b?b.exports=d:"function"==typeof define&&define.amd?define(function(){return d}):chai.use(d)}(function(a,b){"use strict";function c(a){return"function"==typeof a&&"function"==typeof a.getCall&&"function"==typeof a.calledWithExactly}function d(a){return 1===a?"once":2===a?"twice":3===a?"thrice":(a||0)+" times"}function e(a){return a&&c(a.proxy)}function f(a){if(!c(a._obj)&&!e(a._obj))throw new TypeError(b.inspect(a._obj)+" is not a spy or a call to a spy!")}function g(a,b,d,e,f){function g(b){return a.printf.apply(a,b)}var h=e?"always have ":"have ";return d=d||"",c(a.proxy)&&(a=a.proxy),{affirmative:g(["expected %n to "+h+b+d].concat(f)),negative:g(["expected %n to not "+h+b].concat(f))}}function h(c,d,e){b.addProperty(a.Assertion.prototype,c,function(){f(this);var a=g(this._obj,d,e,!1);this.assert(this._obj[c],a.affirmative,a.negative)})}function i(c,e,h){b.addMethod(a.Assertion.prototype,c,function(a){f(this);var b=g(this._obj,e,h,!1,[d(a)]);this.assert(this._obj[c]===a,b.affirmative,b.negative)})}function j(a,c,d){return function(){f(this);var e="always"+a[0].toUpperCase()+a.substring(1),h=b.flag(this,"always")&&"function"==typeof this._obj[e],i=h?e:a,j=g(this._obj,c,d,h,n.call(arguments));this.assert(this._obj[i].apply(this._obj,arguments),j.affirmative,j.negative)}}function k(c,d,e){var f=j(c,d,e);b.addProperty(a.Assertion.prototype,c,f)}function l(c,d,e,f){var g=j(d,e,f);b.addMethod(a.Assertion.prototype,c,g)}function m(a,b,c){l(a,a,b,c)}var n=Array.prototype.slice;b.addProperty(a.Assertion.prototype,"always",function(){b.flag(this,"always",!0)}),h("called","been called"," at least once, but it was never called"),i("callCount","been called exactly %1",", but it was called %c%C"),h("calledOnce","been called exactly once",", but it was called %c%C"),h("calledTwice","been called exactly twice",", but it was called %c%C"),h("calledThrice","been called exactly thrice",", but it was called %c%C"),k("calledWithNew","been called with new"),m("calledBefore","been called before %1"),m("calledAfter","been called after %1"),m("calledOn","been called with %1 as this",", but it was called with %t instead"),m("calledWith","been called with arguments %*","%C"),m("calledWithExactly","been called with exact arguments %*","%C"),m("calledWithMatch","been called with arguments matching %*","%C"),m("returned","returned %1"),l("thrown","threw","thrown %1")})},{}],50:[function(a,b,c){"use strict";!function(d){function e(a){var b=!1;try{a.appendChild(l),b=l.parentNode==a}catch(c){return!1}finally{try{a.removeChild(l)}catch(c){}}return b}function f(a){return l&&a&&1===a.nodeType&&e(a)}function g(a){return"function"==typeof a||!!(a&&a.constructor&&a.call&&a.apply)}function h(a){return"number"==typeof a&&isNaN(a)}function i(a,b){for(var c in b)m.call(a,c)||(a[c]=b[c])}function j(a){return"function"==typeof a&&"function"==typeof a.restore&&a.restore.sinon}function k(a,b,c){c.exports=n,n.spy=a("./sinon/spy"),n.spyCall=a("./sinon/call"),n.behavior=a("./sinon/behavior"),n.stub=a("./sinon/stub"),n.mock=a("./sinon/mock"),n.collection=a("./sinon/collection"),n.assert=a("./sinon/assert"),n.sandbox=a("./sinon/sandbox"),n.test=a("./sinon/test"),n.testCase=a("./sinon/test_case"),n.match=a("./sinon/match")}var l="undefined"!=typeof document&&document.createElement("div"),m=Object.prototype.hasOwnProperty,n={wrapMethod:function(a,b,c){if(!a)throw new TypeError("Should wrap property of object");if("function"!=typeof c)throw new TypeError("Method wrapper should be function");var d,e=a[b];if(g(e)){if(e.restore&&e.restore.sinon)d=new TypeError("Attempted to wrap "+b+" which is already wrapped");else if(e.calledBefore){var f=e.returns?"stubbed":"spied on";d=new TypeError("Attempted to wrap "+b+" which is already "+f)}}else d=new TypeError("Attempted to wrap "+typeof e+" property "+b+" as function");if(d)throw e&&e._stack&&(d.stack+="\n--------------\n"+e._stack),d;var h=a.hasOwnProperty?a.hasOwnProperty(b):m.call(a,b);return a[b]=c,c.displayName=b,c._stack=new Error("Stack Trace for original").stack,c.restore=function(){h||delete a[b],a[b]===c&&(a[b]=e)},c.restore.sinon=!0,i(c,e),c},extend:function(a){for(var b=1,c=arguments.length;c>b;b+=1)for(var d in arguments[b])arguments[b].hasOwnProperty(d)&&(a[d]=arguments[b][d]),arguments[b].hasOwnProperty("toString")&&arguments[b].toString!=a.toString&&(a.toString=arguments[b].toString);return a},create:function(a){var b=function(){};return b.prototype=a,new b},deepEqual:function t(a,b){if(n.match&&n.match.isMatcher(a))return a.test(b);if("object"!=typeof a||"object"!=typeof b)return h(a)&&h(b)?!0:a===b;if(f(a)||f(b))return a===b;if(a===b)return!0;if(null===a&&null!==b||null!==a&&null===b)return!1;if(a instanceof RegExp&&b instanceof RegExp)return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;var c=Object.prototype.toString.call(a);if(c!=Object.prototype.toString.call(b))return!1;if("[object Date]"==c)return a.valueOf()===b.valueOf();var d,e=0,g=0;if("[object Array]"==c&&a.length!==b.length)return!1;for(d in a){if(e+=1,!(d in b))return!1;if(!t(a[d],b[d]))return!1}for(d in b)g+=1;return e==g},functionName:function(a){var b=a.displayName||a.name;if(!b){var c=a.toString().match(/function ([^\s\(]+)/);b=c&&c[1]}return b},functionToString:function(){if(this.getCall&&this.callCount)for(var a,b,c=this.callCount;c--;){a=this.getCall(c).thisValue;for(b in a)if(a[b]===this)return b}return this.displayName||"sinon fake"},getConfig:function(a){var b={};a=a||{};var c=n.defaultConfig;for(var d in c)c.hasOwnProperty(d)&&(b[d]=a.hasOwnProperty(d)?a[d]:c[d]);return b},format:function(a){return""+a},defaultConfig:{injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},timesInWords:function(a){return 1==a&&"once"||2==a&&"twice"||3==a&&"thrice"||(a||0)+" times"},calledInOrder:function(a){for(var b=1,c=a.length;c>b;b++)if(!a[b-1].calledBefore(a[b])||!a[b].called)return!1;return!0},orderByFirstCall:function(a){return a.sort(function(a,b){var c=a.getCall(0),d=b.getCall(0),e=c&&c.callId||-1,f=d&&d.callId||-1;return f>e?-1:1})},log:function(){},logError:function(a,b){var c=a+" threw exception: ";n.log(c+"["+b.name+"] "+b.message),b.stack&&n.log(b.stack),setTimeout(function(){throw b.message=c+b.message,b},0)},typeOf:function(a){if(null===a)return"null";if(void 0===a)return"undefined";var b=Object.prototype.toString.call(a);return b.substring(8,b.length-1).toLowerCase()},createStubInstance:function(a){if("function"!=typeof a)throw new TypeError("The constructor should be a function.");return n.stub(n.create(a.prototype))},restore:function(a){if(null!==a&&"object"==typeof a)for(var b in a)j(a[b])&&a[b].restore();else j(a)&&a.restore()}},o="undefined"!=typeof b&&b.exports&&"function"==typeof a,p="function"==typeof define&&"object"==typeof define.amd&&define.amd;if(p)define(k);else if(o){try{d=a("formatio")}catch(q){}k(a,c,b)}if(d){var r=d.configure({quoteStrings:!1});n.format=function(){return r.ascii.apply(r,arguments)}}else if(o)try{var s=a("util");n.format=function(a){return"object"==typeof a&&a.toString===Object.prototype.toString?s.inspect(a):a}}catch(q){}return n}("object"==typeof formatio&&formatio)},{"./sinon/assert":51,"./sinon/behavior":52,"./sinon/call":53,"./sinon/collection":54,"./sinon/match":55,"./sinon/mock":56,"./sinon/sandbox":57,"./sinon/spy":58,"./sinon/stub":59,"./sinon/test":60,"./sinon/test_case":61,formatio:63,util:48}],51:[function(a,b){(function(c){"use strict";!function(c,d){function e(){for(var a,b=0,c=arguments.length;c>b;++b)a=arguments[b],a||i.fail("fake is not a spy"),"function"!=typeof a&&i.fail(a+" is not a function"),"function"!=typeof a.getCall&&i.fail(a+" is not stubbed")}function f(a,b){a=a||d;var c=a.fail||i.fail;c.call(a,b)}function g(a,b,c){2==arguments.length&&(c=b,b=a),i[a]=function(d){e(d);var g=k.call(arguments,1),h=!1;h="function"==typeof b?!b(d):"function"==typeof d[b]?!d[b].apply(d,g):!d[b],h?f(this,d.printf.apply(d,[c].concat(g))):i.pass(a)}}function h(a,b){return!a||/^fail/.test(b)?b:a+b.slice(0,1).toUpperCase()+b.slice(1)}var i,j="undefined"!=typeof b&&b.exports&&"function"==typeof a,k=Array.prototype.slice;!c&&j&&(c=a("../sinon")),c&&(i={failException:"AssertError",fail:function(a){var b=new Error(a);throw b.name=this.failException||i.failException,b},pass:function(){},callOrder:function(){e.apply(null,arguments);var a="",b="";if(c.calledInOrder(arguments))i.pass("callOrder");else{try{a=[].join.call(arguments,", ");for(var d=k.call(arguments),g=d.length;g;)d[--g].called||d.splice(g,1);b=c.orderByFirstCall(d).join(", ")}catch(h){}f(this,"expected "+a+" to be called in order but were called as "+b)}},callCount:function(a,b){if(e(a),a.callCount!=b){var d="expected %n to be called "+c.timesInWords(b)+" but was called %c%C";f(this,a.printf(d))}else i.pass("callCount")},expose:function(a,b){if(!a)throw new TypeError("target is null or undefined");var c=b||{},d="undefined"==typeof c.prefix&&"assert"||c.prefix,e="undefined"==typeof c.includeFail||!!c.includeFail;for(var f in this)"export"==f||!e&&/^(fail)/.test(f)||(a[h(d,f)]=this[f]);return a},match:function(a,b){var d=c.match(b);if(d.test(a))i.pass("match");else{var e=["expected value to match"," expected = "+c.format(b)," actual = "+c.format(a)];f(this,e.join("\n"))}}},g("called","expected %n to have been called at least once but was never called"),g("notCalled",function(a){return!a.called},"expected %n to not have been called but was called %c%C"),g("calledOnce","expected %n to be called once but was called %c%C"),g("calledTwice","expected %n to be called twice but was called %c%C"),g("calledThrice","expected %n to be called thrice but was called %c%C"),g("calledOn","expected %n to be called with %1 as this but was called with %t"),g("alwaysCalledOn","expected %n to always be called with %1 as this but was called with %t"),g("calledWithNew","expected %n to be called with new"),g("alwaysCalledWithNew","expected %n to always be called with new"),g("calledWith","expected %n to be called with arguments %*%C"),g("calledWithMatch","expected %n to be called with match %*%C"),g("alwaysCalledWith","expected %n to always be called with arguments %*%C"),g("alwaysCalledWithMatch","expected %n to always be called with match %*%C"),g("calledWithExactly","expected %n to be called with exact arguments %*%C"),g("alwaysCalledWithExactly","expected %n to always be called with exact arguments %*%C"),g("neverCalledWith","expected %n to never be called with arguments %*%C"),g("neverCalledWithMatch","expected %n to never be called with match %*%C"),g("threw","%n did not throw exception%C"),g("alwaysThrew","%n did not always throw exception%C"),c.assert=i,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=i}):j&&(b.exports=i))}("object"==typeof sinon&&sinon||null,"undefined"!=typeof window?window:"undefined"!=typeof self?self:c)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../sinon":50}],52:[function(a,b){(function(c){"use strict";!function(d){function e(a,b){return"string"==typeof a?(this.exception=new Error(b||""),this.exception.name=a):this.exception=a?a:new Error("Error"),this}function f(a,b){var c=a.callArgAt;if(0>c){for(var d=a.callArgProp,e=0,f=b.length;f>e;++e){if(!d&&"function"==typeof b[e])return b[e];if(d&&b[e]&&"function"==typeof b[e][d])return b[e][d]}return null}return b[c]}function g(a,b,c){if(a.callArgAt<0){var e;return e=a.callArgProp?d.functionName(a.stub)+" expected to yield to '"+a.callArgProp+"', but no object with such a property was passed.":d.functionName(a.stub)+" expected to yield, but no callback was passed.",c.length>0&&(e+=" Received ["+l.call(c,", ")+"]"),e}return"argument at index "+a.callArgAt+" is not a function: "+b}function h(a,b){if("number"==typeof a.callArgAt){var c=f(a,b);if("function"!=typeof c)throw new TypeError(g(a,c,b));a.callbackAsync?m(function(){c.apply(a.callbackContext,a.callbackArguments)}):c.apply(a.callbackContext,a.callbackArguments)}}var i="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!d&&i&&(d=a("../sinon")),d){var j,k=Array.prototype.slice,l=Array.prototype.join,m=function(){return"object"==typeof c&&"function"==typeof c.nextTick?c.nextTick:"function"==typeof setImmediate?setImmediate:function(a){setTimeout(a,0)}}();j={create:function(a){var b=d.extend({},d.behavior);return delete b.create,b.stub=a,b},isPresent:function(){return"number"==typeof this.callArgAt||this.exception||"number"==typeof this.returnArgAt||this.returnThis||this.returnValueDefined},invoke:function(a,b){if(h(this,b),this.exception)throw this.exception;return"number"==typeof this.returnArgAt?b[this.returnArgAt]:this.returnThis?a:this.returnValue},onCall:function(a){return this.stub.onCall(a)},onFirstCall:function(){return this.stub.onFirstCall()},onSecondCall:function(){return this.stub.onSecondCall()},onThirdCall:function(){return this.stub.onThirdCall()},withArgs:function(){throw new Error('Defining a stub by invoking "stub.onCall(...).withArgs(...)" is not supported. Use "stub.withArgs(...).onCall(...)" to define sequential behavior for calls with certain arguments.')},callsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOn:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgWith:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");
|
||
return this.callArgAt=a,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOnWith:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},yields:function(){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,0),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsOn:function(a){if("object"!=typeof a)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=a,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsTo:function(a){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=a,this.callbackAsync=!1,this},yieldsToOn:function(a,b){if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=a,this.callbackAsync=!1,this},"throws":e,throwsException:e,returns:function(a){return this.returnValue=a,this.returnValueDefined=!0,this},returnsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.returnArgAt=a,this},returnsThis:function(){return this.returnThis=!0,this}};for(var n in j)j.hasOwnProperty(n)&&n.match(/^(callsArg|yields)/)&&!n.match(/Async/)&&(j[n+"Async"]=function(a){return function(){var b=this[a].apply(this,arguments);return this.callbackAsync=!0,b}}(n));d.behavior=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):i&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)}).call(this,a("JkpR2F"))},{"../sinon":50,JkpR2F:46}],53:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.functionName(a)+b;throw d.length&&(e+=" Received ["+g.call(d).join(", ")+"]"),new Error(e)}function e(a,b,d,e,f,g){if("number"!=typeof g)throw new TypeError("Call id is not a number");var i=c.create(h);return i.proxy=a,i.thisValue=b,i.args=d,i.returnValue=e,i.exception=f,i.callId=g,i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&f&&(c=a("../sinon")),c){var g=Array.prototype.slice,h={calledOn:function(a){return c.match&&c.match.isMatcher(a)?a.test(this.thisValue):this.thisValue===a},calledWith:function(){for(var a=0,b=arguments.length;b>a;a+=1)if(!c.deepEqual(arguments[a],this.args[a]))return!1;return!0},calledWithMatch:function(){for(var a=0,b=arguments.length;b>a;a+=1){var d=this.args[a],e=arguments[a];if(!c.match||!c.match(e).test(d))return!1}return!0},calledWithExactly:function(){return arguments.length==this.args.length&&this.calledWith.apply(this,arguments)},notCalledWith:function(){return!this.calledWith.apply(this,arguments)},notCalledWithMatch:function(){return!this.calledWithMatch.apply(this,arguments)},returned:function(a){return c.deepEqual(a,this.returnValue)},threw:function(a){return"undefined"!=typeof a&&this.exception?this.exception===a||this.exception.name===a:!!this.exception},calledWithNew:function(){return this.proxy.prototype&&this.thisValue instanceof this.proxy},calledBefore:function(a){return this.callId<a.callId},calledAfter:function(a){return this.callId>a.callId},callArg:function(a){this.args[a]()},callArgOn:function(a,b){this.args[a].apply(b)},callArgWith:function(a){this.callArgOnWith.apply(this,[a,null].concat(g.call(arguments,1)))},callArgOnWith:function(a,b){var c=g.call(arguments,2);this.args[a].apply(b,c)},"yield":function(){this.yieldOn.apply(this,[null].concat(g.call(arguments,0)))},yieldOn:function(a){for(var b=this.args,c=0,e=b.length;e>c;++c)if("function"==typeof b[c])return void b[c].apply(a,g.call(arguments,1));d(this.proxy," cannot yield since no callback was passed.",b)},yieldTo:function(a){this.yieldToOn.apply(this,[a,null].concat(g.call(arguments,1)))},yieldToOn:function(a,b){for(var c=this.args,e=0,f=c.length;f>e;++e)if(c[e]&&"function"==typeof c[e][a])return void c[e][a].apply(b,g.call(arguments,2));d(this.proxy," cannot yield to '"+a+"' since no callback was passed.",c)},toString:function(){for(var a=this.proxy.toString()+"(",b=[],d=0,e=this.args.length;e>d;++d)b.push(c.format(this.args[d]));return a=a+b.join(", ")+")","undefined"!=typeof this.returnValue&&(a+=" => "+c.format(this.returnValue)),this.exception&&(a+=" !"+this.exception.name,this.exception.message&&(a+="("+this.exception.message+")")),a}};h.invokeCallback=h.yield,e.toString=h.toString,c.spyCall=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],54:[function(a,b){"use strict";!function(c){function d(a){return a.fakes||(a.fakes=[]),a.fakes}function e(a,b){for(var c=d(a),e=0,f=c.length;f>e;e+=1)"function"==typeof c[e][b]&&c[e][b]()}function f(a){for(var b=d(a),c=0;c<b.length;)b.splice(c,1)}var g="undefined"!=typeof b&&b.exports&&"function"==typeof a,h=[].push,i=Object.prototype.hasOwnProperty;if(!c&&g&&(c=a("../sinon")),c){var j={verify:function(){e(this,"verify")},restore:function(){e(this,"restore"),f(this)},verifyAndRestore:function(){var a;try{this.verify()}catch(b){a=b}if(this.restore(),a)throw a},add:function(a){return h.call(d(this),a),a},spy:function(){return this.add(c.spy.apply(c,arguments))},stub:function(a,b,d){if(b){var e=a[b];if("function"!=typeof e){if(!i.call(a,b))throw new TypeError("Cannot stub non-existent own property "+b);return a[b]=d,this.add({restore:function(){a[b]=e}})}}if(!b&&a&&"object"==typeof a){var f=c.stub.apply(c,arguments);for(var g in f)"function"==typeof f[g]&&this.add(f[g]);return f}return this.add(c.stub.apply(c,arguments))},mock:function(){return this.add(c.mock.apply(c,arguments))},inject:function(a){var b=this;return a.spy=function(){return b.spy.apply(b,arguments)},a.stub=function(){return b.stub.apply(b,arguments)},a.mock=function(){return b.mock.apply(b,arguments)},a}};c.collection=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):g&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],55:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.typeOf(a);if(e!==b)throw new TypeError("Expected type of "+d+" to be "+b+", but was "+e)}function e(a){return i.isPrototypeOf(a)}function f(a,b){if(null===b||void 0===b)return!1;for(var d in a)if(a.hasOwnProperty(d)){var e=a[d],g=b[d];if(j.isMatcher(e)){if(!e.test(g))return!1}else if("object"===c.typeOf(e)){if(!f(e,g))return!1}else if(!c.deepEqual(e,g))return!1}return!0}function g(a,b){return function(e,f){d(e,"string","property");var g=1===arguments.length,h=b+'("'+e+'"';return g||(h+=", "+f),h+=")",j(function(b){return void 0!==b&&null!==b&&a(b,e)?g||c.deepEqual(f,b[e]):!1},h)}}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i={toString:function(){return this.message}};i.or=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)||a.test(c)},d.message=b.message+".or("+a.message+")",d},i.and=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)&&a.test(c)},d.message=b.message+".and("+a.message+")",d};var j=function(a,b){var d=c.create(i),e=c.typeOf(a);switch(e){case"object":if("function"==typeof a.test)return d.test=function(b){return a.test(b)===!0},d.message="match("+c.functionName(a.test)+")",d;var g=[];for(var h in a)a.hasOwnProperty(h)&&g.push(h+": "+a[h]);d.test=function(b){return f(a,b)},d.message="match("+g.join(", ")+")";break;case"number":d.test=function(b){return a==b};break;case"string":d.test=function(b){return"string"!=typeof b?!1:-1!==b.indexOf(a)},d.message='match("'+a+'")';break;case"regexp":d.test=function(b){return"string"!=typeof b?!1:a.test(b)};break;case"function":d.test=a,d.message=b?b:"match("+c.functionName(a)+")";break;default:d.test=function(b){return c.deepEqual(a,b)}}return d.message||(d.message="match("+a+")"),d};j.isMatcher=e,j.any=j(function(){return!0},"any"),j.defined=j(function(a){return null!==a&&void 0!==a},"defined"),j.truthy=j(function(a){return!!a},"truthy"),j.falsy=j(function(a){return!a},"falsy"),j.same=function(a){return j(function(b){return a===b},"same("+a+")")},j.typeOf=function(a){return d(a,"string","type"),j(function(b){return c.typeOf(b)===a},'typeOf("'+a+'")')},j.instanceOf=function(a){return d(a,"function","type"),j(function(b){return b instanceof a},"instanceOf("+c.functionName(a)+")")},j.has=g(function(a,b){return"object"==typeof a?b in a:void 0!==a[b]},"has"),j.hasOwn=g(function(a,b){return a.hasOwnProperty(b)},"hasOwn"),j.bool=j.typeOf("boolean"),j.number=j.typeOf("number"),j.string=j.typeOf("string"),j.object=j.typeOf("object"),j.func=j.typeOf("function"),j.array=j.typeOf("array"),j.regexp=j.typeOf("regexp"),j.date=j.typeOf("date"),c.match=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):h&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],56:[function(a,b){"use strict";!function(c){function d(a){return a?d.create(a):c.expectation.create("Anonymous mock")}var e,f="undefined"!=typeof b&&b.exports&&"function"==typeof a,g=[].push;if(!c&&f&&(c=a("../sinon")),c){e=c.match,!e&&f&&(e=a("./match")),c.mock=d,c.extend(d,function(){function a(a,b){if(a)for(var c=0,d=a.length;d>c;c+=1)b(a[c])}return{create:function(a){if(!a)throw new TypeError("object is null");var b=c.extend({},d);return b.object=a,delete b.create,b},expects:function(a){if(!a)throw new TypeError("method is falsy");if(this.expectations||(this.expectations={},this.proxies=[]),!this.expectations[a]){this.expectations[a]=[];var b=this;c.wrapMethod(this.object,a,function(){return b.invokeMethod(a,this,arguments)}),g.call(this.proxies,a)}var d=c.expectation.create(a);return g.call(this.expectations[a],d),d},restore:function(){var b=this.object;a(this.proxies,function(a){"function"==typeof b[a].restore&&b[a].restore()})},verify:function(){var b=this.expectations||{},d=[],e=[];return a(this.proxies,function(c){a(b[c],function(a){a.met()?g.call(e,a.toString()):g.call(d,a.toString())})}),this.restore(),d.length>0?c.expectation.fail(d.concat(e).join("\n")):c.expectation.pass(d.concat(e).join("\n")),!0},invokeMethod:function(a,b,d){var e,f=this.expectations&&this.expectations[a],h=f&&f.length||0;for(e=0;h>e;e+=1)if(!f[e].met()&&f[e].allowsCall(b,d))return f[e].apply(b,d);var i,j=[],k=0;for(e=0;h>e;e+=1)f[e].allowsCall(b,d)?i=i||f[e]:k+=1,g.call(j," "+f[e].toString());return 0===k?i.apply(b,d):(j.unshift("Unexpected call: "+c.spyCall.toString.call({proxy:a,args:d})),void c.expectation.fail(j.join("\n")))}}}());var h=c.timesInWords;c.expectation=function(){function a(a){return 0==a?"never called":"called "+h(a)}function b(a){var b=a.minCalls,c=a.maxCalls;if("number"==typeof b&&"number"==typeof c){var d=h(b);return b!=c&&(d="at least "+d+" and at most "+h(c)),d}return"number"==typeof b?"at least "+h(b):"at most "+h(c)}function d(a){var b="number"==typeof a.minCalls;return!b||a.callCount>=a.minCalls}function f(a){return"number"!=typeof a.maxCalls?!1:a.callCount==a.maxCalls}function i(a,b){return e&&e.isMatcher(a)?a.test(b):!0}var j=Array.prototype.slice,k=c.spy.invoke;return{minCalls:1,maxCalls:1,create:function(a){var b=c.extend(c.stub.create(),c.expectation);return delete b.create,b.method=a,b},invoke:function(a,b,c){return this.verifyCallAllowed(b,c),k.apply(this,arguments)},atLeast:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");return this.limitsSet||(this.maxCalls=null,this.limitsSet=!0),this.minCalls=a,this},atMost:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");return this.limitsSet||(this.minCalls=null,this.limitsSet=!0),this.maxCalls=a,this},never:function(){return this.exactly(0)},once:function(){return this.exactly(1)},twice:function(){return this.exactly(2)},thrice:function(){return this.exactly(3)},exactly:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not a number");return this.atLeast(a),this.atMost(a)},met:function(){return!this.failed&&d(this)},verifyCallAllowed:function(a,b){if(f(this)&&(this.failed=!0,c.expectation.fail(this.method+" already called "+h(this.maxCalls))),"expectedThis"in this&&this.expectedThis!==a&&c.expectation.fail(this.method+" called with "+a+" as thisValue, expected "+this.expectedThis),"expectedArguments"in this){b||c.expectation.fail(this.method+" received no arguments, expected "+c.format(this.expectedArguments)),b.length<this.expectedArguments.length&&c.expectation.fail(this.method+" received too few arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments)),this.expectsExactArgCount&&b.length!=this.expectedArguments.length&&c.expectation.fail(this.method+" received too many arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments));for(var d=0,e=this.expectedArguments.length;e>d;d+=1)i(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", didn't match "+this.expectedArguments.toString()),c.deepEqual(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", expected "+c.format(this.expectedArguments))}},allowsCall:function(a,b){if(this.met()&&f(this))return!1;if("expectedThis"in this&&this.expectedThis!==a)return!1;if(!("expectedArguments"in this))return!0;if(b=b||[],b.length<this.expectedArguments.length)return!1;if(this.expectsExactArgCount&&b.length!=this.expectedArguments.length)return!1;for(var d=0,e=this.expectedArguments.length;e>d;d+=1){if(!i(this.expectedArguments[d],b[d]))return!1;if(!c.deepEqual(this.expectedArguments[d],b[d]))return!1}return!0},withArgs:function(){return this.expectedArguments=j.call(arguments),this},withExactArgs:function(){return this.withArgs.apply(this,arguments),this.expectsExactArgCount=!0,this},on:function(a){return this.expectedThis=a,this},toString:function(){var d=(this.expectedArguments||[]).slice();this.expectsExactArgCount||g.call(d,"[...]");var e=c.spyCall.toString.call({proxy:this.method||"anonymous mock expectation",args:d}),f=e.replace(", [...","[, ...")+" "+b(this);return this.met()?"Expectation met: "+f:"Expected "+f+" ("+a(this.callCount)+")"},verify:function(){return this.met()?c.expectation.pass(this.toString()):c.expectation.fail(this.toString()),!0},pass:function(a){c.assert.pass(a)},fail:function(a){var b=new Error(a);throw b.name="ExpectationError",b}}}(),c.mock=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):f&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50,"./match":55}],57:[function(a,b){"use strict";if("undefined"!=typeof b&&b.exports&&"function"==typeof a){var c=a("../sinon");c.extend(c,a("./util/fake_timers"))}!function(){function a(a,b,c,d){d&&(!b.injectInto||c in b.injectInto?e.call(a.args,d):(b.injectInto[c]=d,a.injectedKeys.push(c)))}function d(a){var b=c.create(c.sandbox);return a.useFakeServer&&("object"==typeof a.useFakeServer&&(b.serverPrototype=a.useFakeServer),b.useFakeServer()),a.useFakeTimers&&("object"==typeof a.useFakeTimers?b.useFakeTimers.apply(b,a.useFakeTimers):b.useFakeTimers()),b}var e=[].push;c.sandbox=c.extend(c.create(c.collection),{useFakeTimers:function(){return this.clock=c.useFakeTimers.apply(c,arguments),this.add(this.clock)},serverPrototype:c.fakeServer,useFakeServer:function(){var a=this.serverPrototype||c.fakeServer;return a&&a.create?(this.server=a.create(),this.add(this.server)):null},inject:function(a){return c.collection.inject.call(this,a),this.clock&&(a.clock=this.clock),this.server&&(a.server=this.server,a.requests=this.server.requests),a},restore:function(){c.collection.restore.apply(this,arguments),this.restoreContext()},restoreContext:function(){if(this.injectedKeys){for(var a=0,b=this.injectedKeys.length;b>a;a++)delete this.injectInto[this.injectedKeys[a]];this.injectedKeys=[]}},create:function(b){if(!b)return c.create(c.sandbox);var e=d(b);e.args=e.args||[],e.injectedKeys=[],e.injectInto=b.injectInto;var f,g,h=e.inject({});if(b.properties)for(var i=0,j=b.properties.length;j>i;i++)f=b.properties[i],g=h[f]||"sandbox"==f&&e,a(e,b,f,g);else a(e,b,"sandbox",g);return e}}),c.sandbox.useFakeXMLHttpRequest=c.sandbox.useFakeServer,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=c.sandbox}):"undefined"!=typeof b&&b.exports&&(b.exports=c.sandbox)}()},{"../sinon":50,"./util/fake_timers":62}],58:[function(require,module,exports){"use strict";!function(sinon){function spy(a,b){if(!b&&"function"==typeof a)return spy.create(a);if(!a&&!b)return spy.create(function(){});var c=a[b];return sinon.wrapMethod(a,b,spy.create(c))}function matchingFake(a,b,c){if(a)for(var d=0,e=a.length;e>d;d++)if(a[d].matches(b,c))return a[d]}function incrementCallCount(){this.called=!0,this.callCount+=1,this.notCalled=!1,this.calledOnce=1==this.callCount,this.calledTwice=2==this.callCount,this.calledThrice=3==this.callCount}function createCallProperties(){this.firstCall=this.getCall(0),this.secondCall=this.getCall(1),this.thirdCall=this.getCall(2),this.lastCall=this.getCall(this.callCount-1)}function createProxy(func){var p;return func.length?eval("p = (function proxy("+vars.substring(0,2*func.length-1)+") { return p.invoke(func, this, slice.call(arguments)); });"):p=function(){return p.invoke(func,this,slice.call(arguments))},p}function delegateToCalls(a,b,c,d){spyApi[a]=function(){if(!this.called)return d?d.apply(this,arguments):!1;for(var e,f=0,g=0,h=this.callCount;h>g;g+=1)if(e=this.getCall(g),e[c||a].apply(e,arguments)&&(f+=1,b))return!0;return f===this.callCount}}var commonJSModule="undefined"!=typeof module&&module.exports&&"function"==typeof require,push=Array.prototype.push,slice=Array.prototype.slice,callId=0;if(!sinon&&commonJSModule&&(sinon=require("../sinon")),sinon){var vars="a,b,c,d,e,f,g,h,i,j,k,l",uuid=0,spyApi={reset:function(){if(this.called=!1,this.notCalled=!0,this.calledOnce=!1,this.calledTwice=!1,this.calledThrice=!1,this.callCount=0,this.firstCall=null,this.secondCall=null,this.thirdCall=null,this.lastCall=null,this.args=[],this.returnValues=[],this.thisValues=[],this.exceptions=[],this.callIds=[],this.fakes)for(var a=0;a<this.fakes.length;a++)this.fakes[a].reset()},create:function(a){var b;"function"!=typeof a?a=function(){}:b=sinon.functionName(a);var c=createProxy(a);return sinon.extend(c,spy),delete c.create,sinon.extend(c,a),c.reset(),c.prototype=a.prototype,c.displayName=b||"spy",c.toString=sinon.functionToString,c._create=sinon.spy.create,c.id="spy#"+uuid++,c},invoke:function(a,b,c){var d,e,f=matchingFake(this.fakes,c);incrementCallCount.call(this),push.call(this.thisValues,b),push.call(this.args,c),push.call(this.callIds,callId++),createCallProperties.call(this);try{e=f?f.invoke(a,b,c):(this.func||a).apply(b,c);var g=this.getCall(this.callCount-1);g.calledWithNew()&&"object"!=typeof e&&(e=b)}catch(h){d=h}if(push.call(this.exceptions,d),push.call(this.returnValues,e),createCallProperties.call(this),void 0!==d)throw d;return e},named:function(a){return this.displayName=a,this},getCall:function(a){return 0>a||a>=this.callCount?null:sinon.spyCall(this,this.thisValues[a],this.args[a],this.returnValues[a],this.exceptions[a],this.callIds[a])},getCalls:function(){var a,b=[];for(a=0;a<this.callCount;a++)b.push(this.getCall(a));return b},calledBefore:function(a){return this.called?a.called?this.callIds[0]<a.callIds[a.callIds.length-1]:!0:!1},calledAfter:function(a){return this.called&&a.called?this.callIds[this.callCount-1]>a.callIds[a.callCount-1]:!1},withArgs:function(){var a=slice.call(arguments);if(this.fakes){var b=matchingFake(this.fakes,a,!0);if(b)return b}else this.fakes=[];var c=this,d=this._create();d.matchingAguments=a,d.parent=this,push.call(this.fakes,d),d.withArgs=function(){return c.withArgs.apply(c,arguments)};for(var e=0;e<this.args.length;e++)d.matches(this.args[e])&&(incrementCallCount.call(d),push.call(d.thisValues,this.thisValues[e]),push.call(d.args,this.args[e]),push.call(d.returnValues,this.returnValues[e]),push.call(d.exceptions,this.exceptions[e]),push.call(d.callIds,this.callIds[e]));return createCallProperties.call(d),d},matches:function(a,b){var c=this.matchingAguments;return c.length<=a.length&&sinon.deepEqual(c,a.slice(0,c.length))?!b||c.length==a.length:void 0},printf:function(a){var b,c=this,d=slice.call(arguments,1);return(a||"").replace(/%(.)/g,function(a,e){return b=spyApi.formatters[e],"function"==typeof b?b.call(null,c,d):isNaN(parseInt(e,10))?"%"+e:sinon.format(d[e-1])})}};delegateToCalls("calledOn",!0),delegateToCalls("alwaysCalledOn",!1,"calledOn"),delegateToCalls("calledWith",!0),delegateToCalls("calledWithMatch",!0),delegateToCalls("alwaysCalledWith",!1,"calledWith"),delegateToCalls("alwaysCalledWithMatch",!1,"calledWithMatch"),delegateToCalls("calledWithExactly",!0),delegateToCalls("alwaysCalledWithExactly",!1,"calledWithExactly"),delegateToCalls("neverCalledWith",!1,"notCalledWith",function(){return!0}),delegateToCalls("neverCalledWithMatch",!1,"notCalledWithMatch",function(){return!0}),delegateToCalls("threw",!0),delegateToCalls("alwaysThrew",!1,"threw"),delegateToCalls("returned",!0),delegateToCalls("alwaysReturned",!1,"returned"),delegateToCalls("calledWithNew",!0),delegateToCalls("alwaysCalledWithNew",!1,"calledWithNew"),delegateToCalls("callArg",!1,"callArgWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")}),spyApi.callArgWith=spyApi.callArg,delegateToCalls("callArgOn",!1,"callArgOnWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")}),spyApi.callArgOnWith=spyApi.callArgOn,delegateToCalls("yield",!1,"yield",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),spyApi.invokeCallback=spyApi.yield,delegateToCalls("yieldOn",!1,"yieldOn",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),delegateToCalls("yieldTo",!1,"yieldTo",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),delegateToCalls("yieldToOn",!1,"yieldToOn",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),spyApi.formatters={c:function(a){return sinon.timesInWords(a.callCount)},n:function(a){return a.toString()},C:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c){var e=" "+a.getCall(c).toString();/\n/.test(b[c-1])&&(e="\n"+e),push.call(b,e)}return b.length>0?"\n"+b.join("\n"):""},t:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c)push.call(b,sinon.format(a.thisValues[c]));return b.join(", ")},"*":function(a,b){for(var c=[],d=0,e=b.length;e>d;++d)push.call(c,sinon.format(b[d]));return c.join(", ")}},sinon.extend(spy,spyApi),spy.spyCall=sinon.spyCall,sinon.spy=spy,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=spy}):commonJSModule&&(module.exports=spy)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],59:[function(a,b){"use strict";!function(c){function d(a,b,e){if(e&&"function"!=typeof e)throw new TypeError("Custom stub should be function");var f;if(f=e?c.spy&&c.spy.create?c.spy.create(e):e:d.create(),!a&&"undefined"==typeof b)return c.stub.create();if("undefined"==typeof b&&"object"==typeof a){for(var g in a)"function"==typeof a[g]&&d(a,g);return a}return c.wrapMethod(a,b,f)}function e(a){return a.defaultBehavior||f(a)||c.behavior.create(a)}function f(a){return a.parent&&g(a.parent)}function g(a){var b=a.behaviors[a.callCount-1];return b&&b.isPresent()?b:e(a)}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i=0;c.extend(d,function(){var a={create:function(){var a=function(){return g(a).invoke(this,arguments)};a.id="stub#"+i++;var b=a;return a=c.spy.create(a),a.func=b,c.extend(a,d),a._create=c.stub.create,a.displayName="stub",a.toString=c.functionToString,a.defaultBehavior=null,a.behaviors=[],a},resetBehavior:function(){var a;if(this.defaultBehavior=null,this.behaviors=[],delete this.returnValue,delete this.returnArgAt,this.returnThis=!1,this.fakes)for(a=0;a<this.fakes.length;a++)this.fakes[a].resetBehavior()},onCall:function(a){return this.behaviors[a]||(this.behaviors[a]=c.behavior.create(this)),this.behaviors[a]},onFirstCall:function(){return this.onCall(0)},onSecondCall:function(){return this.onCall(1)},onThirdCall:function(){return this.onCall(2)}};for(var b in c.behavior)c.behavior.hasOwnProperty(b)&&!a.hasOwnProperty(b)&&"create"!=b&&"withArgs"!=b&&"invoke"!=b&&(a[b]=function(a){return function(){return this.defaultBehavior=this.defaultBehavior||c.behavior.create(this),this.defaultBehavior[a].apply(this.defaultBehavior,arguments),this}}(b));return a}()),c.stub=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):h&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],60:[function(a,b){"use strict";!function(c){function d(a){function b(){var b=c.getConfig(c.config);b.injectInto=b.injectIntoThis&&this||b.injectInto;var d,e,f=c.sandbox.create(b),g=Array.prototype.slice.call(arguments).concat(f.args);try{e=a.apply(this,g)}catch(h){d=h}if("undefined"!=typeof d)throw f.restore(),d;return f.verifyAndRestore(),e}var d=typeof a;if("function"!=d)throw new TypeError("sinon.test needs to wrap a test function, got "+d);return a.length?function(){return b.apply(this,arguments)}:b}var e="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&e&&(c=a("../sinon")),c&&(d.config={injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},c.test=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):e&&(b.exports=d))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],61:[function(a,b){"use strict";!function(c){function d(a,b,c){return function(){b&&b.apply(this,arguments);var d,e;try{e=a.apply(this,arguments)}catch(f){d=f}if(c&&c.apply(this,arguments),d)throw d;return e}}function e(a,b){if(!a||"object"!=typeof a)throw new TypeError("sinon.testCase needs an object with test functions");b=b||"test";var e,f,g,h=new RegExp("^"+b),i={},j=a.setUp,k=a.tearDown;for(e in a)if(a.hasOwnProperty(e)){if(f=a[e],/^(setUp|tearDown)$/.test(e))continue;"function"==typeof f&&h.test(e)?(g=f,(j||k)&&(g=d(f,j,k)),i[e]=c.test(g)):i[e]=a[e]}return i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&f&&(c=a("../sinon")),c&&Object.prototype.hasOwnProperty&&(c.testCase=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],62:[function(require,module,exports){(function(global){"use strict";if("undefined"==typeof sinon)var sinon={};!function(global){function addTimer(a,b){if(0===a.length)throw new Error("Function requires at least 1 parameter");if("undefined"==typeof a[0])throw new Error("Callback must be provided to timer calls");var c=id++,d=a[1]||0;return this.timeouts||(this.timeouts={}),this.timeouts[c]={id:c,func:a[0],callAt:this.now+d,invokeArgs:Array.prototype.slice.call(a,2)},b===!0&&(this.timeouts[c].interval=d),addTimerReturnsObject?{id:c,ref:function(){},unref:function(){}}:c}function parseTime(a){if(!a)return 0;var b,c=a.split(":"),d=c.length,e=d,f=0;if(d>3||!/^(\d\d:){0,2}\d\d?$/.test(a))throw new Error("tick only understands numbers and 'h:m:s'");for(;e--;){if(b=parseInt(c[e],10),b>=60)throw new Error("Invalid time "+a);f+=b*Math.pow(60,d-e-1)}return 1e3*f}function createObject(a){var b;if(Object.create)b=Object.create(a);else{var c=function(){};c.prototype=a,b=new c}return b.Date.clock=b,b}function mirrorDateProperties(a,b){b.now?a.now=function(){return a.clock.now}:delete a.now,b.toSource?a.toSource=function(){return b.toSource()}:delete a.toSource,a.toString=function(){return b.toString()},a.prototype=b.prototype,a.parse=b.parse,a.UTC=b.UTC,a.prototype.toUTCString=b.prototype.toUTCString;for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function restore(){for(var a,b=0,c=this.methods.length;c>b;b++)if(a=this.methods[b],global[a].hadOwnProperty)global[a]=this["_"+a];else try{delete global[a]}catch(d){}this.methods=[]}function stubGlobal(a,b){if(b[a].hadOwnProperty=Object.prototype.hasOwnProperty.call(global,a),b["_"+a]=global[a],"Date"==a){var c=mirrorDateProperties(b[a],global[a]);global[a]=c}else{global[a]=function(){return b[a].apply(b,arguments)};for(var d in b[a])b[a].hasOwnProperty(d)&&(global[a][d]=b[a][d])}global[a].clock=b}var timeoutResult=setTimeout(function(){},0),addTimerReturnsObject="object"==typeof timeoutResult;clearTimeout(timeoutResult);var id=1;sinon.clock={now:0,create:function(a){var b=createObject(this);if("number"==typeof a&&(b.now=a),a&&"object"==typeof a)throw new TypeError("now should be milliseconds since UNIX epoch");return b},setTimeout:function(){return addTimer.call(this,arguments,!1)},clearTimeout:function(a){a&&(this.timeouts||(this.timeouts=[]),"object"==typeof a&&(a=a.id),a in this.timeouts&&delete this.timeouts[a])},setInterval:function(){return addTimer.call(this,arguments,!0)},clearInterval:function(a){this.clearTimeout(a)},setImmediate:function(a){var b=Array.prototype.slice.call(arguments,1);return addTimer.call(this,[a,0].concat(b),!1)},clearImmediate:function(a){this.clearTimeout(a)},tick:function(a){a="number"==typeof a?a:parseTime(a);for(var b,c=this.now,d=this.now+a,e=this.now,f=this.firstTimerInRange(c,d);f&&d>=c;){if(this.timeouts[f.id]){c=this.now=f.callAt;try{this.callTimer(f)}catch(g){b=b||g}}f=this.firstTimerInRange(e,d),e=c}if(this.now=d,b)throw b;return this.now},firstTimerInRange:function(a,b){var c,d,e=null;for(var f in this.timeouts)if(this.timeouts.hasOwnProperty(f)){if(this.timeouts[f].callAt<a||this.timeouts[f].callAt>b)continue;(null===e||this.timeouts[f].callAt<e)&&(d=this.timeouts[f],e=this.timeouts[f].callAt,c={func:this.timeouts[f].func,callAt:this.timeouts[f].callAt,interval:this.timeouts[f].interval,id:this.timeouts[f].id,invokeArgs:this.timeouts[f].invokeArgs})}return c||null},callTimer:function(timer){"number"==typeof timer.interval?this.timeouts[timer.id].callAt+=timer.interval:delete this.timeouts[timer.id];try{"function"==typeof timer.func?timer.func.apply(null,timer.invokeArgs):eval(timer.func)}catch(e){var exception=e}if(this.timeouts[timer.id]){if(exception)throw exception}else if(exception)throw exception},reset:function(){this.timeouts={}},Date:function(){function a(c,d,e,f,g,h,i){switch(arguments.length){case 0:return new b(a.clock.now);case 1:return new b(c);case 2:return new b(c,d);case 3:return new b(c,d,e);case 4:return new b(c,d,e,f);case 5:return new b(c,d,e,f,g);case 6:return new b(c,d,e,f,g,h);default:return new b(c,d,e,f,g,h,i)}}var b=Date;return mirrorDateProperties(a,b)}()};var methods=["Date","setTimeout","setInterval","clearTimeout","clearInterval"];"undefined"!=typeof global.setImmediate&&methods.push("setImmediate"),"undefined"!=typeof global.clearImmediate&&methods.push("clearImmediate"),sinon.useFakeTimers=function(a){var b=sinon.clock.create(a);b.restore=restore,b.methods=Array.prototype.slice.call(arguments,"number"==typeof a?1:0),0===b.methods.length&&(b.methods=methods);for(var c=0,d=b.methods.length;d>c;c++)stubGlobal(b.methods[c],b);return b}}("undefined"!=typeof global&&"function"!=typeof global?global:this),sinon.timers={setTimeout:setTimeout,clearTimeout:clearTimeout,setImmediate:"undefined"!=typeof setImmediate?setImmediate:void 0,clearImmediate:"undefined"!=typeof clearImmediate?clearImmediate:void 0,setInterval:setInterval,clearInterval:clearInterval,Date:Date},"undefined"!=typeof module&&module.exports&&(module.exports=sinon)
|
||
}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],63:[function(a,b){(function(c){("function"==typeof define&&define.amd&&function(a){define("formatio",["samsam"],a)}||"object"==typeof b&&function(c){b.exports=c(a("samsam"))}||function(a){this.formatio=a(this.samsam)})(function(a){"use strict";function b(a){if(!a)return"";if(a.displayName)return a.displayName;if(a.name)return a.name;var b=a.toString().match(/function\s+([^\(]+)/m);return b&&b[1]||""}function d(a,c){var d,e,f=b(c&&c.constructor),g=a.excludeConstructors||h.excludeConstructors||[];for(d=0,e=g.length;e>d;++d){if("string"==typeof g[d]&&g[d]===f)return"";if(g[d].test&&g[d].test(f))return""}return f}function e(a,b){if("object"!=typeof a)return!1;var c,d;for(c=0,d=b.length;d>c;++c)if(b[c]===a)return!0;return!1}function f(b,c,d,g){if("string"==typeof c){var h=b.quoteStrings,j="boolean"!=typeof h||h;return d||j?'"'+c+'"':c}if("function"==typeof c&&!(c instanceof RegExp))return f.func(c);if(d=d||[],e(c,d))return"[Circular]";if("[object Array]"===Object.prototype.toString.call(c))return f.array.call(b,c,d);if(!c)return String(1/c===-1/0?"-0":c);if(a.isElement(c))return f.element(c);if("function"==typeof c.toString&&c.toString!==Object.prototype.toString)return c.toString();var k,l;for(k=0,l=i.length;l>k;k++)if(c===i[k].object)return i[k].value;return f.object.call(b,c,d,g)}function g(a){for(var b in a)this[b]=a[b]}var h={excludeConstructors:["Object",/^.$/],quoteStrings:!0},i=(Object.prototype.hasOwnProperty,[]);return"undefined"!=typeof c&&i.push({object:c,value:"[object global]"}),"undefined"!=typeof document&&i.push({object:document,value:"[object HTMLDocument]"}),"undefined"!=typeof window&&i.push({object:window,value:"[object Window]"}),f.func=function(a){return"function "+b(a)+"() {}"},f.array=function(a,b){b=b||[],b.push(a);var c,d,e=[];for(c=0,d=a.length;d>c;++c)e.push(f(this,a[c],b));return"["+e.join(", ")+"]"},f.object=function(b,c,g){c=c||[],c.push(b),g=g||0;var h,i,j,k,l,m=[],n=a.keys(b).sort(),o=3;for(k=0,l=n.length;l>k;++k)h=n[k],j=b[h],i=e(j,c)?"[Circular]":f(this,j,c,g+2),i=(/\s/.test(h)?'"'+h+'"':h)+": "+i,o+=i.length,m.push(i);var p=d(this,b),q=p?"["+p+"] ":"",r="";for(k=0,l=g;l>k;++k)r+=" ";return o+g>80?q+"{\n "+r+m.join(",\n "+r)+"\n"+r+"}":q+"{ "+m.join(", ")+" }"},f.element=function(a){var b,c,d,e,f,g=a.tagName.toLowerCase(),h=a.attributes,i=[];for(d=0,e=h.length;e>d;++d)b=h.item(d),c=b.nodeName.toLowerCase().replace("html:",""),f=b.nodeValue,("contenteditable"!==c||"inherit"!==f)&&f&&i.push(c+'="'+f+'"');var j="<"+g+(i.length>0?" ":""),k=a.innerHTML;k.length>20&&(k=k.substr(0,20)+"[...]");var l=j+i.join(" ")+">"+k+"</"+g+">";return l.replace(/ contentEditable="inherit"/,"")},g.prototype={functionName:b,configure:function(a){return new g(a)},constructorName:function(a){return d(this,a)},ascii:function(a,b,c){return f(this,a,b,c)}},g.prototype})}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{samsam:64}],64:[function(a,b){("function"==typeof define&&define.amd&&function(a){define("samsam",a)}||"object"==typeof b&&function(a){b.exports=a()}||function(a){this.samsam=a()})(function(){function a(a){var b=a;return"number"==typeof a&&a!==b}function b(a){return l.toString.call(a).split(/[ \]]/)[1]}function c(a){if("Arguments"===b(a))return!0;if("object"!=typeof a||"number"!=typeof a.length||"Array"===b(a))return!1;if("function"==typeof a.callee)return!0;try{a[a.length]=6,delete a[a.length]}catch(c){return!0}return!1}function d(a){if(!a||1!==a.nodeType||!m)return!1;try{a.appendChild(m),a.removeChild(m)}catch(b){return!1}return!0}function e(a){var b,c=[];for(b in a)l.hasOwnProperty.call(a,b)&&c.push(b);return c}function f(a){return"function"==typeof a.getTime&&a.getTime()==a.valueOf()}function g(a){return 0===a&&1/a===-1/0}function h(b,c){return b===c||a(b)&&a(c)?0!==b||g(b)===g(c):void 0}function i(g,i){function j(a){return"object"!=typeof a||null===a||a instanceof Boolean||a instanceof Date||a instanceof Number||a instanceof RegExp||a instanceof String?!1:!0}function k(a,b){var c;for(c=0;c<a.length;c++)if(a[c]===b)return c;return-1}var m=[],n=[],o=[],p=[],q={};return function r(g,i,s,t){var u=typeof g,v=typeof i;if(g===i||a(g)||a(i)||null==g||null==i||"object"!==u||"object"!==v)return h(g,i);if(d(g)||d(i))return!1;var w=f(g),x=f(i);if(!(!w&&!x||w&&x&&g.getTime()===i.getTime()))return!1;if(g instanceof RegExp&&i instanceof RegExp&&g.toString()!==i.toString())return!1;var y=b(g),z=b(i),A=e(g),B=e(i);if(c(g)||c(i)){if(g.length!==i.length)return!1}else if(u!==v||y!==z||A.length!==B.length)return!1;var C,D,E,F,G,H,I,J,K,L,M;for(D=0,E=A.length;E>D;D++){if(C=A[D],!l.hasOwnProperty.call(i,C))return!1;if(F=g[C],G=i[C],H=j(F),I=j(G),J=H?k(m,F):-1,K=I?k(n,G):-1,L=-1!==J?o[J]:s+"["+JSON.stringify(C)+"]",M=-1!==K?p[K]:t+"["+JSON.stringify(C)+"]",q[L+M])return!0;if(-1===J&&H&&(m.push(F),o.push(L)),-1===K&&I&&(n.push(G),p.push(M)),H&&I&&(q[L+M]=!0),!r(F,G,L,M))return!1}return!0}(g,i,"$1","$2")}function j(a,b){if(0===b.length)return!0;var c,d,e,f;for(c=0,d=a.length;d>c;++c)if(k(a[c],b[0])){for(e=0,f=b.length;f>e;++e)if(!k(a[c+e],b[e]))return!1;return!0}return!1}var k,l=Object.prototype,m="undefined"!=typeof document&&document.createElement("div");return k=function n(a,c){if(c&&"function"==typeof c.test)return c.test(a);if("function"==typeof c)return c(a)===!0;if("string"==typeof c){c=c.toLowerCase();var d="string"==typeof a||!!a;return d&&String(a).toLowerCase().indexOf(c)>=0}if("number"==typeof c)return c===a;if("boolean"==typeof c)return c===a;if("Array"===b(a)&&"Array"===b(c))return j(a,c);if(c&&"object"==typeof c){var e;for(e in c){var f=a[e];if("undefined"==typeof f&&"function"==typeof a.getAttribute&&(f=a.getAttribute(e)),"undefined"==typeof f||!n(f,c[e]))return!1}return!0}throw new Error("Matcher was not a string, a number, a function, a boolean or an object")},{isArguments:c,isElement:d,isDate:f,isNegZero:g,identical:h,deepEqual:i,match:k,keys:e}})},{}],65:[function(a,b,c){(function(){var a=this,d=a._,e={},f=Array.prototype,g=Object.prototype,h=Function.prototype,i=f.push,j=f.slice,k=f.concat,l=g.toString,m=g.hasOwnProperty,n=f.forEach,o=f.map,p=f.reduce,q=f.reduceRight,r=f.filter,s=f.every,t=f.some,u=f.indexOf,v=f.lastIndexOf,w=Array.isArray,x=Object.keys,y=h.bind,z=function(a){return a instanceof z?a:this instanceof z?void(this._wrapped=a):new z(a)};"undefined"!=typeof c?("undefined"!=typeof b&&b.exports&&(c=b.exports=z),c._=z):a._=z,z.VERSION="1.6.0";var A=z.each=z.forEach=function(a,b,c){if(null==a)return a;if(n&&a.forEach===n)a.forEach(b,c);else if(a.length===+a.length){for(var d=0,f=a.length;f>d;d++)if(b.call(c,a[d],d,a)===e)return}else for(var g=z.keys(a),d=0,f=g.length;f>d;d++)if(b.call(c,a[g[d]],g[d],a)===e)return;return a};z.map=z.collect=function(a,b,c){var d=[];return null==a?d:o&&a.map===o?a.map(b,c):(A(a,function(a,e,f){d.push(b.call(c,a,e,f))}),d)};var B="Reduce of empty array with no initial value";z.reduce=z.foldl=z.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),p&&a.reduce===p)return d&&(b=z.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(A(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(B);return c},z.reduceRight=z.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),q&&a.reduceRight===q)return d&&(b=z.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=z.keys(a);f=g.length}if(A(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(B);return c},z.find=z.detect=function(a,b,c){var d;return C(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},z.filter=z.select=function(a,b,c){var d=[];return null==a?d:r&&a.filter===r?a.filter(b,c):(A(a,function(a,e,f){b.call(c,a,e,f)&&d.push(a)}),d)},z.reject=function(a,b,c){return z.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},z.every=z.all=function(a,b,c){b||(b=z.identity);var d=!0;return null==a?d:s&&a.every===s?a.every(b,c):(A(a,function(a,f,g){return(d=d&&b.call(c,a,f,g))?void 0:e}),!!d)};var C=z.some=z.any=function(a,b,c){b||(b=z.identity);var d=!1;return null==a?d:t&&a.some===t?a.some(b,c):(A(a,function(a,f,g){return d||(d=b.call(c,a,f,g))?e:void 0}),!!d)};z.contains=z.include=function(a,b){return null==a?!1:u&&a.indexOf===u?-1!=a.indexOf(b):C(a,function(a){return a===b})},z.invoke=function(a,b){var c=j.call(arguments,2),d=z.isFunction(b);return z.map(a,function(a){return(d?b:a[b]).apply(a,c)})},z.pluck=function(a,b){return z.map(a,z.property(b))},z.where=function(a,b){return z.filter(a,z.matches(b))},z.findWhere=function(a,b){return z.find(a,z.matches(b))},z.max=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);var d=-1/0,e=-1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;h>e&&(d=a,e=h)}),d},z.min=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);var d=1/0,e=1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;e>h&&(d=a,e=h)}),d},z.shuffle=function(a){var b,c=0,d=[];return A(a,function(a){b=z.random(c++),d[c-1]=d[b],d[b]=a}),d},z.sample=function(a,b,c){return null==b||c?(a.length!==+a.length&&(a=z.values(a)),a[z.random(a.length-1)]):z.shuffle(a).slice(0,Math.max(0,b))};var D=function(a){return null==a?z.identity:z.isFunction(a)?a:z.property(a)};z.sortBy=function(a,b,c){return b=D(b),z.pluck(z.map(a,function(a,d,e){return{value:a,index:d,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index-b.index}),"value")};var E=function(a){return function(b,c,d){var e={};return c=D(c),A(b,function(f,g){var h=c.call(d,f,g,b);a(e,h,f)}),e}};z.groupBy=E(function(a,b,c){z.has(a,b)?a[b].push(c):a[b]=[c]}),z.indexBy=E(function(a,b,c){a[b]=c}),z.countBy=E(function(a,b){z.has(a,b)?a[b]++:a[b]=1}),z.sortedIndex=function(a,b,c,d){c=D(c);for(var e=c.call(d,b),f=0,g=a.length;g>f;){var h=f+g>>>1;c.call(d,a[h])<e?f=h+1:g=h}return f},z.toArray=function(a){return a?z.isArray(a)?j.call(a):a.length===+a.length?z.map(a,z.identity):z.values(a):[]},z.size=function(a){return null==a?0:a.length===+a.length?a.length:z.keys(a).length},z.first=z.head=z.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:0>b?[]:j.call(a,0,b)},z.initial=function(a,b,c){return j.call(a,0,a.length-(null==b||c?1:b))},z.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:j.call(a,Math.max(a.length-b,0))},z.rest=z.tail=z.drop=function(a,b,c){return j.call(a,null==b||c?1:b)},z.compact=function(a){return z.filter(a,z.identity)};var F=function(a,b,c){return b&&z.every(a,z.isArray)?k.apply(c,a):(A(a,function(a){z.isArray(a)||z.isArguments(a)?b?i.apply(c,a):F(a,b,c):c.push(a)}),c)};z.flatten=function(a,b){return F(a,b,[])},z.without=function(a){return z.difference(a,j.call(arguments,1))},z.partition=function(a,b){var c=[],d=[];return A(a,function(a){(b(a)?c:d).push(a)}),[c,d]},z.uniq=z.unique=function(a,b,c,d){z.isFunction(b)&&(d=c,c=b,b=!1);var e=c?z.map(a,c,d):a,f=[],g=[];return A(e,function(c,d){(b?d&&g[g.length-1]===c:z.contains(g,c))||(g.push(c),f.push(a[d]))}),f},z.union=function(){return z.uniq(z.flatten(arguments,!0))},z.intersection=function(a){var b=j.call(arguments,1);return z.filter(z.uniq(a),function(a){return z.every(b,function(b){return z.contains(b,a)})})},z.difference=function(a){var b=k.apply(f,j.call(arguments,1));return z.filter(a,function(a){return!z.contains(b,a)})},z.zip=function(){for(var a=z.max(z.pluck(arguments,"length").concat(0)),b=new Array(a),c=0;a>c;c++)b[c]=z.pluck(arguments,""+c);return b},z.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},z.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=z.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(u&&a.indexOf===u)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},z.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(v&&a.lastIndexOf===v)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},z.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);d>e;)f[e++]=a,a+=c;return f};var G=function(){};z.bind=function(a,b){var c,d;if(y&&a.bind===y)return y.apply(a,j.call(arguments,1));if(!z.isFunction(a))throw new TypeError;return c=j.call(arguments,2),d=function(){if(!(this instanceof d))return a.apply(b,c.concat(j.call(arguments)));G.prototype=a.prototype;var e=new G;G.prototype=null;var f=a.apply(e,c.concat(j.call(arguments)));return Object(f)===f?f:e}},z.partial=function(a){var b=j.call(arguments,1);return function(){for(var c=0,d=b.slice(),e=0,f=d.length;f>e;e++)d[e]===z&&(d[e]=arguments[c++]);for(;c<arguments.length;)d.push(arguments[c++]);return a.apply(this,d)}},z.bindAll=function(a){var b=j.call(arguments,1);if(0===b.length)throw new Error("bindAll must be passed function names");return A(b,function(b){a[b]=z.bind(a[b],a)}),a},z.memoize=function(a,b){var c={};return b||(b=z.identity),function(){var d=b.apply(this,arguments);return z.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},z.delay=function(a,b){var c=j.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},z.defer=function(a){return z.delay.apply(z,[a,1].concat(j.call(arguments,1)))},z.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:z.now(),g=null,f=a.apply(d,e),d=e=null};return function(){var j=z.now();h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k?(clearTimeout(g),g=null,h=j,f=a.apply(d,e),d=e=null):g||c.trailing===!1||(g=setTimeout(i,k)),f}},z.debounce=function(a,b,c){var d,e,f,g,h,i=function(){var j=z.now()-g;b>j?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),f=e=null))};return function(){f=this,e=arguments,g=z.now();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}},z.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},z.wrap=function(a,b){return z.partial(b,a)},z.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},z.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},z.keys=function(a){if(!z.isObject(a))return[];if(x)return x(a);var b=[];for(var c in a)z.has(a,c)&&b.push(c);return b},z.values=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},z.pairs=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},z.invert=function(a){for(var b={},c=z.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},z.functions=z.methods=function(a){var b=[];for(var c in a)z.isFunction(a[c])&&b.push(c);return b.sort()},z.extend=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},z.pick=function(a){var b={},c=k.apply(f,j.call(arguments,1));return A(c,function(c){c in a&&(b[c]=a[c])}),b},z.omit=function(a){var b={},c=k.apply(f,j.call(arguments,1));for(var d in a)z.contains(c,d)||(b[d]=a[d]);return b},z.defaults=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)void 0===a[c]&&(a[c]=b[c])}),a},z.clone=function(a){return z.isObject(a)?z.isArray(a)?a.slice():z.extend({},a):a},z.tap=function(a,b){return b(a),a};var H=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof z&&(a=a._wrapped),b instanceof z&&(b=b._wrapped);var e=l.call(a);if(e!=l.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;var g=a.constructor,h=b.constructor;if(g!==h&&!(z.isFunction(g)&&g instanceof g&&z.isFunction(h)&&h instanceof h)&&"constructor"in a&&"constructor"in b)return!1;c.push(a),d.push(b);var i=0,j=!0;if("[object Array]"==e){if(i=a.length,j=i==b.length)for(;i--&&(j=H(a[i],b[i],c,d)););}else{for(var k in a)if(z.has(a,k)&&(i++,!(j=z.has(b,k)&&H(a[k],b[k],c,d))))break;if(j){for(k in b)if(z.has(b,k)&&!i--)break;j=!i}}return c.pop(),d.pop(),j};z.isEqual=function(a,b){return H(a,b,[],[])},z.isEmpty=function(a){if(null==a)return!0;if(z.isArray(a)||z.isString(a))return 0===a.length;for(var b in a)if(z.has(a,b))return!1;return!0},z.isElement=function(a){return!(!a||1!==a.nodeType)},z.isArray=w||function(a){return"[object Array]"==l.call(a)},z.isObject=function(a){return a===Object(a)},A(["Arguments","Function","String","Number","Date","RegExp"],function(a){z["is"+a]=function(b){return l.call(b)=="[object "+a+"]"}}),z.isArguments(arguments)||(z.isArguments=function(a){return!(!a||!z.has(a,"callee"))}),"function"!=typeof/./&&(z.isFunction=function(a){return"function"==typeof a}),z.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},z.isNaN=function(a){return z.isNumber(a)&&a!=+a},z.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==l.call(a)},z.isNull=function(a){return null===a},z.isUndefined=function(a){return void 0===a},z.has=function(a,b){return m.call(a,b)},z.noConflict=function(){return a._=d,this},z.identity=function(a){return a},z.constant=function(a){return function(){return a}},z.property=function(a){return function(b){return b[a]}},z.matches=function(a){return function(b){if(b===a)return!0;for(var c in a)if(a[c]!==b[c])return!1;return!0}},z.times=function(a,b,c){for(var d=Array(Math.max(0,a)),e=0;a>e;e++)d[e]=b.call(c,e);return d},z.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))},z.now=Date.now||function(){return(new Date).getTime()};var I={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};I.unescape=z.invert(I.escape);var J={escape:new RegExp("["+z.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+z.keys(I.unescape).join("|")+")","g")};z.each(["escape","unescape"],function(a){z[a]=function(b){return null==b?"":(""+b).replace(J[a],function(b){return I[a][b]})}}),z.result=function(a,b){if(null==a)return void 0;var c=a[b];return z.isFunction(c)?c.call(a):c},z.mixin=function(a){A(z.functions(a),function(b){var c=z[b]=a[b];z.prototype[b]=function(){var a=[this._wrapped];return i.apply(a,arguments),O.call(this,c.apply(z,a))}})};var K=0;z.uniqueId=function(a){var b=++K+"";return a?a+b:b},z.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var L=/(.)^/,M={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},N=/\\|'|\r|\n|\t|\u2028|\u2029/g;z.template=function(a,b,c){var d;c=z.defaults({},c,z.templateSettings);var e=new RegExp([(c.escape||L).source,(c.interpolate||L).source,(c.evaluate||L).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(N,function(a){return"\\"+M[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=new Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,z);var i=function(a){return d.call(this,a,z)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},z.chain=function(a){return z(a).chain()};var O=function(a){return this._chain?z(a).chain():a};z.mixin(z),A(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=f[a];z.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],O.call(this,c)}}),A(["concat","join","slice"],function(a){var b=f[a];z.prototype[a]=function(){return O.call(this,b.apply(this._wrapped,arguments))}}),z.extend(z.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return z})}).call(this)},{}],66:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:10,sinon:50,"sinon-chai":49,underscore:65}],67:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/TextYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/TextYatta.coffee":4,chai:10,sinon:50,"sinon-chai":49,underscore:65}],68:[function(a){var b,c,d,e,f,g,h,i,j,k=function(a,b){return function(){return a.apply(b,arguments)}};e=a("chai"),f=e.expect,g=e.should(),h=a("sinon"),i=a("sinon-chai"),j=a("underscore"),e.use(i),d=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee"),c=function(){function a(){this.applyRandomOp=k(this.applyRandomOp,this),this.generateRandomOp=k(this.generateRandomOp,this),this.generateDeleteOp=k(this.generateDeleteOp,this),this.generateReplaceOp=k(this.generateReplaceOp,this),this.generateInsertOp=k(this.generateInsertOp,this),this.number_of_test_cases_multiplier=1,this.repeat_this=10*this.number_of_test_cases_multiplier,this.doSomething_amount=200*this.number_of_test_cases_multiplier,this.number_of_engines=12+this.number_of_test_cases_multiplier-1,this.time=0,this.ops=0,this.time_now=0,this.reinitialize()}return a.prototype.reinitialize=function(){var a,c,e,f;for(this.users=[],this.Connector=b(this.users),this.users.push(new d(0,this.Connector)),this.users[0].val("name","initial"),f=[],a=c=1,e=this.number_of_engines;e>=1?e>c:c>e;a=e>=1?++c:--c)f.push(this.users.push(new d(a,this.Connector)));return f},a.prototype.getSomeUser=function(){var a;return a=j.random(0,this.users.length-1),this.users[a]},a.prototype.getRandomText=function(){var a,b,c,d;return a="abcdefghijklmnopqrstuvwxyz",b=j.random(0,10),c=a[j.random(0,a.length-1)],d="",j(b).times(function(){return d+=c}),d},a.prototype.generateInsertOp=function(a){var b;return b=j.random(0,this.users[a].val("name").val().length-1),this.users[a].val("name").insertText(b,this.getRandomText()),null},a.prototype.generateReplaceOp=function(a){return this.users[a].val("name").replaceText(this.getRandomText()),null},a.prototype.generateDeleteOp=function(a){var b,c,d;return void(this.users[a].val("name").val().length>0&&(d=j.random(0,this.users[a].val("name").val().length-1),b=1,c=this.users[a].val("name").deleteText(d,b)))},a.prototype.generateRandomOp=function(a){var b,c,d;return d=[this.generateDeleteOp,this.generateInsertOp,this.generateReplaceOp],b=j.random(d.length-1),c=d[b](a)},a.prototype.applyRandomOp=function(a){var b;return b=this.users[a],b.getConnector().flushOneRandom()},a.prototype.doSomething=function(){var a,b,c;return c=j.random(this.number_of_engines-1),b=[this.applyRandomOp,this.generateRandomOp],a=j.random(b.length-1),b[a](c)},a.prototype.flushAll=function(){var a,b,c,d,e,f;for(e=this.users,f=[],b=c=0,d=e.length;d>c;b=++c)a=e[b],f.push(a.getConnector().flushAll());return f},a.prototype.compareAll=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;for(this.flushAll(),this.time+=(new Date).getTime()-this.time_now,d=0,b=i=0,m=this.users.length;m>=0?m>i:i>m;b=m>=0?++i:--i)d+=this.users[b].getConnector().getOpsInExecutionOrder().length;for(this.ops+=d*this.users.length,f=Math.floor(this.ops/this.time),null!=a&&console.log(""+a+"/"+this.repeat_this+": Every collaborator ("+this.users.length+") applied "+this.number_of_created_operations+" ops in a different order."+(" Over all we consumed "+this.ops+" operations in "+this.time/1e3+" seconds ("+f+" ops/msek).")),o=[],b=j=0,n=this.users.length-1;n>=0?n>j:j>n;b=n>=0?++j:--j)if(this.users[b].val("name").val()!==this.users[b+1].val("name").val()){for(g=function(a,b){var c,d,e,f,g,h,i,j;for(e=this.users[a].getConnector().getOpsInExecutionOrder(),g=0,i=e.length;i>g;g++)f=e[g],console.log(JSON.stringify(f));for(console.log(""),f="ops = [",c=h=0,j=e.length;j>h;c=++h)d=e[c],0!==c&&(f+=", "),f+="op"+c;return f+="]",console.log(f),console.log("@users[@last_user].ot.applyOps ops"),console.log("expect(@users[@last_user].ot.val('name')).to.equal(\""+users[b].val("name")+'")'),e},console.log(""),console.log("Found an OT Puzzle!"),console.log("OT states:"),c=k=0,l=users.length;l>k;c=++k)h=users[c],console.log("OT"+c+": "+h.val("name"));console.log("\nOT execution order ("+b+","+(b+1)+"):"),g(b,b+1),console.log(""),e=g(b+1,b),o.push(console.log(""))}else o.push(void 0);return o},a.prototype.run=function(){var a,b,c,d,e,f,g;for(console.log(""),g=[],b=c=1,e=this.repeat_this;e>=1?e>=c:c>=e;b=e>=1?++c:--c){for(this.time_now=(new Date).getTime(),a=d=1,f=this.doSomething_amount;f>=1?f>=d:d>=f;a=f>=1?++d:--d)this.doSomething();this.compareAll(b),g.push(this.reinitialize())}return g},a}(),describe("JsonYatta",function(){return beforeEach(function(a){return this.yTest=new c,a()}),it("has a JsonWrapper",function(){var a,b;return b=this.yTest.getSomeUser().root_element,b.val("x","dtrn","immutable"),b.val("set",{x:"x"},"immutable"),a=b.value,a.x,a.set={y:""},a.x,a.set,a.set.x,f(a.x).to.equal("dtrn"),f(a.set.x).to.equal("x")}),it("can handle creaton of complex json",function(){return this.yTest.getSomeUser().val("x",{a:"b"}),this.yTest.getSomeUser().val("a",{a:{q:"dtrndtrtdrntdrnrtdnrtdnrtdnrtdnrdnrdt"}}),this.yTest.getSomeUser().val("b",{a:{}}),this.yTest.getSomeUser().val("c",{a:"c"}),this.yTest.getSomeUser().val("c",{a:"b"}),this.yTest.compareAll(),console.log(this.yTest.getSomeUser().value.a.a.q)}),it("handles some immutable tests",function(){return this.yTest.getSomeUser().val("string","text","immutable"),this.yTest.getSomeUser().val("number",4,"immutable"),this.yTest.getSomeUser().val("object",{q:"rr"},"immutable"),this.yTest.compareAll(),f(this.yTest.getSomeUser().val("string")).to.equal("text"),f(this.yTest.getSomeUser().val("number")).to.equal(4),f(this.yTest.getSomeUser().val("object").val("q")).to.equal("rr")}),it("can handle many engines, many operations, concurrently (random)",function(){return this.yTest.run()})})},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:10,sinon:50,"sinon-chai":49,underscore:65}]},{},[66,67,68]),!function h(a,b,c){function d(f,g){if(!b[f]){if(!a[f]){var i="function"==typeof require&&require;if(!g&&i)return i(f,!0);if(e)return e(f,!0);throw new Error("Cannot find module '"+f+"'")}var j=b[f]={exports:{}};a[f][0].call(j.exports,function(b){var c=a[f][1][b];return d(c?c:b)},j,j.exports,h,a,b,c)}return b[f].exports}for(var e="function"==typeof require&&require,f=0;f<c.length;f++)d(c[f]);return d}({1:[function(a,b){var c;c=a("underscore"),b.exports=function(a){var b;return b=function(){function b(b,c,d){var e,f;this.engine=b,this.HB=c,this.execution_listener=d,f=function(a){return function(b){return a.send(b)}}(this),this.execution_listener.push(f),this.applied_operations=[],e=function(a){return function(b){return a.applied_operations.push(b)}}(this),this.execution_listener.push(e),0!==(null!=a?a.length:void 0)&&this.engine.applyOps(a[0].getHistoryBuffer()._encode()),this.unexecuted={}}return b.prototype.getOpsInExecutionOrder=function(){return this.applied_operations},b.prototype.getRootElement=function(){return a.length>0?a[0].getRootElement().getUid():void 0},b.prototype.send=function(b){var c,d,e,f;if(b.uid.creator===this.HB.getUserId()&&"string"!=typeof b.uid.op_number){for(f=[],d=0,e=a.length;e>d;d++)c=a[d],f.push(c.getUserId()!==this.HB.getUserId()?c.getConnector().receive(b):void 0);return f}},b.prototype.receive=function(a){var b,c;return null==(b=this.unexecuted)[c=a.creator]&&(b[c]=[]),this.unexecuted[a.creator].push(a)},b.prototype.flushOne=function(a){var b;return(null!=(b=this.unexecuted[a])?b.length:void 0)>0?this.engine.applyOp(this.unexecuted[a].shift()):void 0},b.prototype.flushOneRandom=function(){return this.flushOne(c.random(0,a.length-1))},b.prototype.flushAll=function(){var a,b,c;c=this.unexecuted;for(a in c)b=c[a],this.engine.applyOps(b);return this.unexecuted={}},b.prototype.sync=function(){throw new Error("Can't use this a.t.m.")},b}()}},{underscore:65}],2:[function(a,b){var c;c=function(){function a(a,b){this.HB=a,this.parser=b,this.unprocessed_ops=[]}return a.prototype.parseOperation=function(a){var b;if(b=this.parser[a.type],null!=b)return b(a);throw new Error("You forgot to specify a parser for type "+a.type+". The message is "+JSON.stringify(a)+".")},a.prototype.applyOps=function(a){var b,c,d,e,f,g,h,i;for(c=[],d=0,g=a.length;g>d;d++)b=a[d],c.push(this.parseOperation(b));for(e=0,h=c.length;h>e;e++)b=c[e],this.HB.addOperation(b);for(f=0,i=c.length;i>f;f++)b=c[f],b.execute()||this.unprocessed_ops.push(b);return this.tryUnprocessed()},a.prototype.applyOp=function(a){var b;return b=this.parseOperation(a),this.HB.addOperation(b),b.execute()||this.unprocessed_ops.push(b),this.tryUnprocessed()},a.prototype.tryUnprocessed=function(){var a,b,c,d,e,f,g;for(g=[];;){for(a=this.unprocessed_ops.length,c=[],f=this.unprocessed_ops,d=0,e=f.length;e>d;d++)b=f[d],b.execute()||c.push(b);if(this.unprocessed_ops=c,this.unprocessed_ops.length===a)break;g.push(void 0)}return g},a}(),b.exports=c},{}],3:[function(a,b){var c,d,e,f;f=a("../Types/JsonTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),g=f(this.HB),this.engine=new c(this.HB,g.parser),this.connector=new b(this.engine,this.HB,g.execution_listener,this),h=this.connector.getRootElement(),null==h?(e=new g.types.JsonType(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=e):this.root_element=this.HB.getOperation(h)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.setMutableDefault=function(a){return this.root_element.setMutableDefault(a)},a.prototype.getUserId=function(){return this.HB.getUserId()},a.prototype.val=function(a,b,c){return this.root_element.val(a,b,c)},Object.defineProperty(a.prototype,"value",{get:function(){return this.root_element.value},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),a}(),"undefined"!=typeof window&&null!==window&&(window.JsonYatta=e),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/JsonTypes.coffee":7}],4:[function(a,b){var c,d,e,f;f=a("../Types/TextTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),h=f(this.HB),this.engine=new c(this.HB,h.parser),this.connector=new b(this.engine,this.HB,h.execution_listener),g=this.connector.getRootElement(),null==g?(e=new h.types.Word(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=this.HB.addOperation(new h.types.ReplaceManager(e,this.HB.getNextOperationIdentifier())).execute()):this.root_element=this.HB.getOperation(g)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.getUserId=function(){return this.HB.getUserId()
|
||
},a.prototype.val=function(){return this.root_element.val().val()},a.prototype.insertText=function(a,b){return this.root_element.val().insertText(a,b)},a.prototype.deleteText=function(a,b){return this.root_element.val().deleteText(a,b)},a.prototype.replaceText=function(a){return this.root_element.val().replaceText(a)},a}(),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/TextTypes.coffee":9}],5:[function(a,b){var c;c=function(){function a(a){this.user_id=a,this.operation_counter={},this.buffer={},this.change_listeners=[]}return a.prototype.getUserId=function(){return this.user_id},a.prototype.getOperationCounter=function(){var a,b,c,d;b={},d=this.operation_counter;for(c in d)a=d[c],b[c]=a;return b},a.prototype._encode=function(){var a,b,c,d,e,f;a=[],f=this.buffer;for(d in f){e=f[d];for(c in e)b=e[c],isNaN(parseInt(c))||a.push(b._encode())}return a},a.prototype.getNextOperationIdentifier=function(a){var b;return null==a&&(a=this.user_id),null==this.operation_counter[a]&&(this.operation_counter[a]=0),b={creator:a,op_number:this.operation_counter[a]},this.operation_counter[a]++,b},a.prototype.getOperation=function(a){var b;if(a instanceof Object)return null!=(b=this.buffer[a.creator])?b[a.op_number]:void 0;if(null!=a)throw new Error("This type of uid is not defined!")},a.prototype.addOperation=function(a){if(null==this.buffer[a.creator]&&(this.buffer[a.creator]={}),null==this.operation_counter[a.creator]&&(this.operation_counter[a.creator]=0),null!=this.buffer[a.creator][a.op_number])throw new Error("You must not overwrite operations!");return this.buffer[a.creator][a.op_number]=a,"number"==typeof a.op_number&&a.creator!==this.getUserId()&&this.operation_counter[a.creator]++,a},a}(),b.exports=c},{}],6:[function(a,b){var c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};b.exports=function(a){var b,c,e,f,g,h,i;return i={},h=[],g=function(){function b(b){null==b&&(b=a.getNextOperationIdentifier()),this.creator=b.creator,this.op_number=b.op_number}return b.prototype.getUid=function(){return{creator:this.creator,op_number:this.op_number}},b.prototype.execute=function(){var a,b,c;for(this.is_executed=!0,b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this},b.prototype.saveOperation=function(a,b){return null!=(null!=b?b.execute:void 0)?this[a]=b:null!=b?(null==this.unchecked&&(this.unchecked={}),this.unchecked[a]=b):void 0},b.prototype.validateSavedOperations=function(){var b,c,d,e,f,g;f={},e=this,g=this.unchecked;for(b in g)d=g[b],c=a.getOperation(d),c?this[b]=c:(f[b]=d,e=!1);return delete this.unchecked,e||(this.unchecked=f),e},b}(),b=function(a){function b(a,c){this.saveOperation("deletes",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype._encode=function(){return{type:"Delete",uid:this.getUid(),deletes:this.deletes.getUid()}},b.prototype.execute=function(){return this.validateSavedOperations()?(this.deletes.applyDelete(this),b.__super__.execute.apply(this,arguments),this):!1},b}(g),i.Delete=function(a){var c,d;return d=a.uid,c=a.deletes,new b(d,c)},f=function(a){function b(a,c,d,e){this.saveOperation("prev_cl",c),this.saveOperation("next_cl",d),null!=e?this.saveOperation("origin",e):this.saveOperation("origin",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype.applyDelete=function(a){return null==this.deleted_by&&(this.deleted_by=[]),this.deleted_by.push(a)},b.prototype.isDeleted=function(){var a;return(null!=(a=this.deleted_by)?a.length:void 0)>0},b.prototype.getDistanceToOrigin=function(){var a,b;for(a=0,b=this.prev_cl;this.origin!==b;){if(a++,this===this.prev_cl)throw new Error("this should not happen ;) ");b=b.prev_cl}return a},b.prototype.update_sl=function(){var a;return a=this.prev_cl,update("prev_cl","prev_sl"),update("next_cl","prev_sl")},b.prototype.execute=function(){var a,c,d,e,f;if(null!=this.is_executed)return this;if(this.validateSavedOperations()){if((null!=(e=this.prev_cl)?e.validateSavedOperations():void 0)&&(null!=(f=this.next_cl)?f.validateSavedOperations():void 0)&&this.prev_cl.next_cl!==this){for(a=0,d=this.prev_cl.next_cl,c=0;null==d&&(console.log(JSON.stringify(this.prev_cl.getUid())),console.log(JSON.stringify(this.next_cl.getUid()))),d!==this.next_cl;){if(d.getDistanceToOrigin()===c)d.creator<this.creator&&(this.prev_cl=d,a=c+1);else{if(!(d.getDistanceToOrigin()<c))break;c-a<=d.getDistanceToOrigin()&&(this.prev_cl=d,a=c+1)}c++,d=d.next_cl}this.next_cl=this.prev_cl.next_cl,this.prev_cl.next_cl=this,this.next_cl.prev_cl=this}return b.__super__.execute.apply(this,arguments),this}return!1},b}(g),e=function(a){function b(a,c,d,e,f){this.content=null!=c?c:"",b.__super__.constructor.call(this,a,d,e,f)}return d(b,a),b.prototype.val=function(){return this.content},b.prototype._encode=function(){var a;return a={type:"ImmutableObject",uid:this.getUid(),content:this.content},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(f),i.ImmutableObject=function(a){var b,c,d,f,g;return g=a.uid,b=a.content,f=a.prev,c=a.next,d=a.origin,new e(g,b,f,c,d)},c=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return d(b,a),b.prototype.execute=function(){var a,b,c;if(this.validateSavedOperations()){for(b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this}return!1},b.prototype._encode=function(){var a,b;return{type:"Delimiter",uid:this.getUid(),prev:null!=(a=this.prev_cl)?a.getUid():void 0,next:null!=(b=this.next_cl)?b.getUid():void 0}},b}(f),i.Delimiter=function(a){var b,d,e;return e=a.uid,d=a.prev,b=a.next,new c(e,d,b)},{types:{Delete:b,Insert:f,Delimiter:c,Operation:g,ImmutableObject:e},parser:i,execution_listener:h}}},{}],7:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./TextTypes.coffee"),b.exports=function(a){var b,d,f,g,h;return g=c(a),h=g.types,f=g.parser,d=function(a){var c;return new(c=function(){function a(c){var e,f,g,i;i=c.map,g=function(e,f){return Object.defineProperty(a.prototype,e,{get:function(){var a;return a=f.val(),a instanceof b?d(a):a instanceof h.ImmutableObject?a.val():a},set:function(a){var b,d,f,g;if(a.constructor==={}.constructor){f=c.val(e),g=[];for(b in a)d=a[b],g.push(f.val(b,d,"immutable"));return g}return c.val(e,a,"immutable")},enumerable:!0,configurable:!1})};for(e in i)f=i[e],g(e,f)}return a}())(a)},b=function(b){function c(a,b,d){var e,f;if(c.__super__.constructor.call(this,a),null!=b){if("object"!=typeof b)throw new Error("The initial value of JsonTypes must be of type Object! (current type: "+typeof b+")");for(e in b)f=b[e],this.val(e,f,d)}}return e(c,b),c.prototype.mutable_default=!0,c.prototype.setMutableDefault=function(a){if(a===!0||"mutable"===a)c.prototype.mutable_default=!0;else{if(a!==!1&&"immutable"!==a)throw new Error('Set mutable either "mutable" or "immutable"!');c.prototype.mutable_default=!1}return"OK"},c.prototype.val=function(b,d,e){var f,g,i,j,k;if("object"==typeof b){for(i in b)g=b[i],this.val(i,g,d);return this}if(null!=b&&null!=d){if(e=null!=e?e===!0||"mutable"===e?!0:!1:this.mutable_default,"function"==typeof d)return this;if(e&&"number"!=typeof d||d.constructor===Object){if("string"==typeof d)return k=a.addOperation(new h.Word(a.getNextOperationIdentifier(),d)).execute(),c.__super__.val.call(this,b,k);if(d.constructor===Object)return f=a.addOperation(new c(a.getNextOperationIdentifier(),d,e)).execute(),c.__super__.val.call(this,b,f);throw new Error("You must not set "+typeof d+"-types in collaborative Json-objects!")}return j=a.addOperation(new h.ImmutableObject(void 0,d)).execute(),c.__super__.val.call(this,b,j)}return c.__super__.val.call(this,b,d)},Object.defineProperty(c.prototype,"value",{get:function(){return d(this)},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),c.prototype._encode=function(){return{type:"JsonType",uid:this.getUid()}},c}(h.MapManager),f.JsonType=function(a){var c;return c=a.uid,new b(c)},h.JsonType=b,g}},{"./TextTypes.coffee":9}],8:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./BasicTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i,j,k;return i=c(a),k=i.types,j=i.parser,f=function(c){function d(a){this.map={},d.__super__.constructor.call(this,a)}return e(d,c),d.prototype.val=function(c,e){var f,g,h,i,j;if(null!=e)return null==this.map[c]&&a.addOperation(new b(a.getNextOperationIdentifier(),this,c)).execute(),this.map[c].replace(e),this;if(null!=c)return g=null!=(i=this.map[c])?i.val():void 0,g instanceof k.ImmutableObject?g.val():g;h={},j=this.map;for(c in j)f=j[c],g=f.val(),(g instanceof k.ImmutableObject||g instanceof d)&&(g=g.val()),h[c]=g;return h},d}(k.Operation),b=function(b){function c(a,b,d){this.name=d,this.saveOperation("map_manager",b),c.__super__.constructor.call(this,a)}return e(c,b),c.prototype.execute=function(){var b,d,e,f,h;return this.validateSavedOperations()?(h=this.map_manager.getUid(),h.op_number="_"+h.op_number+"_RM_"+this.name,null==a.getOperation(h)&&(e=this.map_manager.getUid(),e.op_number="_"+e.op_number+"_RM_"+this.name+"_beginning",f=this.map_manager.getUid(),f.op_number="_"+f.op_number+"_RM_"+this.name+"_end",b=a.addOperation(new k.Delimiter(e,void 0,f)),d=a.addOperation(new k.Delimiter(f,b,void 0)).execute(),b.execute(),this.map_manager.map[this.name]=a.addOperation(new g(void 0,h,b,d)).execute()),c.__super__.execute.apply(this,arguments)):!1},c.prototype._encode=function(){return{type:"AddName",uid:this.getUid(),map_manager:this.map_manager.getUid(),name:this.name}},c}(k.Operation),j.AddName=function(a){var c,d,e;return c=a.map_manager,e=a.uid,d=a.name,new b(e,c,d)},d=function(b){function c(b,d,e,f,g,h){null!=d&&null!=e?(this.saveOperation("beginning",d),this.saveOperation("end",e)):(this.beginning=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),void 0,void 0)),this.end=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),this.beginning,void 0)),this.beginning.next_cl=this.end,this.beginning.execute(),this.end.execute()),c.__super__.constructor.call(this,b,f,g,h)}return e(c,b),c.prototype.getLastOperation=function(){return this.end.prev_cl},c.prototype.getFirstOperation=function(){return this.beginning.next_cl},c.prototype.toArray=function(){var a,b;for(a=this.beginning.next_cl,b=[];a!==this.end;)b.push(a),a=a.next_cl;return b},c.prototype.getOperationByPosition=function(a){var b;if(b=this.beginning.next_cl,a>0)for(;b=b.next_cl,b.isDeleted()||(a-=1),0!==a;)if(b instanceof k.Delimiter)throw new Error("position parameter exceeded the length of the document!");return b},c}(k.Insert),g=function(b){function c(a,b,d,e,f,g,h){c.__super__.constructor.call(this,b,d,e,f,g,h),null!=a&&this.replace(a)}return e(c,b),c.prototype.replace=function(b){var c,d;return c=this.getLastOperation(),d=new h(b,this,a.getNextOperationIdentifier(),c,c.next_cl),a.addOperation(d).execute()},c.prototype.val=function(){var a;if(a=this.getLastOperation(),a instanceof k.Delimiter)throw new Error("dtrn");return a.val()},c.prototype._encode=function(){var a;return a={type:"ReplaceManager",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&null!=this.next_cl&&(a.prev=this.prev_cl.getUid(),a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},c}(d),j.ReplaceManager=function(a){var b,c,d,e,f,h,i;return c=a.content,i=a.uid,h=a.prev,e=a.next,f=a.origin,b=a.beginning,d=a.end,new g(c,i,b,d,h,e,f)},h=function(a){function b(a,c,d,e,f,g){if(this.saveOperation("content",a),this.saveOperation("parent",c),null==e||null==f||null==a)throw new Error("You must define content, prev, and next for Replaceable-types!");b.__super__.constructor.call(this,d,e,f,g)}return e(b,a),b.prototype.val=function(){return this.content},b.prototype.replace=function(a){return this.parent.replace(a)},b.prototype.execute=function(){var a;return this.validateSavedOperations()?("function"==typeof(a=this.content).setReplaceManager&&a.setReplaceManager(this.parent),b.__super__.execute.apply(this,arguments),this):!1},b.prototype._encode=function(){var a;return a={type:"Replaceable",content:this.content.getUid(),ReplaceManager:this.parent.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid(),uid:this.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(k.Insert),j.Replaceable=function(a){var b,c,d,e,f,g;return b=a.content,e=a.ReplaceManager,g=a.uid,f=a.prev,c=a.next,d=a.origin,new h(b,e,g,f,c,d)},k.ListManager=d,k.MapManager=f,k.ReplaceManager=g,k.Replaceable=h,i}},{"./BasicTypes.coffee":6}],9:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./StructuredTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i;return h=c(a),i=h.types,g=h.parser,b=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return e(b,a),b}(i.Delete),g.TextDelete=g.Delete,d=function(a){function b(a,c,d,e,f){if(this.content=a,null==d||null==e)throw new Error("You must define prev, and next for TextInsert-types!");b.__super__.constructor.call(this,c,d,e,f)}return e(b,a),b.prototype.getLength=function(){return this.isDeleted()?0:this.content.length},b.prototype.val=function(){return this.isDeleted()?"":this.content},b.prototype._encode=function(){var a;return a={type:"TextInsert",content:this.content,uid:this.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(i.Insert),g.TextInsert=function(a){var b,c,e,f,g;return b=a.content,g=a.uid,f=a.prev,c=a.next,e=a.origin,new d(b,g,f,c,e)},f=function(c){function f(a,b,c,d,e,g,h){f.__super__.constructor.call(this,a,c,d,e,g,h),null!=b&&this.insertText(0,b)}return e(f,c),f.prototype.insertText=function(b,c){var e,f,g,h,i,j;for(f=this.getOperationByPosition(b),j=[],h=0,i=c.length;i>h;h++)e=c[h],g=new d(e,a.getNextOperationIdentifier(),f.prev_cl,f),j.push(a.addOperation(g).execute());return j},f.prototype.deleteText=function(c,d){var e,f,g,h,j;for(g=this.getOperationByPosition(c),j=[],f=h=0;d>=0?d>h:h>d;f=d>=0?++h:--h){for(e=a.addOperation(new b(a.getNextOperationIdentifier(),g)).execute(),g=g.next_cl;g.isDeleted();){if(g instanceof i.Delimiter)throw new Error("You can't delete more than there is..");g=g.next_cl}j.push(e._encode())}return j},f.prototype.replaceText=function(b){var c;if(null!=this.replace_manager)return c=a.addOperation(new f(a.getNextOperationIdentifier())).execute(),c.insertText(0,b),this.replace_manager.replace(c);throw new Error("This type is currently not maintained by a ReplaceManager!")},f.prototype.val=function(){var a,b;return a=function(){var a,c,d,e;for(d=this.toArray(),e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(null!=b.val?b.val():"");return e}.call(this),a.join("")},f.prototype.setReplaceManager=function(a){return this.saveOperation("replace_manager",a),this.validateSavedOperations},f.prototype._encode=function(){var a;return a={type:"Word",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},f}(i.ListManager),g.Word=function(a){var b,c,d,e,g,h;return h=a.uid,b=a.beginning,c=a.end,g=a.prev,d=a.next,e=a.origin,new f(h,void 0,b,c,g,d,e)},i.TextInsert=d,i.TextDelete=b,i.Word=f,h}},{"./StructuredTypes.coffee":8}],10:[function(a,b){b.exports=a("./lib/chai")},{"./lib/chai":11}],11:[function(a,b,c){var d=[],c=b.exports={};c.version="1.9.1",c.AssertionError=a("assertion-error");var e=a("./chai/utils");c.use=function(a){return~d.indexOf(a)||(a(this,e),d.push(a)),this};var f=a("./chai/config");c.config=f;var g=a("./chai/assertion");c.use(g);var h=a("./chai/core/assertions");c.use(h);var i=a("./chai/interface/expect");c.use(i);var j=a("./chai/interface/should");c.use(j);var k=a("./chai/interface/assert");c.use(k)},{"./chai/assertion":12,"./chai/config":13,"./chai/core/assertions":14,"./chai/interface/assert":15,"./chai/interface/expect":16,"./chai/interface/should":17,"./chai/utils":28,"assertion-error":37}],12:[function(a,b){var c=a("./config");b.exports=function(a,b){function d(a,b,c){f(this,"ssfi",c||arguments.callee),f(this,"object",a),f(this,"message",b)}var e=a.AssertionError,f=b.flag;a.Assertion=d,Object.defineProperty(d,"includeStack",{get:function(){return console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack},set:function(a){console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack=a}}),Object.defineProperty(d,"showDiff",{get:function(){return console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff},set:function(a){console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff=a}}),d.addProperty=function(a,c){b.addProperty(this.prototype,a,c)},d.addMethod=function(a,c){b.addMethod(this.prototype,a,c)},d.addChainableMethod=function(a,c,d){b.addChainableMethod(this.prototype,a,c,d)},d.overwriteProperty=function(a,c){b.overwriteProperty(this.prototype,a,c)},d.overwriteMethod=function(a,c){b.overwriteMethod(this.prototype,a,c)},d.overwriteChainableMethod=function(a,c,d){b.overwriteChainableMethod(this.prototype,a,c,d)},d.prototype.assert=function(a,d,g,h,i,j){var k=b.test(this,arguments);if(!0!==j&&(j=!1),!0!==c.showDiff&&(j=!1),!k){var d=b.getMessage(this,arguments),l=b.getActual(this,arguments);throw new e(d,{actual:l,expected:h,showDiff:j},c.includeStack?this.assert:f(this,"ssfi"))}},Object.defineProperty(d.prototype,"_obj",{get:function(){return f(this,"object")},set:function(a){f(this,"object",a)}})}},{"./config":13}],13:[function(a,b){b.exports={includeStack:!1,showDiff:!0,truncateThreshold:40}},{}],14:[function(a,b){b.exports=function(a,b){function c(a,c){c&&u(this,"message",c),a=a.toLowerCase();var d=u(this,"object"),e=~["a","e","i","o","u"].indexOf(a.charAt(0))?"an ":"a ";this.assert(a===b.type(d),"expected #{this} to be "+e+a,"expected #{this} not to be "+e+a)}function d(){u(this,"contains",!0)}function e(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=!1;if("array"===b.type(d)&&"object"===b.type(a)){for(var f in d)if(b.eql(d[f],a)){e=!0;break}}else if("object"===b.type(a)){if(!u(this,"negate")){for(var g in a)new t(d).property(g,a[g]);return}var h={};for(var g in a)h[g]=d[g];e=b.eql(h,a)}else e=d&&~d.indexOf(a);this.assert(e,"expected #{this} to include "+b.inspect(a),"expected #{this} to not include "+b.inspect(a))}function f(){var a=u(this,"object"),b=Object.prototype.toString.call(a);this.assert("[object Arguments]"===b,"expected #{this} to be arguments but got "+b,"expected #{this} to not be arguments")}function g(a,b){b&&u(this,"message",b);var c=u(this,"object");return u(this,"deep")?this.eql(a):void this.assert(a===c,"expected #{this} to equal #{exp}","expected #{this} to not equal #{exp}",a,this._obj,!0)}function h(a,c){c&&u(this,"message",c),this.assert(b.eql(a,u(this,"object")),"expected #{this} to deeply equal #{exp}","expected #{this} to not deeply equal #{exp}",a,this._obj,!0)}function i(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>a,"expected #{this} to have a length above #{exp} but got #{act}","expected #{this} to not have a length above #{exp}",a,d)}else this.assert(c>a,"expected #{this} to be above "+a,"expected #{this} to be at most "+a)}function j(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>=a,"expected #{this} to have a length at least #{exp} but got #{act}","expected #{this} to have a length below #{exp}",a,d)}else this.assert(c>=a,"expected #{this} to be at least "+a,"expected #{this} to be below "+a)}function k(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(a>d,"expected #{this} to have a length below #{exp} but got #{act}","expected #{this} to not have a length below #{exp}",a,d)}else this.assert(a>c,"expected #{this} to be below "+a,"expected #{this} to be at least "+a)}function l(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(a>=d,"expected #{this} to have a length at most #{exp} but got #{act}","expected #{this} to have a length above #{exp}",a,d)}else this.assert(a>=c,"expected #{this} to be at most "+a,"expected #{this} to be above "+a)}function m(a,c){c&&u(this,"message",c);var d=b.getName(a);this.assert(u(this,"object")instanceof a,"expected #{this} to be an instance of "+d,"expected #{this} to not be an instance of "+d)}function n(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(d.hasOwnProperty(a),"expected #{this} to have own property "+b.inspect(a),"expected #{this} to not have own property "+b.inspect(a))}function o(){u(this,"doLength",!0)}function p(a,b){b&&u(this,"message",b);var c=u(this,"object");new t(c,b).to.have.property("length");var d=c.length;this.assert(d==a,"expected #{this} to have a length of #{exp} but got #{act}","expected #{this} to not have a length of #{act}",a,d)}function q(a){var c,d=u(this,"object"),e=!0;if(a=a instanceof Array?a:Array.prototype.slice.call(arguments),!a.length)throw new Error("keys required");var f=Object.keys(d),g=a.length;if(e=a.every(function(a){return~f.indexOf(a)}),u(this,"negate")||u(this,"contains")||(e=e&&a.length==f.length),g>1){a=a.map(function(a){return b.inspect(a)});var h=a.pop();c=a.join(", ")+", and "+h}else c=b.inspect(a[0]);c=(g>1?"keys ":"key ")+c,c=(u(this,"contains")?"contain ":"have ")+c,this.assert(e,"expected #{this} to "+c,"expected #{this} to not "+c)}function r(a,c,d){d&&u(this,"message",d);var e=u(this,"object");new t(e,d).is.a("function");var f=!1,g=null,h=null,i=null;0===arguments.length?(c=null,a=null):a&&(a instanceof RegExp||"string"==typeof a)?(c=a,a=null):a&&a instanceof Error?(g=a,a=null,c=null):"function"==typeof a?(h=a.prototype.name||a.name,"Error"===h&&a!==Error&&(h=(new a).name)):a=null;try{e()}catch(j){if(g)return this.assert(j===g,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}",g instanceof Error?g.toString():g,j instanceof Error?j.toString():j),u(this,"object",j),this;if(a&&(this.assert(j instanceof a,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp} but #{act} was thrown",h,j instanceof Error?j.toString():j),!c))return u(this,"object",j),this;var k="object"===b.type(j)&&"message"in j?j.message:""+j;if(null!=k&&c&&c instanceof RegExp)return this.assert(c.exec(k),"expected #{this} to throw error matching #{exp} but got #{act}","expected #{this} to throw error not matching #{exp}",c,k),u(this,"object",j),this;if(null!=k&&c&&"string"==typeof c)return this.assert(~k.indexOf(c),"expected #{this} to throw error including #{exp} but got #{act}","expected #{this} to throw error not including #{act}",c,k),u(this,"object",j),this;f=!0,i=j}var l="",m=null!==h?h:g?"#{exp}":"an error";f&&(l=" but #{act} was thrown"),this.assert(f===!0,"expected #{this} to throw "+m+l,"expected #{this} to not throw "+m+l,g instanceof Error?g.toString():g,i instanceof Error?i.toString():i),u(this,"object",i)}function s(a,b,c){return a.every(function(a){return c?b.some(function(b){return c(a,b)}):-1!==b.indexOf(a)})}var t=a.Assertion,u=(Object.prototype.toString,b.flag);["to","be","been","is","and","has","have","with","that","at","of","same"].forEach(function(a){t.addProperty(a,function(){return this})}),t.addProperty("not",function(){u(this,"negate",!0)}),t.addProperty("deep",function(){u(this,"deep",!0)}),t.addChainableMethod("an",c),t.addChainableMethod("a",c),t.addChainableMethod("include",e,d),t.addChainableMethod("contain",e,d),t.addProperty("ok",function(){this.assert(u(this,"object"),"expected #{this} to be truthy","expected #{this} to be falsy")}),t.addProperty("true",function(){this.assert(!0===u(this,"object"),"expected #{this} to be true","expected #{this} to be false",this.negate?!1:!0)}),t.addProperty("false",function(){this.assert(!1===u(this,"object"),"expected #{this} to be false","expected #{this} to be true",this.negate?!0:!1)}),t.addProperty("null",function(){this.assert(null===u(this,"object"),"expected #{this} to be null","expected #{this} not to be null")}),t.addProperty("undefined",function(){this.assert(void 0===u(this,"object"),"expected #{this} to be undefined","expected #{this} not to be undefined")}),t.addProperty("exist",function(){this.assert(null!=u(this,"object"),"expected #{this} to exist","expected #{this} to not exist")}),t.addProperty("empty",function(){var a=u(this,"object"),b=a;Array.isArray(a)||"string"==typeof object?b=a.length:"object"==typeof a&&(b=Object.keys(a).length),this.assert(!b,"expected #{this} to be empty","expected #{this} not to be empty")}),t.addProperty("arguments",f),t.addProperty("Arguments",f),t.addMethod("equal",g),t.addMethod("equals",g),t.addMethod("eq",g),t.addMethod("eql",h),t.addMethod("eqls",h),t.addMethod("above",i),t.addMethod("gt",i),t.addMethod("greaterThan",i),t.addMethod("least",j),t.addMethod("gte",j),t.addMethod("below",k),t.addMethod("lt",k),t.addMethod("lessThan",k),t.addMethod("most",l),t.addMethod("lte",l),t.addMethod("within",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object"),e=a+".."+b;if(u(this,"doLength")){new t(d,c).to.have.property("length");var f=d.length;this.assert(f>=a&&b>=f,"expected #{this} to have a length within "+e,"expected #{this} to not have a length within "+e)}else this.assert(d>=a&&b>=d,"expected #{this} to be within "+e,"expected #{this} to not be within "+e)}),t.addMethod("instanceof",m),t.addMethod("instanceOf",m),t.addMethod("property",function(a,c,d){d&&u(this,"message",d);var e=u(this,"deep")?"deep property ":"property ",f=u(this,"negate"),g=u(this,"object"),h=u(this,"deep")?b.getPathValue(a,g):g[a];if(f&&void 0!==c){if(void 0===h)throw d=null!=d?d+": ":"",new Error(d+b.inspect(g)+" has no "+e+b.inspect(a))}else this.assert(void 0!==h,"expected #{this} to have a "+e+b.inspect(a),"expected #{this} to not have "+e+b.inspect(a));void 0!==c&&this.assert(c===h,"expected #{this} to have a "+e+b.inspect(a)+" of #{exp}, but got #{act}","expected #{this} to not have a "+e+b.inspect(a)+" of #{act}",c,h),u(this,"object",h)}),t.addMethod("ownProperty",n),t.addMethod("haveOwnProperty",n),t.addChainableMethod("length",p,o),t.addMethod("lengthOf",p,o),t.addMethod("match",function(a,b){b&&u(this,"message",b);var c=u(this,"object");this.assert(a.exec(c),"expected #{this} to match "+a,"expected #{this} not to match "+a)}),t.addMethod("string",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d,c).is.a("string"),this.assert(~d.indexOf(a),"expected #{this} to contain "+b.inspect(a),"expected #{this} to not contain "+b.inspect(a))}),t.addMethod("keys",q),t.addMethod("key",q),t.addMethod("throw",r),t.addMethod("throws",r),t.addMethod("Throw",r),t.addMethod("respondTo",function(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=u(this,"itself"),f="function"!==b.type(d)||e?d[a]:d.prototype[a];this.assert("function"==typeof f,"expected #{this} to respond to "+b.inspect(a),"expected #{this} to not respond to "+b.inspect(a))}),t.addProperty("itself",function(){u(this,"itself",!0)}),t.addMethod("satisfy",function(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(a(d),"expected #{this} to satisfy "+b.objDisplay(a),"expected #{this} to not satisfy"+b.objDisplay(a),this.negate?!1:!0,a(d))}),t.addMethod("closeTo",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(Math.abs(d-a)<=b,"expected #{this} to be close to "+a+" +/- "+b,"expected #{this} not to be close to "+a+" +/- "+b)}),t.addMethod("members",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d).to.be.an("array"),new t(a).to.be.an("array");var e=u(this,"deep")?b.eql:void 0;return u(this,"contains")?this.assert(s(a,d,e),"expected #{this} to be a superset of #{act}","expected #{this} to not be a superset of #{act}",d,a):void this.assert(s(d,a,e)&&s(a,d,e),"expected #{this} to have the same members as #{act}","expected #{this} to not have the same members as #{act}",d,a)})}},{}],15:[function(require,module,exports){module.exports=function(chai,util){var Assertion=chai.Assertion,flag=util.flag,assert=chai.assert=function(a,b){var c=new Assertion(null,null,chai.assert);c.assert(a,b,"[ negation message unavailable ]")};assert.fail=function(a,b,c,d){throw c=c||"assert.fail()",new chai.AssertionError(c,{actual:a,expected:b,operator:d},assert.fail)},assert.ok=function(a,b){new Assertion(a,b).is.ok},assert.notOk=function(a,b){new Assertion(a,b).is.not.ok},assert.equal=function(a,b,c){var d=new Assertion(a,c,assert.equal);d.assert(b==flag(d,"object"),"expected #{this} to equal #{exp}","expected #{this} to not equal #{act}",b,a)},assert.notEqual=function(a,b,c){var d=new Assertion(a,c,assert.notEqual);d.assert(b!=flag(d,"object"),"expected #{this} to not equal #{exp}","expected #{this} to equal #{act}",b,a)},assert.strictEqual=function(a,b,c){new Assertion(a,c).to.equal(b)},assert.notStrictEqual=function(a,b,c){new Assertion(a,c).to.not.equal(b)},assert.deepEqual=function(a,b,c){new Assertion(a,c).to.eql(b)},assert.notDeepEqual=function(a,b,c){new Assertion(a,c).to.not.eql(b)},assert.isTrue=function(a,b){new Assertion(a,b).is["true"]},assert.isFalse=function(a,b){new Assertion(a,b).is["false"]},assert.isNull=function(a,b){new Assertion(a,b).to.equal(null)},assert.isNotNull=function(a,b){new Assertion(a,b).to.not.equal(null)},assert.isUndefined=function(a,b){new Assertion(a,b).to.equal(void 0)},assert.isDefined=function(a,b){new Assertion(a,b).to.not.equal(void 0)},assert.isFunction=function(a,b){new Assertion(a,b).to.be.a("function")},assert.isNotFunction=function(a,b){new Assertion(a,b).to.not.be.a("function")},assert.isObject=function(a,b){new Assertion(a,b).to.be.a("object")},assert.isNotObject=function(a,b){new Assertion(a,b).to.not.be.a("object")},assert.isArray=function(a,b){new Assertion(a,b).to.be.an("array")},assert.isNotArray=function(a,b){new Assertion(a,b).to.not.be.an("array")},assert.isString=function(a,b){new Assertion(a,b).to.be.a("string")},assert.isNotString=function(a,b){new Assertion(a,b).to.not.be.a("string")},assert.isNumber=function(a,b){new Assertion(a,b).to.be.a("number")},assert.isNotNumber=function(a,b){new Assertion(a,b).to.not.be.a("number")},assert.isBoolean=function(a,b){new Assertion(a,b).to.be.a("boolean")},assert.isNotBoolean=function(a,b){new Assertion(a,b).to.not.be.a("boolean")},assert.typeOf=function(a,b,c){new Assertion(a,c).to.be.a(b)},assert.notTypeOf=function(a,b,c){new Assertion(a,c).to.not.be.a(b)},assert.instanceOf=function(a,b,c){new Assertion(a,c).to.be.instanceOf(b)},assert.notInstanceOf=function(a,b,c){new Assertion(a,c).to.not.be.instanceOf(b)},assert.include=function(a,b,c){new Assertion(a,c,assert.include).include(b)},assert.notInclude=function(a,b,c){new Assertion(a,c,assert.notInclude).not.include(b)},assert.match=function(a,b,c){new Assertion(a,c).to.match(b)},assert.notMatch=function(a,b,c){new Assertion(a,c).to.not.match(b)
|
||
},assert.property=function(a,b,c){new Assertion(a,c).to.have.property(b)},assert.notProperty=function(a,b,c){new Assertion(a,c).to.not.have.property(b)},assert.deepProperty=function(a,b,c){new Assertion(a,c).to.have.deep.property(b)},assert.notDeepProperty=function(a,b,c){new Assertion(a,c).to.not.have.deep.property(b)},assert.propertyVal=function(a,b,c,d){new Assertion(a,d).to.have.property(b,c)},assert.propertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.property(b,c)},assert.deepPropertyVal=function(a,b,c,d){new Assertion(a,d).to.have.deep.property(b,c)},assert.deepPropertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.deep.property(b,c)},assert.lengthOf=function(a,b,c){new Assertion(a,c).to.have.length(b)},assert.Throw=function(a,b,c,d){("string"==typeof b||b instanceof RegExp)&&(c=b,b=null);var e=new Assertion(a,d).to.Throw(b,c);return flag(e,"object")},assert.doesNotThrow=function(a,b,c){"string"==typeof b&&(c=b,b=null),new Assertion(a,c).to.not.Throw(b)},assert.operator=function(val,operator,val2,msg){if(!~["==","===",">",">=","<","<=","!=","!=="].indexOf(operator))throw new Error('Invalid operator "'+operator+'"');var test=new Assertion(eval(val+operator+val2),msg);test.assert(!0===flag(test,"object"),"expected "+util.inspect(val)+" to be "+operator+" "+util.inspect(val2),"expected "+util.inspect(val)+" to not be "+operator+" "+util.inspect(val2))},assert.closeTo=function(a,b,c,d){new Assertion(a,d).to.be.closeTo(b,c)},assert.sameMembers=function(a,b,c){new Assertion(a,c).to.have.same.members(b)},assert.includeMembers=function(a,b,c){new Assertion(a,c).to.include.members(b)},assert.ifError=function(a,b){new Assertion(a,b).to.not.be.ok},function a(b,c){return assert[c]=assert[b],a}("Throw","throw")("Throw","throws")}},{}],16:[function(a,b){b.exports=function(a){a.expect=function(b,c){return new a.Assertion(b,c)}}},{}],17:[function(a,b){b.exports=function(a){function b(){function a(){return this instanceof String||this instanceof Number?new c(this.constructor(this),null,a):this instanceof Boolean?new c(1==this,null,a):new c(this,null,a)}function b(a){Object.defineProperty(this,"should",{value:a,enumerable:!0,configurable:!0,writable:!0})}Object.defineProperty(Object.prototype,"should",{set:b,get:a,configurable:!0});var d={};return d.equal=function(a,b,d){new c(a,d).to.equal(b)},d.Throw=function(a,b,d,e){new c(a,e).to.Throw(b,d)},d.exist=function(a,b){new c(a,b).to.exist},d.not={},d.not.equal=function(a,b,d){new c(a,d).to.not.equal(b)},d.not.Throw=function(a,b,d,e){new c(a,e).to.not.Throw(b,d)},d.not.exist=function(a,b){new c(a,b).to.not.exist},d["throw"]=d.Throw,d.not["throw"]=d.not.Throw,d}var c=a.Assertion;a.should=b,a.Should=b}},{}],18:[function(a,b){var c=a("./transferFlags"),d=a("./flag"),e=a("../config"),f="__proto__"in Object,g=/^(?:length|name|arguments|caller)$/,h=Function.prototype.call,i=Function.prototype.apply;b.exports=function(a,b,j,k){"function"!=typeof k&&(k=function(){});var l={method:j,chainingBehavior:k};a.__methods||(a.__methods={}),a.__methods[b]=l,Object.defineProperty(a,b,{get:function(){l.chainingBehavior.call(this);var b=function m(){var a=d(this,"ssfi");a&&e.includeStack===!1&&d(this,"ssfi",m);var b=l.method.apply(this,arguments);return void 0===b?this:b};if(f){var j=b.__proto__=Object.create(this);j.call=h,j.apply=i}else{var k=Object.getOwnPropertyNames(a);k.forEach(function(c){if(!g.test(c)){var d=Object.getOwnPropertyDescriptor(a,c);Object.defineProperty(b,c,d)}})}return c(this,b),b},configurable:!0})}},{"../config":13,"./flag":21,"./transferFlags":35}],19:[function(a,b){var c=a("../config"),d=a("./flag");b.exports=function(a,b,e){a[b]=function(){var f=d(this,"ssfi");f&&c.includeStack===!1&&d(this,"ssfi",a[b]);var g=e.apply(this,arguments);return void 0===g?this:g}}},{"../config":13,"./flag":21}],20:[function(a,b){b.exports=function(a,b,c){Object.defineProperty(a,b,{get:function(){var a=c.call(this);return void 0===a?this:a},configurable:!0})}},{}],21:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));return 3!==arguments.length?d[b]:void(d[b]=c)}},{}],22:[function(a,b){b.exports=function(a,b){return b.length>4?b[4]:a._obj}},{}],23:[function(a,b){b.exports=function(a){var b=[];for(var c in a)b.push(c);return b}},{}],24:[function(a,b){var c=a("./flag"),d=a("./getActual"),e=(a("./inspect"),a("./objDisplay"));b.exports=function(a,b){var f=c(a,"negate"),g=c(a,"object"),h=b[3],i=d(a,b),j=f?b[2]:b[1],k=c(a,"message");return j=j||"",j=j.replace(/#{this}/g,e(g)).replace(/#{act}/g,e(i)).replace(/#{exp}/g,e(h)),k?k+": "+j:j}},{"./flag":21,"./getActual":22,"./inspect":29,"./objDisplay":30}],25:[function(a,b){b.exports=function(a){if(a.name)return a.name;var b=/^\s?function ([^(]*)\(/.exec(a);return b&&b[1]?b[1]:""}},{}],26:[function(a,b){function c(a){var b=a.replace(/\[/g,".["),c=b.match(/(\\\.|[^.]+?)+/g);return c.map(function(a){var b=/\[(\d+)\]$/,c=b.exec(a);return c?{i:parseFloat(c[1])}:{p:a}})}function d(a,b){for(var c,d=b,e=0,f=a.length;f>e;e++){var g=a[e];d?("undefined"!=typeof g.p?d=d[g.p]:"undefined"!=typeof g.i&&(d=d[g.i]),e==f-1&&(c=d)):c=void 0}return c}b.exports=function(a,b){var e=c(a);return d(e,b)}},{}],27:[function(a,b){b.exports=function(){function a(a){-1===b.indexOf(a)&&b.push(a)}for(var b=Object.getOwnPropertyNames(subject),c=Object.getPrototypeOf(subject);null!==c;)Object.getOwnPropertyNames(c).forEach(a),c=Object.getPrototypeOf(c);return b}},{}],28:[function(a,b,c){var c=b.exports={};c.test=a("./test"),c.type=a("./type"),c.getMessage=a("./getMessage"),c.getActual=a("./getActual"),c.inspect=a("./inspect"),c.objDisplay=a("./objDisplay"),c.flag=a("./flag"),c.transferFlags=a("./transferFlags"),c.eql=a("deep-eql"),c.getPathValue=a("./getPathValue"),c.getName=a("./getName"),c.addProperty=a("./addProperty"),c.addMethod=a("./addMethod"),c.overwriteProperty=a("./overwriteProperty"),c.overwriteMethod=a("./overwriteMethod"),c.addChainableMethod=a("./addChainableMethod"),c.overwriteChainableMethod=a("./overwriteChainableMethod")},{"./addChainableMethod":18,"./addMethod":19,"./addProperty":20,"./flag":21,"./getActual":22,"./getMessage":24,"./getName":25,"./getPathValue":26,"./inspect":29,"./objDisplay":30,"./overwriteChainableMethod":31,"./overwriteMethod":32,"./overwriteProperty":33,"./test":34,"./transferFlags":35,"./type":36,"deep-eql":38}],29:[function(a,b,c){function d(a,b,c){var d={showHidden:b,seen:[],stylize:function(a){return a}};return e(d,a,"undefined"==typeof c?2:c)}function e(a,b,d){if(b&&"function"==typeof b.inspect&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var o=b.inspect(d);return"string"!=typeof o&&(o=e(a,o,d)),o}var u=f(a,b);if(u)return u;if(t(b))return s(b);var v=r(b),w=a.showHidden?q(b):v;if(0===w.length||n(b)&&(1===w.length&&"stack"===w[0]||2===w.length&&"description"===w[0]&&"stack"===w[1])){if("function"==typeof b){var x=p(b),y=x?": "+x:"";return a.stylize("[Function"+y+"]","special")}if(l(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(m(b))return a.stylize(Date.prototype.toUTCString.call(b),"date");if(n(b))return g(b)}var z="",A=!1,B=["{","}"];if(k(b)&&(A=!0,B=["[","]"]),"function"==typeof b){var x=p(b),y=x?": "+x:"";z=" [Function"+y+"]"}if(l(b)&&(z=" "+RegExp.prototype.toString.call(b)),m(b)&&(z=" "+Date.prototype.toUTCString.call(b)),n(b))return g(b);if(0===w.length&&(!A||0==b.length))return B[0]+z+B[1];if(0>d)return l(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var C;return C=A?h(a,b,d,v,w):w.map(function(c){return i(a,b,d,v,c,A)}),a.seen.pop(),j(C,z,B)}function f(a,b){switch(typeof b){case"undefined":return a.stylize("undefined","undefined");case"string":var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string");case"number":return a.stylize(""+b,"number");case"boolean":return a.stylize(""+b,"boolean")}return null===b?a.stylize("null","null"):void 0}function g(a){return"["+Error.prototype.toString.call(a)+"]"}function h(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(Object.prototype.hasOwnProperty.call(b,String(g))?i(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(i(a,b,c,d,e,!0))}),f}function i(a,b,c,d,f,g){var h,i;if(b.__lookupGetter__&&(b.__lookupGetter__(f)?i=b.__lookupSetter__(f)?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):b.__lookupSetter__(f)&&(i=a.stylize("[Setter]","special"))),d.indexOf(f)<0&&(h="["+f+"]"),i||(a.seen.indexOf(b[f])<0?(i=null===c?e(a,b[f],null):e(a,b[f],c-1),i.indexOf("\n")>-1&&(i=g?i.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+i.split("\n").map(function(a){return" "+a}).join("\n"))):i=a.stylize("[Circular]","special")),"undefined"==typeof h){if(g&&f.match(/^\d+$/))return i;h=JSON.stringify(""+f),h.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(h=h.substr(1,h.length-2),h=a.stylize(h,"name")):(h=h.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),h=a.stylize(h,"string"))}return h+": "+i}function j(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function k(a){return Array.isArray(a)||"object"==typeof a&&"[object Array]"===o(a)}function l(a){return"object"==typeof a&&"[object RegExp]"===o(a)}function m(a){return"object"==typeof a&&"[object Date]"===o(a)}function n(a){return"object"==typeof a&&"[object Error]"===o(a)}function o(a){return Object.prototype.toString.call(a)}var p=a("./getName"),q=a("./getProperties"),r=a("./getEnumerableProperties");b.exports=d;var s=function(a){if("outerHTML"in a)return a.outerHTML;var b,c="http://www.w3.org/1999/xhtml",d=document.createElementNS(c,"_"),e=((window.HTMLElement||window.Element).prototype,new XMLSerializer);return document.xmlVersion?e.serializeToString(a):(d.appendChild(a.cloneNode(!1)),b=d.innerHTML.replace("><",">"+a.innerHTML+"<"),d.innerHTML="",b)},t=function(a){return"object"==typeof HTMLElement?a instanceof HTMLElement:a&&"object"==typeof a&&1===a.nodeType&&"string"==typeof a.nodeName}},{"./getEnumerableProperties":23,"./getName":25,"./getProperties":27}],30:[function(a,b){var c=a("./inspect"),d=a("../config");b.exports=function(a){var b=c(a),e=Object.prototype.toString.call(a);if(d.truncateThreshold&&b.length>=d.truncateThreshold){if("[object Function]"===e)return a.name&&""!==a.name?"[Function: "+a.name+"]":"[Function]";if("[object Array]"===e)return"[ Array("+a.length+") ]";if("[object Object]"===e){var f=Object.keys(a),g=f.length>2?f.splice(0,2).join(", ")+", ...":f.join(", ");return"{ Object ("+g+") }"}return b}return b}},{"../config":13,"./inspect":29}],31:[function(a,b){b.exports=function(a,b,c,d){var e=a.__methods[b],f=e.chainingBehavior;e.chainingBehavior=function(){var a=d(f).call(this);return void 0===a?this:a};var g=e.method;e.method=function(){var a=c(g).apply(this,arguments);return void 0===a?this:a}}},{}],32:[function(a,b){b.exports=function(a,b,c){var d=a[b],e=function(){return this};d&&"function"==typeof d&&(e=d),a[b]=function(){var a=c(e).apply(this,arguments);return void 0===a?this:a}}},{}],33:[function(a,b){b.exports=function(a,b,c){var d=Object.getOwnPropertyDescriptor(a,b),e=function(){};d&&"function"==typeof d.get&&(e=d.get),Object.defineProperty(a,b,{get:function(){var a=c(e).call(this);return void 0===a?this:a},configurable:!0})}},{}],34:[function(a,b){var c=a("./flag");b.exports=function(a,b){var d=c(a,"negate"),e=b[0];return d?!e:e}},{"./flag":21}],35:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));b.__flags||(b.__flags=Object.create(null)),c=3===arguments.length?c:!0;for(var e in d)(c||"object"!==e&&"ssfi"!==e&&"message"!=e)&&(b.__flags[e]=d[e])}},{}],36:[function(a,b){var c={"[object Arguments]":"arguments","[object Array]":"array","[object Date]":"date","[object Function]":"function","[object Number]":"number","[object RegExp]":"regexp","[object String]":"string"};b.exports=function(a){var b=Object.prototype.toString.call(a);return c[b]?c[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}},{}],37:[function(a,b){function c(){function a(a,c){Object.keys(c).forEach(function(d){~b.indexOf(d)||(a[d]=c[d])})}var b=[].slice.call(arguments);return function(){for(var b=[].slice.call(arguments),c=0,d={};c<b.length;c++)a(d,b[c]);return d}}function d(a,b,d){var e=c("name","message","stack","constructor","toJSON"),f=e(b||{});this.message=a||"Unspecified AssertionError",this.showDiff=!1;for(var g in f)this[g]=f[g];d=d||arguments.callee,d&&Error.captureStackTrace&&Error.captureStackTrace(this,d)}b.exports=d,d.prototype=Object.create(Error.prototype),d.prototype.name="AssertionError",d.prototype.constructor=d,d.prototype.toJSON=function(a){var b=c("constructor","toJSON","stack"),d=b({name:this.name},this);return!1!==a&&this.stack&&(d.stack=this.stack),d}},{}],38:[function(a,b){b.exports=a("./lib/eql")},{"./lib/eql":39}],39:[function(a,b){function c(a,b,c){return d(a,b)?!0:"date"===o(a)?f(a,b):"regexp"===o(a)?g(a,b):n.isBuffer(a)?k(a,b):"arguments"===o(a)?h(a,b,c):e(a,b)?"object"!==o(a)&&"object"!==o(b)&&"array"!==o(a)&&"array"!==o(b)?d(a,b):m(a,b,c):!1}function d(a,b){return a===b?0!==a||1/a===1/b:a!==a&&b!==b}function e(a,b){return o(a)===o(b)}function f(a,b){return"date"!==o(b)?!1:d(a.getTime(),b.getTime())}function g(a,b){return"regexp"!==o(b)?!1:d(a.toString(),b.toString())}function h(a,b,d){return"arguments"!==o(b)?!1:(a=[].slice.call(a),b=[].slice.call(b),c(a,b,d))}function i(a){var b=[];for(var c in a)b.push(c);return b}function j(a,b){if(a.length!==b.length)return!1;for(var c=0,d=!0;c<a.length;c++)if(a[c]!==b[c]){d=!1;break}return d}function k(a,b){return n.isBuffer(b)?j(a,b):!1}function l(a){return null!==a&&void 0!==a}function m(a,b,d){if(!l(a)||!l(b))return!1;if(a.prototype!==b.prototype)return!1;var e;if(d){for(e=0;e<d.length;e++)if(d[e][0]===a&&d[e][1]===b||d[e][0]===b&&d[e][1]===a)return!0}else d=[];try{var f=i(a),g=i(b)}catch(h){return!1}if(f.sort(),g.sort(),!j(f,g))return!1;d.push([a,b]);var k;for(e=f.length-1;e>=0;e--)if(k=f[e],!c(a[k],b[k],d))return!1;return!0}var n,o=a("type-detect");try{n=a("buffer").Buffer}catch(p){n={},n.isBuffer=function(){return!1}}b.exports=c},{buffer:42,"type-detect":40}],40:[function(a,b){b.exports=a("./lib/type")},{"./lib/type":41}],41:[function(a,b,c){function d(a){var b=Object.prototype.toString.call(a);return f[b]?f[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}function e(){this.tests={}}var c=b.exports=d,f={"[object Array]":"array","[object RegExp]":"regexp","[object Function]":"function","[object Arguments]":"arguments","[object Date]":"date"};c.Library=e,e.prototype.of=d,e.prototype.define=function(a,b){return 1===arguments.length?this.tests[a]:(this.tests[a]=b,this)},e.prototype.test=function(a,b){if(b===d(a))return!0;var c=this.tests[b];if(c&&"regexp"===d(c))return c.test(a);if(c&&"function"===d(c))return c(a);throw new ReferenceError('Type test "'+b+'" not defined or invalid.')}},{}],42:[function(a,b,c){function d(a,b,c){if(!(this instanceof d))return new d(a,b,c);var e,f=typeof a;if("number"===f)e=a>0?a>>>0:0;else if("string"===f)"base64"===b&&(a=C(a)),e=d.byteLength(a,b);else{if("object"!==f||null===a)throw new Error("First argument needs to be a number, array or string.");"Buffer"===a.type&&E(a.data)&&(a=a.data),e=+a.length>0?Math.floor(+a.length):0}var g;T?g=d._augment(new Uint8Array(e)):(g=this,g.length=e,g._isBuffer=!0);var h;if(T&&"number"==typeof a.byteLength)g._set(a);else if(F(a))if(d.isBuffer(a))for(h=0;e>h;h++)g[h]=a.readUInt8(h);else for(h=0;e>h;h++)g[h]=(a[h]%256+256)%256;else if("string"===f)g.write(a,0,b);else if("number"===f&&!T&&!c)for(h=0;e>h;h++)g[h]=0;return g}function e(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;Q(f%2===0,"Invalid hex string"),d>f/2&&(d=f/2);for(var g=0;d>g;g++){var h=parseInt(b.substr(2*g,2),16);Q(!isNaN(h),"Invalid hex string"),a[c+g]=h}return g}function f(a,b,c,d){var e=L(H(b),a,c,d);return e}function g(a,b,c,d){var e=L(I(b),a,c,d);return e}function h(a,b,c,d){return g(a,b,c,d)}function i(a,b,c,d){var e=L(K(b),a,c,d);return e}function j(a,b,c,d){var e=L(J(b),a,c,d);return e}function k(a,b,c){return R.fromByteArray(0===b&&c===a.length?a:a.slice(b,c))}function l(a,b,c){var d="",e="";c=Math.min(a.length,c);for(var f=b;c>f;f++)a[f]<=127?(d+=M(e)+String.fromCharCode(a[f]),e=""):e+="%"+a[f].toString(16);return d+M(e)}function m(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(a[e]);return d}function n(a,b,c){return m(a,b,c)}function o(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;f++)e+=G(a[f]);return e}function p(a,b,c){for(var d=a.slice(b,c),e="",f=0;f<d.length;f+=2)e+=String.fromCharCode(d[f]+256*d[f+1]);return e}function q(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(f=a[b],e>b+1&&(f|=a[b+1]<<8)):(f=a[b]<<8,e>b+1&&(f|=a[b+1])),f}}function r(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(e>b+2&&(f=a[b+2]<<16),e>b+1&&(f|=a[b+1]<<8),f|=a[b],e>b+3&&(f+=a[b+3]<<24>>>0)):(e>b+1&&(f=a[b+1]<<16),e>b+2&&(f|=a[b+2]<<8),e>b+3&&(f|=a[b+3]),f+=a[b]<<24>>>0),f}}function s(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=q(a,b,c,!0),g=32768&f;return g?-1*(65535-f+1):f}}function t(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=r(a,b,c,!0),g=2147483648&f;return g?-1*(4294967295-f+1):f}}function u(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+3<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,23,4)}function v(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+7<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,52,8)}function w(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"trying to write beyond buffer length"),N(b,65535));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,2);h>g;g++)a[c+g]=(b&255<<8*(d?g:1-g))>>>8*(d?g:1-g);return c+2}}function x(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"trying to write beyond buffer length"),N(b,4294967295));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,4);h>g;g++)a[c+g]=b>>>8*(d?g:3-g)&255;return c+4}}function y(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"Trying to write beyond buffer length"),O(b,32767,-32768));var f=a.length;return c>=f?void 0:(b>=0?w(a,b,c,d,e):w(a,65535+b+1,c,d,e),c+2)}function z(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),O(b,2147483647,-2147483648));var f=a.length;return c>=f?void 0:(b>=0?x(a,b,c,d,e):x(a,4294967295+b+1,c,d,e),c+4)}function A(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),P(b,3.4028234663852886e38,-3.4028234663852886e38));var f=a.length;return c>=f?void 0:(S.write(a,b,c,d,23,4),c+4)}function B(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+7<a.length,"Trying to write beyond buffer length"),P(b,1.7976931348623157e308,-1.7976931348623157e308));var f=a.length;return c>=f?void 0:(S.write(a,b,c,d,52,8),c+8)}function C(a){for(a=D(a).replace(V,"");a.length%4!==0;)a+="=";return a}function D(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function E(a){return(Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)})(a)}function F(a){return E(a)||d.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length}function G(a){return 16>a?"0"+a.toString(16):a.toString(16)}function H(a){for(var b=[],c=0;c<a.length;c++){var d=a.charCodeAt(c);if(127>=d)b.push(d);else{var e=c;d>=55296&&57343>=d&&c++;for(var f=encodeURIComponent(a.slice(e,c+1)).substr(1).split("%"),g=0;g<f.length;g++)b.push(parseInt(f[g],16))}}return b}function I(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function J(a){for(var b,c,d,e=[],f=0;f<a.length;f++)b=a.charCodeAt(f),c=b>>8,d=b%256,e.push(d),e.push(c);return e}function K(a){return R.toByteArray(a)}function L(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);e++)b[e+c]=a[e];return e}function M(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function N(a,b){Q("number"==typeof a,"cannot write a non-number as a number"),Q(a>=0,"specified a negative value for writing an unsigned value"),Q(b>=a,"value is larger than maximum value for type"),Q(Math.floor(a)===a,"value has a fractional component")}function O(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value"),Q(Math.floor(a)===a,"value has a fractional component")}function P(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value")}function Q(a,b){if(!a)throw new Error(b||"Failed assertion")}var R=a("base64-js"),S=a("ieee754");c.Buffer=d,c.SlowBuffer=d,c.INSPECT_MAX_BYTES=50,d.poolSize=8192;var T=function(){try{var a=new ArrayBuffer(0),b=new Uint8Array(a);return b.foo=function(){return 42},42===b.foo()&&"function"==typeof b.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(c){return!1}}();d.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.isBuffer=function(a){return!(null==a||!a._isBuffer)},d.byteLength=function(a,b){var c;switch(a=a.toString(),b||"utf8"){case"hex":c=a.length/2;break;case"utf8":case"utf-8":c=H(a).length;break;case"ascii":case"binary":case"raw":c=a.length;break;case"base64":c=K(a).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":c=2*a.length;break;default:throw new Error("Unknown encoding")}return c},d.concat=function(a,b){if(Q(E(a),"Usage: Buffer.concat(list[, length])"),0===a.length)return new d(0);if(1===a.length)return a[0];var c;if(void 0===b)for(b=0,c=0;c<a.length;c++)b+=a[c].length;var e=new d(b),f=0;for(c=0;c<a.length;c++){var g=a[c];g.copy(e,f),f+=g.length}return e},d.compare=function(a,b){Q(d.isBuffer(a)&&d.isBuffer(b),"Arguments must be Buffers");for(var c=a.length,e=b.length,f=0,g=Math.min(c,e);g>f&&a[f]===b[f];f++);return f!==g&&(c=a[f],e=b[f]),e>c?-1:c>e?1:0},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var k=d;d=b,b=c,c=k}b=Number(b)||0;var l=this.length-b;c?(c=Number(c),c>l&&(c=l)):c=l,d=String(d||"utf8").toLowerCase();var m;switch(d){case"hex":m=e(this,a,b,c);break;case"utf8":case"utf-8":m=f(this,a,b,c);break;case"ascii":m=g(this,a,b,c);break;case"binary":m=h(this,a,b,c);break;case"base64":m=i(this,a,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":m=j(this,a,b,c);break;default:throw new Error("Unknown encoding")}return m},d.prototype.toString=function(a,b,c){var d=this;if(a=String(a||"utf8").toLowerCase(),b=Number(b)||0,c=void 0===c?d.length:Number(c),c===b)return"";var e;switch(a){case"hex":e=o(d,b,c);break;case"utf8":case"utf-8":e=l(d,b,c);break;case"ascii":e=m(d,b,c);break;case"binary":e=n(d,b,c);break;case"base64":e=k(d,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":e=p(d,b,c);break;default:throw new Error("Unknown encoding")}return e},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},d.prototype.equals=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),0===d.compare(this,a)},d.prototype.compare=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),d.compare(this,a)},d.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||0===d||(d=this.length),b||(b=0),d!==c&&0!==a.length&&0!==e.length){Q(d>=c,"sourceEnd < sourceStart"),Q(b>=0&&b<a.length,"targetStart out of bounds"),Q(c>=0&&c<e.length,"sourceStart out of bounds"),Q(d>=0&&d<=e.length,"sourceEnd out of bounds"),d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);var f=d-c;if(100>f||!T)for(var g=0;f>g;g++)a[g+b]=this[g+c];else a._set(this.subarray(c,c+f),b)}},d.prototype.slice=function(a,b){var c=this.length;if(a=~~a,b=void 0===b?c:~~b,0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c),0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c),a>b&&(b=a),T)return d._augment(this.subarray(a,b));for(var e=b-a,f=new d(e,void 0,!0),g=0;e>g;g++)f[g]=this[g+a];return f},d.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},d.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},d.prototype.readUInt8=function(a,b){return b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),a>=this.length?void 0:this[a]},d.prototype.readUInt16LE=function(a,b){return q(this,a,!0,b)},d.prototype.readUInt16BE=function(a,b){return q(this,a,!1,b)},d.prototype.readUInt32LE=function(a,b){return r(this,a,!0,b)},d.prototype.readUInt32BE=function(a,b){return r(this,a,!1,b)},d.prototype.readInt8=function(a,b){if(b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),!(a>=this.length)){var c=128&this[a];return c?-1*(255-this[a]+1):this[a]}},d.prototype.readInt16LE=function(a,b){return s(this,a,!0,b)},d.prototype.readInt16BE=function(a,b){return s(this,a,!1,b)},d.prototype.readInt32LE=function(a,b){return t(this,a,!0,b)},d.prototype.readInt32BE=function(a,b){return t(this,a,!1,b)},d.prototype.readFloatLE=function(a,b){return u(this,a,!0,b)},d.prototype.readFloatBE=function(a,b){return u(this,a,!1,b)},d.prototype.readDoubleLE=function(a,b){return v(this,a,!0,b)},d.prototype.readDoubleBE=function(a,b){return v(this,a,!1,b)},d.prototype.writeUInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"trying to write beyond buffer length"),N(a,255)),b>=this.length?void 0:(this[b]=a,b+1)},d.prototype.writeUInt16LE=function(a,b,c){return w(this,a,b,!0,c)},d.prototype.writeUInt16BE=function(a,b,c){return w(this,a,b,!1,c)},d.prototype.writeUInt32LE=function(a,b,c){return x(this,a,b,!0,c)},d.prototype.writeUInt32BE=function(a,b,c){return x(this,a,b,!1,c)},d.prototype.writeInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"Trying to write beyond buffer length"),O(a,127,-128)),b>=this.length?void 0:(a>=0?this.writeUInt8(a,b,c):this.writeUInt8(255+a+1,b,c),b+1)},d.prototype.writeInt16LE=function(a,b,c){return y(this,a,b,!0,c)},d.prototype.writeInt16BE=function(a,b,c){return y(this,a,b,!1,c)},d.prototype.writeInt32LE=function(a,b,c){return z(this,a,b,!0,c)},d.prototype.writeInt32BE=function(a,b,c){return z(this,a,b,!1,c)},d.prototype.writeFloatLE=function(a,b,c){return A(this,a,b,!0,c)},d.prototype.writeFloatBE=function(a,b,c){return A(this,a,b,!1,c)},d.prototype.writeDoubleLE=function(a,b,c){return B(this,a,b,!0,c)},d.prototype.writeDoubleBE=function(a,b,c){return B(this,a,b,!1,c)},d.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),Q(c>=b,"end < start"),c!==b&&0!==this.length){Q(b>=0&&b<this.length,"start out of bounds"),Q(c>=0&&c<=this.length,"end out of bounds");var d;if("number"==typeof a)for(d=b;c>d;d++)this[d]=a;else{var e=H(a.toString()),f=e.length;for(d=b;c>d;d++)this[d]=e[d%f]}return this}},d.prototype.inspect=function(){for(var a=[],b=this.length,d=0;b>d;d++)if(a[d]=G(this[d]),d===c.INSPECT_MAX_BYTES){a[d+1]="...";break}return"<Buffer "+a.join(" ")+">"},d.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(T)return new d(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;c>b;b+=1)a[b]=this[b];return a.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var U=d.prototype;d._augment=function(a){return a._isBuffer=!0,a._get=a.get,a._set=a.set,a.get=U.get,a.set=U.set,a.write=U.write,a.toString=U.toString,a.toLocaleString=U.toString,a.toJSON=U.toJSON,a.equals=U.equals,a.compare=U.compare,a.copy=U.copy,a.slice=U.slice,a.readUInt8=U.readUInt8,a.readUInt16LE=U.readUInt16LE,a.readUInt16BE=U.readUInt16BE,a.readUInt32LE=U.readUInt32LE,a.readUInt32BE=U.readUInt32BE,a.readInt8=U.readInt8,a.readInt16LE=U.readInt16LE,a.readInt16BE=U.readInt16BE,a.readInt32LE=U.readInt32LE,a.readInt32BE=U.readInt32BE,a.readFloatLE=U.readFloatLE,a.readFloatBE=U.readFloatBE,a.readDoubleLE=U.readDoubleLE,a.readDoubleBE=U.readDoubleBE,a.writeUInt8=U.writeUInt8,a.writeUInt16LE=U.writeUInt16LE,a.writeUInt16BE=U.writeUInt16BE,a.writeUInt32LE=U.writeUInt32LE,a.writeUInt32BE=U.writeUInt32BE,a.writeInt8=U.writeInt8,a.writeInt16LE=U.writeInt16LE,a.writeInt16BE=U.writeInt16BE,a.writeInt32LE=U.writeInt32LE,a.writeInt32BE=U.writeInt32BE,a.writeFloatLE=U.writeFloatLE,a.writeFloatBE=U.writeFloatBE,a.writeDoubleLE=U.writeDoubleLE,a.writeDoubleBE=U.writeDoubleBE,a.fill=U.fill,a.inspect=U.inspect,a.toArrayBuffer=U.toArrayBuffer,a};var V=/[^+\/0-9A-z]/g},{"base64-js":43,ieee754:44}],43:[function(a,b,c){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(a){"use strict";function b(a){var b=a.charCodeAt(0);return b===g?62:b===h?63:i>b?-1:i+10>b?b-i+26+26:k+26>b?b-k:j+26>b?b-j+26:void 0}function c(a){function c(a){j[l++]=a}var d,e,g,h,i,j;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new f(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,e=0;g>d;d+=4,e+=3)h=b(a.charAt(d))<<18|b(a.charAt(d+1))<<12|b(a.charAt(d+2))<<6|b(a.charAt(d+3)),c((16711680&h)>>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function e(a){function b(a){return d.charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var e,f,g,h=a.length%3,i="";for(e=0,g=a.length-h;g>e;e+=3)f=(a[e]<<16)+(a[e+1]<<8)+a[e+2],i+=c(f);switch(h){case 1:f=a[a.length-1],i+=b(f>>2),i+=b(f<<4&63),i+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],i+=b(f>>10),i+=b(f>>4&63),i+=b(f<<2&63),i+="="}return i}var f="undefined"!=typeof Uint8Array?Uint8Array:Array,g="+".charCodeAt(0),h="/".charCodeAt(0),i="0".charCodeAt(0),j="a".charCodeAt(0),k="A".charCodeAt(0);a.toByteArray=c,a.fromByteArray=e}("undefined"==typeof c?this.base64js={}:c)},{}],44:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);
|
||
g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],45:[function(a,b){b.exports="function"==typeof Object.create?function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],46:[function(a,b){function c(){}var d=b.exports={};d.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var d=c.shift();d()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.binding=function(){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(){throw new Error("process.chdir is not supported")}},{}],47:[function(a,b){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8}},{}],48:[function(a,b,c){(function(b,d){function e(a,b){var d={seen:[],stylize:g};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),p(b)?d.showHidden=b:b&&c._extend(d,b),v(d.showHidden)&&(d.showHidden=!1),v(d.depth)&&(d.depth=2),v(d.colors)&&(d.colors=!1),v(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=f),i(d,a,d.depth)}function f(a,b){var c=e.styles[b];return c?"["+e.colors[c][0]+"m"+a+"["+e.colors[c][1]+"m":a}function g(a){return a}function h(a){var b={};return a.forEach(function(a){b[a]=!0}),b}function i(a,b,d){if(a.customInspect&&b&&A(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return t(e)||(e=i(a,e,d)),e}var f=j(a,b);if(f)return f;var g=Object.keys(b),p=h(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),z(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return k(b);if(0===g.length){if(A(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(w(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(y(b))return a.stylize(Date.prototype.toString.call(b),"date");if(z(b))return k(b)}var r="",s=!1,u=["{","}"];if(o(b)&&(s=!0,u=["[","]"]),A(b)){var v=b.name?": "+b.name:"";r=" [Function"+v+"]"}if(w(b)&&(r=" "+RegExp.prototype.toString.call(b)),y(b)&&(r=" "+Date.prototype.toUTCString.call(b)),z(b)&&(r=" "+k(b)),0===g.length&&(!s||0==b.length))return u[0]+r+u[1];if(0>d)return w(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var x;return x=s?l(a,b,d,p,g):g.map(function(c){return m(a,b,d,p,c,s)}),a.seen.pop(),n(x,r,u)}function j(a,b){if(v(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return s(b)?a.stylize(""+b,"number"):p(b)?a.stylize(""+b,"boolean"):q(b)?a.stylize("null","null"):void 0}function k(a){return"["+Error.prototype.toString.call(a)+"]"}function l(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(F(b,String(g))?m(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(m(a,b,c,d,e,!0))}),f}function m(a,b,c,d,e,f){var g,h,j;if(j=Object.getOwnPropertyDescriptor(b,e)||{value:b[e]},j.get?h=j.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):j.set&&(h=a.stylize("[Setter]","special")),F(d,e)||(g="["+e+"]"),h||(a.seen.indexOf(j.value)<0?(h=q(c)?i(a,j.value,null):i(a,j.value,c-1),h.indexOf("\n")>-1&&(h=f?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),v(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function n(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function o(a){return Array.isArray(a)}function p(a){return"boolean"==typeof a}function q(a){return null===a}function r(a){return null==a}function s(a){return"number"==typeof a}function t(a){return"string"==typeof a}function u(a){return"symbol"==typeof a}function v(a){return void 0===a}function w(a){return x(a)&&"[object RegExp]"===C(a)}function x(a){return"object"==typeof a&&null!==a}function y(a){return x(a)&&"[object Date]"===C(a)}function z(a){return x(a)&&("[object Error]"===C(a)||a instanceof Error)}function A(a){return"function"==typeof a}function B(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function C(a){return Object.prototype.toString.call(a)}function D(a){return 10>a?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),J[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=/%[sdj%]/g;c.format=function(a){if(!t(a)){for(var b=[],c=0;c<arguments.length;c++)b.push(e(arguments[c]));return b.join(" ")}for(var c=1,d=arguments,f=d.length,g=String(a).replace(G,function(a){if("%%"===a)return"%";if(c>=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(b){return"[Circular]"}default:return a}}),h=d[c];f>c;h=d[++c])g+=q(h)||!x(h)?" "+h:" "+e(h);return g},c.deprecate=function(a,e){function f(){if(!g){if(b.throwDeprecation)throw new Error(e);b.traceDeprecation?console.trace(e):console.error(e),g=!0}return a.apply(this,arguments)}if(v(d.process))return function(){return c.deprecate(a,e).apply(this,arguments)};if(b.noDeprecation===!0)return a;var g=!1;return f};var H,I={};c.debuglog=function(a){if(v(H)&&(H=b.env.NODE_DEBUG||""),a=a.toUpperCase(),!I[a])if(new RegExp("\\b"+a+"\\b","i").test(H)){var d=b.pid;I[a]=function(){var b=c.format.apply(c,arguments);console.error("%s %d: %s",a,d,b)}}else I[a]=function(){};return I[a]},c.inspect=e,e.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},e.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},c.isArray=o,c.isBoolean=p,c.isNull=q,c.isNullOrUndefined=r,c.isNumber=s,c.isString=t,c.isSymbol=u,c.isUndefined=v,c.isRegExp=w,c.isObject=x,c.isDate=y,c.isError=z,c.isFunction=A,c.isPrimitive=B,c.isBuffer=a("./support/isBuffer");var J=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c.log=function(){console.log("%s - %s",E(),c.format.apply(c,arguments))},c.inherits=a("inherits"),c._extend=function(a,b){if(!b||!x(b))return a;for(var c=Object.keys(b),d=c.length;d--;)a[c[d]]=b[c[d]];return a}}).call(this,a("JkpR2F"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":47,JkpR2F:46,inherits:45}],49:[function(a,b,c){!function(d){"use strict";"function"==typeof a&&"object"==typeof c&&"object"==typeof b?b.exports=d:"function"==typeof define&&define.amd?define(function(){return d}):chai.use(d)}(function(a,b){"use strict";function c(a){return"function"==typeof a&&"function"==typeof a.getCall&&"function"==typeof a.calledWithExactly}function d(a){return 1===a?"once":2===a?"twice":3===a?"thrice":(a||0)+" times"}function e(a){return a&&c(a.proxy)}function f(a){if(!c(a._obj)&&!e(a._obj))throw new TypeError(b.inspect(a._obj)+" is not a spy or a call to a spy!")}function g(a,b,d,e,f){function g(b){return a.printf.apply(a,b)}var h=e?"always have ":"have ";return d=d||"",c(a.proxy)&&(a=a.proxy),{affirmative:g(["expected %n to "+h+b+d].concat(f)),negative:g(["expected %n to not "+h+b].concat(f))}}function h(c,d,e){b.addProperty(a.Assertion.prototype,c,function(){f(this);var a=g(this._obj,d,e,!1);this.assert(this._obj[c],a.affirmative,a.negative)})}function i(c,e,h){b.addMethod(a.Assertion.prototype,c,function(a){f(this);var b=g(this._obj,e,h,!1,[d(a)]);this.assert(this._obj[c]===a,b.affirmative,b.negative)})}function j(a,c,d){return function(){f(this);var e="always"+a[0].toUpperCase()+a.substring(1),h=b.flag(this,"always")&&"function"==typeof this._obj[e],i=h?e:a,j=g(this._obj,c,d,h,n.call(arguments));this.assert(this._obj[i].apply(this._obj,arguments),j.affirmative,j.negative)}}function k(c,d,e){var f=j(c,d,e);b.addProperty(a.Assertion.prototype,c,f)}function l(c,d,e,f){var g=j(d,e,f);b.addMethod(a.Assertion.prototype,c,g)}function m(a,b,c){l(a,a,b,c)}var n=Array.prototype.slice;b.addProperty(a.Assertion.prototype,"always",function(){b.flag(this,"always",!0)}),h("called","been called"," at least once, but it was never called"),i("callCount","been called exactly %1",", but it was called %c%C"),h("calledOnce","been called exactly once",", but it was called %c%C"),h("calledTwice","been called exactly twice",", but it was called %c%C"),h("calledThrice","been called exactly thrice",", but it was called %c%C"),k("calledWithNew","been called with new"),m("calledBefore","been called before %1"),m("calledAfter","been called after %1"),m("calledOn","been called with %1 as this",", but it was called with %t instead"),m("calledWith","been called with arguments %*","%C"),m("calledWithExactly","been called with exact arguments %*","%C"),m("calledWithMatch","been called with arguments matching %*","%C"),m("returned","returned %1"),l("thrown","threw","thrown %1")})},{}],50:[function(a,b,c){"use strict";!function(d){function e(a){var b=!1;try{a.appendChild(l),b=l.parentNode==a}catch(c){return!1}finally{try{a.removeChild(l)}catch(c){}}return b}function f(a){return l&&a&&1===a.nodeType&&e(a)}function g(a){return"function"==typeof a||!!(a&&a.constructor&&a.call&&a.apply)}function h(a){return"number"==typeof a&&isNaN(a)}function i(a,b){for(var c in b)m.call(a,c)||(a[c]=b[c])}function j(a){return"function"==typeof a&&"function"==typeof a.restore&&a.restore.sinon}function k(a,b,c){c.exports=n,n.spy=a("./sinon/spy"),n.spyCall=a("./sinon/call"),n.behavior=a("./sinon/behavior"),n.stub=a("./sinon/stub"),n.mock=a("./sinon/mock"),n.collection=a("./sinon/collection"),n.assert=a("./sinon/assert"),n.sandbox=a("./sinon/sandbox"),n.test=a("./sinon/test"),n.testCase=a("./sinon/test_case"),n.match=a("./sinon/match")}var l="undefined"!=typeof document&&document.createElement("div"),m=Object.prototype.hasOwnProperty,n={wrapMethod:function(a,b,c){if(!a)throw new TypeError("Should wrap property of object");if("function"!=typeof c)throw new TypeError("Method wrapper should be function");var d,e=a[b];if(g(e)){if(e.restore&&e.restore.sinon)d=new TypeError("Attempted to wrap "+b+" which is already wrapped");else if(e.calledBefore){var f=e.returns?"stubbed":"spied on";d=new TypeError("Attempted to wrap "+b+" which is already "+f)}}else d=new TypeError("Attempted to wrap "+typeof e+" property "+b+" as function");if(d)throw e&&e._stack&&(d.stack+="\n--------------\n"+e._stack),d;var h=a.hasOwnProperty?a.hasOwnProperty(b):m.call(a,b);return a[b]=c,c.displayName=b,c._stack=new Error("Stack Trace for original").stack,c.restore=function(){h||delete a[b],a[b]===c&&(a[b]=e)},c.restore.sinon=!0,i(c,e),c},extend:function(a){for(var b=1,c=arguments.length;c>b;b+=1)for(var d in arguments[b])arguments[b].hasOwnProperty(d)&&(a[d]=arguments[b][d]),arguments[b].hasOwnProperty("toString")&&arguments[b].toString!=a.toString&&(a.toString=arguments[b].toString);return a},create:function(a){var b=function(){};return b.prototype=a,new b},deepEqual:function t(a,b){if(n.match&&n.match.isMatcher(a))return a.test(b);if("object"!=typeof a||"object"!=typeof b)return h(a)&&h(b)?!0:a===b;if(f(a)||f(b))return a===b;if(a===b)return!0;if(null===a&&null!==b||null!==a&&null===b)return!1;if(a instanceof RegExp&&b instanceof RegExp)return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;var c=Object.prototype.toString.call(a);if(c!=Object.prototype.toString.call(b))return!1;if("[object Date]"==c)return a.valueOf()===b.valueOf();var d,e=0,g=0;if("[object Array]"==c&&a.length!==b.length)return!1;for(d in a){if(e+=1,!(d in b))return!1;if(!t(a[d],b[d]))return!1}for(d in b)g+=1;return e==g},functionName:function(a){var b=a.displayName||a.name;if(!b){var c=a.toString().match(/function ([^\s\(]+)/);b=c&&c[1]}return b},functionToString:function(){if(this.getCall&&this.callCount)for(var a,b,c=this.callCount;c--;){a=this.getCall(c).thisValue;for(b in a)if(a[b]===this)return b}return this.displayName||"sinon fake"},getConfig:function(a){var b={};a=a||{};var c=n.defaultConfig;for(var d in c)c.hasOwnProperty(d)&&(b[d]=a.hasOwnProperty(d)?a[d]:c[d]);return b},format:function(a){return""+a},defaultConfig:{injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},timesInWords:function(a){return 1==a&&"once"||2==a&&"twice"||3==a&&"thrice"||(a||0)+" times"},calledInOrder:function(a){for(var b=1,c=a.length;c>b;b++)if(!a[b-1].calledBefore(a[b])||!a[b].called)return!1;return!0},orderByFirstCall:function(a){return a.sort(function(a,b){var c=a.getCall(0),d=b.getCall(0),e=c&&c.callId||-1,f=d&&d.callId||-1;return f>e?-1:1})},log:function(){},logError:function(a,b){var c=a+" threw exception: ";n.log(c+"["+b.name+"] "+b.message),b.stack&&n.log(b.stack),setTimeout(function(){throw b.message=c+b.message,b},0)},typeOf:function(a){if(null===a)return"null";if(void 0===a)return"undefined";var b=Object.prototype.toString.call(a);return b.substring(8,b.length-1).toLowerCase()},createStubInstance:function(a){if("function"!=typeof a)throw new TypeError("The constructor should be a function.");return n.stub(n.create(a.prototype))},restore:function(a){if(null!==a&&"object"==typeof a)for(var b in a)j(a[b])&&a[b].restore();else j(a)&&a.restore()}},o="undefined"!=typeof b&&b.exports&&"function"==typeof a,p="function"==typeof define&&"object"==typeof define.amd&&define.amd;if(p)define(k);else if(o){try{d=a("formatio")}catch(q){}k(a,c,b)}if(d){var r=d.configure({quoteStrings:!1});n.format=function(){return r.ascii.apply(r,arguments)}}else if(o)try{var s=a("util");n.format=function(a){return"object"==typeof a&&a.toString===Object.prototype.toString?s.inspect(a):a}}catch(q){}return n}("object"==typeof formatio&&formatio)},{"./sinon/assert":51,"./sinon/behavior":52,"./sinon/call":53,"./sinon/collection":54,"./sinon/match":55,"./sinon/mock":56,"./sinon/sandbox":57,"./sinon/spy":58,"./sinon/stub":59,"./sinon/test":60,"./sinon/test_case":61,formatio:63,util:48}],51:[function(a,b){(function(c){"use strict";!function(c,d){function e(){for(var a,b=0,c=arguments.length;c>b;++b)a=arguments[b],a||i.fail("fake is not a spy"),"function"!=typeof a&&i.fail(a+" is not a function"),"function"!=typeof a.getCall&&i.fail(a+" is not stubbed")}function f(a,b){a=a||d;var c=a.fail||i.fail;c.call(a,b)}function g(a,b,c){2==arguments.length&&(c=b,b=a),i[a]=function(d){e(d);var g=k.call(arguments,1),h=!1;h="function"==typeof b?!b(d):"function"==typeof d[b]?!d[b].apply(d,g):!d[b],h?f(this,d.printf.apply(d,[c].concat(g))):i.pass(a)}}function h(a,b){return!a||/^fail/.test(b)?b:a+b.slice(0,1).toUpperCase()+b.slice(1)}var i,j="undefined"!=typeof b&&b.exports&&"function"==typeof a,k=Array.prototype.slice;!c&&j&&(c=a("../sinon")),c&&(i={failException:"AssertError",fail:function(a){var b=new Error(a);throw b.name=this.failException||i.failException,b},pass:function(){},callOrder:function(){e.apply(null,arguments);var a="",b="";if(c.calledInOrder(arguments))i.pass("callOrder");else{try{a=[].join.call(arguments,", ");for(var d=k.call(arguments),g=d.length;g;)d[--g].called||d.splice(g,1);b=c.orderByFirstCall(d).join(", ")}catch(h){}f(this,"expected "+a+" to be called in order but were called as "+b)}},callCount:function(a,b){if(e(a),a.callCount!=b){var d="expected %n to be called "+c.timesInWords(b)+" but was called %c%C";f(this,a.printf(d))}else i.pass("callCount")},expose:function(a,b){if(!a)throw new TypeError("target is null or undefined");var c=b||{},d="undefined"==typeof c.prefix&&"assert"||c.prefix,e="undefined"==typeof c.includeFail||!!c.includeFail;for(var f in this)"export"==f||!e&&/^(fail)/.test(f)||(a[h(d,f)]=this[f]);return a},match:function(a,b){var d=c.match(b);if(d.test(a))i.pass("match");else{var e=["expected value to match"," expected = "+c.format(b)," actual = "+c.format(a)];f(this,e.join("\n"))}}},g("called","expected %n to have been called at least once but was never called"),g("notCalled",function(a){return!a.called},"expected %n to not have been called but was called %c%C"),g("calledOnce","expected %n to be called once but was called %c%C"),g("calledTwice","expected %n to be called twice but was called %c%C"),g("calledThrice","expected %n to be called thrice but was called %c%C"),g("calledOn","expected %n to be called with %1 as this but was called with %t"),g("alwaysCalledOn","expected %n to always be called with %1 as this but was called with %t"),g("calledWithNew","expected %n to be called with new"),g("alwaysCalledWithNew","expected %n to always be called with new"),g("calledWith","expected %n to be called with arguments %*%C"),g("calledWithMatch","expected %n to be called with match %*%C"),g("alwaysCalledWith","expected %n to always be called with arguments %*%C"),g("alwaysCalledWithMatch","expected %n to always be called with match %*%C"),g("calledWithExactly","expected %n to be called with exact arguments %*%C"),g("alwaysCalledWithExactly","expected %n to always be called with exact arguments %*%C"),g("neverCalledWith","expected %n to never be called with arguments %*%C"),g("neverCalledWithMatch","expected %n to never be called with match %*%C"),g("threw","%n did not throw exception%C"),g("alwaysThrew","%n did not always throw exception%C"),c.assert=i,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=i}):j&&(b.exports=i))}("object"==typeof sinon&&sinon||null,"undefined"!=typeof window?window:"undefined"!=typeof self?self:c)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../sinon":50}],52:[function(a,b){(function(c){"use strict";!function(d){function e(a,b){return"string"==typeof a?(this.exception=new Error(b||""),this.exception.name=a):this.exception=a?a:new Error("Error"),this}function f(a,b){var c=a.callArgAt;if(0>c){for(var d=a.callArgProp,e=0,f=b.length;f>e;++e){if(!d&&"function"==typeof b[e])return b[e];if(d&&b[e]&&"function"==typeof b[e][d])return b[e][d]}return null}return b[c]}function g(a,b,c){if(a.callArgAt<0){var e;return e=a.callArgProp?d.functionName(a.stub)+" expected to yield to '"+a.callArgProp+"', but no object with such a property was passed.":d.functionName(a.stub)+" expected to yield, but no callback was passed.",c.length>0&&(e+=" Received ["+l.call(c,", ")+"]"),e}return"argument at index "+a.callArgAt+" is not a function: "+b}function h(a,b){if("number"==typeof a.callArgAt){var c=f(a,b);if("function"!=typeof c)throw new TypeError(g(a,c,b));a.callbackAsync?m(function(){c.apply(a.callbackContext,a.callbackArguments)}):c.apply(a.callbackContext,a.callbackArguments)}}var i="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!d&&i&&(d=a("../sinon")),d){var j,k=Array.prototype.slice,l=Array.prototype.join,m=function(){return"object"==typeof c&&"function"==typeof c.nextTick?c.nextTick:"function"==typeof setImmediate?setImmediate:function(a){setTimeout(a,0)}}();j={create:function(a){var b=d.extend({},d.behavior);return delete b.create,b.stub=a,b},isPresent:function(){return"number"==typeof this.callArgAt||this.exception||"number"==typeof this.returnArgAt||this.returnThis||this.returnValueDefined},invoke:function(a,b){if(h(this,b),this.exception)throw this.exception;return"number"==typeof this.returnArgAt?b[this.returnArgAt]:this.returnThis?a:this.returnValue},onCall:function(a){return this.stub.onCall(a)},onFirstCall:function(){return this.stub.onFirstCall()},onSecondCall:function(){return this.stub.onSecondCall()},onThirdCall:function(){return this.stub.onThirdCall()},withArgs:function(){throw new Error('Defining a stub by invoking "stub.onCall(...).withArgs(...)" is not supported. Use "stub.withArgs(...).onCall(...)" to define sequential behavior for calls with certain arguments.')},callsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOn:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgWith:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.callArgAt=a,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOnWith:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},yields:function(){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,0),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsOn:function(a){if("object"!=typeof a)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=a,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsTo:function(a){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=a,this.callbackAsync=!1,this},yieldsToOn:function(a,b){if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=a,this.callbackAsync=!1,this},"throws":e,throwsException:e,returns:function(a){return this.returnValue=a,this.returnValueDefined=!0,this},returnsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.returnArgAt=a,this},returnsThis:function(){return this.returnThis=!0,this}};for(var n in j)j.hasOwnProperty(n)&&n.match(/^(callsArg|yields)/)&&!n.match(/Async/)&&(j[n+"Async"]=function(a){return function(){var b=this[a].apply(this,arguments);return this.callbackAsync=!0,b}}(n));d.behavior=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):i&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)}).call(this,a("JkpR2F"))},{"../sinon":50,JkpR2F:46}],53:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.functionName(a)+b;throw d.length&&(e+=" Received ["+g.call(d).join(", ")+"]"),new Error(e)}function e(a,b,d,e,f,g){if("number"!=typeof g)throw new TypeError("Call id is not a number");var i=c.create(h);return i.proxy=a,i.thisValue=b,i.args=d,i.returnValue=e,i.exception=f,i.callId=g,i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&f&&(c=a("../sinon")),c){var g=Array.prototype.slice,h={calledOn:function(a){return c.match&&c.match.isMatcher(a)?a.test(this.thisValue):this.thisValue===a},calledWith:function(){for(var a=0,b=arguments.length;b>a;a+=1)if(!c.deepEqual(arguments[a],this.args[a]))return!1;return!0},calledWithMatch:function(){for(var a=0,b=arguments.length;b>a;a+=1){var d=this.args[a],e=arguments[a];if(!c.match||!c.match(e).test(d))return!1}return!0},calledWithExactly:function(){return arguments.length==this.args.length&&this.calledWith.apply(this,arguments)},notCalledWith:function(){return!this.calledWith.apply(this,arguments)},notCalledWithMatch:function(){return!this.calledWithMatch.apply(this,arguments)},returned:function(a){return c.deepEqual(a,this.returnValue)},threw:function(a){return"undefined"!=typeof a&&this.exception?this.exception===a||this.exception.name===a:!!this.exception},calledWithNew:function(){return this.proxy.prototype&&this.thisValue instanceof this.proxy},calledBefore:function(a){return this.callId<a.callId},calledAfter:function(a){return this.callId>a.callId},callArg:function(a){this.args[a]()},callArgOn:function(a,b){this.args[a].apply(b)},callArgWith:function(a){this.callArgOnWith.apply(this,[a,null].concat(g.call(arguments,1)))},callArgOnWith:function(a,b){var c=g.call(arguments,2);this.args[a].apply(b,c)},"yield":function(){this.yieldOn.apply(this,[null].concat(g.call(arguments,0)))},yieldOn:function(a){for(var b=this.args,c=0,e=b.length;e>c;++c)if("function"==typeof b[c])return void b[c].apply(a,g.call(arguments,1));d(this.proxy," cannot yield since no callback was passed.",b)},yieldTo:function(a){this.yieldToOn.apply(this,[a,null].concat(g.call(arguments,1)))},yieldToOn:function(a,b){for(var c=this.args,e=0,f=c.length;f>e;++e)if(c[e]&&"function"==typeof c[e][a])return void c[e][a].apply(b,g.call(arguments,2));d(this.proxy," cannot yield to '"+a+"' since no callback was passed.",c)},toString:function(){for(var a=this.proxy.toString()+"(",b=[],d=0,e=this.args.length;e>d;++d)b.push(c.format(this.args[d]));return a=a+b.join(", ")+")","undefined"!=typeof this.returnValue&&(a+=" => "+c.format(this.returnValue)),this.exception&&(a+=" !"+this.exception.name,this.exception.message&&(a+="("+this.exception.message+")")),a}};h.invokeCallback=h.yield,e.toString=h.toString,c.spyCall=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],54:[function(a,b){"use strict";!function(c){function d(a){return a.fakes||(a.fakes=[]),a.fakes}function e(a,b){for(var c=d(a),e=0,f=c.length;f>e;e+=1)"function"==typeof c[e][b]&&c[e][b]()}function f(a){for(var b=d(a),c=0;c<b.length;)b.splice(c,1)}var g="undefined"!=typeof b&&b.exports&&"function"==typeof a,h=[].push,i=Object.prototype.hasOwnProperty;if(!c&&g&&(c=a("../sinon")),c){var j={verify:function(){e(this,"verify")},restore:function(){e(this,"restore"),f(this)},verifyAndRestore:function(){var a;try{this.verify()}catch(b){a=b}if(this.restore(),a)throw a},add:function(a){return h.call(d(this),a),a},spy:function(){return this.add(c.spy.apply(c,arguments))},stub:function(a,b,d){if(b){var e=a[b];if("function"!=typeof e){if(!i.call(a,b))throw new TypeError("Cannot stub non-existent own property "+b);return a[b]=d,this.add({restore:function(){a[b]=e}})}}if(!b&&a&&"object"==typeof a){var f=c.stub.apply(c,arguments);for(var g in f)"function"==typeof f[g]&&this.add(f[g]);return f}return this.add(c.stub.apply(c,arguments))},mock:function(){return this.add(c.mock.apply(c,arguments))},inject:function(a){var b=this;return a.spy=function(){return b.spy.apply(b,arguments)},a.stub=function(){return b.stub.apply(b,arguments)},a.mock=function(){return b.mock.apply(b,arguments)},a}};c.collection=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):g&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],55:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.typeOf(a);if(e!==b)throw new TypeError("Expected type of "+d+" to be "+b+", but was "+e)}function e(a){return i.isPrototypeOf(a)}function f(a,b){if(null===b||void 0===b)return!1;for(var d in a)if(a.hasOwnProperty(d)){var e=a[d],g=b[d];if(j.isMatcher(e)){if(!e.test(g))return!1}else if("object"===c.typeOf(e)){if(!f(e,g))return!1}else if(!c.deepEqual(e,g))return!1}return!0}function g(a,b){return function(e,f){d(e,"string","property");var g=1===arguments.length,h=b+'("'+e+'"';return g||(h+=", "+f),h+=")",j(function(b){return void 0!==b&&null!==b&&a(b,e)?g||c.deepEqual(f,b[e]):!1},h)}}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i={toString:function(){return this.message}};i.or=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)||a.test(c)},d.message=b.message+".or("+a.message+")",d},i.and=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)&&a.test(c)},d.message=b.message+".and("+a.message+")",d};var j=function(a,b){var d=c.create(i),e=c.typeOf(a);switch(e){case"object":if("function"==typeof a.test)return d.test=function(b){return a.test(b)===!0},d.message="match("+c.functionName(a.test)+")",d;var g=[];for(var h in a)a.hasOwnProperty(h)&&g.push(h+": "+a[h]);d.test=function(b){return f(a,b)},d.message="match("+g.join(", ")+")";break;case"number":d.test=function(b){return a==b};break;case"string":d.test=function(b){return"string"!=typeof b?!1:-1!==b.indexOf(a)},d.message='match("'+a+'")';break;case"regexp":d.test=function(b){return"string"!=typeof b?!1:a.test(b)};break;case"function":d.test=a,d.message=b?b:"match("+c.functionName(a)+")";break;default:d.test=function(b){return c.deepEqual(a,b)}}return d.message||(d.message="match("+a+")"),d};j.isMatcher=e,j.any=j(function(){return!0},"any"),j.defined=j(function(a){return null!==a&&void 0!==a},"defined"),j.truthy=j(function(a){return!!a},"truthy"),j.falsy=j(function(a){return!a},"falsy"),j.same=function(a){return j(function(b){return a===b},"same("+a+")")},j.typeOf=function(a){return d(a,"string","type"),j(function(b){return c.typeOf(b)===a},'typeOf("'+a+'")')},j.instanceOf=function(a){return d(a,"function","type"),j(function(b){return b instanceof a},"instanceOf("+c.functionName(a)+")")},j.has=g(function(a,b){return"object"==typeof a?b in a:void 0!==a[b]},"has"),j.hasOwn=g(function(a,b){return a.hasOwnProperty(b)},"hasOwn"),j.bool=j.typeOf("boolean"),j.number=j.typeOf("number"),j.string=j.typeOf("string"),j.object=j.typeOf("object"),j.func=j.typeOf("function"),j.array=j.typeOf("array"),j.regexp=j.typeOf("regexp"),j.date=j.typeOf("date"),c.match=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):h&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],56:[function(a,b){"use strict";!function(c){function d(a){return a?d.create(a):c.expectation.create("Anonymous mock")}var e,f="undefined"!=typeof b&&b.exports&&"function"==typeof a,g=[].push;if(!c&&f&&(c=a("../sinon")),c){e=c.match,!e&&f&&(e=a("./match")),c.mock=d,c.extend(d,function(){function a(a,b){if(a)for(var c=0,d=a.length;d>c;c+=1)b(a[c])}return{create:function(a){if(!a)throw new TypeError("object is null");var b=c.extend({},d);return b.object=a,delete b.create,b},expects:function(a){if(!a)throw new TypeError("method is falsy");
|
||
if(this.expectations||(this.expectations={},this.proxies=[]),!this.expectations[a]){this.expectations[a]=[];var b=this;c.wrapMethod(this.object,a,function(){return b.invokeMethod(a,this,arguments)}),g.call(this.proxies,a)}var d=c.expectation.create(a);return g.call(this.expectations[a],d),d},restore:function(){var b=this.object;a(this.proxies,function(a){"function"==typeof b[a].restore&&b[a].restore()})},verify:function(){var b=this.expectations||{},d=[],e=[];return a(this.proxies,function(c){a(b[c],function(a){a.met()?g.call(e,a.toString()):g.call(d,a.toString())})}),this.restore(),d.length>0?c.expectation.fail(d.concat(e).join("\n")):c.expectation.pass(d.concat(e).join("\n")),!0},invokeMethod:function(a,b,d){var e,f=this.expectations&&this.expectations[a],h=f&&f.length||0;for(e=0;h>e;e+=1)if(!f[e].met()&&f[e].allowsCall(b,d))return f[e].apply(b,d);var i,j=[],k=0;for(e=0;h>e;e+=1)f[e].allowsCall(b,d)?i=i||f[e]:k+=1,g.call(j," "+f[e].toString());return 0===k?i.apply(b,d):(j.unshift("Unexpected call: "+c.spyCall.toString.call({proxy:a,args:d})),void c.expectation.fail(j.join("\n")))}}}());var h=c.timesInWords;c.expectation=function(){function a(a){return 0==a?"never called":"called "+h(a)}function b(a){var b=a.minCalls,c=a.maxCalls;if("number"==typeof b&&"number"==typeof c){var d=h(b);return b!=c&&(d="at least "+d+" and at most "+h(c)),d}return"number"==typeof b?"at least "+h(b):"at most "+h(c)}function d(a){var b="number"==typeof a.minCalls;return!b||a.callCount>=a.minCalls}function f(a){return"number"!=typeof a.maxCalls?!1:a.callCount==a.maxCalls}function i(a,b){return e&&e.isMatcher(a)?a.test(b):!0}var j=Array.prototype.slice,k=c.spy.invoke;return{minCalls:1,maxCalls:1,create:function(a){var b=c.extend(c.stub.create(),c.expectation);return delete b.create,b.method=a,b},invoke:function(a,b,c){return this.verifyCallAllowed(b,c),k.apply(this,arguments)},atLeast:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");return this.limitsSet||(this.maxCalls=null,this.limitsSet=!0),this.minCalls=a,this},atMost:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");return this.limitsSet||(this.minCalls=null,this.limitsSet=!0),this.maxCalls=a,this},never:function(){return this.exactly(0)},once:function(){return this.exactly(1)},twice:function(){return this.exactly(2)},thrice:function(){return this.exactly(3)},exactly:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not a number");return this.atLeast(a),this.atMost(a)},met:function(){return!this.failed&&d(this)},verifyCallAllowed:function(a,b){if(f(this)&&(this.failed=!0,c.expectation.fail(this.method+" already called "+h(this.maxCalls))),"expectedThis"in this&&this.expectedThis!==a&&c.expectation.fail(this.method+" called with "+a+" as thisValue, expected "+this.expectedThis),"expectedArguments"in this){b||c.expectation.fail(this.method+" received no arguments, expected "+c.format(this.expectedArguments)),b.length<this.expectedArguments.length&&c.expectation.fail(this.method+" received too few arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments)),this.expectsExactArgCount&&b.length!=this.expectedArguments.length&&c.expectation.fail(this.method+" received too many arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments));for(var d=0,e=this.expectedArguments.length;e>d;d+=1)i(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", didn't match "+this.expectedArguments.toString()),c.deepEqual(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", expected "+c.format(this.expectedArguments))}},allowsCall:function(a,b){if(this.met()&&f(this))return!1;if("expectedThis"in this&&this.expectedThis!==a)return!1;if(!("expectedArguments"in this))return!0;if(b=b||[],b.length<this.expectedArguments.length)return!1;if(this.expectsExactArgCount&&b.length!=this.expectedArguments.length)return!1;for(var d=0,e=this.expectedArguments.length;e>d;d+=1){if(!i(this.expectedArguments[d],b[d]))return!1;if(!c.deepEqual(this.expectedArguments[d],b[d]))return!1}return!0},withArgs:function(){return this.expectedArguments=j.call(arguments),this},withExactArgs:function(){return this.withArgs.apply(this,arguments),this.expectsExactArgCount=!0,this},on:function(a){return this.expectedThis=a,this},toString:function(){var d=(this.expectedArguments||[]).slice();this.expectsExactArgCount||g.call(d,"[...]");var e=c.spyCall.toString.call({proxy:this.method||"anonymous mock expectation",args:d}),f=e.replace(", [...","[, ...")+" "+b(this);return this.met()?"Expectation met: "+f:"Expected "+f+" ("+a(this.callCount)+")"},verify:function(){return this.met()?c.expectation.pass(this.toString()):c.expectation.fail(this.toString()),!0},pass:function(a){c.assert.pass(a)},fail:function(a){var b=new Error(a);throw b.name="ExpectationError",b}}}(),c.mock=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):f&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50,"./match":55}],57:[function(a,b){"use strict";if("undefined"!=typeof b&&b.exports&&"function"==typeof a){var c=a("../sinon");c.extend(c,a("./util/fake_timers"))}!function(){function a(a,b,c,d){d&&(!b.injectInto||c in b.injectInto?e.call(a.args,d):(b.injectInto[c]=d,a.injectedKeys.push(c)))}function d(a){var b=c.create(c.sandbox);return a.useFakeServer&&("object"==typeof a.useFakeServer&&(b.serverPrototype=a.useFakeServer),b.useFakeServer()),a.useFakeTimers&&("object"==typeof a.useFakeTimers?b.useFakeTimers.apply(b,a.useFakeTimers):b.useFakeTimers()),b}var e=[].push;c.sandbox=c.extend(c.create(c.collection),{useFakeTimers:function(){return this.clock=c.useFakeTimers.apply(c,arguments),this.add(this.clock)},serverPrototype:c.fakeServer,useFakeServer:function(){var a=this.serverPrototype||c.fakeServer;return a&&a.create?(this.server=a.create(),this.add(this.server)):null},inject:function(a){return c.collection.inject.call(this,a),this.clock&&(a.clock=this.clock),this.server&&(a.server=this.server,a.requests=this.server.requests),a},restore:function(){c.collection.restore.apply(this,arguments),this.restoreContext()},restoreContext:function(){if(this.injectedKeys){for(var a=0,b=this.injectedKeys.length;b>a;a++)delete this.injectInto[this.injectedKeys[a]];this.injectedKeys=[]}},create:function(b){if(!b)return c.create(c.sandbox);var e=d(b);e.args=e.args||[],e.injectedKeys=[],e.injectInto=b.injectInto;var f,g,h=e.inject({});if(b.properties)for(var i=0,j=b.properties.length;j>i;i++)f=b.properties[i],g=h[f]||"sandbox"==f&&e,a(e,b,f,g);else a(e,b,"sandbox",g);return e}}),c.sandbox.useFakeXMLHttpRequest=c.sandbox.useFakeServer,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=c.sandbox}):"undefined"!=typeof b&&b.exports&&(b.exports=c.sandbox)}()},{"../sinon":50,"./util/fake_timers":62}],58:[function(require,module,exports){"use strict";!function(sinon){function spy(a,b){if(!b&&"function"==typeof a)return spy.create(a);if(!a&&!b)return spy.create(function(){});var c=a[b];return sinon.wrapMethod(a,b,spy.create(c))}function matchingFake(a,b,c){if(a)for(var d=0,e=a.length;e>d;d++)if(a[d].matches(b,c))return a[d]}function incrementCallCount(){this.called=!0,this.callCount+=1,this.notCalled=!1,this.calledOnce=1==this.callCount,this.calledTwice=2==this.callCount,this.calledThrice=3==this.callCount}function createCallProperties(){this.firstCall=this.getCall(0),this.secondCall=this.getCall(1),this.thirdCall=this.getCall(2),this.lastCall=this.getCall(this.callCount-1)}function createProxy(func){var p;return func.length?eval("p = (function proxy("+vars.substring(0,2*func.length-1)+") { return p.invoke(func, this, slice.call(arguments)); });"):p=function(){return p.invoke(func,this,slice.call(arguments))},p}function delegateToCalls(a,b,c,d){spyApi[a]=function(){if(!this.called)return d?d.apply(this,arguments):!1;for(var e,f=0,g=0,h=this.callCount;h>g;g+=1)if(e=this.getCall(g),e[c||a].apply(e,arguments)&&(f+=1,b))return!0;return f===this.callCount}}var commonJSModule="undefined"!=typeof module&&module.exports&&"function"==typeof require,push=Array.prototype.push,slice=Array.prototype.slice,callId=0;if(!sinon&&commonJSModule&&(sinon=require("../sinon")),sinon){var vars="a,b,c,d,e,f,g,h,i,j,k,l",uuid=0,spyApi={reset:function(){if(this.called=!1,this.notCalled=!0,this.calledOnce=!1,this.calledTwice=!1,this.calledThrice=!1,this.callCount=0,this.firstCall=null,this.secondCall=null,this.thirdCall=null,this.lastCall=null,this.args=[],this.returnValues=[],this.thisValues=[],this.exceptions=[],this.callIds=[],this.fakes)for(var a=0;a<this.fakes.length;a++)this.fakes[a].reset()},create:function(a){var b;"function"!=typeof a?a=function(){}:b=sinon.functionName(a);var c=createProxy(a);return sinon.extend(c,spy),delete c.create,sinon.extend(c,a),c.reset(),c.prototype=a.prototype,c.displayName=b||"spy",c.toString=sinon.functionToString,c._create=sinon.spy.create,c.id="spy#"+uuid++,c},invoke:function(a,b,c){var d,e,f=matchingFake(this.fakes,c);incrementCallCount.call(this),push.call(this.thisValues,b),push.call(this.args,c),push.call(this.callIds,callId++),createCallProperties.call(this);try{e=f?f.invoke(a,b,c):(this.func||a).apply(b,c);var g=this.getCall(this.callCount-1);g.calledWithNew()&&"object"!=typeof e&&(e=b)}catch(h){d=h}if(push.call(this.exceptions,d),push.call(this.returnValues,e),createCallProperties.call(this),void 0!==d)throw d;return e},named:function(a){return this.displayName=a,this},getCall:function(a){return 0>a||a>=this.callCount?null:sinon.spyCall(this,this.thisValues[a],this.args[a],this.returnValues[a],this.exceptions[a],this.callIds[a])},getCalls:function(){var a,b=[];for(a=0;a<this.callCount;a++)b.push(this.getCall(a));return b},calledBefore:function(a){return this.called?a.called?this.callIds[0]<a.callIds[a.callIds.length-1]:!0:!1},calledAfter:function(a){return this.called&&a.called?this.callIds[this.callCount-1]>a.callIds[a.callCount-1]:!1},withArgs:function(){var a=slice.call(arguments);if(this.fakes){var b=matchingFake(this.fakes,a,!0);if(b)return b}else this.fakes=[];var c=this,d=this._create();d.matchingAguments=a,d.parent=this,push.call(this.fakes,d),d.withArgs=function(){return c.withArgs.apply(c,arguments)};for(var e=0;e<this.args.length;e++)d.matches(this.args[e])&&(incrementCallCount.call(d),push.call(d.thisValues,this.thisValues[e]),push.call(d.args,this.args[e]),push.call(d.returnValues,this.returnValues[e]),push.call(d.exceptions,this.exceptions[e]),push.call(d.callIds,this.callIds[e]));return createCallProperties.call(d),d},matches:function(a,b){var c=this.matchingAguments;return c.length<=a.length&&sinon.deepEqual(c,a.slice(0,c.length))?!b||c.length==a.length:void 0},printf:function(a){var b,c=this,d=slice.call(arguments,1);return(a||"").replace(/%(.)/g,function(a,e){return b=spyApi.formatters[e],"function"==typeof b?b.call(null,c,d):isNaN(parseInt(e,10))?"%"+e:sinon.format(d[e-1])})}};delegateToCalls("calledOn",!0),delegateToCalls("alwaysCalledOn",!1,"calledOn"),delegateToCalls("calledWith",!0),delegateToCalls("calledWithMatch",!0),delegateToCalls("alwaysCalledWith",!1,"calledWith"),delegateToCalls("alwaysCalledWithMatch",!1,"calledWithMatch"),delegateToCalls("calledWithExactly",!0),delegateToCalls("alwaysCalledWithExactly",!1,"calledWithExactly"),delegateToCalls("neverCalledWith",!1,"notCalledWith",function(){return!0}),delegateToCalls("neverCalledWithMatch",!1,"notCalledWithMatch",function(){return!0}),delegateToCalls("threw",!0),delegateToCalls("alwaysThrew",!1,"threw"),delegateToCalls("returned",!0),delegateToCalls("alwaysReturned",!1,"returned"),delegateToCalls("calledWithNew",!0),delegateToCalls("alwaysCalledWithNew",!1,"calledWithNew"),delegateToCalls("callArg",!1,"callArgWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")}),spyApi.callArgWith=spyApi.callArg,delegateToCalls("callArgOn",!1,"callArgOnWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")}),spyApi.callArgOnWith=spyApi.callArgOn,delegateToCalls("yield",!1,"yield",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),spyApi.invokeCallback=spyApi.yield,delegateToCalls("yieldOn",!1,"yieldOn",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),delegateToCalls("yieldTo",!1,"yieldTo",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),delegateToCalls("yieldToOn",!1,"yieldToOn",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),spyApi.formatters={c:function(a){return sinon.timesInWords(a.callCount)},n:function(a){return a.toString()},C:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c){var e=" "+a.getCall(c).toString();/\n/.test(b[c-1])&&(e="\n"+e),push.call(b,e)}return b.length>0?"\n"+b.join("\n"):""},t:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c)push.call(b,sinon.format(a.thisValues[c]));return b.join(", ")},"*":function(a,b){for(var c=[],d=0,e=b.length;e>d;++d)push.call(c,sinon.format(b[d]));return c.join(", ")}},sinon.extend(spy,spyApi),spy.spyCall=sinon.spyCall,sinon.spy=spy,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=spy}):commonJSModule&&(module.exports=spy)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],59:[function(a,b){"use strict";!function(c){function d(a,b,e){if(e&&"function"!=typeof e)throw new TypeError("Custom stub should be function");var f;if(f=e?c.spy&&c.spy.create?c.spy.create(e):e:d.create(),!a&&"undefined"==typeof b)return c.stub.create();if("undefined"==typeof b&&"object"==typeof a){for(var g in a)"function"==typeof a[g]&&d(a,g);return a}return c.wrapMethod(a,b,f)}function e(a){return a.defaultBehavior||f(a)||c.behavior.create(a)}function f(a){return a.parent&&g(a.parent)}function g(a){var b=a.behaviors[a.callCount-1];return b&&b.isPresent()?b:e(a)}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i=0;c.extend(d,function(){var a={create:function(){var a=function(){return g(a).invoke(this,arguments)};a.id="stub#"+i++;var b=a;return a=c.spy.create(a),a.func=b,c.extend(a,d),a._create=c.stub.create,a.displayName="stub",a.toString=c.functionToString,a.defaultBehavior=null,a.behaviors=[],a},resetBehavior:function(){var a;if(this.defaultBehavior=null,this.behaviors=[],delete this.returnValue,delete this.returnArgAt,this.returnThis=!1,this.fakes)for(a=0;a<this.fakes.length;a++)this.fakes[a].resetBehavior()},onCall:function(a){return this.behaviors[a]||(this.behaviors[a]=c.behavior.create(this)),this.behaviors[a]},onFirstCall:function(){return this.onCall(0)},onSecondCall:function(){return this.onCall(1)},onThirdCall:function(){return this.onCall(2)}};for(var b in c.behavior)c.behavior.hasOwnProperty(b)&&!a.hasOwnProperty(b)&&"create"!=b&&"withArgs"!=b&&"invoke"!=b&&(a[b]=function(a){return function(){return this.defaultBehavior=this.defaultBehavior||c.behavior.create(this),this.defaultBehavior[a].apply(this.defaultBehavior,arguments),this}}(b));return a}()),c.stub=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):h&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],60:[function(a,b){"use strict";!function(c){function d(a){function b(){var b=c.getConfig(c.config);b.injectInto=b.injectIntoThis&&this||b.injectInto;var d,e,f=c.sandbox.create(b),g=Array.prototype.slice.call(arguments).concat(f.args);try{e=a.apply(this,g)}catch(h){d=h}if("undefined"!=typeof d)throw f.restore(),d;return f.verifyAndRestore(),e}var d=typeof a;if("function"!=d)throw new TypeError("sinon.test needs to wrap a test function, got "+d);return a.length?function(){return b.apply(this,arguments)}:b}var e="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&e&&(c=a("../sinon")),c&&(d.config={injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},c.test=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):e&&(b.exports=d))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],61:[function(a,b){"use strict";!function(c){function d(a,b,c){return function(){b&&b.apply(this,arguments);var d,e;try{e=a.apply(this,arguments)}catch(f){d=f}if(c&&c.apply(this,arguments),d)throw d;return e}}function e(a,b){if(!a||"object"!=typeof a)throw new TypeError("sinon.testCase needs an object with test functions");b=b||"test";var e,f,g,h=new RegExp("^"+b),i={},j=a.setUp,k=a.tearDown;for(e in a)if(a.hasOwnProperty(e)){if(f=a[e],/^(setUp|tearDown)$/.test(e))continue;"function"==typeof f&&h.test(e)?(g=f,(j||k)&&(g=d(f,j,k)),i[e]=c.test(g)):i[e]=a[e]}return i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&f&&(c=a("../sinon")),c&&Object.prototype.hasOwnProperty&&(c.testCase=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],62:[function(require,module,exports){(function(global){"use strict";if("undefined"==typeof sinon)var sinon={};!function(global){function addTimer(a,b){if(0===a.length)throw new Error("Function requires at least 1 parameter");if("undefined"==typeof a[0])throw new Error("Callback must be provided to timer calls");var c=id++,d=a[1]||0;return this.timeouts||(this.timeouts={}),this.timeouts[c]={id:c,func:a[0],callAt:this.now+d,invokeArgs:Array.prototype.slice.call(a,2)},b===!0&&(this.timeouts[c].interval=d),addTimerReturnsObject?{id:c,ref:function(){},unref:function(){}}:c}function parseTime(a){if(!a)return 0;var b,c=a.split(":"),d=c.length,e=d,f=0;if(d>3||!/^(\d\d:){0,2}\d\d?$/.test(a))throw new Error("tick only understands numbers and 'h:m:s'");for(;e--;){if(b=parseInt(c[e],10),b>=60)throw new Error("Invalid time "+a);f+=b*Math.pow(60,d-e-1)}return 1e3*f}function createObject(a){var b;if(Object.create)b=Object.create(a);else{var c=function(){};c.prototype=a,b=new c}return b.Date.clock=b,b}function mirrorDateProperties(a,b){b.now?a.now=function(){return a.clock.now}:delete a.now,b.toSource?a.toSource=function(){return b.toSource()}:delete a.toSource,a.toString=function(){return b.toString()},a.prototype=b.prototype,a.parse=b.parse,a.UTC=b.UTC,a.prototype.toUTCString=b.prototype.toUTCString;for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function restore(){for(var a,b=0,c=this.methods.length;c>b;b++)if(a=this.methods[b],global[a].hadOwnProperty)global[a]=this["_"+a];else try{delete global[a]}catch(d){}this.methods=[]}function stubGlobal(a,b){if(b[a].hadOwnProperty=Object.prototype.hasOwnProperty.call(global,a),b["_"+a]=global[a],"Date"==a){var c=mirrorDateProperties(b[a],global[a]);global[a]=c}else{global[a]=function(){return b[a].apply(b,arguments)};for(var d in b[a])b[a].hasOwnProperty(d)&&(global[a][d]=b[a][d])}global[a].clock=b}var timeoutResult=setTimeout(function(){},0),addTimerReturnsObject="object"==typeof timeoutResult;clearTimeout(timeoutResult);var id=1;sinon.clock={now:0,create:function(a){var b=createObject(this);if("number"==typeof a&&(b.now=a),a&&"object"==typeof a)throw new TypeError("now should be milliseconds since UNIX epoch");return b},setTimeout:function(){return addTimer.call(this,arguments,!1)},clearTimeout:function(a){a&&(this.timeouts||(this.timeouts=[]),"object"==typeof a&&(a=a.id),a in this.timeouts&&delete this.timeouts[a])},setInterval:function(){return addTimer.call(this,arguments,!0)},clearInterval:function(a){this.clearTimeout(a)},setImmediate:function(a){var b=Array.prototype.slice.call(arguments,1);return addTimer.call(this,[a,0].concat(b),!1)},clearImmediate:function(a){this.clearTimeout(a)},tick:function(a){a="number"==typeof a?a:parseTime(a);for(var b,c=this.now,d=this.now+a,e=this.now,f=this.firstTimerInRange(c,d);f&&d>=c;){if(this.timeouts[f.id]){c=this.now=f.callAt;try{this.callTimer(f)}catch(g){b=b||g}}f=this.firstTimerInRange(e,d),e=c}if(this.now=d,b)throw b;return this.now},firstTimerInRange:function(a,b){var c,d,e=null;for(var f in this.timeouts)if(this.timeouts.hasOwnProperty(f)){if(this.timeouts[f].callAt<a||this.timeouts[f].callAt>b)continue;(null===e||this.timeouts[f].callAt<e)&&(d=this.timeouts[f],e=this.timeouts[f].callAt,c={func:this.timeouts[f].func,callAt:this.timeouts[f].callAt,interval:this.timeouts[f].interval,id:this.timeouts[f].id,invokeArgs:this.timeouts[f].invokeArgs})}return c||null},callTimer:function(timer){"number"==typeof timer.interval?this.timeouts[timer.id].callAt+=timer.interval:delete this.timeouts[timer.id];try{"function"==typeof timer.func?timer.func.apply(null,timer.invokeArgs):eval(timer.func)}catch(e){var exception=e}if(this.timeouts[timer.id]){if(exception)throw exception}else if(exception)throw exception},reset:function(){this.timeouts={}},Date:function(){function a(c,d,e,f,g,h,i){switch(arguments.length){case 0:return new b(a.clock.now);case 1:return new b(c);case 2:return new b(c,d);case 3:return new b(c,d,e);case 4:return new b(c,d,e,f);case 5:return new b(c,d,e,f,g);case 6:return new b(c,d,e,f,g,h);default:return new b(c,d,e,f,g,h,i)}}var b=Date;return mirrorDateProperties(a,b)}()};var methods=["Date","setTimeout","setInterval","clearTimeout","clearInterval"];"undefined"!=typeof global.setImmediate&&methods.push("setImmediate"),"undefined"!=typeof global.clearImmediate&&methods.push("clearImmediate"),sinon.useFakeTimers=function(a){var b=sinon.clock.create(a);b.restore=restore,b.methods=Array.prototype.slice.call(arguments,"number"==typeof a?1:0),0===b.methods.length&&(b.methods=methods);for(var c=0,d=b.methods.length;d>c;c++)stubGlobal(b.methods[c],b);return b}}("undefined"!=typeof global&&"function"!=typeof global?global:this),sinon.timers={setTimeout:setTimeout,clearTimeout:clearTimeout,setImmediate:"undefined"!=typeof setImmediate?setImmediate:void 0,clearImmediate:"undefined"!=typeof clearImmediate?clearImmediate:void 0,setInterval:setInterval,clearInterval:clearInterval,Date:Date},"undefined"!=typeof module&&module.exports&&(module.exports=sinon)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],63:[function(a,b){(function(c){("function"==typeof define&&define.amd&&function(a){define("formatio",["samsam"],a)}||"object"==typeof b&&function(c){b.exports=c(a("samsam"))}||function(a){this.formatio=a(this.samsam)})(function(a){"use strict";function b(a){if(!a)return"";if(a.displayName)return a.displayName;if(a.name)return a.name;var b=a.toString().match(/function\s+([^\(]+)/m);return b&&b[1]||""}function d(a,c){var d,e,f=b(c&&c.constructor),g=a.excludeConstructors||h.excludeConstructors||[];for(d=0,e=g.length;e>d;++d){if("string"==typeof g[d]&&g[d]===f)return"";if(g[d].test&&g[d].test(f))return""}return f}function e(a,b){if("object"!=typeof a)return!1;var c,d;for(c=0,d=b.length;d>c;++c)if(b[c]===a)return!0;return!1}function f(b,c,d,g){if("string"==typeof c){var h=b.quoteStrings,j="boolean"!=typeof h||h;return d||j?'"'+c+'"':c}if("function"==typeof c&&!(c instanceof RegExp))return f.func(c);if(d=d||[],e(c,d))return"[Circular]";if("[object Array]"===Object.prototype.toString.call(c))return f.array.call(b,c,d);if(!c)return String(1/c===-1/0?"-0":c);if(a.isElement(c))return f.element(c);if("function"==typeof c.toString&&c.toString!==Object.prototype.toString)return c.toString();var k,l;for(k=0,l=i.length;l>k;k++)if(c===i[k].object)return i[k].value;return f.object.call(b,c,d,g)}function g(a){for(var b in a)this[b]=a[b]}var h={excludeConstructors:["Object",/^.$/],quoteStrings:!0},i=(Object.prototype.hasOwnProperty,[]);return"undefined"!=typeof c&&i.push({object:c,value:"[object global]"}),"undefined"!=typeof document&&i.push({object:document,value:"[object HTMLDocument]"}),"undefined"!=typeof window&&i.push({object:window,value:"[object Window]"}),f.func=function(a){return"function "+b(a)+"() {}"},f.array=function(a,b){b=b||[],b.push(a);var c,d,e=[];for(c=0,d=a.length;d>c;++c)e.push(f(this,a[c],b));return"["+e.join(", ")+"]"},f.object=function(b,c,g){c=c||[],c.push(b),g=g||0;var h,i,j,k,l,m=[],n=a.keys(b).sort(),o=3;for(k=0,l=n.length;l>k;++k)h=n[k],j=b[h],i=e(j,c)?"[Circular]":f(this,j,c,g+2),i=(/\s/.test(h)?'"'+h+'"':h)+": "+i,o+=i.length,m.push(i);var p=d(this,b),q=p?"["+p+"] ":"",r="";for(k=0,l=g;l>k;++k)r+=" ";return o+g>80?q+"{\n "+r+m.join(",\n "+r)+"\n"+r+"}":q+"{ "+m.join(", ")+" }"},f.element=function(a){var b,c,d,e,f,g=a.tagName.toLowerCase(),h=a.attributes,i=[];for(d=0,e=h.length;e>d;++d)b=h.item(d),c=b.nodeName.toLowerCase().replace("html:",""),f=b.nodeValue,("contenteditable"!==c||"inherit"!==f)&&f&&i.push(c+'="'+f+'"');var j="<"+g+(i.length>0?" ":""),k=a.innerHTML;k.length>20&&(k=k.substr(0,20)+"[...]");var l=j+i.join(" ")+">"+k+"</"+g+">";return l.replace(/ contentEditable="inherit"/,"")},g.prototype={functionName:b,configure:function(a){return new g(a)},constructorName:function(a){return d(this,a)},ascii:function(a,b,c){return f(this,a,b,c)}},g.prototype})}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{samsam:64}],64:[function(a,b){("function"==typeof define&&define.amd&&function(a){define("samsam",a)}||"object"==typeof b&&function(a){b.exports=a()}||function(a){this.samsam=a()})(function(){function a(a){var b=a;return"number"==typeof a&&a!==b}function b(a){return l.toString.call(a).split(/[ \]]/)[1]}function c(a){if("Arguments"===b(a))return!0;if("object"!=typeof a||"number"!=typeof a.length||"Array"===b(a))return!1;if("function"==typeof a.callee)return!0;try{a[a.length]=6,delete a[a.length]}catch(c){return!0}return!1}function d(a){if(!a||1!==a.nodeType||!m)return!1;try{a.appendChild(m),a.removeChild(m)}catch(b){return!1}return!0}function e(a){var b,c=[];for(b in a)l.hasOwnProperty.call(a,b)&&c.push(b);return c}function f(a){return"function"==typeof a.getTime&&a.getTime()==a.valueOf()}function g(a){return 0===a&&1/a===-1/0}function h(b,c){return b===c||a(b)&&a(c)?0!==b||g(b)===g(c):void 0}function i(g,i){function j(a){return"object"!=typeof a||null===a||a instanceof Boolean||a instanceof Date||a instanceof Number||a instanceof RegExp||a instanceof String?!1:!0}function k(a,b){var c;for(c=0;c<a.length;c++)if(a[c]===b)return c;return-1}var m=[],n=[],o=[],p=[],q={};return function r(g,i,s,t){var u=typeof g,v=typeof i;if(g===i||a(g)||a(i)||null==g||null==i||"object"!==u||"object"!==v)return h(g,i);if(d(g)||d(i))return!1;var w=f(g),x=f(i);if(!(!w&&!x||w&&x&&g.getTime()===i.getTime()))return!1;if(g instanceof RegExp&&i instanceof RegExp&&g.toString()!==i.toString())return!1;var y=b(g),z=b(i),A=e(g),B=e(i);if(c(g)||c(i)){if(g.length!==i.length)return!1}else if(u!==v||y!==z||A.length!==B.length)return!1;var C,D,E,F,G,H,I,J,K,L,M;for(D=0,E=A.length;E>D;D++){if(C=A[D],!l.hasOwnProperty.call(i,C))return!1;if(F=g[C],G=i[C],H=j(F),I=j(G),J=H?k(m,F):-1,K=I?k(n,G):-1,L=-1!==J?o[J]:s+"["+JSON.stringify(C)+"]",M=-1!==K?p[K]:t+"["+JSON.stringify(C)+"]",q[L+M])return!0;if(-1===J&&H&&(m.push(F),o.push(L)),-1===K&&I&&(n.push(G),p.push(M)),H&&I&&(q[L+M]=!0),!r(F,G,L,M))return!1}return!0}(g,i,"$1","$2")}function j(a,b){if(0===b.length)return!0;var c,d,e,f;for(c=0,d=a.length;d>c;++c)if(k(a[c],b[0])){for(e=0,f=b.length;f>e;++e)if(!k(a[c+e],b[e]))return!1;return!0}return!1}var k,l=Object.prototype,m="undefined"!=typeof document&&document.createElement("div");return k=function n(a,c){if(c&&"function"==typeof c.test)return c.test(a);if("function"==typeof c)return c(a)===!0;if("string"==typeof c){c=c.toLowerCase();var d="string"==typeof a||!!a;return d&&String(a).toLowerCase().indexOf(c)>=0}if("number"==typeof c)return c===a;if("boolean"==typeof c)return c===a;if("Array"===b(a)&&"Array"===b(c))return j(a,c);if(c&&"object"==typeof c){var e;for(e in c){var f=a[e];if("undefined"==typeof f&&"function"==typeof a.getAttribute&&(f=a.getAttribute(e)),"undefined"==typeof f||!n(f,c[e]))return!1}return!0}throw new Error("Matcher was not a string, a number, a function, a boolean or an object")},{isArguments:c,isElement:d,isDate:f,isNegZero:g,identical:h,deepEqual:i,match:k,keys:e}})},{}],65:[function(a,b,c){(function(){var a=this,d=a._,e={},f=Array.prototype,g=Object.prototype,h=Function.prototype,i=f.push,j=f.slice,k=f.concat,l=g.toString,m=g.hasOwnProperty,n=f.forEach,o=f.map,p=f.reduce,q=f.reduceRight,r=f.filter,s=f.every,t=f.some,u=f.indexOf,v=f.lastIndexOf,w=Array.isArray,x=Object.keys,y=h.bind,z=function(a){return a instanceof z?a:this instanceof z?void(this._wrapped=a):new z(a)};"undefined"!=typeof c?("undefined"!=typeof b&&b.exports&&(c=b.exports=z),c._=z):a._=z,z.VERSION="1.6.0";var A=z.each=z.forEach=function(a,b,c){if(null==a)return a;if(n&&a.forEach===n)a.forEach(b,c);else if(a.length===+a.length){for(var d=0,f=a.length;f>d;d++)if(b.call(c,a[d],d,a)===e)return}else for(var g=z.keys(a),d=0,f=g.length;f>d;d++)if(b.call(c,a[g[d]],g[d],a)===e)return;return a};z.map=z.collect=function(a,b,c){var d=[];return null==a?d:o&&a.map===o?a.map(b,c):(A(a,function(a,e,f){d.push(b.call(c,a,e,f))}),d)};var B="Reduce of empty array with no initial value";z.reduce=z.foldl=z.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),p&&a.reduce===p)return d&&(b=z.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(A(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(B);return c},z.reduceRight=z.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),q&&a.reduceRight===q)return d&&(b=z.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=z.keys(a);f=g.length}if(A(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(B);return c},z.find=z.detect=function(a,b,c){var d;return C(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},z.filter=z.select=function(a,b,c){var d=[];return null==a?d:r&&a.filter===r?a.filter(b,c):(A(a,function(a,e,f){b.call(c,a,e,f)&&d.push(a)}),d)},z.reject=function(a,b,c){return z.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},z.every=z.all=function(a,b,c){b||(b=z.identity);var d=!0;return null==a?d:s&&a.every===s?a.every(b,c):(A(a,function(a,f,g){return(d=d&&b.call(c,a,f,g))?void 0:e}),!!d)};var C=z.some=z.any=function(a,b,c){b||(b=z.identity);var d=!1;return null==a?d:t&&a.some===t?a.some(b,c):(A(a,function(a,f,g){return d||(d=b.call(c,a,f,g))?e:void 0}),!!d)};z.contains=z.include=function(a,b){return null==a?!1:u&&a.indexOf===u?-1!=a.indexOf(b):C(a,function(a){return a===b})},z.invoke=function(a,b){var c=j.call(arguments,2),d=z.isFunction(b);return z.map(a,function(a){return(d?b:a[b]).apply(a,c)})},z.pluck=function(a,b){return z.map(a,z.property(b))},z.where=function(a,b){return z.filter(a,z.matches(b))},z.findWhere=function(a,b){return z.find(a,z.matches(b))},z.max=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);var d=-1/0,e=-1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;h>e&&(d=a,e=h)}),d},z.min=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);var d=1/0,e=1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;e>h&&(d=a,e=h)}),d},z.shuffle=function(a){var b,c=0,d=[];return A(a,function(a){b=z.random(c++),d[c-1]=d[b],d[b]=a}),d},z.sample=function(a,b,c){return null==b||c?(a.length!==+a.length&&(a=z.values(a)),a[z.random(a.length-1)]):z.shuffle(a).slice(0,Math.max(0,b))};var D=function(a){return null==a?z.identity:z.isFunction(a)?a:z.property(a)};z.sortBy=function(a,b,c){return b=D(b),z.pluck(z.map(a,function(a,d,e){return{value:a,index:d,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index-b.index}),"value")};var E=function(a){return function(b,c,d){var e={};return c=D(c),A(b,function(f,g){var h=c.call(d,f,g,b);a(e,h,f)}),e}};z.groupBy=E(function(a,b,c){z.has(a,b)?a[b].push(c):a[b]=[c]}),z.indexBy=E(function(a,b,c){a[b]=c
|
||
}),z.countBy=E(function(a,b){z.has(a,b)?a[b]++:a[b]=1}),z.sortedIndex=function(a,b,c,d){c=D(c);for(var e=c.call(d,b),f=0,g=a.length;g>f;){var h=f+g>>>1;c.call(d,a[h])<e?f=h+1:g=h}return f},z.toArray=function(a){return a?z.isArray(a)?j.call(a):a.length===+a.length?z.map(a,z.identity):z.values(a):[]},z.size=function(a){return null==a?0:a.length===+a.length?a.length:z.keys(a).length},z.first=z.head=z.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:0>b?[]:j.call(a,0,b)},z.initial=function(a,b,c){return j.call(a,0,a.length-(null==b||c?1:b))},z.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:j.call(a,Math.max(a.length-b,0))},z.rest=z.tail=z.drop=function(a,b,c){return j.call(a,null==b||c?1:b)},z.compact=function(a){return z.filter(a,z.identity)};var F=function(a,b,c){return b&&z.every(a,z.isArray)?k.apply(c,a):(A(a,function(a){z.isArray(a)||z.isArguments(a)?b?i.apply(c,a):F(a,b,c):c.push(a)}),c)};z.flatten=function(a,b){return F(a,b,[])},z.without=function(a){return z.difference(a,j.call(arguments,1))},z.partition=function(a,b){var c=[],d=[];return A(a,function(a){(b(a)?c:d).push(a)}),[c,d]},z.uniq=z.unique=function(a,b,c,d){z.isFunction(b)&&(d=c,c=b,b=!1);var e=c?z.map(a,c,d):a,f=[],g=[];return A(e,function(c,d){(b?d&&g[g.length-1]===c:z.contains(g,c))||(g.push(c),f.push(a[d]))}),f},z.union=function(){return z.uniq(z.flatten(arguments,!0))},z.intersection=function(a){var b=j.call(arguments,1);return z.filter(z.uniq(a),function(a){return z.every(b,function(b){return z.contains(b,a)})})},z.difference=function(a){var b=k.apply(f,j.call(arguments,1));return z.filter(a,function(a){return!z.contains(b,a)})},z.zip=function(){for(var a=z.max(z.pluck(arguments,"length").concat(0)),b=new Array(a),c=0;a>c;c++)b[c]=z.pluck(arguments,""+c);return b},z.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},z.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=z.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(u&&a.indexOf===u)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},z.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(v&&a.lastIndexOf===v)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},z.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);d>e;)f[e++]=a,a+=c;return f};var G=function(){};z.bind=function(a,b){var c,d;if(y&&a.bind===y)return y.apply(a,j.call(arguments,1));if(!z.isFunction(a))throw new TypeError;return c=j.call(arguments,2),d=function(){if(!(this instanceof d))return a.apply(b,c.concat(j.call(arguments)));G.prototype=a.prototype;var e=new G;G.prototype=null;var f=a.apply(e,c.concat(j.call(arguments)));return Object(f)===f?f:e}},z.partial=function(a){var b=j.call(arguments,1);return function(){for(var c=0,d=b.slice(),e=0,f=d.length;f>e;e++)d[e]===z&&(d[e]=arguments[c++]);for(;c<arguments.length;)d.push(arguments[c++]);return a.apply(this,d)}},z.bindAll=function(a){var b=j.call(arguments,1);if(0===b.length)throw new Error("bindAll must be passed function names");return A(b,function(b){a[b]=z.bind(a[b],a)}),a},z.memoize=function(a,b){var c={};return b||(b=z.identity),function(){var d=b.apply(this,arguments);return z.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},z.delay=function(a,b){var c=j.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},z.defer=function(a){return z.delay.apply(z,[a,1].concat(j.call(arguments,1)))},z.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:z.now(),g=null,f=a.apply(d,e),d=e=null};return function(){var j=z.now();h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k?(clearTimeout(g),g=null,h=j,f=a.apply(d,e),d=e=null):g||c.trailing===!1||(g=setTimeout(i,k)),f}},z.debounce=function(a,b,c){var d,e,f,g,h,i=function(){var j=z.now()-g;b>j?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),f=e=null))};return function(){f=this,e=arguments,g=z.now();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}},z.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},z.wrap=function(a,b){return z.partial(b,a)},z.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},z.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},z.keys=function(a){if(!z.isObject(a))return[];if(x)return x(a);var b=[];for(var c in a)z.has(a,c)&&b.push(c);return b},z.values=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},z.pairs=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},z.invert=function(a){for(var b={},c=z.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},z.functions=z.methods=function(a){var b=[];for(var c in a)z.isFunction(a[c])&&b.push(c);return b.sort()},z.extend=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},z.pick=function(a){var b={},c=k.apply(f,j.call(arguments,1));return A(c,function(c){c in a&&(b[c]=a[c])}),b},z.omit=function(a){var b={},c=k.apply(f,j.call(arguments,1));for(var d in a)z.contains(c,d)||(b[d]=a[d]);return b},z.defaults=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)void 0===a[c]&&(a[c]=b[c])}),a},z.clone=function(a){return z.isObject(a)?z.isArray(a)?a.slice():z.extend({},a):a},z.tap=function(a,b){return b(a),a};var H=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof z&&(a=a._wrapped),b instanceof z&&(b=b._wrapped);var e=l.call(a);if(e!=l.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;var g=a.constructor,h=b.constructor;if(g!==h&&!(z.isFunction(g)&&g instanceof g&&z.isFunction(h)&&h instanceof h)&&"constructor"in a&&"constructor"in b)return!1;c.push(a),d.push(b);var i=0,j=!0;if("[object Array]"==e){if(i=a.length,j=i==b.length)for(;i--&&(j=H(a[i],b[i],c,d)););}else{for(var k in a)if(z.has(a,k)&&(i++,!(j=z.has(b,k)&&H(a[k],b[k],c,d))))break;if(j){for(k in b)if(z.has(b,k)&&!i--)break;j=!i}}return c.pop(),d.pop(),j};z.isEqual=function(a,b){return H(a,b,[],[])},z.isEmpty=function(a){if(null==a)return!0;if(z.isArray(a)||z.isString(a))return 0===a.length;for(var b in a)if(z.has(a,b))return!1;return!0},z.isElement=function(a){return!(!a||1!==a.nodeType)},z.isArray=w||function(a){return"[object Array]"==l.call(a)},z.isObject=function(a){return a===Object(a)},A(["Arguments","Function","String","Number","Date","RegExp"],function(a){z["is"+a]=function(b){return l.call(b)=="[object "+a+"]"}}),z.isArguments(arguments)||(z.isArguments=function(a){return!(!a||!z.has(a,"callee"))}),"function"!=typeof/./&&(z.isFunction=function(a){return"function"==typeof a}),z.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},z.isNaN=function(a){return z.isNumber(a)&&a!=+a},z.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==l.call(a)},z.isNull=function(a){return null===a},z.isUndefined=function(a){return void 0===a},z.has=function(a,b){return m.call(a,b)},z.noConflict=function(){return a._=d,this},z.identity=function(a){return a},z.constant=function(a){return function(){return a}},z.property=function(a){return function(b){return b[a]}},z.matches=function(a){return function(b){if(b===a)return!0;for(var c in a)if(a[c]!==b[c])return!1;return!0}},z.times=function(a,b,c){for(var d=Array(Math.max(0,a)),e=0;a>e;e++)d[e]=b.call(c,e);return d},z.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))},z.now=Date.now||function(){return(new Date).getTime()};var I={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};I.unescape=z.invert(I.escape);var J={escape:new RegExp("["+z.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+z.keys(I.unescape).join("|")+")","g")};z.each(["escape","unescape"],function(a){z[a]=function(b){return null==b?"":(""+b).replace(J[a],function(b){return I[a][b]})}}),z.result=function(a,b){if(null==a)return void 0;var c=a[b];return z.isFunction(c)?c.call(a):c},z.mixin=function(a){A(z.functions(a),function(b){var c=z[b]=a[b];z.prototype[b]=function(){var a=[this._wrapped];return i.apply(a,arguments),O.call(this,c.apply(z,a))}})};var K=0;z.uniqueId=function(a){var b=++K+"";return a?a+b:b},z.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var L=/(.)^/,M={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},N=/\\|'|\r|\n|\t|\u2028|\u2029/g;z.template=function(a,b,c){var d;c=z.defaults({},c,z.templateSettings);var e=new RegExp([(c.escape||L).source,(c.interpolate||L).source,(c.evaluate||L).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(N,function(a){return"\\"+M[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=new Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,z);var i=function(a){return d.call(this,a,z)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},z.chain=function(a){return z(a).chain()};var O=function(a){return this._chain?z(a).chain():a};z.mixin(z),A(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=f[a];z.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],O.call(this,c)}}),A(["concat","join","slice"],function(a){var b=f[a];z.prototype[a]=function(){return O.call(this,b.apply(this._wrapped,arguments))}}),z.extend(z.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return z})}).call(this)},{}],66:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:10,sinon:50,"sinon-chai":49,underscore:65}],67:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/TextYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/TextYatta.coffee":4,chai:10,sinon:50,"sinon-chai":49,underscore:65}],68:[function(a){var b,c,d,e,f,g,h,i,j,k=function(a,b){return function(){return a.apply(b,arguments)}};e=a("chai"),f=e.expect,g=e.should(),h=a("sinon"),i=a("sinon-chai"),j=a("underscore"),e.use(i),d=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee"),c=function(){function a(){this.applyRandomOp=k(this.applyRandomOp,this),this.generateRandomOp=k(this.generateRandomOp,this),this.generateDeleteOp=k(this.generateDeleteOp,this),this.generateReplaceOp=k(this.generateReplaceOp,this),this.generateInsertOp=k(this.generateInsertOp,this),this.number_of_test_cases_multiplier=1,this.repeat_this=10*this.number_of_test_cases_multiplier,this.doSomething_amount=200*this.number_of_test_cases_multiplier,this.number_of_engines=12+this.number_of_test_cases_multiplier-1,this.time=0,this.ops=0,this.time_now=0,this.reinitialize()}return a.prototype.reinitialize=function(){var a,c,e,f;for(this.users=[],this.Connector=b(this.users),this.users.push(new d(0,this.Connector)),this.users[0].val("name","initial"),f=[],a=c=1,e=this.number_of_engines;e>=1?e>c:c>e;a=e>=1?++c:--c)f.push(this.users.push(new d(a,this.Connector)));return f},a.prototype.getSomeUser=function(){var a;return a=j.random(0,this.users.length-1),this.users[a]},a.prototype.getRandomText=function(){var a,b,c,d;return a="abcdefghijklmnopqrstuvwxyz",b=j.random(0,10),c=a[j.random(0,a.length-1)],d="",j(b).times(function(){return d+=c}),d},a.prototype.generateInsertOp=function(a){var b;return b=j.random(0,this.users[a].val("name").val().length-1),this.users[a].val("name").insertText(b,this.getRandomText()),null},a.prototype.generateReplaceOp=function(a){return this.users[a].val("name").replaceText(this.getRandomText()),null},a.prototype.generateDeleteOp=function(a){var b,c,d;return void(this.users[a].val("name").val().length>0&&(d=j.random(0,this.users[a].val("name").val().length-1),b=1,c=this.users[a].val("name").deleteText(d,b)))},a.prototype.generateRandomOp=function(a){var b,c,d;return d=[this.generateDeleteOp,this.generateInsertOp,this.generateReplaceOp],b=j.random(d.length-1),c=d[b](a)},a.prototype.applyRandomOp=function(a){var b;return b=this.users[a],b.getConnector().flushOneRandom()},a.prototype.doSomething=function(){var a,b,c;return c=j.random(this.number_of_engines-1),b=[this.applyRandomOp,this.generateRandomOp],a=j.random(b.length-1),b[a](c)},a.prototype.flushAll=function(){var a,b,c,d,e,f;for(e=this.users,f=[],b=c=0,d=e.length;d>c;b=++c)a=e[b],f.push(a.getConnector().flushAll());return f},a.prototype.compareAll=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;for(this.flushAll(),this.time+=(new Date).getTime()-this.time_now,d=0,b=i=0,m=this.users.length;m>=0?m>i:i>m;b=m>=0?++i:--i)d+=this.users[b].getConnector().getOpsInExecutionOrder().length;for(this.ops+=d*this.users.length,f=Math.floor(this.ops/this.time),null!=a&&console.log(""+a+"/"+this.repeat_this+": Every collaborator ("+this.users.length+") applied "+this.number_of_created_operations+" ops in a different order."+(" Over all we consumed "+this.ops+" operations in "+this.time/1e3+" seconds ("+f+" ops/msek).")),o=[],b=j=0,n=this.users.length-1;n>=0?n>j:j>n;b=n>=0?++j:--j)if(this.users[b].val("name").val()!==this.users[b+1].val("name").val()){for(g=function(a,b){var c,d,e,f,g,h,i,j;for(e=this.users[a].getConnector().getOpsInExecutionOrder(),g=0,i=e.length;i>g;g++)f=e[g],console.log(JSON.stringify(f));for(console.log(""),f="ops = [",c=h=0,j=e.length;j>h;c=++h)d=e[c],0!==c&&(f+=", "),f+="op"+c;return f+="]",console.log(f),console.log("@users[@last_user].ot.applyOps ops"),console.log("expect(@users[@last_user].ot.val('name')).to.equal(\""+users[b].val("name")+'")'),e},console.log(""),console.log("Found an OT Puzzle!"),console.log("OT states:"),c=k=0,l=users.length;l>k;c=++k)h=users[c],console.log("OT"+c+": "+h.val("name"));console.log("\nOT execution order ("+b+","+(b+1)+"):"),g(b,b+1),console.log(""),e=g(b+1,b),o.push(console.log(""))}else o.push(void 0);return o},a.prototype.run=function(){var a,b,c,d,e,f,g;for(console.log(""),g=[],b=c=1,e=this.repeat_this;e>=1?e>=c:c>=e;b=e>=1?++c:--c){for(this.time_now=(new Date).getTime(),a=d=1,f=this.doSomething_amount;f>=1?f>=d:d>=f;a=f>=1?++d:--d)this.doSomething();this.compareAll(b),g.push(this.reinitialize())}return g},a}(),describe("JsonYatta",function(){return beforeEach(function(a){return this.yTest=new c,a()}),it("has a JsonWrapper",function(){var a,b;return b=this.yTest.getSomeUser().root_element,b.val("x","dtrn","immutable"),b.val("set",{x:"x"},"immutable"),a=b.value,a.x,a.set={y:""},a.x,a.set,a.set.x,f(a.x).to.equal("dtrn"),f(a.set.x).to.equal("x")}),it("can handle creaton of complex json",function(){return this.yTest.getSomeUser().val("x",{a:"b"}),this.yTest.getSomeUser().val("a",{a:{q:"dtrndtrtdrntdrnrtdnrtdnrtdnrtdnrdnrdt"}}),this.yTest.getSomeUser().val("b",{a:{}}),this.yTest.getSomeUser().val("c",{a:"b"}),this.yTest.compareAll()}),it("handles some immutable tests",function(){return this.yTest.getSomeUser().val("string","text","immutable"),this.yTest.getSomeUser().val("number",4,"immutable"),this.yTest.getSomeUser().val("object",{q:"rr"},"immutable"),this.yTest.compareAll(),f(this.yTest.getSomeUser().val("string")).to.equal("text"),f(this.yTest.getSomeUser().val("number")).to.equal(4),f(this.yTest.getSomeUser().val("object").val("q")).to.equal("rr")}),it("can handle many engines, many operations, concurrently (random)",function(){return this.yTest.run()})})},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:10,sinon:50,"sinon-chai":49,underscore:65}]},{},[66,67,68]),!function i(a,b,c){function d(f,g){if(!b[f]){if(!a[f]){var h="function"==typeof require&&require;if(!g&&h)return h(f,!0);if(e)return e(f,!0);throw new Error("Cannot find module '"+f+"'")}var j=b[f]={exports:{}};a[f][0].call(j.exports,function(b){var c=a[f][1][b];return d(c?c:b)},j,j.exports,i,a,b,c)}return b[f].exports}for(var e="function"==typeof require&&require,f=0;f<c.length;f++)d(c[f]);return d}({1:[function(a,b){var c;c=a("underscore"),b.exports=function(a){var b;return b=function(){function b(b,c,d){var e,f;this.engine=b,this.HB=c,this.execution_listener=d,f=function(a){return function(b){return a.send(b)}}(this),this.execution_listener.push(f),this.applied_operations=[],e=function(a){return function(b){return a.applied_operations.push(b)}}(this),this.execution_listener.push(e),0!==(null!=a?a.length:void 0)&&this.engine.applyOps(a[0].getHistoryBuffer()._encode()),this.unexecuted={}}return b.prototype.getOpsInExecutionOrder=function(){return this.applied_operations},b.prototype.getRootElement=function(){return a.length>0?a[0].getRootElement().getUid():void 0},b.prototype.send=function(b){var c,d,e,f;if(b.uid.creator===this.HB.getUserId()&&"string"!=typeof b.uid.op_number){for(f=[],d=0,e=a.length;e>d;d++)c=a[d],f.push(c.getUserId()!==this.HB.getUserId()?c.getConnector().receive(b):void 0);return f}},b.prototype.receive=function(a){var b,c;return null==(b=this.unexecuted)[c=a.creator]&&(b[c]=[]),this.unexecuted[a.creator].push(a)},b.prototype.flushOne=function(a){var b;return(null!=(b=this.unexecuted[a])?b.length:void 0)>0?this.engine.applyOp(this.unexecuted[a].shift()):void 0},b.prototype.flushOneRandom=function(){return this.flushOne(c.random(0,a.length-1))},b.prototype.flushAll=function(){var a,b,c;c=this.unexecuted;for(a in c)b=c[a],this.engine.applyOps(b);return this.unexecuted={}},b.prototype.sync=function(){throw new Error("Can't use this a.t.m.")},b}()}},{underscore:65}],2:[function(a,b){var c;c=function(){function a(a,b){this.HB=a,this.parser=b,this.unprocessed_ops=[]}return a.prototype.parseOperation=function(a){var b;if(b=this.parser[a.type],null!=b)return b(a);throw new Error("You forgot to specify a parser for type "+a.type+". The message is "+JSON.stringify(a)+".")},a.prototype.applyOps=function(a){var b,c,d,e,f,g,h,i;for(c=[],d=0,g=a.length;g>d;d++)b=a[d],c.push(this.parseOperation(b));for(e=0,h=c.length;h>e;e++)b=c[e],this.HB.addOperation(b);for(f=0,i=c.length;i>f;f++)b=c[f],b.execute()||this.unprocessed_ops.push(b);return this.tryUnprocessed()},a.prototype.applyOp=function(a){var b;return b=this.parseOperation(a),this.HB.addOperation(b),b.execute()||this.unprocessed_ops.push(b),this.tryUnprocessed()},a.prototype.tryUnprocessed=function(){var a,b,c,d,e,f,g;for(g=[];;){for(a=this.unprocessed_ops.length,c=[],f=this.unprocessed_ops,d=0,e=f.length;e>d;d++)b=f[d],b.execute()||c.push(b);if(this.unprocessed_ops=c,this.unprocessed_ops.length===a)break;g.push(void 0)}return g},a}(),b.exports=c},{}],3:[function(a,b){var c,d,e,f;f=a("../Types/JsonTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),g=f(this.HB),this.engine=new c(this.HB,g.parser),this.connector=new b(this.engine,this.HB,g.execution_listener,this),h=this.connector.getRootElement(),null==h?(e=new g.types.JsonType(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=e):this.root_element=this.HB.getOperation(h)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.setMutableDefault=function(a){return this.root_element.setMutableDefault(a)},a.prototype.getUserId=function(){return this.HB.getUserId()},a.prototype.val=function(a,b,c){return this.root_element.val(a,b,c)},Object.defineProperty(a.prototype,"value",{get:function(){return this.root_element.value},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),a}(),"undefined"!=typeof window&&null!==window&&(window.JsonYatta=e),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/JsonTypes.coffee":7}],4:[function(a,b){var c,d,e,f;f=a("../Types/TextTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),h=f(this.HB),this.engine=new c(this.HB,h.parser),this.connector=new b(this.engine,this.HB,h.execution_listener),g=this.connector.getRootElement(),null==g?(e=new h.types.Word(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=this.HB.addOperation(new h.types.ReplaceManager(e,this.HB.getNextOperationIdentifier())).execute()):this.root_element=this.HB.getOperation(g)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.getUserId=function(){return this.HB.getUserId()},a.prototype.val=function(){return this.root_element.val().val()},a.prototype.insertText=function(a,b){return this.root_element.val().insertText(a,b)},a.prototype.deleteText=function(a,b){return this.root_element.val().deleteText(a,b)},a.prototype.replaceText=function(a){return this.root_element.val().replaceText(a)},a}(),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/TextTypes.coffee":9}],5:[function(a,b){var c;c=function(){function a(a){this.user_id=a,this.operation_counter={},this.buffer={},this.change_listeners=[]}return a.prototype.getUserId=function(){return this.user_id},a.prototype.getOperationCounter=function(){var a,b,c,d;b={},d=this.operation_counter;for(c in d)a=d[c],b[c]=a;return b},a.prototype._encode=function(){var a,b,c,d,e,f;a=[],f=this.buffer;for(d in f){e=f[d];for(c in e)b=e[c],isNaN(parseInt(c))||a.push(b._encode())}return a},a.prototype.getNextOperationIdentifier=function(a){var b;return null==a&&(a=this.user_id),null==this.operation_counter[a]&&(this.operation_counter[a]=0),b={creator:a,op_number:this.operation_counter[a]},this.operation_counter[a]++,b},a.prototype.getOperation=function(a){var b;if(a instanceof Object)return null!=(b=this.buffer[a.creator])?b[a.op_number]:void 0;if(null!=a)throw new Error("This type of uid is not defined!")},a.prototype.addOperation=function(a){if(null==this.buffer[a.creator]&&(this.buffer[a.creator]={}),null==this.operation_counter[a.creator]&&(this.operation_counter[a.creator]=0),null!=this.buffer[a.creator][a.op_number])throw new Error("You must not overwrite operations!");return this.buffer[a.creator][a.op_number]=a,"number"==typeof a.op_number&&a.creator!==this.getUserId()&&this.operation_counter[a.creator]++,a},a}(),b.exports=c},{}],6:[function(a,b){var c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};b.exports=function(a){var b,c,e,f,g,h,i;return i={},h=[],g=function(){function b(b){null==b&&(b=a.getNextOperationIdentifier()),this.creator=b.creator,this.op_number=b.op_number}return b.prototype.getUid=function(){return{creator:this.creator,op_number:this.op_number}},b.prototype.execute=function(){var a,b,c;for(this.is_executed=!0,b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this},b.prototype.saveOperation=function(a,b){return null!=(null!=b?b.execute:void 0)?this[a]=b:null!=b?(null==this.unchecked&&(this.unchecked={}),this.unchecked[a]=b):void 0},b.prototype.validateSavedOperations=function(){var b,c,d,e,f,g;f={},e=this,g=this.unchecked;for(b in g)d=g[b],c=a.getOperation(d),c?this[b]=c:(f[b]=d,e=!1);return delete this.unchecked,e||(this.unchecked=f),e},b}(),b=function(a){function b(a,c){this.saveOperation("deletes",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype._encode=function(){return{type:"Delete",uid:this.getUid(),deletes:this.deletes.getUid()}},b.prototype.execute=function(){return this.validateSavedOperations()?(this.deletes.applyDelete(this),b.__super__.execute.apply(this,arguments),this):!1},b}(g),i.Delete=function(a){var c,d;return d=a.uid,c=a.deletes,new b(d,c)},f=function(a){function b(a,c,d,e){this.saveOperation("prev_cl",c),this.saveOperation("next_cl",d),null!=e?this.saveOperation("origin",e):this.saveOperation("origin",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype.applyDelete=function(a){return null==this.deleted_by&&(this.deleted_by=[]),this.deleted_by.push(a)},b.prototype.isDeleted=function(){var a;return(null!=(a=this.deleted_by)?a.length:void 0)>0},b.prototype.getDistanceToOrigin=function(){var a,b;for(a=0,b=this.prev_cl;this.origin!==b;){if(a++,this===this.prev_cl)throw new Error("this should not happen ;) ");b=b.prev_cl}return a},b.prototype.update_sl=function(){var a;return a=this.prev_cl,update("prev_cl","prev_sl"),update("next_cl","prev_sl")},b.prototype.execute=function(){var a,c,d,e,f;if(null!=this.is_executed)return this;if(this.validateSavedOperations()){if((null!=(e=this.prev_cl)?e.validateSavedOperations():void 0)&&(null!=(f=this.next_cl)?f.validateSavedOperations():void 0)&&this.prev_cl.next_cl!==this){for(a=0,d=this.prev_cl.next_cl,c=0;null==d&&(console.log(JSON.stringify(this.prev_cl.getUid())),console.log(JSON.stringify(this.next_cl.getUid()))),d!==this.next_cl;){if(d.getDistanceToOrigin()===c)d.creator<this.creator&&(this.prev_cl=d,a=c+1);else{if(!(d.getDistanceToOrigin()<c))break;c-a<=d.getDistanceToOrigin()&&(this.prev_cl=d,a=c+1)}c++,d=d.next_cl}this.next_cl=this.prev_cl.next_cl,this.prev_cl.next_cl=this,this.next_cl.prev_cl=this}return b.__super__.execute.apply(this,arguments),this}return!1},b}(g),e=function(a){function b(a,c,d,e,f){this.content=null!=c?c:"",b.__super__.constructor.call(this,a,d,e,f)}return d(b,a),b.prototype.val=function(){return this.content},b.prototype._encode=function(){var a;return a={type:"ImmutableObject",uid:this.getUid(),content:this.content},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(f),i.ImmutableObject=function(a){var b,c,d,f,g;return g=a.uid,b=a.content,f=a.prev,c=a.next,d=a.origin,new e(g,b,f,c,d)},c=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return d(b,a),b.prototype.execute=function(){var a,b,c;if(this.validateSavedOperations()){for(b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this}return!1},b.prototype._encode=function(){var a,b;return{type:"Delimiter",uid:this.getUid(),prev:null!=(a=this.prev_cl)?a.getUid():void 0,next:null!=(b=this.next_cl)?b.getUid():void 0}},b}(f),i.Delimiter=function(a){var b,d,e;return e=a.uid,d=a.prev,b=a.next,new c(e,d,b)},{types:{Delete:b,Insert:f,Delimiter:c,Operation:g,ImmutableObject:e},parser:i,execution_listener:h}}},{}],7:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./TextTypes.coffee"),b.exports=function(a){var b,d,f,g,h;return g=c(a),h=g.types,f=g.parser,d=function(a){var c;return new(c=function(){function a(c){var e,f,g,i;i=c.map,g=function(e,f){return Object.defineProperty(a.prototype,e,{get:function(){var a;return a=f.val(),a instanceof b?d(a):a instanceof h.ImmutableObject?a.val():a},set:function(a){var b,d,f,g;if(a.constructor==={}.constructor){f=c.val(e),g=[];for(b in a)d=a[b],g.push(f.val(b,d,"immutable"));return g}return c.val(e,a,"immutable")},enumerable:!0,configurable:!1})};for(e in i)f=i[e],g(e,f)}return a}())(a)},b=function(b){function c(a,b,d){var e,f;if(c.__super__.constructor.call(this,a),null!=b){if("object"!=typeof b)throw new Error("The initial value of JsonTypes must be of type Object! (current type: "+typeof b+")");for(e in b)f=b[e],this.val(e,f,d)}}return e(c,b),c.prototype.mutable_default=!0,c.prototype.setMutableDefault=function(a){if(a===!0||"mutable"===a)c.prototype.mutable_default=!0;else{if(a!==!1&&"immutable"!==a)throw new Error('Set mutable either "mutable" or "immutable"!');c.prototype.mutable_default=!1}return"OK"},c.prototype.val=function(b,d,e){var f,g,i,j,k;if("object"==typeof b){for(i in b)g=b[i],this.val(i,g,d);return this}if(null!=b&&null!=d){if(e=null!=e?e===!0||"mutable"===e?!0:!1:this.mutable_default,"function"==typeof d)return this;if(e&&"number"!=typeof d||d.constructor===Object){if("string"==typeof d)return k=a.addOperation(new h.Word(a.getNextOperationIdentifier(),d)).execute(),c.__super__.val.call(this,b,k);if(d.constructor===Object)return f=a.addOperation(new c(a.getNextOperationIdentifier(),d,e)).execute(),c.__super__.val.call(this,b,f);throw new Error("You must not set "+typeof d+"-types in collaborative Json-objects!")}return j=a.addOperation(new h.ImmutableObject(void 0,d)).execute(),c.__super__.val.call(this,b,j)}return c.__super__.val.call(this,b,d)},Object.defineProperty(c.prototype,"value",{get:function(){return d(this)},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),c.prototype._encode=function(){return{type:"JsonType",uid:this.getUid()}},c}(h.MapManager),f.JsonType=function(a){var c;return c=a.uid,new b(c)},h.JsonType=b,g}},{"./TextTypes.coffee":9}],8:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./BasicTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i,j,k;return i=c(a),k=i.types,j=i.parser,f=function(c){function d(a){this.map={},d.__super__.constructor.call(this,a)}return e(d,c),d.prototype.val=function(c,e){var f,g,h,i,j;if(null!=e)return null==this.map[c]&&a.addOperation(new b(a.getNextOperationIdentifier(),this,c)).execute(),this.map[c].replace(e),this;if(null!=c)return g=null!=(i=this.map[c])?i.val():void 0,g instanceof k.ImmutableObject?g.val():g;h={},j=this.map;for(c in j)f=j[c],g=f.val(),(g instanceof k.ImmutableObject||g instanceof d)&&(g=g.val()),h[c]=g;return h},d}(k.Operation),b=function(b){function c(a,b,d){this.name=d,this.saveOperation("map_manager",b),c.__super__.constructor.call(this,a)}return e(c,b),c.prototype.execute=function(){var b,d,e,f,h;return this.validateSavedOperations()?(h=this.map_manager.getUid(),h.op_number="_"+h.op_number+"_RM_"+this.name,null==a.getOperation(h)&&(e=this.map_manager.getUid(),e.op_number="_"+e.op_number+"_RM_"+this.name+"_beginning",f=this.map_manager.getUid(),f.op_number="_"+f.op_number+"_RM_"+this.name+"_end",b=a.addOperation(new k.Delimiter(e,void 0,f)),d=a.addOperation(new k.Delimiter(f,b,void 0)).execute(),b.execute(),this.map_manager.map[this.name]=a.addOperation(new g(void 0,h,b,d)).execute()),c.__super__.execute.apply(this,arguments)):!1
|
||
},c.prototype._encode=function(){return{type:"AddName",uid:this.getUid(),map_manager:this.map_manager.getUid(),name:this.name}},c}(k.Operation),j.AddName=function(a){var c,d,e;return c=a.map_manager,e=a.uid,d=a.name,new b(e,c,d)},d=function(b){function c(b,d,e,f,g,h){null!=d&&null!=e?(this.saveOperation("beginning",d),this.saveOperation("end",e)):(this.beginning=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),void 0,void 0)),this.end=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),this.beginning,void 0)),this.beginning.next_cl=this.end,this.beginning.execute(),this.end.execute()),c.__super__.constructor.call(this,b,f,g,h)}return e(c,b),c.prototype.getLastOperation=function(){return this.end.prev_cl},c.prototype.getFirstOperation=function(){return this.beginning.next_cl},c.prototype.toArray=function(){var a,b;for(a=this.beginning.next_cl,b=[];a!==this.end;)b.push(a),a=a.next_cl;return b},c.prototype.getOperationByPosition=function(a){var b;if(b=this.beginning.next_cl,a>0)for(;b=b.next_cl,b.isDeleted()||(a-=1),0!==a;)if(b instanceof k.Delimiter)throw new Error("position parameter exceeded the length of the document!");return b},c}(k.Insert),g=function(b){function c(a,b,d,e,f,g,h){c.__super__.constructor.call(this,b,d,e,f,g,h),null!=a&&this.replace(a)}return e(c,b),c.prototype.replace=function(b){var c,d;return c=this.getLastOperation(),d=new h(b,this,a.getNextOperationIdentifier(),c,c.next_cl),a.addOperation(d).execute()},c.prototype.val=function(){var a;if(a=this.getLastOperation(),a instanceof k.Delimiter)throw new Error("dtrn");return a.val()},c.prototype._encode=function(){var a;return a={type:"ReplaceManager",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&null!=this.next_cl&&(a.prev=this.prev_cl.getUid(),a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},c}(d),j.ReplaceManager=function(a){var b,c,d,e,f,h,i;return c=a.content,i=a.uid,h=a.prev,e=a.next,f=a.origin,b=a.beginning,d=a.end,new g(c,i,b,d,h,e,f)},h=function(a){function b(a,c,d,e,f,g){if(this.saveOperation("content",a),this.saveOperation("parent",c),null==e||null==f||null==a)throw new Error("You must define content, prev, and next for Replaceable-types!");b.__super__.constructor.call(this,d,e,f,g)}return e(b,a),b.prototype.val=function(){return this.content},b.prototype.replace=function(a){return this.parent.replace(a)},b.prototype.execute=function(){var a;return this.validateSavedOperations()?("function"==typeof(a=this.content).setReplaceManager&&a.setReplaceManager(this.parent),b.__super__.execute.apply(this,arguments),this):!1},b.prototype._encode=function(){var a;return a={type:"Replaceable",content:this.content.getUid(),ReplaceManager:this.parent.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid(),uid:this.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(k.Insert),j.Replaceable=function(a){var b,c,d,e,f,g;return b=a.content,e=a.ReplaceManager,g=a.uid,f=a.prev,c=a.next,d=a.origin,new h(b,e,g,f,c,d)},k.ListManager=d,k.MapManager=f,k.ReplaceManager=g,k.Replaceable=h,i}},{"./BasicTypes.coffee":6}],9:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./StructuredTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i;return h=c(a),i=h.types,g=h.parser,b=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return e(b,a),b}(i.Delete),g.TextDelete=g.Delete,d=function(a){function b(a,c,d,e,f){if(this.content=a,null==d||null==e)throw new Error("You must define prev, and next for TextInsert-types!");b.__super__.constructor.call(this,c,d,e,f)}return e(b,a),b.prototype.getLength=function(){return this.isDeleted()?0:this.content.length},b.prototype.val=function(){return this.isDeleted()?"":this.content},b.prototype._encode=function(){var a;return a={type:"TextInsert",content:this.content,uid:this.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(i.Insert),g.TextInsert=function(a){var b,c,e,f,g;return b=a.content,g=a.uid,f=a.prev,c=a.next,e=a.origin,new d(b,g,f,c,e)},f=function(c){function f(a,b,c,d,e,g,h){f.__super__.constructor.call(this,a,c,d,e,g,h),null!=b&&this.insertText(0,b)}return e(f,c),f.prototype.insertText=function(b,c){var e,f,g,h,i,j;for(f=this.getOperationByPosition(b),j=[],h=0,i=c.length;i>h;h++)e=c[h],g=new d(e,a.getNextOperationIdentifier(),f.prev_cl,f),j.push(a.addOperation(g).execute());return j},f.prototype.deleteText=function(c,d){var e,f,g,h,j;for(g=this.getOperationByPosition(c),j=[],f=h=0;d>=0?d>h:h>d;f=d>=0?++h:--h){for(e=a.addOperation(new b(a.getNextOperationIdentifier(),g)).execute(),g=g.next_cl;g.isDeleted();){if(g instanceof i.Delimiter)throw new Error("You can't delete more than there is..");g=g.next_cl}j.push(e._encode())}return j},f.prototype.replaceText=function(b){var c;if(null!=this.replace_manager)return c=a.addOperation(new f(a.getNextOperationIdentifier())).execute(),c.insertText(0,b),this.replace_manager.replace(c);throw new Error("This type is currently not maintained by a ReplaceManager!")},f.prototype.val=function(){var a,b;return a=function(){var a,c,d,e;for(d=this.toArray(),e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(null!=b.val?b.val():"");return e}.call(this),a.join("")},f.prototype.setReplaceManager=function(a){return this.saveOperation("replace_manager",a),this.validateSavedOperations},f.prototype._encode=function(){var a;return a={type:"Word",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},f}(i.ListManager),g.Word=function(a){var b,c,d,e,g,h;return h=a.uid,b=a.beginning,c=a.end,g=a.prev,d=a.next,e=a.origin,new f(h,void 0,b,c,g,d,e)},i.TextInsert=d,i.TextDelete=b,i.Word=f,h}},{"./StructuredTypes.coffee":8}],10:[function(a,b){b.exports=a("./lib/chai")},{"./lib/chai":11}],11:[function(a,b,c){var d=[],c=b.exports={};c.version="1.9.1",c.AssertionError=a("assertion-error");var e=a("./chai/utils");c.use=function(a){return~d.indexOf(a)||(a(this,e),d.push(a)),this};var f=a("./chai/config");c.config=f;var g=a("./chai/assertion");c.use(g);var h=a("./chai/core/assertions");c.use(h);var i=a("./chai/interface/expect");c.use(i);var j=a("./chai/interface/should");c.use(j);var k=a("./chai/interface/assert");c.use(k)},{"./chai/assertion":12,"./chai/config":13,"./chai/core/assertions":14,"./chai/interface/assert":15,"./chai/interface/expect":16,"./chai/interface/should":17,"./chai/utils":28,"assertion-error":37}],12:[function(a,b){var c=a("./config");b.exports=function(a,b){function d(a,b,c){f(this,"ssfi",c||arguments.callee),f(this,"object",a),f(this,"message",b)}var e=a.AssertionError,f=b.flag;a.Assertion=d,Object.defineProperty(d,"includeStack",{get:function(){return console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack},set:function(a){console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack=a}}),Object.defineProperty(d,"showDiff",{get:function(){return console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff},set:function(a){console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff=a}}),d.addProperty=function(a,c){b.addProperty(this.prototype,a,c)},d.addMethod=function(a,c){b.addMethod(this.prototype,a,c)},d.addChainableMethod=function(a,c,d){b.addChainableMethod(this.prototype,a,c,d)},d.overwriteProperty=function(a,c){b.overwriteProperty(this.prototype,a,c)},d.overwriteMethod=function(a,c){b.overwriteMethod(this.prototype,a,c)},d.overwriteChainableMethod=function(a,c,d){b.overwriteChainableMethod(this.prototype,a,c,d)},d.prototype.assert=function(a,d,g,h,i,j){var k=b.test(this,arguments);if(!0!==j&&(j=!1),!0!==c.showDiff&&(j=!1),!k){var d=b.getMessage(this,arguments),l=b.getActual(this,arguments);throw new e(d,{actual:l,expected:h,showDiff:j},c.includeStack?this.assert:f(this,"ssfi"))}},Object.defineProperty(d.prototype,"_obj",{get:function(){return f(this,"object")},set:function(a){f(this,"object",a)}})}},{"./config":13}],13:[function(a,b){b.exports={includeStack:!1,showDiff:!0,truncateThreshold:40}},{}],14:[function(a,b){b.exports=function(a,b){function c(a,c){c&&u(this,"message",c),a=a.toLowerCase();var d=u(this,"object"),e=~["a","e","i","o","u"].indexOf(a.charAt(0))?"an ":"a ";this.assert(a===b.type(d),"expected #{this} to be "+e+a,"expected #{this} not to be "+e+a)}function d(){u(this,"contains",!0)}function e(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=!1;if("array"===b.type(d)&&"object"===b.type(a)){for(var f in d)if(b.eql(d[f],a)){e=!0;break}}else if("object"===b.type(a)){if(!u(this,"negate")){for(var g in a)new t(d).property(g,a[g]);return}var h={};for(var g in a)h[g]=d[g];e=b.eql(h,a)}else e=d&&~d.indexOf(a);this.assert(e,"expected #{this} to include "+b.inspect(a),"expected #{this} to not include "+b.inspect(a))}function f(){var a=u(this,"object"),b=Object.prototype.toString.call(a);this.assert("[object Arguments]"===b,"expected #{this} to be arguments but got "+b,"expected #{this} to not be arguments")}function g(a,b){b&&u(this,"message",b);var c=u(this,"object");return u(this,"deep")?this.eql(a):void this.assert(a===c,"expected #{this} to equal #{exp}","expected #{this} to not equal #{exp}",a,this._obj,!0)}function h(a,c){c&&u(this,"message",c),this.assert(b.eql(a,u(this,"object")),"expected #{this} to deeply equal #{exp}","expected #{this} to not deeply equal #{exp}",a,this._obj,!0)}function i(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>a,"expected #{this} to have a length above #{exp} but got #{act}","expected #{this} to not have a length above #{exp}",a,d)}else this.assert(c>a,"expected #{this} to be above "+a,"expected #{this} to be at most "+a)}function j(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>=a,"expected #{this} to have a length at least #{exp} but got #{act}","expected #{this} to have a length below #{exp}",a,d)}else this.assert(c>=a,"expected #{this} to be at least "+a,"expected #{this} to be below "+a)}function k(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(a>d,"expected #{this} to have a length below #{exp} but got #{act}","expected #{this} to not have a length below #{exp}",a,d)}else this.assert(a>c,"expected #{this} to be below "+a,"expected #{this} to be at least "+a)}function l(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(a>=d,"expected #{this} to have a length at most #{exp} but got #{act}","expected #{this} to have a length above #{exp}",a,d)}else this.assert(a>=c,"expected #{this} to be at most "+a,"expected #{this} to be above "+a)}function m(a,c){c&&u(this,"message",c);var d=b.getName(a);this.assert(u(this,"object")instanceof a,"expected #{this} to be an instance of "+d,"expected #{this} to not be an instance of "+d)}function n(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(d.hasOwnProperty(a),"expected #{this} to have own property "+b.inspect(a),"expected #{this} to not have own property "+b.inspect(a))}function o(){u(this,"doLength",!0)}function p(a,b){b&&u(this,"message",b);var c=u(this,"object");new t(c,b).to.have.property("length");var d=c.length;this.assert(d==a,"expected #{this} to have a length of #{exp} but got #{act}","expected #{this} to not have a length of #{act}",a,d)}function q(a){var c,d=u(this,"object"),e=!0;if(a=a instanceof Array?a:Array.prototype.slice.call(arguments),!a.length)throw new Error("keys required");var f=Object.keys(d),g=a.length;if(e=a.every(function(a){return~f.indexOf(a)}),u(this,"negate")||u(this,"contains")||(e=e&&a.length==f.length),g>1){a=a.map(function(a){return b.inspect(a)});var h=a.pop();c=a.join(", ")+", and "+h}else c=b.inspect(a[0]);c=(g>1?"keys ":"key ")+c,c=(u(this,"contains")?"contain ":"have ")+c,this.assert(e,"expected #{this} to "+c,"expected #{this} to not "+c)}function r(a,c,d){d&&u(this,"message",d);var e=u(this,"object");new t(e,d).is.a("function");var f=!1,g=null,h=null,i=null;0===arguments.length?(c=null,a=null):a&&(a instanceof RegExp||"string"==typeof a)?(c=a,a=null):a&&a instanceof Error?(g=a,a=null,c=null):"function"==typeof a?(h=a.prototype.name||a.name,"Error"===h&&a!==Error&&(h=(new a).name)):a=null;try{e()}catch(j){if(g)return this.assert(j===g,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}",g instanceof Error?g.toString():g,j instanceof Error?j.toString():j),u(this,"object",j),this;if(a&&(this.assert(j instanceof a,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp} but #{act} was thrown",h,j instanceof Error?j.toString():j),!c))return u(this,"object",j),this;var k="object"===b.type(j)&&"message"in j?j.message:""+j;if(null!=k&&c&&c instanceof RegExp)return this.assert(c.exec(k),"expected #{this} to throw error matching #{exp} but got #{act}","expected #{this} to throw error not matching #{exp}",c,k),u(this,"object",j),this;if(null!=k&&c&&"string"==typeof c)return this.assert(~k.indexOf(c),"expected #{this} to throw error including #{exp} but got #{act}","expected #{this} to throw error not including #{act}",c,k),u(this,"object",j),this;f=!0,i=j}var l="",m=null!==h?h:g?"#{exp}":"an error";f&&(l=" but #{act} was thrown"),this.assert(f===!0,"expected #{this} to throw "+m+l,"expected #{this} to not throw "+m+l,g instanceof Error?g.toString():g,i instanceof Error?i.toString():i),u(this,"object",i)}function s(a,b,c){return a.every(function(a){return c?b.some(function(b){return c(a,b)}):-1!==b.indexOf(a)})}var t=a.Assertion,u=(Object.prototype.toString,b.flag);["to","be","been","is","and","has","have","with","that","at","of","same"].forEach(function(a){t.addProperty(a,function(){return this})}),t.addProperty("not",function(){u(this,"negate",!0)}),t.addProperty("deep",function(){u(this,"deep",!0)}),t.addChainableMethod("an",c),t.addChainableMethod("a",c),t.addChainableMethod("include",e,d),t.addChainableMethod("contain",e,d),t.addProperty("ok",function(){this.assert(u(this,"object"),"expected #{this} to be truthy","expected #{this} to be falsy")}),t.addProperty("true",function(){this.assert(!0===u(this,"object"),"expected #{this} to be true","expected #{this} to be false",this.negate?!1:!0)}),t.addProperty("false",function(){this.assert(!1===u(this,"object"),"expected #{this} to be false","expected #{this} to be true",this.negate?!0:!1)}),t.addProperty("null",function(){this.assert(null===u(this,"object"),"expected #{this} to be null","expected #{this} not to be null")}),t.addProperty("undefined",function(){this.assert(void 0===u(this,"object"),"expected #{this} to be undefined","expected #{this} not to be undefined")}),t.addProperty("exist",function(){this.assert(null!=u(this,"object"),"expected #{this} to exist","expected #{this} to not exist")}),t.addProperty("empty",function(){var a=u(this,"object"),b=a;Array.isArray(a)||"string"==typeof object?b=a.length:"object"==typeof a&&(b=Object.keys(a).length),this.assert(!b,"expected #{this} to be empty","expected #{this} not to be empty")}),t.addProperty("arguments",f),t.addProperty("Arguments",f),t.addMethod("equal",g),t.addMethod("equals",g),t.addMethod("eq",g),t.addMethod("eql",h),t.addMethod("eqls",h),t.addMethod("above",i),t.addMethod("gt",i),t.addMethod("greaterThan",i),t.addMethod("least",j),t.addMethod("gte",j),t.addMethod("below",k),t.addMethod("lt",k),t.addMethod("lessThan",k),t.addMethod("most",l),t.addMethod("lte",l),t.addMethod("within",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object"),e=a+".."+b;if(u(this,"doLength")){new t(d,c).to.have.property("length");var f=d.length;this.assert(f>=a&&b>=f,"expected #{this} to have a length within "+e,"expected #{this} to not have a length within "+e)}else this.assert(d>=a&&b>=d,"expected #{this} to be within "+e,"expected #{this} to not be within "+e)}),t.addMethod("instanceof",m),t.addMethod("instanceOf",m),t.addMethod("property",function(a,c,d){d&&u(this,"message",d);var e=u(this,"deep")?"deep property ":"property ",f=u(this,"negate"),g=u(this,"object"),h=u(this,"deep")?b.getPathValue(a,g):g[a];if(f&&void 0!==c){if(void 0===h)throw d=null!=d?d+": ":"",new Error(d+b.inspect(g)+" has no "+e+b.inspect(a))}else this.assert(void 0!==h,"expected #{this} to have a "+e+b.inspect(a),"expected #{this} to not have "+e+b.inspect(a));void 0!==c&&this.assert(c===h,"expected #{this} to have a "+e+b.inspect(a)+" of #{exp}, but got #{act}","expected #{this} to not have a "+e+b.inspect(a)+" of #{act}",c,h),u(this,"object",h)}),t.addMethod("ownProperty",n),t.addMethod("haveOwnProperty",n),t.addChainableMethod("length",p,o),t.addMethod("lengthOf",p,o),t.addMethod("match",function(a,b){b&&u(this,"message",b);var c=u(this,"object");this.assert(a.exec(c),"expected #{this} to match "+a,"expected #{this} not to match "+a)}),t.addMethod("string",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d,c).is.a("string"),this.assert(~d.indexOf(a),"expected #{this} to contain "+b.inspect(a),"expected #{this} to not contain "+b.inspect(a))}),t.addMethod("keys",q),t.addMethod("key",q),t.addMethod("throw",r),t.addMethod("throws",r),t.addMethod("Throw",r),t.addMethod("respondTo",function(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=u(this,"itself"),f="function"!==b.type(d)||e?d[a]:d.prototype[a];this.assert("function"==typeof f,"expected #{this} to respond to "+b.inspect(a),"expected #{this} to not respond to "+b.inspect(a))}),t.addProperty("itself",function(){u(this,"itself",!0)}),t.addMethod("satisfy",function(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(a(d),"expected #{this} to satisfy "+b.objDisplay(a),"expected #{this} to not satisfy"+b.objDisplay(a),this.negate?!1:!0,a(d))}),t.addMethod("closeTo",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(Math.abs(d-a)<=b,"expected #{this} to be close to "+a+" +/- "+b,"expected #{this} not to be close to "+a+" +/- "+b)}),t.addMethod("members",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d).to.be.an("array"),new t(a).to.be.an("array");var e=u(this,"deep")?b.eql:void 0;return u(this,"contains")?this.assert(s(a,d,e),"expected #{this} to be a superset of #{act}","expected #{this} to not be a superset of #{act}",d,a):void this.assert(s(d,a,e)&&s(a,d,e),"expected #{this} to have the same members as #{act}","expected #{this} to not have the same members as #{act}",d,a)})}},{}],15:[function(require,module,exports){module.exports=function(chai,util){var Assertion=chai.Assertion,flag=util.flag,assert=chai.assert=function(a,b){var c=new Assertion(null,null,chai.assert);c.assert(a,b,"[ negation message unavailable ]")};assert.fail=function(a,b,c,d){throw c=c||"assert.fail()",new chai.AssertionError(c,{actual:a,expected:b,operator:d},assert.fail)},assert.ok=function(a,b){new Assertion(a,b).is.ok},assert.notOk=function(a,b){new Assertion(a,b).is.not.ok},assert.equal=function(a,b,c){var d=new Assertion(a,c,assert.equal);d.assert(b==flag(d,"object"),"expected #{this} to equal #{exp}","expected #{this} to not equal #{act}",b,a)},assert.notEqual=function(a,b,c){var d=new Assertion(a,c,assert.notEqual);d.assert(b!=flag(d,"object"),"expected #{this} to not equal #{exp}","expected #{this} to equal #{act}",b,a)},assert.strictEqual=function(a,b,c){new Assertion(a,c).to.equal(b)},assert.notStrictEqual=function(a,b,c){new Assertion(a,c).to.not.equal(b)},assert.deepEqual=function(a,b,c){new Assertion(a,c).to.eql(b)},assert.notDeepEqual=function(a,b,c){new Assertion(a,c).to.not.eql(b)},assert.isTrue=function(a,b){new Assertion(a,b).is["true"]},assert.isFalse=function(a,b){new Assertion(a,b).is["false"]},assert.isNull=function(a,b){new Assertion(a,b).to.equal(null)},assert.isNotNull=function(a,b){new Assertion(a,b).to.not.equal(null)},assert.isUndefined=function(a,b){new Assertion(a,b).to.equal(void 0)},assert.isDefined=function(a,b){new Assertion(a,b).to.not.equal(void 0)},assert.isFunction=function(a,b){new Assertion(a,b).to.be.a("function")},assert.isNotFunction=function(a,b){new Assertion(a,b).to.not.be.a("function")},assert.isObject=function(a,b){new Assertion(a,b).to.be.a("object")},assert.isNotObject=function(a,b){new Assertion(a,b).to.not.be.a("object")},assert.isArray=function(a,b){new Assertion(a,b).to.be.an("array")},assert.isNotArray=function(a,b){new Assertion(a,b).to.not.be.an("array")},assert.isString=function(a,b){new Assertion(a,b).to.be.a("string")},assert.isNotString=function(a,b){new Assertion(a,b).to.not.be.a("string")},assert.isNumber=function(a,b){new Assertion(a,b).to.be.a("number")},assert.isNotNumber=function(a,b){new Assertion(a,b).to.not.be.a("number")},assert.isBoolean=function(a,b){new Assertion(a,b).to.be.a("boolean")},assert.isNotBoolean=function(a,b){new Assertion(a,b).to.not.be.a("boolean")},assert.typeOf=function(a,b,c){new Assertion(a,c).to.be.a(b)},assert.notTypeOf=function(a,b,c){new Assertion(a,c).to.not.be.a(b)},assert.instanceOf=function(a,b,c){new Assertion(a,c).to.be.instanceOf(b)},assert.notInstanceOf=function(a,b,c){new Assertion(a,c).to.not.be.instanceOf(b)},assert.include=function(a,b,c){new Assertion(a,c,assert.include).include(b)},assert.notInclude=function(a,b,c){new Assertion(a,c,assert.notInclude).not.include(b)},assert.match=function(a,b,c){new Assertion(a,c).to.match(b)},assert.notMatch=function(a,b,c){new Assertion(a,c).to.not.match(b)},assert.property=function(a,b,c){new Assertion(a,c).to.have.property(b)},assert.notProperty=function(a,b,c){new Assertion(a,c).to.not.have.property(b)},assert.deepProperty=function(a,b,c){new Assertion(a,c).to.have.deep.property(b)},assert.notDeepProperty=function(a,b,c){new Assertion(a,c).to.not.have.deep.property(b)},assert.propertyVal=function(a,b,c,d){new Assertion(a,d).to.have.property(b,c)},assert.propertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.property(b,c)},assert.deepPropertyVal=function(a,b,c,d){new Assertion(a,d).to.have.deep.property(b,c)},assert.deepPropertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.deep.property(b,c)},assert.lengthOf=function(a,b,c){new Assertion(a,c).to.have.length(b)},assert.Throw=function(a,b,c,d){("string"==typeof b||b instanceof RegExp)&&(c=b,b=null);var e=new Assertion(a,d).to.Throw(b,c);return flag(e,"object")},assert.doesNotThrow=function(a,b,c){"string"==typeof b&&(c=b,b=null),new Assertion(a,c).to.not.Throw(b)},assert.operator=function(val,operator,val2,msg){if(!~["==","===",">",">=","<","<=","!=","!=="].indexOf(operator))throw new Error('Invalid operator "'+operator+'"');var test=new Assertion(eval(val+operator+val2),msg);test.assert(!0===flag(test,"object"),"expected "+util.inspect(val)+" to be "+operator+" "+util.inspect(val2),"expected "+util.inspect(val)+" to not be "+operator+" "+util.inspect(val2))},assert.closeTo=function(a,b,c,d){new Assertion(a,d).to.be.closeTo(b,c)},assert.sameMembers=function(a,b,c){new Assertion(a,c).to.have.same.members(b)},assert.includeMembers=function(a,b,c){new Assertion(a,c).to.include.members(b)},assert.ifError=function(a,b){new Assertion(a,b).to.not.be.ok},function a(b,c){return assert[c]=assert[b],a}("Throw","throw")("Throw","throws")}},{}],16:[function(a,b){b.exports=function(a){a.expect=function(b,c){return new a.Assertion(b,c)}}},{}],17:[function(a,b){b.exports=function(a){function b(){function a(){return this instanceof String||this instanceof Number?new c(this.constructor(this),null,a):this instanceof Boolean?new c(1==this,null,a):new c(this,null,a)}function b(a){Object.defineProperty(this,"should",{value:a,enumerable:!0,configurable:!0,writable:!0})}Object.defineProperty(Object.prototype,"should",{set:b,get:a,configurable:!0});var d={};return d.equal=function(a,b,d){new c(a,d).to.equal(b)},d.Throw=function(a,b,d,e){new c(a,e).to.Throw(b,d)},d.exist=function(a,b){new c(a,b).to.exist},d.not={},d.not.equal=function(a,b,d){new c(a,d).to.not.equal(b)},d.not.Throw=function(a,b,d,e){new c(a,e).to.not.Throw(b,d)},d.not.exist=function(a,b){new c(a,b).to.not.exist},d["throw"]=d.Throw,d.not["throw"]=d.not.Throw,d}var c=a.Assertion;a.should=b,a.Should=b}},{}],18:[function(a,b){var c=a("./transferFlags"),d=a("./flag"),e=a("../config"),f="__proto__"in Object,g=/^(?:length|name|arguments|caller)$/,h=Function.prototype.call,i=Function.prototype.apply;b.exports=function(a,b,j,k){"function"!=typeof k&&(k=function(){});var l={method:j,chainingBehavior:k};a.__methods||(a.__methods={}),a.__methods[b]=l,Object.defineProperty(a,b,{get:function(){l.chainingBehavior.call(this);var b=function m(){var a=d(this,"ssfi");a&&e.includeStack===!1&&d(this,"ssfi",m);var b=l.method.apply(this,arguments);return void 0===b?this:b};if(f){var j=b.__proto__=Object.create(this);j.call=h,j.apply=i}else{var k=Object.getOwnPropertyNames(a);k.forEach(function(c){if(!g.test(c)){var d=Object.getOwnPropertyDescriptor(a,c);Object.defineProperty(b,c,d)}})}return c(this,b),b},configurable:!0})}},{"../config":13,"./flag":21,"./transferFlags":35}],19:[function(a,b){var c=a("../config"),d=a("./flag");b.exports=function(a,b,e){a[b]=function(){var f=d(this,"ssfi");f&&c.includeStack===!1&&d(this,"ssfi",a[b]);var g=e.apply(this,arguments);return void 0===g?this:g}}},{"../config":13,"./flag":21}],20:[function(a,b){b.exports=function(a,b,c){Object.defineProperty(a,b,{get:function(){var a=c.call(this);return void 0===a?this:a},configurable:!0})}},{}],21:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));return 3!==arguments.length?d[b]:void(d[b]=c)}},{}],22:[function(a,b){b.exports=function(a,b){return b.length>4?b[4]:a._obj}},{}],23:[function(a,b){b.exports=function(a){var b=[];for(var c in a)b.push(c);return b}},{}],24:[function(a,b){var c=a("./flag"),d=a("./getActual"),e=(a("./inspect"),a("./objDisplay"));b.exports=function(a,b){var f=c(a,"negate"),g=c(a,"object"),h=b[3],i=d(a,b),j=f?b[2]:b[1],k=c(a,"message");return j=j||"",j=j.replace(/#{this}/g,e(g)).replace(/#{act}/g,e(i)).replace(/#{exp}/g,e(h)),k?k+": "+j:j}},{"./flag":21,"./getActual":22,"./inspect":29,"./objDisplay":30}],25:[function(a,b){b.exports=function(a){if(a.name)return a.name;var b=/^\s?function ([^(]*)\(/.exec(a);return b&&b[1]?b[1]:""}},{}],26:[function(a,b){function c(a){var b=a.replace(/\[/g,".["),c=b.match(/(\\\.|[^.]+?)+/g);return c.map(function(a){var b=/\[(\d+)\]$/,c=b.exec(a);return c?{i:parseFloat(c[1])}:{p:a}})}function d(a,b){for(var c,d=b,e=0,f=a.length;f>e;e++){var g=a[e];d?("undefined"!=typeof g.p?d=d[g.p]:"undefined"!=typeof g.i&&(d=d[g.i]),e==f-1&&(c=d)):c=void 0}return c}b.exports=function(a,b){var e=c(a);return d(e,b)}},{}],27:[function(a,b){b.exports=function(){function a(a){-1===b.indexOf(a)&&b.push(a)}for(var b=Object.getOwnPropertyNames(subject),c=Object.getPrototypeOf(subject);null!==c;)Object.getOwnPropertyNames(c).forEach(a),c=Object.getPrototypeOf(c);return b}},{}],28:[function(a,b,c){var c=b.exports={};c.test=a("./test"),c.type=a("./type"),c.getMessage=a("./getMessage"),c.getActual=a("./getActual"),c.inspect=a("./inspect"),c.objDisplay=a("./objDisplay"),c.flag=a("./flag"),c.transferFlags=a("./transferFlags"),c.eql=a("deep-eql"),c.getPathValue=a("./getPathValue"),c.getName=a("./getName"),c.addProperty=a("./addProperty"),c.addMethod=a("./addMethod"),c.overwriteProperty=a("./overwriteProperty"),c.overwriteMethod=a("./overwriteMethod"),c.addChainableMethod=a("./addChainableMethod"),c.overwriteChainableMethod=a("./overwriteChainableMethod")},{"./addChainableMethod":18,"./addMethod":19,"./addProperty":20,"./flag":21,"./getActual":22,"./getMessage":24,"./getName":25,"./getPathValue":26,"./inspect":29,"./objDisplay":30,"./overwriteChainableMethod":31,"./overwriteMethod":32,"./overwriteProperty":33,"./test":34,"./transferFlags":35,"./type":36,"deep-eql":38}],29:[function(a,b,c){function d(a,b,c){var d={showHidden:b,seen:[],stylize:function(a){return a}};return e(d,a,"undefined"==typeof c?2:c)}function e(a,b,d){if(b&&"function"==typeof b.inspect&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var o=b.inspect(d);return"string"!=typeof o&&(o=e(a,o,d)),o}var u=f(a,b);if(u)return u;if(t(b))return s(b);var v=r(b),w=a.showHidden?q(b):v;if(0===w.length||n(b)&&(1===w.length&&"stack"===w[0]||2===w.length&&"description"===w[0]&&"stack"===w[1])){if("function"==typeof b){var x=p(b),y=x?": "+x:"";return a.stylize("[Function"+y+"]","special")}if(l(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(m(b))return a.stylize(Date.prototype.toUTCString.call(b),"date");if(n(b))return g(b)}var z="",A=!1,B=["{","}"];if(k(b)&&(A=!0,B=["[","]"]),"function"==typeof b){var x=p(b),y=x?": "+x:"";z=" [Function"+y+"]"}if(l(b)&&(z=" "+RegExp.prototype.toString.call(b)),m(b)&&(z=" "+Date.prototype.toUTCString.call(b)),n(b))return g(b);if(0===w.length&&(!A||0==b.length))return B[0]+z+B[1];if(0>d)return l(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var C;return C=A?h(a,b,d,v,w):w.map(function(c){return i(a,b,d,v,c,A)}),a.seen.pop(),j(C,z,B)}function f(a,b){switch(typeof b){case"undefined":return a.stylize("undefined","undefined");case"string":var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string");case"number":return a.stylize(""+b,"number");case"boolean":return a.stylize(""+b,"boolean")}return null===b?a.stylize("null","null"):void 0}function g(a){return"["+Error.prototype.toString.call(a)+"]"}function h(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(Object.prototype.hasOwnProperty.call(b,String(g))?i(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(i(a,b,c,d,e,!0))}),f}function i(a,b,c,d,f,g){var h,i;if(b.__lookupGetter__&&(b.__lookupGetter__(f)?i=b.__lookupSetter__(f)?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):b.__lookupSetter__(f)&&(i=a.stylize("[Setter]","special"))),d.indexOf(f)<0&&(h="["+f+"]"),i||(a.seen.indexOf(b[f])<0?(i=null===c?e(a,b[f],null):e(a,b[f],c-1),i.indexOf("\n")>-1&&(i=g?i.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+i.split("\n").map(function(a){return" "+a}).join("\n"))):i=a.stylize("[Circular]","special")),"undefined"==typeof h){if(g&&f.match(/^\d+$/))return i;h=JSON.stringify(""+f),h.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(h=h.substr(1,h.length-2),h=a.stylize(h,"name")):(h=h.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),h=a.stylize(h,"string"))}return h+": "+i}function j(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function k(a){return Array.isArray(a)||"object"==typeof a&&"[object Array]"===o(a)}function l(a){return"object"==typeof a&&"[object RegExp]"===o(a)}function m(a){return"object"==typeof a&&"[object Date]"===o(a)}function n(a){return"object"==typeof a&&"[object Error]"===o(a)}function o(a){return Object.prototype.toString.call(a)}var p=a("./getName"),q=a("./getProperties"),r=a("./getEnumerableProperties");b.exports=d;var s=function(a){if("outerHTML"in a)return a.outerHTML;var b,c="http://www.w3.org/1999/xhtml",d=document.createElementNS(c,"_"),e=((window.HTMLElement||window.Element).prototype,new XMLSerializer);return document.xmlVersion?e.serializeToString(a):(d.appendChild(a.cloneNode(!1)),b=d.innerHTML.replace("><",">"+a.innerHTML+"<"),d.innerHTML="",b)
|
||
},t=function(a){return"object"==typeof HTMLElement?a instanceof HTMLElement:a&&"object"==typeof a&&1===a.nodeType&&"string"==typeof a.nodeName}},{"./getEnumerableProperties":23,"./getName":25,"./getProperties":27}],30:[function(a,b){var c=a("./inspect"),d=a("../config");b.exports=function(a){var b=c(a),e=Object.prototype.toString.call(a);if(d.truncateThreshold&&b.length>=d.truncateThreshold){if("[object Function]"===e)return a.name&&""!==a.name?"[Function: "+a.name+"]":"[Function]";if("[object Array]"===e)return"[ Array("+a.length+") ]";if("[object Object]"===e){var f=Object.keys(a),g=f.length>2?f.splice(0,2).join(", ")+", ...":f.join(", ");return"{ Object ("+g+") }"}return b}return b}},{"../config":13,"./inspect":29}],31:[function(a,b){b.exports=function(a,b,c,d){var e=a.__methods[b],f=e.chainingBehavior;e.chainingBehavior=function(){var a=d(f).call(this);return void 0===a?this:a};var g=e.method;e.method=function(){var a=c(g).apply(this,arguments);return void 0===a?this:a}}},{}],32:[function(a,b){b.exports=function(a,b,c){var d=a[b],e=function(){return this};d&&"function"==typeof d&&(e=d),a[b]=function(){var a=c(e).apply(this,arguments);return void 0===a?this:a}}},{}],33:[function(a,b){b.exports=function(a,b,c){var d=Object.getOwnPropertyDescriptor(a,b),e=function(){};d&&"function"==typeof d.get&&(e=d.get),Object.defineProperty(a,b,{get:function(){var a=c(e).call(this);return void 0===a?this:a},configurable:!0})}},{}],34:[function(a,b){var c=a("./flag");b.exports=function(a,b){var d=c(a,"negate"),e=b[0];return d?!e:e}},{"./flag":21}],35:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));b.__flags||(b.__flags=Object.create(null)),c=3===arguments.length?c:!0;for(var e in d)(c||"object"!==e&&"ssfi"!==e&&"message"!=e)&&(b.__flags[e]=d[e])}},{}],36:[function(a,b){var c={"[object Arguments]":"arguments","[object Array]":"array","[object Date]":"date","[object Function]":"function","[object Number]":"number","[object RegExp]":"regexp","[object String]":"string"};b.exports=function(a){var b=Object.prototype.toString.call(a);return c[b]?c[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}},{}],37:[function(a,b){function c(){function a(a,c){Object.keys(c).forEach(function(d){~b.indexOf(d)||(a[d]=c[d])})}var b=[].slice.call(arguments);return function(){for(var b=[].slice.call(arguments),c=0,d={};c<b.length;c++)a(d,b[c]);return d}}function d(a,b,d){var e=c("name","message","stack","constructor","toJSON"),f=e(b||{});this.message=a||"Unspecified AssertionError",this.showDiff=!1;for(var g in f)this[g]=f[g];d=d||arguments.callee,d&&Error.captureStackTrace&&Error.captureStackTrace(this,d)}b.exports=d,d.prototype=Object.create(Error.prototype),d.prototype.name="AssertionError",d.prototype.constructor=d,d.prototype.toJSON=function(a){var b=c("constructor","toJSON","stack"),d=b({name:this.name},this);return!1!==a&&this.stack&&(d.stack=this.stack),d}},{}],38:[function(a,b){b.exports=a("./lib/eql")},{"./lib/eql":39}],39:[function(a,b){function c(a,b,c){return d(a,b)?!0:"date"===o(a)?f(a,b):"regexp"===o(a)?g(a,b):n.isBuffer(a)?k(a,b):"arguments"===o(a)?h(a,b,c):e(a,b)?"object"!==o(a)&&"object"!==o(b)&&"array"!==o(a)&&"array"!==o(b)?d(a,b):m(a,b,c):!1}function d(a,b){return a===b?0!==a||1/a===1/b:a!==a&&b!==b}function e(a,b){return o(a)===o(b)}function f(a,b){return"date"!==o(b)?!1:d(a.getTime(),b.getTime())}function g(a,b){return"regexp"!==o(b)?!1:d(a.toString(),b.toString())}function h(a,b,d){return"arguments"!==o(b)?!1:(a=[].slice.call(a),b=[].slice.call(b),c(a,b,d))}function i(a){var b=[];for(var c in a)b.push(c);return b}function j(a,b){if(a.length!==b.length)return!1;for(var c=0,d=!0;c<a.length;c++)if(a[c]!==b[c]){d=!1;break}return d}function k(a,b){return n.isBuffer(b)?j(a,b):!1}function l(a){return null!==a&&void 0!==a}function m(a,b,d){if(!l(a)||!l(b))return!1;if(a.prototype!==b.prototype)return!1;var e;if(d){for(e=0;e<d.length;e++)if(d[e][0]===a&&d[e][1]===b||d[e][0]===b&&d[e][1]===a)return!0}else d=[];try{var f=i(a),g=i(b)}catch(h){return!1}if(f.sort(),g.sort(),!j(f,g))return!1;d.push([a,b]);var k;for(e=f.length-1;e>=0;e--)if(k=f[e],!c(a[k],b[k],d))return!1;return!0}var n,o=a("type-detect");try{n=a("buffer").Buffer}catch(p){n={},n.isBuffer=function(){return!1}}b.exports=c},{buffer:42,"type-detect":40}],40:[function(a,b){b.exports=a("./lib/type")},{"./lib/type":41}],41:[function(a,b,c){function d(a){var b=Object.prototype.toString.call(a);return f[b]?f[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}function e(){this.tests={}}var c=b.exports=d,f={"[object Array]":"array","[object RegExp]":"regexp","[object Function]":"function","[object Arguments]":"arguments","[object Date]":"date"};c.Library=e,e.prototype.of=d,e.prototype.define=function(a,b){return 1===arguments.length?this.tests[a]:(this.tests[a]=b,this)},e.prototype.test=function(a,b){if(b===d(a))return!0;var c=this.tests[b];if(c&&"regexp"===d(c))return c.test(a);if(c&&"function"===d(c))return c(a);throw new ReferenceError('Type test "'+b+'" not defined or invalid.')}},{}],42:[function(a,b,c){function d(a,b,c){if(!(this instanceof d))return new d(a,b,c);var e,f=typeof a;if("number"===f)e=a>0?a>>>0:0;else if("string"===f)"base64"===b&&(a=C(a)),e=d.byteLength(a,b);else{if("object"!==f||null===a)throw new Error("First argument needs to be a number, array or string.");"Buffer"===a.type&&E(a.data)&&(a=a.data),e=+a.length>0?Math.floor(+a.length):0}var g;T?g=d._augment(new Uint8Array(e)):(g=this,g.length=e,g._isBuffer=!0);var h;if(T&&"number"==typeof a.byteLength)g._set(a);else if(F(a))if(d.isBuffer(a))for(h=0;e>h;h++)g[h]=a.readUInt8(h);else for(h=0;e>h;h++)g[h]=(a[h]%256+256)%256;else if("string"===f)g.write(a,0,b);else if("number"===f&&!T&&!c)for(h=0;e>h;h++)g[h]=0;return g}function e(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;Q(f%2===0,"Invalid hex string"),d>f/2&&(d=f/2);for(var g=0;d>g;g++){var h=parseInt(b.substr(2*g,2),16);Q(!isNaN(h),"Invalid hex string"),a[c+g]=h}return g}function f(a,b,c,d){var e=L(H(b),a,c,d);return e}function g(a,b,c,d){var e=L(I(b),a,c,d);return e}function h(a,b,c,d){return g(a,b,c,d)}function i(a,b,c,d){var e=L(K(b),a,c,d);return e}function j(a,b,c,d){var e=L(J(b),a,c,d);return e}function k(a,b,c){return R.fromByteArray(0===b&&c===a.length?a:a.slice(b,c))}function l(a,b,c){var d="",e="";c=Math.min(a.length,c);for(var f=b;c>f;f++)a[f]<=127?(d+=M(e)+String.fromCharCode(a[f]),e=""):e+="%"+a[f].toString(16);return d+M(e)}function m(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(a[e]);return d}function n(a,b,c){return m(a,b,c)}function o(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;f++)e+=G(a[f]);return e}function p(a,b,c){for(var d=a.slice(b,c),e="",f=0;f<d.length;f+=2)e+=String.fromCharCode(d[f]+256*d[f+1]);return e}function q(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(f=a[b],e>b+1&&(f|=a[b+1]<<8)):(f=a[b]<<8,e>b+1&&(f|=a[b+1])),f}}function r(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(e>b+2&&(f=a[b+2]<<16),e>b+1&&(f|=a[b+1]<<8),f|=a[b],e>b+3&&(f+=a[b+3]<<24>>>0)):(e>b+1&&(f=a[b+1]<<16),e>b+2&&(f|=a[b+2]<<8),e>b+3&&(f|=a[b+3]),f+=a[b]<<24>>>0),f}}function s(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=q(a,b,c,!0),g=32768&f;return g?-1*(65535-f+1):f}}function t(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=r(a,b,c,!0),g=2147483648&f;return g?-1*(4294967295-f+1):f}}function u(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+3<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,23,4)}function v(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+7<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,52,8)}function w(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"trying to write beyond buffer length"),N(b,65535));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,2);h>g;g++)a[c+g]=(b&255<<8*(d?g:1-g))>>>8*(d?g:1-g);return c+2}}function x(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"trying to write beyond buffer length"),N(b,4294967295));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,4);h>g;g++)a[c+g]=b>>>8*(d?g:3-g)&255;return c+4}}function y(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"Trying to write beyond buffer length"),O(b,32767,-32768));var f=a.length;return c>=f?void 0:(b>=0?w(a,b,c,d,e):w(a,65535+b+1,c,d,e),c+2)}function z(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),O(b,2147483647,-2147483648));var f=a.length;return c>=f?void 0:(b>=0?x(a,b,c,d,e):x(a,4294967295+b+1,c,d,e),c+4)}function A(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),P(b,3.4028234663852886e38,-3.4028234663852886e38));var f=a.length;return c>=f?void 0:(S.write(a,b,c,d,23,4),c+4)}function B(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+7<a.length,"Trying to write beyond buffer length"),P(b,1.7976931348623157e308,-1.7976931348623157e308));var f=a.length;return c>=f?void 0:(S.write(a,b,c,d,52,8),c+8)}function C(a){for(a=D(a).replace(V,"");a.length%4!==0;)a+="=";return a}function D(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function E(a){return(Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)})(a)}function F(a){return E(a)||d.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length}function G(a){return 16>a?"0"+a.toString(16):a.toString(16)}function H(a){for(var b=[],c=0;c<a.length;c++){var d=a.charCodeAt(c);if(127>=d)b.push(d);else{var e=c;d>=55296&&57343>=d&&c++;for(var f=encodeURIComponent(a.slice(e,c+1)).substr(1).split("%"),g=0;g<f.length;g++)b.push(parseInt(f[g],16))}}return b}function I(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function J(a){for(var b,c,d,e=[],f=0;f<a.length;f++)b=a.charCodeAt(f),c=b>>8,d=b%256,e.push(d),e.push(c);return e}function K(a){return R.toByteArray(a)}function L(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);e++)b[e+c]=a[e];return e}function M(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function N(a,b){Q("number"==typeof a,"cannot write a non-number as a number"),Q(a>=0,"specified a negative value for writing an unsigned value"),Q(b>=a,"value is larger than maximum value for type"),Q(Math.floor(a)===a,"value has a fractional component")}function O(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value"),Q(Math.floor(a)===a,"value has a fractional component")}function P(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value")}function Q(a,b){if(!a)throw new Error(b||"Failed assertion")}var R=a("base64-js"),S=a("ieee754");c.Buffer=d,c.SlowBuffer=d,c.INSPECT_MAX_BYTES=50,d.poolSize=8192;var T=function(){try{var a=new ArrayBuffer(0),b=new Uint8Array(a);return b.foo=function(){return 42},42===b.foo()&&"function"==typeof b.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(c){return!1}}();d.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.isBuffer=function(a){return!(null==a||!a._isBuffer)},d.byteLength=function(a,b){var c;switch(a=a.toString(),b||"utf8"){case"hex":c=a.length/2;break;case"utf8":case"utf-8":c=H(a).length;break;case"ascii":case"binary":case"raw":c=a.length;break;case"base64":c=K(a).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":c=2*a.length;break;default:throw new Error("Unknown encoding")}return c},d.concat=function(a,b){if(Q(E(a),"Usage: Buffer.concat(list[, length])"),0===a.length)return new d(0);if(1===a.length)return a[0];var c;if(void 0===b)for(b=0,c=0;c<a.length;c++)b+=a[c].length;var e=new d(b),f=0;for(c=0;c<a.length;c++){var g=a[c];g.copy(e,f),f+=g.length}return e},d.compare=function(a,b){Q(d.isBuffer(a)&&d.isBuffer(b),"Arguments must be Buffers");for(var c=a.length,e=b.length,f=0,g=Math.min(c,e);g>f&&a[f]===b[f];f++);return f!==g&&(c=a[f],e=b[f]),e>c?-1:c>e?1:0},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var k=d;d=b,b=c,c=k}b=Number(b)||0;var l=this.length-b;c?(c=Number(c),c>l&&(c=l)):c=l,d=String(d||"utf8").toLowerCase();var m;switch(d){case"hex":m=e(this,a,b,c);break;case"utf8":case"utf-8":m=f(this,a,b,c);break;case"ascii":m=g(this,a,b,c);break;case"binary":m=h(this,a,b,c);break;case"base64":m=i(this,a,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":m=j(this,a,b,c);break;default:throw new Error("Unknown encoding")}return m},d.prototype.toString=function(a,b,c){var d=this;if(a=String(a||"utf8").toLowerCase(),b=Number(b)||0,c=void 0===c?d.length:Number(c),c===b)return"";var e;switch(a){case"hex":e=o(d,b,c);break;case"utf8":case"utf-8":e=l(d,b,c);break;case"ascii":e=m(d,b,c);break;case"binary":e=n(d,b,c);break;case"base64":e=k(d,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":e=p(d,b,c);break;default:throw new Error("Unknown encoding")}return e},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},d.prototype.equals=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),0===d.compare(this,a)},d.prototype.compare=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),d.compare(this,a)},d.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||0===d||(d=this.length),b||(b=0),d!==c&&0!==a.length&&0!==e.length){Q(d>=c,"sourceEnd < sourceStart"),Q(b>=0&&b<a.length,"targetStart out of bounds"),Q(c>=0&&c<e.length,"sourceStart out of bounds"),Q(d>=0&&d<=e.length,"sourceEnd out of bounds"),d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);var f=d-c;if(100>f||!T)for(var g=0;f>g;g++)a[g+b]=this[g+c];else a._set(this.subarray(c,c+f),b)}},d.prototype.slice=function(a,b){var c=this.length;if(a=~~a,b=void 0===b?c:~~b,0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c),0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c),a>b&&(b=a),T)return d._augment(this.subarray(a,b));for(var e=b-a,f=new d(e,void 0,!0),g=0;e>g;g++)f[g]=this[g+a];return f},d.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},d.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},d.prototype.readUInt8=function(a,b){return b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),a>=this.length?void 0:this[a]},d.prototype.readUInt16LE=function(a,b){return q(this,a,!0,b)},d.prototype.readUInt16BE=function(a,b){return q(this,a,!1,b)},d.prototype.readUInt32LE=function(a,b){return r(this,a,!0,b)},d.prototype.readUInt32BE=function(a,b){return r(this,a,!1,b)},d.prototype.readInt8=function(a,b){if(b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),!(a>=this.length)){var c=128&this[a];return c?-1*(255-this[a]+1):this[a]}},d.prototype.readInt16LE=function(a,b){return s(this,a,!0,b)},d.prototype.readInt16BE=function(a,b){return s(this,a,!1,b)},d.prototype.readInt32LE=function(a,b){return t(this,a,!0,b)},d.prototype.readInt32BE=function(a,b){return t(this,a,!1,b)},d.prototype.readFloatLE=function(a,b){return u(this,a,!0,b)},d.prototype.readFloatBE=function(a,b){return u(this,a,!1,b)},d.prototype.readDoubleLE=function(a,b){return v(this,a,!0,b)},d.prototype.readDoubleBE=function(a,b){return v(this,a,!1,b)},d.prototype.writeUInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"trying to write beyond buffer length"),N(a,255)),b>=this.length?void 0:(this[b]=a,b+1)},d.prototype.writeUInt16LE=function(a,b,c){return w(this,a,b,!0,c)},d.prototype.writeUInt16BE=function(a,b,c){return w(this,a,b,!1,c)},d.prototype.writeUInt32LE=function(a,b,c){return x(this,a,b,!0,c)},d.prototype.writeUInt32BE=function(a,b,c){return x(this,a,b,!1,c)},d.prototype.writeInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"Trying to write beyond buffer length"),O(a,127,-128)),b>=this.length?void 0:(a>=0?this.writeUInt8(a,b,c):this.writeUInt8(255+a+1,b,c),b+1)},d.prototype.writeInt16LE=function(a,b,c){return y(this,a,b,!0,c)},d.prototype.writeInt16BE=function(a,b,c){return y(this,a,b,!1,c)},d.prototype.writeInt32LE=function(a,b,c){return z(this,a,b,!0,c)},d.prototype.writeInt32BE=function(a,b,c){return z(this,a,b,!1,c)},d.prototype.writeFloatLE=function(a,b,c){return A(this,a,b,!0,c)},d.prototype.writeFloatBE=function(a,b,c){return A(this,a,b,!1,c)},d.prototype.writeDoubleLE=function(a,b,c){return B(this,a,b,!0,c)},d.prototype.writeDoubleBE=function(a,b,c){return B(this,a,b,!1,c)},d.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),Q(c>=b,"end < start"),c!==b&&0!==this.length){Q(b>=0&&b<this.length,"start out of bounds"),Q(c>=0&&c<=this.length,"end out of bounds");var d;if("number"==typeof a)for(d=b;c>d;d++)this[d]=a;else{var e=H(a.toString()),f=e.length;for(d=b;c>d;d++)this[d]=e[d%f]}return this}},d.prototype.inspect=function(){for(var a=[],b=this.length,d=0;b>d;d++)if(a[d]=G(this[d]),d===c.INSPECT_MAX_BYTES){a[d+1]="...";break}return"<Buffer "+a.join(" ")+">"},d.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(T)return new d(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;c>b;b+=1)a[b]=this[b];return a.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var U=d.prototype;d._augment=function(a){return a._isBuffer=!0,a._get=a.get,a._set=a.set,a.get=U.get,a.set=U.set,a.write=U.write,a.toString=U.toString,a.toLocaleString=U.toString,a.toJSON=U.toJSON,a.equals=U.equals,a.compare=U.compare,a.copy=U.copy,a.slice=U.slice,a.readUInt8=U.readUInt8,a.readUInt16LE=U.readUInt16LE,a.readUInt16BE=U.readUInt16BE,a.readUInt32LE=U.readUInt32LE,a.readUInt32BE=U.readUInt32BE,a.readInt8=U.readInt8,a.readInt16LE=U.readInt16LE,a.readInt16BE=U.readInt16BE,a.readInt32LE=U.readInt32LE,a.readInt32BE=U.readInt32BE,a.readFloatLE=U.readFloatLE,a.readFloatBE=U.readFloatBE,a.readDoubleLE=U.readDoubleLE,a.readDoubleBE=U.readDoubleBE,a.writeUInt8=U.writeUInt8,a.writeUInt16LE=U.writeUInt16LE,a.writeUInt16BE=U.writeUInt16BE,a.writeUInt32LE=U.writeUInt32LE,a.writeUInt32BE=U.writeUInt32BE,a.writeInt8=U.writeInt8,a.writeInt16LE=U.writeInt16LE,a.writeInt16BE=U.writeInt16BE,a.writeInt32LE=U.writeInt32LE,a.writeInt32BE=U.writeInt32BE,a.writeFloatLE=U.writeFloatLE,a.writeFloatBE=U.writeFloatBE,a.writeDoubleLE=U.writeDoubleLE,a.writeDoubleBE=U.writeDoubleBE,a.fill=U.fill,a.inspect=U.inspect,a.toArrayBuffer=U.toArrayBuffer,a};var V=/[^+\/0-9A-z]/g},{"base64-js":43,ieee754:44}],43:[function(a,b,c){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(a){"use strict";function b(a){var b=a.charCodeAt(0);return b===g?62:b===h?63:i>b?-1:i+10>b?b-i+26+26:k+26>b?b-k:j+26>b?b-j+26:void 0}function c(a){function c(a){j[l++]=a}var d,e,g,h,i,j;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new f(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,e=0;g>d;d+=4,e+=3)h=b(a.charAt(d))<<18|b(a.charAt(d+1))<<12|b(a.charAt(d+2))<<6|b(a.charAt(d+3)),c((16711680&h)>>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function e(a){function b(a){return d.charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var e,f,g,h=a.length%3,i="";for(e=0,g=a.length-h;g>e;e+=3)f=(a[e]<<16)+(a[e+1]<<8)+a[e+2],i+=c(f);switch(h){case 1:f=a[a.length-1],i+=b(f>>2),i+=b(f<<4&63),i+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],i+=b(f>>10),i+=b(f>>4&63),i+=b(f<<2&63),i+="="}return i}var f="undefined"!=typeof Uint8Array?Uint8Array:Array,g="+".charCodeAt(0),h="/".charCodeAt(0),i="0".charCodeAt(0),j="a".charCodeAt(0),k="A".charCodeAt(0);a.toByteArray=c,a.fromByteArray=e}("undefined"==typeof c?this.base64js={}:c)},{}],44:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],45:[function(a,b){b.exports="function"==typeof Object.create?function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],46:[function(a,b){function c(){}var d=b.exports={};d.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var d=c.shift();d()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.binding=function(){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(){throw new Error("process.chdir is not supported")}},{}],47:[function(a,b){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8}},{}],48:[function(a,b,c){(function(b,d){function e(a,b){var d={seen:[],stylize:g};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),p(b)?d.showHidden=b:b&&c._extend(d,b),v(d.showHidden)&&(d.showHidden=!1),v(d.depth)&&(d.depth=2),v(d.colors)&&(d.colors=!1),v(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=f),i(d,a,d.depth)}function f(a,b){var c=e.styles[b];return c?"["+e.colors[c][0]+"m"+a+"["+e.colors[c][1]+"m":a}function g(a){return a}function h(a){var b={};return a.forEach(function(a){b[a]=!0}),b}function i(a,b,d){if(a.customInspect&&b&&A(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return t(e)||(e=i(a,e,d)),e}var f=j(a,b);if(f)return f;var g=Object.keys(b),p=h(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),z(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return k(b);if(0===g.length){if(A(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(w(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(y(b))return a.stylize(Date.prototype.toString.call(b),"date");if(z(b))return k(b)}var r="",s=!1,u=["{","}"];if(o(b)&&(s=!0,u=["[","]"]),A(b)){var v=b.name?": "+b.name:"";r=" [Function"+v+"]"}if(w(b)&&(r=" "+RegExp.prototype.toString.call(b)),y(b)&&(r=" "+Date.prototype.toUTCString.call(b)),z(b)&&(r=" "+k(b)),0===g.length&&(!s||0==b.length))return u[0]+r+u[1];if(0>d)return w(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var x;return x=s?l(a,b,d,p,g):g.map(function(c){return m(a,b,d,p,c,s)}),a.seen.pop(),n(x,r,u)}function j(a,b){if(v(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return s(b)?a.stylize(""+b,"number"):p(b)?a.stylize(""+b,"boolean"):q(b)?a.stylize("null","null"):void 0}function k(a){return"["+Error.prototype.toString.call(a)+"]"}function l(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(F(b,String(g))?m(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(m(a,b,c,d,e,!0))}),f}function m(a,b,c,d,e,f){var g,h,j;if(j=Object.getOwnPropertyDescriptor(b,e)||{value:b[e]},j.get?h=j.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):j.set&&(h=a.stylize("[Setter]","special")),F(d,e)||(g="["+e+"]"),h||(a.seen.indexOf(j.value)<0?(h=q(c)?i(a,j.value,null):i(a,j.value,c-1),h.indexOf("\n")>-1&&(h=f?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),v(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function n(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function o(a){return Array.isArray(a)}function p(a){return"boolean"==typeof a}function q(a){return null===a}function r(a){return null==a}function s(a){return"number"==typeof a}function t(a){return"string"==typeof a}function u(a){return"symbol"==typeof a}function v(a){return void 0===a}function w(a){return x(a)&&"[object RegExp]"===C(a)}function x(a){return"object"==typeof a&&null!==a}function y(a){return x(a)&&"[object Date]"===C(a)}function z(a){return x(a)&&("[object Error]"===C(a)||a instanceof Error)}function A(a){return"function"==typeof a}function B(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function C(a){return Object.prototype.toString.call(a)}function D(a){return 10>a?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),J[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=/%[sdj%]/g;c.format=function(a){if(!t(a)){for(var b=[],c=0;c<arguments.length;c++)b.push(e(arguments[c]));return b.join(" ")}for(var c=1,d=arguments,f=d.length,g=String(a).replace(G,function(a){if("%%"===a)return"%";if(c>=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(b){return"[Circular]"}default:return a}}),h=d[c];f>c;h=d[++c])g+=q(h)||!x(h)?" "+h:" "+e(h);return g},c.deprecate=function(a,e){function f(){if(!g){if(b.throwDeprecation)throw new Error(e);b.traceDeprecation?console.trace(e):console.error(e),g=!0}return a.apply(this,arguments)}if(v(d.process))return function(){return c.deprecate(a,e).apply(this,arguments)};if(b.noDeprecation===!0)return a;var g=!1;return f};var H,I={};c.debuglog=function(a){if(v(H)&&(H=b.env.NODE_DEBUG||""),a=a.toUpperCase(),!I[a])if(new RegExp("\\b"+a+"\\b","i").test(H)){var d=b.pid;I[a]=function(){var b=c.format.apply(c,arguments);console.error("%s %d: %s",a,d,b)}}else I[a]=function(){};return I[a]},c.inspect=e,e.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},e.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},c.isArray=o,c.isBoolean=p,c.isNull=q,c.isNullOrUndefined=r,c.isNumber=s,c.isString=t,c.isSymbol=u,c.isUndefined=v,c.isRegExp=w,c.isObject=x,c.isDate=y,c.isError=z,c.isFunction=A,c.isPrimitive=B,c.isBuffer=a("./support/isBuffer");var J=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c.log=function(){console.log("%s - %s",E(),c.format.apply(c,arguments))},c.inherits=a("inherits"),c._extend=function(a,b){if(!b||!x(b))return a;for(var c=Object.keys(b),d=c.length;d--;)a[c[d]]=b[c[d]];return a}}).call(this,a("JkpR2F"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":47,JkpR2F:46,inherits:45}],49:[function(a,b,c){!function(d){"use strict";"function"==typeof a&&"object"==typeof c&&"object"==typeof b?b.exports=d:"function"==typeof define&&define.amd?define(function(){return d}):chai.use(d)}(function(a,b){"use strict";function c(a){return"function"==typeof a&&"function"==typeof a.getCall&&"function"==typeof a.calledWithExactly}function d(a){return 1===a?"once":2===a?"twice":3===a?"thrice":(a||0)+" times"}function e(a){return a&&c(a.proxy)}function f(a){if(!c(a._obj)&&!e(a._obj))throw new TypeError(b.inspect(a._obj)+" is not a spy or a call to a spy!")}function g(a,b,d,e,f){function g(b){return a.printf.apply(a,b)}var h=e?"always have ":"have ";return d=d||"",c(a.proxy)&&(a=a.proxy),{affirmative:g(["expected %n to "+h+b+d].concat(f)),negative:g(["expected %n to not "+h+b].concat(f))}}function h(c,d,e){b.addProperty(a.Assertion.prototype,c,function(){f(this);var a=g(this._obj,d,e,!1);this.assert(this._obj[c],a.affirmative,a.negative)})}function i(c,e,h){b.addMethod(a.Assertion.prototype,c,function(a){f(this);var b=g(this._obj,e,h,!1,[d(a)]);this.assert(this._obj[c]===a,b.affirmative,b.negative)})}function j(a,c,d){return function(){f(this);var e="always"+a[0].toUpperCase()+a.substring(1),h=b.flag(this,"always")&&"function"==typeof this._obj[e],i=h?e:a,j=g(this._obj,c,d,h,n.call(arguments));this.assert(this._obj[i].apply(this._obj,arguments),j.affirmative,j.negative)}}function k(c,d,e){var f=j(c,d,e);b.addProperty(a.Assertion.prototype,c,f)}function l(c,d,e,f){var g=j(d,e,f);b.addMethod(a.Assertion.prototype,c,g)}function m(a,b,c){l(a,a,b,c)}var n=Array.prototype.slice;b.addProperty(a.Assertion.prototype,"always",function(){b.flag(this,"always",!0)}),h("called","been called"," at least once, but it was never called"),i("callCount","been called exactly %1",", but it was called %c%C"),h("calledOnce","been called exactly once",", but it was called %c%C"),h("calledTwice","been called exactly twice",", but it was called %c%C"),h("calledThrice","been called exactly thrice",", but it was called %c%C"),k("calledWithNew","been called with new"),m("calledBefore","been called before %1"),m("calledAfter","been called after %1"),m("calledOn","been called with %1 as this",", but it was called with %t instead"),m("calledWith","been called with arguments %*","%C"),m("calledWithExactly","been called with exact arguments %*","%C"),m("calledWithMatch","been called with arguments matching %*","%C"),m("returned","returned %1"),l("thrown","threw","thrown %1")
|
||
})},{}],50:[function(a,b,c){"use strict";!function(d){function e(a){var b=!1;try{a.appendChild(l),b=l.parentNode==a}catch(c){return!1}finally{try{a.removeChild(l)}catch(c){}}return b}function f(a){return l&&a&&1===a.nodeType&&e(a)}function g(a){return"function"==typeof a||!!(a&&a.constructor&&a.call&&a.apply)}function h(a){return"number"==typeof a&&isNaN(a)}function i(a,b){for(var c in b)m.call(a,c)||(a[c]=b[c])}function j(a){return"function"==typeof a&&"function"==typeof a.restore&&a.restore.sinon}function k(a,b,c){c.exports=n,n.spy=a("./sinon/spy"),n.spyCall=a("./sinon/call"),n.behavior=a("./sinon/behavior"),n.stub=a("./sinon/stub"),n.mock=a("./sinon/mock"),n.collection=a("./sinon/collection"),n.assert=a("./sinon/assert"),n.sandbox=a("./sinon/sandbox"),n.test=a("./sinon/test"),n.testCase=a("./sinon/test_case"),n.match=a("./sinon/match")}var l="undefined"!=typeof document&&document.createElement("div"),m=Object.prototype.hasOwnProperty,n={wrapMethod:function(a,b,c){if(!a)throw new TypeError("Should wrap property of object");if("function"!=typeof c)throw new TypeError("Method wrapper should be function");var d,e=a[b];if(g(e)){if(e.restore&&e.restore.sinon)d=new TypeError("Attempted to wrap "+b+" which is already wrapped");else if(e.calledBefore){var f=e.returns?"stubbed":"spied on";d=new TypeError("Attempted to wrap "+b+" which is already "+f)}}else d=new TypeError("Attempted to wrap "+typeof e+" property "+b+" as function");if(d)throw e&&e._stack&&(d.stack+="\n--------------\n"+e._stack),d;var h=a.hasOwnProperty?a.hasOwnProperty(b):m.call(a,b);return a[b]=c,c.displayName=b,c._stack=new Error("Stack Trace for original").stack,c.restore=function(){h||delete a[b],a[b]===c&&(a[b]=e)},c.restore.sinon=!0,i(c,e),c},extend:function(a){for(var b=1,c=arguments.length;c>b;b+=1)for(var d in arguments[b])arguments[b].hasOwnProperty(d)&&(a[d]=arguments[b][d]),arguments[b].hasOwnProperty("toString")&&arguments[b].toString!=a.toString&&(a.toString=arguments[b].toString);return a},create:function(a){var b=function(){};return b.prototype=a,new b},deepEqual:function t(a,b){if(n.match&&n.match.isMatcher(a))return a.test(b);if("object"!=typeof a||"object"!=typeof b)return h(a)&&h(b)?!0:a===b;if(f(a)||f(b))return a===b;if(a===b)return!0;if(null===a&&null!==b||null!==a&&null===b)return!1;if(a instanceof RegExp&&b instanceof RegExp)return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;var c=Object.prototype.toString.call(a);if(c!=Object.prototype.toString.call(b))return!1;if("[object Date]"==c)return a.valueOf()===b.valueOf();var d,e=0,g=0;if("[object Array]"==c&&a.length!==b.length)return!1;for(d in a){if(e+=1,!(d in b))return!1;if(!t(a[d],b[d]))return!1}for(d in b)g+=1;return e==g},functionName:function(a){var b=a.displayName||a.name;if(!b){var c=a.toString().match(/function ([^\s\(]+)/);b=c&&c[1]}return b},functionToString:function(){if(this.getCall&&this.callCount)for(var a,b,c=this.callCount;c--;){a=this.getCall(c).thisValue;for(b in a)if(a[b]===this)return b}return this.displayName||"sinon fake"},getConfig:function(a){var b={};a=a||{};var c=n.defaultConfig;for(var d in c)c.hasOwnProperty(d)&&(b[d]=a.hasOwnProperty(d)?a[d]:c[d]);return b},format:function(a){return""+a},defaultConfig:{injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},timesInWords:function(a){return 1==a&&"once"||2==a&&"twice"||3==a&&"thrice"||(a||0)+" times"},calledInOrder:function(a){for(var b=1,c=a.length;c>b;b++)if(!a[b-1].calledBefore(a[b])||!a[b].called)return!1;return!0},orderByFirstCall:function(a){return a.sort(function(a,b){var c=a.getCall(0),d=b.getCall(0),e=c&&c.callId||-1,f=d&&d.callId||-1;return f>e?-1:1})},log:function(){},logError:function(a,b){var c=a+" threw exception: ";n.log(c+"["+b.name+"] "+b.message),b.stack&&n.log(b.stack),setTimeout(function(){throw b.message=c+b.message,b},0)},typeOf:function(a){if(null===a)return"null";if(void 0===a)return"undefined";var b=Object.prototype.toString.call(a);return b.substring(8,b.length-1).toLowerCase()},createStubInstance:function(a){if("function"!=typeof a)throw new TypeError("The constructor should be a function.");return n.stub(n.create(a.prototype))},restore:function(a){if(null!==a&&"object"==typeof a)for(var b in a)j(a[b])&&a[b].restore();else j(a)&&a.restore()}},o="undefined"!=typeof b&&b.exports&&"function"==typeof a,p="function"==typeof define&&"object"==typeof define.amd&&define.amd;if(p)define(k);else if(o){try{d=a("formatio")}catch(q){}k(a,c,b)}if(d){var r=d.configure({quoteStrings:!1});n.format=function(){return r.ascii.apply(r,arguments)}}else if(o)try{var s=a("util");n.format=function(a){return"object"==typeof a&&a.toString===Object.prototype.toString?s.inspect(a):a}}catch(q){}return n}("object"==typeof formatio&&formatio)},{"./sinon/assert":51,"./sinon/behavior":52,"./sinon/call":53,"./sinon/collection":54,"./sinon/match":55,"./sinon/mock":56,"./sinon/sandbox":57,"./sinon/spy":58,"./sinon/stub":59,"./sinon/test":60,"./sinon/test_case":61,formatio:63,util:48}],51:[function(a,b){(function(c){"use strict";!function(c,d){function e(){for(var a,b=0,c=arguments.length;c>b;++b)a=arguments[b],a||i.fail("fake is not a spy"),"function"!=typeof a&&i.fail(a+" is not a function"),"function"!=typeof a.getCall&&i.fail(a+" is not stubbed")}function f(a,b){a=a||d;var c=a.fail||i.fail;c.call(a,b)}function g(a,b,c){2==arguments.length&&(c=b,b=a),i[a]=function(d){e(d);var g=k.call(arguments,1),h=!1;h="function"==typeof b?!b(d):"function"==typeof d[b]?!d[b].apply(d,g):!d[b],h?f(this,d.printf.apply(d,[c].concat(g))):i.pass(a)}}function h(a,b){return!a||/^fail/.test(b)?b:a+b.slice(0,1).toUpperCase()+b.slice(1)}var i,j="undefined"!=typeof b&&b.exports&&"function"==typeof a,k=Array.prototype.slice;!c&&j&&(c=a("../sinon")),c&&(i={failException:"AssertError",fail:function(a){var b=new Error(a);throw b.name=this.failException||i.failException,b},pass:function(){},callOrder:function(){e.apply(null,arguments);var a="",b="";if(c.calledInOrder(arguments))i.pass("callOrder");else{try{a=[].join.call(arguments,", ");for(var d=k.call(arguments),g=d.length;g;)d[--g].called||d.splice(g,1);b=c.orderByFirstCall(d).join(", ")}catch(h){}f(this,"expected "+a+" to be called in order but were called as "+b)}},callCount:function(a,b){if(e(a),a.callCount!=b){var d="expected %n to be called "+c.timesInWords(b)+" but was called %c%C";f(this,a.printf(d))}else i.pass("callCount")},expose:function(a,b){if(!a)throw new TypeError("target is null or undefined");var c=b||{},d="undefined"==typeof c.prefix&&"assert"||c.prefix,e="undefined"==typeof c.includeFail||!!c.includeFail;for(var f in this)"export"==f||!e&&/^(fail)/.test(f)||(a[h(d,f)]=this[f]);return a},match:function(a,b){var d=c.match(b);if(d.test(a))i.pass("match");else{var e=["expected value to match"," expected = "+c.format(b)," actual = "+c.format(a)];f(this,e.join("\n"))}}},g("called","expected %n to have been called at least once but was never called"),g("notCalled",function(a){return!a.called},"expected %n to not have been called but was called %c%C"),g("calledOnce","expected %n to be called once but was called %c%C"),g("calledTwice","expected %n to be called twice but was called %c%C"),g("calledThrice","expected %n to be called thrice but was called %c%C"),g("calledOn","expected %n to be called with %1 as this but was called with %t"),g("alwaysCalledOn","expected %n to always be called with %1 as this but was called with %t"),g("calledWithNew","expected %n to be called with new"),g("alwaysCalledWithNew","expected %n to always be called with new"),g("calledWith","expected %n to be called with arguments %*%C"),g("calledWithMatch","expected %n to be called with match %*%C"),g("alwaysCalledWith","expected %n to always be called with arguments %*%C"),g("alwaysCalledWithMatch","expected %n to always be called with match %*%C"),g("calledWithExactly","expected %n to be called with exact arguments %*%C"),g("alwaysCalledWithExactly","expected %n to always be called with exact arguments %*%C"),g("neverCalledWith","expected %n to never be called with arguments %*%C"),g("neverCalledWithMatch","expected %n to never be called with match %*%C"),g("threw","%n did not throw exception%C"),g("alwaysThrew","%n did not always throw exception%C"),c.assert=i,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=i}):j&&(b.exports=i))}("object"==typeof sinon&&sinon||null,"undefined"!=typeof window?window:"undefined"!=typeof self?self:c)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../sinon":50}],52:[function(a,b){(function(c){"use strict";!function(d){function e(a,b){return"string"==typeof a?(this.exception=new Error(b||""),this.exception.name=a):this.exception=a?a:new Error("Error"),this}function f(a,b){var c=a.callArgAt;if(0>c){for(var d=a.callArgProp,e=0,f=b.length;f>e;++e){if(!d&&"function"==typeof b[e])return b[e];if(d&&b[e]&&"function"==typeof b[e][d])return b[e][d]}return null}return b[c]}function g(a,b,c){if(a.callArgAt<0){var e;return e=a.callArgProp?d.functionName(a.stub)+" expected to yield to '"+a.callArgProp+"', but no object with such a property was passed.":d.functionName(a.stub)+" expected to yield, but no callback was passed.",c.length>0&&(e+=" Received ["+l.call(c,", ")+"]"),e}return"argument at index "+a.callArgAt+" is not a function: "+b}function h(a,b){if("number"==typeof a.callArgAt){var c=f(a,b);if("function"!=typeof c)throw new TypeError(g(a,c,b));a.callbackAsync?m(function(){c.apply(a.callbackContext,a.callbackArguments)}):c.apply(a.callbackContext,a.callbackArguments)}}var i="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!d&&i&&(d=a("../sinon")),d){var j,k=Array.prototype.slice,l=Array.prototype.join,m=function(){return"object"==typeof c&&"function"==typeof c.nextTick?c.nextTick:"function"==typeof setImmediate?setImmediate:function(a){setTimeout(a,0)}}();j={create:function(a){var b=d.extend({},d.behavior);return delete b.create,b.stub=a,b},isPresent:function(){return"number"==typeof this.callArgAt||this.exception||"number"==typeof this.returnArgAt||this.returnThis||this.returnValueDefined},invoke:function(a,b){if(h(this,b),this.exception)throw this.exception;return"number"==typeof this.returnArgAt?b[this.returnArgAt]:this.returnThis?a:this.returnValue},onCall:function(a){return this.stub.onCall(a)},onFirstCall:function(){return this.stub.onFirstCall()},onSecondCall:function(){return this.stub.onSecondCall()},onThirdCall:function(){return this.stub.onThirdCall()},withArgs:function(){throw new Error('Defining a stub by invoking "stub.onCall(...).withArgs(...)" is not supported. Use "stub.withArgs(...).onCall(...)" to define sequential behavior for calls with certain arguments.')},callsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOn:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgWith:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.callArgAt=a,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOnWith:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},yields:function(){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,0),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsOn:function(a){if("object"!=typeof a)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=a,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsTo:function(a){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=a,this.callbackAsync=!1,this},yieldsToOn:function(a,b){if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=a,this.callbackAsync=!1,this},"throws":e,throwsException:e,returns:function(a){return this.returnValue=a,this.returnValueDefined=!0,this},returnsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.returnArgAt=a,this},returnsThis:function(){return this.returnThis=!0,this}};for(var n in j)j.hasOwnProperty(n)&&n.match(/^(callsArg|yields)/)&&!n.match(/Async/)&&(j[n+"Async"]=function(a){return function(){var b=this[a].apply(this,arguments);return this.callbackAsync=!0,b}}(n));d.behavior=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):i&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)}).call(this,a("JkpR2F"))},{"../sinon":50,JkpR2F:46}],53:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.functionName(a)+b;throw d.length&&(e+=" Received ["+g.call(d).join(", ")+"]"),new Error(e)}function e(a,b,d,e,f,g){if("number"!=typeof g)throw new TypeError("Call id is not a number");var i=c.create(h);return i.proxy=a,i.thisValue=b,i.args=d,i.returnValue=e,i.exception=f,i.callId=g,i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&f&&(c=a("../sinon")),c){var g=Array.prototype.slice,h={calledOn:function(a){return c.match&&c.match.isMatcher(a)?a.test(this.thisValue):this.thisValue===a},calledWith:function(){for(var a=0,b=arguments.length;b>a;a+=1)if(!c.deepEqual(arguments[a],this.args[a]))return!1;return!0},calledWithMatch:function(){for(var a=0,b=arguments.length;b>a;a+=1){var d=this.args[a],e=arguments[a];if(!c.match||!c.match(e).test(d))return!1}return!0},calledWithExactly:function(){return arguments.length==this.args.length&&this.calledWith.apply(this,arguments)},notCalledWith:function(){return!this.calledWith.apply(this,arguments)},notCalledWithMatch:function(){return!this.calledWithMatch.apply(this,arguments)},returned:function(a){return c.deepEqual(a,this.returnValue)},threw:function(a){return"undefined"!=typeof a&&this.exception?this.exception===a||this.exception.name===a:!!this.exception},calledWithNew:function(){return this.proxy.prototype&&this.thisValue instanceof this.proxy},calledBefore:function(a){return this.callId<a.callId},calledAfter:function(a){return this.callId>a.callId},callArg:function(a){this.args[a]()},callArgOn:function(a,b){this.args[a].apply(b)},callArgWith:function(a){this.callArgOnWith.apply(this,[a,null].concat(g.call(arguments,1)))},callArgOnWith:function(a,b){var c=g.call(arguments,2);this.args[a].apply(b,c)},"yield":function(){this.yieldOn.apply(this,[null].concat(g.call(arguments,0)))},yieldOn:function(a){for(var b=this.args,c=0,e=b.length;e>c;++c)if("function"==typeof b[c])return void b[c].apply(a,g.call(arguments,1));d(this.proxy," cannot yield since no callback was passed.",b)},yieldTo:function(a){this.yieldToOn.apply(this,[a,null].concat(g.call(arguments,1)))},yieldToOn:function(a,b){for(var c=this.args,e=0,f=c.length;f>e;++e)if(c[e]&&"function"==typeof c[e][a])return void c[e][a].apply(b,g.call(arguments,2));d(this.proxy," cannot yield to '"+a+"' since no callback was passed.",c)},toString:function(){for(var a=this.proxy.toString()+"(",b=[],d=0,e=this.args.length;e>d;++d)b.push(c.format(this.args[d]));return a=a+b.join(", ")+")","undefined"!=typeof this.returnValue&&(a+=" => "+c.format(this.returnValue)),this.exception&&(a+=" !"+this.exception.name,this.exception.message&&(a+="("+this.exception.message+")")),a}};h.invokeCallback=h.yield,e.toString=h.toString,c.spyCall=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],54:[function(a,b){"use strict";!function(c){function d(a){return a.fakes||(a.fakes=[]),a.fakes}function e(a,b){for(var c=d(a),e=0,f=c.length;f>e;e+=1)"function"==typeof c[e][b]&&c[e][b]()}function f(a){for(var b=d(a),c=0;c<b.length;)b.splice(c,1)}var g="undefined"!=typeof b&&b.exports&&"function"==typeof a,h=[].push,i=Object.prototype.hasOwnProperty;if(!c&&g&&(c=a("../sinon")),c){var j={verify:function(){e(this,"verify")},restore:function(){e(this,"restore"),f(this)},verifyAndRestore:function(){var a;try{this.verify()}catch(b){a=b}if(this.restore(),a)throw a},add:function(a){return h.call(d(this),a),a},spy:function(){return this.add(c.spy.apply(c,arguments))},stub:function(a,b,d){if(b){var e=a[b];if("function"!=typeof e){if(!i.call(a,b))throw new TypeError("Cannot stub non-existent own property "+b);return a[b]=d,this.add({restore:function(){a[b]=e}})}}if(!b&&a&&"object"==typeof a){var f=c.stub.apply(c,arguments);for(var g in f)"function"==typeof f[g]&&this.add(f[g]);return f}return this.add(c.stub.apply(c,arguments))},mock:function(){return this.add(c.mock.apply(c,arguments))},inject:function(a){var b=this;return a.spy=function(){return b.spy.apply(b,arguments)},a.stub=function(){return b.stub.apply(b,arguments)},a.mock=function(){return b.mock.apply(b,arguments)},a}};c.collection=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):g&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],55:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.typeOf(a);if(e!==b)throw new TypeError("Expected type of "+d+" to be "+b+", but was "+e)}function e(a){return i.isPrototypeOf(a)}function f(a,b){if(null===b||void 0===b)return!1;for(var d in a)if(a.hasOwnProperty(d)){var e=a[d],g=b[d];if(j.isMatcher(e)){if(!e.test(g))return!1}else if("object"===c.typeOf(e)){if(!f(e,g))return!1}else if(!c.deepEqual(e,g))return!1}return!0}function g(a,b){return function(e,f){d(e,"string","property");var g=1===arguments.length,h=b+'("'+e+'"';return g||(h+=", "+f),h+=")",j(function(b){return void 0!==b&&null!==b&&a(b,e)?g||c.deepEqual(f,b[e]):!1},h)}}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i={toString:function(){return this.message}};i.or=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)||a.test(c)},d.message=b.message+".or("+a.message+")",d},i.and=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)&&a.test(c)},d.message=b.message+".and("+a.message+")",d};var j=function(a,b){var d=c.create(i),e=c.typeOf(a);switch(e){case"object":if("function"==typeof a.test)return d.test=function(b){return a.test(b)===!0},d.message="match("+c.functionName(a.test)+")",d;var g=[];for(var h in a)a.hasOwnProperty(h)&&g.push(h+": "+a[h]);d.test=function(b){return f(a,b)},d.message="match("+g.join(", ")+")";break;case"number":d.test=function(b){return a==b};break;case"string":d.test=function(b){return"string"!=typeof b?!1:-1!==b.indexOf(a)},d.message='match("'+a+'")';break;case"regexp":d.test=function(b){return"string"!=typeof b?!1:a.test(b)};break;case"function":d.test=a,d.message=b?b:"match("+c.functionName(a)+")";break;default:d.test=function(b){return c.deepEqual(a,b)}}return d.message||(d.message="match("+a+")"),d};j.isMatcher=e,j.any=j(function(){return!0},"any"),j.defined=j(function(a){return null!==a&&void 0!==a},"defined"),j.truthy=j(function(a){return!!a},"truthy"),j.falsy=j(function(a){return!a},"falsy"),j.same=function(a){return j(function(b){return a===b},"same("+a+")")},j.typeOf=function(a){return d(a,"string","type"),j(function(b){return c.typeOf(b)===a},'typeOf("'+a+'")')},j.instanceOf=function(a){return d(a,"function","type"),j(function(b){return b instanceof a},"instanceOf("+c.functionName(a)+")")},j.has=g(function(a,b){return"object"==typeof a?b in a:void 0!==a[b]},"has"),j.hasOwn=g(function(a,b){return a.hasOwnProperty(b)},"hasOwn"),j.bool=j.typeOf("boolean"),j.number=j.typeOf("number"),j.string=j.typeOf("string"),j.object=j.typeOf("object"),j.func=j.typeOf("function"),j.array=j.typeOf("array"),j.regexp=j.typeOf("regexp"),j.date=j.typeOf("date"),c.match=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):h&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],56:[function(a,b){"use strict";!function(c){function d(a){return a?d.create(a):c.expectation.create("Anonymous mock")}var e,f="undefined"!=typeof b&&b.exports&&"function"==typeof a,g=[].push;if(!c&&f&&(c=a("../sinon")),c){e=c.match,!e&&f&&(e=a("./match")),c.mock=d,c.extend(d,function(){function a(a,b){if(a)for(var c=0,d=a.length;d>c;c+=1)b(a[c])}return{create:function(a){if(!a)throw new TypeError("object is null");var b=c.extend({},d);return b.object=a,delete b.create,b},expects:function(a){if(!a)throw new TypeError("method is falsy");if(this.expectations||(this.expectations={},this.proxies=[]),!this.expectations[a]){this.expectations[a]=[];var b=this;c.wrapMethod(this.object,a,function(){return b.invokeMethod(a,this,arguments)}),g.call(this.proxies,a)}var d=c.expectation.create(a);return g.call(this.expectations[a],d),d},restore:function(){var b=this.object;a(this.proxies,function(a){"function"==typeof b[a].restore&&b[a].restore()})},verify:function(){var b=this.expectations||{},d=[],e=[];return a(this.proxies,function(c){a(b[c],function(a){a.met()?g.call(e,a.toString()):g.call(d,a.toString())})}),this.restore(),d.length>0?c.expectation.fail(d.concat(e).join("\n")):c.expectation.pass(d.concat(e).join("\n")),!0},invokeMethod:function(a,b,d){var e,f=this.expectations&&this.expectations[a],h=f&&f.length||0;for(e=0;h>e;e+=1)if(!f[e].met()&&f[e].allowsCall(b,d))return f[e].apply(b,d);var i,j=[],k=0;for(e=0;h>e;e+=1)f[e].allowsCall(b,d)?i=i||f[e]:k+=1,g.call(j," "+f[e].toString());return 0===k?i.apply(b,d):(j.unshift("Unexpected call: "+c.spyCall.toString.call({proxy:a,args:d})),void c.expectation.fail(j.join("\n")))}}}());var h=c.timesInWords;c.expectation=function(){function a(a){return 0==a?"never called":"called "+h(a)}function b(a){var b=a.minCalls,c=a.maxCalls;if("number"==typeof b&&"number"==typeof c){var d=h(b);return b!=c&&(d="at least "+d+" and at most "+h(c)),d}return"number"==typeof b?"at least "+h(b):"at most "+h(c)}function d(a){var b="number"==typeof a.minCalls;return!b||a.callCount>=a.minCalls}function f(a){return"number"!=typeof a.maxCalls?!1:a.callCount==a.maxCalls}function i(a,b){return e&&e.isMatcher(a)?a.test(b):!0}var j=Array.prototype.slice,k=c.spy.invoke;return{minCalls:1,maxCalls:1,create:function(a){var b=c.extend(c.stub.create(),c.expectation);return delete b.create,b.method=a,b},invoke:function(a,b,c){return this.verifyCallAllowed(b,c),k.apply(this,arguments)},atLeast:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");return this.limitsSet||(this.maxCalls=null,this.limitsSet=!0),this.minCalls=a,this},atMost:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");return this.limitsSet||(this.minCalls=null,this.limitsSet=!0),this.maxCalls=a,this},never:function(){return this.exactly(0)},once:function(){return this.exactly(1)},twice:function(){return this.exactly(2)},thrice:function(){return this.exactly(3)},exactly:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not a number");return this.atLeast(a),this.atMost(a)},met:function(){return!this.failed&&d(this)},verifyCallAllowed:function(a,b){if(f(this)&&(this.failed=!0,c.expectation.fail(this.method+" already called "+h(this.maxCalls))),"expectedThis"in this&&this.expectedThis!==a&&c.expectation.fail(this.method+" called with "+a+" as thisValue, expected "+this.expectedThis),"expectedArguments"in this){b||c.expectation.fail(this.method+" received no arguments, expected "+c.format(this.expectedArguments)),b.length<this.expectedArguments.length&&c.expectation.fail(this.method+" received too few arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments)),this.expectsExactArgCount&&b.length!=this.expectedArguments.length&&c.expectation.fail(this.method+" received too many arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments));for(var d=0,e=this.expectedArguments.length;e>d;d+=1)i(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", didn't match "+this.expectedArguments.toString()),c.deepEqual(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", expected "+c.format(this.expectedArguments))}},allowsCall:function(a,b){if(this.met()&&f(this))return!1;if("expectedThis"in this&&this.expectedThis!==a)return!1;if(!("expectedArguments"in this))return!0;if(b=b||[],b.length<this.expectedArguments.length)return!1;if(this.expectsExactArgCount&&b.length!=this.expectedArguments.length)return!1;for(var d=0,e=this.expectedArguments.length;e>d;d+=1){if(!i(this.expectedArguments[d],b[d]))return!1;if(!c.deepEqual(this.expectedArguments[d],b[d]))return!1}return!0},withArgs:function(){return this.expectedArguments=j.call(arguments),this},withExactArgs:function(){return this.withArgs.apply(this,arguments),this.expectsExactArgCount=!0,this},on:function(a){return this.expectedThis=a,this},toString:function(){var d=(this.expectedArguments||[]).slice();this.expectsExactArgCount||g.call(d,"[...]");var e=c.spyCall.toString.call({proxy:this.method||"anonymous mock expectation",args:d}),f=e.replace(", [...","[, ...")+" "+b(this);return this.met()?"Expectation met: "+f:"Expected "+f+" ("+a(this.callCount)+")"},verify:function(){return this.met()?c.expectation.pass(this.toString()):c.expectation.fail(this.toString()),!0},pass:function(a){c.assert.pass(a)},fail:function(a){var b=new Error(a);throw b.name="ExpectationError",b}}}(),c.mock=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):f&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50,"./match":55}],57:[function(a,b){"use strict";if("undefined"!=typeof b&&b.exports&&"function"==typeof a){var c=a("../sinon");c.extend(c,a("./util/fake_timers"))}!function(){function a(a,b,c,d){d&&(!b.injectInto||c in b.injectInto?e.call(a.args,d):(b.injectInto[c]=d,a.injectedKeys.push(c)))}function d(a){var b=c.create(c.sandbox);return a.useFakeServer&&("object"==typeof a.useFakeServer&&(b.serverPrototype=a.useFakeServer),b.useFakeServer()),a.useFakeTimers&&("object"==typeof a.useFakeTimers?b.useFakeTimers.apply(b,a.useFakeTimers):b.useFakeTimers()),b}var e=[].push;c.sandbox=c.extend(c.create(c.collection),{useFakeTimers:function(){return this.clock=c.useFakeTimers.apply(c,arguments),this.add(this.clock)},serverPrototype:c.fakeServer,useFakeServer:function(){var a=this.serverPrototype||c.fakeServer;return a&&a.create?(this.server=a.create(),this.add(this.server)):null},inject:function(a){return c.collection.inject.call(this,a),this.clock&&(a.clock=this.clock),this.server&&(a.server=this.server,a.requests=this.server.requests),a},restore:function(){c.collection.restore.apply(this,arguments),this.restoreContext()},restoreContext:function(){if(this.injectedKeys){for(var a=0,b=this.injectedKeys.length;b>a;a++)delete this.injectInto[this.injectedKeys[a]];this.injectedKeys=[]}},create:function(b){if(!b)return c.create(c.sandbox);var e=d(b);e.args=e.args||[],e.injectedKeys=[],e.injectInto=b.injectInto;var f,g,h=e.inject({});if(b.properties)for(var i=0,j=b.properties.length;j>i;i++)f=b.properties[i],g=h[f]||"sandbox"==f&&e,a(e,b,f,g);else a(e,b,"sandbox",g);return e}}),c.sandbox.useFakeXMLHttpRequest=c.sandbox.useFakeServer,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=c.sandbox}):"undefined"!=typeof b&&b.exports&&(b.exports=c.sandbox)}()},{"../sinon":50,"./util/fake_timers":62}],58:[function(require,module,exports){"use strict";!function(sinon){function spy(a,b){if(!b&&"function"==typeof a)return spy.create(a);if(!a&&!b)return spy.create(function(){});var c=a[b];return sinon.wrapMethod(a,b,spy.create(c))}function matchingFake(a,b,c){if(a)for(var d=0,e=a.length;e>d;d++)if(a[d].matches(b,c))return a[d]}function incrementCallCount(){this.called=!0,this.callCount+=1,this.notCalled=!1,this.calledOnce=1==this.callCount,this.calledTwice=2==this.callCount,this.calledThrice=3==this.callCount}function createCallProperties(){this.firstCall=this.getCall(0),this.secondCall=this.getCall(1),this.thirdCall=this.getCall(2),this.lastCall=this.getCall(this.callCount-1)}function createProxy(func){var p;return func.length?eval("p = (function proxy("+vars.substring(0,2*func.length-1)+") { return p.invoke(func, this, slice.call(arguments)); });"):p=function(){return p.invoke(func,this,slice.call(arguments))},p}function delegateToCalls(a,b,c,d){spyApi[a]=function(){if(!this.called)return d?d.apply(this,arguments):!1;for(var e,f=0,g=0,h=this.callCount;h>g;g+=1)if(e=this.getCall(g),e[c||a].apply(e,arguments)&&(f+=1,b))return!0;return f===this.callCount}}var commonJSModule="undefined"!=typeof module&&module.exports&&"function"==typeof require,push=Array.prototype.push,slice=Array.prototype.slice,callId=0;if(!sinon&&commonJSModule&&(sinon=require("../sinon")),sinon){var vars="a,b,c,d,e,f,g,h,i,j,k,l",uuid=0,spyApi={reset:function(){if(this.called=!1,this.notCalled=!0,this.calledOnce=!1,this.calledTwice=!1,this.calledThrice=!1,this.callCount=0,this.firstCall=null,this.secondCall=null,this.thirdCall=null,this.lastCall=null,this.args=[],this.returnValues=[],this.thisValues=[],this.exceptions=[],this.callIds=[],this.fakes)for(var a=0;a<this.fakes.length;a++)this.fakes[a].reset()},create:function(a){var b;"function"!=typeof a?a=function(){}:b=sinon.functionName(a);var c=createProxy(a);return sinon.extend(c,spy),delete c.create,sinon.extend(c,a),c.reset(),c.prototype=a.prototype,c.displayName=b||"spy",c.toString=sinon.functionToString,c._create=sinon.spy.create,c.id="spy#"+uuid++,c},invoke:function(a,b,c){var d,e,f=matchingFake(this.fakes,c);incrementCallCount.call(this),push.call(this.thisValues,b),push.call(this.args,c),push.call(this.callIds,callId++),createCallProperties.call(this);try{e=f?f.invoke(a,b,c):(this.func||a).apply(b,c);var g=this.getCall(this.callCount-1);g.calledWithNew()&&"object"!=typeof e&&(e=b)}catch(h){d=h}if(push.call(this.exceptions,d),push.call(this.returnValues,e),createCallProperties.call(this),void 0!==d)throw d;return e},named:function(a){return this.displayName=a,this},getCall:function(a){return 0>a||a>=this.callCount?null:sinon.spyCall(this,this.thisValues[a],this.args[a],this.returnValues[a],this.exceptions[a],this.callIds[a])},getCalls:function(){var a,b=[];for(a=0;a<this.callCount;a++)b.push(this.getCall(a));return b},calledBefore:function(a){return this.called?a.called?this.callIds[0]<a.callIds[a.callIds.length-1]:!0:!1},calledAfter:function(a){return this.called&&a.called?this.callIds[this.callCount-1]>a.callIds[a.callCount-1]:!1},withArgs:function(){var a=slice.call(arguments);if(this.fakes){var b=matchingFake(this.fakes,a,!0);if(b)return b}else this.fakes=[];var c=this,d=this._create();d.matchingAguments=a,d.parent=this,push.call(this.fakes,d),d.withArgs=function(){return c.withArgs.apply(c,arguments)};for(var e=0;e<this.args.length;e++)d.matches(this.args[e])&&(incrementCallCount.call(d),push.call(d.thisValues,this.thisValues[e]),push.call(d.args,this.args[e]),push.call(d.returnValues,this.returnValues[e]),push.call(d.exceptions,this.exceptions[e]),push.call(d.callIds,this.callIds[e]));return createCallProperties.call(d),d
|
||
},matches:function(a,b){var c=this.matchingAguments;return c.length<=a.length&&sinon.deepEqual(c,a.slice(0,c.length))?!b||c.length==a.length:void 0},printf:function(a){var b,c=this,d=slice.call(arguments,1);return(a||"").replace(/%(.)/g,function(a,e){return b=spyApi.formatters[e],"function"==typeof b?b.call(null,c,d):isNaN(parseInt(e,10))?"%"+e:sinon.format(d[e-1])})}};delegateToCalls("calledOn",!0),delegateToCalls("alwaysCalledOn",!1,"calledOn"),delegateToCalls("calledWith",!0),delegateToCalls("calledWithMatch",!0),delegateToCalls("alwaysCalledWith",!1,"calledWith"),delegateToCalls("alwaysCalledWithMatch",!1,"calledWithMatch"),delegateToCalls("calledWithExactly",!0),delegateToCalls("alwaysCalledWithExactly",!1,"calledWithExactly"),delegateToCalls("neverCalledWith",!1,"notCalledWith",function(){return!0}),delegateToCalls("neverCalledWithMatch",!1,"notCalledWithMatch",function(){return!0}),delegateToCalls("threw",!0),delegateToCalls("alwaysThrew",!1,"threw"),delegateToCalls("returned",!0),delegateToCalls("alwaysReturned",!1,"returned"),delegateToCalls("calledWithNew",!0),delegateToCalls("alwaysCalledWithNew",!1,"calledWithNew"),delegateToCalls("callArg",!1,"callArgWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")}),spyApi.callArgWith=spyApi.callArg,delegateToCalls("callArgOn",!1,"callArgOnWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")}),spyApi.callArgOnWith=spyApi.callArgOn,delegateToCalls("yield",!1,"yield",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),spyApi.invokeCallback=spyApi.yield,delegateToCalls("yieldOn",!1,"yieldOn",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),delegateToCalls("yieldTo",!1,"yieldTo",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),delegateToCalls("yieldToOn",!1,"yieldToOn",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),spyApi.formatters={c:function(a){return sinon.timesInWords(a.callCount)},n:function(a){return a.toString()},C:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c){var e=" "+a.getCall(c).toString();/\n/.test(b[c-1])&&(e="\n"+e),push.call(b,e)}return b.length>0?"\n"+b.join("\n"):""},t:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c)push.call(b,sinon.format(a.thisValues[c]));return b.join(", ")},"*":function(a,b){for(var c=[],d=0,e=b.length;e>d;++d)push.call(c,sinon.format(b[d]));return c.join(", ")}},sinon.extend(spy,spyApi),spy.spyCall=sinon.spyCall,sinon.spy=spy,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=spy}):commonJSModule&&(module.exports=spy)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],59:[function(a,b){"use strict";!function(c){function d(a,b,e){if(e&&"function"!=typeof e)throw new TypeError("Custom stub should be function");var f;if(f=e?c.spy&&c.spy.create?c.spy.create(e):e:d.create(),!a&&"undefined"==typeof b)return c.stub.create();if("undefined"==typeof b&&"object"==typeof a){for(var g in a)"function"==typeof a[g]&&d(a,g);return a}return c.wrapMethod(a,b,f)}function e(a){return a.defaultBehavior||f(a)||c.behavior.create(a)}function f(a){return a.parent&&g(a.parent)}function g(a){var b=a.behaviors[a.callCount-1];return b&&b.isPresent()?b:e(a)}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i=0;c.extend(d,function(){var a={create:function(){var a=function(){return g(a).invoke(this,arguments)};a.id="stub#"+i++;var b=a;return a=c.spy.create(a),a.func=b,c.extend(a,d),a._create=c.stub.create,a.displayName="stub",a.toString=c.functionToString,a.defaultBehavior=null,a.behaviors=[],a},resetBehavior:function(){var a;if(this.defaultBehavior=null,this.behaviors=[],delete this.returnValue,delete this.returnArgAt,this.returnThis=!1,this.fakes)for(a=0;a<this.fakes.length;a++)this.fakes[a].resetBehavior()},onCall:function(a){return this.behaviors[a]||(this.behaviors[a]=c.behavior.create(this)),this.behaviors[a]},onFirstCall:function(){return this.onCall(0)},onSecondCall:function(){return this.onCall(1)},onThirdCall:function(){return this.onCall(2)}};for(var b in c.behavior)c.behavior.hasOwnProperty(b)&&!a.hasOwnProperty(b)&&"create"!=b&&"withArgs"!=b&&"invoke"!=b&&(a[b]=function(a){return function(){return this.defaultBehavior=this.defaultBehavior||c.behavior.create(this),this.defaultBehavior[a].apply(this.defaultBehavior,arguments),this}}(b));return a}()),c.stub=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):h&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],60:[function(a,b){"use strict";!function(c){function d(a){function b(){var b=c.getConfig(c.config);b.injectInto=b.injectIntoThis&&this||b.injectInto;var d,e,f=c.sandbox.create(b),g=Array.prototype.slice.call(arguments).concat(f.args);try{e=a.apply(this,g)}catch(h){d=h}if("undefined"!=typeof d)throw f.restore(),d;return f.verifyAndRestore(),e}var d=typeof a;if("function"!=d)throw new TypeError("sinon.test needs to wrap a test function, got "+d);return a.length?function(){return b.apply(this,arguments)}:b}var e="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&e&&(c=a("../sinon")),c&&(d.config={injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},c.test=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):e&&(b.exports=d))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],61:[function(a,b){"use strict";!function(c){function d(a,b,c){return function(){b&&b.apply(this,arguments);var d,e;try{e=a.apply(this,arguments)}catch(f){d=f}if(c&&c.apply(this,arguments),d)throw d;return e}}function e(a,b){if(!a||"object"!=typeof a)throw new TypeError("sinon.testCase needs an object with test functions");b=b||"test";var e,f,g,h=new RegExp("^"+b),i={},j=a.setUp,k=a.tearDown;for(e in a)if(a.hasOwnProperty(e)){if(f=a[e],/^(setUp|tearDown)$/.test(e))continue;"function"==typeof f&&h.test(e)?(g=f,(j||k)&&(g=d(f,j,k)),i[e]=c.test(g)):i[e]=a[e]}return i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&f&&(c=a("../sinon")),c&&Object.prototype.hasOwnProperty&&(c.testCase=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],62:[function(require,module,exports){(function(global){"use strict";if("undefined"==typeof sinon)var sinon={};!function(global){function addTimer(a,b){if(0===a.length)throw new Error("Function requires at least 1 parameter");if("undefined"==typeof a[0])throw new Error("Callback must be provided to timer calls");var c=id++,d=a[1]||0;return this.timeouts||(this.timeouts={}),this.timeouts[c]={id:c,func:a[0],callAt:this.now+d,invokeArgs:Array.prototype.slice.call(a,2)},b===!0&&(this.timeouts[c].interval=d),addTimerReturnsObject?{id:c,ref:function(){},unref:function(){}}:c}function parseTime(a){if(!a)return 0;var b,c=a.split(":"),d=c.length,e=d,f=0;if(d>3||!/^(\d\d:){0,2}\d\d?$/.test(a))throw new Error("tick only understands numbers and 'h:m:s'");for(;e--;){if(b=parseInt(c[e],10),b>=60)throw new Error("Invalid time "+a);f+=b*Math.pow(60,d-e-1)}return 1e3*f}function createObject(a){var b;if(Object.create)b=Object.create(a);else{var c=function(){};c.prototype=a,b=new c}return b.Date.clock=b,b}function mirrorDateProperties(a,b){b.now?a.now=function(){return a.clock.now}:delete a.now,b.toSource?a.toSource=function(){return b.toSource()}:delete a.toSource,a.toString=function(){return b.toString()},a.prototype=b.prototype,a.parse=b.parse,a.UTC=b.UTC,a.prototype.toUTCString=b.prototype.toUTCString;for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function restore(){for(var a,b=0,c=this.methods.length;c>b;b++)if(a=this.methods[b],global[a].hadOwnProperty)global[a]=this["_"+a];else try{delete global[a]}catch(d){}this.methods=[]}function stubGlobal(a,b){if(b[a].hadOwnProperty=Object.prototype.hasOwnProperty.call(global,a),b["_"+a]=global[a],"Date"==a){var c=mirrorDateProperties(b[a],global[a]);global[a]=c}else{global[a]=function(){return b[a].apply(b,arguments)};for(var d in b[a])b[a].hasOwnProperty(d)&&(global[a][d]=b[a][d])}global[a].clock=b}var timeoutResult=setTimeout(function(){},0),addTimerReturnsObject="object"==typeof timeoutResult;clearTimeout(timeoutResult);var id=1;sinon.clock={now:0,create:function(a){var b=createObject(this);if("number"==typeof a&&(b.now=a),a&&"object"==typeof a)throw new TypeError("now should be milliseconds since UNIX epoch");return b},setTimeout:function(){return addTimer.call(this,arguments,!1)},clearTimeout:function(a){a&&(this.timeouts||(this.timeouts=[]),"object"==typeof a&&(a=a.id),a in this.timeouts&&delete this.timeouts[a])},setInterval:function(){return addTimer.call(this,arguments,!0)},clearInterval:function(a){this.clearTimeout(a)},setImmediate:function(a){var b=Array.prototype.slice.call(arguments,1);return addTimer.call(this,[a,0].concat(b),!1)},clearImmediate:function(a){this.clearTimeout(a)},tick:function(a){a="number"==typeof a?a:parseTime(a);for(var b,c=this.now,d=this.now+a,e=this.now,f=this.firstTimerInRange(c,d);f&&d>=c;){if(this.timeouts[f.id]){c=this.now=f.callAt;try{this.callTimer(f)}catch(g){b=b||g}}f=this.firstTimerInRange(e,d),e=c}if(this.now=d,b)throw b;return this.now},firstTimerInRange:function(a,b){var c,d,e=null;for(var f in this.timeouts)if(this.timeouts.hasOwnProperty(f)){if(this.timeouts[f].callAt<a||this.timeouts[f].callAt>b)continue;(null===e||this.timeouts[f].callAt<e)&&(d=this.timeouts[f],e=this.timeouts[f].callAt,c={func:this.timeouts[f].func,callAt:this.timeouts[f].callAt,interval:this.timeouts[f].interval,id:this.timeouts[f].id,invokeArgs:this.timeouts[f].invokeArgs})}return c||null},callTimer:function(timer){"number"==typeof timer.interval?this.timeouts[timer.id].callAt+=timer.interval:delete this.timeouts[timer.id];try{"function"==typeof timer.func?timer.func.apply(null,timer.invokeArgs):eval(timer.func)}catch(e){var exception=e}if(this.timeouts[timer.id]){if(exception)throw exception}else if(exception)throw exception},reset:function(){this.timeouts={}},Date:function(){function a(c,d,e,f,g,h,i){switch(arguments.length){case 0:return new b(a.clock.now);case 1:return new b(c);case 2:return new b(c,d);case 3:return new b(c,d,e);case 4:return new b(c,d,e,f);case 5:return new b(c,d,e,f,g);case 6:return new b(c,d,e,f,g,h);default:return new b(c,d,e,f,g,h,i)}}var b=Date;return mirrorDateProperties(a,b)}()};var methods=["Date","setTimeout","setInterval","clearTimeout","clearInterval"];"undefined"!=typeof global.setImmediate&&methods.push("setImmediate"),"undefined"!=typeof global.clearImmediate&&methods.push("clearImmediate"),sinon.useFakeTimers=function(a){var b=sinon.clock.create(a);b.restore=restore,b.methods=Array.prototype.slice.call(arguments,"number"==typeof a?1:0),0===b.methods.length&&(b.methods=methods);for(var c=0,d=b.methods.length;d>c;c++)stubGlobal(b.methods[c],b);return b}}("undefined"!=typeof global&&"function"!=typeof global?global:this),sinon.timers={setTimeout:setTimeout,clearTimeout:clearTimeout,setImmediate:"undefined"!=typeof setImmediate?setImmediate:void 0,clearImmediate:"undefined"!=typeof clearImmediate?clearImmediate:void 0,setInterval:setInterval,clearInterval:clearInterval,Date:Date},"undefined"!=typeof module&&module.exports&&(module.exports=sinon)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],63:[function(a,b){(function(c){("function"==typeof define&&define.amd&&function(a){define("formatio",["samsam"],a)}||"object"==typeof b&&function(c){b.exports=c(a("samsam"))}||function(a){this.formatio=a(this.samsam)})(function(a){"use strict";function b(a){if(!a)return"";if(a.displayName)return a.displayName;if(a.name)return a.name;var b=a.toString().match(/function\s+([^\(]+)/m);return b&&b[1]||""}function d(a,c){var d,e,f=b(c&&c.constructor),g=a.excludeConstructors||h.excludeConstructors||[];for(d=0,e=g.length;e>d;++d){if("string"==typeof g[d]&&g[d]===f)return"";if(g[d].test&&g[d].test(f))return""}return f}function e(a,b){if("object"!=typeof a)return!1;var c,d;for(c=0,d=b.length;d>c;++c)if(b[c]===a)return!0;return!1}function f(b,c,d,g){if("string"==typeof c){var h=b.quoteStrings,j="boolean"!=typeof h||h;return d||j?'"'+c+'"':c}if("function"==typeof c&&!(c instanceof RegExp))return f.func(c);if(d=d||[],e(c,d))return"[Circular]";if("[object Array]"===Object.prototype.toString.call(c))return f.array.call(b,c,d);if(!c)return String(1/c===-1/0?"-0":c);if(a.isElement(c))return f.element(c);if("function"==typeof c.toString&&c.toString!==Object.prototype.toString)return c.toString();var k,l;for(k=0,l=i.length;l>k;k++)if(c===i[k].object)return i[k].value;return f.object.call(b,c,d,g)}function g(a){for(var b in a)this[b]=a[b]}var h={excludeConstructors:["Object",/^.$/],quoteStrings:!0},i=(Object.prototype.hasOwnProperty,[]);return"undefined"!=typeof c&&i.push({object:c,value:"[object global]"}),"undefined"!=typeof document&&i.push({object:document,value:"[object HTMLDocument]"}),"undefined"!=typeof window&&i.push({object:window,value:"[object Window]"}),f.func=function(a){return"function "+b(a)+"() {}"},f.array=function(a,b){b=b||[],b.push(a);var c,d,e=[];for(c=0,d=a.length;d>c;++c)e.push(f(this,a[c],b));return"["+e.join(", ")+"]"},f.object=function(b,c,g){c=c||[],c.push(b),g=g||0;var h,i,j,k,l,m=[],n=a.keys(b).sort(),o=3;for(k=0,l=n.length;l>k;++k)h=n[k],j=b[h],i=e(j,c)?"[Circular]":f(this,j,c,g+2),i=(/\s/.test(h)?'"'+h+'"':h)+": "+i,o+=i.length,m.push(i);var p=d(this,b),q=p?"["+p+"] ":"",r="";for(k=0,l=g;l>k;++k)r+=" ";return o+g>80?q+"{\n "+r+m.join(",\n "+r)+"\n"+r+"}":q+"{ "+m.join(", ")+" }"},f.element=function(a){var b,c,d,e,f,g=a.tagName.toLowerCase(),h=a.attributes,i=[];for(d=0,e=h.length;e>d;++d)b=h.item(d),c=b.nodeName.toLowerCase().replace("html:",""),f=b.nodeValue,("contenteditable"!==c||"inherit"!==f)&&f&&i.push(c+'="'+f+'"');var j="<"+g+(i.length>0?" ":""),k=a.innerHTML;k.length>20&&(k=k.substr(0,20)+"[...]");var l=j+i.join(" ")+">"+k+"</"+g+">";return l.replace(/ contentEditable="inherit"/,"")},g.prototype={functionName:b,configure:function(a){return new g(a)},constructorName:function(a){return d(this,a)},ascii:function(a,b,c){return f(this,a,b,c)}},g.prototype})}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{samsam:64}],64:[function(a,b){("function"==typeof define&&define.amd&&function(a){define("samsam",a)}||"object"==typeof b&&function(a){b.exports=a()}||function(a){this.samsam=a()})(function(){function a(a){var b=a;return"number"==typeof a&&a!==b}function b(a){return l.toString.call(a).split(/[ \]]/)[1]}function c(a){if("Arguments"===b(a))return!0;if("object"!=typeof a||"number"!=typeof a.length||"Array"===b(a))return!1;if("function"==typeof a.callee)return!0;try{a[a.length]=6,delete a[a.length]}catch(c){return!0}return!1}function d(a){if(!a||1!==a.nodeType||!m)return!1;try{a.appendChild(m),a.removeChild(m)}catch(b){return!1}return!0}function e(a){var b,c=[];for(b in a)l.hasOwnProperty.call(a,b)&&c.push(b);return c}function f(a){return"function"==typeof a.getTime&&a.getTime()==a.valueOf()}function g(a){return 0===a&&1/a===-1/0}function h(b,c){return b===c||a(b)&&a(c)?0!==b||g(b)===g(c):void 0}function i(g,i){function j(a){return"object"!=typeof a||null===a||a instanceof Boolean||a instanceof Date||a instanceof Number||a instanceof RegExp||a instanceof String?!1:!0}function k(a,b){var c;for(c=0;c<a.length;c++)if(a[c]===b)return c;return-1}var m=[],n=[],o=[],p=[],q={};return function r(g,i,s,t){var u=typeof g,v=typeof i;if(g===i||a(g)||a(i)||null==g||null==i||"object"!==u||"object"!==v)return h(g,i);if(d(g)||d(i))return!1;var w=f(g),x=f(i);if(!(!w&&!x||w&&x&&g.getTime()===i.getTime()))return!1;if(g instanceof RegExp&&i instanceof RegExp&&g.toString()!==i.toString())return!1;var y=b(g),z=b(i),A=e(g),B=e(i);if(c(g)||c(i)){if(g.length!==i.length)return!1}else if(u!==v||y!==z||A.length!==B.length)return!1;var C,D,E,F,G,H,I,J,K,L,M;for(D=0,E=A.length;E>D;D++){if(C=A[D],!l.hasOwnProperty.call(i,C))return!1;if(F=g[C],G=i[C],H=j(F),I=j(G),J=H?k(m,F):-1,K=I?k(n,G):-1,L=-1!==J?o[J]:s+"["+JSON.stringify(C)+"]",M=-1!==K?p[K]:t+"["+JSON.stringify(C)+"]",q[L+M])return!0;if(-1===J&&H&&(m.push(F),o.push(L)),-1===K&&I&&(n.push(G),p.push(M)),H&&I&&(q[L+M]=!0),!r(F,G,L,M))return!1}return!0}(g,i,"$1","$2")}function j(a,b){if(0===b.length)return!0;var c,d,e,f;for(c=0,d=a.length;d>c;++c)if(k(a[c],b[0])){for(e=0,f=b.length;f>e;++e)if(!k(a[c+e],b[e]))return!1;return!0}return!1}var k,l=Object.prototype,m="undefined"!=typeof document&&document.createElement("div");return k=function n(a,c){if(c&&"function"==typeof c.test)return c.test(a);if("function"==typeof c)return c(a)===!0;if("string"==typeof c){c=c.toLowerCase();var d="string"==typeof a||!!a;return d&&String(a).toLowerCase().indexOf(c)>=0}if("number"==typeof c)return c===a;if("boolean"==typeof c)return c===a;if("Array"===b(a)&&"Array"===b(c))return j(a,c);if(c&&"object"==typeof c){var e;for(e in c){var f=a[e];if("undefined"==typeof f&&"function"==typeof a.getAttribute&&(f=a.getAttribute(e)),"undefined"==typeof f||!n(f,c[e]))return!1}return!0}throw new Error("Matcher was not a string, a number, a function, a boolean or an object")},{isArguments:c,isElement:d,isDate:f,isNegZero:g,identical:h,deepEqual:i,match:k,keys:e}})},{}],65:[function(a,b,c){(function(){var a=this,d=a._,e={},f=Array.prototype,g=Object.prototype,h=Function.prototype,i=f.push,j=f.slice,k=f.concat,l=g.toString,m=g.hasOwnProperty,n=f.forEach,o=f.map,p=f.reduce,q=f.reduceRight,r=f.filter,s=f.every,t=f.some,u=f.indexOf,v=f.lastIndexOf,w=Array.isArray,x=Object.keys,y=h.bind,z=function(a){return a instanceof z?a:this instanceof z?void(this._wrapped=a):new z(a)};"undefined"!=typeof c?("undefined"!=typeof b&&b.exports&&(c=b.exports=z),c._=z):a._=z,z.VERSION="1.6.0";var A=z.each=z.forEach=function(a,b,c){if(null==a)return a;if(n&&a.forEach===n)a.forEach(b,c);else if(a.length===+a.length){for(var d=0,f=a.length;f>d;d++)if(b.call(c,a[d],d,a)===e)return}else for(var g=z.keys(a),d=0,f=g.length;f>d;d++)if(b.call(c,a[g[d]],g[d],a)===e)return;return a};z.map=z.collect=function(a,b,c){var d=[];return null==a?d:o&&a.map===o?a.map(b,c):(A(a,function(a,e,f){d.push(b.call(c,a,e,f))}),d)};var B="Reduce of empty array with no initial value";z.reduce=z.foldl=z.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),p&&a.reduce===p)return d&&(b=z.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(A(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(B);return c},z.reduceRight=z.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),q&&a.reduceRight===q)return d&&(b=z.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=z.keys(a);f=g.length}if(A(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(B);return c},z.find=z.detect=function(a,b,c){var d;return C(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},z.filter=z.select=function(a,b,c){var d=[];return null==a?d:r&&a.filter===r?a.filter(b,c):(A(a,function(a,e,f){b.call(c,a,e,f)&&d.push(a)}),d)},z.reject=function(a,b,c){return z.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},z.every=z.all=function(a,b,c){b||(b=z.identity);var d=!0;return null==a?d:s&&a.every===s?a.every(b,c):(A(a,function(a,f,g){return(d=d&&b.call(c,a,f,g))?void 0:e}),!!d)};var C=z.some=z.any=function(a,b,c){b||(b=z.identity);var d=!1;return null==a?d:t&&a.some===t?a.some(b,c):(A(a,function(a,f,g){return d||(d=b.call(c,a,f,g))?e:void 0}),!!d)};z.contains=z.include=function(a,b){return null==a?!1:u&&a.indexOf===u?-1!=a.indexOf(b):C(a,function(a){return a===b})},z.invoke=function(a,b){var c=j.call(arguments,2),d=z.isFunction(b);return z.map(a,function(a){return(d?b:a[b]).apply(a,c)})},z.pluck=function(a,b){return z.map(a,z.property(b))},z.where=function(a,b){return z.filter(a,z.matches(b))},z.findWhere=function(a,b){return z.find(a,z.matches(b))},z.max=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);var d=-1/0,e=-1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;h>e&&(d=a,e=h)}),d},z.min=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);var d=1/0,e=1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;e>h&&(d=a,e=h)}),d},z.shuffle=function(a){var b,c=0,d=[];return A(a,function(a){b=z.random(c++),d[c-1]=d[b],d[b]=a}),d},z.sample=function(a,b,c){return null==b||c?(a.length!==+a.length&&(a=z.values(a)),a[z.random(a.length-1)]):z.shuffle(a).slice(0,Math.max(0,b))};var D=function(a){return null==a?z.identity:z.isFunction(a)?a:z.property(a)};z.sortBy=function(a,b,c){return b=D(b),z.pluck(z.map(a,function(a,d,e){return{value:a,index:d,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index-b.index}),"value")};var E=function(a){return function(b,c,d){var e={};return c=D(c),A(b,function(f,g){var h=c.call(d,f,g,b);a(e,h,f)}),e}};z.groupBy=E(function(a,b,c){z.has(a,b)?a[b].push(c):a[b]=[c]}),z.indexBy=E(function(a,b,c){a[b]=c}),z.countBy=E(function(a,b){z.has(a,b)?a[b]++:a[b]=1}),z.sortedIndex=function(a,b,c,d){c=D(c);for(var e=c.call(d,b),f=0,g=a.length;g>f;){var h=f+g>>>1;c.call(d,a[h])<e?f=h+1:g=h}return f},z.toArray=function(a){return a?z.isArray(a)?j.call(a):a.length===+a.length?z.map(a,z.identity):z.values(a):[]},z.size=function(a){return null==a?0:a.length===+a.length?a.length:z.keys(a).length},z.first=z.head=z.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:0>b?[]:j.call(a,0,b)},z.initial=function(a,b,c){return j.call(a,0,a.length-(null==b||c?1:b))},z.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:j.call(a,Math.max(a.length-b,0))},z.rest=z.tail=z.drop=function(a,b,c){return j.call(a,null==b||c?1:b)},z.compact=function(a){return z.filter(a,z.identity)};var F=function(a,b,c){return b&&z.every(a,z.isArray)?k.apply(c,a):(A(a,function(a){z.isArray(a)||z.isArguments(a)?b?i.apply(c,a):F(a,b,c):c.push(a)}),c)};z.flatten=function(a,b){return F(a,b,[])},z.without=function(a){return z.difference(a,j.call(arguments,1))},z.partition=function(a,b){var c=[],d=[];return A(a,function(a){(b(a)?c:d).push(a)}),[c,d]},z.uniq=z.unique=function(a,b,c,d){z.isFunction(b)&&(d=c,c=b,b=!1);var e=c?z.map(a,c,d):a,f=[],g=[];return A(e,function(c,d){(b?d&&g[g.length-1]===c:z.contains(g,c))||(g.push(c),f.push(a[d]))}),f},z.union=function(){return z.uniq(z.flatten(arguments,!0))},z.intersection=function(a){var b=j.call(arguments,1);return z.filter(z.uniq(a),function(a){return z.every(b,function(b){return z.contains(b,a)})})},z.difference=function(a){var b=k.apply(f,j.call(arguments,1));return z.filter(a,function(a){return!z.contains(b,a)})},z.zip=function(){for(var a=z.max(z.pluck(arguments,"length").concat(0)),b=new Array(a),c=0;a>c;c++)b[c]=z.pluck(arguments,""+c);return b},z.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},z.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=z.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(u&&a.indexOf===u)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},z.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(v&&a.lastIndexOf===v)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},z.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);d>e;)f[e++]=a,a+=c;return f};var G=function(){};z.bind=function(a,b){var c,d;if(y&&a.bind===y)return y.apply(a,j.call(arguments,1));if(!z.isFunction(a))throw new TypeError;return c=j.call(arguments,2),d=function(){if(!(this instanceof d))return a.apply(b,c.concat(j.call(arguments)));G.prototype=a.prototype;var e=new G;G.prototype=null;var f=a.apply(e,c.concat(j.call(arguments)));return Object(f)===f?f:e}},z.partial=function(a){var b=j.call(arguments,1);return function(){for(var c=0,d=b.slice(),e=0,f=d.length;f>e;e++)d[e]===z&&(d[e]=arguments[c++]);for(;c<arguments.length;)d.push(arguments[c++]);return a.apply(this,d)}},z.bindAll=function(a){var b=j.call(arguments,1);if(0===b.length)throw new Error("bindAll must be passed function names");return A(b,function(b){a[b]=z.bind(a[b],a)}),a},z.memoize=function(a,b){var c={};return b||(b=z.identity),function(){var d=b.apply(this,arguments);return z.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},z.delay=function(a,b){var c=j.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},z.defer=function(a){return z.delay.apply(z,[a,1].concat(j.call(arguments,1)))},z.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:z.now(),g=null,f=a.apply(d,e),d=e=null};return function(){var j=z.now();h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k?(clearTimeout(g),g=null,h=j,f=a.apply(d,e),d=e=null):g||c.trailing===!1||(g=setTimeout(i,k)),f}},z.debounce=function(a,b,c){var d,e,f,g,h,i=function(){var j=z.now()-g;b>j?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),f=e=null))};return function(){f=this,e=arguments,g=z.now();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}},z.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},z.wrap=function(a,b){return z.partial(b,a)},z.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},z.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},z.keys=function(a){if(!z.isObject(a))return[];if(x)return x(a);var b=[];for(var c in a)z.has(a,c)&&b.push(c);return b},z.values=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},z.pairs=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},z.invert=function(a){for(var b={},c=z.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},z.functions=z.methods=function(a){var b=[];for(var c in a)z.isFunction(a[c])&&b.push(c);return b.sort()},z.extend=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},z.pick=function(a){var b={},c=k.apply(f,j.call(arguments,1));return A(c,function(c){c in a&&(b[c]=a[c])}),b},z.omit=function(a){var b={},c=k.apply(f,j.call(arguments,1));for(var d in a)z.contains(c,d)||(b[d]=a[d]);return b},z.defaults=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)void 0===a[c]&&(a[c]=b[c])}),a},z.clone=function(a){return z.isObject(a)?z.isArray(a)?a.slice():z.extend({},a):a},z.tap=function(a,b){return b(a),a};var H=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof z&&(a=a._wrapped),b instanceof z&&(b=b._wrapped);var e=l.call(a);if(e!=l.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;var g=a.constructor,h=b.constructor;if(g!==h&&!(z.isFunction(g)&&g instanceof g&&z.isFunction(h)&&h instanceof h)&&"constructor"in a&&"constructor"in b)return!1;c.push(a),d.push(b);var i=0,j=!0;if("[object Array]"==e){if(i=a.length,j=i==b.length)for(;i--&&(j=H(a[i],b[i],c,d)););}else{for(var k in a)if(z.has(a,k)&&(i++,!(j=z.has(b,k)&&H(a[k],b[k],c,d))))break;if(j){for(k in b)if(z.has(b,k)&&!i--)break;j=!i}}return c.pop(),d.pop(),j};z.isEqual=function(a,b){return H(a,b,[],[])},z.isEmpty=function(a){if(null==a)return!0;if(z.isArray(a)||z.isString(a))return 0===a.length;for(var b in a)if(z.has(a,b))return!1;return!0},z.isElement=function(a){return!(!a||1!==a.nodeType)},z.isArray=w||function(a){return"[object Array]"==l.call(a)},z.isObject=function(a){return a===Object(a)},A(["Arguments","Function","String","Number","Date","RegExp"],function(a){z["is"+a]=function(b){return l.call(b)=="[object "+a+"]"}}),z.isArguments(arguments)||(z.isArguments=function(a){return!(!a||!z.has(a,"callee"))}),"function"!=typeof/./&&(z.isFunction=function(a){return"function"==typeof a}),z.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},z.isNaN=function(a){return z.isNumber(a)&&a!=+a},z.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==l.call(a)},z.isNull=function(a){return null===a},z.isUndefined=function(a){return void 0===a},z.has=function(a,b){return m.call(a,b)},z.noConflict=function(){return a._=d,this},z.identity=function(a){return a},z.constant=function(a){return function(){return a}},z.property=function(a){return function(b){return b[a]}},z.matches=function(a){return function(b){if(b===a)return!0;for(var c in a)if(a[c]!==b[c])return!1;return!0}},z.times=function(a,b,c){for(var d=Array(Math.max(0,a)),e=0;a>e;e++)d[e]=b.call(c,e);return d},z.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))},z.now=Date.now||function(){return(new Date).getTime()};var I={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};I.unescape=z.invert(I.escape);var J={escape:new RegExp("["+z.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+z.keys(I.unescape).join("|")+")","g")};z.each(["escape","unescape"],function(a){z[a]=function(b){return null==b?"":(""+b).replace(J[a],function(b){return I[a][b]})}}),z.result=function(a,b){if(null==a)return void 0;var c=a[b];return z.isFunction(c)?c.call(a):c},z.mixin=function(a){A(z.functions(a),function(b){var c=z[b]=a[b];z.prototype[b]=function(){var a=[this._wrapped];return i.apply(a,arguments),O.call(this,c.apply(z,a))}})};var K=0;z.uniqueId=function(a){var b=++K+"";return a?a+b:b},z.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var L=/(.)^/,M={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},N=/\\|'|\r|\n|\t|\u2028|\u2029/g;z.template=function(a,b,c){var d;c=z.defaults({},c,z.templateSettings);var e=new RegExp([(c.escape||L).source,(c.interpolate||L).source,(c.evaluate||L).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(N,function(a){return"\\"+M[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=new Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,z);var i=function(a){return d.call(this,a,z)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},z.chain=function(a){return z(a).chain()};var O=function(a){return this._chain?z(a).chain():a};z.mixin(z),A(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=f[a];z.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],O.call(this,c)}}),A(["concat","join","slice"],function(a){var b=f[a];z.prototype[a]=function(){return O.call(this,b.apply(this._wrapped,arguments))}}),z.extend(z.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return z})}).call(this)},{}],66:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")
|
||
},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:10,sinon:50,"sinon-chai":49,underscore:65}],67:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/TextYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/TextYatta.coffee":4,chai:10,sinon:50,"sinon-chai":49,underscore:65}],68:[function(a){var b,c,d,e,f,g,h,i,j,k=function(a,b){return function(){return a.apply(b,arguments)}};e=a("chai"),f=e.expect,g=e.should(),h=a("sinon"),i=a("sinon-chai"),j=a("underscore"),e.use(i),d=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee"),c=function(){function a(){this.applyRandomOp=k(this.applyRandomOp,this),this.generateRandomOp=k(this.generateRandomOp,this),this.generateDeleteOp=k(this.generateDeleteOp,this),this.generateReplaceOp=k(this.generateReplaceOp,this),this.generateInsertOp=k(this.generateInsertOp,this),this.number_of_test_cases_multiplier=1,this.repeat_this=10*this.number_of_test_cases_multiplier,this.doSomething_amount=200*this.number_of_test_cases_multiplier,this.number_of_engines=12+this.number_of_test_cases_multiplier-1,this.time=0,this.ops=0,this.time_now=0,this.reinitialize()}return a.prototype.reinitialize=function(){var a,c,e,f;for(this.users=[],this.Connector=b(this.users),this.users.push(new d(0,this.Connector)),this.users[0].val("name","initial"),f=[],a=c=1,e=this.number_of_engines;e>=1?e>c:c>e;a=e>=1?++c:--c)f.push(this.users.push(new d(a,this.Connector)));return f},a.prototype.getSomeUser=function(){var a;return a=j.random(0,this.users.length-1),this.users[a]},a.prototype.getRandomText=function(){var a,b,c,d;return a="abcdefghijklmnopqrstuvwxyz",b=j.random(0,10),c=a[j.random(0,a.length-1)],d="",j(b).times(function(){return d+=c}),d},a.prototype.generateInsertOp=function(a){var b;return b=j.random(0,this.users[a].val("name").val().length-1),this.users[a].val("name").insertText(b,this.getRandomText()),null},a.prototype.generateReplaceOp=function(a){return this.users[a].val("name").replaceText(this.getRandomText()),null},a.prototype.generateDeleteOp=function(a){var b,c,d;return void(this.users[a].val("name").val().length>0&&(d=j.random(0,this.users[a].val("name").val().length-1),b=1,c=this.users[a].val("name").deleteText(d,b)))},a.prototype.generateRandomOp=function(a){var b,c,d;return d=[this.generateDeleteOp,this.generateInsertOp,this.generateReplaceOp],b=j.random(d.length-1),c=d[b](a)},a.prototype.applyRandomOp=function(a){var b;return b=this.users[a],b.getConnector().flushOneRandom()},a.prototype.doSomething=function(){var a,b,c;return c=j.random(this.number_of_engines-1),b=[this.applyRandomOp,this.generateRandomOp],a=j.random(b.length-1),b[a](c)},a.prototype.flushAll=function(){var a,b,c,d,e,f;for(e=this.users,f=[],b=c=0,d=e.length;d>c;b=++c)a=e[b],f.push(a.getConnector().flushAll());return f},a.prototype.compareAll=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;for(this.flushAll(),this.time+=(new Date).getTime()-this.time_now,d=0,b=i=0,m=this.users.length;m>=0?m>i:i>m;b=m>=0?++i:--i)d+=this.users[b].getConnector().getOpsInExecutionOrder().length;for(this.ops+=d*this.users.length,f=Math.floor(this.ops/this.time),null!=a&&console.log(""+a+"/"+this.repeat_this+": Every collaborator ("+this.users.length+") applied "+this.number_of_created_operations+" ops in a different order."+(" Over all we consumed "+this.ops+" operations in "+this.time/1e3+" seconds ("+f+" ops/msek).")),o=[],b=j=0,n=this.users.length-1;n>=0?n>j:j>n;b=n>=0?++j:--j)if(this.users[b].val("name").val()!==this.users[b+1].val("name").val()){for(g=function(a,b){var c,d,e,f,g,h,i,j;for(e=this.users[a].getConnector().getOpsInExecutionOrder(),g=0,i=e.length;i>g;g++)f=e[g],console.log(JSON.stringify(f));for(console.log(""),f="ops = [",c=h=0,j=e.length;j>h;c=++h)d=e[c],0!==c&&(f+=", "),f+="op"+c;return f+="]",console.log(f),console.log("@users[@last_user].ot.applyOps ops"),console.log("expect(@users[@last_user].ot.val('name')).to.equal(\""+users[b].val("name")+'")'),e},console.log(""),console.log("Found an OT Puzzle!"),console.log("OT states:"),c=k=0,l=users.length;l>k;c=++k)h=users[c],console.log("OT"+c+": "+h.val("name"));console.log("\nOT execution order ("+b+","+(b+1)+"):"),g(b,b+1),console.log(""),e=g(b+1,b),o.push(console.log(""))}else o.push(void 0);return o},a.prototype.run=function(){var a,b,c,d,e,f,g;for(console.log(""),g=[],b=c=1,e=this.repeat_this;e>=1?e>=c:c>=e;b=e>=1?++c:--c){for(this.time_now=(new Date).getTime(),a=d=1,f=this.doSomething_amount;f>=1?f>=d:d>=f;a=f>=1?++d:--d)this.doSomething();this.compareAll(b),g.push(this.reinitialize())}return g},a}(),describe("JsonYatta",function(){return beforeEach(function(a){return this.yTest=new c,a()}),it("has a JsonWrapper",function(){var a,b;return b=this.yTest.getSomeUser().root_element,b.val("x","dtrn","immutable"),b.val("set",{x:"x"},"immutable"),a=b.value,a.x,a.set={y:""},a.x,a.set,a.set.x,f(a.x).to.equal("dtrn"),f(a.set.x).to.equal("x")}),it("can handle creaton of complex json",function(){return this.yTest.getSomeUser().val("x",{a:"b"}),this.yTest.getSomeUser().val("a",{a:{q:"dtrndtrtdrntdrnrtdnrtdnrtdnrtdnrdnrdt"}}),this.yTest.getSomeUser().val("b",{a:{}}),this.yTest.getSomeUser().val("c",{a:"b"}),this.yTest.compareAll()}),it("handles some immutable tests",function(){return this.yTest.getSomeUser().val("string","text","immutable"),this.yTest.getSomeUser().val("number",4,"immutable"),this.yTest.getSomeUser().val("object",{q:"rr"},"immutable"),this.yTest.compareAll(),f(this.yTest.getSomeUser().val("string")).to.equal("text"),f(this.yTest.getSomeUser().val("number")).to.equal(4),f(this.yTest.getSomeUser().val("object").val("q")).to.equal("rr")}),it("can handle many engines, many operations, concurrently (random)",function(){return this.yTest.run()})})},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:10,sinon:50,"sinon-chai":49,underscore:65}]},{},[66,67,68]),!function j(a,b,c){function d(f,g){if(!b[f]){if(!a[f]){var h="function"==typeof require&&require;if(!g&&h)return h(f,!0);if(e)return e(f,!0);throw new Error("Cannot find module '"+f+"'")}var i=b[f]={exports:{}};a[f][0].call(i.exports,function(b){var c=a[f][1][b];return d(c?c:b)},i,i.exports,j,a,b,c)}return b[f].exports}for(var e="function"==typeof require&&require,f=0;f<c.length;f++)d(c[f]);return d}({1:[function(a,b){var c;c=a("underscore"),b.exports=function(a){var b;return b=function(){function b(b,c,d){var e,f;this.engine=b,this.HB=c,this.execution_listener=d,f=function(a){return function(b){return a.send(b)}}(this),this.execution_listener.push(f),this.applied_operations=[],e=function(a){return function(b){return a.applied_operations.push(b)}}(this),this.execution_listener.push(e),0!==(null!=a?a.length:void 0)&&this.engine.applyOps(a[0].getHistoryBuffer()._encode()),this.unexecuted={}}return b.prototype.getOpsInExecutionOrder=function(){return this.applied_operations},b.prototype.getRootElement=function(){return a.length>0?a[0].getRootElement().getUid():void 0},b.prototype.send=function(b){var c,d,e,f;if(b.uid.creator===this.HB.getUserId()&&"string"!=typeof b.uid.op_number){for(f=[],d=0,e=a.length;e>d;d++)c=a[d],f.push(c.getUserId()!==this.HB.getUserId()?c.getConnector().receive(b):void 0);return f}},b.prototype.receive=function(a){var b,c;return null==(b=this.unexecuted)[c=a.creator]&&(b[c]=[]),this.unexecuted[a.creator].push(a)},b.prototype.flushOne=function(a){var b;return(null!=(b=this.unexecuted[a])?b.length:void 0)>0?this.engine.applyOp(this.unexecuted[a].shift()):void 0},b.prototype.flushOneRandom=function(){return this.flushOne(c.random(0,a.length-1))},b.prototype.flushAll=function(){var a,b,c;c=this.unexecuted;for(a in c)b=c[a],this.engine.applyOps(b);return this.unexecuted={}},b.prototype.sync=function(){throw new Error("Can't use this a.t.m.")},b}()}},{underscore:65}],2:[function(a,b){var c;c=function(){function a(a,b){this.HB=a,this.parser=b,this.unprocessed_ops=[]}return a.prototype.parseOperation=function(a){var b;if(b=this.parser[a.type],null!=b)return b(a);throw new Error("You forgot to specify a parser for type "+a.type+". The message is "+JSON.stringify(a)+".")},a.prototype.applyOps=function(a){var b,c,d,e,f,g,h,i;for(c=[],d=0,g=a.length;g>d;d++)b=a[d],c.push(this.parseOperation(b));for(e=0,h=c.length;h>e;e++)b=c[e],this.HB.addOperation(b);for(f=0,i=c.length;i>f;f++)b=c[f],b.execute()||this.unprocessed_ops.push(b);return this.tryUnprocessed()},a.prototype.applyOp=function(a){var b;return b=this.parseOperation(a),this.HB.addOperation(b),b.execute()||this.unprocessed_ops.push(b),this.tryUnprocessed()},a.prototype.tryUnprocessed=function(){var a,b,c,d,e,f,g;for(g=[];;){for(a=this.unprocessed_ops.length,c=[],f=this.unprocessed_ops,d=0,e=f.length;e>d;d++)b=f[d],b.execute()||c.push(b);if(this.unprocessed_ops=c,this.unprocessed_ops.length===a)break;g.push(void 0)}return g},a}(),b.exports=c},{}],3:[function(a,b){var c,d,e,f;f=a("../Types/JsonTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),g=f(this.HB),this.engine=new c(this.HB,g.parser),this.connector=new b(this.engine,this.HB,g.execution_listener,this),h=this.connector.getRootElement(),null==h?(e=new g.types.JsonType(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=e):this.root_element=this.HB.getOperation(h)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.setMutableDefault=function(a){return this.root_element.setMutableDefault(a)},a.prototype.getUserId=function(){return this.HB.getUserId()},a.prototype.val=function(a,b,c){return this.root_element.val(a,b,c)},Object.defineProperty(a.prototype,"value",{get:function(){return this.root_element.value},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),a}(),"undefined"!=typeof window&&null!==window&&(window.JsonYatta=e),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/JsonTypes.coffee":7}],4:[function(a,b){var c,d,e,f;f=a("../Types/TextTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),h=f(this.HB),this.engine=new c(this.HB,h.parser),this.connector=new b(this.engine,this.HB,h.execution_listener),g=this.connector.getRootElement(),null==g?(e=new h.types.Word(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=this.HB.addOperation(new h.types.ReplaceManager(e,this.HB.getNextOperationIdentifier())).execute()):this.root_element=this.HB.getOperation(g)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.getUserId=function(){return this.HB.getUserId()},a.prototype.val=function(){return this.root_element.val().val()},a.prototype.insertText=function(a,b){return this.root_element.val().insertText(a,b)},a.prototype.deleteText=function(a,b){return this.root_element.val().deleteText(a,b)},a.prototype.replaceText=function(a){return this.root_element.val().replaceText(a)},a}(),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/TextTypes.coffee":9}],5:[function(a,b){var c;c=function(){function a(a){this.user_id=a,this.operation_counter={},this.buffer={},this.change_listeners=[]}return a.prototype.getUserId=function(){return this.user_id},a.prototype.getOperationCounter=function(){var a,b,c,d;b={},d=this.operation_counter;for(c in d)a=d[c],b[c]=a;return b},a.prototype._encode=function(){var a,b,c,d,e,f;a=[],f=this.buffer;for(d in f){e=f[d];for(c in e)b=e[c],isNaN(parseInt(c))||a.push(b._encode())}return a},a.prototype.getNextOperationIdentifier=function(a){var b;return null==a&&(a=this.user_id),null==this.operation_counter[a]&&(this.operation_counter[a]=0),b={creator:a,op_number:this.operation_counter[a]},this.operation_counter[a]++,b},a.prototype.getOperation=function(a){var b;if(a instanceof Object)return null!=(b=this.buffer[a.creator])?b[a.op_number]:void 0;if(null!=a)throw new Error("This type of uid is not defined!")},a.prototype.addOperation=function(a){if(null==this.buffer[a.creator]&&(this.buffer[a.creator]={}),null==this.operation_counter[a.creator]&&(this.operation_counter[a.creator]=0),null!=this.buffer[a.creator][a.op_number])throw new Error("You must not overwrite operations!");return this.buffer[a.creator][a.op_number]=a,"number"==typeof a.op_number&&a.creator!==this.getUserId()&&this.operation_counter[a.creator]++,a},a}(),b.exports=c},{}],6:[function(a,b){var c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};b.exports=function(a){var b,c,e,f,g,h,i;return i={},h=[],g=function(){function b(b){null==b&&(b=a.getNextOperationIdentifier()),this.creator=b.creator,this.op_number=b.op_number}return b.prototype.getUid=function(){return{creator:this.creator,op_number:this.op_number}},b.prototype.execute=function(){var a,b,c;for(this.is_executed=!0,b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this},b.prototype.saveOperation=function(a,b){return null!=(null!=b?b.execute:void 0)?this[a]=b:null!=b?(null==this.unchecked&&(this.unchecked={}),this.unchecked[a]=b):void 0},b.prototype.validateSavedOperations=function(){var b,c,d,e,f,g;f={},e=this,g=this.unchecked;for(b in g)d=g[b],c=a.getOperation(d),c?this[b]=c:(f[b]=d,e=!1);return delete this.unchecked,e||(this.unchecked=f),e},b}(),b=function(a){function b(a,c){this.saveOperation("deletes",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype._encode=function(){return{type:"Delete",uid:this.getUid(),deletes:this.deletes.getUid()}},b.prototype.execute=function(){return this.validateSavedOperations()?(this.deletes.applyDelete(this),b.__super__.execute.apply(this,arguments),this):!1},b}(g),i.Delete=function(a){var c,d;return d=a.uid,c=a.deletes,new b(d,c)},f=function(a){function b(a,c,d,e){this.saveOperation("prev_cl",c),this.saveOperation("next_cl",d),null!=e?this.saveOperation("origin",e):this.saveOperation("origin",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype.applyDelete=function(a){return null==this.deleted_by&&(this.deleted_by=[]),this.deleted_by.push(a)},b.prototype.isDeleted=function(){var a;return(null!=(a=this.deleted_by)?a.length:void 0)>0},b.prototype.getDistanceToOrigin=function(){var a,b;for(a=0,b=this.prev_cl;this.origin!==b;){if(a++,this===this.prev_cl)throw new Error("this should not happen ;) ");b=b.prev_cl}return a},b.prototype.update_sl=function(){var a;return a=this.prev_cl,update("prev_cl","prev_sl"),update("next_cl","prev_sl")},b.prototype.execute=function(){var a,c,d,e,f;if(null!=this.is_executed)return this;if(this.validateSavedOperations()){if((null!=(e=this.prev_cl)?e.validateSavedOperations():void 0)&&(null!=(f=this.next_cl)?f.validateSavedOperations():void 0)&&this.prev_cl.next_cl!==this){for(a=0,d=this.prev_cl.next_cl,c=0;null==d&&(console.log(JSON.stringify(this.prev_cl.getUid())),console.log(JSON.stringify(this.next_cl.getUid()))),d!==this.next_cl;){if(d.getDistanceToOrigin()===c)d.creator<this.creator&&(this.prev_cl=d,a=c+1);else{if(!(d.getDistanceToOrigin()<c))break;c-a<=d.getDistanceToOrigin()&&(this.prev_cl=d,a=c+1)}c++,d=d.next_cl}this.next_cl=this.prev_cl.next_cl,this.prev_cl.next_cl=this,this.next_cl.prev_cl=this}return b.__super__.execute.apply(this,arguments),this}return!1},b}(g),e=function(a){function b(a,c,d,e,f){this.content=null!=c?c:"",b.__super__.constructor.call(this,a,d,e,f)}return d(b,a),b.prototype.val=function(){return this.content},b.prototype._encode=function(){var a;return a={type:"ImmutableObject",uid:this.getUid(),content:this.content},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(f),i.ImmutableObject=function(a){var b,c,d,f,g;return g=a.uid,b=a.content,f=a.prev,c=a.next,d=a.origin,new e(g,b,f,c,d)},c=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return d(b,a),b.prototype.execute=function(){var a,b,c;if(this.validateSavedOperations()){for(b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this}return!1},b.prototype._encode=function(){var a,b;return{type:"Delimiter",uid:this.getUid(),prev:null!=(a=this.prev_cl)?a.getUid():void 0,next:null!=(b=this.next_cl)?b.getUid():void 0}},b}(f),i.Delimiter=function(a){var b,d,e;return e=a.uid,d=a.prev,b=a.next,new c(e,d,b)},{types:{Delete:b,Insert:f,Delimiter:c,Operation:g,ImmutableObject:e},parser:i,execution_listener:h}}},{}],7:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./TextTypes.coffee"),b.exports=function(a){var b,d,f,g,h;return g=c(a),h=g.types,f=g.parser,d=function(a){var c;return new(c=function(){function a(c){var e,f,g,i;i=c.map,g=function(e,f){return Object.defineProperty(a.prototype,e,{get:function(){var a;return a=f.val(),a instanceof b?d(a):a instanceof h.ImmutableObject?a.val():a},set:function(a){var b,d,f,g;if(a.constructor==={}.constructor){f=c.val(e),g=[];for(b in a)d=a[b],g.push(f.val(b,d,"immutable"));return g}return c.val(e,a,"immutable")},enumerable:!0,configurable:!1})};for(e in i)f=i[e],g(e,f)}return a}())(a)},b=function(b){function c(a,b,d){var e,f;if(c.__super__.constructor.call(this,a),null!=b){if("object"!=typeof b)throw new Error("The initial value of JsonTypes must be of type Object! (current type: "+typeof b+")");for(e in b)f=b[e],this.val(e,f,d)}}return e(c,b),c.prototype.mutable_default=!0,c.prototype.setMutableDefault=function(a){if(a===!0||"mutable"===a)c.prototype.mutable_default=!0;else{if(a!==!1&&"immutable"!==a)throw new Error('Set mutable either "mutable" or "immutable"!');c.prototype.mutable_default=!1}return"OK"},c.prototype.val=function(b,d,e){var f,g,i,j,k;if("object"==typeof b){for(i in b)g=b[i],this.val(i,g,d);return this}if(null!=b&&null!=d){if(e=null!=e?e===!0||"mutable"===e?!0:!1:this.mutable_default,"function"==typeof d)return this;if(e&&"number"!=typeof d||d.constructor===Object){if("string"==typeof d)return k=a.addOperation(new h.Word(a.getNextOperationIdentifier(),d)).execute(),c.__super__.val.call(this,b,k);if(d.constructor===Object)return f=a.addOperation(new c(a.getNextOperationIdentifier(),d,e)).execute(),c.__super__.val.call(this,b,f);throw new Error("You must not set "+typeof d+"-types in collaborative Json-objects!")}return j=a.addOperation(new h.ImmutableObject(void 0,d)).execute(),c.__super__.val.call(this,b,j)}return c.__super__.val.call(this,b,d)},Object.defineProperty(c.prototype,"value",{get:function(){return d(this)},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),c.prototype._encode=function(){return{type:"JsonType",uid:this.getUid()}},c}(h.MapManager),f.JsonType=function(a){var c;return c=a.uid,new b(c)},h.JsonType=b,g}},{"./TextTypes.coffee":9}],8:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./BasicTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i,j,k;return i=c(a),k=i.types,j=i.parser,f=function(c){function d(a){this.map={},d.__super__.constructor.call(this,a)}return e(d,c),d.prototype.val=function(c,e){var f,g,h,i,j;if(null!=e)return null==this.map[c]&&a.addOperation(new b(a.getNextOperationIdentifier(),this,c)).execute(),this.map[c].replace(e),this;if(null!=c)return g=null!=(i=this.map[c])?i.val():void 0,g instanceof k.ImmutableObject?g.val():g;h={},j=this.map;for(c in j)f=j[c],g=f.val(),(g instanceof k.ImmutableObject||g instanceof d)&&(g=g.val()),h[c]=g;return h},d}(k.Operation),b=function(b){function c(a,b,d){this.name=d,this.saveOperation("map_manager",b),c.__super__.constructor.call(this,a)}return e(c,b),c.prototype.execute=function(){var b,d,e,f,h;return this.validateSavedOperations()?(h=this.map_manager.getUid(),h.op_number="_"+h.op_number+"_RM_"+this.name,null==a.getOperation(h)&&(e=this.map_manager.getUid(),e.op_number="_"+e.op_number+"_RM_"+this.name+"_beginning",f=this.map_manager.getUid(),f.op_number="_"+f.op_number+"_RM_"+this.name+"_end",b=a.addOperation(new k.Delimiter(e,void 0,f)),d=a.addOperation(new k.Delimiter(f,b,void 0)).execute(),b.execute(),this.map_manager.map[this.name]=a.addOperation(new g(void 0,h,b,d)).execute()),c.__super__.execute.apply(this,arguments)):!1},c.prototype._encode=function(){return{type:"AddName",uid:this.getUid(),map_manager:this.map_manager.getUid(),name:this.name}},c}(k.Operation),j.AddName=function(a){var c,d,e;return c=a.map_manager,e=a.uid,d=a.name,new b(e,c,d)},d=function(b){function c(b,d,e,f,g,h){null!=d&&null!=e?(this.saveOperation("beginning",d),this.saveOperation("end",e)):(this.beginning=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),void 0,void 0)),this.end=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),this.beginning,void 0)),this.beginning.next_cl=this.end,this.beginning.execute(),this.end.execute()),c.__super__.constructor.call(this,b,f,g,h)}return e(c,b),c.prototype.getLastOperation=function(){return this.end.prev_cl},c.prototype.getFirstOperation=function(){return this.beginning.next_cl},c.prototype.toArray=function(){var a,b;for(a=this.beginning.next_cl,b=[];a!==this.end;)b.push(a),a=a.next_cl;return b},c.prototype.getOperationByPosition=function(a){var b;if(b=this.beginning.next_cl,a>0)for(;b=b.next_cl,b.isDeleted()||(a-=1),0!==a;)if(b instanceof k.Delimiter)throw new Error("position parameter exceeded the length of the document!");return b},c}(k.Insert),g=function(b){function c(a,b,d,e,f,g,h){c.__super__.constructor.call(this,b,d,e,f,g,h),null!=a&&this.replace(a)}return e(c,b),c.prototype.replace=function(b){var c,d;return c=this.getLastOperation(),d=new h(b,this,a.getNextOperationIdentifier(),c,c.next_cl),a.addOperation(d).execute()},c.prototype.val=function(){var a;if(a=this.getLastOperation(),a instanceof k.Delimiter)throw new Error("dtrn");return a.val()},c.prototype._encode=function(){var a;return a={type:"ReplaceManager",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&null!=this.next_cl&&(a.prev=this.prev_cl.getUid(),a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},c}(d),j.ReplaceManager=function(a){var b,c,d,e,f,h,i;return c=a.content,i=a.uid,h=a.prev,e=a.next,f=a.origin,b=a.beginning,d=a.end,new g(c,i,b,d,h,e,f)},h=function(a){function b(a,c,d,e,f,g){if(this.saveOperation("content",a),this.saveOperation("parent",c),null==e||null==f||null==a)throw new Error("You must define content, prev, and next for Replaceable-types!");b.__super__.constructor.call(this,d,e,f,g)}return e(b,a),b.prototype.val=function(){return this.content},b.prototype.replace=function(a){return this.parent.replace(a)},b.prototype.execute=function(){var a;return this.validateSavedOperations()?("function"==typeof(a=this.content).setReplaceManager&&a.setReplaceManager(this.parent),b.__super__.execute.apply(this,arguments),this):!1},b.prototype._encode=function(){var a;return a={type:"Replaceable",content:this.content.getUid(),ReplaceManager:this.parent.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid(),uid:this.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(k.Insert),j.Replaceable=function(a){var b,c,d,e,f,g;return b=a.content,e=a.ReplaceManager,g=a.uid,f=a.prev,c=a.next,d=a.origin,new h(b,e,g,f,c,d)},k.ListManager=d,k.MapManager=f,k.ReplaceManager=g,k.Replaceable=h,i}},{"./BasicTypes.coffee":6}],9:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./StructuredTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i;return h=c(a),i=h.types,g=h.parser,b=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return e(b,a),b}(i.Delete),g.TextDelete=g.Delete,d=function(a){function b(a,c,d,e,f){if(this.content=a,null==d||null==e)throw new Error("You must define prev, and next for TextInsert-types!");b.__super__.constructor.call(this,c,d,e,f)}return e(b,a),b.prototype.getLength=function(){return this.isDeleted()?0:this.content.length},b.prototype.val=function(){return this.isDeleted()?"":this.content},b.prototype._encode=function(){var a;return a={type:"TextInsert",content:this.content,uid:this.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(i.Insert),g.TextInsert=function(a){var b,c,e,f,g;return b=a.content,g=a.uid,f=a.prev,c=a.next,e=a.origin,new d(b,g,f,c,e)},f=function(c){function f(a,b,c,d,e,g,h){f.__super__.constructor.call(this,a,c,d,e,g,h),null!=b&&this.insertText(0,b)}return e(f,c),f.prototype.insertText=function(b,c){var e,f,g,h,i,j;for(f=this.getOperationByPosition(b),j=[],h=0,i=c.length;i>h;h++)e=c[h],g=new d(e,a.getNextOperationIdentifier(),f.prev_cl,f),j.push(a.addOperation(g).execute());return j},f.prototype.deleteText=function(c,d){var e,f,g,h,j;for(g=this.getOperationByPosition(c),j=[],f=h=0;d>=0?d>h:h>d;f=d>=0?++h:--h){for(e=a.addOperation(new b(a.getNextOperationIdentifier(),g)).execute(),g=g.next_cl;g.isDeleted();){if(g instanceof i.Delimiter)throw new Error("You can't delete more than there is..");g=g.next_cl}j.push(e._encode())}return j},f.prototype.replaceText=function(b){var c;if(null!=this.replace_manager)return c=a.addOperation(new f(a.getNextOperationIdentifier())).execute(),c.insertText(0,b),this.replace_manager.replace(c);throw new Error("This type is currently not maintained by a ReplaceManager!")},f.prototype.val=function(){var a,b;return a=function(){var a,c,d,e;for(d=this.toArray(),e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(null!=b.val?b.val():"");return e}.call(this),a.join("")},f.prototype.setReplaceManager=function(a){return this.saveOperation("replace_manager",a),this.validateSavedOperations},f.prototype._encode=function(){var a;return a={type:"Word",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},f}(i.ListManager),g.Word=function(a){var b,c,d,e,g,h;return h=a.uid,b=a.beginning,c=a.end,g=a.prev,d=a.next,e=a.origin,new f(h,void 0,b,c,g,d,e)},i.TextInsert=d,i.TextDelete=b,i.Word=f,h}},{"./StructuredTypes.coffee":8}],10:[function(a,b){b.exports=a("./lib/chai")},{"./lib/chai":11}],11:[function(a,b,c){var d=[],c=b.exports={};c.version="1.9.1",c.AssertionError=a("assertion-error");var e=a("./chai/utils");c.use=function(a){return~d.indexOf(a)||(a(this,e),d.push(a)),this};var f=a("./chai/config");c.config=f;var g=a("./chai/assertion");c.use(g);var h=a("./chai/core/assertions");c.use(h);var i=a("./chai/interface/expect");c.use(i);var j=a("./chai/interface/should");c.use(j);var k=a("./chai/interface/assert");c.use(k)},{"./chai/assertion":12,"./chai/config":13,"./chai/core/assertions":14,"./chai/interface/assert":15,"./chai/interface/expect":16,"./chai/interface/should":17,"./chai/utils":28,"assertion-error":37}],12:[function(a,b){var c=a("./config");b.exports=function(a,b){function d(a,b,c){f(this,"ssfi",c||arguments.callee),f(this,"object",a),f(this,"message",b)}var e=a.AssertionError,f=b.flag;a.Assertion=d,Object.defineProperty(d,"includeStack",{get:function(){return console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack},set:function(a){console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack=a}}),Object.defineProperty(d,"showDiff",{get:function(){return console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff},set:function(a){console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff=a}}),d.addProperty=function(a,c){b.addProperty(this.prototype,a,c)},d.addMethod=function(a,c){b.addMethod(this.prototype,a,c)},d.addChainableMethod=function(a,c,d){b.addChainableMethod(this.prototype,a,c,d)},d.overwriteProperty=function(a,c){b.overwriteProperty(this.prototype,a,c)},d.overwriteMethod=function(a,c){b.overwriteMethod(this.prototype,a,c)},d.overwriteChainableMethod=function(a,c,d){b.overwriteChainableMethod(this.prototype,a,c,d)},d.prototype.assert=function(a,d,g,h,i,j){var k=b.test(this,arguments);if(!0!==j&&(j=!1),!0!==c.showDiff&&(j=!1),!k){var d=b.getMessage(this,arguments),l=b.getActual(this,arguments);throw new e(d,{actual:l,expected:h,showDiff:j},c.includeStack?this.assert:f(this,"ssfi"))}},Object.defineProperty(d.prototype,"_obj",{get:function(){return f(this,"object")},set:function(a){f(this,"object",a)}})}},{"./config":13}],13:[function(a,b){b.exports={includeStack:!1,showDiff:!0,truncateThreshold:40}},{}],14:[function(a,b){b.exports=function(a,b){function c(a,c){c&&u(this,"message",c),a=a.toLowerCase();var d=u(this,"object"),e=~["a","e","i","o","u"].indexOf(a.charAt(0))?"an ":"a ";this.assert(a===b.type(d),"expected #{this} to be "+e+a,"expected #{this} not to be "+e+a)}function d(){u(this,"contains",!0)}function e(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=!1;if("array"===b.type(d)&&"object"===b.type(a)){for(var f in d)if(b.eql(d[f],a)){e=!0;break}}else if("object"===b.type(a)){if(!u(this,"negate")){for(var g in a)new t(d).property(g,a[g]);return}var h={};for(var g in a)h[g]=d[g];e=b.eql(h,a)}else e=d&&~d.indexOf(a);this.assert(e,"expected #{this} to include "+b.inspect(a),"expected #{this} to not include "+b.inspect(a))}function f(){var a=u(this,"object"),b=Object.prototype.toString.call(a);this.assert("[object Arguments]"===b,"expected #{this} to be arguments but got "+b,"expected #{this} to not be arguments")}function g(a,b){b&&u(this,"message",b);var c=u(this,"object");return u(this,"deep")?this.eql(a):void this.assert(a===c,"expected #{this} to equal #{exp}","expected #{this} to not equal #{exp}",a,this._obj,!0)}function h(a,c){c&&u(this,"message",c),this.assert(b.eql(a,u(this,"object")),"expected #{this} to deeply equal #{exp}","expected #{this} to not deeply equal #{exp}",a,this._obj,!0)}function i(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>a,"expected #{this} to have a length above #{exp} but got #{act}","expected #{this} to not have a length above #{exp}",a,d)}else this.assert(c>a,"expected #{this} to be above "+a,"expected #{this} to be at most "+a)}function j(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>=a,"expected #{this} to have a length at least #{exp} but got #{act}","expected #{this} to have a length below #{exp}",a,d)}else this.assert(c>=a,"expected #{this} to be at least "+a,"expected #{this} to be below "+a)}function k(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");
|
||
var d=c.length;this.assert(a>d,"expected #{this} to have a length below #{exp} but got #{act}","expected #{this} to not have a length below #{exp}",a,d)}else this.assert(a>c,"expected #{this} to be below "+a,"expected #{this} to be at least "+a)}function l(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(a>=d,"expected #{this} to have a length at most #{exp} but got #{act}","expected #{this} to have a length above #{exp}",a,d)}else this.assert(a>=c,"expected #{this} to be at most "+a,"expected #{this} to be above "+a)}function m(a,c){c&&u(this,"message",c);var d=b.getName(a);this.assert(u(this,"object")instanceof a,"expected #{this} to be an instance of "+d,"expected #{this} to not be an instance of "+d)}function n(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(d.hasOwnProperty(a),"expected #{this} to have own property "+b.inspect(a),"expected #{this} to not have own property "+b.inspect(a))}function o(){u(this,"doLength",!0)}function p(a,b){b&&u(this,"message",b);var c=u(this,"object");new t(c,b).to.have.property("length");var d=c.length;this.assert(d==a,"expected #{this} to have a length of #{exp} but got #{act}","expected #{this} to not have a length of #{act}",a,d)}function q(a){var c,d=u(this,"object"),e=!0;if(a=a instanceof Array?a:Array.prototype.slice.call(arguments),!a.length)throw new Error("keys required");var f=Object.keys(d),g=a.length;if(e=a.every(function(a){return~f.indexOf(a)}),u(this,"negate")||u(this,"contains")||(e=e&&a.length==f.length),g>1){a=a.map(function(a){return b.inspect(a)});var h=a.pop();c=a.join(", ")+", and "+h}else c=b.inspect(a[0]);c=(g>1?"keys ":"key ")+c,c=(u(this,"contains")?"contain ":"have ")+c,this.assert(e,"expected #{this} to "+c,"expected #{this} to not "+c)}function r(a,c,d){d&&u(this,"message",d);var e=u(this,"object");new t(e,d).is.a("function");var f=!1,g=null,h=null,i=null;0===arguments.length?(c=null,a=null):a&&(a instanceof RegExp||"string"==typeof a)?(c=a,a=null):a&&a instanceof Error?(g=a,a=null,c=null):"function"==typeof a?(h=a.prototype.name||a.name,"Error"===h&&a!==Error&&(h=(new a).name)):a=null;try{e()}catch(j){if(g)return this.assert(j===g,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}",g instanceof Error?g.toString():g,j instanceof Error?j.toString():j),u(this,"object",j),this;if(a&&(this.assert(j instanceof a,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp} but #{act} was thrown",h,j instanceof Error?j.toString():j),!c))return u(this,"object",j),this;var k="object"===b.type(j)&&"message"in j?j.message:""+j;if(null!=k&&c&&c instanceof RegExp)return this.assert(c.exec(k),"expected #{this} to throw error matching #{exp} but got #{act}","expected #{this} to throw error not matching #{exp}",c,k),u(this,"object",j),this;if(null!=k&&c&&"string"==typeof c)return this.assert(~k.indexOf(c),"expected #{this} to throw error including #{exp} but got #{act}","expected #{this} to throw error not including #{act}",c,k),u(this,"object",j),this;f=!0,i=j}var l="",m=null!==h?h:g?"#{exp}":"an error";f&&(l=" but #{act} was thrown"),this.assert(f===!0,"expected #{this} to throw "+m+l,"expected #{this} to not throw "+m+l,g instanceof Error?g.toString():g,i instanceof Error?i.toString():i),u(this,"object",i)}function s(a,b,c){return a.every(function(a){return c?b.some(function(b){return c(a,b)}):-1!==b.indexOf(a)})}var t=a.Assertion,u=(Object.prototype.toString,b.flag);["to","be","been","is","and","has","have","with","that","at","of","same"].forEach(function(a){t.addProperty(a,function(){return this})}),t.addProperty("not",function(){u(this,"negate",!0)}),t.addProperty("deep",function(){u(this,"deep",!0)}),t.addChainableMethod("an",c),t.addChainableMethod("a",c),t.addChainableMethod("include",e,d),t.addChainableMethod("contain",e,d),t.addProperty("ok",function(){this.assert(u(this,"object"),"expected #{this} to be truthy","expected #{this} to be falsy")}),t.addProperty("true",function(){this.assert(!0===u(this,"object"),"expected #{this} to be true","expected #{this} to be false",this.negate?!1:!0)}),t.addProperty("false",function(){this.assert(!1===u(this,"object"),"expected #{this} to be false","expected #{this} to be true",this.negate?!0:!1)}),t.addProperty("null",function(){this.assert(null===u(this,"object"),"expected #{this} to be null","expected #{this} not to be null")}),t.addProperty("undefined",function(){this.assert(void 0===u(this,"object"),"expected #{this} to be undefined","expected #{this} not to be undefined")}),t.addProperty("exist",function(){this.assert(null!=u(this,"object"),"expected #{this} to exist","expected #{this} to not exist")}),t.addProperty("empty",function(){var a=u(this,"object"),b=a;Array.isArray(a)||"string"==typeof object?b=a.length:"object"==typeof a&&(b=Object.keys(a).length),this.assert(!b,"expected #{this} to be empty","expected #{this} not to be empty")}),t.addProperty("arguments",f),t.addProperty("Arguments",f),t.addMethod("equal",g),t.addMethod("equals",g),t.addMethod("eq",g),t.addMethod("eql",h),t.addMethod("eqls",h),t.addMethod("above",i),t.addMethod("gt",i),t.addMethod("greaterThan",i),t.addMethod("least",j),t.addMethod("gte",j),t.addMethod("below",k),t.addMethod("lt",k),t.addMethod("lessThan",k),t.addMethod("most",l),t.addMethod("lte",l),t.addMethod("within",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object"),e=a+".."+b;if(u(this,"doLength")){new t(d,c).to.have.property("length");var f=d.length;this.assert(f>=a&&b>=f,"expected #{this} to have a length within "+e,"expected #{this} to not have a length within "+e)}else this.assert(d>=a&&b>=d,"expected #{this} to be within "+e,"expected #{this} to not be within "+e)}),t.addMethod("instanceof",m),t.addMethod("instanceOf",m),t.addMethod("property",function(a,c,d){d&&u(this,"message",d);var e=u(this,"deep")?"deep property ":"property ",f=u(this,"negate"),g=u(this,"object"),h=u(this,"deep")?b.getPathValue(a,g):g[a];if(f&&void 0!==c){if(void 0===h)throw d=null!=d?d+": ":"",new Error(d+b.inspect(g)+" has no "+e+b.inspect(a))}else this.assert(void 0!==h,"expected #{this} to have a "+e+b.inspect(a),"expected #{this} to not have "+e+b.inspect(a));void 0!==c&&this.assert(c===h,"expected #{this} to have a "+e+b.inspect(a)+" of #{exp}, but got #{act}","expected #{this} to not have a "+e+b.inspect(a)+" of #{act}",c,h),u(this,"object",h)}),t.addMethod("ownProperty",n),t.addMethod("haveOwnProperty",n),t.addChainableMethod("length",p,o),t.addMethod("lengthOf",p,o),t.addMethod("match",function(a,b){b&&u(this,"message",b);var c=u(this,"object");this.assert(a.exec(c),"expected #{this} to match "+a,"expected #{this} not to match "+a)}),t.addMethod("string",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d,c).is.a("string"),this.assert(~d.indexOf(a),"expected #{this} to contain "+b.inspect(a),"expected #{this} to not contain "+b.inspect(a))}),t.addMethod("keys",q),t.addMethod("key",q),t.addMethod("throw",r),t.addMethod("throws",r),t.addMethod("Throw",r),t.addMethod("respondTo",function(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=u(this,"itself"),f="function"!==b.type(d)||e?d[a]:d.prototype[a];this.assert("function"==typeof f,"expected #{this} to respond to "+b.inspect(a),"expected #{this} to not respond to "+b.inspect(a))}),t.addProperty("itself",function(){u(this,"itself",!0)}),t.addMethod("satisfy",function(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(a(d),"expected #{this} to satisfy "+b.objDisplay(a),"expected #{this} to not satisfy"+b.objDisplay(a),this.negate?!1:!0,a(d))}),t.addMethod("closeTo",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(Math.abs(d-a)<=b,"expected #{this} to be close to "+a+" +/- "+b,"expected #{this} not to be close to "+a+" +/- "+b)}),t.addMethod("members",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d).to.be.an("array"),new t(a).to.be.an("array");var e=u(this,"deep")?b.eql:void 0;return u(this,"contains")?this.assert(s(a,d,e),"expected #{this} to be a superset of #{act}","expected #{this} to not be a superset of #{act}",d,a):void this.assert(s(d,a,e)&&s(a,d,e),"expected #{this} to have the same members as #{act}","expected #{this} to not have the same members as #{act}",d,a)})}},{}],15:[function(require,module,exports){module.exports=function(chai,util){var Assertion=chai.Assertion,flag=util.flag,assert=chai.assert=function(a,b){var c=new Assertion(null,null,chai.assert);c.assert(a,b,"[ negation message unavailable ]")};assert.fail=function(a,b,c,d){throw c=c||"assert.fail()",new chai.AssertionError(c,{actual:a,expected:b,operator:d},assert.fail)},assert.ok=function(a,b){new Assertion(a,b).is.ok},assert.notOk=function(a,b){new Assertion(a,b).is.not.ok},assert.equal=function(a,b,c){var d=new Assertion(a,c,assert.equal);d.assert(b==flag(d,"object"),"expected #{this} to equal #{exp}","expected #{this} to not equal #{act}",b,a)},assert.notEqual=function(a,b,c){var d=new Assertion(a,c,assert.notEqual);d.assert(b!=flag(d,"object"),"expected #{this} to not equal #{exp}","expected #{this} to equal #{act}",b,a)},assert.strictEqual=function(a,b,c){new Assertion(a,c).to.equal(b)},assert.notStrictEqual=function(a,b,c){new Assertion(a,c).to.not.equal(b)},assert.deepEqual=function(a,b,c){new Assertion(a,c).to.eql(b)},assert.notDeepEqual=function(a,b,c){new Assertion(a,c).to.not.eql(b)},assert.isTrue=function(a,b){new Assertion(a,b).is["true"]},assert.isFalse=function(a,b){new Assertion(a,b).is["false"]},assert.isNull=function(a,b){new Assertion(a,b).to.equal(null)},assert.isNotNull=function(a,b){new Assertion(a,b).to.not.equal(null)},assert.isUndefined=function(a,b){new Assertion(a,b).to.equal(void 0)},assert.isDefined=function(a,b){new Assertion(a,b).to.not.equal(void 0)},assert.isFunction=function(a,b){new Assertion(a,b).to.be.a("function")},assert.isNotFunction=function(a,b){new Assertion(a,b).to.not.be.a("function")},assert.isObject=function(a,b){new Assertion(a,b).to.be.a("object")},assert.isNotObject=function(a,b){new Assertion(a,b).to.not.be.a("object")},assert.isArray=function(a,b){new Assertion(a,b).to.be.an("array")},assert.isNotArray=function(a,b){new Assertion(a,b).to.not.be.an("array")},assert.isString=function(a,b){new Assertion(a,b).to.be.a("string")},assert.isNotString=function(a,b){new Assertion(a,b).to.not.be.a("string")},assert.isNumber=function(a,b){new Assertion(a,b).to.be.a("number")},assert.isNotNumber=function(a,b){new Assertion(a,b).to.not.be.a("number")},assert.isBoolean=function(a,b){new Assertion(a,b).to.be.a("boolean")},assert.isNotBoolean=function(a,b){new Assertion(a,b).to.not.be.a("boolean")},assert.typeOf=function(a,b,c){new Assertion(a,c).to.be.a(b)},assert.notTypeOf=function(a,b,c){new Assertion(a,c).to.not.be.a(b)},assert.instanceOf=function(a,b,c){new Assertion(a,c).to.be.instanceOf(b)},assert.notInstanceOf=function(a,b,c){new Assertion(a,c).to.not.be.instanceOf(b)},assert.include=function(a,b,c){new Assertion(a,c,assert.include).include(b)},assert.notInclude=function(a,b,c){new Assertion(a,c,assert.notInclude).not.include(b)},assert.match=function(a,b,c){new Assertion(a,c).to.match(b)},assert.notMatch=function(a,b,c){new Assertion(a,c).to.not.match(b)},assert.property=function(a,b,c){new Assertion(a,c).to.have.property(b)},assert.notProperty=function(a,b,c){new Assertion(a,c).to.not.have.property(b)},assert.deepProperty=function(a,b,c){new Assertion(a,c).to.have.deep.property(b)},assert.notDeepProperty=function(a,b,c){new Assertion(a,c).to.not.have.deep.property(b)},assert.propertyVal=function(a,b,c,d){new Assertion(a,d).to.have.property(b,c)},assert.propertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.property(b,c)},assert.deepPropertyVal=function(a,b,c,d){new Assertion(a,d).to.have.deep.property(b,c)},assert.deepPropertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.deep.property(b,c)},assert.lengthOf=function(a,b,c){new Assertion(a,c).to.have.length(b)},assert.Throw=function(a,b,c,d){("string"==typeof b||b instanceof RegExp)&&(c=b,b=null);var e=new Assertion(a,d).to.Throw(b,c);return flag(e,"object")},assert.doesNotThrow=function(a,b,c){"string"==typeof b&&(c=b,b=null),new Assertion(a,c).to.not.Throw(b)},assert.operator=function(val,operator,val2,msg){if(!~["==","===",">",">=","<","<=","!=","!=="].indexOf(operator))throw new Error('Invalid operator "'+operator+'"');var test=new Assertion(eval(val+operator+val2),msg);test.assert(!0===flag(test,"object"),"expected "+util.inspect(val)+" to be "+operator+" "+util.inspect(val2),"expected "+util.inspect(val)+" to not be "+operator+" "+util.inspect(val2))},assert.closeTo=function(a,b,c,d){new Assertion(a,d).to.be.closeTo(b,c)},assert.sameMembers=function(a,b,c){new Assertion(a,c).to.have.same.members(b)},assert.includeMembers=function(a,b,c){new Assertion(a,c).to.include.members(b)},assert.ifError=function(a,b){new Assertion(a,b).to.not.be.ok},function a(b,c){return assert[c]=assert[b],a}("Throw","throw")("Throw","throws")}},{}],16:[function(a,b){b.exports=function(a){a.expect=function(b,c){return new a.Assertion(b,c)}}},{}],17:[function(a,b){b.exports=function(a){function b(){function a(){return this instanceof String||this instanceof Number?new c(this.constructor(this),null,a):this instanceof Boolean?new c(1==this,null,a):new c(this,null,a)}function b(a){Object.defineProperty(this,"should",{value:a,enumerable:!0,configurable:!0,writable:!0})}Object.defineProperty(Object.prototype,"should",{set:b,get:a,configurable:!0});var d={};return d.equal=function(a,b,d){new c(a,d).to.equal(b)},d.Throw=function(a,b,d,e){new c(a,e).to.Throw(b,d)},d.exist=function(a,b){new c(a,b).to.exist},d.not={},d.not.equal=function(a,b,d){new c(a,d).to.not.equal(b)},d.not.Throw=function(a,b,d,e){new c(a,e).to.not.Throw(b,d)},d.not.exist=function(a,b){new c(a,b).to.not.exist},d["throw"]=d.Throw,d.not["throw"]=d.not.Throw,d}var c=a.Assertion;a.should=b,a.Should=b}},{}],18:[function(a,b){var c=a("./transferFlags"),d=a("./flag"),e=a("../config"),f="__proto__"in Object,g=/^(?:length|name|arguments|caller)$/,h=Function.prototype.call,i=Function.prototype.apply;b.exports=function(a,b,j,k){"function"!=typeof k&&(k=function(){});var l={method:j,chainingBehavior:k};a.__methods||(a.__methods={}),a.__methods[b]=l,Object.defineProperty(a,b,{get:function(){l.chainingBehavior.call(this);var b=function m(){var a=d(this,"ssfi");a&&e.includeStack===!1&&d(this,"ssfi",m);var b=l.method.apply(this,arguments);return void 0===b?this:b};if(f){var j=b.__proto__=Object.create(this);j.call=h,j.apply=i}else{var k=Object.getOwnPropertyNames(a);k.forEach(function(c){if(!g.test(c)){var d=Object.getOwnPropertyDescriptor(a,c);Object.defineProperty(b,c,d)}})}return c(this,b),b},configurable:!0})}},{"../config":13,"./flag":21,"./transferFlags":35}],19:[function(a,b){var c=a("../config"),d=a("./flag");b.exports=function(a,b,e){a[b]=function(){var f=d(this,"ssfi");f&&c.includeStack===!1&&d(this,"ssfi",a[b]);var g=e.apply(this,arguments);return void 0===g?this:g}}},{"../config":13,"./flag":21}],20:[function(a,b){b.exports=function(a,b,c){Object.defineProperty(a,b,{get:function(){var a=c.call(this);return void 0===a?this:a},configurable:!0})}},{}],21:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));return 3!==arguments.length?d[b]:void(d[b]=c)}},{}],22:[function(a,b){b.exports=function(a,b){return b.length>4?b[4]:a._obj}},{}],23:[function(a,b){b.exports=function(a){var b=[];for(var c in a)b.push(c);return b}},{}],24:[function(a,b){var c=a("./flag"),d=a("./getActual"),e=(a("./inspect"),a("./objDisplay"));b.exports=function(a,b){var f=c(a,"negate"),g=c(a,"object"),h=b[3],i=d(a,b),j=f?b[2]:b[1],k=c(a,"message");return j=j||"",j=j.replace(/#{this}/g,e(g)).replace(/#{act}/g,e(i)).replace(/#{exp}/g,e(h)),k?k+": "+j:j}},{"./flag":21,"./getActual":22,"./inspect":29,"./objDisplay":30}],25:[function(a,b){b.exports=function(a){if(a.name)return a.name;var b=/^\s?function ([^(]*)\(/.exec(a);return b&&b[1]?b[1]:""}},{}],26:[function(a,b){function c(a){var b=a.replace(/\[/g,".["),c=b.match(/(\\\.|[^.]+?)+/g);return c.map(function(a){var b=/\[(\d+)\]$/,c=b.exec(a);return c?{i:parseFloat(c[1])}:{p:a}})}function d(a,b){for(var c,d=b,e=0,f=a.length;f>e;e++){var g=a[e];d?("undefined"!=typeof g.p?d=d[g.p]:"undefined"!=typeof g.i&&(d=d[g.i]),e==f-1&&(c=d)):c=void 0}return c}b.exports=function(a,b){var e=c(a);return d(e,b)}},{}],27:[function(a,b){b.exports=function(){function a(a){-1===b.indexOf(a)&&b.push(a)}for(var b=Object.getOwnPropertyNames(subject),c=Object.getPrototypeOf(subject);null!==c;)Object.getOwnPropertyNames(c).forEach(a),c=Object.getPrototypeOf(c);return b}},{}],28:[function(a,b,c){var c=b.exports={};c.test=a("./test"),c.type=a("./type"),c.getMessage=a("./getMessage"),c.getActual=a("./getActual"),c.inspect=a("./inspect"),c.objDisplay=a("./objDisplay"),c.flag=a("./flag"),c.transferFlags=a("./transferFlags"),c.eql=a("deep-eql"),c.getPathValue=a("./getPathValue"),c.getName=a("./getName"),c.addProperty=a("./addProperty"),c.addMethod=a("./addMethod"),c.overwriteProperty=a("./overwriteProperty"),c.overwriteMethod=a("./overwriteMethod"),c.addChainableMethod=a("./addChainableMethod"),c.overwriteChainableMethod=a("./overwriteChainableMethod")},{"./addChainableMethod":18,"./addMethod":19,"./addProperty":20,"./flag":21,"./getActual":22,"./getMessage":24,"./getName":25,"./getPathValue":26,"./inspect":29,"./objDisplay":30,"./overwriteChainableMethod":31,"./overwriteMethod":32,"./overwriteProperty":33,"./test":34,"./transferFlags":35,"./type":36,"deep-eql":38}],29:[function(a,b,c){function d(a,b,c){var d={showHidden:b,seen:[],stylize:function(a){return a}};return e(d,a,"undefined"==typeof c?2:c)}function e(a,b,d){if(b&&"function"==typeof b.inspect&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var o=b.inspect(d);return"string"!=typeof o&&(o=e(a,o,d)),o}var u=f(a,b);if(u)return u;if(t(b))return s(b);var v=r(b),w=a.showHidden?q(b):v;if(0===w.length||n(b)&&(1===w.length&&"stack"===w[0]||2===w.length&&"description"===w[0]&&"stack"===w[1])){if("function"==typeof b){var x=p(b),y=x?": "+x:"";return a.stylize("[Function"+y+"]","special")}if(l(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(m(b))return a.stylize(Date.prototype.toUTCString.call(b),"date");if(n(b))return g(b)}var z="",A=!1,B=["{","}"];if(k(b)&&(A=!0,B=["[","]"]),"function"==typeof b){var x=p(b),y=x?": "+x:"";z=" [Function"+y+"]"}if(l(b)&&(z=" "+RegExp.prototype.toString.call(b)),m(b)&&(z=" "+Date.prototype.toUTCString.call(b)),n(b))return g(b);if(0===w.length&&(!A||0==b.length))return B[0]+z+B[1];if(0>d)return l(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var C;return C=A?h(a,b,d,v,w):w.map(function(c){return i(a,b,d,v,c,A)}),a.seen.pop(),j(C,z,B)}function f(a,b){switch(typeof b){case"undefined":return a.stylize("undefined","undefined");case"string":var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string");case"number":return a.stylize(""+b,"number");case"boolean":return a.stylize(""+b,"boolean")}return null===b?a.stylize("null","null"):void 0}function g(a){return"["+Error.prototype.toString.call(a)+"]"}function h(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(Object.prototype.hasOwnProperty.call(b,String(g))?i(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(i(a,b,c,d,e,!0))}),f}function i(a,b,c,d,f,g){var h,i;if(b.__lookupGetter__&&(b.__lookupGetter__(f)?i=b.__lookupSetter__(f)?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):b.__lookupSetter__(f)&&(i=a.stylize("[Setter]","special"))),d.indexOf(f)<0&&(h="["+f+"]"),i||(a.seen.indexOf(b[f])<0?(i=null===c?e(a,b[f],null):e(a,b[f],c-1),i.indexOf("\n")>-1&&(i=g?i.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+i.split("\n").map(function(a){return" "+a}).join("\n"))):i=a.stylize("[Circular]","special")),"undefined"==typeof h){if(g&&f.match(/^\d+$/))return i;h=JSON.stringify(""+f),h.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(h=h.substr(1,h.length-2),h=a.stylize(h,"name")):(h=h.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),h=a.stylize(h,"string"))}return h+": "+i}function j(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function k(a){return Array.isArray(a)||"object"==typeof a&&"[object Array]"===o(a)}function l(a){return"object"==typeof a&&"[object RegExp]"===o(a)}function m(a){return"object"==typeof a&&"[object Date]"===o(a)}function n(a){return"object"==typeof a&&"[object Error]"===o(a)}function o(a){return Object.prototype.toString.call(a)}var p=a("./getName"),q=a("./getProperties"),r=a("./getEnumerableProperties");b.exports=d;var s=function(a){if("outerHTML"in a)return a.outerHTML;var b,c="http://www.w3.org/1999/xhtml",d=document.createElementNS(c,"_"),e=((window.HTMLElement||window.Element).prototype,new XMLSerializer);return document.xmlVersion?e.serializeToString(a):(d.appendChild(a.cloneNode(!1)),b=d.innerHTML.replace("><",">"+a.innerHTML+"<"),d.innerHTML="",b)},t=function(a){return"object"==typeof HTMLElement?a instanceof HTMLElement:a&&"object"==typeof a&&1===a.nodeType&&"string"==typeof a.nodeName}},{"./getEnumerableProperties":23,"./getName":25,"./getProperties":27}],30:[function(a,b){var c=a("./inspect"),d=a("../config");b.exports=function(a){var b=c(a),e=Object.prototype.toString.call(a);if(d.truncateThreshold&&b.length>=d.truncateThreshold){if("[object Function]"===e)return a.name&&""!==a.name?"[Function: "+a.name+"]":"[Function]";if("[object Array]"===e)return"[ Array("+a.length+") ]";if("[object Object]"===e){var f=Object.keys(a),g=f.length>2?f.splice(0,2).join(", ")+", ...":f.join(", ");return"{ Object ("+g+") }"}return b}return b}},{"../config":13,"./inspect":29}],31:[function(a,b){b.exports=function(a,b,c,d){var e=a.__methods[b],f=e.chainingBehavior;e.chainingBehavior=function(){var a=d(f).call(this);return void 0===a?this:a};var g=e.method;e.method=function(){var a=c(g).apply(this,arguments);return void 0===a?this:a}}},{}],32:[function(a,b){b.exports=function(a,b,c){var d=a[b],e=function(){return this};d&&"function"==typeof d&&(e=d),a[b]=function(){var a=c(e).apply(this,arguments);return void 0===a?this:a}}},{}],33:[function(a,b){b.exports=function(a,b,c){var d=Object.getOwnPropertyDescriptor(a,b),e=function(){};d&&"function"==typeof d.get&&(e=d.get),Object.defineProperty(a,b,{get:function(){var a=c(e).call(this);return void 0===a?this:a},configurable:!0})}},{}],34:[function(a,b){var c=a("./flag");b.exports=function(a,b){var d=c(a,"negate"),e=b[0];return d?!e:e}},{"./flag":21}],35:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));b.__flags||(b.__flags=Object.create(null)),c=3===arguments.length?c:!0;for(var e in d)(c||"object"!==e&&"ssfi"!==e&&"message"!=e)&&(b.__flags[e]=d[e])}},{}],36:[function(a,b){var c={"[object Arguments]":"arguments","[object Array]":"array","[object Date]":"date","[object Function]":"function","[object Number]":"number","[object RegExp]":"regexp","[object String]":"string"};b.exports=function(a){var b=Object.prototype.toString.call(a);return c[b]?c[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}},{}],37:[function(a,b){function c(){function a(a,c){Object.keys(c).forEach(function(d){~b.indexOf(d)||(a[d]=c[d])})}var b=[].slice.call(arguments);return function(){for(var b=[].slice.call(arguments),c=0,d={};c<b.length;c++)a(d,b[c]);return d}}function d(a,b,d){var e=c("name","message","stack","constructor","toJSON"),f=e(b||{});this.message=a||"Unspecified AssertionError",this.showDiff=!1;for(var g in f)this[g]=f[g];d=d||arguments.callee,d&&Error.captureStackTrace&&Error.captureStackTrace(this,d)}b.exports=d,d.prototype=Object.create(Error.prototype),d.prototype.name="AssertionError",d.prototype.constructor=d,d.prototype.toJSON=function(a){var b=c("constructor","toJSON","stack"),d=b({name:this.name},this);return!1!==a&&this.stack&&(d.stack=this.stack),d}},{}],38:[function(a,b){b.exports=a("./lib/eql")},{"./lib/eql":39}],39:[function(a,b){function c(a,b,c){return d(a,b)?!0:"date"===o(a)?f(a,b):"regexp"===o(a)?g(a,b):n.isBuffer(a)?k(a,b):"arguments"===o(a)?h(a,b,c):e(a,b)?"object"!==o(a)&&"object"!==o(b)&&"array"!==o(a)&&"array"!==o(b)?d(a,b):m(a,b,c):!1}function d(a,b){return a===b?0!==a||1/a===1/b:a!==a&&b!==b}function e(a,b){return o(a)===o(b)}function f(a,b){return"date"!==o(b)?!1:d(a.getTime(),b.getTime())}function g(a,b){return"regexp"!==o(b)?!1:d(a.toString(),b.toString())}function h(a,b,d){return"arguments"!==o(b)?!1:(a=[].slice.call(a),b=[].slice.call(b),c(a,b,d))}function i(a){var b=[];for(var c in a)b.push(c);return b}function j(a,b){if(a.length!==b.length)return!1;for(var c=0,d=!0;c<a.length;c++)if(a[c]!==b[c]){d=!1;break}return d}function k(a,b){return n.isBuffer(b)?j(a,b):!1}function l(a){return null!==a&&void 0!==a}function m(a,b,d){if(!l(a)||!l(b))return!1;if(a.prototype!==b.prototype)return!1;var e;if(d){for(e=0;e<d.length;e++)if(d[e][0]===a&&d[e][1]===b||d[e][0]===b&&d[e][1]===a)return!0}else d=[];try{var f=i(a),g=i(b)}catch(h){return!1}if(f.sort(),g.sort(),!j(f,g))return!1;d.push([a,b]);var k;for(e=f.length-1;e>=0;e--)if(k=f[e],!c(a[k],b[k],d))return!1;return!0}var n,o=a("type-detect");try{n=a("buffer").Buffer}catch(p){n={},n.isBuffer=function(){return!1}}b.exports=c},{buffer:42,"type-detect":40}],40:[function(a,b){b.exports=a("./lib/type")},{"./lib/type":41}],41:[function(a,b,c){function d(a){var b=Object.prototype.toString.call(a);return f[b]?f[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}function e(){this.tests={}}var c=b.exports=d,f={"[object Array]":"array","[object RegExp]":"regexp","[object Function]":"function","[object Arguments]":"arguments","[object Date]":"date"};c.Library=e,e.prototype.of=d,e.prototype.define=function(a,b){return 1===arguments.length?this.tests[a]:(this.tests[a]=b,this)},e.prototype.test=function(a,b){if(b===d(a))return!0;var c=this.tests[b];if(c&&"regexp"===d(c))return c.test(a);if(c&&"function"===d(c))return c(a);throw new ReferenceError('Type test "'+b+'" not defined or invalid.')}},{}],42:[function(a,b,c){function d(a,b,c){if(!(this instanceof d))return new d(a,b,c);var e,f=typeof a;if("number"===f)e=a>0?a>>>0:0;else if("string"===f)"base64"===b&&(a=C(a)),e=d.byteLength(a,b);else{if("object"!==f||null===a)throw new Error("First argument needs to be a number, array or string.");"Buffer"===a.type&&E(a.data)&&(a=a.data),e=+a.length>0?Math.floor(+a.length):0}var g;T?g=d._augment(new Uint8Array(e)):(g=this,g.length=e,g._isBuffer=!0);var h;if(T&&"number"==typeof a.byteLength)g._set(a);else if(F(a))if(d.isBuffer(a))for(h=0;e>h;h++)g[h]=a.readUInt8(h);else for(h=0;e>h;h++)g[h]=(a[h]%256+256)%256;else if("string"===f)g.write(a,0,b);else if("number"===f&&!T&&!c)for(h=0;e>h;h++)g[h]=0;return g}function e(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;Q(f%2===0,"Invalid hex string"),d>f/2&&(d=f/2);for(var g=0;d>g;g++){var h=parseInt(b.substr(2*g,2),16);Q(!isNaN(h),"Invalid hex string"),a[c+g]=h}return g}function f(a,b,c,d){var e=L(H(b),a,c,d);return e}function g(a,b,c,d){var e=L(I(b),a,c,d);return e}function h(a,b,c,d){return g(a,b,c,d)}function i(a,b,c,d){var e=L(K(b),a,c,d);return e}function j(a,b,c,d){var e=L(J(b),a,c,d);return e}function k(a,b,c){return R.fromByteArray(0===b&&c===a.length?a:a.slice(b,c))}function l(a,b,c){var d="",e="";c=Math.min(a.length,c);for(var f=b;c>f;f++)a[f]<=127?(d+=M(e)+String.fromCharCode(a[f]),e=""):e+="%"+a[f].toString(16);return d+M(e)}function m(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(a[e]);return d}function n(a,b,c){return m(a,b,c)}function o(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;f++)e+=G(a[f]);return e}function p(a,b,c){for(var d=a.slice(b,c),e="",f=0;f<d.length;f+=2)e+=String.fromCharCode(d[f]+256*d[f+1]);return e}function q(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(f=a[b],e>b+1&&(f|=a[b+1]<<8)):(f=a[b]<<8,e>b+1&&(f|=a[b+1])),f}}function r(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(e>b+2&&(f=a[b+2]<<16),e>b+1&&(f|=a[b+1]<<8),f|=a[b],e>b+3&&(f+=a[b+3]<<24>>>0)):(e>b+1&&(f=a[b+1]<<16),e>b+2&&(f|=a[b+2]<<8),e>b+3&&(f|=a[b+3]),f+=a[b]<<24>>>0),f}}function s(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=q(a,b,c,!0),g=32768&f;return g?-1*(65535-f+1):f}}function t(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=r(a,b,c,!0),g=2147483648&f;return g?-1*(4294967295-f+1):f}}function u(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+3<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,23,4)}function v(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+7<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,52,8)}function w(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"trying to write beyond buffer length"),N(b,65535));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,2);h>g;g++)a[c+g]=(b&255<<8*(d?g:1-g))>>>8*(d?g:1-g);return c+2}}function x(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"trying to write beyond buffer length"),N(b,4294967295));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,4);h>g;g++)a[c+g]=b>>>8*(d?g:3-g)&255;return c+4}}function y(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"Trying to write beyond buffer length"),O(b,32767,-32768));var f=a.length;return c>=f?void 0:(b>=0?w(a,b,c,d,e):w(a,65535+b+1,c,d,e),c+2)}function z(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),O(b,2147483647,-2147483648));var f=a.length;return c>=f?void 0:(b>=0?x(a,b,c,d,e):x(a,4294967295+b+1,c,d,e),c+4)}function A(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),P(b,3.4028234663852886e38,-3.4028234663852886e38));var f=a.length;return c>=f?void 0:(S.write(a,b,c,d,23,4),c+4)}function B(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+7<a.length,"Trying to write beyond buffer length"),P(b,1.7976931348623157e308,-1.7976931348623157e308));var f=a.length;return c>=f?void 0:(S.write(a,b,c,d,52,8),c+8)}function C(a){for(a=D(a).replace(V,"");a.length%4!==0;)a+="=";return a}function D(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function E(a){return(Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)})(a)}function F(a){return E(a)||d.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length
|
||
}function G(a){return 16>a?"0"+a.toString(16):a.toString(16)}function H(a){for(var b=[],c=0;c<a.length;c++){var d=a.charCodeAt(c);if(127>=d)b.push(d);else{var e=c;d>=55296&&57343>=d&&c++;for(var f=encodeURIComponent(a.slice(e,c+1)).substr(1).split("%"),g=0;g<f.length;g++)b.push(parseInt(f[g],16))}}return b}function I(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function J(a){for(var b,c,d,e=[],f=0;f<a.length;f++)b=a.charCodeAt(f),c=b>>8,d=b%256,e.push(d),e.push(c);return e}function K(a){return R.toByteArray(a)}function L(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);e++)b[e+c]=a[e];return e}function M(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function N(a,b){Q("number"==typeof a,"cannot write a non-number as a number"),Q(a>=0,"specified a negative value for writing an unsigned value"),Q(b>=a,"value is larger than maximum value for type"),Q(Math.floor(a)===a,"value has a fractional component")}function O(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value"),Q(Math.floor(a)===a,"value has a fractional component")}function P(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value")}function Q(a,b){if(!a)throw new Error(b||"Failed assertion")}var R=a("base64-js"),S=a("ieee754");c.Buffer=d,c.SlowBuffer=d,c.INSPECT_MAX_BYTES=50,d.poolSize=8192;var T=function(){try{var a=new ArrayBuffer(0),b=new Uint8Array(a);return b.foo=function(){return 42},42===b.foo()&&"function"==typeof b.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(c){return!1}}();d.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.isBuffer=function(a){return!(null==a||!a._isBuffer)},d.byteLength=function(a,b){var c;switch(a=a.toString(),b||"utf8"){case"hex":c=a.length/2;break;case"utf8":case"utf-8":c=H(a).length;break;case"ascii":case"binary":case"raw":c=a.length;break;case"base64":c=K(a).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":c=2*a.length;break;default:throw new Error("Unknown encoding")}return c},d.concat=function(a,b){if(Q(E(a),"Usage: Buffer.concat(list[, length])"),0===a.length)return new d(0);if(1===a.length)return a[0];var c;if(void 0===b)for(b=0,c=0;c<a.length;c++)b+=a[c].length;var e=new d(b),f=0;for(c=0;c<a.length;c++){var g=a[c];g.copy(e,f),f+=g.length}return e},d.compare=function(a,b){Q(d.isBuffer(a)&&d.isBuffer(b),"Arguments must be Buffers");for(var c=a.length,e=b.length,f=0,g=Math.min(c,e);g>f&&a[f]===b[f];f++);return f!==g&&(c=a[f],e=b[f]),e>c?-1:c>e?1:0},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var k=d;d=b,b=c,c=k}b=Number(b)||0;var l=this.length-b;c?(c=Number(c),c>l&&(c=l)):c=l,d=String(d||"utf8").toLowerCase();var m;switch(d){case"hex":m=e(this,a,b,c);break;case"utf8":case"utf-8":m=f(this,a,b,c);break;case"ascii":m=g(this,a,b,c);break;case"binary":m=h(this,a,b,c);break;case"base64":m=i(this,a,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":m=j(this,a,b,c);break;default:throw new Error("Unknown encoding")}return m},d.prototype.toString=function(a,b,c){var d=this;if(a=String(a||"utf8").toLowerCase(),b=Number(b)||0,c=void 0===c?d.length:Number(c),c===b)return"";var e;switch(a){case"hex":e=o(d,b,c);break;case"utf8":case"utf-8":e=l(d,b,c);break;case"ascii":e=m(d,b,c);break;case"binary":e=n(d,b,c);break;case"base64":e=k(d,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":e=p(d,b,c);break;default:throw new Error("Unknown encoding")}return e},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},d.prototype.equals=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),0===d.compare(this,a)},d.prototype.compare=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),d.compare(this,a)},d.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||0===d||(d=this.length),b||(b=0),d!==c&&0!==a.length&&0!==e.length){Q(d>=c,"sourceEnd < sourceStart"),Q(b>=0&&b<a.length,"targetStart out of bounds"),Q(c>=0&&c<e.length,"sourceStart out of bounds"),Q(d>=0&&d<=e.length,"sourceEnd out of bounds"),d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);var f=d-c;if(100>f||!T)for(var g=0;f>g;g++)a[g+b]=this[g+c];else a._set(this.subarray(c,c+f),b)}},d.prototype.slice=function(a,b){var c=this.length;if(a=~~a,b=void 0===b?c:~~b,0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c),0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c),a>b&&(b=a),T)return d._augment(this.subarray(a,b));for(var e=b-a,f=new d(e,void 0,!0),g=0;e>g;g++)f[g]=this[g+a];return f},d.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},d.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},d.prototype.readUInt8=function(a,b){return b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),a>=this.length?void 0:this[a]},d.prototype.readUInt16LE=function(a,b){return q(this,a,!0,b)},d.prototype.readUInt16BE=function(a,b){return q(this,a,!1,b)},d.prototype.readUInt32LE=function(a,b){return r(this,a,!0,b)},d.prototype.readUInt32BE=function(a,b){return r(this,a,!1,b)},d.prototype.readInt8=function(a,b){if(b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),!(a>=this.length)){var c=128&this[a];return c?-1*(255-this[a]+1):this[a]}},d.prototype.readInt16LE=function(a,b){return s(this,a,!0,b)},d.prototype.readInt16BE=function(a,b){return s(this,a,!1,b)},d.prototype.readInt32LE=function(a,b){return t(this,a,!0,b)},d.prototype.readInt32BE=function(a,b){return t(this,a,!1,b)},d.prototype.readFloatLE=function(a,b){return u(this,a,!0,b)},d.prototype.readFloatBE=function(a,b){return u(this,a,!1,b)},d.prototype.readDoubleLE=function(a,b){return v(this,a,!0,b)},d.prototype.readDoubleBE=function(a,b){return v(this,a,!1,b)},d.prototype.writeUInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"trying to write beyond buffer length"),N(a,255)),b>=this.length?void 0:(this[b]=a,b+1)},d.prototype.writeUInt16LE=function(a,b,c){return w(this,a,b,!0,c)},d.prototype.writeUInt16BE=function(a,b,c){return w(this,a,b,!1,c)},d.prototype.writeUInt32LE=function(a,b,c){return x(this,a,b,!0,c)},d.prototype.writeUInt32BE=function(a,b,c){return x(this,a,b,!1,c)},d.prototype.writeInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"Trying to write beyond buffer length"),O(a,127,-128)),b>=this.length?void 0:(a>=0?this.writeUInt8(a,b,c):this.writeUInt8(255+a+1,b,c),b+1)},d.prototype.writeInt16LE=function(a,b,c){return y(this,a,b,!0,c)},d.prototype.writeInt16BE=function(a,b,c){return y(this,a,b,!1,c)},d.prototype.writeInt32LE=function(a,b,c){return z(this,a,b,!0,c)},d.prototype.writeInt32BE=function(a,b,c){return z(this,a,b,!1,c)},d.prototype.writeFloatLE=function(a,b,c){return A(this,a,b,!0,c)},d.prototype.writeFloatBE=function(a,b,c){return A(this,a,b,!1,c)},d.prototype.writeDoubleLE=function(a,b,c){return B(this,a,b,!0,c)},d.prototype.writeDoubleBE=function(a,b,c){return B(this,a,b,!1,c)},d.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),Q(c>=b,"end < start"),c!==b&&0!==this.length){Q(b>=0&&b<this.length,"start out of bounds"),Q(c>=0&&c<=this.length,"end out of bounds");var d;if("number"==typeof a)for(d=b;c>d;d++)this[d]=a;else{var e=H(a.toString()),f=e.length;for(d=b;c>d;d++)this[d]=e[d%f]}return this}},d.prototype.inspect=function(){for(var a=[],b=this.length,d=0;b>d;d++)if(a[d]=G(this[d]),d===c.INSPECT_MAX_BYTES){a[d+1]="...";break}return"<Buffer "+a.join(" ")+">"},d.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(T)return new d(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;c>b;b+=1)a[b]=this[b];return a.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var U=d.prototype;d._augment=function(a){return a._isBuffer=!0,a._get=a.get,a._set=a.set,a.get=U.get,a.set=U.set,a.write=U.write,a.toString=U.toString,a.toLocaleString=U.toString,a.toJSON=U.toJSON,a.equals=U.equals,a.compare=U.compare,a.copy=U.copy,a.slice=U.slice,a.readUInt8=U.readUInt8,a.readUInt16LE=U.readUInt16LE,a.readUInt16BE=U.readUInt16BE,a.readUInt32LE=U.readUInt32LE,a.readUInt32BE=U.readUInt32BE,a.readInt8=U.readInt8,a.readInt16LE=U.readInt16LE,a.readInt16BE=U.readInt16BE,a.readInt32LE=U.readInt32LE,a.readInt32BE=U.readInt32BE,a.readFloatLE=U.readFloatLE,a.readFloatBE=U.readFloatBE,a.readDoubleLE=U.readDoubleLE,a.readDoubleBE=U.readDoubleBE,a.writeUInt8=U.writeUInt8,a.writeUInt16LE=U.writeUInt16LE,a.writeUInt16BE=U.writeUInt16BE,a.writeUInt32LE=U.writeUInt32LE,a.writeUInt32BE=U.writeUInt32BE,a.writeInt8=U.writeInt8,a.writeInt16LE=U.writeInt16LE,a.writeInt16BE=U.writeInt16BE,a.writeInt32LE=U.writeInt32LE,a.writeInt32BE=U.writeInt32BE,a.writeFloatLE=U.writeFloatLE,a.writeFloatBE=U.writeFloatBE,a.writeDoubleLE=U.writeDoubleLE,a.writeDoubleBE=U.writeDoubleBE,a.fill=U.fill,a.inspect=U.inspect,a.toArrayBuffer=U.toArrayBuffer,a};var V=/[^+\/0-9A-z]/g},{"base64-js":43,ieee754:44}],43:[function(a,b,c){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(a){"use strict";function b(a){var b=a.charCodeAt(0);return b===g?62:b===h?63:i>b?-1:i+10>b?b-i+26+26:k+26>b?b-k:j+26>b?b-j+26:void 0}function c(a){function c(a){j[l++]=a}var d,e,g,h,i,j;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new f(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,e=0;g>d;d+=4,e+=3)h=b(a.charAt(d))<<18|b(a.charAt(d+1))<<12|b(a.charAt(d+2))<<6|b(a.charAt(d+3)),c((16711680&h)>>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function e(a){function b(a){return d.charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var e,f,g,h=a.length%3,i="";for(e=0,g=a.length-h;g>e;e+=3)f=(a[e]<<16)+(a[e+1]<<8)+a[e+2],i+=c(f);switch(h){case 1:f=a[a.length-1],i+=b(f>>2),i+=b(f<<4&63),i+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],i+=b(f>>10),i+=b(f>>4&63),i+=b(f<<2&63),i+="="}return i}var f="undefined"!=typeof Uint8Array?Uint8Array:Array,g="+".charCodeAt(0),h="/".charCodeAt(0),i="0".charCodeAt(0),j="a".charCodeAt(0),k="A".charCodeAt(0);a.toByteArray=c,a.fromByteArray=e}("undefined"==typeof c?this.base64js={}:c)},{}],44:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],45:[function(a,b){b.exports="function"==typeof Object.create?function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],46:[function(a,b){function c(){}var d=b.exports={};d.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var d=c.shift();d()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.binding=function(){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(){throw new Error("process.chdir is not supported")}},{}],47:[function(a,b){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8}},{}],48:[function(a,b,c){(function(b,d){function e(a,b){var d={seen:[],stylize:g};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),p(b)?d.showHidden=b:b&&c._extend(d,b),v(d.showHidden)&&(d.showHidden=!1),v(d.depth)&&(d.depth=2),v(d.colors)&&(d.colors=!1),v(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=f),i(d,a,d.depth)}function f(a,b){var c=e.styles[b];return c?"["+e.colors[c][0]+"m"+a+"["+e.colors[c][1]+"m":a}function g(a){return a}function h(a){var b={};return a.forEach(function(a){b[a]=!0}),b}function i(a,b,d){if(a.customInspect&&b&&A(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return t(e)||(e=i(a,e,d)),e}var f=j(a,b);if(f)return f;var g=Object.keys(b),p=h(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),z(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return k(b);if(0===g.length){if(A(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(w(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(y(b))return a.stylize(Date.prototype.toString.call(b),"date");if(z(b))return k(b)}var r="",s=!1,u=["{","}"];if(o(b)&&(s=!0,u=["[","]"]),A(b)){var v=b.name?": "+b.name:"";r=" [Function"+v+"]"}if(w(b)&&(r=" "+RegExp.prototype.toString.call(b)),y(b)&&(r=" "+Date.prototype.toUTCString.call(b)),z(b)&&(r=" "+k(b)),0===g.length&&(!s||0==b.length))return u[0]+r+u[1];if(0>d)return w(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var x;return x=s?l(a,b,d,p,g):g.map(function(c){return m(a,b,d,p,c,s)}),a.seen.pop(),n(x,r,u)}function j(a,b){if(v(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return s(b)?a.stylize(""+b,"number"):p(b)?a.stylize(""+b,"boolean"):q(b)?a.stylize("null","null"):void 0}function k(a){return"["+Error.prototype.toString.call(a)+"]"}function l(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(F(b,String(g))?m(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(m(a,b,c,d,e,!0))}),f}function m(a,b,c,d,e,f){var g,h,j;if(j=Object.getOwnPropertyDescriptor(b,e)||{value:b[e]},j.get?h=j.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):j.set&&(h=a.stylize("[Setter]","special")),F(d,e)||(g="["+e+"]"),h||(a.seen.indexOf(j.value)<0?(h=q(c)?i(a,j.value,null):i(a,j.value,c-1),h.indexOf("\n")>-1&&(h=f?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),v(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function n(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function o(a){return Array.isArray(a)}function p(a){return"boolean"==typeof a}function q(a){return null===a}function r(a){return null==a}function s(a){return"number"==typeof a}function t(a){return"string"==typeof a}function u(a){return"symbol"==typeof a}function v(a){return void 0===a}function w(a){return x(a)&&"[object RegExp]"===C(a)}function x(a){return"object"==typeof a&&null!==a}function y(a){return x(a)&&"[object Date]"===C(a)}function z(a){return x(a)&&("[object Error]"===C(a)||a instanceof Error)}function A(a){return"function"==typeof a}function B(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function C(a){return Object.prototype.toString.call(a)}function D(a){return 10>a?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),J[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=/%[sdj%]/g;c.format=function(a){if(!t(a)){for(var b=[],c=0;c<arguments.length;c++)b.push(e(arguments[c]));return b.join(" ")}for(var c=1,d=arguments,f=d.length,g=String(a).replace(G,function(a){if("%%"===a)return"%";if(c>=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(b){return"[Circular]"}default:return a}}),h=d[c];f>c;h=d[++c])g+=q(h)||!x(h)?" "+h:" "+e(h);return g},c.deprecate=function(a,e){function f(){if(!g){if(b.throwDeprecation)throw new Error(e);b.traceDeprecation?console.trace(e):console.error(e),g=!0}return a.apply(this,arguments)}if(v(d.process))return function(){return c.deprecate(a,e).apply(this,arguments)};if(b.noDeprecation===!0)return a;var g=!1;return f};var H,I={};c.debuglog=function(a){if(v(H)&&(H=b.env.NODE_DEBUG||""),a=a.toUpperCase(),!I[a])if(new RegExp("\\b"+a+"\\b","i").test(H)){var d=b.pid;I[a]=function(){var b=c.format.apply(c,arguments);console.error("%s %d: %s",a,d,b)}}else I[a]=function(){};return I[a]},c.inspect=e,e.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},e.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},c.isArray=o,c.isBoolean=p,c.isNull=q,c.isNullOrUndefined=r,c.isNumber=s,c.isString=t,c.isSymbol=u,c.isUndefined=v,c.isRegExp=w,c.isObject=x,c.isDate=y,c.isError=z,c.isFunction=A,c.isPrimitive=B,c.isBuffer=a("./support/isBuffer");var J=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c.log=function(){console.log("%s - %s",E(),c.format.apply(c,arguments))},c.inherits=a("inherits"),c._extend=function(a,b){if(!b||!x(b))return a;for(var c=Object.keys(b),d=c.length;d--;)a[c[d]]=b[c[d]];return a}}).call(this,a("JkpR2F"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":47,JkpR2F:46,inherits:45}],49:[function(a,b,c){!function(d){"use strict";"function"==typeof a&&"object"==typeof c&&"object"==typeof b?b.exports=d:"function"==typeof define&&define.amd?define(function(){return d}):chai.use(d)}(function(a,b){"use strict";function c(a){return"function"==typeof a&&"function"==typeof a.getCall&&"function"==typeof a.calledWithExactly}function d(a){return 1===a?"once":2===a?"twice":3===a?"thrice":(a||0)+" times"}function e(a){return a&&c(a.proxy)}function f(a){if(!c(a._obj)&&!e(a._obj))throw new TypeError(b.inspect(a._obj)+" is not a spy or a call to a spy!")}function g(a,b,d,e,f){function g(b){return a.printf.apply(a,b)}var h=e?"always have ":"have ";return d=d||"",c(a.proxy)&&(a=a.proxy),{affirmative:g(["expected %n to "+h+b+d].concat(f)),negative:g(["expected %n to not "+h+b].concat(f))}}function h(c,d,e){b.addProperty(a.Assertion.prototype,c,function(){f(this);var a=g(this._obj,d,e,!1);this.assert(this._obj[c],a.affirmative,a.negative)})}function i(c,e,h){b.addMethod(a.Assertion.prototype,c,function(a){f(this);var b=g(this._obj,e,h,!1,[d(a)]);this.assert(this._obj[c]===a,b.affirmative,b.negative)})}function j(a,c,d){return function(){f(this);var e="always"+a[0].toUpperCase()+a.substring(1),h=b.flag(this,"always")&&"function"==typeof this._obj[e],i=h?e:a,j=g(this._obj,c,d,h,n.call(arguments));this.assert(this._obj[i].apply(this._obj,arguments),j.affirmative,j.negative)}}function k(c,d,e){var f=j(c,d,e);b.addProperty(a.Assertion.prototype,c,f)}function l(c,d,e,f){var g=j(d,e,f);b.addMethod(a.Assertion.prototype,c,g)}function m(a,b,c){l(a,a,b,c)}var n=Array.prototype.slice;b.addProperty(a.Assertion.prototype,"always",function(){b.flag(this,"always",!0)}),h("called","been called"," at least once, but it was never called"),i("callCount","been called exactly %1",", but it was called %c%C"),h("calledOnce","been called exactly once",", but it was called %c%C"),h("calledTwice","been called exactly twice",", but it was called %c%C"),h("calledThrice","been called exactly thrice",", but it was called %c%C"),k("calledWithNew","been called with new"),m("calledBefore","been called before %1"),m("calledAfter","been called after %1"),m("calledOn","been called with %1 as this",", but it was called with %t instead"),m("calledWith","been called with arguments %*","%C"),m("calledWithExactly","been called with exact arguments %*","%C"),m("calledWithMatch","been called with arguments matching %*","%C"),m("returned","returned %1"),l("thrown","threw","thrown %1")})},{}],50:[function(a,b,c){"use strict";!function(d){function e(a){var b=!1;try{a.appendChild(l),b=l.parentNode==a}catch(c){return!1}finally{try{a.removeChild(l)}catch(c){}}return b}function f(a){return l&&a&&1===a.nodeType&&e(a)}function g(a){return"function"==typeof a||!!(a&&a.constructor&&a.call&&a.apply)}function h(a){return"number"==typeof a&&isNaN(a)}function i(a,b){for(var c in b)m.call(a,c)||(a[c]=b[c])}function j(a){return"function"==typeof a&&"function"==typeof a.restore&&a.restore.sinon}function k(a,b,c){c.exports=n,n.spy=a("./sinon/spy"),n.spyCall=a("./sinon/call"),n.behavior=a("./sinon/behavior"),n.stub=a("./sinon/stub"),n.mock=a("./sinon/mock"),n.collection=a("./sinon/collection"),n.assert=a("./sinon/assert"),n.sandbox=a("./sinon/sandbox"),n.test=a("./sinon/test"),n.testCase=a("./sinon/test_case"),n.match=a("./sinon/match")}var l="undefined"!=typeof document&&document.createElement("div"),m=Object.prototype.hasOwnProperty,n={wrapMethod:function(a,b,c){if(!a)throw new TypeError("Should wrap property of object");if("function"!=typeof c)throw new TypeError("Method wrapper should be function");var d,e=a[b];if(g(e)){if(e.restore&&e.restore.sinon)d=new TypeError("Attempted to wrap "+b+" which is already wrapped");else if(e.calledBefore){var f=e.returns?"stubbed":"spied on";d=new TypeError("Attempted to wrap "+b+" which is already "+f)}}else d=new TypeError("Attempted to wrap "+typeof e+" property "+b+" as function");if(d)throw e&&e._stack&&(d.stack+="\n--------------\n"+e._stack),d;var h=a.hasOwnProperty?a.hasOwnProperty(b):m.call(a,b);return a[b]=c,c.displayName=b,c._stack=new Error("Stack Trace for original").stack,c.restore=function(){h||delete a[b],a[b]===c&&(a[b]=e)},c.restore.sinon=!0,i(c,e),c},extend:function(a){for(var b=1,c=arguments.length;c>b;b+=1)for(var d in arguments[b])arguments[b].hasOwnProperty(d)&&(a[d]=arguments[b][d]),arguments[b].hasOwnProperty("toString")&&arguments[b].toString!=a.toString&&(a.toString=arguments[b].toString);return a},create:function(a){var b=function(){};return b.prototype=a,new b},deepEqual:function t(a,b){if(n.match&&n.match.isMatcher(a))return a.test(b);if("object"!=typeof a||"object"!=typeof b)return h(a)&&h(b)?!0:a===b;if(f(a)||f(b))return a===b;if(a===b)return!0;if(null===a&&null!==b||null!==a&&null===b)return!1;if(a instanceof RegExp&&b instanceof RegExp)return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;var c=Object.prototype.toString.call(a);if(c!=Object.prototype.toString.call(b))return!1;if("[object Date]"==c)return a.valueOf()===b.valueOf();var d,e=0,g=0;if("[object Array]"==c&&a.length!==b.length)return!1;for(d in a){if(e+=1,!(d in b))return!1;if(!t(a[d],b[d]))return!1}for(d in b)g+=1;return e==g},functionName:function(a){var b=a.displayName||a.name;if(!b){var c=a.toString().match(/function ([^\s\(]+)/);b=c&&c[1]}return b},functionToString:function(){if(this.getCall&&this.callCount)for(var a,b,c=this.callCount;c--;){a=this.getCall(c).thisValue;for(b in a)if(a[b]===this)return b}return this.displayName||"sinon fake"},getConfig:function(a){var b={};a=a||{};var c=n.defaultConfig;for(var d in c)c.hasOwnProperty(d)&&(b[d]=a.hasOwnProperty(d)?a[d]:c[d]);return b},format:function(a){return""+a},defaultConfig:{injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},timesInWords:function(a){return 1==a&&"once"||2==a&&"twice"||3==a&&"thrice"||(a||0)+" times"},calledInOrder:function(a){for(var b=1,c=a.length;c>b;b++)if(!a[b-1].calledBefore(a[b])||!a[b].called)return!1;return!0},orderByFirstCall:function(a){return a.sort(function(a,b){var c=a.getCall(0),d=b.getCall(0),e=c&&c.callId||-1,f=d&&d.callId||-1;return f>e?-1:1})},log:function(){},logError:function(a,b){var c=a+" threw exception: ";n.log(c+"["+b.name+"] "+b.message),b.stack&&n.log(b.stack),setTimeout(function(){throw b.message=c+b.message,b},0)},typeOf:function(a){if(null===a)return"null";if(void 0===a)return"undefined";var b=Object.prototype.toString.call(a);return b.substring(8,b.length-1).toLowerCase()},createStubInstance:function(a){if("function"!=typeof a)throw new TypeError("The constructor should be a function.");return n.stub(n.create(a.prototype))},restore:function(a){if(null!==a&&"object"==typeof a)for(var b in a)j(a[b])&&a[b].restore();else j(a)&&a.restore()}},o="undefined"!=typeof b&&b.exports&&"function"==typeof a,p="function"==typeof define&&"object"==typeof define.amd&&define.amd;if(p)define(k);else if(o){try{d=a("formatio")}catch(q){}k(a,c,b)}if(d){var r=d.configure({quoteStrings:!1});n.format=function(){return r.ascii.apply(r,arguments)}}else if(o)try{var s=a("util");n.format=function(a){return"object"==typeof a&&a.toString===Object.prototype.toString?s.inspect(a):a}}catch(q){}return n}("object"==typeof formatio&&formatio)},{"./sinon/assert":51,"./sinon/behavior":52,"./sinon/call":53,"./sinon/collection":54,"./sinon/match":55,"./sinon/mock":56,"./sinon/sandbox":57,"./sinon/spy":58,"./sinon/stub":59,"./sinon/test":60,"./sinon/test_case":61,formatio:63,util:48}],51:[function(a,b){(function(c){"use strict";!function(c,d){function e(){for(var a,b=0,c=arguments.length;c>b;++b)a=arguments[b],a||i.fail("fake is not a spy"),"function"!=typeof a&&i.fail(a+" is not a function"),"function"!=typeof a.getCall&&i.fail(a+" is not stubbed")}function f(a,b){a=a||d;var c=a.fail||i.fail;c.call(a,b)}function g(a,b,c){2==arguments.length&&(c=b,b=a),i[a]=function(d){e(d);var g=k.call(arguments,1),h=!1;h="function"==typeof b?!b(d):"function"==typeof d[b]?!d[b].apply(d,g):!d[b],h?f(this,d.printf.apply(d,[c].concat(g))):i.pass(a)}}function h(a,b){return!a||/^fail/.test(b)?b:a+b.slice(0,1).toUpperCase()+b.slice(1)}var i,j="undefined"!=typeof b&&b.exports&&"function"==typeof a,k=Array.prototype.slice;!c&&j&&(c=a("../sinon")),c&&(i={failException:"AssertError",fail:function(a){var b=new Error(a);throw b.name=this.failException||i.failException,b},pass:function(){},callOrder:function(){e.apply(null,arguments);var a="",b="";if(c.calledInOrder(arguments))i.pass("callOrder");else{try{a=[].join.call(arguments,", ");for(var d=k.call(arguments),g=d.length;g;)d[--g].called||d.splice(g,1);b=c.orderByFirstCall(d).join(", ")}catch(h){}f(this,"expected "+a+" to be called in order but were called as "+b)}},callCount:function(a,b){if(e(a),a.callCount!=b){var d="expected %n to be called "+c.timesInWords(b)+" but was called %c%C";f(this,a.printf(d))}else i.pass("callCount")},expose:function(a,b){if(!a)throw new TypeError("target is null or undefined");var c=b||{},d="undefined"==typeof c.prefix&&"assert"||c.prefix,e="undefined"==typeof c.includeFail||!!c.includeFail;for(var f in this)"export"==f||!e&&/^(fail)/.test(f)||(a[h(d,f)]=this[f]);return a},match:function(a,b){var d=c.match(b);if(d.test(a))i.pass("match");else{var e=["expected value to match"," expected = "+c.format(b)," actual = "+c.format(a)];f(this,e.join("\n"))}}},g("called","expected %n to have been called at least once but was never called"),g("notCalled",function(a){return!a.called},"expected %n to not have been called but was called %c%C"),g("calledOnce","expected %n to be called once but was called %c%C"),g("calledTwice","expected %n to be called twice but was called %c%C"),g("calledThrice","expected %n to be called thrice but was called %c%C"),g("calledOn","expected %n to be called with %1 as this but was called with %t"),g("alwaysCalledOn","expected %n to always be called with %1 as this but was called with %t"),g("calledWithNew","expected %n to be called with new"),g("alwaysCalledWithNew","expected %n to always be called with new"),g("calledWith","expected %n to be called with arguments %*%C"),g("calledWithMatch","expected %n to be called with match %*%C"),g("alwaysCalledWith","expected %n to always be called with arguments %*%C"),g("alwaysCalledWithMatch","expected %n to always be called with match %*%C"),g("calledWithExactly","expected %n to be called with exact arguments %*%C"),g("alwaysCalledWithExactly","expected %n to always be called with exact arguments %*%C"),g("neverCalledWith","expected %n to never be called with arguments %*%C"),g("neverCalledWithMatch","expected %n to never be called with match %*%C"),g("threw","%n did not throw exception%C"),g("alwaysThrew","%n did not always throw exception%C"),c.assert=i,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=i}):j&&(b.exports=i))}("object"==typeof sinon&&sinon||null,"undefined"!=typeof window?window:"undefined"!=typeof self?self:c)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../sinon":50}],52:[function(a,b){(function(c){"use strict";!function(d){function e(a,b){return"string"==typeof a?(this.exception=new Error(b||""),this.exception.name=a):this.exception=a?a:new Error("Error"),this}function f(a,b){var c=a.callArgAt;if(0>c){for(var d=a.callArgProp,e=0,f=b.length;f>e;++e){if(!d&&"function"==typeof b[e])return b[e];if(d&&b[e]&&"function"==typeof b[e][d])return b[e][d]}return null}return b[c]}function g(a,b,c){if(a.callArgAt<0){var e;return e=a.callArgProp?d.functionName(a.stub)+" expected to yield to '"+a.callArgProp+"', but no object with such a property was passed.":d.functionName(a.stub)+" expected to yield, but no callback was passed.",c.length>0&&(e+=" Received ["+l.call(c,", ")+"]"),e}return"argument at index "+a.callArgAt+" is not a function: "+b}function h(a,b){if("number"==typeof a.callArgAt){var c=f(a,b);if("function"!=typeof c)throw new TypeError(g(a,c,b));a.callbackAsync?m(function(){c.apply(a.callbackContext,a.callbackArguments)}):c.apply(a.callbackContext,a.callbackArguments)}}var i="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!d&&i&&(d=a("../sinon")),d){var j,k=Array.prototype.slice,l=Array.prototype.join,m=function(){return"object"==typeof c&&"function"==typeof c.nextTick?c.nextTick:"function"==typeof setImmediate?setImmediate:function(a){setTimeout(a,0)}}();j={create:function(a){var b=d.extend({},d.behavior);return delete b.create,b.stub=a,b
|
||
},isPresent:function(){return"number"==typeof this.callArgAt||this.exception||"number"==typeof this.returnArgAt||this.returnThis||this.returnValueDefined},invoke:function(a,b){if(h(this,b),this.exception)throw this.exception;return"number"==typeof this.returnArgAt?b[this.returnArgAt]:this.returnThis?a:this.returnValue},onCall:function(a){return this.stub.onCall(a)},onFirstCall:function(){return this.stub.onFirstCall()},onSecondCall:function(){return this.stub.onSecondCall()},onThirdCall:function(){return this.stub.onThirdCall()},withArgs:function(){throw new Error('Defining a stub by invoking "stub.onCall(...).withArgs(...)" is not supported. Use "stub.withArgs(...).onCall(...)" to define sequential behavior for calls with certain arguments.')},callsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOn:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgWith:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.callArgAt=a,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOnWith:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},yields:function(){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,0),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsOn:function(a){if("object"!=typeof a)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=a,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsTo:function(a){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=a,this.callbackAsync=!1,this},yieldsToOn:function(a,b){if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=a,this.callbackAsync=!1,this},"throws":e,throwsException:e,returns:function(a){return this.returnValue=a,this.returnValueDefined=!0,this},returnsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.returnArgAt=a,this},returnsThis:function(){return this.returnThis=!0,this}};for(var n in j)j.hasOwnProperty(n)&&n.match(/^(callsArg|yields)/)&&!n.match(/Async/)&&(j[n+"Async"]=function(a){return function(){var b=this[a].apply(this,arguments);return this.callbackAsync=!0,b}}(n));d.behavior=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):i&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)}).call(this,a("JkpR2F"))},{"../sinon":50,JkpR2F:46}],53:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.functionName(a)+b;throw d.length&&(e+=" Received ["+g.call(d).join(", ")+"]"),new Error(e)}function e(a,b,d,e,f,g){if("number"!=typeof g)throw new TypeError("Call id is not a number");var i=c.create(h);return i.proxy=a,i.thisValue=b,i.args=d,i.returnValue=e,i.exception=f,i.callId=g,i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&f&&(c=a("../sinon")),c){var g=Array.prototype.slice,h={calledOn:function(a){return c.match&&c.match.isMatcher(a)?a.test(this.thisValue):this.thisValue===a},calledWith:function(){for(var a=0,b=arguments.length;b>a;a+=1)if(!c.deepEqual(arguments[a],this.args[a]))return!1;return!0},calledWithMatch:function(){for(var a=0,b=arguments.length;b>a;a+=1){var d=this.args[a],e=arguments[a];if(!c.match||!c.match(e).test(d))return!1}return!0},calledWithExactly:function(){return arguments.length==this.args.length&&this.calledWith.apply(this,arguments)},notCalledWith:function(){return!this.calledWith.apply(this,arguments)},notCalledWithMatch:function(){return!this.calledWithMatch.apply(this,arguments)},returned:function(a){return c.deepEqual(a,this.returnValue)},threw:function(a){return"undefined"!=typeof a&&this.exception?this.exception===a||this.exception.name===a:!!this.exception},calledWithNew:function(){return this.proxy.prototype&&this.thisValue instanceof this.proxy},calledBefore:function(a){return this.callId<a.callId},calledAfter:function(a){return this.callId>a.callId},callArg:function(a){this.args[a]()},callArgOn:function(a,b){this.args[a].apply(b)},callArgWith:function(a){this.callArgOnWith.apply(this,[a,null].concat(g.call(arguments,1)))},callArgOnWith:function(a,b){var c=g.call(arguments,2);this.args[a].apply(b,c)},"yield":function(){this.yieldOn.apply(this,[null].concat(g.call(arguments,0)))},yieldOn:function(a){for(var b=this.args,c=0,e=b.length;e>c;++c)if("function"==typeof b[c])return void b[c].apply(a,g.call(arguments,1));d(this.proxy," cannot yield since no callback was passed.",b)},yieldTo:function(a){this.yieldToOn.apply(this,[a,null].concat(g.call(arguments,1)))},yieldToOn:function(a,b){for(var c=this.args,e=0,f=c.length;f>e;++e)if(c[e]&&"function"==typeof c[e][a])return void c[e][a].apply(b,g.call(arguments,2));d(this.proxy," cannot yield to '"+a+"' since no callback was passed.",c)},toString:function(){for(var a=this.proxy.toString()+"(",b=[],d=0,e=this.args.length;e>d;++d)b.push(c.format(this.args[d]));return a=a+b.join(", ")+")","undefined"!=typeof this.returnValue&&(a+=" => "+c.format(this.returnValue)),this.exception&&(a+=" !"+this.exception.name,this.exception.message&&(a+="("+this.exception.message+")")),a}};h.invokeCallback=h.yield,e.toString=h.toString,c.spyCall=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],54:[function(a,b){"use strict";!function(c){function d(a){return a.fakes||(a.fakes=[]),a.fakes}function e(a,b){for(var c=d(a),e=0,f=c.length;f>e;e+=1)"function"==typeof c[e][b]&&c[e][b]()}function f(a){for(var b=d(a),c=0;c<b.length;)b.splice(c,1)}var g="undefined"!=typeof b&&b.exports&&"function"==typeof a,h=[].push,i=Object.prototype.hasOwnProperty;if(!c&&g&&(c=a("../sinon")),c){var j={verify:function(){e(this,"verify")},restore:function(){e(this,"restore"),f(this)},verifyAndRestore:function(){var a;try{this.verify()}catch(b){a=b}if(this.restore(),a)throw a},add:function(a){return h.call(d(this),a),a},spy:function(){return this.add(c.spy.apply(c,arguments))},stub:function(a,b,d){if(b){var e=a[b];if("function"!=typeof e){if(!i.call(a,b))throw new TypeError("Cannot stub non-existent own property "+b);return a[b]=d,this.add({restore:function(){a[b]=e}})}}if(!b&&a&&"object"==typeof a){var f=c.stub.apply(c,arguments);for(var g in f)"function"==typeof f[g]&&this.add(f[g]);return f}return this.add(c.stub.apply(c,arguments))},mock:function(){return this.add(c.mock.apply(c,arguments))},inject:function(a){var b=this;return a.spy=function(){return b.spy.apply(b,arguments)},a.stub=function(){return b.stub.apply(b,arguments)},a.mock=function(){return b.mock.apply(b,arguments)},a}};c.collection=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):g&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],55:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.typeOf(a);if(e!==b)throw new TypeError("Expected type of "+d+" to be "+b+", but was "+e)}function e(a){return i.isPrototypeOf(a)}function f(a,b){if(null===b||void 0===b)return!1;for(var d in a)if(a.hasOwnProperty(d)){var e=a[d],g=b[d];if(j.isMatcher(e)){if(!e.test(g))return!1}else if("object"===c.typeOf(e)){if(!f(e,g))return!1}else if(!c.deepEqual(e,g))return!1}return!0}function g(a,b){return function(e,f){d(e,"string","property");var g=1===arguments.length,h=b+'("'+e+'"';return g||(h+=", "+f),h+=")",j(function(b){return void 0!==b&&null!==b&&a(b,e)?g||c.deepEqual(f,b[e]):!1},h)}}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i={toString:function(){return this.message}};i.or=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)||a.test(c)},d.message=b.message+".or("+a.message+")",d},i.and=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)&&a.test(c)},d.message=b.message+".and("+a.message+")",d};var j=function(a,b){var d=c.create(i),e=c.typeOf(a);switch(e){case"object":if("function"==typeof a.test)return d.test=function(b){return a.test(b)===!0},d.message="match("+c.functionName(a.test)+")",d;var g=[];for(var h in a)a.hasOwnProperty(h)&&g.push(h+": "+a[h]);d.test=function(b){return f(a,b)},d.message="match("+g.join(", ")+")";break;case"number":d.test=function(b){return a==b};break;case"string":d.test=function(b){return"string"!=typeof b?!1:-1!==b.indexOf(a)},d.message='match("'+a+'")';break;case"regexp":d.test=function(b){return"string"!=typeof b?!1:a.test(b)};break;case"function":d.test=a,d.message=b?b:"match("+c.functionName(a)+")";break;default:d.test=function(b){return c.deepEqual(a,b)}}return d.message||(d.message="match("+a+")"),d};j.isMatcher=e,j.any=j(function(){return!0},"any"),j.defined=j(function(a){return null!==a&&void 0!==a},"defined"),j.truthy=j(function(a){return!!a},"truthy"),j.falsy=j(function(a){return!a},"falsy"),j.same=function(a){return j(function(b){return a===b},"same("+a+")")},j.typeOf=function(a){return d(a,"string","type"),j(function(b){return c.typeOf(b)===a},'typeOf("'+a+'")')},j.instanceOf=function(a){return d(a,"function","type"),j(function(b){return b instanceof a},"instanceOf("+c.functionName(a)+")")},j.has=g(function(a,b){return"object"==typeof a?b in a:void 0!==a[b]},"has"),j.hasOwn=g(function(a,b){return a.hasOwnProperty(b)},"hasOwn"),j.bool=j.typeOf("boolean"),j.number=j.typeOf("number"),j.string=j.typeOf("string"),j.object=j.typeOf("object"),j.func=j.typeOf("function"),j.array=j.typeOf("array"),j.regexp=j.typeOf("regexp"),j.date=j.typeOf("date"),c.match=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):h&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],56:[function(a,b){"use strict";!function(c){function d(a){return a?d.create(a):c.expectation.create("Anonymous mock")}var e,f="undefined"!=typeof b&&b.exports&&"function"==typeof a,g=[].push;if(!c&&f&&(c=a("../sinon")),c){e=c.match,!e&&f&&(e=a("./match")),c.mock=d,c.extend(d,function(){function a(a,b){if(a)for(var c=0,d=a.length;d>c;c+=1)b(a[c])}return{create:function(a){if(!a)throw new TypeError("object is null");var b=c.extend({},d);return b.object=a,delete b.create,b},expects:function(a){if(!a)throw new TypeError("method is falsy");if(this.expectations||(this.expectations={},this.proxies=[]),!this.expectations[a]){this.expectations[a]=[];var b=this;c.wrapMethod(this.object,a,function(){return b.invokeMethod(a,this,arguments)}),g.call(this.proxies,a)}var d=c.expectation.create(a);return g.call(this.expectations[a],d),d},restore:function(){var b=this.object;a(this.proxies,function(a){"function"==typeof b[a].restore&&b[a].restore()})},verify:function(){var b=this.expectations||{},d=[],e=[];return a(this.proxies,function(c){a(b[c],function(a){a.met()?g.call(e,a.toString()):g.call(d,a.toString())})}),this.restore(),d.length>0?c.expectation.fail(d.concat(e).join("\n")):c.expectation.pass(d.concat(e).join("\n")),!0},invokeMethod:function(a,b,d){var e,f=this.expectations&&this.expectations[a],h=f&&f.length||0;for(e=0;h>e;e+=1)if(!f[e].met()&&f[e].allowsCall(b,d))return f[e].apply(b,d);var i,j=[],k=0;for(e=0;h>e;e+=1)f[e].allowsCall(b,d)?i=i||f[e]:k+=1,g.call(j," "+f[e].toString());return 0===k?i.apply(b,d):(j.unshift("Unexpected call: "+c.spyCall.toString.call({proxy:a,args:d})),void c.expectation.fail(j.join("\n")))}}}());var h=c.timesInWords;c.expectation=function(){function a(a){return 0==a?"never called":"called "+h(a)}function b(a){var b=a.minCalls,c=a.maxCalls;if("number"==typeof b&&"number"==typeof c){var d=h(b);return b!=c&&(d="at least "+d+" and at most "+h(c)),d}return"number"==typeof b?"at least "+h(b):"at most "+h(c)}function d(a){var b="number"==typeof a.minCalls;return!b||a.callCount>=a.minCalls}function f(a){return"number"!=typeof a.maxCalls?!1:a.callCount==a.maxCalls}function i(a,b){return e&&e.isMatcher(a)?a.test(b):!0}var j=Array.prototype.slice,k=c.spy.invoke;return{minCalls:1,maxCalls:1,create:function(a){var b=c.extend(c.stub.create(),c.expectation);return delete b.create,b.method=a,b},invoke:function(a,b,c){return this.verifyCallAllowed(b,c),k.apply(this,arguments)},atLeast:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");return this.limitsSet||(this.maxCalls=null,this.limitsSet=!0),this.minCalls=a,this},atMost:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");return this.limitsSet||(this.minCalls=null,this.limitsSet=!0),this.maxCalls=a,this},never:function(){return this.exactly(0)},once:function(){return this.exactly(1)},twice:function(){return this.exactly(2)},thrice:function(){return this.exactly(3)},exactly:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not a number");return this.atLeast(a),this.atMost(a)},met:function(){return!this.failed&&d(this)},verifyCallAllowed:function(a,b){if(f(this)&&(this.failed=!0,c.expectation.fail(this.method+" already called "+h(this.maxCalls))),"expectedThis"in this&&this.expectedThis!==a&&c.expectation.fail(this.method+" called with "+a+" as thisValue, expected "+this.expectedThis),"expectedArguments"in this){b||c.expectation.fail(this.method+" received no arguments, expected "+c.format(this.expectedArguments)),b.length<this.expectedArguments.length&&c.expectation.fail(this.method+" received too few arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments)),this.expectsExactArgCount&&b.length!=this.expectedArguments.length&&c.expectation.fail(this.method+" received too many arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments));for(var d=0,e=this.expectedArguments.length;e>d;d+=1)i(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", didn't match "+this.expectedArguments.toString()),c.deepEqual(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", expected "+c.format(this.expectedArguments))}},allowsCall:function(a,b){if(this.met()&&f(this))return!1;if("expectedThis"in this&&this.expectedThis!==a)return!1;if(!("expectedArguments"in this))return!0;if(b=b||[],b.length<this.expectedArguments.length)return!1;if(this.expectsExactArgCount&&b.length!=this.expectedArguments.length)return!1;for(var d=0,e=this.expectedArguments.length;e>d;d+=1){if(!i(this.expectedArguments[d],b[d]))return!1;if(!c.deepEqual(this.expectedArguments[d],b[d]))return!1}return!0},withArgs:function(){return this.expectedArguments=j.call(arguments),this},withExactArgs:function(){return this.withArgs.apply(this,arguments),this.expectsExactArgCount=!0,this},on:function(a){return this.expectedThis=a,this},toString:function(){var d=(this.expectedArguments||[]).slice();this.expectsExactArgCount||g.call(d,"[...]");var e=c.spyCall.toString.call({proxy:this.method||"anonymous mock expectation",args:d}),f=e.replace(", [...","[, ...")+" "+b(this);return this.met()?"Expectation met: "+f:"Expected "+f+" ("+a(this.callCount)+")"},verify:function(){return this.met()?c.expectation.pass(this.toString()):c.expectation.fail(this.toString()),!0},pass:function(a){c.assert.pass(a)},fail:function(a){var b=new Error(a);throw b.name="ExpectationError",b}}}(),c.mock=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):f&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50,"./match":55}],57:[function(a,b){"use strict";if("undefined"!=typeof b&&b.exports&&"function"==typeof a){var c=a("../sinon");c.extend(c,a("./util/fake_timers"))}!function(){function a(a,b,c,d){d&&(!b.injectInto||c in b.injectInto?e.call(a.args,d):(b.injectInto[c]=d,a.injectedKeys.push(c)))}function d(a){var b=c.create(c.sandbox);return a.useFakeServer&&("object"==typeof a.useFakeServer&&(b.serverPrototype=a.useFakeServer),b.useFakeServer()),a.useFakeTimers&&("object"==typeof a.useFakeTimers?b.useFakeTimers.apply(b,a.useFakeTimers):b.useFakeTimers()),b}var e=[].push;c.sandbox=c.extend(c.create(c.collection),{useFakeTimers:function(){return this.clock=c.useFakeTimers.apply(c,arguments),this.add(this.clock)},serverPrototype:c.fakeServer,useFakeServer:function(){var a=this.serverPrototype||c.fakeServer;return a&&a.create?(this.server=a.create(),this.add(this.server)):null},inject:function(a){return c.collection.inject.call(this,a),this.clock&&(a.clock=this.clock),this.server&&(a.server=this.server,a.requests=this.server.requests),a},restore:function(){c.collection.restore.apply(this,arguments),this.restoreContext()},restoreContext:function(){if(this.injectedKeys){for(var a=0,b=this.injectedKeys.length;b>a;a++)delete this.injectInto[this.injectedKeys[a]];this.injectedKeys=[]}},create:function(b){if(!b)return c.create(c.sandbox);var e=d(b);e.args=e.args||[],e.injectedKeys=[],e.injectInto=b.injectInto;var f,g,h=e.inject({});if(b.properties)for(var i=0,j=b.properties.length;j>i;i++)f=b.properties[i],g=h[f]||"sandbox"==f&&e,a(e,b,f,g);else a(e,b,"sandbox",g);return e}}),c.sandbox.useFakeXMLHttpRequest=c.sandbox.useFakeServer,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=c.sandbox}):"undefined"!=typeof b&&b.exports&&(b.exports=c.sandbox)}()},{"../sinon":50,"./util/fake_timers":62}],58:[function(require,module,exports){"use strict";!function(sinon){function spy(a,b){if(!b&&"function"==typeof a)return spy.create(a);if(!a&&!b)return spy.create(function(){});var c=a[b];return sinon.wrapMethod(a,b,spy.create(c))}function matchingFake(a,b,c){if(a)for(var d=0,e=a.length;e>d;d++)if(a[d].matches(b,c))return a[d]}function incrementCallCount(){this.called=!0,this.callCount+=1,this.notCalled=!1,this.calledOnce=1==this.callCount,this.calledTwice=2==this.callCount,this.calledThrice=3==this.callCount}function createCallProperties(){this.firstCall=this.getCall(0),this.secondCall=this.getCall(1),this.thirdCall=this.getCall(2),this.lastCall=this.getCall(this.callCount-1)}function createProxy(func){var p;return func.length?eval("p = (function proxy("+vars.substring(0,2*func.length-1)+") { return p.invoke(func, this, slice.call(arguments)); });"):p=function(){return p.invoke(func,this,slice.call(arguments))},p}function delegateToCalls(a,b,c,d){spyApi[a]=function(){if(!this.called)return d?d.apply(this,arguments):!1;for(var e,f=0,g=0,h=this.callCount;h>g;g+=1)if(e=this.getCall(g),e[c||a].apply(e,arguments)&&(f+=1,b))return!0;return f===this.callCount}}var commonJSModule="undefined"!=typeof module&&module.exports&&"function"==typeof require,push=Array.prototype.push,slice=Array.prototype.slice,callId=0;if(!sinon&&commonJSModule&&(sinon=require("../sinon")),sinon){var vars="a,b,c,d,e,f,g,h,i,j,k,l",uuid=0,spyApi={reset:function(){if(this.called=!1,this.notCalled=!0,this.calledOnce=!1,this.calledTwice=!1,this.calledThrice=!1,this.callCount=0,this.firstCall=null,this.secondCall=null,this.thirdCall=null,this.lastCall=null,this.args=[],this.returnValues=[],this.thisValues=[],this.exceptions=[],this.callIds=[],this.fakes)for(var a=0;a<this.fakes.length;a++)this.fakes[a].reset()},create:function(a){var b;"function"!=typeof a?a=function(){}:b=sinon.functionName(a);var c=createProxy(a);return sinon.extend(c,spy),delete c.create,sinon.extend(c,a),c.reset(),c.prototype=a.prototype,c.displayName=b||"spy",c.toString=sinon.functionToString,c._create=sinon.spy.create,c.id="spy#"+uuid++,c},invoke:function(a,b,c){var d,e,f=matchingFake(this.fakes,c);incrementCallCount.call(this),push.call(this.thisValues,b),push.call(this.args,c),push.call(this.callIds,callId++),createCallProperties.call(this);try{e=f?f.invoke(a,b,c):(this.func||a).apply(b,c);var g=this.getCall(this.callCount-1);g.calledWithNew()&&"object"!=typeof e&&(e=b)}catch(h){d=h}if(push.call(this.exceptions,d),push.call(this.returnValues,e),createCallProperties.call(this),void 0!==d)throw d;return e},named:function(a){return this.displayName=a,this},getCall:function(a){return 0>a||a>=this.callCount?null:sinon.spyCall(this,this.thisValues[a],this.args[a],this.returnValues[a],this.exceptions[a],this.callIds[a])},getCalls:function(){var a,b=[];for(a=0;a<this.callCount;a++)b.push(this.getCall(a));return b},calledBefore:function(a){return this.called?a.called?this.callIds[0]<a.callIds[a.callIds.length-1]:!0:!1},calledAfter:function(a){return this.called&&a.called?this.callIds[this.callCount-1]>a.callIds[a.callCount-1]:!1},withArgs:function(){var a=slice.call(arguments);if(this.fakes){var b=matchingFake(this.fakes,a,!0);if(b)return b}else this.fakes=[];var c=this,d=this._create();d.matchingAguments=a,d.parent=this,push.call(this.fakes,d),d.withArgs=function(){return c.withArgs.apply(c,arguments)};for(var e=0;e<this.args.length;e++)d.matches(this.args[e])&&(incrementCallCount.call(d),push.call(d.thisValues,this.thisValues[e]),push.call(d.args,this.args[e]),push.call(d.returnValues,this.returnValues[e]),push.call(d.exceptions,this.exceptions[e]),push.call(d.callIds,this.callIds[e]));return createCallProperties.call(d),d},matches:function(a,b){var c=this.matchingAguments;return c.length<=a.length&&sinon.deepEqual(c,a.slice(0,c.length))?!b||c.length==a.length:void 0},printf:function(a){var b,c=this,d=slice.call(arguments,1);return(a||"").replace(/%(.)/g,function(a,e){return b=spyApi.formatters[e],"function"==typeof b?b.call(null,c,d):isNaN(parseInt(e,10))?"%"+e:sinon.format(d[e-1])})}};delegateToCalls("calledOn",!0),delegateToCalls("alwaysCalledOn",!1,"calledOn"),delegateToCalls("calledWith",!0),delegateToCalls("calledWithMatch",!0),delegateToCalls("alwaysCalledWith",!1,"calledWith"),delegateToCalls("alwaysCalledWithMatch",!1,"calledWithMatch"),delegateToCalls("calledWithExactly",!0),delegateToCalls("alwaysCalledWithExactly",!1,"calledWithExactly"),delegateToCalls("neverCalledWith",!1,"notCalledWith",function(){return!0}),delegateToCalls("neverCalledWithMatch",!1,"notCalledWithMatch",function(){return!0}),delegateToCalls("threw",!0),delegateToCalls("alwaysThrew",!1,"threw"),delegateToCalls("returned",!0),delegateToCalls("alwaysReturned",!1,"returned"),delegateToCalls("calledWithNew",!0),delegateToCalls("alwaysCalledWithNew",!1,"calledWithNew"),delegateToCalls("callArg",!1,"callArgWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")}),spyApi.callArgWith=spyApi.callArg,delegateToCalls("callArgOn",!1,"callArgOnWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")}),spyApi.callArgOnWith=spyApi.callArgOn,delegateToCalls("yield",!1,"yield",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),spyApi.invokeCallback=spyApi.yield,delegateToCalls("yieldOn",!1,"yieldOn",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),delegateToCalls("yieldTo",!1,"yieldTo",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),delegateToCalls("yieldToOn",!1,"yieldToOn",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),spyApi.formatters={c:function(a){return sinon.timesInWords(a.callCount)},n:function(a){return a.toString()},C:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c){var e=" "+a.getCall(c).toString();/\n/.test(b[c-1])&&(e="\n"+e),push.call(b,e)}return b.length>0?"\n"+b.join("\n"):""},t:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c)push.call(b,sinon.format(a.thisValues[c]));return b.join(", ")},"*":function(a,b){for(var c=[],d=0,e=b.length;e>d;++d)push.call(c,sinon.format(b[d]));return c.join(", ")}},sinon.extend(spy,spyApi),spy.spyCall=sinon.spyCall,sinon.spy=spy,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=spy}):commonJSModule&&(module.exports=spy)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],59:[function(a,b){"use strict";!function(c){function d(a,b,e){if(e&&"function"!=typeof e)throw new TypeError("Custom stub should be function");var f;if(f=e?c.spy&&c.spy.create?c.spy.create(e):e:d.create(),!a&&"undefined"==typeof b)return c.stub.create();if("undefined"==typeof b&&"object"==typeof a){for(var g in a)"function"==typeof a[g]&&d(a,g);return a}return c.wrapMethod(a,b,f)}function e(a){return a.defaultBehavior||f(a)||c.behavior.create(a)}function f(a){return a.parent&&g(a.parent)}function g(a){var b=a.behaviors[a.callCount-1];return b&&b.isPresent()?b:e(a)}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i=0;c.extend(d,function(){var a={create:function(){var a=function(){return g(a).invoke(this,arguments)};a.id="stub#"+i++;var b=a;return a=c.spy.create(a),a.func=b,c.extend(a,d),a._create=c.stub.create,a.displayName="stub",a.toString=c.functionToString,a.defaultBehavior=null,a.behaviors=[],a},resetBehavior:function(){var a;if(this.defaultBehavior=null,this.behaviors=[],delete this.returnValue,delete this.returnArgAt,this.returnThis=!1,this.fakes)for(a=0;a<this.fakes.length;a++)this.fakes[a].resetBehavior()},onCall:function(a){return this.behaviors[a]||(this.behaviors[a]=c.behavior.create(this)),this.behaviors[a]},onFirstCall:function(){return this.onCall(0)},onSecondCall:function(){return this.onCall(1)},onThirdCall:function(){return this.onCall(2)}};for(var b in c.behavior)c.behavior.hasOwnProperty(b)&&!a.hasOwnProperty(b)&&"create"!=b&&"withArgs"!=b&&"invoke"!=b&&(a[b]=function(a){return function(){return this.defaultBehavior=this.defaultBehavior||c.behavior.create(this),this.defaultBehavior[a].apply(this.defaultBehavior,arguments),this}}(b));return a}()),c.stub=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):h&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],60:[function(a,b){"use strict";!function(c){function d(a){function b(){var b=c.getConfig(c.config);b.injectInto=b.injectIntoThis&&this||b.injectInto;var d,e,f=c.sandbox.create(b),g=Array.prototype.slice.call(arguments).concat(f.args);try{e=a.apply(this,g)}catch(h){d=h}if("undefined"!=typeof d)throw f.restore(),d;return f.verifyAndRestore(),e}var d=typeof a;if("function"!=d)throw new TypeError("sinon.test needs to wrap a test function, got "+d);return a.length?function(){return b.apply(this,arguments)}:b}var e="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&e&&(c=a("../sinon")),c&&(d.config={injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},c.test=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):e&&(b.exports=d))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],61:[function(a,b){"use strict";!function(c){function d(a,b,c){return function(){b&&b.apply(this,arguments);var d,e;try{e=a.apply(this,arguments)}catch(f){d=f}if(c&&c.apply(this,arguments),d)throw d;return e}}function e(a,b){if(!a||"object"!=typeof a)throw new TypeError("sinon.testCase needs an object with test functions");b=b||"test";var e,f,g,h=new RegExp("^"+b),i={},j=a.setUp,k=a.tearDown;for(e in a)if(a.hasOwnProperty(e)){if(f=a[e],/^(setUp|tearDown)$/.test(e))continue;"function"==typeof f&&h.test(e)?(g=f,(j||k)&&(g=d(f,j,k)),i[e]=c.test(g)):i[e]=a[e]}return i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&f&&(c=a("../sinon")),c&&Object.prototype.hasOwnProperty&&(c.testCase=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],62:[function(require,module,exports){(function(global){"use strict";if("undefined"==typeof sinon)var sinon={};!function(global){function addTimer(a,b){if(0===a.length)throw new Error("Function requires at least 1 parameter");if("undefined"==typeof a[0])throw new Error("Callback must be provided to timer calls");var c=id++,d=a[1]||0;return this.timeouts||(this.timeouts={}),this.timeouts[c]={id:c,func:a[0],callAt:this.now+d,invokeArgs:Array.prototype.slice.call(a,2)},b===!0&&(this.timeouts[c].interval=d),addTimerReturnsObject?{id:c,ref:function(){},unref:function(){}}:c}function parseTime(a){if(!a)return 0;var b,c=a.split(":"),d=c.length,e=d,f=0;if(d>3||!/^(\d\d:){0,2}\d\d?$/.test(a))throw new Error("tick only understands numbers and 'h:m:s'");for(;e--;){if(b=parseInt(c[e],10),b>=60)throw new Error("Invalid time "+a);f+=b*Math.pow(60,d-e-1)}return 1e3*f}function createObject(a){var b;if(Object.create)b=Object.create(a);else{var c=function(){};c.prototype=a,b=new c}return b.Date.clock=b,b}function mirrorDateProperties(a,b){b.now?a.now=function(){return a.clock.now}:delete a.now,b.toSource?a.toSource=function(){return b.toSource()}:delete a.toSource,a.toString=function(){return b.toString()},a.prototype=b.prototype,a.parse=b.parse,a.UTC=b.UTC,a.prototype.toUTCString=b.prototype.toUTCString;for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function restore(){for(var a,b=0,c=this.methods.length;c>b;b++)if(a=this.methods[b],global[a].hadOwnProperty)global[a]=this["_"+a];else try{delete global[a]}catch(d){}this.methods=[]}function stubGlobal(a,b){if(b[a].hadOwnProperty=Object.prototype.hasOwnProperty.call(global,a),b["_"+a]=global[a],"Date"==a){var c=mirrorDateProperties(b[a],global[a]);global[a]=c}else{global[a]=function(){return b[a].apply(b,arguments)};for(var d in b[a])b[a].hasOwnProperty(d)&&(global[a][d]=b[a][d])}global[a].clock=b}var timeoutResult=setTimeout(function(){},0),addTimerReturnsObject="object"==typeof timeoutResult;clearTimeout(timeoutResult);var id=1;sinon.clock={now:0,create:function(a){var b=createObject(this);if("number"==typeof a&&(b.now=a),a&&"object"==typeof a)throw new TypeError("now should be milliseconds since UNIX epoch");return b},setTimeout:function(){return addTimer.call(this,arguments,!1)},clearTimeout:function(a){a&&(this.timeouts||(this.timeouts=[]),"object"==typeof a&&(a=a.id),a in this.timeouts&&delete this.timeouts[a])},setInterval:function(){return addTimer.call(this,arguments,!0)},clearInterval:function(a){this.clearTimeout(a)},setImmediate:function(a){var b=Array.prototype.slice.call(arguments,1);return addTimer.call(this,[a,0].concat(b),!1)},clearImmediate:function(a){this.clearTimeout(a)},tick:function(a){a="number"==typeof a?a:parseTime(a);for(var b,c=this.now,d=this.now+a,e=this.now,f=this.firstTimerInRange(c,d);f&&d>=c;){if(this.timeouts[f.id]){c=this.now=f.callAt;try{this.callTimer(f)}catch(g){b=b||g}}f=this.firstTimerInRange(e,d),e=c}if(this.now=d,b)throw b;return this.now},firstTimerInRange:function(a,b){var c,d,e=null;for(var f in this.timeouts)if(this.timeouts.hasOwnProperty(f)){if(this.timeouts[f].callAt<a||this.timeouts[f].callAt>b)continue;(null===e||this.timeouts[f].callAt<e)&&(d=this.timeouts[f],e=this.timeouts[f].callAt,c={func:this.timeouts[f].func,callAt:this.timeouts[f].callAt,interval:this.timeouts[f].interval,id:this.timeouts[f].id,invokeArgs:this.timeouts[f].invokeArgs})}return c||null},callTimer:function(timer){"number"==typeof timer.interval?this.timeouts[timer.id].callAt+=timer.interval:delete this.timeouts[timer.id];try{"function"==typeof timer.func?timer.func.apply(null,timer.invokeArgs):eval(timer.func)
|
||
}catch(e){var exception=e}if(this.timeouts[timer.id]){if(exception)throw exception}else if(exception)throw exception},reset:function(){this.timeouts={}},Date:function(){function a(c,d,e,f,g,h,i){switch(arguments.length){case 0:return new b(a.clock.now);case 1:return new b(c);case 2:return new b(c,d);case 3:return new b(c,d,e);case 4:return new b(c,d,e,f);case 5:return new b(c,d,e,f,g);case 6:return new b(c,d,e,f,g,h);default:return new b(c,d,e,f,g,h,i)}}var b=Date;return mirrorDateProperties(a,b)}()};var methods=["Date","setTimeout","setInterval","clearTimeout","clearInterval"];"undefined"!=typeof global.setImmediate&&methods.push("setImmediate"),"undefined"!=typeof global.clearImmediate&&methods.push("clearImmediate"),sinon.useFakeTimers=function(a){var b=sinon.clock.create(a);b.restore=restore,b.methods=Array.prototype.slice.call(arguments,"number"==typeof a?1:0),0===b.methods.length&&(b.methods=methods);for(var c=0,d=b.methods.length;d>c;c++)stubGlobal(b.methods[c],b);return b}}("undefined"!=typeof global&&"function"!=typeof global?global:this),sinon.timers={setTimeout:setTimeout,clearTimeout:clearTimeout,setImmediate:"undefined"!=typeof setImmediate?setImmediate:void 0,clearImmediate:"undefined"!=typeof clearImmediate?clearImmediate:void 0,setInterval:setInterval,clearInterval:clearInterval,Date:Date},"undefined"!=typeof module&&module.exports&&(module.exports=sinon)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],63:[function(a,b){(function(c){("function"==typeof define&&define.amd&&function(a){define("formatio",["samsam"],a)}||"object"==typeof b&&function(c){b.exports=c(a("samsam"))}||function(a){this.formatio=a(this.samsam)})(function(a){"use strict";function b(a){if(!a)return"";if(a.displayName)return a.displayName;if(a.name)return a.name;var b=a.toString().match(/function\s+([^\(]+)/m);return b&&b[1]||""}function d(a,c){var d,e,f=b(c&&c.constructor),g=a.excludeConstructors||h.excludeConstructors||[];for(d=0,e=g.length;e>d;++d){if("string"==typeof g[d]&&g[d]===f)return"";if(g[d].test&&g[d].test(f))return""}return f}function e(a,b){if("object"!=typeof a)return!1;var c,d;for(c=0,d=b.length;d>c;++c)if(b[c]===a)return!0;return!1}function f(b,c,d,g){if("string"==typeof c){var h=b.quoteStrings,j="boolean"!=typeof h||h;return d||j?'"'+c+'"':c}if("function"==typeof c&&!(c instanceof RegExp))return f.func(c);if(d=d||[],e(c,d))return"[Circular]";if("[object Array]"===Object.prototype.toString.call(c))return f.array.call(b,c,d);if(!c)return String(1/c===-1/0?"-0":c);if(a.isElement(c))return f.element(c);if("function"==typeof c.toString&&c.toString!==Object.prototype.toString)return c.toString();var k,l;for(k=0,l=i.length;l>k;k++)if(c===i[k].object)return i[k].value;return f.object.call(b,c,d,g)}function g(a){for(var b in a)this[b]=a[b]}var h={excludeConstructors:["Object",/^.$/],quoteStrings:!0},i=(Object.prototype.hasOwnProperty,[]);return"undefined"!=typeof c&&i.push({object:c,value:"[object global]"}),"undefined"!=typeof document&&i.push({object:document,value:"[object HTMLDocument]"}),"undefined"!=typeof window&&i.push({object:window,value:"[object Window]"}),f.func=function(a){return"function "+b(a)+"() {}"},f.array=function(a,b){b=b||[],b.push(a);var c,d,e=[];for(c=0,d=a.length;d>c;++c)e.push(f(this,a[c],b));return"["+e.join(", ")+"]"},f.object=function(b,c,g){c=c||[],c.push(b),g=g||0;var h,i,j,k,l,m=[],n=a.keys(b).sort(),o=3;for(k=0,l=n.length;l>k;++k)h=n[k],j=b[h],i=e(j,c)?"[Circular]":f(this,j,c,g+2),i=(/\s/.test(h)?'"'+h+'"':h)+": "+i,o+=i.length,m.push(i);var p=d(this,b),q=p?"["+p+"] ":"",r="";for(k=0,l=g;l>k;++k)r+=" ";return o+g>80?q+"{\n "+r+m.join(",\n "+r)+"\n"+r+"}":q+"{ "+m.join(", ")+" }"},f.element=function(a){var b,c,d,e,f,g=a.tagName.toLowerCase(),h=a.attributes,i=[];for(d=0,e=h.length;e>d;++d)b=h.item(d),c=b.nodeName.toLowerCase().replace("html:",""),f=b.nodeValue,("contenteditable"!==c||"inherit"!==f)&&f&&i.push(c+'="'+f+'"');var j="<"+g+(i.length>0?" ":""),k=a.innerHTML;k.length>20&&(k=k.substr(0,20)+"[...]");var l=j+i.join(" ")+">"+k+"</"+g+">";return l.replace(/ contentEditable="inherit"/,"")},g.prototype={functionName:b,configure:function(a){return new g(a)},constructorName:function(a){return d(this,a)},ascii:function(a,b,c){return f(this,a,b,c)}},g.prototype})}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{samsam:64}],64:[function(a,b){("function"==typeof define&&define.amd&&function(a){define("samsam",a)}||"object"==typeof b&&function(a){b.exports=a()}||function(a){this.samsam=a()})(function(){function a(a){var b=a;return"number"==typeof a&&a!==b}function b(a){return l.toString.call(a).split(/[ \]]/)[1]}function c(a){if("Arguments"===b(a))return!0;if("object"!=typeof a||"number"!=typeof a.length||"Array"===b(a))return!1;if("function"==typeof a.callee)return!0;try{a[a.length]=6,delete a[a.length]}catch(c){return!0}return!1}function d(a){if(!a||1!==a.nodeType||!m)return!1;try{a.appendChild(m),a.removeChild(m)}catch(b){return!1}return!0}function e(a){var b,c=[];for(b in a)l.hasOwnProperty.call(a,b)&&c.push(b);return c}function f(a){return"function"==typeof a.getTime&&a.getTime()==a.valueOf()}function g(a){return 0===a&&1/a===-1/0}function h(b,c){return b===c||a(b)&&a(c)?0!==b||g(b)===g(c):void 0}function i(g,i){function j(a){return"object"!=typeof a||null===a||a instanceof Boolean||a instanceof Date||a instanceof Number||a instanceof RegExp||a instanceof String?!1:!0}function k(a,b){var c;for(c=0;c<a.length;c++)if(a[c]===b)return c;return-1}var m=[],n=[],o=[],p=[],q={};return function r(g,i,s,t){var u=typeof g,v=typeof i;if(g===i||a(g)||a(i)||null==g||null==i||"object"!==u||"object"!==v)return h(g,i);if(d(g)||d(i))return!1;var w=f(g),x=f(i);if(!(!w&&!x||w&&x&&g.getTime()===i.getTime()))return!1;if(g instanceof RegExp&&i instanceof RegExp&&g.toString()!==i.toString())return!1;var y=b(g),z=b(i),A=e(g),B=e(i);if(c(g)||c(i)){if(g.length!==i.length)return!1}else if(u!==v||y!==z||A.length!==B.length)return!1;var C,D,E,F,G,H,I,J,K,L,M;for(D=0,E=A.length;E>D;D++){if(C=A[D],!l.hasOwnProperty.call(i,C))return!1;if(F=g[C],G=i[C],H=j(F),I=j(G),J=H?k(m,F):-1,K=I?k(n,G):-1,L=-1!==J?o[J]:s+"["+JSON.stringify(C)+"]",M=-1!==K?p[K]:t+"["+JSON.stringify(C)+"]",q[L+M])return!0;if(-1===J&&H&&(m.push(F),o.push(L)),-1===K&&I&&(n.push(G),p.push(M)),H&&I&&(q[L+M]=!0),!r(F,G,L,M))return!1}return!0}(g,i,"$1","$2")}function j(a,b){if(0===b.length)return!0;var c,d,e,f;for(c=0,d=a.length;d>c;++c)if(k(a[c],b[0])){for(e=0,f=b.length;f>e;++e)if(!k(a[c+e],b[e]))return!1;return!0}return!1}var k,l=Object.prototype,m="undefined"!=typeof document&&document.createElement("div");return k=function n(a,c){if(c&&"function"==typeof c.test)return c.test(a);if("function"==typeof c)return c(a)===!0;if("string"==typeof c){c=c.toLowerCase();var d="string"==typeof a||!!a;return d&&String(a).toLowerCase().indexOf(c)>=0}if("number"==typeof c)return c===a;if("boolean"==typeof c)return c===a;if("Array"===b(a)&&"Array"===b(c))return j(a,c);if(c&&"object"==typeof c){var e;for(e in c){var f=a[e];if("undefined"==typeof f&&"function"==typeof a.getAttribute&&(f=a.getAttribute(e)),"undefined"==typeof f||!n(f,c[e]))return!1}return!0}throw new Error("Matcher was not a string, a number, a function, a boolean or an object")},{isArguments:c,isElement:d,isDate:f,isNegZero:g,identical:h,deepEqual:i,match:k,keys:e}})},{}],65:[function(a,b,c){(function(){var a=this,d=a._,e={},f=Array.prototype,g=Object.prototype,h=Function.prototype,i=f.push,j=f.slice,k=f.concat,l=g.toString,m=g.hasOwnProperty,n=f.forEach,o=f.map,p=f.reduce,q=f.reduceRight,r=f.filter,s=f.every,t=f.some,u=f.indexOf,v=f.lastIndexOf,w=Array.isArray,x=Object.keys,y=h.bind,z=function(a){return a instanceof z?a:this instanceof z?void(this._wrapped=a):new z(a)};"undefined"!=typeof c?("undefined"!=typeof b&&b.exports&&(c=b.exports=z),c._=z):a._=z,z.VERSION="1.6.0";var A=z.each=z.forEach=function(a,b,c){if(null==a)return a;if(n&&a.forEach===n)a.forEach(b,c);else if(a.length===+a.length){for(var d=0,f=a.length;f>d;d++)if(b.call(c,a[d],d,a)===e)return}else for(var g=z.keys(a),d=0,f=g.length;f>d;d++)if(b.call(c,a[g[d]],g[d],a)===e)return;return a};z.map=z.collect=function(a,b,c){var d=[];return null==a?d:o&&a.map===o?a.map(b,c):(A(a,function(a,e,f){d.push(b.call(c,a,e,f))}),d)};var B="Reduce of empty array with no initial value";z.reduce=z.foldl=z.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),p&&a.reduce===p)return d&&(b=z.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(A(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(B);return c},z.reduceRight=z.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),q&&a.reduceRight===q)return d&&(b=z.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=z.keys(a);f=g.length}if(A(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(B);return c},z.find=z.detect=function(a,b,c){var d;return C(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},z.filter=z.select=function(a,b,c){var d=[];return null==a?d:r&&a.filter===r?a.filter(b,c):(A(a,function(a,e,f){b.call(c,a,e,f)&&d.push(a)}),d)},z.reject=function(a,b,c){return z.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},z.every=z.all=function(a,b,c){b||(b=z.identity);var d=!0;return null==a?d:s&&a.every===s?a.every(b,c):(A(a,function(a,f,g){return(d=d&&b.call(c,a,f,g))?void 0:e}),!!d)};var C=z.some=z.any=function(a,b,c){b||(b=z.identity);var d=!1;return null==a?d:t&&a.some===t?a.some(b,c):(A(a,function(a,f,g){return d||(d=b.call(c,a,f,g))?e:void 0}),!!d)};z.contains=z.include=function(a,b){return null==a?!1:u&&a.indexOf===u?-1!=a.indexOf(b):C(a,function(a){return a===b})},z.invoke=function(a,b){var c=j.call(arguments,2),d=z.isFunction(b);return z.map(a,function(a){return(d?b:a[b]).apply(a,c)})},z.pluck=function(a,b){return z.map(a,z.property(b))},z.where=function(a,b){return z.filter(a,z.matches(b))},z.findWhere=function(a,b){return z.find(a,z.matches(b))},z.max=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);var d=-1/0,e=-1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;h>e&&(d=a,e=h)}),d},z.min=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);var d=1/0,e=1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;e>h&&(d=a,e=h)}),d},z.shuffle=function(a){var b,c=0,d=[];return A(a,function(a){b=z.random(c++),d[c-1]=d[b],d[b]=a}),d},z.sample=function(a,b,c){return null==b||c?(a.length!==+a.length&&(a=z.values(a)),a[z.random(a.length-1)]):z.shuffle(a).slice(0,Math.max(0,b))};var D=function(a){return null==a?z.identity:z.isFunction(a)?a:z.property(a)};z.sortBy=function(a,b,c){return b=D(b),z.pluck(z.map(a,function(a,d,e){return{value:a,index:d,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index-b.index}),"value")};var E=function(a){return function(b,c,d){var e={};return c=D(c),A(b,function(f,g){var h=c.call(d,f,g,b);a(e,h,f)}),e}};z.groupBy=E(function(a,b,c){z.has(a,b)?a[b].push(c):a[b]=[c]}),z.indexBy=E(function(a,b,c){a[b]=c}),z.countBy=E(function(a,b){z.has(a,b)?a[b]++:a[b]=1}),z.sortedIndex=function(a,b,c,d){c=D(c);for(var e=c.call(d,b),f=0,g=a.length;g>f;){var h=f+g>>>1;c.call(d,a[h])<e?f=h+1:g=h}return f},z.toArray=function(a){return a?z.isArray(a)?j.call(a):a.length===+a.length?z.map(a,z.identity):z.values(a):[]},z.size=function(a){return null==a?0:a.length===+a.length?a.length:z.keys(a).length},z.first=z.head=z.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:0>b?[]:j.call(a,0,b)},z.initial=function(a,b,c){return j.call(a,0,a.length-(null==b||c?1:b))},z.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:j.call(a,Math.max(a.length-b,0))},z.rest=z.tail=z.drop=function(a,b,c){return j.call(a,null==b||c?1:b)},z.compact=function(a){return z.filter(a,z.identity)};var F=function(a,b,c){return b&&z.every(a,z.isArray)?k.apply(c,a):(A(a,function(a){z.isArray(a)||z.isArguments(a)?b?i.apply(c,a):F(a,b,c):c.push(a)}),c)};z.flatten=function(a,b){return F(a,b,[])},z.without=function(a){return z.difference(a,j.call(arguments,1))},z.partition=function(a,b){var c=[],d=[];return A(a,function(a){(b(a)?c:d).push(a)}),[c,d]},z.uniq=z.unique=function(a,b,c,d){z.isFunction(b)&&(d=c,c=b,b=!1);var e=c?z.map(a,c,d):a,f=[],g=[];return A(e,function(c,d){(b?d&&g[g.length-1]===c:z.contains(g,c))||(g.push(c),f.push(a[d]))}),f},z.union=function(){return z.uniq(z.flatten(arguments,!0))},z.intersection=function(a){var b=j.call(arguments,1);return z.filter(z.uniq(a),function(a){return z.every(b,function(b){return z.contains(b,a)})})},z.difference=function(a){var b=k.apply(f,j.call(arguments,1));return z.filter(a,function(a){return!z.contains(b,a)})},z.zip=function(){for(var a=z.max(z.pluck(arguments,"length").concat(0)),b=new Array(a),c=0;a>c;c++)b[c]=z.pluck(arguments,""+c);return b},z.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},z.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=z.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(u&&a.indexOf===u)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},z.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(v&&a.lastIndexOf===v)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},z.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);d>e;)f[e++]=a,a+=c;return f};var G=function(){};z.bind=function(a,b){var c,d;if(y&&a.bind===y)return y.apply(a,j.call(arguments,1));if(!z.isFunction(a))throw new TypeError;return c=j.call(arguments,2),d=function(){if(!(this instanceof d))return a.apply(b,c.concat(j.call(arguments)));G.prototype=a.prototype;var e=new G;G.prototype=null;var f=a.apply(e,c.concat(j.call(arguments)));return Object(f)===f?f:e}},z.partial=function(a){var b=j.call(arguments,1);return function(){for(var c=0,d=b.slice(),e=0,f=d.length;f>e;e++)d[e]===z&&(d[e]=arguments[c++]);for(;c<arguments.length;)d.push(arguments[c++]);return a.apply(this,d)}},z.bindAll=function(a){var b=j.call(arguments,1);if(0===b.length)throw new Error("bindAll must be passed function names");return A(b,function(b){a[b]=z.bind(a[b],a)}),a},z.memoize=function(a,b){var c={};return b||(b=z.identity),function(){var d=b.apply(this,arguments);return z.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},z.delay=function(a,b){var c=j.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},z.defer=function(a){return z.delay.apply(z,[a,1].concat(j.call(arguments,1)))},z.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:z.now(),g=null,f=a.apply(d,e),d=e=null};return function(){var j=z.now();h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k?(clearTimeout(g),g=null,h=j,f=a.apply(d,e),d=e=null):g||c.trailing===!1||(g=setTimeout(i,k)),f}},z.debounce=function(a,b,c){var d,e,f,g,h,i=function(){var j=z.now()-g;b>j?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),f=e=null))};return function(){f=this,e=arguments,g=z.now();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}},z.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},z.wrap=function(a,b){return z.partial(b,a)},z.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},z.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},z.keys=function(a){if(!z.isObject(a))return[];if(x)return x(a);var b=[];for(var c in a)z.has(a,c)&&b.push(c);return b},z.values=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},z.pairs=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},z.invert=function(a){for(var b={},c=z.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},z.functions=z.methods=function(a){var b=[];for(var c in a)z.isFunction(a[c])&&b.push(c);return b.sort()},z.extend=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},z.pick=function(a){var b={},c=k.apply(f,j.call(arguments,1));return A(c,function(c){c in a&&(b[c]=a[c])}),b},z.omit=function(a){var b={},c=k.apply(f,j.call(arguments,1));for(var d in a)z.contains(c,d)||(b[d]=a[d]);return b},z.defaults=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)void 0===a[c]&&(a[c]=b[c])}),a},z.clone=function(a){return z.isObject(a)?z.isArray(a)?a.slice():z.extend({},a):a},z.tap=function(a,b){return b(a),a};var H=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof z&&(a=a._wrapped),b instanceof z&&(b=b._wrapped);var e=l.call(a);if(e!=l.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;var g=a.constructor,h=b.constructor;if(g!==h&&!(z.isFunction(g)&&g instanceof g&&z.isFunction(h)&&h instanceof h)&&"constructor"in a&&"constructor"in b)return!1;c.push(a),d.push(b);var i=0,j=!0;if("[object Array]"==e){if(i=a.length,j=i==b.length)for(;i--&&(j=H(a[i],b[i],c,d)););}else{for(var k in a)if(z.has(a,k)&&(i++,!(j=z.has(b,k)&&H(a[k],b[k],c,d))))break;if(j){for(k in b)if(z.has(b,k)&&!i--)break;j=!i}}return c.pop(),d.pop(),j};z.isEqual=function(a,b){return H(a,b,[],[])},z.isEmpty=function(a){if(null==a)return!0;if(z.isArray(a)||z.isString(a))return 0===a.length;for(var b in a)if(z.has(a,b))return!1;return!0},z.isElement=function(a){return!(!a||1!==a.nodeType)},z.isArray=w||function(a){return"[object Array]"==l.call(a)},z.isObject=function(a){return a===Object(a)},A(["Arguments","Function","String","Number","Date","RegExp"],function(a){z["is"+a]=function(b){return l.call(b)=="[object "+a+"]"}}),z.isArguments(arguments)||(z.isArguments=function(a){return!(!a||!z.has(a,"callee"))}),"function"!=typeof/./&&(z.isFunction=function(a){return"function"==typeof a}),z.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},z.isNaN=function(a){return z.isNumber(a)&&a!=+a},z.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==l.call(a)},z.isNull=function(a){return null===a},z.isUndefined=function(a){return void 0===a},z.has=function(a,b){return m.call(a,b)},z.noConflict=function(){return a._=d,this},z.identity=function(a){return a},z.constant=function(a){return function(){return a}},z.property=function(a){return function(b){return b[a]}},z.matches=function(a){return function(b){if(b===a)return!0;for(var c in a)if(a[c]!==b[c])return!1;return!0}},z.times=function(a,b,c){for(var d=Array(Math.max(0,a)),e=0;a>e;e++)d[e]=b.call(c,e);return d},z.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))},z.now=Date.now||function(){return(new Date).getTime()};var I={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};I.unescape=z.invert(I.escape);var J={escape:new RegExp("["+z.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+z.keys(I.unescape).join("|")+")","g")};z.each(["escape","unescape"],function(a){z[a]=function(b){return null==b?"":(""+b).replace(J[a],function(b){return I[a][b]})}}),z.result=function(a,b){if(null==a)return void 0;var c=a[b];return z.isFunction(c)?c.call(a):c},z.mixin=function(a){A(z.functions(a),function(b){var c=z[b]=a[b];z.prototype[b]=function(){var a=[this._wrapped];return i.apply(a,arguments),O.call(this,c.apply(z,a))}})};var K=0;z.uniqueId=function(a){var b=++K+"";return a?a+b:b},z.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var L=/(.)^/,M={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},N=/\\|'|\r|\n|\t|\u2028|\u2029/g;z.template=function(a,b,c){var d;c=z.defaults({},c,z.templateSettings);var e=new RegExp([(c.escape||L).source,(c.interpolate||L).source,(c.evaluate||L).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(N,function(a){return"\\"+M[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=new Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,z);var i=function(a){return d.call(this,a,z)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},z.chain=function(a){return z(a).chain()};var O=function(a){return this._chain?z(a).chain():a};z.mixin(z),A(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=f[a];z.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],O.call(this,c)}}),A(["concat","join","slice"],function(a){var b=f[a];z.prototype[a]=function(){return O.call(this,b.apply(this._wrapped,arguments))}}),z.extend(z.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return z})}).call(this)},{}],66:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:10,sinon:50,"sinon-chai":49,underscore:65}],67:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/TextYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/TextYatta.coffee":4,chai:10,sinon:50,"sinon-chai":49,underscore:65}],68:[function(a){var b,c,d,e,f,g,h,i,j,k=function(a,b){return function(){return a.apply(b,arguments)}};e=a("chai"),f=e.expect,g=e.should(),h=a("sinon"),i=a("sinon-chai"),j=a("underscore"),e.use(i),d=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee"),c=function(){function a(){this.applyRandomOp=k(this.applyRandomOp,this),this.generateRandomOp=k(this.generateRandomOp,this),this.generateDeleteOp=k(this.generateDeleteOp,this),this.generateReplaceOp=k(this.generateReplaceOp,this),this.generateInsertOp=k(this.generateInsertOp,this),this.number_of_test_cases_multiplier=1,this.repeat_this=10*this.number_of_test_cases_multiplier,this.doSomething_amount=200*this.number_of_test_cases_multiplier,this.number_of_engines=12+this.number_of_test_cases_multiplier-1,this.time=0,this.ops=0,this.time_now=0,this.reinitialize()}return a.prototype.reinitialize=function(){var a,c,e,f;for(this.users=[],this.Connector=b(this.users),this.users.push(new d(0,this.Connector)),this.users[0].val("name","initial"),f=[],a=c=1,e=this.number_of_engines;e>=1?e>c:c>e;a=e>=1?++c:--c)f.push(this.users.push(new d(a,this.Connector)));return f},a.prototype.getSomeUser=function(){var a;return a=j.random(0,this.users.length-1),this.users[a]},a.prototype.getRandomText=function(){var a,b,c,d;return a="abcdefghijklmnopqrstuvwxyz",b=j.random(0,10),c=a[j.random(0,a.length-1)],d="",j(b).times(function(){return d+=c}),d},a.prototype.generateInsertOp=function(a){var b;return b=j.random(0,this.users[a].val("name").val().length-1),this.users[a].val("name").insertText(b,this.getRandomText()),null},a.prototype.generateReplaceOp=function(a){return this.users[a].val("name").replaceText(this.getRandomText()),null},a.prototype.generateDeleteOp=function(a){var b,c,d;return void(this.users[a].val("name").val().length>0&&(d=j.random(0,this.users[a].val("name").val().length-1),b=1,c=this.users[a].val("name").deleteText(d,b)))},a.prototype.generateRandomOp=function(a){var b,c,d;return d=[this.generateDeleteOp,this.generateInsertOp,this.generateReplaceOp],b=j.random(d.length-1),c=d[b](a)},a.prototype.applyRandomOp=function(a){var b;return b=this.users[a],b.getConnector().flushOneRandom()},a.prototype.doSomething=function(){var a,b,c;return c=j.random(this.number_of_engines-1),b=[this.applyRandomOp,this.generateRandomOp],a=j.random(b.length-1),b[a](c)},a.prototype.flushAll=function(){var a,b,c,d,e,f;for(e=this.users,f=[],b=c=0,d=e.length;d>c;b=++c)a=e[b],f.push(a.getConnector().flushAll());return f},a.prototype.compareAll=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;for(this.flushAll(),this.time+=(new Date).getTime()-this.time_now,d=0,b=i=0,m=this.users.length;m>=0?m>i:i>m;b=m>=0?++i:--i)d+=this.users[b].getConnector().getOpsInExecutionOrder().length;for(this.ops+=d*this.users.length,f=Math.floor(this.ops/this.time),null!=a&&console.log(""+a+"/"+this.repeat_this+": Every collaborator ("+this.users.length+") applied "+this.number_of_created_operations+" ops in a different order."+(" Over all we consumed "+this.ops+" operations in "+this.time/1e3+" seconds ("+f+" ops/msek).")),o=[],b=j=0,n=this.users.length-1;n>=0?n>j:j>n;b=n>=0?++j:--j)if(this.users[b].val("name").val()!==this.users[b+1].val("name").val()){for(g=function(a,b){var c,d,e,f,g,h,i,j;for(e=this.users[a].getConnector().getOpsInExecutionOrder(),g=0,i=e.length;i>g;g++)f=e[g],console.log(JSON.stringify(f));for(console.log(""),f="ops = [",c=h=0,j=e.length;j>h;c=++h)d=e[c],0!==c&&(f+=", "),f+="op"+c;return f+="]",console.log(f),console.log("@users[@last_user].ot.applyOps ops"),console.log("expect(@users[@last_user].ot.val('name')).to.equal(\""+users[b].val("name")+'")'),e},console.log(""),console.log("Found an OT Puzzle!"),console.log("OT states:"),c=k=0,l=users.length;l>k;c=++k)h=users[c],console.log("OT"+c+": "+h.val("name"));console.log("\nOT execution order ("+b+","+(b+1)+"):"),g(b,b+1),console.log(""),e=g(b+1,b),o.push(console.log(""))}else o.push(void 0);return o},a.prototype.run=function(){var a,b,c,d,e,f,g;for(console.log(""),g=[],b=c=1,e=this.repeat_this;e>=1?e>=c:c>=e;b=e>=1?++c:--c){for(this.time_now=(new Date).getTime(),a=d=1,f=this.doSomething_amount;f>=1?f>=d:d>=f;a=f>=1?++d:--d)this.doSomething();this.compareAll(b),g.push(this.reinitialize())}return g},a}(),describe("JsonYatta",function(){return beforeEach(function(a){return this.yTest=new c,a()}),it("has a JsonWrapper",function(){var a,b;return b=this.yTest.getSomeUser().root_element,b.val("x","dtrn","immutable"),b.val("set",{x:"x"},"immutable"),a=b.value,a.x,a.set={y:""},a.x,a.set,a.set.x,f(a.x).to.equal("dtrn"),f(a.set.x).to.equal("x")}),it("can handle creaton of complex json",function(){return this.yTest.getSomeUser().val("x",{a:"b"}),this.yTest.getSomeUser().val("a",{a:{q:"dtrndtrtdrntdrnrtdnrtdnrtdnrtdnrdnrdt"}}),this.yTest.getSomeUser().val("b",{a:{}}),this.yTest.getSomeUser().val("c",{a:"b"}),this.yTest.compareAll()}),it("handles some immutable tests",function(){return this.yTest.getSomeUser().val("string","text","immutable"),this.yTest.getSomeUser().val("number",4,"immutable"),this.yTest.getSomeUser().val("object",{q:"rr"},"immutable"),this.yTest.compareAll(),f(this.yTest.getSomeUser().val("string")).to.equal("text"),f(this.yTest.getSomeUser().val("number")).to.equal(4),f(this.yTest.getSomeUser().val("object").val("q")).to.equal("rr")}),it("can handle many engines, many operations, concurrently (random)",function(){return this.yTest.run()})})},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:10,sinon:50,"sinon-chai":49,underscore:65}]},{},[66,67,68]),!function k(a,b,c){function d(f,g){if(!b[f]){if(!a[f]){var h="function"==typeof require&&require;if(!g&&h)return h(f,!0);if(e)return e(f,!0);throw new Error("Cannot find module '"+f+"'")}var i=b[f]={exports:{}};a[f][0].call(i.exports,function(b){var c=a[f][1][b];return d(c?c:b)},i,i.exports,k,a,b,c)}return b[f].exports}for(var e="function"==typeof require&&require,f=0;f<c.length;f++)d(c[f]);return d}({1:[function(a,b){var c;c=a("underscore"),b.exports=function(a){var b;return b=function(){function b(b,c,d){var e,f;this.engine=b,this.HB=c,this.execution_listener=d,f=function(a){return function(b){return a.send(b)}}(this),this.execution_listener.push(f),this.applied_operations=[],e=function(a){return function(b){return a.applied_operations.push(b)}}(this),this.execution_listener.push(e),0!==(null!=a?a.length:void 0)&&this.engine.applyOps(a[0].getHistoryBuffer()._encode()),this.unexecuted={}}return b.prototype.getOpsInExecutionOrder=function(){return this.applied_operations},b.prototype.getRootElement=function(){return a.length>0?a[0].getRootElement().getUid():void 0},b.prototype.send=function(b){var c,d,e,f;if(b.uid.creator===this.HB.getUserId()&&"string"!=typeof b.uid.op_number){for(f=[],d=0,e=a.length;e>d;d++)c=a[d],f.push(c.getUserId()!==this.HB.getUserId()?c.getConnector().receive(b):void 0);return f}},b.prototype.receive=function(a){var b,c;return null==(b=this.unexecuted)[c=a.creator]&&(b[c]=[]),this.unexecuted[a.creator].push(a)},b.prototype.flushOne=function(a){var b;return(null!=(b=this.unexecuted[a])?b.length:void 0)>0?this.engine.applyOp(this.unexecuted[a].shift()):void 0},b.prototype.flushOneRandom=function(){return this.flushOne(c.random(0,a.length-1))},b.prototype.flushAll=function(){var a,b,c;c=this.unexecuted;for(a in c)b=c[a],this.engine.applyOps(b);return this.unexecuted={}},b.prototype.sync=function(){throw new Error("Can't use this a.t.m.")},b}()}},{underscore:65}],2:[function(a,b){var c;c=function(){function a(a,b){this.HB=a,this.parser=b,this.unprocessed_ops=[]}return a.prototype.parseOperation=function(a){var b;if(b=this.parser[a.type],null!=b)return b(a);throw new Error("You forgot to specify a parser for type "+a.type+". The message is "+JSON.stringify(a)+".")},a.prototype.applyOps=function(a){var b,c,d,e,f,g,h,i;for(c=[],d=0,g=a.length;g>d;d++)b=a[d],c.push(this.parseOperation(b));for(e=0,h=c.length;h>e;e++)b=c[e],this.HB.addOperation(b);for(f=0,i=c.length;i>f;f++)b=c[f],b.execute()||this.unprocessed_ops.push(b);return this.tryUnprocessed()},a.prototype.applyOp=function(a){var b;return b=this.parseOperation(a),this.HB.addOperation(b),b.execute()||this.unprocessed_ops.push(b),this.tryUnprocessed()},a.prototype.tryUnprocessed=function(){var a,b,c,d,e,f,g;for(g=[];;){for(a=this.unprocessed_ops.length,c=[],f=this.unprocessed_ops,d=0,e=f.length;e>d;d++)b=f[d],b.execute()||c.push(b);if(this.unprocessed_ops=c,this.unprocessed_ops.length===a)break;g.push(void 0)}return g},a}(),b.exports=c},{}],3:[function(a,b){var c,d,e,f;f=a("../Types/JsonTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),g=f(this.HB),this.engine=new c(this.HB,g.parser),this.connector=new b(this.engine,this.HB,g.execution_listener,this),h=this.connector.getRootElement(),null==h?(e=new g.types.JsonType(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=e):this.root_element=this.HB.getOperation(h)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.setMutableDefault=function(a){return this.root_element.setMutableDefault(a)},a.prototype.getUserId=function(){return this.HB.getUserId()},a.prototype.val=function(a,b,c){return this.root_element.val(a,b,c)
|
||
},Object.defineProperty(a.prototype,"value",{get:function(){return this.root_element.value},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),a}(),"undefined"!=typeof window&&null!==window&&(window.JsonYatta=e),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/JsonTypes.coffee":7}],4:[function(a,b){var c,d,e,f;f=a("../Types/TextTypes.coffee"),d=a("../HistoryBuffer.coffee"),c=a("../Engine.coffee"),e=function(){function a(a,b){var e,g,h;this.HB=new d(a),h=f(this.HB),this.engine=new c(this.HB,h.parser),this.connector=new b(this.engine,this.HB,h.execution_listener),g=this.connector.getRootElement(),null==g?(e=new h.types.Word(this.HB.getNextOperationIdentifier()),this.HB.addOperation(e),e.execute(),this.root_element=this.HB.addOperation(new h.types.ReplaceManager(e,this.HB.getNextOperationIdentifier())).execute()):this.root_element=this.HB.getOperation(g)}return a.prototype.getRootElement=function(){return this.root_element},a.prototype.getEngine=function(){return this.engine},a.prototype.getConnector=function(){return this.connector},a.prototype.getHistoryBuffer=function(){return this.HB},a.prototype.getUserId=function(){return this.HB.getUserId()},a.prototype.val=function(){return this.root_element.val().val()},a.prototype.insertText=function(a,b){return this.root_element.val().insertText(a,b)},a.prototype.deleteText=function(a,b){return this.root_element.val().deleteText(a,b)},a.prototype.replaceText=function(a){return this.root_element.val().replaceText(a)},a}(),b.exports=e},{"../Engine.coffee":2,"../HistoryBuffer.coffee":5,"../Types/TextTypes.coffee":9}],5:[function(a,b){var c;c=function(){function a(a){this.user_id=a,this.operation_counter={},this.buffer={},this.change_listeners=[]}return a.prototype.getUserId=function(){return this.user_id},a.prototype.getOperationCounter=function(){var a,b,c,d;b={},d=this.operation_counter;for(c in d)a=d[c],b[c]=a;return b},a.prototype._encode=function(){var a,b,c,d,e,f;a=[],f=this.buffer;for(d in f){e=f[d];for(c in e)b=e[c],isNaN(parseInt(c))||a.push(b._encode())}return a},a.prototype.getNextOperationIdentifier=function(a){var b;return null==a&&(a=this.user_id),null==this.operation_counter[a]&&(this.operation_counter[a]=0),b={creator:a,op_number:this.operation_counter[a]},this.operation_counter[a]++,b},a.prototype.getOperation=function(a){var b;if(a instanceof Object)return null!=(b=this.buffer[a.creator])?b[a.op_number]:void 0;if(null!=a)throw new Error("This type of uid is not defined!")},a.prototype.addOperation=function(a){if(null==this.buffer[a.creator]&&(this.buffer[a.creator]={}),null==this.operation_counter[a.creator]&&(this.operation_counter[a.creator]=0),null!=this.buffer[a.creator][a.op_number])throw new Error("You must not overwrite operations!");return this.buffer[a.creator][a.op_number]=a,"number"==typeof a.op_number&&a.creator!==this.getUserId()&&this.operation_counter[a.creator]++,a},a}(),b.exports=c},{}],6:[function(a,b){var c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};b.exports=function(a){var b,c,e,f,g,h,i;return i={},h=[],g=function(){function b(b){null==b&&(b=a.getNextOperationIdentifier()),this.creator=b.creator,this.op_number=b.op_number}return b.prototype.getUid=function(){return{creator:this.creator,op_number:this.op_number}},b.prototype.execute=function(){var a,b,c;for(this.is_executed=!0,b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this},b.prototype.saveOperation=function(a,b){return null!=(null!=b?b.execute:void 0)?this[a]=b:null!=b?(null==this.unchecked&&(this.unchecked={}),this.unchecked[a]=b):void 0},b.prototype.validateSavedOperations=function(){var b,c,d,e,f,g;f={},e=this,g=this.unchecked;for(b in g)d=g[b],c=a.getOperation(d),c?this[b]=c:(f[b]=d,e=!1);return delete this.unchecked,e||(this.unchecked=f),e},b}(),b=function(a){function b(a,c){this.saveOperation("deletes",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype._encode=function(){return{type:"Delete",uid:this.getUid(),deletes:this.deletes.getUid()}},b.prototype.execute=function(){return this.validateSavedOperations()?(this.deletes.applyDelete(this),b.__super__.execute.apply(this,arguments),this):!1},b}(g),i.Delete=function(a){var c,d;return d=a.uid,c=a.deletes,new b(d,c)},f=function(a){function b(a,c,d,e){this.saveOperation("prev_cl",c),this.saveOperation("next_cl",d),null!=e?this.saveOperation("origin",e):this.saveOperation("origin",c),b.__super__.constructor.call(this,a)}return d(b,a),b.prototype.applyDelete=function(a){return null==this.deleted_by&&(this.deleted_by=[]),this.deleted_by.push(a)},b.prototype.isDeleted=function(){var a;return(null!=(a=this.deleted_by)?a.length:void 0)>0},b.prototype.getDistanceToOrigin=function(){var a,b;for(a=0,b=this.prev_cl;this.origin!==b;){if(a++,this===this.prev_cl)throw new Error("this should not happen ;) ");b=b.prev_cl}return a},b.prototype.update_sl=function(){var a;return a=this.prev_cl,update("prev_cl","prev_sl"),update("next_cl","prev_sl")},b.prototype.execute=function(){var a,c,d,e,f;if(null!=this.is_executed)return this;if(this.validateSavedOperations()){if((null!=(e=this.prev_cl)?e.validateSavedOperations():void 0)&&(null!=(f=this.next_cl)?f.validateSavedOperations():void 0)&&this.prev_cl.next_cl!==this){for(a=0,d=this.prev_cl.next_cl,c=0;null==d&&(console.log(JSON.stringify(this.prev_cl.getUid())),console.log(JSON.stringify(this.next_cl.getUid()))),d!==this.next_cl;){if(d.getDistanceToOrigin()===c)d.creator<this.creator&&(this.prev_cl=d,a=c+1);else{if(!(d.getDistanceToOrigin()<c))break;c-a<=d.getDistanceToOrigin()&&(this.prev_cl=d,a=c+1)}c++,d=d.next_cl}this.next_cl=this.prev_cl.next_cl,this.prev_cl.next_cl=this,this.next_cl.prev_cl=this}return b.__super__.execute.apply(this,arguments),this}return!1},b}(g),e=function(a){function b(a,c,d,e,f){this.content=null!=c?c:"",b.__super__.constructor.call(this,a,d,e,f)}return d(b,a),b.prototype.val=function(){return this.content},b.prototype._encode=function(){var a;return a={type:"ImmutableObject",uid:this.getUid(),content:this.content},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(f),i.ImmutableObject=function(a){var b,c,d,f,g;return g=a.uid,b=a.content,f=a.prev,c=a.next,d=a.origin,new e(g,b,f,c,d)},c=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return d(b,a),b.prototype.execute=function(){var a,b,c;if(this.validateSavedOperations()){for(b=0,c=h.length;c>b;b++)(a=h[b])(this._encode());return this}return!1},b.prototype._encode=function(){var a,b;return{type:"Delimiter",uid:this.getUid(),prev:null!=(a=this.prev_cl)?a.getUid():void 0,next:null!=(b=this.next_cl)?b.getUid():void 0}},b}(f),i.Delimiter=function(a){var b,d,e;return e=a.uid,d=a.prev,b=a.next,new c(e,d,b)},{types:{Delete:b,Insert:f,Delimiter:c,Operation:g,ImmutableObject:e},parser:i,execution_listener:h}}},{}],7:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./TextTypes.coffee"),b.exports=function(a){var b,d,f,g,h;return g=c(a),h=g.types,f=g.parser,d=function(a){var c;return new(c=function(){function a(c){var e,f,g,i;i=c.map,g=function(e,f){return Object.defineProperty(a.prototype,e,{get:function(){var a;return a=f.val(),a instanceof b?d(a):a instanceof h.ImmutableObject?a.val():a},set:function(a){var b,d,f,g;if(a.constructor==={}.constructor){f=c.val(e),g=[];for(b in a)d=a[b],g.push(f.val(b,d,"immutable"));return g}return c.val(e,a,"immutable")},enumerable:!0,configurable:!1})};for(e in i)f=i[e],g(e,f)}return a}())(a)},b=function(b){function c(a,b,d){var e,f;if(c.__super__.constructor.call(this,a),null!=b){if("object"!=typeof b)throw new Error("The initial value of JsonTypes must be of type Object! (current type: "+typeof b+")");for(e in b)f=b[e],this.val(e,f,d)}}return e(c,b),c.prototype.mutable_default=!0,c.prototype.setMutableDefault=function(a){if(a===!0||"mutable"===a)c.prototype.mutable_default=!0;else{if(a!==!1&&"immutable"!==a)throw new Error('Set mutable either "mutable" or "immutable"!');c.prototype.mutable_default=!1}return"OK"},c.prototype.val=function(b,d,e){var f,g,i,j,k;if("object"==typeof b){for(i in b)g=b[i],this.val(i,g,d);return this}if(null!=b&&null!=d){if(e=null!=e?e===!0||"mutable"===e?!0:!1:this.mutable_default,"function"==typeof d)return this;if(e&&"number"!=typeof d||d.constructor===Object){if("string"==typeof d)return k=a.addOperation(new h.Word(a.getNextOperationIdentifier(),d)).execute(),c.__super__.val.call(this,b,k);if(d.constructor===Object)return f=a.addOperation(new c(a.getNextOperationIdentifier(),d,e)).execute(),c.__super__.val.call(this,b,f);throw new Error("You must not set "+typeof d+"-types in collaborative Json-objects!")}return j=a.addOperation(new h.ImmutableObject(void 0,d)).execute(),c.__super__.val.call(this,b,j)}return c.__super__.val.call(this,b,d)},Object.defineProperty(c.prototype,"value",{get:function(){return d(this)},set:function(a){var b,c,d;if(a.constructor==={}.constructor){d=[];for(b in a)c=a[b],d.push(this.val(b,c,"immutable"));return d}throw new Error("You must only set Object values!")}}),c.prototype._encode=function(){return{type:"JsonType",uid:this.getUid()}},c}(h.MapManager),f.JsonType=function(a){var c;return c=a.uid,new b(c)},h.JsonType=b,g}},{"./TextTypes.coffee":9}],8:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./BasicTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i,j,k;return i=c(a),k=i.types,j=i.parser,f=function(c){function d(a){this.map={},d.__super__.constructor.call(this,a)}return e(d,c),d.prototype.val=function(c,e){var f,g,h,i,j;if(null!=e)return null==this.map[c]&&a.addOperation(new b(a.getNextOperationIdentifier(),this,c)).execute(),this.map[c].replace(e),this;if(null!=c)return g=null!=(i=this.map[c])?i.val():void 0,g instanceof k.ImmutableObject?g.val():g;h={},j=this.map;for(c in j)f=j[c],g=f.val(),(g instanceof k.ImmutableObject||g instanceof d)&&(g=g.val()),h[c]=g;return h},d}(k.Operation),b=function(b){function c(a,b,d){this.name=d,this.saveOperation("map_manager",b),c.__super__.constructor.call(this,a)}return e(c,b),c.prototype.execute=function(){var b,d,e,f,h;return this.validateSavedOperations()?(h=this.map_manager.getUid(),h.op_number="_"+h.op_number+"_RM_"+this.name,null==a.getOperation(h)&&(e=this.map_manager.getUid(),e.op_number="_"+e.op_number+"_RM_"+this.name+"_beginning",f=this.map_manager.getUid(),f.op_number="_"+f.op_number+"_RM_"+this.name+"_end",b=a.addOperation(new k.Delimiter(e,void 0,f)),d=a.addOperation(new k.Delimiter(f,b,void 0)).execute(),b.execute(),this.map_manager.map[this.name]=a.addOperation(new g(void 0,h,b,d)).execute()),c.__super__.execute.apply(this,arguments)):!1},c.prototype._encode=function(){return{type:"AddName",uid:this.getUid(),map_manager:this.map_manager.getUid(),name:this.name}},c}(k.Operation),j.AddName=function(a){var c,d,e;return c=a.map_manager,e=a.uid,d=a.name,new b(e,c,d)},d=function(b){function c(b,d,e,f,g,h){null!=d&&null!=e?(this.saveOperation("beginning",d),this.saveOperation("end",e)):(this.beginning=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),void 0,void 0)),this.end=a.addOperation(new k.Delimiter(a.getNextOperationIdentifier(),this.beginning,void 0)),this.beginning.next_cl=this.end,this.beginning.execute(),this.end.execute()),c.__super__.constructor.call(this,b,f,g,h)}return e(c,b),c.prototype.getLastOperation=function(){return this.end.prev_cl},c.prototype.getFirstOperation=function(){return this.beginning.next_cl},c.prototype.toArray=function(){var a,b;for(a=this.beginning.next_cl,b=[];a!==this.end;)b.push(a),a=a.next_cl;return b},c.prototype.getOperationByPosition=function(a){var b;if(b=this.beginning.next_cl,a>0)for(;b=b.next_cl,b.isDeleted()||(a-=1),0!==a;)if(b instanceof k.Delimiter)throw new Error("position parameter exceeded the length of the document!");return b},c}(k.Insert),g=function(b){function c(a,b,d,e,f,g,h){c.__super__.constructor.call(this,b,d,e,f,g,h),null!=a&&this.replace(a)}return e(c,b),c.prototype.replace=function(b){var c,d;return c=this.getLastOperation(),d=new h(b,this,a.getNextOperationIdentifier(),c,c.next_cl),a.addOperation(d).execute()},c.prototype.val=function(){var a;if(a=this.getLastOperation(),a instanceof k.Delimiter)throw new Error("dtrn");return a.val()},c.prototype._encode=function(){var a;return a={type:"ReplaceManager",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&null!=this.next_cl&&(a.prev=this.prev_cl.getUid(),a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},c}(d),j.ReplaceManager=function(a){var b,c,d,e,f,h,i;return c=a.content,i=a.uid,h=a.prev,e=a.next,f=a.origin,b=a.beginning,d=a.end,new g(c,i,b,d,h,e,f)},h=function(a){function b(a,c,d,e,f,g){if(this.saveOperation("content",a),this.saveOperation("parent",c),null==e||null==f||null==a)throw new Error("You must define content, prev, and next for Replaceable-types!");b.__super__.constructor.call(this,d,e,f,g)}return e(b,a),b.prototype.val=function(){return this.content},b.prototype.replace=function(a){return this.parent.replace(a)},b.prototype.execute=function(){var a;return this.validateSavedOperations()?("function"==typeof(a=this.content).setReplaceManager&&a.setReplaceManager(this.parent),b.__super__.execute.apply(this,arguments),this):!1},b.prototype._encode=function(){var a;return a={type:"Replaceable",content:this.content.getUid(),ReplaceManager:this.parent.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid(),uid:this.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(k.Insert),j.Replaceable=function(a){var b,c,d,e,f,g;return b=a.content,e=a.ReplaceManager,g=a.uid,f=a.prev,c=a.next,d=a.origin,new h(b,e,g,f,c,d)},k.ListManager=d,k.MapManager=f,k.ReplaceManager=g,k.Replaceable=h,i}},{"./BasicTypes.coffee":6}],9:[function(a,b){var c,d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};c=a("./StructuredTypes.coffee"),b.exports=function(a){var b,d,f,g,h,i;return h=c(a),i=h.types,g=h.parser,b=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return e(b,a),b}(i.Delete),g.TextDelete=g.Delete,d=function(a){function b(a,c,d,e,f){if(this.content=a,null==d||null==e)throw new Error("You must define prev, and next for TextInsert-types!");b.__super__.constructor.call(this,c,d,e,f)}return e(b,a),b.prototype.getLength=function(){return this.isDeleted()?0:this.content.length},b.prototype.val=function(){return this.isDeleted()?"":this.content},b.prototype._encode=function(){var a;return a={type:"TextInsert",content:this.content,uid:this.getUid(),prev:this.prev_cl.getUid(),next:this.next_cl.getUid()},null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},b}(i.Insert),g.TextInsert=function(a){var b,c,e,f,g;return b=a.content,g=a.uid,f=a.prev,c=a.next,e=a.origin,new d(b,g,f,c,e)},f=function(c){function f(a,b,c,d,e,g,h){f.__super__.constructor.call(this,a,c,d,e,g,h),null!=b&&this.insertText(0,b)}return e(f,c),f.prototype.insertText=function(b,c){var e,f,g,h,i,j;for(f=this.getOperationByPosition(b),j=[],h=0,i=c.length;i>h;h++)e=c[h],g=new d(e,a.getNextOperationIdentifier(),f.prev_cl,f),j.push(a.addOperation(g).execute());return j},f.prototype.deleteText=function(c,d){var e,f,g,h,j;for(g=this.getOperationByPosition(c),j=[],f=h=0;d>=0?d>h:h>d;f=d>=0?++h:--h){for(e=a.addOperation(new b(a.getNextOperationIdentifier(),g)).execute(),g=g.next_cl;g.isDeleted();){if(g instanceof i.Delimiter)throw new Error("You can't delete more than there is..");g=g.next_cl}j.push(e._encode())}return j},f.prototype.replaceText=function(b){var c;if(null!=this.replace_manager)return c=a.addOperation(new f(a.getNextOperationIdentifier())).execute(),c.insertText(0,b),this.replace_manager.replace(c);throw new Error("This type is currently not maintained by a ReplaceManager!")},f.prototype.val=function(){var a,b;return a=function(){var a,c,d,e;for(d=this.toArray(),e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(null!=b.val?b.val():"");return e}.call(this),a.join("")},f.prototype.setReplaceManager=function(a){return this.saveOperation("replace_manager",a),this.validateSavedOperations},f.prototype._encode=function(){var a;return a={type:"Word",uid:this.getUid(),beginning:this.beginning.getUid(),end:this.end.getUid()},null!=this.prev_cl&&(a.prev=this.prev_cl.getUid()),null!=this.next_cl&&(a.next=this.next_cl.getUid()),null!=this.origin&&this.origin!==this.prev_cl&&(a.origin=this.origin.getUid()),a},f}(i.ListManager),g.Word=function(a){var b,c,d,e,g,h;return h=a.uid,b=a.beginning,c=a.end,g=a.prev,d=a.next,e=a.origin,new f(h,void 0,b,c,g,d,e)},i.TextInsert=d,i.TextDelete=b,i.Word=f,h}},{"./StructuredTypes.coffee":8}],10:[function(a,b,c){function d(a,b,c){if(!(this instanceof d))return new d(a,b,c);var e,f=typeof a;if("number"===f)e=a>0?a>>>0:0;else if("string"===f)"base64"===b&&(a=C(a)),e=d.byteLength(a,b);else{if("object"!==f||null===a)throw new Error("First argument needs to be a number, array or string.");"Buffer"===a.type&&E(a.data)&&(a=a.data),e=+a.length>0?Math.floor(+a.length):0}var g;T?g=d._augment(new Uint8Array(e)):(g=this,g.length=e,g._isBuffer=!0);var h;if(T&&"number"==typeof a.byteLength)g._set(a);else if(F(a))if(d.isBuffer(a))for(h=0;e>h;h++)g[h]=a.readUInt8(h);else for(h=0;e>h;h++)g[h]=(a[h]%256+256)%256;else if("string"===f)g.write(a,0,b);else if("number"===f&&!T&&!c)for(h=0;e>h;h++)g[h]=0;return g}function e(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;Q(f%2===0,"Invalid hex string"),d>f/2&&(d=f/2);for(var g=0;d>g;g++){var h=parseInt(b.substr(2*g,2),16);Q(!isNaN(h),"Invalid hex string"),a[c+g]=h}return g}function f(a,b,c,d){var e=L(H(b),a,c,d);return e}function g(a,b,c,d){var e=L(I(b),a,c,d);return e}function h(a,b,c,d){return g(a,b,c,d)}function i(a,b,c,d){var e=L(K(b),a,c,d);return e}function j(a,b,c,d){var e=L(J(b),a,c,d);return e}function k(a,b,c){return R.fromByteArray(0===b&&c===a.length?a:a.slice(b,c))}function l(a,b,c){var d="",e="";c=Math.min(a.length,c);for(var f=b;c>f;f++)a[f]<=127?(d+=M(e)+String.fromCharCode(a[f]),e=""):e+="%"+a[f].toString(16);return d+M(e)}function m(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(a[e]);return d}function n(a,b,c){return m(a,b,c)}function o(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;f++)e+=G(a[f]);return e}function p(a,b,c){for(var d=a.slice(b,c),e="",f=0;f<d.length;f+=2)e+=String.fromCharCode(d[f]+256*d[f+1]);return e}function q(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(f=a[b],e>b+1&&(f|=a[b+1]<<8)):(f=a[b]<<8,e>b+1&&(f|=a[b+1])),f}}function r(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(e>b+2&&(f=a[b+2]<<16),e>b+1&&(f|=a[b+1]<<8),f|=a[b],e>b+3&&(f+=a[b+3]<<24>>>0)):(e>b+1&&(f=a[b+1]<<16),e>b+2&&(f|=a[b+2]<<8),e>b+3&&(f|=a[b+3]),f+=a[b]<<24>>>0),f}}function s(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=q(a,b,c,!0),g=32768&f;return g?-1*(65535-f+1):f}}function t(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=r(a,b,c,!0),g=2147483648&f;return g?-1*(4294967295-f+1):f}}function u(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+3<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,23,4)}function v(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+7<a.length,"Trying to read beyond buffer length")),S.read(a,b,c,52,8)}function w(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"trying to write beyond buffer length"),N(b,65535));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,2);h>g;g++)a[c+g]=(b&255<<8*(d?g:1-g))>>>8*(d?g:1-g);return c+2}}function x(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"trying to write beyond buffer length"),N(b,4294967295));var f=a.length;if(!(c>=f)){for(var g=0,h=Math.min(f-c,4);h>g;g++)a[c+g]=b>>>8*(d?g:3-g)&255;return c+4}}function y(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1<a.length,"Trying to write beyond buffer length"),O(b,32767,-32768));var f=a.length;return c>=f?void 0:(b>=0?w(a,b,c,d,e):w(a,65535+b+1,c,d,e),c+2)}function z(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),O(b,2147483647,-2147483648));var f=a.length;return c>=f?void 0:(b>=0?x(a,b,c,d,e):x(a,4294967295+b+1,c,d,e),c+4)}function A(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3<a.length,"Trying to write beyond buffer length"),P(b,3.4028234663852886e38,-3.4028234663852886e38));var f=a.length;return c>=f?void 0:(S.write(a,b,c,d,23,4),c+4)}function B(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+7<a.length,"Trying to write beyond buffer length"),P(b,1.7976931348623157e308,-1.7976931348623157e308));var f=a.length;return c>=f?void 0:(S.write(a,b,c,d,52,8),c+8)}function C(a){for(a=D(a).replace(V,"");a.length%4!==0;)a+="=";return a}function D(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function E(a){return(Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)})(a)}function F(a){return E(a)||d.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length}function G(a){return 16>a?"0"+a.toString(16):a.toString(16)}function H(a){for(var b=[],c=0;c<a.length;c++){var d=a.charCodeAt(c);if(127>=d)b.push(d);else{var e=c;d>=55296&&57343>=d&&c++;for(var f=encodeURIComponent(a.slice(e,c+1)).substr(1).split("%"),g=0;g<f.length;g++)b.push(parseInt(f[g],16))}}return b}function I(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function J(a){for(var b,c,d,e=[],f=0;f<a.length;f++)b=a.charCodeAt(f),c=b>>8,d=b%256,e.push(d),e.push(c);return e}function K(a){return R.toByteArray(a)}function L(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);e++)b[e+c]=a[e];return e}function M(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function N(a,b){Q("number"==typeof a,"cannot write a non-number as a number"),Q(a>=0,"specified a negative value for writing an unsigned value"),Q(b>=a,"value is larger than maximum value for type"),Q(Math.floor(a)===a,"value has a fractional component")}function O(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value"),Q(Math.floor(a)===a,"value has a fractional component")}function P(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value")}function Q(a,b){if(!a)throw new Error(b||"Failed assertion")}var R=a("base64-js"),S=a("ieee754");c.Buffer=d,c.SlowBuffer=d,c.INSPECT_MAX_BYTES=50,d.poolSize=8192;var T=function(){try{var a=new ArrayBuffer(0),b=new Uint8Array(a);return b.foo=function(){return 42},42===b.foo()&&"function"==typeof b.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(c){return!1}}();d.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.isBuffer=function(a){return!(null==a||!a._isBuffer)},d.byteLength=function(a,b){var c;switch(a=a.toString(),b||"utf8"){case"hex":c=a.length/2;break;case"utf8":case"utf-8":c=H(a).length;break;case"ascii":case"binary":case"raw":c=a.length;break;case"base64":c=K(a).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":c=2*a.length;break;default:throw new Error("Unknown encoding")}return c},d.concat=function(a,b){if(Q(E(a),"Usage: Buffer.concat(list[, length])"),0===a.length)return new d(0);if(1===a.length)return a[0];var c;if(void 0===b)for(b=0,c=0;c<a.length;c++)b+=a[c].length;var e=new d(b),f=0;for(c=0;c<a.length;c++){var g=a[c];g.copy(e,f),f+=g.length}return e},d.compare=function(a,b){Q(d.isBuffer(a)&&d.isBuffer(b),"Arguments must be Buffers");for(var c=a.length,e=b.length,f=0,g=Math.min(c,e);g>f&&a[f]===b[f];f++);return f!==g&&(c=a[f],e=b[f]),e>c?-1:c>e?1:0},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var k=d;d=b,b=c,c=k}b=Number(b)||0;var l=this.length-b;c?(c=Number(c),c>l&&(c=l)):c=l,d=String(d||"utf8").toLowerCase();var m;switch(d){case"hex":m=e(this,a,b,c);break;case"utf8":case"utf-8":m=f(this,a,b,c);break;case"ascii":m=g(this,a,b,c);break;case"binary":m=h(this,a,b,c);break;case"base64":m=i(this,a,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":m=j(this,a,b,c);break;default:throw new Error("Unknown encoding")}return m},d.prototype.toString=function(a,b,c){var d=this;if(a=String(a||"utf8").toLowerCase(),b=Number(b)||0,c=void 0===c?d.length:Number(c),c===b)return"";var e;switch(a){case"hex":e=o(d,b,c);break;case"utf8":case"utf-8":e=l(d,b,c);break;case"ascii":e=m(d,b,c);break;case"binary":e=n(d,b,c);break;case"base64":e=k(d,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":e=p(d,b,c);break;default:throw new Error("Unknown encoding")}return e},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},d.prototype.equals=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),0===d.compare(this,a)},d.prototype.compare=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),d.compare(this,a)},d.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||0===d||(d=this.length),b||(b=0),d!==c&&0!==a.length&&0!==e.length){Q(d>=c,"sourceEnd < sourceStart"),Q(b>=0&&b<a.length,"targetStart out of bounds"),Q(c>=0&&c<e.length,"sourceStart out of bounds"),Q(d>=0&&d<=e.length,"sourceEnd out of bounds"),d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);var f=d-c;if(100>f||!T)for(var g=0;f>g;g++)a[g+b]=this[g+c];else a._set(this.subarray(c,c+f),b)}},d.prototype.slice=function(a,b){var c=this.length;if(a=~~a,b=void 0===b?c:~~b,0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c),0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c),a>b&&(b=a),T)return d._augment(this.subarray(a,b));for(var e=b-a,f=new d(e,void 0,!0),g=0;e>g;g++)f[g]=this[g+a];return f},d.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},d.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},d.prototype.readUInt8=function(a,b){return b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),a>=this.length?void 0:this[a]},d.prototype.readUInt16LE=function(a,b){return q(this,a,!0,b)},d.prototype.readUInt16BE=function(a,b){return q(this,a,!1,b)},d.prototype.readUInt32LE=function(a,b){return r(this,a,!0,b)},d.prototype.readUInt32BE=function(a,b){return r(this,a,!1,b)},d.prototype.readInt8=function(a,b){if(b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a<this.length,"Trying to read beyond buffer length")),!(a>=this.length)){var c=128&this[a];return c?-1*(255-this[a]+1):this[a]}},d.prototype.readInt16LE=function(a,b){return s(this,a,!0,b)},d.prototype.readInt16BE=function(a,b){return s(this,a,!1,b)},d.prototype.readInt32LE=function(a,b){return t(this,a,!0,b)},d.prototype.readInt32BE=function(a,b){return t(this,a,!1,b)},d.prototype.readFloatLE=function(a,b){return u(this,a,!0,b)},d.prototype.readFloatBE=function(a,b){return u(this,a,!1,b)},d.prototype.readDoubleLE=function(a,b){return v(this,a,!0,b)},d.prototype.readDoubleBE=function(a,b){return v(this,a,!1,b)},d.prototype.writeUInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"trying to write beyond buffer length"),N(a,255)),b>=this.length?void 0:(this[b]=a,b+1)},d.prototype.writeUInt16LE=function(a,b,c){return w(this,a,b,!0,c)},d.prototype.writeUInt16BE=function(a,b,c){return w(this,a,b,!1,c)},d.prototype.writeUInt32LE=function(a,b,c){return x(this,a,b,!0,c)},d.prototype.writeUInt32BE=function(a,b,c){return x(this,a,b,!1,c)},d.prototype.writeInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b<this.length,"Trying to write beyond buffer length"),O(a,127,-128)),b>=this.length?void 0:(a>=0?this.writeUInt8(a,b,c):this.writeUInt8(255+a+1,b,c),b+1)},d.prototype.writeInt16LE=function(a,b,c){return y(this,a,b,!0,c)},d.prototype.writeInt16BE=function(a,b,c){return y(this,a,b,!1,c)},d.prototype.writeInt32LE=function(a,b,c){return z(this,a,b,!0,c)},d.prototype.writeInt32BE=function(a,b,c){return z(this,a,b,!1,c)},d.prototype.writeFloatLE=function(a,b,c){return A(this,a,b,!0,c)},d.prototype.writeFloatBE=function(a,b,c){return A(this,a,b,!1,c)},d.prototype.writeDoubleLE=function(a,b,c){return B(this,a,b,!0,c)},d.prototype.writeDoubleBE=function(a,b,c){return B(this,a,b,!1,c)},d.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),Q(c>=b,"end < start"),c!==b&&0!==this.length){Q(b>=0&&b<this.length,"start out of bounds"),Q(c>=0&&c<=this.length,"end out of bounds");var d;if("number"==typeof a)for(d=b;c>d;d++)this[d]=a;else{var e=H(a.toString()),f=e.length;for(d=b;c>d;d++)this[d]=e[d%f]}return this}},d.prototype.inspect=function(){for(var a=[],b=this.length,d=0;b>d;d++)if(a[d]=G(this[d]),d===c.INSPECT_MAX_BYTES){a[d+1]="...";break}return"<Buffer "+a.join(" ")+">"},d.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(T)return new d(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;c>b;b+=1)a[b]=this[b];return a.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var U=d.prototype;d._augment=function(a){return a._isBuffer=!0,a._get=a.get,a._set=a.set,a.get=U.get,a.set=U.set,a.write=U.write,a.toString=U.toString,a.toLocaleString=U.toString,a.toJSON=U.toJSON,a.equals=U.equals,a.compare=U.compare,a.copy=U.copy,a.slice=U.slice,a.readUInt8=U.readUInt8,a.readUInt16LE=U.readUInt16LE,a.readUInt16BE=U.readUInt16BE,a.readUInt32LE=U.readUInt32LE,a.readUInt32BE=U.readUInt32BE,a.readInt8=U.readInt8,a.readInt16LE=U.readInt16LE,a.readInt16BE=U.readInt16BE,a.readInt32LE=U.readInt32LE,a.readInt32BE=U.readInt32BE,a.readFloatLE=U.readFloatLE,a.readFloatBE=U.readFloatBE,a.readDoubleLE=U.readDoubleLE,a.readDoubleBE=U.readDoubleBE,a.writeUInt8=U.writeUInt8,a.writeUInt16LE=U.writeUInt16LE,a.writeUInt16BE=U.writeUInt16BE,a.writeUInt32LE=U.writeUInt32LE,a.writeUInt32BE=U.writeUInt32BE,a.writeInt8=U.writeInt8,a.writeInt16LE=U.writeInt16LE,a.writeInt16BE=U.writeInt16BE,a.writeInt32LE=U.writeInt32LE,a.writeInt32BE=U.writeInt32BE,a.writeFloatLE=U.writeFloatLE,a.writeFloatBE=U.writeFloatBE,a.writeDoubleLE=U.writeDoubleLE,a.writeDoubleBE=U.writeDoubleBE,a.fill=U.fill,a.inspect=U.inspect,a.toArrayBuffer=U.toArrayBuffer,a
|
||
};var V=/[^+\/0-9A-z]/g},{"base64-js":11,ieee754:12}],11:[function(a,b,c){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(a){"use strict";function b(a){var b=a.charCodeAt(0);return b===g?62:b===h?63:i>b?-1:i+10>b?b-i+26+26:k+26>b?b-k:j+26>b?b-j+26:void 0}function c(a){function c(a){j[l++]=a}var d,e,g,h,i,j;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new f(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,e=0;g>d;d+=4,e+=3)h=b(a.charAt(d))<<18|b(a.charAt(d+1))<<12|b(a.charAt(d+2))<<6|b(a.charAt(d+3)),c((16711680&h)>>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function e(a){function b(a){return d.charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var e,f,g,h=a.length%3,i="";for(e=0,g=a.length-h;g>e;e+=3)f=(a[e]<<16)+(a[e+1]<<8)+a[e+2],i+=c(f);switch(h){case 1:f=a[a.length-1],i+=b(f>>2),i+=b(f<<4&63),i+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],i+=b(f>>10),i+=b(f>>4&63),i+=b(f<<2&63),i+="="}return i}var f="undefined"!=typeof Uint8Array?Uint8Array:Array,g="+".charCodeAt(0),h="/".charCodeAt(0),i="0".charCodeAt(0),j="a".charCodeAt(0),k="A".charCodeAt(0);a.toByteArray=c,a.fromByteArray=e}("undefined"==typeof c?this.base64js={}:c)},{}],12:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],13:[function(a,b){b.exports="function"==typeof Object.create?function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],14:[function(a,b){function c(){}var d=b.exports={};d.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var d=c.shift();d()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.binding=function(){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(){throw new Error("process.chdir is not supported")}},{}],15:[function(a,b){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8}},{}],16:[function(a,b,c){(function(b,d){function e(a,b){var d={seen:[],stylize:g};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),p(b)?d.showHidden=b:b&&c._extend(d,b),v(d.showHidden)&&(d.showHidden=!1),v(d.depth)&&(d.depth=2),v(d.colors)&&(d.colors=!1),v(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=f),i(d,a,d.depth)}function f(a,b){var c=e.styles[b];return c?"["+e.colors[c][0]+"m"+a+"["+e.colors[c][1]+"m":a}function g(a){return a}function h(a){var b={};return a.forEach(function(a){b[a]=!0}),b}function i(a,b,d){if(a.customInspect&&b&&A(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return t(e)||(e=i(a,e,d)),e}var f=j(a,b);if(f)return f;var g=Object.keys(b),p=h(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),z(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return k(b);if(0===g.length){if(A(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(w(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(y(b))return a.stylize(Date.prototype.toString.call(b),"date");if(z(b))return k(b)}var r="",s=!1,u=["{","}"];if(o(b)&&(s=!0,u=["[","]"]),A(b)){var v=b.name?": "+b.name:"";r=" [Function"+v+"]"}if(w(b)&&(r=" "+RegExp.prototype.toString.call(b)),y(b)&&(r=" "+Date.prototype.toUTCString.call(b)),z(b)&&(r=" "+k(b)),0===g.length&&(!s||0==b.length))return u[0]+r+u[1];if(0>d)return w(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var x;return x=s?l(a,b,d,p,g):g.map(function(c){return m(a,b,d,p,c,s)}),a.seen.pop(),n(x,r,u)}function j(a,b){if(v(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return s(b)?a.stylize(""+b,"number"):p(b)?a.stylize(""+b,"boolean"):q(b)?a.stylize("null","null"):void 0}function k(a){return"["+Error.prototype.toString.call(a)+"]"}function l(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(F(b,String(g))?m(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(m(a,b,c,d,e,!0))}),f}function m(a,b,c,d,e,f){var g,h,j;if(j=Object.getOwnPropertyDescriptor(b,e)||{value:b[e]},j.get?h=j.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):j.set&&(h=a.stylize("[Setter]","special")),F(d,e)||(g="["+e+"]"),h||(a.seen.indexOf(j.value)<0?(h=q(c)?i(a,j.value,null):i(a,j.value,c-1),h.indexOf("\n")>-1&&(h=f?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),v(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function n(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function o(a){return Array.isArray(a)}function p(a){return"boolean"==typeof a}function q(a){return null===a}function r(a){return null==a}function s(a){return"number"==typeof a}function t(a){return"string"==typeof a}function u(a){return"symbol"==typeof a}function v(a){return void 0===a}function w(a){return x(a)&&"[object RegExp]"===C(a)}function x(a){return"object"==typeof a&&null!==a}function y(a){return x(a)&&"[object Date]"===C(a)}function z(a){return x(a)&&("[object Error]"===C(a)||a instanceof Error)}function A(a){return"function"==typeof a}function B(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function C(a){return Object.prototype.toString.call(a)}function D(a){return 10>a?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),J[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=/%[sdj%]/g;c.format=function(a){if(!t(a)){for(var b=[],c=0;c<arguments.length;c++)b.push(e(arguments[c]));return b.join(" ")}for(var c=1,d=arguments,f=d.length,g=String(a).replace(G,function(a){if("%%"===a)return"%";if(c>=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(b){return"[Circular]"}default:return a}}),h=d[c];f>c;h=d[++c])g+=q(h)||!x(h)?" "+h:" "+e(h);return g},c.deprecate=function(a,e){function f(){if(!g){if(b.throwDeprecation)throw new Error(e);b.traceDeprecation?console.trace(e):console.error(e),g=!0}return a.apply(this,arguments)}if(v(d.process))return function(){return c.deprecate(a,e).apply(this,arguments)};if(b.noDeprecation===!0)return a;var g=!1;return f};var H,I={};c.debuglog=function(a){if(v(H)&&(H=b.env.NODE_DEBUG||""),a=a.toUpperCase(),!I[a])if(new RegExp("\\b"+a+"\\b","i").test(H)){var d=b.pid;I[a]=function(){var b=c.format.apply(c,arguments);console.error("%s %d: %s",a,d,b)}}else I[a]=function(){};return I[a]},c.inspect=e,e.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},e.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},c.isArray=o,c.isBoolean=p,c.isNull=q,c.isNullOrUndefined=r,c.isNumber=s,c.isString=t,c.isSymbol=u,c.isUndefined=v,c.isRegExp=w,c.isObject=x,c.isDate=y,c.isError=z,c.isFunction=A,c.isPrimitive=B,c.isBuffer=a("./support/isBuffer");var J=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c.log=function(){console.log("%s - %s",E(),c.format.apply(c,arguments))},c.inherits=a("inherits"),c._extend=function(a,b){if(!b||!x(b))return a;for(var c=Object.keys(b),d=c.length;d--;)a[c[d]]=b[c[d]];return a}}).call(this,a("FWaASH"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":15,FWaASH:14,inherits:13}],17:[function(a,b){b.exports=a("./lib/chai")},{"./lib/chai":18}],18:[function(a,b,c){var d=[],c=b.exports={};c.version="1.9.1",c.AssertionError=a("assertion-error");var e=a("./chai/utils");c.use=function(a){return~d.indexOf(a)||(a(this,e),d.push(a)),this};var f=a("./chai/config");c.config=f;var g=a("./chai/assertion");c.use(g);var h=a("./chai/core/assertions");c.use(h);var i=a("./chai/interface/expect");c.use(i);var j=a("./chai/interface/should");c.use(j);var k=a("./chai/interface/assert");c.use(k)},{"./chai/assertion":19,"./chai/config":20,"./chai/core/assertions":21,"./chai/interface/assert":22,"./chai/interface/expect":23,"./chai/interface/should":24,"./chai/utils":35,"assertion-error":44}],19:[function(a,b){var c=a("./config");b.exports=function(a,b){function d(a,b,c){f(this,"ssfi",c||arguments.callee),f(this,"object",a),f(this,"message",b)}var e=a.AssertionError,f=b.flag;a.Assertion=d,Object.defineProperty(d,"includeStack",{get:function(){return console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack},set:function(a){console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),c.includeStack=a}}),Object.defineProperty(d,"showDiff",{get:function(){return console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff},set:function(a){console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),c.showDiff=a}}),d.addProperty=function(a,c){b.addProperty(this.prototype,a,c)},d.addMethod=function(a,c){b.addMethod(this.prototype,a,c)},d.addChainableMethod=function(a,c,d){b.addChainableMethod(this.prototype,a,c,d)},d.overwriteProperty=function(a,c){b.overwriteProperty(this.prototype,a,c)},d.overwriteMethod=function(a,c){b.overwriteMethod(this.prototype,a,c)},d.overwriteChainableMethod=function(a,c,d){b.overwriteChainableMethod(this.prototype,a,c,d)},d.prototype.assert=function(a,d,g,h,i,j){var k=b.test(this,arguments);if(!0!==j&&(j=!1),!0!==c.showDiff&&(j=!1),!k){var d=b.getMessage(this,arguments),l=b.getActual(this,arguments);throw new e(d,{actual:l,expected:h,showDiff:j},c.includeStack?this.assert:f(this,"ssfi"))}},Object.defineProperty(d.prototype,"_obj",{get:function(){return f(this,"object")},set:function(a){f(this,"object",a)}})}},{"./config":20}],20:[function(a,b){b.exports={includeStack:!1,showDiff:!0,truncateThreshold:40}},{}],21:[function(a,b){b.exports=function(a,b){function c(a,c){c&&u(this,"message",c),a=a.toLowerCase();var d=u(this,"object"),e=~["a","e","i","o","u"].indexOf(a.charAt(0))?"an ":"a ";this.assert(a===b.type(d),"expected #{this} to be "+e+a,"expected #{this} not to be "+e+a)}function d(){u(this,"contains",!0)}function e(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=!1;if("array"===b.type(d)&&"object"===b.type(a)){for(var f in d)if(b.eql(d[f],a)){e=!0;break}}else if("object"===b.type(a)){if(!u(this,"negate")){for(var g in a)new t(d).property(g,a[g]);return}var h={};for(var g in a)h[g]=d[g];e=b.eql(h,a)}else e=d&&~d.indexOf(a);this.assert(e,"expected #{this} to include "+b.inspect(a),"expected #{this} to not include "+b.inspect(a))}function f(){var a=u(this,"object"),b=Object.prototype.toString.call(a);this.assert("[object Arguments]"===b,"expected #{this} to be arguments but got "+b,"expected #{this} to not be arguments")}function g(a,b){b&&u(this,"message",b);var c=u(this,"object");return u(this,"deep")?this.eql(a):void this.assert(a===c,"expected #{this} to equal #{exp}","expected #{this} to not equal #{exp}",a,this._obj,!0)}function h(a,c){c&&u(this,"message",c),this.assert(b.eql(a,u(this,"object")),"expected #{this} to deeply equal #{exp}","expected #{this} to not deeply equal #{exp}",a,this._obj,!0)}function i(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>a,"expected #{this} to have a length above #{exp} but got #{act}","expected #{this} to not have a length above #{exp}",a,d)}else this.assert(c>a,"expected #{this} to be above "+a,"expected #{this} to be at most "+a)}function j(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(d>=a,"expected #{this} to have a length at least #{exp} but got #{act}","expected #{this} to have a length below #{exp}",a,d)}else this.assert(c>=a,"expected #{this} to be at least "+a,"expected #{this} to be below "+a)}function k(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(a>d,"expected #{this} to have a length below #{exp} but got #{act}","expected #{this} to not have a length below #{exp}",a,d)}else this.assert(a>c,"expected #{this} to be below "+a,"expected #{this} to be at least "+a)}function l(a,b){b&&u(this,"message",b);var c=u(this,"object");if(u(this,"doLength")){new t(c,b).to.have.property("length");var d=c.length;this.assert(a>=d,"expected #{this} to have a length at most #{exp} but got #{act}","expected #{this} to have a length above #{exp}",a,d)}else this.assert(a>=c,"expected #{this} to be at most "+a,"expected #{this} to be above "+a)}function m(a,c){c&&u(this,"message",c);var d=b.getName(a);this.assert(u(this,"object")instanceof a,"expected #{this} to be an instance of "+d,"expected #{this} to not be an instance of "+d)}function n(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(d.hasOwnProperty(a),"expected #{this} to have own property "+b.inspect(a),"expected #{this} to not have own property "+b.inspect(a))}function o(){u(this,"doLength",!0)}function p(a,b){b&&u(this,"message",b);var c=u(this,"object");new t(c,b).to.have.property("length");var d=c.length;this.assert(d==a,"expected #{this} to have a length of #{exp} but got #{act}","expected #{this} to not have a length of #{act}",a,d)}function q(a){var c,d=u(this,"object"),e=!0;if(a=a instanceof Array?a:Array.prototype.slice.call(arguments),!a.length)throw new Error("keys required");var f=Object.keys(d),g=a.length;if(e=a.every(function(a){return~f.indexOf(a)}),u(this,"negate")||u(this,"contains")||(e=e&&a.length==f.length),g>1){a=a.map(function(a){return b.inspect(a)});var h=a.pop();c=a.join(", ")+", and "+h}else c=b.inspect(a[0]);c=(g>1?"keys ":"key ")+c,c=(u(this,"contains")?"contain ":"have ")+c,this.assert(e,"expected #{this} to "+c,"expected #{this} to not "+c)}function r(a,c,d){d&&u(this,"message",d);var e=u(this,"object");new t(e,d).is.a("function");var f=!1,g=null,h=null,i=null;0===arguments.length?(c=null,a=null):a&&(a instanceof RegExp||"string"==typeof a)?(c=a,a=null):a&&a instanceof Error?(g=a,a=null,c=null):"function"==typeof a?(h=a.prototype.name||a.name,"Error"===h&&a!==Error&&(h=(new a).name)):a=null;try{e()}catch(j){if(g)return this.assert(j===g,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}",g instanceof Error?g.toString():g,j instanceof Error?j.toString():j),u(this,"object",j),this;if(a&&(this.assert(j instanceof a,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp} but #{act} was thrown",h,j instanceof Error?j.toString():j),!c))return u(this,"object",j),this;var k="object"===b.type(j)&&"message"in j?j.message:""+j;if(null!=k&&c&&c instanceof RegExp)return this.assert(c.exec(k),"expected #{this} to throw error matching #{exp} but got #{act}","expected #{this} to throw error not matching #{exp}",c,k),u(this,"object",j),this;if(null!=k&&c&&"string"==typeof c)return this.assert(~k.indexOf(c),"expected #{this} to throw error including #{exp} but got #{act}","expected #{this} to throw error not including #{act}",c,k),u(this,"object",j),this;f=!0,i=j}var l="",m=null!==h?h:g?"#{exp}":"an error";f&&(l=" but #{act} was thrown"),this.assert(f===!0,"expected #{this} to throw "+m+l,"expected #{this} to not throw "+m+l,g instanceof Error?g.toString():g,i instanceof Error?i.toString():i),u(this,"object",i)}function s(a,b,c){return a.every(function(a){return c?b.some(function(b){return c(a,b)}):-1!==b.indexOf(a)})}var t=a.Assertion,u=(Object.prototype.toString,b.flag);["to","be","been","is","and","has","have","with","that","at","of","same"].forEach(function(a){t.addProperty(a,function(){return this})}),t.addProperty("not",function(){u(this,"negate",!0)}),t.addProperty("deep",function(){u(this,"deep",!0)}),t.addChainableMethod("an",c),t.addChainableMethod("a",c),t.addChainableMethod("include",e,d),t.addChainableMethod("contain",e,d),t.addProperty("ok",function(){this.assert(u(this,"object"),"expected #{this} to be truthy","expected #{this} to be falsy")}),t.addProperty("true",function(){this.assert(!0===u(this,"object"),"expected #{this} to be true","expected #{this} to be false",this.negate?!1:!0)}),t.addProperty("false",function(){this.assert(!1===u(this,"object"),"expected #{this} to be false","expected #{this} to be true",this.negate?!0:!1)}),t.addProperty("null",function(){this.assert(null===u(this,"object"),"expected #{this} to be null","expected #{this} not to be null")}),t.addProperty("undefined",function(){this.assert(void 0===u(this,"object"),"expected #{this} to be undefined","expected #{this} not to be undefined")}),t.addProperty("exist",function(){this.assert(null!=u(this,"object"),"expected #{this} to exist","expected #{this} to not exist")}),t.addProperty("empty",function(){var a=u(this,"object"),b=a;Array.isArray(a)||"string"==typeof object?b=a.length:"object"==typeof a&&(b=Object.keys(a).length),this.assert(!b,"expected #{this} to be empty","expected #{this} not to be empty")}),t.addProperty("arguments",f),t.addProperty("Arguments",f),t.addMethod("equal",g),t.addMethod("equals",g),t.addMethod("eq",g),t.addMethod("eql",h),t.addMethod("eqls",h),t.addMethod("above",i),t.addMethod("gt",i),t.addMethod("greaterThan",i),t.addMethod("least",j),t.addMethod("gte",j),t.addMethod("below",k),t.addMethod("lt",k),t.addMethod("lessThan",k),t.addMethod("most",l),t.addMethod("lte",l),t.addMethod("within",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object"),e=a+".."+b;if(u(this,"doLength")){new t(d,c).to.have.property("length");var f=d.length;this.assert(f>=a&&b>=f,"expected #{this} to have a length within "+e,"expected #{this} to not have a length within "+e)}else this.assert(d>=a&&b>=d,"expected #{this} to be within "+e,"expected #{this} to not be within "+e)}),t.addMethod("instanceof",m),t.addMethod("instanceOf",m),t.addMethod("property",function(a,c,d){d&&u(this,"message",d);var e=u(this,"deep")?"deep property ":"property ",f=u(this,"negate"),g=u(this,"object"),h=u(this,"deep")?b.getPathValue(a,g):g[a];if(f&&void 0!==c){if(void 0===h)throw d=null!=d?d+": ":"",new Error(d+b.inspect(g)+" has no "+e+b.inspect(a))}else this.assert(void 0!==h,"expected #{this} to have a "+e+b.inspect(a),"expected #{this} to not have "+e+b.inspect(a));void 0!==c&&this.assert(c===h,"expected #{this} to have a "+e+b.inspect(a)+" of #{exp}, but got #{act}","expected #{this} to not have a "+e+b.inspect(a)+" of #{act}",c,h),u(this,"object",h)}),t.addMethod("ownProperty",n),t.addMethod("haveOwnProperty",n),t.addChainableMethod("length",p,o),t.addMethod("lengthOf",p,o),t.addMethod("match",function(a,b){b&&u(this,"message",b);var c=u(this,"object");this.assert(a.exec(c),"expected #{this} to match "+a,"expected #{this} not to match "+a)}),t.addMethod("string",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d,c).is.a("string"),this.assert(~d.indexOf(a),"expected #{this} to contain "+b.inspect(a),"expected #{this} to not contain "+b.inspect(a))}),t.addMethod("keys",q),t.addMethod("key",q),t.addMethod("throw",r),t.addMethod("throws",r),t.addMethod("Throw",r),t.addMethod("respondTo",function(a,c){c&&u(this,"message",c);var d=u(this,"object"),e=u(this,"itself"),f="function"!==b.type(d)||e?d[a]:d.prototype[a];this.assert("function"==typeof f,"expected #{this} to respond to "+b.inspect(a),"expected #{this} to not respond to "+b.inspect(a))}),t.addProperty("itself",function(){u(this,"itself",!0)}),t.addMethod("satisfy",function(a,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(a(d),"expected #{this} to satisfy "+b.objDisplay(a),"expected #{this} to not satisfy"+b.objDisplay(a),this.negate?!1:!0,a(d))}),t.addMethod("closeTo",function(a,b,c){c&&u(this,"message",c);var d=u(this,"object");this.assert(Math.abs(d-a)<=b,"expected #{this} to be close to "+a+" +/- "+b,"expected #{this} not to be close to "+a+" +/- "+b)}),t.addMethod("members",function(a,c){c&&u(this,"message",c);var d=u(this,"object");new t(d).to.be.an("array"),new t(a).to.be.an("array");var e=u(this,"deep")?b.eql:void 0;return u(this,"contains")?this.assert(s(a,d,e),"expected #{this} to be a superset of #{act}","expected #{this} to not be a superset of #{act}",d,a):void this.assert(s(d,a,e)&&s(a,d,e),"expected #{this} to have the same members as #{act}","expected #{this} to not have the same members as #{act}",d,a)})}},{}],22:[function(require,module,exports){module.exports=function(chai,util){var Assertion=chai.Assertion,flag=util.flag,assert=chai.assert=function(a,b){var c=new Assertion(null,null,chai.assert);c.assert(a,b,"[ negation message unavailable ]")};assert.fail=function(a,b,c,d){throw c=c||"assert.fail()",new chai.AssertionError(c,{actual:a,expected:b,operator:d},assert.fail)},assert.ok=function(a,b){new Assertion(a,b).is.ok},assert.notOk=function(a,b){new Assertion(a,b).is.not.ok},assert.equal=function(a,b,c){var d=new Assertion(a,c,assert.equal);d.assert(b==flag(d,"object"),"expected #{this} to equal #{exp}","expected #{this} to not equal #{act}",b,a)},assert.notEqual=function(a,b,c){var d=new Assertion(a,c,assert.notEqual);d.assert(b!=flag(d,"object"),"expected #{this} to not equal #{exp}","expected #{this} to equal #{act}",b,a)},assert.strictEqual=function(a,b,c){new Assertion(a,c).to.equal(b)},assert.notStrictEqual=function(a,b,c){new Assertion(a,c).to.not.equal(b)},assert.deepEqual=function(a,b,c){new Assertion(a,c).to.eql(b)},assert.notDeepEqual=function(a,b,c){new Assertion(a,c).to.not.eql(b)},assert.isTrue=function(a,b){new Assertion(a,b).is["true"]},assert.isFalse=function(a,b){new Assertion(a,b).is["false"]},assert.isNull=function(a,b){new Assertion(a,b).to.equal(null)},assert.isNotNull=function(a,b){new Assertion(a,b).to.not.equal(null)},assert.isUndefined=function(a,b){new Assertion(a,b).to.equal(void 0)},assert.isDefined=function(a,b){new Assertion(a,b).to.not.equal(void 0)},assert.isFunction=function(a,b){new Assertion(a,b).to.be.a("function")},assert.isNotFunction=function(a,b){new Assertion(a,b).to.not.be.a("function")},assert.isObject=function(a,b){new Assertion(a,b).to.be.a("object")},assert.isNotObject=function(a,b){new Assertion(a,b).to.not.be.a("object")},assert.isArray=function(a,b){new Assertion(a,b).to.be.an("array")},assert.isNotArray=function(a,b){new Assertion(a,b).to.not.be.an("array")},assert.isString=function(a,b){new Assertion(a,b).to.be.a("string")},assert.isNotString=function(a,b){new Assertion(a,b).to.not.be.a("string")},assert.isNumber=function(a,b){new Assertion(a,b).to.be.a("number")},assert.isNotNumber=function(a,b){new Assertion(a,b).to.not.be.a("number")},assert.isBoolean=function(a,b){new Assertion(a,b).to.be.a("boolean")},assert.isNotBoolean=function(a,b){new Assertion(a,b).to.not.be.a("boolean")},assert.typeOf=function(a,b,c){new Assertion(a,c).to.be.a(b)},assert.notTypeOf=function(a,b,c){new Assertion(a,c).to.not.be.a(b)},assert.instanceOf=function(a,b,c){new Assertion(a,c).to.be.instanceOf(b)},assert.notInstanceOf=function(a,b,c){new Assertion(a,c).to.not.be.instanceOf(b)},assert.include=function(a,b,c){new Assertion(a,c,assert.include).include(b)},assert.notInclude=function(a,b,c){new Assertion(a,c,assert.notInclude).not.include(b)},assert.match=function(a,b,c){new Assertion(a,c).to.match(b)},assert.notMatch=function(a,b,c){new Assertion(a,c).to.not.match(b)},assert.property=function(a,b,c){new Assertion(a,c).to.have.property(b)},assert.notProperty=function(a,b,c){new Assertion(a,c).to.not.have.property(b)},assert.deepProperty=function(a,b,c){new Assertion(a,c).to.have.deep.property(b)},assert.notDeepProperty=function(a,b,c){new Assertion(a,c).to.not.have.deep.property(b)},assert.propertyVal=function(a,b,c,d){new Assertion(a,d).to.have.property(b,c)},assert.propertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.property(b,c)},assert.deepPropertyVal=function(a,b,c,d){new Assertion(a,d).to.have.deep.property(b,c)},assert.deepPropertyNotVal=function(a,b,c,d){new Assertion(a,d).to.not.have.deep.property(b,c)},assert.lengthOf=function(a,b,c){new Assertion(a,c).to.have.length(b)},assert.Throw=function(a,b,c,d){("string"==typeof b||b instanceof RegExp)&&(c=b,b=null);var e=new Assertion(a,d).to.Throw(b,c);return flag(e,"object")},assert.doesNotThrow=function(a,b,c){"string"==typeof b&&(c=b,b=null),new Assertion(a,c).to.not.Throw(b)},assert.operator=function(val,operator,val2,msg){if(!~["==","===",">",">=","<","<=","!=","!=="].indexOf(operator))throw new Error('Invalid operator "'+operator+'"');var test=new Assertion(eval(val+operator+val2),msg);test.assert(!0===flag(test,"object"),"expected "+util.inspect(val)+" to be "+operator+" "+util.inspect(val2),"expected "+util.inspect(val)+" to not be "+operator+" "+util.inspect(val2))},assert.closeTo=function(a,b,c,d){new Assertion(a,d).to.be.closeTo(b,c)},assert.sameMembers=function(a,b,c){new Assertion(a,c).to.have.same.members(b)},assert.includeMembers=function(a,b,c){new Assertion(a,c).to.include.members(b)},assert.ifError=function(a,b){new Assertion(a,b).to.not.be.ok},function a(b,c){return assert[c]=assert[b],a}("Throw","throw")("Throw","throws")}},{}],23:[function(a,b){b.exports=function(a){a.expect=function(b,c){return new a.Assertion(b,c)}}},{}],24:[function(a,b){b.exports=function(a){function b(){function a(){return this instanceof String||this instanceof Number?new c(this.constructor(this),null,a):this instanceof Boolean?new c(1==this,null,a):new c(this,null,a)}function b(a){Object.defineProperty(this,"should",{value:a,enumerable:!0,configurable:!0,writable:!0})}Object.defineProperty(Object.prototype,"should",{set:b,get:a,configurable:!0});var d={};return d.equal=function(a,b,d){new c(a,d).to.equal(b)},d.Throw=function(a,b,d,e){new c(a,e).to.Throw(b,d)},d.exist=function(a,b){new c(a,b).to.exist},d.not={},d.not.equal=function(a,b,d){new c(a,d).to.not.equal(b)},d.not.Throw=function(a,b,d,e){new c(a,e).to.not.Throw(b,d)},d.not.exist=function(a,b){new c(a,b).to.not.exist},d["throw"]=d.Throw,d.not["throw"]=d.not.Throw,d}var c=a.Assertion;a.should=b,a.Should=b}},{}],25:[function(a,b){var c=a("./transferFlags"),d=a("./flag"),e=a("../config"),f="__proto__"in Object,g=/^(?:length|name|arguments|caller)$/,h=Function.prototype.call,i=Function.prototype.apply;b.exports=function(a,b,j,k){"function"!=typeof k&&(k=function(){});var l={method:j,chainingBehavior:k};a.__methods||(a.__methods={}),a.__methods[b]=l,Object.defineProperty(a,b,{get:function(){l.chainingBehavior.call(this);var b=function m(){var a=d(this,"ssfi");a&&e.includeStack===!1&&d(this,"ssfi",m);var b=l.method.apply(this,arguments);return void 0===b?this:b};if(f){var j=b.__proto__=Object.create(this);j.call=h,j.apply=i}else{var k=Object.getOwnPropertyNames(a);k.forEach(function(c){if(!g.test(c)){var d=Object.getOwnPropertyDescriptor(a,c);Object.defineProperty(b,c,d)}})}return c(this,b),b},configurable:!0})}},{"../config":20,"./flag":28,"./transferFlags":42}],26:[function(a,b){var c=a("../config"),d=a("./flag");b.exports=function(a,b,e){a[b]=function(){var f=d(this,"ssfi");f&&c.includeStack===!1&&d(this,"ssfi",a[b]);var g=e.apply(this,arguments);return void 0===g?this:g}}},{"../config":20,"./flag":28}],27:[function(a,b){b.exports=function(a,b,c){Object.defineProperty(a,b,{get:function(){var a=c.call(this);return void 0===a?this:a},configurable:!0})}},{}],28:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));return 3!==arguments.length?d[b]:void(d[b]=c)}},{}],29:[function(a,b){b.exports=function(a,b){return b.length>4?b[4]:a._obj}},{}],30:[function(a,b){b.exports=function(a){var b=[];for(var c in a)b.push(c);return b}},{}],31:[function(a,b){var c=a("./flag"),d=a("./getActual"),e=(a("./inspect"),a("./objDisplay"));b.exports=function(a,b){var f=c(a,"negate"),g=c(a,"object"),h=b[3],i=d(a,b),j=f?b[2]:b[1],k=c(a,"message");return j=j||"",j=j.replace(/#{this}/g,e(g)).replace(/#{act}/g,e(i)).replace(/#{exp}/g,e(h)),k?k+": "+j:j}},{"./flag":28,"./getActual":29,"./inspect":36,"./objDisplay":37}],32:[function(a,b){b.exports=function(a){if(a.name)return a.name;var b=/^\s?function ([^(]*)\(/.exec(a);return b&&b[1]?b[1]:""}},{}],33:[function(a,b){function c(a){var b=a.replace(/\[/g,".["),c=b.match(/(\\\.|[^.]+?)+/g);return c.map(function(a){var b=/\[(\d+)\]$/,c=b.exec(a);return c?{i:parseFloat(c[1])}:{p:a}})}function d(a,b){for(var c,d=b,e=0,f=a.length;f>e;e++){var g=a[e];d?("undefined"!=typeof g.p?d=d[g.p]:"undefined"!=typeof g.i&&(d=d[g.i]),e==f-1&&(c=d)):c=void 0}return c}b.exports=function(a,b){var e=c(a);return d(e,b)}},{}],34:[function(a,b){b.exports=function(){function a(a){-1===b.indexOf(a)&&b.push(a)}for(var b=Object.getOwnPropertyNames(subject),c=Object.getPrototypeOf(subject);null!==c;)Object.getOwnPropertyNames(c).forEach(a),c=Object.getPrototypeOf(c);return b}},{}],35:[function(a,b,c){var c=b.exports={};c.test=a("./test"),c.type=a("./type"),c.getMessage=a("./getMessage"),c.getActual=a("./getActual"),c.inspect=a("./inspect"),c.objDisplay=a("./objDisplay"),c.flag=a("./flag"),c.transferFlags=a("./transferFlags"),c.eql=a("deep-eql"),c.getPathValue=a("./getPathValue"),c.getName=a("./getName"),c.addProperty=a("./addProperty"),c.addMethod=a("./addMethod"),c.overwriteProperty=a("./overwriteProperty"),c.overwriteMethod=a("./overwriteMethod"),c.addChainableMethod=a("./addChainableMethod"),c.overwriteChainableMethod=a("./overwriteChainableMethod")},{"./addChainableMethod":25,"./addMethod":26,"./addProperty":27,"./flag":28,"./getActual":29,"./getMessage":31,"./getName":32,"./getPathValue":33,"./inspect":36,"./objDisplay":37,"./overwriteChainableMethod":38,"./overwriteMethod":39,"./overwriteProperty":40,"./test":41,"./transferFlags":42,"./type":43,"deep-eql":45}],36:[function(a,b,c){function d(a,b,c){var d={showHidden:b,seen:[],stylize:function(a){return a
|
||
}};return e(d,a,"undefined"==typeof c?2:c)}function e(a,b,d){if(b&&"function"==typeof b.inspect&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var o=b.inspect(d);return"string"!=typeof o&&(o=e(a,o,d)),o}var u=f(a,b);if(u)return u;if(t(b))return s(b);var v=r(b),w=a.showHidden?q(b):v;if(0===w.length||n(b)&&(1===w.length&&"stack"===w[0]||2===w.length&&"description"===w[0]&&"stack"===w[1])){if("function"==typeof b){var x=p(b),y=x?": "+x:"";return a.stylize("[Function"+y+"]","special")}if(l(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(m(b))return a.stylize(Date.prototype.toUTCString.call(b),"date");if(n(b))return g(b)}var z="",A=!1,B=["{","}"];if(k(b)&&(A=!0,B=["[","]"]),"function"==typeof b){var x=p(b),y=x?": "+x:"";z=" [Function"+y+"]"}if(l(b)&&(z=" "+RegExp.prototype.toString.call(b)),m(b)&&(z=" "+Date.prototype.toUTCString.call(b)),n(b))return g(b);if(0===w.length&&(!A||0==b.length))return B[0]+z+B[1];if(0>d)return l(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var C;return C=A?h(a,b,d,v,w):w.map(function(c){return i(a,b,d,v,c,A)}),a.seen.pop(),j(C,z,B)}function f(a,b){switch(typeof b){case"undefined":return a.stylize("undefined","undefined");case"string":var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string");case"number":return a.stylize(""+b,"number");case"boolean":return a.stylize(""+b,"boolean")}return null===b?a.stylize("null","null"):void 0}function g(a){return"["+Error.prototype.toString.call(a)+"]"}function h(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(Object.prototype.hasOwnProperty.call(b,String(g))?i(a,b,c,d,String(g),!0):"");return e.forEach(function(e){e.match(/^\d+$/)||f.push(i(a,b,c,d,e,!0))}),f}function i(a,b,c,d,f,g){var h,i;if(b.__lookupGetter__&&(b.__lookupGetter__(f)?i=b.__lookupSetter__(f)?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):b.__lookupSetter__(f)&&(i=a.stylize("[Setter]","special"))),d.indexOf(f)<0&&(h="["+f+"]"),i||(a.seen.indexOf(b[f])<0?(i=null===c?e(a,b[f],null):e(a,b[f],c-1),i.indexOf("\n")>-1&&(i=g?i.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+i.split("\n").map(function(a){return" "+a}).join("\n"))):i=a.stylize("[Circular]","special")),"undefined"==typeof h){if(g&&f.match(/^\d+$/))return i;h=JSON.stringify(""+f),h.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(h=h.substr(1,h.length-2),h=a.stylize(h,"name")):(h=h.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),h=a.stylize(h,"string"))}return h+": "+i}function j(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function k(a){return Array.isArray(a)||"object"==typeof a&&"[object Array]"===o(a)}function l(a){return"object"==typeof a&&"[object RegExp]"===o(a)}function m(a){return"object"==typeof a&&"[object Date]"===o(a)}function n(a){return"object"==typeof a&&"[object Error]"===o(a)}function o(a){return Object.prototype.toString.call(a)}var p=a("./getName"),q=a("./getProperties"),r=a("./getEnumerableProperties");b.exports=d;var s=function(a){if("outerHTML"in a)return a.outerHTML;var b,c="http://www.w3.org/1999/xhtml",d=document.createElementNS(c,"_"),e=((window.HTMLElement||window.Element).prototype,new XMLSerializer);return document.xmlVersion?e.serializeToString(a):(d.appendChild(a.cloneNode(!1)),b=d.innerHTML.replace("><",">"+a.innerHTML+"<"),d.innerHTML="",b)},t=function(a){return"object"==typeof HTMLElement?a instanceof HTMLElement:a&&"object"==typeof a&&1===a.nodeType&&"string"==typeof a.nodeName}},{"./getEnumerableProperties":30,"./getName":32,"./getProperties":34}],37:[function(a,b){var c=a("./inspect"),d=a("../config");b.exports=function(a){var b=c(a),e=Object.prototype.toString.call(a);if(d.truncateThreshold&&b.length>=d.truncateThreshold){if("[object Function]"===e)return a.name&&""!==a.name?"[Function: "+a.name+"]":"[Function]";if("[object Array]"===e)return"[ Array("+a.length+") ]";if("[object Object]"===e){var f=Object.keys(a),g=f.length>2?f.splice(0,2).join(", ")+", ...":f.join(", ");return"{ Object ("+g+") }"}return b}return b}},{"../config":20,"./inspect":36}],38:[function(a,b){b.exports=function(a,b,c,d){var e=a.__methods[b],f=e.chainingBehavior;e.chainingBehavior=function(){var a=d(f).call(this);return void 0===a?this:a};var g=e.method;e.method=function(){var a=c(g).apply(this,arguments);return void 0===a?this:a}}},{}],39:[function(a,b){b.exports=function(a,b,c){var d=a[b],e=function(){return this};d&&"function"==typeof d&&(e=d),a[b]=function(){var a=c(e).apply(this,arguments);return void 0===a?this:a}}},{}],40:[function(a,b){b.exports=function(a,b,c){var d=Object.getOwnPropertyDescriptor(a,b),e=function(){};d&&"function"==typeof d.get&&(e=d.get),Object.defineProperty(a,b,{get:function(){var a=c(e).call(this);return void 0===a?this:a},configurable:!0})}},{}],41:[function(a,b){var c=a("./flag");b.exports=function(a,b){var d=c(a,"negate"),e=b[0];return d?!e:e}},{"./flag":28}],42:[function(a,b){b.exports=function(a,b,c){var d=a.__flags||(a.__flags=Object.create(null));b.__flags||(b.__flags=Object.create(null)),c=3===arguments.length?c:!0;for(var e in d)(c||"object"!==e&&"ssfi"!==e&&"message"!=e)&&(b.__flags[e]=d[e])}},{}],43:[function(a,b){var c={"[object Arguments]":"arguments","[object Array]":"array","[object Date]":"date","[object Function]":"function","[object Number]":"number","[object RegExp]":"regexp","[object String]":"string"};b.exports=function(a){var b=Object.prototype.toString.call(a);return c[b]?c[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}},{}],44:[function(a,b){function c(){function a(a,c){Object.keys(c).forEach(function(d){~b.indexOf(d)||(a[d]=c[d])})}var b=[].slice.call(arguments);return function(){for(var b=[].slice.call(arguments),c=0,d={};c<b.length;c++)a(d,b[c]);return d}}function d(a,b,d){var e=c("name","message","stack","constructor","toJSON"),f=e(b||{});this.message=a||"Unspecified AssertionError",this.showDiff=!1;for(var g in f)this[g]=f[g];d=d||arguments.callee,d&&Error.captureStackTrace&&Error.captureStackTrace(this,d)}b.exports=d,d.prototype=Object.create(Error.prototype),d.prototype.name="AssertionError",d.prototype.constructor=d,d.prototype.toJSON=function(a){var b=c("constructor","toJSON","stack"),d=b({name:this.name},this);return!1!==a&&this.stack&&(d.stack=this.stack),d}},{}],45:[function(a,b){b.exports=a("./lib/eql")},{"./lib/eql":46}],46:[function(a,b){function c(a,b,c){return d(a,b)?!0:"date"===o(a)?f(a,b):"regexp"===o(a)?g(a,b):n.isBuffer(a)?k(a,b):"arguments"===o(a)?h(a,b,c):e(a,b)?"object"!==o(a)&&"object"!==o(b)&&"array"!==o(a)&&"array"!==o(b)?d(a,b):m(a,b,c):!1}function d(a,b){return a===b?0!==a||1/a===1/b:a!==a&&b!==b}function e(a,b){return o(a)===o(b)}function f(a,b){return"date"!==o(b)?!1:d(a.getTime(),b.getTime())}function g(a,b){return"regexp"!==o(b)?!1:d(a.toString(),b.toString())}function h(a,b,d){return"arguments"!==o(b)?!1:(a=[].slice.call(a),b=[].slice.call(b),c(a,b,d))}function i(a){var b=[];for(var c in a)b.push(c);return b}function j(a,b){if(a.length!==b.length)return!1;for(var c=0,d=!0;c<a.length;c++)if(a[c]!==b[c]){d=!1;break}return d}function k(a,b){return n.isBuffer(b)?j(a,b):!1}function l(a){return null!==a&&void 0!==a}function m(a,b,d){if(!l(a)||!l(b))return!1;if(a.prototype!==b.prototype)return!1;var e;if(d){for(e=0;e<d.length;e++)if(d[e][0]===a&&d[e][1]===b||d[e][0]===b&&d[e][1]===a)return!0}else d=[];try{var f=i(a),g=i(b)}catch(h){return!1}if(f.sort(),g.sort(),!j(f,g))return!1;d.push([a,b]);var k;for(e=f.length-1;e>=0;e--)if(k=f[e],!c(a[k],b[k],d))return!1;return!0}var n,o=a("type-detect");try{n=a("buffer").Buffer}catch(p){n={},n.isBuffer=function(){return!1}}b.exports=c},{buffer:10,"type-detect":47}],47:[function(a,b){b.exports=a("./lib/type")},{"./lib/type":48}],48:[function(a,b,c){function d(a){var b=Object.prototype.toString.call(a);return f[b]?f[b]:null===a?"null":void 0===a?"undefined":a===Object(a)?"object":typeof a}function e(){this.tests={}}var c=b.exports=d,f={"[object Array]":"array","[object RegExp]":"regexp","[object Function]":"function","[object Arguments]":"arguments","[object Date]":"date"};c.Library=e,e.prototype.of=d,e.prototype.define=function(a,b){return 1===arguments.length?this.tests[a]:(this.tests[a]=b,this)},e.prototype.test=function(a,b){if(b===d(a))return!0;var c=this.tests[b];if(c&&"regexp"===d(c))return c.test(a);if(c&&"function"===d(c))return c(a);throw new ReferenceError('Type test "'+b+'" not defined or invalid.')}},{}],49:[function(a,b,c){!function(d){"use strict";"function"==typeof a&&"object"==typeof c&&"object"==typeof b?b.exports=d:"function"==typeof define&&define.amd?define(function(){return d}):chai.use(d)}(function(a,b){"use strict";function c(a){return"function"==typeof a&&"function"==typeof a.getCall&&"function"==typeof a.calledWithExactly}function d(a){return 1===a?"once":2===a?"twice":3===a?"thrice":(a||0)+" times"}function e(a){return a&&c(a.proxy)}function f(a){if(!c(a._obj)&&!e(a._obj))throw new TypeError(b.inspect(a._obj)+" is not a spy or a call to a spy!")}function g(a,b,d,e,f){function g(b){return a.printf.apply(a,b)}var h=e?"always have ":"have ";return d=d||"",c(a.proxy)&&(a=a.proxy),{affirmative:g(["expected %n to "+h+b+d].concat(f)),negative:g(["expected %n to not "+h+b].concat(f))}}function h(c,d,e){b.addProperty(a.Assertion.prototype,c,function(){f(this);var a=g(this._obj,d,e,!1);this.assert(this._obj[c],a.affirmative,a.negative)})}function i(c,e,h){b.addMethod(a.Assertion.prototype,c,function(a){f(this);var b=g(this._obj,e,h,!1,[d(a)]);this.assert(this._obj[c]===a,b.affirmative,b.negative)})}function j(a,c,d){return function(){f(this);var e="always"+a[0].toUpperCase()+a.substring(1),h=b.flag(this,"always")&&"function"==typeof this._obj[e],i=h?e:a,j=g(this._obj,c,d,h,n.call(arguments));this.assert(this._obj[i].apply(this._obj,arguments),j.affirmative,j.negative)}}function k(c,d,e){var f=j(c,d,e);b.addProperty(a.Assertion.prototype,c,f)}function l(c,d,e,f){var g=j(d,e,f);b.addMethod(a.Assertion.prototype,c,g)}function m(a,b,c){l(a,a,b,c)}var n=Array.prototype.slice;b.addProperty(a.Assertion.prototype,"always",function(){b.flag(this,"always",!0)}),h("called","been called"," at least once, but it was never called"),i("callCount","been called exactly %1",", but it was called %c%C"),h("calledOnce","been called exactly once",", but it was called %c%C"),h("calledTwice","been called exactly twice",", but it was called %c%C"),h("calledThrice","been called exactly thrice",", but it was called %c%C"),k("calledWithNew","been called with new"),m("calledBefore","been called before %1"),m("calledAfter","been called after %1"),m("calledOn","been called with %1 as this",", but it was called with %t instead"),m("calledWith","been called with arguments %*","%C"),m("calledWithExactly","been called with exact arguments %*","%C"),m("calledWithMatch","been called with arguments matching %*","%C"),m("returned","returned %1"),l("thrown","threw","thrown %1")})},{}],50:[function(a,b,c){"use strict";!function(d){function e(a){var b=!1;try{a.appendChild(l),b=l.parentNode==a}catch(c){return!1}finally{try{a.removeChild(l)}catch(c){}}return b}function f(a){return l&&a&&1===a.nodeType&&e(a)}function g(a){return"function"==typeof a||!!(a&&a.constructor&&a.call&&a.apply)}function h(a){return"number"==typeof a&&isNaN(a)}function i(a,b){for(var c in b)m.call(a,c)||(a[c]=b[c])}function j(a){return"function"==typeof a&&"function"==typeof a.restore&&a.restore.sinon}function k(a,b,c){c.exports=n,n.spy=a("./sinon/spy"),n.spyCall=a("./sinon/call"),n.behavior=a("./sinon/behavior"),n.stub=a("./sinon/stub"),n.mock=a("./sinon/mock"),n.collection=a("./sinon/collection"),n.assert=a("./sinon/assert"),n.sandbox=a("./sinon/sandbox"),n.test=a("./sinon/test"),n.testCase=a("./sinon/test_case"),n.match=a("./sinon/match")}var l="undefined"!=typeof document&&document.createElement("div"),m=Object.prototype.hasOwnProperty,n={wrapMethod:function(a,b,c){if(!a)throw new TypeError("Should wrap property of object");if("function"!=typeof c)throw new TypeError("Method wrapper should be function");var d,e=a[b];if(g(e)){if(e.restore&&e.restore.sinon)d=new TypeError("Attempted to wrap "+b+" which is already wrapped");else if(e.calledBefore){var f=e.returns?"stubbed":"spied on";d=new TypeError("Attempted to wrap "+b+" which is already "+f)}}else d=new TypeError("Attempted to wrap "+typeof e+" property "+b+" as function");if(d)throw e&&e._stack&&(d.stack+="\n--------------\n"+e._stack),d;var h=a.hasOwnProperty?a.hasOwnProperty(b):m.call(a,b);return a[b]=c,c.displayName=b,c._stack=new Error("Stack Trace for original").stack,c.restore=function(){h||delete a[b],a[b]===c&&(a[b]=e)},c.restore.sinon=!0,i(c,e),c},extend:function(a){for(var b=1,c=arguments.length;c>b;b+=1)for(var d in arguments[b])arguments[b].hasOwnProperty(d)&&(a[d]=arguments[b][d]),arguments[b].hasOwnProperty("toString")&&arguments[b].toString!=a.toString&&(a.toString=arguments[b].toString);return a},create:function(a){var b=function(){};return b.prototype=a,new b},deepEqual:function t(a,b){if(n.match&&n.match.isMatcher(a))return a.test(b);if("object"!=typeof a||"object"!=typeof b)return h(a)&&h(b)?!0:a===b;if(f(a)||f(b))return a===b;if(a===b)return!0;if(null===a&&null!==b||null!==a&&null===b)return!1;if(a instanceof RegExp&&b instanceof RegExp)return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;var c=Object.prototype.toString.call(a);if(c!=Object.prototype.toString.call(b))return!1;if("[object Date]"==c)return a.valueOf()===b.valueOf();var d,e=0,g=0;if("[object Array]"==c&&a.length!==b.length)return!1;for(d in a){if(e+=1,!(d in b))return!1;if(!t(a[d],b[d]))return!1}for(d in b)g+=1;return e==g},functionName:function(a){var b=a.displayName||a.name;if(!b){var c=a.toString().match(/function ([^\s\(]+)/);b=c&&c[1]}return b},functionToString:function(){if(this.getCall&&this.callCount)for(var a,b,c=this.callCount;c--;){a=this.getCall(c).thisValue;for(b in a)if(a[b]===this)return b}return this.displayName||"sinon fake"},getConfig:function(a){var b={};a=a||{};var c=n.defaultConfig;for(var d in c)c.hasOwnProperty(d)&&(b[d]=a.hasOwnProperty(d)?a[d]:c[d]);return b},format:function(a){return""+a},defaultConfig:{injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},timesInWords:function(a){return 1==a&&"once"||2==a&&"twice"||3==a&&"thrice"||(a||0)+" times"},calledInOrder:function(a){for(var b=1,c=a.length;c>b;b++)if(!a[b-1].calledBefore(a[b])||!a[b].called)return!1;return!0},orderByFirstCall:function(a){return a.sort(function(a,b){var c=a.getCall(0),d=b.getCall(0),e=c&&c.callId||-1,f=d&&d.callId||-1;return f>e?-1:1})},log:function(){},logError:function(a,b){var c=a+" threw exception: ";n.log(c+"["+b.name+"] "+b.message),b.stack&&n.log(b.stack),setTimeout(function(){throw b.message=c+b.message,b},0)},typeOf:function(a){if(null===a)return"null";if(void 0===a)return"undefined";var b=Object.prototype.toString.call(a);return b.substring(8,b.length-1).toLowerCase()},createStubInstance:function(a){if("function"!=typeof a)throw new TypeError("The constructor should be a function.");return n.stub(n.create(a.prototype))},restore:function(a){if(null!==a&&"object"==typeof a)for(var b in a)j(a[b])&&a[b].restore();else j(a)&&a.restore()}},o="undefined"!=typeof b&&b.exports&&"function"==typeof a,p="function"==typeof define&&"object"==typeof define.amd&&define.amd;if(p)define(k);else if(o){try{d=a("formatio")}catch(q){}k(a,c,b)}if(d){var r=d.configure({quoteStrings:!1});n.format=function(){return r.ascii.apply(r,arguments)}}else if(o)try{var s=a("util");n.format=function(a){return"object"==typeof a&&a.toString===Object.prototype.toString?s.inspect(a):a}}catch(q){}return n}("object"==typeof formatio&&formatio)},{"./sinon/assert":51,"./sinon/behavior":52,"./sinon/call":53,"./sinon/collection":54,"./sinon/match":55,"./sinon/mock":56,"./sinon/sandbox":57,"./sinon/spy":58,"./sinon/stub":59,"./sinon/test":60,"./sinon/test_case":61,formatio:63,util:16}],51:[function(a,b){(function(c){"use strict";!function(c,d){function e(){for(var a,b=0,c=arguments.length;c>b;++b)a=arguments[b],a||i.fail("fake is not a spy"),"function"!=typeof a&&i.fail(a+" is not a function"),"function"!=typeof a.getCall&&i.fail(a+" is not stubbed")}function f(a,b){a=a||d;var c=a.fail||i.fail;c.call(a,b)}function g(a,b,c){2==arguments.length&&(c=b,b=a),i[a]=function(d){e(d);var g=k.call(arguments,1),h=!1;h="function"==typeof b?!b(d):"function"==typeof d[b]?!d[b].apply(d,g):!d[b],h?f(this,d.printf.apply(d,[c].concat(g))):i.pass(a)}}function h(a,b){return!a||/^fail/.test(b)?b:a+b.slice(0,1).toUpperCase()+b.slice(1)}var i,j="undefined"!=typeof b&&b.exports&&"function"==typeof a,k=Array.prototype.slice;!c&&j&&(c=a("../sinon")),c&&(i={failException:"AssertError",fail:function(a){var b=new Error(a);throw b.name=this.failException||i.failException,b},pass:function(){},callOrder:function(){e.apply(null,arguments);var a="",b="";if(c.calledInOrder(arguments))i.pass("callOrder");else{try{a=[].join.call(arguments,", ");for(var d=k.call(arguments),g=d.length;g;)d[--g].called||d.splice(g,1);b=c.orderByFirstCall(d).join(", ")}catch(h){}f(this,"expected "+a+" to be called in order but were called as "+b)}},callCount:function(a,b){if(e(a),a.callCount!=b){var d="expected %n to be called "+c.timesInWords(b)+" but was called %c%C";f(this,a.printf(d))}else i.pass("callCount")},expose:function(a,b){if(!a)throw new TypeError("target is null or undefined");var c=b||{},d="undefined"==typeof c.prefix&&"assert"||c.prefix,e="undefined"==typeof c.includeFail||!!c.includeFail;for(var f in this)"export"==f||!e&&/^(fail)/.test(f)||(a[h(d,f)]=this[f]);return a},match:function(a,b){var d=c.match(b);if(d.test(a))i.pass("match");else{var e=["expected value to match"," expected = "+c.format(b)," actual = "+c.format(a)];f(this,e.join("\n"))}}},g("called","expected %n to have been called at least once but was never called"),g("notCalled",function(a){return!a.called},"expected %n to not have been called but was called %c%C"),g("calledOnce","expected %n to be called once but was called %c%C"),g("calledTwice","expected %n to be called twice but was called %c%C"),g("calledThrice","expected %n to be called thrice but was called %c%C"),g("calledOn","expected %n to be called with %1 as this but was called with %t"),g("alwaysCalledOn","expected %n to always be called with %1 as this but was called with %t"),g("calledWithNew","expected %n to be called with new"),g("alwaysCalledWithNew","expected %n to always be called with new"),g("calledWith","expected %n to be called with arguments %*%C"),g("calledWithMatch","expected %n to be called with match %*%C"),g("alwaysCalledWith","expected %n to always be called with arguments %*%C"),g("alwaysCalledWithMatch","expected %n to always be called with match %*%C"),g("calledWithExactly","expected %n to be called with exact arguments %*%C"),g("alwaysCalledWithExactly","expected %n to always be called with exact arguments %*%C"),g("neverCalledWith","expected %n to never be called with arguments %*%C"),g("neverCalledWithMatch","expected %n to never be called with match %*%C"),g("threw","%n did not throw exception%C"),g("alwaysThrew","%n did not always throw exception%C"),c.assert=i,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=i}):j&&(b.exports=i))}("object"==typeof sinon&&sinon||null,"undefined"!=typeof window?window:"undefined"!=typeof self?self:c)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../sinon":50}],52:[function(a,b){(function(c){"use strict";!function(d){function e(a,b){return"string"==typeof a?(this.exception=new Error(b||""),this.exception.name=a):this.exception=a?a:new Error("Error"),this}function f(a,b){var c=a.callArgAt;if(0>c){for(var d=a.callArgProp,e=0,f=b.length;f>e;++e){if(!d&&"function"==typeof b[e])return b[e];if(d&&b[e]&&"function"==typeof b[e][d])return b[e][d]}return null}return b[c]}function g(a,b,c){if(a.callArgAt<0){var e;return e=a.callArgProp?d.functionName(a.stub)+" expected to yield to '"+a.callArgProp+"', but no object with such a property was passed.":d.functionName(a.stub)+" expected to yield, but no callback was passed.",c.length>0&&(e+=" Received ["+l.call(c,", ")+"]"),e}return"argument at index "+a.callArgAt+" is not a function: "+b}function h(a,b){if("number"==typeof a.callArgAt){var c=f(a,b);if("function"!=typeof c)throw new TypeError(g(a,c,b));a.callbackAsync?m(function(){c.apply(a.callbackContext,a.callbackArguments)}):c.apply(a.callbackContext,a.callbackArguments)}}var i="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!d&&i&&(d=a("../sinon")),d){var j,k=Array.prototype.slice,l=Array.prototype.join,m=function(){return"object"==typeof c&&"function"==typeof c.nextTick?c.nextTick:"function"==typeof setImmediate?setImmediate:function(a){setTimeout(a,0)}}();j={create:function(a){var b=d.extend({},d.behavior);return delete b.create,b.stub=a,b},isPresent:function(){return"number"==typeof this.callArgAt||this.exception||"number"==typeof this.returnArgAt||this.returnThis||this.returnValueDefined},invoke:function(a,b){if(h(this,b),this.exception)throw this.exception;return"number"==typeof this.returnArgAt?b[this.returnArgAt]:this.returnThis?a:this.returnValue},onCall:function(a){return this.stub.onCall(a)},onFirstCall:function(){return this.stub.onFirstCall()},onSecondCall:function(){return this.stub.onSecondCall()},onThirdCall:function(){return this.stub.onThirdCall()},withArgs:function(){throw new Error('Defining a stub by invoking "stub.onCall(...).withArgs(...)" is not supported. Use "stub.withArgs(...).onCall(...)" to define sequential behavior for calls with certain arguments.')},callsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOn:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=[],this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgWith:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.callArgAt=a,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},callsArgOnWith:function(a,b){if("number"!=typeof a)throw new TypeError("argument index is not number");if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=a,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=void 0,this.callbackAsync=!1,this},yields:function(){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,0),this.callbackContext=void 0,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsOn:function(a){if("object"!=typeof a)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=a,this.callArgProp=void 0,this.callbackAsync=!1,this},yieldsTo:function(a){return this.callArgAt=-1,this.callbackArguments=k.call(arguments,1),this.callbackContext=void 0,this.callArgProp=a,this.callbackAsync=!1,this},yieldsToOn:function(a,b){if("object"!=typeof b)throw new TypeError("argument context is not an object");return this.callArgAt=-1,this.callbackArguments=k.call(arguments,2),this.callbackContext=b,this.callArgProp=a,this.callbackAsync=!1,this},"throws":e,throwsException:e,returns:function(a){return this.returnValue=a,this.returnValueDefined=!0,this},returnsArg:function(a){if("number"!=typeof a)throw new TypeError("argument index is not number");return this.returnArgAt=a,this},returnsThis:function(){return this.returnThis=!0,this}};for(var n in j)j.hasOwnProperty(n)&&n.match(/^(callsArg|yields)/)&&!n.match(/Async/)&&(j[n+"Async"]=function(a){return function(){var b=this[a].apply(this,arguments);return this.callbackAsync=!0,b}}(n));d.behavior=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):i&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)}).call(this,a("FWaASH"))},{"../sinon":50,FWaASH:14}],53:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.functionName(a)+b;throw d.length&&(e+=" Received ["+g.call(d).join(", ")+"]"),new Error(e)}function e(a,b,d,e,f,g){if("number"!=typeof g)throw new TypeError("Call id is not a number");var i=c.create(h);return i.proxy=a,i.thisValue=b,i.args=d,i.returnValue=e,i.exception=f,i.callId=g,i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&f&&(c=a("../sinon")),c){var g=Array.prototype.slice,h={calledOn:function(a){return c.match&&c.match.isMatcher(a)?a.test(this.thisValue):this.thisValue===a},calledWith:function(){for(var a=0,b=arguments.length;b>a;a+=1)if(!c.deepEqual(arguments[a],this.args[a]))return!1;return!0},calledWithMatch:function(){for(var a=0,b=arguments.length;b>a;a+=1){var d=this.args[a],e=arguments[a];if(!c.match||!c.match(e).test(d))return!1}return!0},calledWithExactly:function(){return arguments.length==this.args.length&&this.calledWith.apply(this,arguments)},notCalledWith:function(){return!this.calledWith.apply(this,arguments)},notCalledWithMatch:function(){return!this.calledWithMatch.apply(this,arguments)},returned:function(a){return c.deepEqual(a,this.returnValue)},threw:function(a){return"undefined"!=typeof a&&this.exception?this.exception===a||this.exception.name===a:!!this.exception},calledWithNew:function(){return this.proxy.prototype&&this.thisValue instanceof this.proxy},calledBefore:function(a){return this.callId<a.callId},calledAfter:function(a){return this.callId>a.callId},callArg:function(a){this.args[a]()},callArgOn:function(a,b){this.args[a].apply(b)},callArgWith:function(a){this.callArgOnWith.apply(this,[a,null].concat(g.call(arguments,1)))},callArgOnWith:function(a,b){var c=g.call(arguments,2);this.args[a].apply(b,c)},"yield":function(){this.yieldOn.apply(this,[null].concat(g.call(arguments,0)))},yieldOn:function(a){for(var b=this.args,c=0,e=b.length;e>c;++c)if("function"==typeof b[c])return void b[c].apply(a,g.call(arguments,1));d(this.proxy," cannot yield since no callback was passed.",b)},yieldTo:function(a){this.yieldToOn.apply(this,[a,null].concat(g.call(arguments,1)))},yieldToOn:function(a,b){for(var c=this.args,e=0,f=c.length;f>e;++e)if(c[e]&&"function"==typeof c[e][a])return void c[e][a].apply(b,g.call(arguments,2));d(this.proxy," cannot yield to '"+a+"' since no callback was passed.",c)},toString:function(){for(var a=this.proxy.toString()+"(",b=[],d=0,e=this.args.length;e>d;++d)b.push(c.format(this.args[d]));return a=a+b.join(", ")+")","undefined"!=typeof this.returnValue&&(a+=" => "+c.format(this.returnValue)),this.exception&&(a+=" !"+this.exception.name,this.exception.message&&(a+="("+this.exception.message+")")),a}};h.invokeCallback=h.yield,e.toString=h.toString,c.spyCall=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],54:[function(a,b){"use strict";!function(c){function d(a){return a.fakes||(a.fakes=[]),a.fakes}function e(a,b){for(var c=d(a),e=0,f=c.length;f>e;e+=1)"function"==typeof c[e][b]&&c[e][b]()}function f(a){for(var b=d(a),c=0;c<b.length;)b.splice(c,1)}var g="undefined"!=typeof b&&b.exports&&"function"==typeof a,h=[].push,i=Object.prototype.hasOwnProperty;if(!c&&g&&(c=a("../sinon")),c){var j={verify:function(){e(this,"verify")},restore:function(){e(this,"restore"),f(this)},verifyAndRestore:function(){var a;try{this.verify()}catch(b){a=b}if(this.restore(),a)throw a},add:function(a){return h.call(d(this),a),a},spy:function(){return this.add(c.spy.apply(c,arguments))},stub:function(a,b,d){if(b){var e=a[b];if("function"!=typeof e){if(!i.call(a,b))throw new TypeError("Cannot stub non-existent own property "+b);return a[b]=d,this.add({restore:function(){a[b]=e}})}}if(!b&&a&&"object"==typeof a){var f=c.stub.apply(c,arguments);for(var g in f)"function"==typeof f[g]&&this.add(f[g]);return f}return this.add(c.stub.apply(c,arguments))},mock:function(){return this.add(c.mock.apply(c,arguments))},inject:function(a){var b=this;return a.spy=function(){return b.spy.apply(b,arguments)},a.stub=function(){return b.stub.apply(b,arguments)},a.mock=function(){return b.mock.apply(b,arguments)},a}};c.collection=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):g&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],55:[function(a,b){"use strict";!function(c){function d(a,b,d){var e=c.typeOf(a);if(e!==b)throw new TypeError("Expected type of "+d+" to be "+b+", but was "+e)}function e(a){return i.isPrototypeOf(a)}function f(a,b){if(null===b||void 0===b)return!1;for(var d in a)if(a.hasOwnProperty(d)){var e=a[d],g=b[d];if(j.isMatcher(e)){if(!e.test(g))return!1}else if("object"===c.typeOf(e)){if(!f(e,g))return!1}else if(!c.deepEqual(e,g))return!1}return!0}function g(a,b){return function(e,f){d(e,"string","property");var g=1===arguments.length,h=b+'("'+e+'"';return g||(h+=", "+f),h+=")",j(function(b){return void 0!==b&&null!==b&&a(b,e)?g||c.deepEqual(f,b[e]):!1},h)}}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i={toString:function(){return this.message}};i.or=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)||a.test(c)},d.message=b.message+".or("+a.message+")",d},i.and=function(a){if(!arguments.length)throw new TypeError("Matcher expected");e(a)||(a=j(a));var b=this,d=c.create(i);return d.test=function(c){return b.test(c)&&a.test(c)},d.message=b.message+".and("+a.message+")",d};var j=function(a,b){var d=c.create(i),e=c.typeOf(a);switch(e){case"object":if("function"==typeof a.test)return d.test=function(b){return a.test(b)===!0},d.message="match("+c.functionName(a.test)+")",d;var g=[];for(var h in a)a.hasOwnProperty(h)&&g.push(h+": "+a[h]);d.test=function(b){return f(a,b)},d.message="match("+g.join(", ")+")";break;case"number":d.test=function(b){return a==b};break;case"string":d.test=function(b){return"string"!=typeof b?!1:-1!==b.indexOf(a)},d.message='match("'+a+'")';break;case"regexp":d.test=function(b){return"string"!=typeof b?!1:a.test(b)};break;case"function":d.test=a,d.message=b?b:"match("+c.functionName(a)+")";break;default:d.test=function(b){return c.deepEqual(a,b)}}return d.message||(d.message="match("+a+")"),d};j.isMatcher=e,j.any=j(function(){return!0},"any"),j.defined=j(function(a){return null!==a&&void 0!==a},"defined"),j.truthy=j(function(a){return!!a},"truthy"),j.falsy=j(function(a){return!a},"falsy"),j.same=function(a){return j(function(b){return a===b},"same("+a+")")},j.typeOf=function(a){return d(a,"string","type"),j(function(b){return c.typeOf(b)===a},'typeOf("'+a+'")')},j.instanceOf=function(a){return d(a,"function","type"),j(function(b){return b instanceof a},"instanceOf("+c.functionName(a)+")")},j.has=g(function(a,b){return"object"==typeof a?b in a:void 0!==a[b]},"has"),j.hasOwn=g(function(a,b){return a.hasOwnProperty(b)},"hasOwn"),j.bool=j.typeOf("boolean"),j.number=j.typeOf("number"),j.string=j.typeOf("string"),j.object=j.typeOf("object"),j.func=j.typeOf("function"),j.array=j.typeOf("array"),j.regexp=j.typeOf("regexp"),j.date=j.typeOf("date"),c.match=j,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=j}):h&&(b.exports=j)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],56:[function(a,b){"use strict";
|
||
!function(c){function d(a){return a?d.create(a):c.expectation.create("Anonymous mock")}var e,f="undefined"!=typeof b&&b.exports&&"function"==typeof a,g=[].push;if(!c&&f&&(c=a("../sinon")),c){e=c.match,!e&&f&&(e=a("./match")),c.mock=d,c.extend(d,function(){function a(a,b){if(a)for(var c=0,d=a.length;d>c;c+=1)b(a[c])}return{create:function(a){if(!a)throw new TypeError("object is null");var b=c.extend({},d);return b.object=a,delete b.create,b},expects:function(a){if(!a)throw new TypeError("method is falsy");if(this.expectations||(this.expectations={},this.proxies=[]),!this.expectations[a]){this.expectations[a]=[];var b=this;c.wrapMethod(this.object,a,function(){return b.invokeMethod(a,this,arguments)}),g.call(this.proxies,a)}var d=c.expectation.create(a);return g.call(this.expectations[a],d),d},restore:function(){var b=this.object;a(this.proxies,function(a){"function"==typeof b[a].restore&&b[a].restore()})},verify:function(){var b=this.expectations||{},d=[],e=[];return a(this.proxies,function(c){a(b[c],function(a){a.met()?g.call(e,a.toString()):g.call(d,a.toString())})}),this.restore(),d.length>0?c.expectation.fail(d.concat(e).join("\n")):c.expectation.pass(d.concat(e).join("\n")),!0},invokeMethod:function(a,b,d){var e,f=this.expectations&&this.expectations[a],h=f&&f.length||0;for(e=0;h>e;e+=1)if(!f[e].met()&&f[e].allowsCall(b,d))return f[e].apply(b,d);var i,j=[],k=0;for(e=0;h>e;e+=1)f[e].allowsCall(b,d)?i=i||f[e]:k+=1,g.call(j," "+f[e].toString());return 0===k?i.apply(b,d):(j.unshift("Unexpected call: "+c.spyCall.toString.call({proxy:a,args:d})),void c.expectation.fail(j.join("\n")))}}}());var h=c.timesInWords;c.expectation=function(){function a(a){return 0==a?"never called":"called "+h(a)}function b(a){var b=a.minCalls,c=a.maxCalls;if("number"==typeof b&&"number"==typeof c){var d=h(b);return b!=c&&(d="at least "+d+" and at most "+h(c)),d}return"number"==typeof b?"at least "+h(b):"at most "+h(c)}function d(a){var b="number"==typeof a.minCalls;return!b||a.callCount>=a.minCalls}function f(a){return"number"!=typeof a.maxCalls?!1:a.callCount==a.maxCalls}function i(a,b){return e&&e.isMatcher(a)?a.test(b):!0}var j=Array.prototype.slice,k=c.spy.invoke;return{minCalls:1,maxCalls:1,create:function(a){var b=c.extend(c.stub.create(),c.expectation);return delete b.create,b.method=a,b},invoke:function(a,b,c){return this.verifyCallAllowed(b,c),k.apply(this,arguments)},atLeast:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");return this.limitsSet||(this.maxCalls=null,this.limitsSet=!0),this.minCalls=a,this},atMost:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not number");return this.limitsSet||(this.minCalls=null,this.limitsSet=!0),this.maxCalls=a,this},never:function(){return this.exactly(0)},once:function(){return this.exactly(1)},twice:function(){return this.exactly(2)},thrice:function(){return this.exactly(3)},exactly:function(a){if("number"!=typeof a)throw new TypeError("'"+a+"' is not a number");return this.atLeast(a),this.atMost(a)},met:function(){return!this.failed&&d(this)},verifyCallAllowed:function(a,b){if(f(this)&&(this.failed=!0,c.expectation.fail(this.method+" already called "+h(this.maxCalls))),"expectedThis"in this&&this.expectedThis!==a&&c.expectation.fail(this.method+" called with "+a+" as thisValue, expected "+this.expectedThis),"expectedArguments"in this){b||c.expectation.fail(this.method+" received no arguments, expected "+c.format(this.expectedArguments)),b.length<this.expectedArguments.length&&c.expectation.fail(this.method+" received too few arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments)),this.expectsExactArgCount&&b.length!=this.expectedArguments.length&&c.expectation.fail(this.method+" received too many arguments ("+c.format(b)+"), expected "+c.format(this.expectedArguments));for(var d=0,e=this.expectedArguments.length;e>d;d+=1)i(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", didn't match "+this.expectedArguments.toString()),c.deepEqual(this.expectedArguments[d],b[d])||c.expectation.fail(this.method+" received wrong arguments "+c.format(b)+", expected "+c.format(this.expectedArguments))}},allowsCall:function(a,b){if(this.met()&&f(this))return!1;if("expectedThis"in this&&this.expectedThis!==a)return!1;if(!("expectedArguments"in this))return!0;if(b=b||[],b.length<this.expectedArguments.length)return!1;if(this.expectsExactArgCount&&b.length!=this.expectedArguments.length)return!1;for(var d=0,e=this.expectedArguments.length;e>d;d+=1){if(!i(this.expectedArguments[d],b[d]))return!1;if(!c.deepEqual(this.expectedArguments[d],b[d]))return!1}return!0},withArgs:function(){return this.expectedArguments=j.call(arguments),this},withExactArgs:function(){return this.withArgs.apply(this,arguments),this.expectsExactArgCount=!0,this},on:function(a){return this.expectedThis=a,this},toString:function(){var d=(this.expectedArguments||[]).slice();this.expectsExactArgCount||g.call(d,"[...]");var e=c.spyCall.toString.call({proxy:this.method||"anonymous mock expectation",args:d}),f=e.replace(", [...","[, ...")+" "+b(this);return this.met()?"Expectation met: "+f:"Expected "+f+" ("+a(this.callCount)+")"},verify:function(){return this.met()?c.expectation.pass(this.toString()):c.expectation.fail(this.toString()),!0},pass:function(a){c.assert.pass(a)},fail:function(a){var b=new Error(a);throw b.name="ExpectationError",b}}}(),c.mock=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):f&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50,"./match":55}],57:[function(a,b){"use strict";if("undefined"!=typeof b&&b.exports&&"function"==typeof a){var c=a("../sinon");c.extend(c,a("./util/fake_timers"))}!function(){function a(a,b,c,d){d&&(!b.injectInto||c in b.injectInto?e.call(a.args,d):(b.injectInto[c]=d,a.injectedKeys.push(c)))}function d(a){var b=c.create(c.sandbox);return a.useFakeServer&&("object"==typeof a.useFakeServer&&(b.serverPrototype=a.useFakeServer),b.useFakeServer()),a.useFakeTimers&&("object"==typeof a.useFakeTimers?b.useFakeTimers.apply(b,a.useFakeTimers):b.useFakeTimers()),b}var e=[].push;c.sandbox=c.extend(c.create(c.collection),{useFakeTimers:function(){return this.clock=c.useFakeTimers.apply(c,arguments),this.add(this.clock)},serverPrototype:c.fakeServer,useFakeServer:function(){var a=this.serverPrototype||c.fakeServer;return a&&a.create?(this.server=a.create(),this.add(this.server)):null},inject:function(a){return c.collection.inject.call(this,a),this.clock&&(a.clock=this.clock),this.server&&(a.server=this.server,a.requests=this.server.requests),a},restore:function(){c.collection.restore.apply(this,arguments),this.restoreContext()},restoreContext:function(){if(this.injectedKeys){for(var a=0,b=this.injectedKeys.length;b>a;a++)delete this.injectInto[this.injectedKeys[a]];this.injectedKeys=[]}},create:function(b){if(!b)return c.create(c.sandbox);var e=d(b);e.args=e.args||[],e.injectedKeys=[],e.injectInto=b.injectInto;var f,g,h=e.inject({});if(b.properties)for(var i=0,j=b.properties.length;j>i;i++)f=b.properties[i],g=h[f]||"sandbox"==f&&e,a(e,b,f,g);else a(e,b,"sandbox",g);return e}}),c.sandbox.useFakeXMLHttpRequest=c.sandbox.useFakeServer,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=c.sandbox}):"undefined"!=typeof b&&b.exports&&(b.exports=c.sandbox)}()},{"../sinon":50,"./util/fake_timers":62}],58:[function(require,module,exports){"use strict";!function(sinon){function spy(a,b){if(!b&&"function"==typeof a)return spy.create(a);if(!a&&!b)return spy.create(function(){});var c=a[b];return sinon.wrapMethod(a,b,spy.create(c))}function matchingFake(a,b,c){if(a)for(var d=0,e=a.length;e>d;d++)if(a[d].matches(b,c))return a[d]}function incrementCallCount(){this.called=!0,this.callCount+=1,this.notCalled=!1,this.calledOnce=1==this.callCount,this.calledTwice=2==this.callCount,this.calledThrice=3==this.callCount}function createCallProperties(){this.firstCall=this.getCall(0),this.secondCall=this.getCall(1),this.thirdCall=this.getCall(2),this.lastCall=this.getCall(this.callCount-1)}function createProxy(func){var p;return func.length?eval("p = (function proxy("+vars.substring(0,2*func.length-1)+") { return p.invoke(func, this, slice.call(arguments)); });"):p=function(){return p.invoke(func,this,slice.call(arguments))},p}function delegateToCalls(a,b,c,d){spyApi[a]=function(){if(!this.called)return d?d.apply(this,arguments):!1;for(var e,f=0,g=0,h=this.callCount;h>g;g+=1)if(e=this.getCall(g),e[c||a].apply(e,arguments)&&(f+=1,b))return!0;return f===this.callCount}}var commonJSModule="undefined"!=typeof module&&module.exports&&"function"==typeof require,push=Array.prototype.push,slice=Array.prototype.slice,callId=0;if(!sinon&&commonJSModule&&(sinon=require("../sinon")),sinon){var vars="a,b,c,d,e,f,g,h,i,j,k,l",uuid=0,spyApi={reset:function(){if(this.called=!1,this.notCalled=!0,this.calledOnce=!1,this.calledTwice=!1,this.calledThrice=!1,this.callCount=0,this.firstCall=null,this.secondCall=null,this.thirdCall=null,this.lastCall=null,this.args=[],this.returnValues=[],this.thisValues=[],this.exceptions=[],this.callIds=[],this.fakes)for(var a=0;a<this.fakes.length;a++)this.fakes[a].reset()},create:function(a){var b;"function"!=typeof a?a=function(){}:b=sinon.functionName(a);var c=createProxy(a);return sinon.extend(c,spy),delete c.create,sinon.extend(c,a),c.reset(),c.prototype=a.prototype,c.displayName=b||"spy",c.toString=sinon.functionToString,c._create=sinon.spy.create,c.id="spy#"+uuid++,c},invoke:function(a,b,c){var d,e,f=matchingFake(this.fakes,c);incrementCallCount.call(this),push.call(this.thisValues,b),push.call(this.args,c),push.call(this.callIds,callId++),createCallProperties.call(this);try{e=f?f.invoke(a,b,c):(this.func||a).apply(b,c);var g=this.getCall(this.callCount-1);g.calledWithNew()&&"object"!=typeof e&&(e=b)}catch(h){d=h}if(push.call(this.exceptions,d),push.call(this.returnValues,e),createCallProperties.call(this),void 0!==d)throw d;return e},named:function(a){return this.displayName=a,this},getCall:function(a){return 0>a||a>=this.callCount?null:sinon.spyCall(this,this.thisValues[a],this.args[a],this.returnValues[a],this.exceptions[a],this.callIds[a])},getCalls:function(){var a,b=[];for(a=0;a<this.callCount;a++)b.push(this.getCall(a));return b},calledBefore:function(a){return this.called?a.called?this.callIds[0]<a.callIds[a.callIds.length-1]:!0:!1},calledAfter:function(a){return this.called&&a.called?this.callIds[this.callCount-1]>a.callIds[a.callCount-1]:!1},withArgs:function(){var a=slice.call(arguments);if(this.fakes){var b=matchingFake(this.fakes,a,!0);if(b)return b}else this.fakes=[];var c=this,d=this._create();d.matchingAguments=a,d.parent=this,push.call(this.fakes,d),d.withArgs=function(){return c.withArgs.apply(c,arguments)};for(var e=0;e<this.args.length;e++)d.matches(this.args[e])&&(incrementCallCount.call(d),push.call(d.thisValues,this.thisValues[e]),push.call(d.args,this.args[e]),push.call(d.returnValues,this.returnValues[e]),push.call(d.exceptions,this.exceptions[e]),push.call(d.callIds,this.callIds[e]));return createCallProperties.call(d),d},matches:function(a,b){var c=this.matchingAguments;return c.length<=a.length&&sinon.deepEqual(c,a.slice(0,c.length))?!b||c.length==a.length:void 0},printf:function(a){var b,c=this,d=slice.call(arguments,1);return(a||"").replace(/%(.)/g,function(a,e){return b=spyApi.formatters[e],"function"==typeof b?b.call(null,c,d):isNaN(parseInt(e,10))?"%"+e:sinon.format(d[e-1])})}};delegateToCalls("calledOn",!0),delegateToCalls("alwaysCalledOn",!1,"calledOn"),delegateToCalls("calledWith",!0),delegateToCalls("calledWithMatch",!0),delegateToCalls("alwaysCalledWith",!1,"calledWith"),delegateToCalls("alwaysCalledWithMatch",!1,"calledWithMatch"),delegateToCalls("calledWithExactly",!0),delegateToCalls("alwaysCalledWithExactly",!1,"calledWithExactly"),delegateToCalls("neverCalledWith",!1,"notCalledWith",function(){return!0}),delegateToCalls("neverCalledWithMatch",!1,"notCalledWithMatch",function(){return!0}),delegateToCalls("threw",!0),delegateToCalls("alwaysThrew",!1,"threw"),delegateToCalls("returned",!0),delegateToCalls("alwaysReturned",!1,"returned"),delegateToCalls("calledWithNew",!0),delegateToCalls("alwaysCalledWithNew",!1,"calledWithNew"),delegateToCalls("callArg",!1,"callArgWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")}),spyApi.callArgWith=spyApi.callArg,delegateToCalls("callArgOn",!1,"callArgOnWith",function(){throw new Error(this.toString()+" cannot call arg since it was not yet invoked.")}),spyApi.callArgOnWith=spyApi.callArgOn,delegateToCalls("yield",!1,"yield",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),spyApi.invokeCallback=spyApi.yield,delegateToCalls("yieldOn",!1,"yieldOn",function(){throw new Error(this.toString()+" cannot yield since it was not yet invoked.")}),delegateToCalls("yieldTo",!1,"yieldTo",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),delegateToCalls("yieldToOn",!1,"yieldToOn",function(a){throw new Error(this.toString()+" cannot yield to '"+a+"' since it was not yet invoked.")}),spyApi.formatters={c:function(a){return sinon.timesInWords(a.callCount)},n:function(a){return a.toString()},C:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c){var e=" "+a.getCall(c).toString();/\n/.test(b[c-1])&&(e="\n"+e),push.call(b,e)}return b.length>0?"\n"+b.join("\n"):""},t:function(a){for(var b=[],c=0,d=a.callCount;d>c;++c)push.call(b,sinon.format(a.thisValues[c]));return b.join(", ")},"*":function(a,b){for(var c=[],d=0,e=b.length;e>d;++d)push.call(c,sinon.format(b[d]));return c.join(", ")}},sinon.extend(spy,spyApi),spy.spyCall=sinon.spyCall,sinon.spy=spy,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=spy}):commonJSModule&&(module.exports=spy)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],59:[function(a,b){"use strict";!function(c){function d(a,b,e){if(e&&"function"!=typeof e)throw new TypeError("Custom stub should be function");var f;if(f=e?c.spy&&c.spy.create?c.spy.create(e):e:d.create(),!a&&"undefined"==typeof b)return c.stub.create();if("undefined"==typeof b&&"object"==typeof a){for(var g in a)"function"==typeof a[g]&&d(a,g);return a}return c.wrapMethod(a,b,f)}function e(a){return a.defaultBehavior||f(a)||c.behavior.create(a)}function f(a){return a.parent&&g(a.parent)}function g(a){var b=a.behaviors[a.callCount-1];return b&&b.isPresent()?b:e(a)}var h="undefined"!=typeof b&&b.exports&&"function"==typeof a;if(!c&&h&&(c=a("../sinon")),c){var i=0;c.extend(d,function(){var a={create:function(){var a=function(){return g(a).invoke(this,arguments)};a.id="stub#"+i++;var b=a;return a=c.spy.create(a),a.func=b,c.extend(a,d),a._create=c.stub.create,a.displayName="stub",a.toString=c.functionToString,a.defaultBehavior=null,a.behaviors=[],a},resetBehavior:function(){var a;if(this.defaultBehavior=null,this.behaviors=[],delete this.returnValue,delete this.returnArgAt,this.returnThis=!1,this.fakes)for(a=0;a<this.fakes.length;a++)this.fakes[a].resetBehavior()},onCall:function(a){return this.behaviors[a]||(this.behaviors[a]=c.behavior.create(this)),this.behaviors[a]},onFirstCall:function(){return this.onCall(0)},onSecondCall:function(){return this.onCall(1)},onThirdCall:function(){return this.onCall(2)}};for(var b in c.behavior)c.behavior.hasOwnProperty(b)&&!a.hasOwnProperty(b)&&"create"!=b&&"withArgs"!=b&&"invoke"!=b&&(a[b]=function(a){return function(){return this.defaultBehavior=this.defaultBehavior||c.behavior.create(this),this.defaultBehavior[a].apply(this.defaultBehavior,arguments),this}}(b));return a}()),c.stub=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):h&&(b.exports=d)}}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],60:[function(a,b){"use strict";!function(c){function d(a){function b(){var b=c.getConfig(c.config);b.injectInto=b.injectIntoThis&&this||b.injectInto;var d,e,f=c.sandbox.create(b),g=Array.prototype.slice.call(arguments).concat(f.args);try{e=a.apply(this,g)}catch(h){d=h}if("undefined"!=typeof d)throw f.restore(),d;return f.verifyAndRestore(),e}var d=typeof a;if("function"!=d)throw new TypeError("sinon.test needs to wrap a test function, got "+d);return a.length?function(){return b.apply(this,arguments)}:b}var e="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&e&&(c=a("../sinon")),c&&(d.config={injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},c.test=d,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=d}):e&&(b.exports=d))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],61:[function(a,b){"use strict";!function(c){function d(a,b,c){return function(){b&&b.apply(this,arguments);var d,e;try{e=a.apply(this,arguments)}catch(f){d=f}if(c&&c.apply(this,arguments),d)throw d;return e}}function e(a,b){if(!a||"object"!=typeof a)throw new TypeError("sinon.testCase needs an object with test functions");b=b||"test";var e,f,g,h=new RegExp("^"+b),i={},j=a.setUp,k=a.tearDown;for(e in a)if(a.hasOwnProperty(e)){if(f=a[e],/^(setUp|tearDown)$/.test(e))continue;"function"==typeof f&&h.test(e)?(g=f,(j||k)&&(g=d(f,j,k)),i[e]=c.test(g)):i[e]=a[e]}return i}var f="undefined"!=typeof b&&b.exports&&"function"==typeof a;!c&&f&&(c=a("../sinon")),c&&Object.prototype.hasOwnProperty&&(c.testCase=e,"function"==typeof define&&define.amd?define(["module"],function(a){a.exports=e}):f&&(b.exports=e))}("object"==typeof sinon&&sinon||null)},{"../sinon":50}],62:[function(require,module,exports){(function(global){"use strict";if("undefined"==typeof sinon)var sinon={};!function(global){function addTimer(a,b){if(0===a.length)throw new Error("Function requires at least 1 parameter");if("undefined"==typeof a[0])throw new Error("Callback must be provided to timer calls");var c=id++,d=a[1]||0;return this.timeouts||(this.timeouts={}),this.timeouts[c]={id:c,func:a[0],callAt:this.now+d,invokeArgs:Array.prototype.slice.call(a,2)},b===!0&&(this.timeouts[c].interval=d),addTimerReturnsObject?{id:c,ref:function(){},unref:function(){}}:c}function parseTime(a){if(!a)return 0;var b,c=a.split(":"),d=c.length,e=d,f=0;if(d>3||!/^(\d\d:){0,2}\d\d?$/.test(a))throw new Error("tick only understands numbers and 'h:m:s'");for(;e--;){if(b=parseInt(c[e],10),b>=60)throw new Error("Invalid time "+a);f+=b*Math.pow(60,d-e-1)}return 1e3*f}function createObject(a){var b;if(Object.create)b=Object.create(a);else{var c=function(){};c.prototype=a,b=new c}return b.Date.clock=b,b}function mirrorDateProperties(a,b){b.now?a.now=function(){return a.clock.now}:delete a.now,b.toSource?a.toSource=function(){return b.toSource()}:delete a.toSource,a.toString=function(){return b.toString()},a.prototype=b.prototype,a.parse=b.parse,a.UTC=b.UTC,a.prototype.toUTCString=b.prototype.toUTCString;for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function restore(){for(var a,b=0,c=this.methods.length;c>b;b++)if(a=this.methods[b],global[a].hadOwnProperty)global[a]=this["_"+a];else try{delete global[a]}catch(d){}this.methods=[]}function stubGlobal(a,b){if(b[a].hadOwnProperty=Object.prototype.hasOwnProperty.call(global,a),b["_"+a]=global[a],"Date"==a){var c=mirrorDateProperties(b[a],global[a]);global[a]=c}else{global[a]=function(){return b[a].apply(b,arguments)};for(var d in b[a])b[a].hasOwnProperty(d)&&(global[a][d]=b[a][d])}global[a].clock=b}var timeoutResult=setTimeout(function(){},0),addTimerReturnsObject="object"==typeof timeoutResult;clearTimeout(timeoutResult);var id=1;sinon.clock={now:0,create:function(a){var b=createObject(this);if("number"==typeof a&&(b.now=a),a&&"object"==typeof a)throw new TypeError("now should be milliseconds since UNIX epoch");return b},setTimeout:function(){return addTimer.call(this,arguments,!1)},clearTimeout:function(a){a&&(this.timeouts||(this.timeouts=[]),"object"==typeof a&&(a=a.id),a in this.timeouts&&delete this.timeouts[a])},setInterval:function(){return addTimer.call(this,arguments,!0)},clearInterval:function(a){this.clearTimeout(a)},setImmediate:function(a){var b=Array.prototype.slice.call(arguments,1);return addTimer.call(this,[a,0].concat(b),!1)},clearImmediate:function(a){this.clearTimeout(a)},tick:function(a){a="number"==typeof a?a:parseTime(a);for(var b,c=this.now,d=this.now+a,e=this.now,f=this.firstTimerInRange(c,d);f&&d>=c;){if(this.timeouts[f.id]){c=this.now=f.callAt;try{this.callTimer(f)}catch(g){b=b||g}}f=this.firstTimerInRange(e,d),e=c}if(this.now=d,b)throw b;return this.now},firstTimerInRange:function(a,b){var c,d,e=null;for(var f in this.timeouts)if(this.timeouts.hasOwnProperty(f)){if(this.timeouts[f].callAt<a||this.timeouts[f].callAt>b)continue;(null===e||this.timeouts[f].callAt<e)&&(d=this.timeouts[f],e=this.timeouts[f].callAt,c={func:this.timeouts[f].func,callAt:this.timeouts[f].callAt,interval:this.timeouts[f].interval,id:this.timeouts[f].id,invokeArgs:this.timeouts[f].invokeArgs})}return c||null},callTimer:function(timer){"number"==typeof timer.interval?this.timeouts[timer.id].callAt+=timer.interval:delete this.timeouts[timer.id];try{"function"==typeof timer.func?timer.func.apply(null,timer.invokeArgs):eval(timer.func)}catch(e){var exception=e}if(this.timeouts[timer.id]){if(exception)throw exception}else if(exception)throw exception},reset:function(){this.timeouts={}},Date:function(){function a(c,d,e,f,g,h,i){switch(arguments.length){case 0:return new b(a.clock.now);case 1:return new b(c);case 2:return new b(c,d);case 3:return new b(c,d,e);case 4:return new b(c,d,e,f);case 5:return new b(c,d,e,f,g);case 6:return new b(c,d,e,f,g,h);default:return new b(c,d,e,f,g,h,i)}}var b=Date;return mirrorDateProperties(a,b)}()};var methods=["Date","setTimeout","setInterval","clearTimeout","clearInterval"];"undefined"!=typeof global.setImmediate&&methods.push("setImmediate"),"undefined"!=typeof global.clearImmediate&&methods.push("clearImmediate"),sinon.useFakeTimers=function(a){var b=sinon.clock.create(a);b.restore=restore,b.methods=Array.prototype.slice.call(arguments,"number"==typeof a?1:0),0===b.methods.length&&(b.methods=methods);for(var c=0,d=b.methods.length;d>c;c++)stubGlobal(b.methods[c],b);return b}}("undefined"!=typeof global&&"function"!=typeof global?global:this),sinon.timers={setTimeout:setTimeout,clearTimeout:clearTimeout,setImmediate:"undefined"!=typeof setImmediate?setImmediate:void 0,clearImmediate:"undefined"!=typeof clearImmediate?clearImmediate:void 0,setInterval:setInterval,clearInterval:clearInterval,Date:Date},"undefined"!=typeof module&&module.exports&&(module.exports=sinon)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],63:[function(a,b){(function(c){("function"==typeof define&&define.amd&&function(a){define("formatio",["samsam"],a)}||"object"==typeof b&&function(c){b.exports=c(a("samsam"))}||function(a){this.formatio=a(this.samsam)})(function(a){"use strict";function b(a){if(!a)return"";if(a.displayName)return a.displayName;if(a.name)return a.name;var b=a.toString().match(/function\s+([^\(]+)/m);return b&&b[1]||""}function d(a,c){var d,e,f=b(c&&c.constructor),g=a.excludeConstructors||h.excludeConstructors||[];for(d=0,e=g.length;e>d;++d){if("string"==typeof g[d]&&g[d]===f)return"";if(g[d].test&&g[d].test(f))return""}return f}function e(a,b){if("object"!=typeof a)return!1;var c,d;for(c=0,d=b.length;d>c;++c)if(b[c]===a)return!0;return!1}function f(b,c,d,g){if("string"==typeof c){var h=b.quoteStrings,j="boolean"!=typeof h||h;return d||j?'"'+c+'"':c}if("function"==typeof c&&!(c instanceof RegExp))return f.func(c);if(d=d||[],e(c,d))return"[Circular]";if("[object Array]"===Object.prototype.toString.call(c))return f.array.call(b,c,d);if(!c)return String(1/c===-1/0?"-0":c);if(a.isElement(c))return f.element(c);if("function"==typeof c.toString&&c.toString!==Object.prototype.toString)return c.toString();var k,l;for(k=0,l=i.length;l>k;k++)if(c===i[k].object)return i[k].value;return f.object.call(b,c,d,g)}function g(a){for(var b in a)this[b]=a[b]}var h={excludeConstructors:["Object",/^.$/],quoteStrings:!0},i=(Object.prototype.hasOwnProperty,[]);return"undefined"!=typeof c&&i.push({object:c,value:"[object global]"}),"undefined"!=typeof document&&i.push({object:document,value:"[object HTMLDocument]"}),"undefined"!=typeof window&&i.push({object:window,value:"[object Window]"}),f.func=function(a){return"function "+b(a)+"() {}"},f.array=function(a,b){b=b||[],b.push(a);var c,d,e=[];for(c=0,d=a.length;d>c;++c)e.push(f(this,a[c],b));return"["+e.join(", ")+"]"},f.object=function(b,c,g){c=c||[],c.push(b),g=g||0;var h,i,j,k,l,m=[],n=a.keys(b).sort(),o=3;for(k=0,l=n.length;l>k;++k)h=n[k],j=b[h],i=e(j,c)?"[Circular]":f(this,j,c,g+2),i=(/\s/.test(h)?'"'+h+'"':h)+": "+i,o+=i.length,m.push(i);var p=d(this,b),q=p?"["+p+"] ":"",r="";for(k=0,l=g;l>k;++k)r+=" ";return o+g>80?q+"{\n "+r+m.join(",\n "+r)+"\n"+r+"}":q+"{ "+m.join(", ")+" }"},f.element=function(a){var b,c,d,e,f,g=a.tagName.toLowerCase(),h=a.attributes,i=[];for(d=0,e=h.length;e>d;++d)b=h.item(d),c=b.nodeName.toLowerCase().replace("html:",""),f=b.nodeValue,("contenteditable"!==c||"inherit"!==f)&&f&&i.push(c+'="'+f+'"');var j="<"+g+(i.length>0?" ":""),k=a.innerHTML;k.length>20&&(k=k.substr(0,20)+"[...]");var l=j+i.join(" ")+">"+k+"</"+g+">";return l.replace(/ contentEditable="inherit"/,"")},g.prototype={functionName:b,configure:function(a){return new g(a)},constructorName:function(a){return d(this,a)},ascii:function(a,b,c){return f(this,a,b,c)}},g.prototype})}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{samsam:64}],64:[function(a,b){("function"==typeof define&&define.amd&&function(a){define("samsam",a)}||"object"==typeof b&&function(a){b.exports=a()}||function(a){this.samsam=a()})(function(){function a(a){var b=a;return"number"==typeof a&&a!==b}function b(a){return l.toString.call(a).split(/[ \]]/)[1]}function c(a){if("Arguments"===b(a))return!0;if("object"!=typeof a||"number"!=typeof a.length||"Array"===b(a))return!1;if("function"==typeof a.callee)return!0;try{a[a.length]=6,delete a[a.length]}catch(c){return!0}return!1}function d(a){if(!a||1!==a.nodeType||!m)return!1;try{a.appendChild(m),a.removeChild(m)}catch(b){return!1}return!0}function e(a){var b,c=[];for(b in a)l.hasOwnProperty.call(a,b)&&c.push(b);return c}function f(a){return"function"==typeof a.getTime&&a.getTime()==a.valueOf()}function g(a){return 0===a&&1/a===-1/0}function h(b,c){return b===c||a(b)&&a(c)?0!==b||g(b)===g(c):void 0}function i(g,i){function j(a){return"object"!=typeof a||null===a||a instanceof Boolean||a instanceof Date||a instanceof Number||a instanceof RegExp||a instanceof String?!1:!0}function k(a,b){var c;for(c=0;c<a.length;c++)if(a[c]===b)return c;return-1}var m=[],n=[],o=[],p=[],q={};return function r(g,i,s,t){var u=typeof g,v=typeof i;if(g===i||a(g)||a(i)||null==g||null==i||"object"!==u||"object"!==v)return h(g,i);if(d(g)||d(i))return!1;var w=f(g),x=f(i);if(!(!w&&!x||w&&x&&g.getTime()===i.getTime()))return!1;if(g instanceof RegExp&&i instanceof RegExp&&g.toString()!==i.toString())return!1;var y=b(g),z=b(i),A=e(g),B=e(i);if(c(g)||c(i)){if(g.length!==i.length)return!1}else if(u!==v||y!==z||A.length!==B.length)return!1;var C,D,E,F,G,H,I,J,K,L,M;for(D=0,E=A.length;E>D;D++){if(C=A[D],!l.hasOwnProperty.call(i,C))return!1;if(F=g[C],G=i[C],H=j(F),I=j(G),J=H?k(m,F):-1,K=I?k(n,G):-1,L=-1!==J?o[J]:s+"["+JSON.stringify(C)+"]",M=-1!==K?p[K]:t+"["+JSON.stringify(C)+"]",q[L+M])return!0;if(-1===J&&H&&(m.push(F),o.push(L)),-1===K&&I&&(n.push(G),p.push(M)),H&&I&&(q[L+M]=!0),!r(F,G,L,M))return!1}return!0}(g,i,"$1","$2")}function j(a,b){if(0===b.length)return!0;var c,d,e,f;for(c=0,d=a.length;d>c;++c)if(k(a[c],b[0])){for(e=0,f=b.length;f>e;++e)if(!k(a[c+e],b[e]))return!1;return!0}return!1}var k,l=Object.prototype,m="undefined"!=typeof document&&document.createElement("div");return k=function n(a,c){if(c&&"function"==typeof c.test)return c.test(a);if("function"==typeof c)return c(a)===!0;if("string"==typeof c){c=c.toLowerCase();var d="string"==typeof a||!!a;return d&&String(a).toLowerCase().indexOf(c)>=0}if("number"==typeof c)return c===a;if("boolean"==typeof c)return c===a;if("Array"===b(a)&&"Array"===b(c))return j(a,c);if(c&&"object"==typeof c){var e;for(e in c){var f=a[e];if("undefined"==typeof f&&"function"==typeof a.getAttribute&&(f=a.getAttribute(e)),"undefined"==typeof f||!n(f,c[e]))return!1}return!0}throw new Error("Matcher was not a string, a number, a function, a boolean or an object")},{isArguments:c,isElement:d,isDate:f,isNegZero:g,identical:h,deepEqual:i,match:k,keys:e}})},{}],65:[function(a,b,c){(function(){var a=this,d=a._,e={},f=Array.prototype,g=Object.prototype,h=Function.prototype,i=f.push,j=f.slice,k=f.concat,l=g.toString,m=g.hasOwnProperty,n=f.forEach,o=f.map,p=f.reduce,q=f.reduceRight,r=f.filter,s=f.every,t=f.some,u=f.indexOf,v=f.lastIndexOf,w=Array.isArray,x=Object.keys,y=h.bind,z=function(a){return a instanceof z?a:this instanceof z?void(this._wrapped=a):new z(a)};"undefined"!=typeof c?("undefined"!=typeof b&&b.exports&&(c=b.exports=z),c._=z):a._=z,z.VERSION="1.6.0";var A=z.each=z.forEach=function(a,b,c){if(null==a)return a;if(n&&a.forEach===n)a.forEach(b,c);else if(a.length===+a.length){for(var d=0,f=a.length;f>d;d++)if(b.call(c,a[d],d,a)===e)return}else for(var g=z.keys(a),d=0,f=g.length;f>d;d++)if(b.call(c,a[g[d]],g[d],a)===e)return;return a};z.map=z.collect=function(a,b,c){var d=[];return null==a?d:o&&a.map===o?a.map(b,c):(A(a,function(a,e,f){d.push(b.call(c,a,e,f))}),d)};var B="Reduce of empty array with no initial value";z.reduce=z.foldl=z.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),p&&a.reduce===p)return d&&(b=z.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(A(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(B);return c},z.reduceRight=z.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),q&&a.reduceRight===q)return d&&(b=z.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=z.keys(a);f=g.length}if(A(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(B);return c},z.find=z.detect=function(a,b,c){var d;return C(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},z.filter=z.select=function(a,b,c){var d=[];return null==a?d:r&&a.filter===r?a.filter(b,c):(A(a,function(a,e,f){b.call(c,a,e,f)&&d.push(a)}),d)},z.reject=function(a,b,c){return z.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},z.every=z.all=function(a,b,c){b||(b=z.identity);var d=!0;return null==a?d:s&&a.every===s?a.every(b,c):(A(a,function(a,f,g){return(d=d&&b.call(c,a,f,g))?void 0:e}),!!d)};var C=z.some=z.any=function(a,b,c){b||(b=z.identity);var d=!1;return null==a?d:t&&a.some===t?a.some(b,c):(A(a,function(a,f,g){return d||(d=b.call(c,a,f,g))?e:void 0}),!!d)};z.contains=z.include=function(a,b){return null==a?!1:u&&a.indexOf===u?-1!=a.indexOf(b):C(a,function(a){return a===b})},z.invoke=function(a,b){var c=j.call(arguments,2),d=z.isFunction(b);return z.map(a,function(a){return(d?b:a[b]).apply(a,c)})},z.pluck=function(a,b){return z.map(a,z.property(b))},z.where=function(a,b){return z.filter(a,z.matches(b))},z.findWhere=function(a,b){return z.find(a,z.matches(b))},z.max=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);var d=-1/0,e=-1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;h>e&&(d=a,e=h)}),d},z.min=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);var d=1/0,e=1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;e>h&&(d=a,e=h)}),d},z.shuffle=function(a){var b,c=0,d=[];return A(a,function(a){b=z.random(c++),d[c-1]=d[b],d[b]=a}),d},z.sample=function(a,b,c){return null==b||c?(a.length!==+a.length&&(a=z.values(a)),a[z.random(a.length-1)]):z.shuffle(a).slice(0,Math.max(0,b))};var D=function(a){return null==a?z.identity:z.isFunction(a)?a:z.property(a)
|
||
};z.sortBy=function(a,b,c){return b=D(b),z.pluck(z.map(a,function(a,d,e){return{value:a,index:d,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index-b.index}),"value")};var E=function(a){return function(b,c,d){var e={};return c=D(c),A(b,function(f,g){var h=c.call(d,f,g,b);a(e,h,f)}),e}};z.groupBy=E(function(a,b,c){z.has(a,b)?a[b].push(c):a[b]=[c]}),z.indexBy=E(function(a,b,c){a[b]=c}),z.countBy=E(function(a,b){z.has(a,b)?a[b]++:a[b]=1}),z.sortedIndex=function(a,b,c,d){c=D(c);for(var e=c.call(d,b),f=0,g=a.length;g>f;){var h=f+g>>>1;c.call(d,a[h])<e?f=h+1:g=h}return f},z.toArray=function(a){return a?z.isArray(a)?j.call(a):a.length===+a.length?z.map(a,z.identity):z.values(a):[]},z.size=function(a){return null==a?0:a.length===+a.length?a.length:z.keys(a).length},z.first=z.head=z.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:0>b?[]:j.call(a,0,b)},z.initial=function(a,b,c){return j.call(a,0,a.length-(null==b||c?1:b))},z.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:j.call(a,Math.max(a.length-b,0))},z.rest=z.tail=z.drop=function(a,b,c){return j.call(a,null==b||c?1:b)},z.compact=function(a){return z.filter(a,z.identity)};var F=function(a,b,c){return b&&z.every(a,z.isArray)?k.apply(c,a):(A(a,function(a){z.isArray(a)||z.isArguments(a)?b?i.apply(c,a):F(a,b,c):c.push(a)}),c)};z.flatten=function(a,b){return F(a,b,[])},z.without=function(a){return z.difference(a,j.call(arguments,1))},z.partition=function(a,b){var c=[],d=[];return A(a,function(a){(b(a)?c:d).push(a)}),[c,d]},z.uniq=z.unique=function(a,b,c,d){z.isFunction(b)&&(d=c,c=b,b=!1);var e=c?z.map(a,c,d):a,f=[],g=[];return A(e,function(c,d){(b?d&&g[g.length-1]===c:z.contains(g,c))||(g.push(c),f.push(a[d]))}),f},z.union=function(){return z.uniq(z.flatten(arguments,!0))},z.intersection=function(a){var b=j.call(arguments,1);return z.filter(z.uniq(a),function(a){return z.every(b,function(b){return z.contains(b,a)})})},z.difference=function(a){var b=k.apply(f,j.call(arguments,1));return z.filter(a,function(a){return!z.contains(b,a)})},z.zip=function(){for(var a=z.max(z.pluck(arguments,"length").concat(0)),b=new Array(a),c=0;a>c;c++)b[c]=z.pluck(arguments,""+c);return b},z.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},z.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=z.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(u&&a.indexOf===u)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},z.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(v&&a.lastIndexOf===v)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},z.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);d>e;)f[e++]=a,a+=c;return f};var G=function(){};z.bind=function(a,b){var c,d;if(y&&a.bind===y)return y.apply(a,j.call(arguments,1));if(!z.isFunction(a))throw new TypeError;return c=j.call(arguments,2),d=function(){if(!(this instanceof d))return a.apply(b,c.concat(j.call(arguments)));G.prototype=a.prototype;var e=new G;G.prototype=null;var f=a.apply(e,c.concat(j.call(arguments)));return Object(f)===f?f:e}},z.partial=function(a){var b=j.call(arguments,1);return function(){for(var c=0,d=b.slice(),e=0,f=d.length;f>e;e++)d[e]===z&&(d[e]=arguments[c++]);for(;c<arguments.length;)d.push(arguments[c++]);return a.apply(this,d)}},z.bindAll=function(a){var b=j.call(arguments,1);if(0===b.length)throw new Error("bindAll must be passed function names");return A(b,function(b){a[b]=z.bind(a[b],a)}),a},z.memoize=function(a,b){var c={};return b||(b=z.identity),function(){var d=b.apply(this,arguments);return z.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},z.delay=function(a,b){var c=j.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},z.defer=function(a){return z.delay.apply(z,[a,1].concat(j.call(arguments,1)))},z.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:z.now(),g=null,f=a.apply(d,e),d=e=null};return function(){var j=z.now();h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k?(clearTimeout(g),g=null,h=j,f=a.apply(d,e),d=e=null):g||c.trailing===!1||(g=setTimeout(i,k)),f}},z.debounce=function(a,b,c){var d,e,f,g,h,i=function(){var j=z.now()-g;b>j?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),f=e=null))};return function(){f=this,e=arguments,g=z.now();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}},z.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},z.wrap=function(a,b){return z.partial(b,a)},z.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},z.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},z.keys=function(a){if(!z.isObject(a))return[];if(x)return x(a);var b=[];for(var c in a)z.has(a,c)&&b.push(c);return b},z.values=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},z.pairs=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},z.invert=function(a){for(var b={},c=z.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},z.functions=z.methods=function(a){var b=[];for(var c in a)z.isFunction(a[c])&&b.push(c);return b.sort()},z.extend=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},z.pick=function(a){var b={},c=k.apply(f,j.call(arguments,1));return A(c,function(c){c in a&&(b[c]=a[c])}),b},z.omit=function(a){var b={},c=k.apply(f,j.call(arguments,1));for(var d in a)z.contains(c,d)||(b[d]=a[d]);return b},z.defaults=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)void 0===a[c]&&(a[c]=b[c])}),a},z.clone=function(a){return z.isObject(a)?z.isArray(a)?a.slice():z.extend({},a):a},z.tap=function(a,b){return b(a),a};var H=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof z&&(a=a._wrapped),b instanceof z&&(b=b._wrapped);var e=l.call(a);if(e!=l.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;var g=a.constructor,h=b.constructor;if(g!==h&&!(z.isFunction(g)&&g instanceof g&&z.isFunction(h)&&h instanceof h)&&"constructor"in a&&"constructor"in b)return!1;c.push(a),d.push(b);var i=0,j=!0;if("[object Array]"==e){if(i=a.length,j=i==b.length)for(;i--&&(j=H(a[i],b[i],c,d)););}else{for(var k in a)if(z.has(a,k)&&(i++,!(j=z.has(b,k)&&H(a[k],b[k],c,d))))break;if(j){for(k in b)if(z.has(b,k)&&!i--)break;j=!i}}return c.pop(),d.pop(),j};z.isEqual=function(a,b){return H(a,b,[],[])},z.isEmpty=function(a){if(null==a)return!0;if(z.isArray(a)||z.isString(a))return 0===a.length;for(var b in a)if(z.has(a,b))return!1;return!0},z.isElement=function(a){return!(!a||1!==a.nodeType)},z.isArray=w||function(a){return"[object Array]"==l.call(a)},z.isObject=function(a){return a===Object(a)},A(["Arguments","Function","String","Number","Date","RegExp"],function(a){z["is"+a]=function(b){return l.call(b)=="[object "+a+"]"}}),z.isArguments(arguments)||(z.isArguments=function(a){return!(!a||!z.has(a,"callee"))}),"function"!=typeof/./&&(z.isFunction=function(a){return"function"==typeof a}),z.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},z.isNaN=function(a){return z.isNumber(a)&&a!=+a},z.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==l.call(a)},z.isNull=function(a){return null===a},z.isUndefined=function(a){return void 0===a},z.has=function(a,b){return m.call(a,b)},z.noConflict=function(){return a._=d,this},z.identity=function(a){return a},z.constant=function(a){return function(){return a}},z.property=function(a){return function(b){return b[a]}},z.matches=function(a){return function(b){if(b===a)return!0;for(var c in a)if(a[c]!==b[c])return!1;return!0}},z.times=function(a,b,c){for(var d=Array(Math.max(0,a)),e=0;a>e;e++)d[e]=b.call(c,e);return d},z.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))},z.now=Date.now||function(){return(new Date).getTime()};var I={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};I.unescape=z.invert(I.escape);var J={escape:new RegExp("["+z.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+z.keys(I.unescape).join("|")+")","g")};z.each(["escape","unescape"],function(a){z[a]=function(b){return null==b?"":(""+b).replace(J[a],function(b){return I[a][b]})}}),z.result=function(a,b){if(null==a)return void 0;var c=a[b];return z.isFunction(c)?c.call(a):c},z.mixin=function(a){A(z.functions(a),function(b){var c=z[b]=a[b];z.prototype[b]=function(){var a=[this._wrapped];return i.apply(a,arguments),O.call(this,c.apply(z,a))}})};var K=0;z.uniqueId=function(a){var b=++K+"";return a?a+b:b},z.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var L=/(.)^/,M={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},N=/\\|'|\r|\n|\t|\u2028|\u2029/g;z.template=function(a,b,c){var d;c=z.defaults({},c,z.templateSettings);var e=new RegExp([(c.escape||L).source,(c.interpolate||L).source,(c.evaluate||L).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(N,function(a){return"\\"+M[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=new Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,z);var i=function(a){return d.call(this,a,z)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},z.chain=function(a){return z(a).chain()};var O=function(a){return this._chain?z(a).chain():a};z.mixin(z),A(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=f[a];z.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],O.call(this,c)}}),A(["concat","join","slice"],function(a){var b=f[a];z.prototype[a]=function(){return O.call(this,b.apply(this._wrapped,arguments))}}),z.extend(z.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return z})}).call(this)},{}],66:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:17,sinon:50,"sinon-chai":49,underscore:65}],67:[function(a){var b,c,d,e,f,g,h,i;d=a("chai"),e=d.expect,f=d.should(),g=a("sinon"),h=a("sinon-chai"),i=a("underscore"),d.use(h),c=a("../lib/Frameworks/TextYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee")},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/TextYatta.coffee":4,chai:17,sinon:50,"sinon-chai":49,underscore:65}],68:[function(a){var b,c,d,e,f,g,h,i,j,k=function(a,b){return function(){return a.apply(b,arguments)}};e=a("chai"),f=e.expect,g=e.should(),h=a("sinon"),i=a("sinon-chai"),j=a("underscore"),e.use(i),d=a("../lib/Frameworks/JsonYatta.coffee"),b=a("../lib/Connectors/TestConnector.coffee"),c=function(){function a(){this.applyRandomOp=k(this.applyRandomOp,this),this.generateRandomOp=k(this.generateRandomOp,this),this.generateDeleteOp=k(this.generateDeleteOp,this),this.generateReplaceOp=k(this.generateReplaceOp,this),this.generateInsertOp=k(this.generateInsertOp,this),this.number_of_test_cases_multiplier=1,this.repeat_this=10*this.number_of_test_cases_multiplier,this.doSomething_amount=200*this.number_of_test_cases_multiplier,this.number_of_engines=12+this.number_of_test_cases_multiplier-1,this.time=0,this.ops=0,this.time_now=0,this.reinitialize()}return a.prototype.reinitialize=function(){var a,c,e,f;for(this.users=[],this.Connector=b(this.users),this.users.push(new d(0,this.Connector)),this.users[0].val("name","initial"),f=[],a=c=1,e=this.number_of_engines;e>=1?e>c:c>e;a=e>=1?++c:--c)f.push(this.users.push(new d(a,this.Connector)));return f},a.prototype.getSomeUser=function(){var a;return a=j.random(0,this.users.length-1),this.users[a]},a.prototype.getRandomText=function(){var a,b,c,d;return a="abcdefghijklmnopqrstuvwxyz",b=j.random(0,10),c=a[j.random(0,a.length-1)],d="",j(b).times(function(){return d+=c}),d},a.prototype.generateInsertOp=function(a){var b;return b=j.random(0,this.users[a].val("name").val().length-1),this.users[a].val("name").insertText(b,this.getRandomText()),null},a.prototype.generateReplaceOp=function(a){return this.users[a].val("name").replaceText(this.getRandomText()),null},a.prototype.generateDeleteOp=function(a){var b,c,d;return void(this.users[a].val("name").val().length>0&&(d=j.random(0,this.users[a].val("name").val().length-1),b=1,c=this.users[a].val("name").deleteText(d,b)))},a.prototype.generateRandomOp=function(a){var b,c,d;return d=[this.generateDeleteOp,this.generateInsertOp,this.generateReplaceOp],b=j.random(d.length-1),c=d[b](a)},a.prototype.applyRandomOp=function(a){var b;return b=this.users[a],b.getConnector().flushOneRandom()},a.prototype.doSomething=function(){var a,b,c;return c=j.random(this.number_of_engines-1),b=[this.applyRandomOp,this.generateRandomOp],a=j.random(b.length-1),b[a](c)},a.prototype.flushAll=function(){var a,b,c,d,e,f;for(e=this.users,f=[],b=c=0,d=e.length;d>c;b=++c)a=e[b],f.push(a.getConnector().flushAll());return f},a.prototype.compareAll=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;for(this.flushAll(),this.time+=(new Date).getTime()-this.time_now,d=0,b=i=0,m=this.users.length;m>=0?m>i:i>m;b=m>=0?++i:--i)d+=this.users[b].getConnector().getOpsInExecutionOrder().length;for(this.ops+=d*this.users.length,f=Math.floor(this.ops/this.time),null!=a&&console.log(""+a+"/"+this.repeat_this+": Every collaborator ("+this.users.length+") applied "+this.number_of_created_operations+" ops in a different order."+(" Over all we consumed "+this.ops+" operations in "+this.time/1e3+" seconds ("+f+" ops/msek).")),o=[],b=j=0,n=this.users.length-1;n>=0?n>j:j>n;b=n>=0?++j:--j)if(this.users[b].val("name").val()!==this.users[b+1].val("name").val()){for(g=function(a,b){var c,d,e,f,g,h,i,j;for(e=this.users[a].getConnector().getOpsInExecutionOrder(),g=0,i=e.length;i>g;g++)f=e[g],console.log(JSON.stringify(f));for(console.log(""),f="ops = [",c=h=0,j=e.length;j>h;c=++h)d=e[c],0!==c&&(f+=", "),f+="op"+c;return f+="]",console.log(f),console.log("@users[@last_user].ot.applyOps ops"),console.log("expect(@users[@last_user].ot.val('name')).to.equal(\""+users[b].val("name")+'")'),e},console.log(""),console.log("Found an OT Puzzle!"),console.log("OT states:"),c=k=0,l=users.length;l>k;c=++k)h=users[c],console.log("OT"+c+": "+h.val("name"));console.log("\nOT execution order ("+b+","+(b+1)+"):"),g(b,b+1),console.log(""),e=g(b+1,b),o.push(console.log(""))}else o.push(void 0);return o},a.prototype.run=function(){var a,b,c,d,e,f,g;for(console.log(""),g=[],b=c=1,e=this.repeat_this;e>=1?e>=c:c>=e;b=e>=1?++c:--c){for(this.time_now=(new Date).getTime(),a=d=1,f=this.doSomething_amount;f>=1?f>=d:d>=f;a=f>=1?++d:--d)this.doSomething();this.compareAll(b),g.push(this.reinitialize())}return g},a}(),describe("JsonYatta",function(){return beforeEach(function(a){return this.yTest=new c,a()}),it("has a JsonWrapper",function(){var a,b;return b=this.yTest.getSomeUser().root_element,b.val("x","dtrn","immutable"),b.val("set",{x:"x"},"immutable"),a=b.value,a.x,a.set={y:""},a.x,a.set,a.set.x,f(a.x).to.equal("dtrn"),f(a.set.x).to.equal("x")}),it("can handle creaton of complex json",function(){return this.yTest.getSomeUser().val("x",{a:"b"}),this.yTest.getSomeUser().val("a",{a:{q:"dtrndtrtdrntdrnrtdnrtdnrtdnrtdnrdnrdt"}}),this.yTest.getSomeUser().val("b",{a:{}}),this.yTest.getSomeUser().val("c",{a:"b"}),this.yTest.compareAll()}),it("handles some immutable tests",function(){return this.yTest.getSomeUser().val("string","text","immutable"),this.yTest.getSomeUser().val("number",4,"immutable"),this.yTest.getSomeUser().val("object",{q:"rr"},"immutable"),this.yTest.compareAll(),f(this.yTest.getSomeUser().val("string")).to.equal("text"),f(this.yTest.getSomeUser().val("number")).to.equal(4),f(this.yTest.getSomeUser().val("object").val("q")).to.equal("rr")}),it("can handle many engines, many operations, concurrently (random)",function(){return this.yTest.run()})})},{"../lib/Connectors/TestConnector.coffee":1,"../lib/Frameworks/JsonYatta.coffee":3,chai:17,sinon:50,"sinon-chai":49,underscore:65}]},{},[66,67,68]); |