37 lines
402 KiB
JavaScript
37 lines
402 KiB
JavaScript
var OrbitDB=function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.i=function(value){return value},__webpack_require__.d=function(exports,name,getter){Object.defineProperty(exports,name,{configurable:!1,enumerable:!0,get:getter})},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=198)}([function(module,exports){"use strict";exports.__esModule=!0,exports.default=function(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.__esModule=!0;var _defineProperty=__webpack_require__(56),_defineProperty2=_interopRequireDefault(_defineProperty);exports.default=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),(0,_defineProperty2.default)(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}()},function(module,exports){var core=module.exports={version:"2.4.0"};"number"==typeof __e&&(__e=core)},function(module,exports,__webpack_require__){var store=__webpack_require__(45)("wks"),uid=__webpack_require__(34),Symbol=__webpack_require__(4).Symbol,USE_SYMBOL="function"==typeof Symbol,$exports=module.exports=function(name){return store[name]||(store[name]=USE_SYMBOL&&Symbol[name]||(USE_SYMBOL?Symbol:uid)("Symbol."+name))};$exports.store=store},function(module,exports){var global=module.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=global)},function(module,exports,__webpack_require__){module.exports={default:__webpack_require__(107),__esModule:!0}},function(module,exports,__webpack_require__){var isObject=__webpack_require__(20);module.exports=function(it){if(!isObject(it))throw TypeError(it+" is not an object!");return it}},function(module,exports,__webpack_require__){module.exports=!__webpack_require__(19)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(module,exports,__webpack_require__){var global=__webpack_require__(4),core=__webpack_require__(2),ctx=__webpack_require__(23),hide=__webpack_require__(12),PROTOTYPE="prototype",$export=function(type,name,source){var key,own,out,IS_FORCED=type&$export.F,IS_GLOBAL=type&$export.G,IS_STATIC=type&$export.S,IS_PROTO=type&$export.P,IS_BIND=type&$export.B,IS_WRAP=type&$export.W,exports=IS_GLOBAL?core:core[name]||(core[name]={}),expProto=exports[PROTOTYPE],target=IS_GLOBAL?global:IS_STATIC?global[name]:(global[name]||{})[PROTOTYPE];IS_GLOBAL&&(source=name);for(key in source)own=!IS_FORCED&&target&&void 0!==target[key],own&&key in exports||(out=own?target[key]:source[key],exports[key]=IS_GLOBAL&&"function"!=typeof target[key]?source[key]:IS_BIND&&own?ctx(out,global):IS_WRAP&&target[key]==out?function(C){var F=function(a,b,c){if(this instanceof C){switch(arguments.length){case 0:return new C;case 1:return new C(a);case 2:return new C(a,b)}return new C(a,b,c)}return C.apply(this,arguments)};return F[PROTOTYPE]=C[PROTOTYPE],F}(out):IS_PROTO&&"function"==typeof out?ctx(Function.call,out):out,IS_PROTO&&((exports.virtual||(exports.virtual={}))[key]=out,type&$export.R&&expProto&&!expProto[key]&&hide(expProto,key,out)))};$export.F=1,$export.G=2,$export.S=4,$export.P=8,$export.B=16,$export.W=32,$export.U=64,$export.R=128,module.exports=$export},function(module,exports,__webpack_require__){var anObject=__webpack_require__(6),IE8_DOM_DEFINE=__webpack_require__(62),toPrimitive=__webpack_require__(47),dP=Object.defineProperty;exports.f=__webpack_require__(7)?Object.defineProperty:function(O,P,Attributes){if(anObject(O),P=toPrimitive(P,!0),anObject(Attributes),IE8_DOM_DEFINE)try{return dP(O,P,Attributes)}catch(e){}if("get"in Attributes||"set"in Attributes)throw TypeError("Accessors not supported!");return"value"in Attributes&&(O[P]=Attributes.value),O}},function(module,exports){var g;g=function(){return this}();try{g=g||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(g=window)}module.exports=g},function(module,exports){var hasOwnProperty={}.hasOwnProperty;module.exports=function(it,key){return hasOwnProperty.call(it,key)}},function(module,exports,__webpack_require__){var dP=__webpack_require__(9),createDesc=__webpack_require__(31);module.exports=__webpack_require__(7)?function(object,key,value){return dP.f(object,key,createDesc(1,value))}:function(object,key,value){return object[key]=value,object}},function(module,exports,__webpack_require__){var IObject=__webpack_require__(63),defined=__webpack_require__(38);module.exports=function(it){return IObject(defined(it))}},function(module,exports,__webpack_require__){module.exports={default:__webpack_require__(112),__esModule:!0}},function(module,exports,__webpack_require__){module.exports={default:__webpack_require__(111),__esModule:!0}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.__esModule=!0;var _setPrototypeOf=__webpack_require__(101),_setPrototypeOf2=_interopRequireDefault(_setPrototypeOf),_create=__webpack_require__(99),_create2=_interopRequireDefault(_create),_typeof2=__webpack_require__(59),_typeof3=_interopRequireDefault(_typeof2);exports.default=function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof superClass?"undefined":(0,_typeof3.default)(superClass)));subClass.prototype=(0,_create2.default)(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(_setPrototypeOf2.default?(0,_setPrototypeOf2.default)(subClass,superClass):subClass.__proto__=superClass)}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.__esModule=!0;var _typeof2=__webpack_require__(59),_typeof3=_interopRequireDefault(_typeof2);exports.default=function(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!==("undefined"==typeof call?"undefined":(0,_typeof3.default)(call))&&"function"!=typeof call?self:call}},function(module,exports,__webpack_require__){"use strict";(function(Buffer,global){function typedArraySupport(){try{var arr=new Uint8Array(1);return arr.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===arr.foo()&&"function"==typeof arr.subarray&&0===arr.subarray(1,1).byteLength}catch(e){return!1}}function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(that,length){if(kMaxLength()<length)throw new RangeError("Invalid typed array length");return Buffer.TYPED_ARRAY_SUPPORT?(that=new Uint8Array(length),that.__proto__=Buffer.prototype):(null===that&&(that=new Buffer(length)),that.length=length),that}function Buffer(arg,encodingOrOffset,length){if(!(Buffer.TYPED_ARRAY_SUPPORT||this instanceof Buffer))return new Buffer(arg,encodingOrOffset,length);if("number"==typeof arg){if("string"==typeof encodingOrOffset)throw new Error("If encoding is specified then the first argument must be a string");return allocUnsafe(this,arg)}return from(this,arg,encodingOrOffset,length)}function from(that,value,encodingOrOffset,length){if("number"==typeof value)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&value instanceof ArrayBuffer?fromArrayBuffer(that,value,encodingOrOffset,length):"string"==typeof value?fromString(that,value,encodingOrOffset):fromObject(that,value)}function assertSize(size){if("number"!=typeof size)throw new TypeError('"size" argument must be a number');if(size<0)throw new RangeError('"size" argument must not be negative')}function alloc(that,size,fill,encoding){return assertSize(size),size<=0?createBuffer(that,size):void 0!==fill?"string"==typeof encoding?createBuffer(that,size).fill(fill,encoding):createBuffer(that,size).fill(fill):createBuffer(that,size)}function allocUnsafe(that,size){if(assertSize(size),that=createBuffer(that,size<0?0:0|checked(size)),!Buffer.TYPED_ARRAY_SUPPORT)for(var i=0;i<size;++i)that[i]=0;return that}function fromString(that,string,encoding){if("string"==typeof encoding&&""!==encoding||(encoding="utf8"),!Buffer.isEncoding(encoding))throw new TypeError('"encoding" must be a valid string encoding');var length=0|byteLength(string,encoding);that=createBuffer(that,length);var actual=that.write(string,encoding);return actual!==length&&(that=that.slice(0,actual)),that}function fromArrayLike(that,array){var length=array.length<0?0:0|checked(array.length);that=createBuffer(that,length);for(var i=0;i<length;i+=1)that[i]=255&array[i];return that}function fromArrayBuffer(that,array,byteOffset,length){if(array.byteLength,byteOffset<0||array.byteLength<byteOffset)throw new RangeError("'offset' is out of bounds");if(array.byteLength<byteOffset+(length||0))throw new RangeError("'length' is out of bounds");return array=void 0===byteOffset&&void 0===length?new Uint8Array(array):void 0===length?new Uint8Array(array,byteOffset):new Uint8Array(array,byteOffset,length),Buffer.TYPED_ARRAY_SUPPORT?(that=array,that.__proto__=Buffer.prototype):that=fromArrayLike(that,array),that}function fromObject(that,obj){if(Buffer.isBuffer(obj)){var len=0|checked(obj.length);return that=createBuffer(that,len),0===that.length?that:(obj.copy(that,0,0,len),that)}if(obj){if("undefined"!=typeof ArrayBuffer&&obj.buffer instanceof ArrayBuffer||"length"in obj)return"number"!=typeof obj.length||isnan(obj.length)?createBuffer(that,0):fromArrayLike(that,obj);if("Buffer"===obj.type&&isArray(obj.data))return fromArrayLike(that,obj.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function checked(length){if(length>=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|length}function SlowBuffer(length){return+length!=length&&(length=0),Buffer.alloc(+length)}function byteLength(string,encoding){if(Buffer.isBuffer(string))return string.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(string)||string instanceof ArrayBuffer))return string.byteLength;"string"!=typeof string&&(string=""+string);var len=string.length;if(0===len)return 0;for(var loweredCase=!1;;)switch(encoding){case"ascii":case"latin1":case"binary":return len;case"utf8":case"utf-8":case void 0:return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*len;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase(),loweredCase=!0}}function slowToString(encoding,start,end){var loweredCase=!1;if((void 0===start||start<0)&&(start=0),start>this.length)return"";if((void 0===end||end>this.length)&&(end=this.length),end<=0)return"";if(end>>>=0,start>>>=0,end<=start)return"";for(encoding||(encoding="utf8");;)switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase(),loweredCase=!0}}function swap(b,n,m){var i=b[n];b[n]=b[m],b[m]=i}function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){if(0===buffer.length)return-1;if("string"==typeof byteOffset?(encoding=byteOffset,byteOffset=0):byteOffset>2147483647?byteOffset=2147483647:byteOffset<-2147483648&&(byteOffset=-2147483648),byteOffset=+byteOffset,isNaN(byteOffset)&&(byteOffset=dir?0:buffer.length-1),byteOffset<0&&(byteOffset=buffer.length+byteOffset),byteOffset>=buffer.length){if(dir)return-1;byteOffset=buffer.length-1}else if(byteOffset<0){if(!dir)return-1;byteOffset=0}if("string"==typeof val&&(val=Buffer.from(val,encoding)),Buffer.isBuffer(val))return 0===val.length?-1:arrayIndexOf(buffer,val,byteOffset,encoding,dir);if("number"==typeof val)return val&=255,Buffer.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?dir?Uint8Array.prototype.indexOf.call(buffer,val,byteOffset):Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset):arrayIndexOf(buffer,[val],byteOffset,encoding,dir);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){function read(buf,i){return 1===indexSize?buf[i]:buf.readUInt16BE(i*indexSize)}var indexSize=1,arrLength=arr.length,valLength=val.length;if(void 0!==encoding&&(encoding=String(encoding).toLowerCase(),"ucs2"===encoding||"ucs-2"===encoding||"utf16le"===encoding||"utf-16le"===encoding)){if(arr.length<2||val.length<2)return-1;indexSize=2,arrLength/=2,valLength/=2,byteOffset/=2}var i;if(dir){var foundIndex=-1;for(i=byteOffset;i<arrLength;i++)if(read(arr,i)===read(val,foundIndex===-1?0:i-foundIndex)){if(foundIndex===-1&&(foundIndex=i),i-foundIndex+1===valLength)return foundIndex*indexSize}else foundIndex!==-1&&(i-=i-foundIndex),foundIndex=-1}else for(byteOffset+valLength>arrLength&&(byteOffset=arrLength-valLength),i=byteOffset;i>=0;i--){for(var found=!0,j=0;j<valLength;j++)if(read(arr,i+j)!==read(val,j)){found=!1;break}if(found)return i}return-1}function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;length?(length=Number(length),length>remaining&&(length=remaining)):length=remaining;var strLen=string.length;if(strLen%2!==0)throw new TypeError("Invalid hex string");length>strLen/2&&(length=strLen/2);for(var i=0;i<length;++i){var parsed=parseInt(string.substr(2*i,2),16);if(isNaN(parsed))return i;buf[offset+i]=parsed}return i}function utf8Write(buf,string,offset,length){return blitBuffer(utf8ToBytes(string,buf.length-offset),buf,offset,length)}function asciiWrite(buf,string,offset,length){return blitBuffer(asciiToBytes(string),buf,offset,length)}function latin1Write(buf,string,offset,length){return asciiWrite(buf,string,offset,length)}function base64Write(buf,string,offset,length){return blitBuffer(base64ToBytes(string),buf,offset,length)}function ucs2Write(buf,string,offset,length){return blitBuffer(utf16leToBytes(string,buf.length-offset),buf,offset,length)}function base64Slice(buf,start,end){return 0===start&&end===buf.length?base64.fromByteArray(buf):base64.fromByteArray(buf.slice(start,end))}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);for(var res=[],i=start;i<end;){var firstByte=buf[i],codePoint=null,bytesPerSequence=firstByte>239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:firstByte<128&&(codePoint=firstByte);break;case 2:secondByte=buf[i+1],128===(192&secondByte)&&(tempCodePoint=(31&firstByte)<<6|63&secondByte,tempCodePoint>127&&(codePoint=tempCodePoint));break;case 3:secondByte=buf[i+1],thirdByte=buf[i+2],128===(192&secondByte)&&128===(192&thirdByte)&&(tempCodePoint=(15&firstByte)<<12|(63&secondByte)<<6|63&thirdByte,tempCodePoint>2047&&(tempCodePoint<55296||tempCodePoint>57343)&&(codePoint=tempCodePoint));break;case 4:secondByte=buf[i+1],thirdByte=buf[i+2],fourthByte=buf[i+3],128===(192&secondByte)&&128===(192&thirdByte)&&128===(192&fourthByte)&&(tempCodePoint=(15&firstByte)<<18|(63&secondByte)<<12|(63&thirdByte)<<6|63&fourthByte,tempCodePoint>65535&&tempCodePoint<1114112&&(codePoint=tempCodePoint))}}null===codePoint?(codePoint=65533,bytesPerSequence=1):codePoint>65535&&(codePoint-=65536,res.push(codePoint>>>10&1023|55296),codePoint=56320|1023&codePoint),res.push(codePoint),i+=bytesPerSequence}return decodeCodePointsArray(res)}function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,codePoints);for(var res="",i=0;i<len;)res+=String.fromCharCode.apply(String,codePoints.slice(i,i+=MAX_ARGUMENTS_LENGTH));return res}function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;++i)ret+=String.fromCharCode(127&buf[i]);return ret}function latin1Slice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;++i)ret+=String.fromCharCode(buf[i]);return ret}function hexSlice(buf,start,end){var len=buf.length;(!start||start<0)&&(start=0),(!end||end<0||end>len)&&(end=len);for(var out="",i=start;i<end;++i)out+=toHex(buf[i]);return out}function utf16leSlice(buf,start,end){for(var bytes=buf.slice(start,end),res="",i=0;i<bytes.length;i+=2)res+=String.fromCharCode(bytes[i]+256*bytes[i+1]);return res}function checkOffset(offset,ext,length){if(offset%1!==0||offset<0)throw new RangeError("offset is not uint");if(offset+ext>length)throw new RangeError("Trying to access beyond buffer length")}function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||value<min)throw new RangeError('"value" argument is out of bounds');if(offset+ext>buf.length)throw new RangeError("Index out of range")}function objectWriteUInt16(buf,value,offset,littleEndian){value<0&&(value=65535+value+1);for(var i=0,j=Math.min(buf.length-offset,2);i<j;++i)buf[offset+i]=(value&255<<8*(littleEndian?i:1-i))>>>8*(littleEndian?i:1-i)}function objectWriteUInt32(buf,value,offset,littleEndian){value<0&&(value=4294967295+value+1);for(var i=0,j=Math.min(buf.length-offset,4);i<j;++i)buf[offset+i]=value>>>8*(littleEndian?i:3-i)&255}function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38),ieee754.write(buf,value,offset,littleEndian,23,4),offset+4}function writeDouble(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308),ieee754.write(buf,value,offset,littleEndian,52,8),offset+8}function base64clean(str){if(str=stringtrim(str).replace(INVALID_BASE64_RE,""),str.length<2)return"";for(;str.length%4!==0;)str+="=";return str}function stringtrim(str){return str.trim?str.trim():str.replace(/^\s+|\s+$/g,"")}function toHex(n){return n<16?"0"+n.toString(16):n.toString(16)}function utf8ToBytes(string,units){units=units||1/0;for(var codePoint,length=string.length,leadSurrogate=null,bytes=[],i=0;i<length;++i){if(codePoint=string.charCodeAt(i),codePoint>55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){(units-=3)>-1&&bytes.push(239,191,189);continue}if(i+1===length){(units-=3)>-1&&bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){(units-=3)>-1&&bytes.push(239,191,189),leadSurrogate=codePoint;continue}codePoint=(leadSurrogate-55296<<10|codePoint-56320)+65536}else leadSurrogate&&(units-=3)>-1&&bytes.push(239,191,189);if(leadSurrogate=null,codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,63&codePoint|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,63&codePoint|128)}else{if(!(codePoint<1114112))throw new Error("Invalid code point");if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,63&codePoint|128)}}return bytes}function asciiToBytes(str){for(var byteArray=[],i=0;i<str.length;++i)byteArray.push(255&str.charCodeAt(i));return byteArray}function utf16leToBytes(str,units){for(var c,hi,lo,byteArray=[],i=0;i<str.length&&!((units-=2)<0);++i)c=str.charCodeAt(i),hi=c>>8,lo=c%256,byteArray.push(lo),byteArray.push(hi);return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i<length&&!(i+offset>=dst.length||i>=src.length);++i)dst[i+offset]=src[i];return i}function isnan(val){return val!==val}var base64=__webpack_require__(104),ieee754=__webpack_require__(155),isArray=__webpack_require__(158);exports.Buffer=Buffer,exports.SlowBuffer=SlowBuffer,exports.INSPECT_MAX_BYTES=50,Buffer.TYPED_ARRAY_SUPPORT=void 0!==global.TYPED_ARRAY_SUPPORT?global.TYPED_ARRAY_SUPPORT:typedArraySupport(),exports.kMaxLength=kMaxLength(),Buffer.poolSize=8192,Buffer._augment=function(arr){return arr.__proto__=Buffer.prototype,arr},Buffer.from=function(value,encodingOrOffset,length){return from(null,value,encodingOrOffset,length)},Buffer.TYPED_ARRAY_SUPPORT&&(Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Buffer[Symbol.species]===Buffer&&Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:!0})),Buffer.alloc=function(size,fill,encoding){return alloc(null,size,fill,encoding)},Buffer.allocUnsafe=function(size){return allocUnsafe(null,size)},Buffer.allocUnsafeSlow=function(size){return allocUnsafe(null,size)},Buffer.isBuffer=function(b){return!(null==b||!b._isBuffer)},Buffer.compare=function(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var x=a.length,y=b.length,i=0,len=Math.min(x,y);i<len;++i)if(a[i]!==b[i]){x=a[i],y=b[i];break}return x<y?-1:y<x?1:0},Buffer.isEncoding=function(encoding){switch(String(encoding).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer.concat=function(list,length){if(!isArray(list))throw new TypeError('"list" argument must be an Array of Buffers');if(0===list.length)return Buffer.alloc(0);var i;if(void 0===length)for(length=0,i=0;i<list.length;++i)length+=list[i].length;var buffer=Buffer.allocUnsafe(length),pos=0;for(i=0;i<list.length;++i){var buf=list[i];if(!Buffer.isBuffer(buf))throw new TypeError('"list" argument must be an Array of Buffers');buf.copy(buffer,pos),pos+=buf.length}return buffer},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function(){var len=this.length;if(len%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var i=0;i<len;i+=2)swap(this,i,i+1);return this},Buffer.prototype.swap32=function(){var len=this.length;if(len%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var i=0;i<len;i+=4)swap(this,i,i+3),swap(this,i+1,i+2);return this},Buffer.prototype.swap64=function(){var len=this.length;if(len%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var i=0;i<len;i+=8)swap(this,i,i+7),swap(this,i+1,i+6),swap(this,i+2,i+5),swap(this,i+3,i+4);return this},Buffer.prototype.toString=function(){var length=0|this.length;return 0===length?"":0===arguments.length?utf8Slice(this,0,length):slowToString.apply(this,arguments)},Buffer.prototype.equals=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return this===b||0===Buffer.compare(this,b)},Buffer.prototype.inspect=function(){var str="",max=exports.INSPECT_MAX_BYTES;return this.length>0&&(str=this.toString("hex",0,max).match(/.{2}/g).join(" "),this.length>max&&(str+=" ... ")),"<Buffer "+str+">"},Buffer.prototype.compare=function(target,start,end,thisStart,thisEnd){if(!Buffer.isBuffer(target))throw new TypeError("Argument must be a Buffer");if(void 0===start&&(start=0),void 0===end&&(end=target?target.length:0),void 0===thisStart&&(thisStart=0),void 0===thisEnd&&(thisEnd=this.length),start<0||end>target.length||thisStart<0||thisEnd>this.length)throw new RangeError("out of range index");if(thisStart>=thisEnd&&start>=end)return 0;if(thisStart>=thisEnd)return-1;if(start>=end)return 1;if(start>>>=0,end>>>=0,thisStart>>>=0,thisEnd>>>=0,this===target)return 0;for(var x=thisEnd-thisStart,y=end-start,len=Math.min(x,y),thisCopy=this.slice(thisStart,thisEnd),targetCopy=target.slice(start,end),i=0;i<len;++i)if(thisCopy[i]!==targetCopy[i]){x=thisCopy[i],y=targetCopy[i];break}return x<y?-1:y<x?1:0},Buffer.prototype.includes=function(val,byteOffset,encoding){return this.indexOf(val,byteOffset,encoding)!==-1},Buffer.prototype.indexOf=function(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,!0)},Buffer.prototype.lastIndexOf=function(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,!1)},Buffer.prototype.write=function(string,offset,length,encoding){if(void 0===offset)encoding="utf8",length=this.length,offset=0;else if(void 0===length&&"string"==typeof offset)encoding=offset,length=this.length,offset=0;else{if(!isFinite(offset))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");offset|=0,isFinite(length)?(length|=0,void 0===encoding&&(encoding="utf8")):(encoding=length,length=void 0)}var remaining=this.length-offset;if((void 0===length||length>remaining)&&(length=remaining),string.length>0&&(length<0||offset<0)||offset>this.length)throw new RangeError("Attempt to write outside buffer bounds");encoding||(encoding="utf8");for(var loweredCase=!1;;)switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return latin1Write(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase(),loweredCase=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;Buffer.prototype.slice=function(start,end){var len=this.length;start=~~start,end=void 0===end?len:~~end,start<0?(start+=len,start<0&&(start=0)):start>len&&(start=len),end<0?(end+=len,end<0&&(end=0)):end>len&&(end=len),end<start&&(end=start);var newBuf;if(Buffer.TYPED_ARRAY_SUPPORT)newBuf=this.subarray(start,end),newBuf.__proto__=Buffer.prototype;else{var sliceLen=end-start;newBuf=new Buffer(sliceLen,void 0);for(var i=0;i<sliceLen;++i)newBuf[i]=this[i+start]}return newBuf},Buffer.prototype.readUIntLE=function(offset,byteLength,noAssert){offset|=0,byteLength|=0,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset],mul=1,i=0;++i<byteLength&&(mul*=256);)val+=this[offset+i]*mul;return val},Buffer.prototype.readUIntBE=function(offset,byteLength,noAssert){offset|=0,byteLength|=0,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset+--byteLength],mul=1;byteLength>0&&(mul*=256);)val+=this[offset+--byteLength]*mul;return val},Buffer.prototype.readUInt8=function(offset,noAssert){return noAssert||checkOffset(offset,1,this.length),this[offset]},Buffer.prototype.readUInt16LE=function(offset,noAssert){return noAssert||checkOffset(offset,2,this.length),this[offset]|this[offset+1]<<8},Buffer.prototype.readUInt16BE=function(offset,noAssert){return noAssert||checkOffset(offset,2,this.length),this[offset]<<8|this[offset+1]},Buffer.prototype.readUInt32LE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+16777216*this[offset+3]},Buffer.prototype.readUInt32BE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),16777216*this[offset]+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])},Buffer.prototype.readIntLE=function(offset,byteLength,noAssert){offset|=0,byteLength|=0,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset],mul=1,i=0;++i<byteLength&&(mul*=256);)val+=this[offset+i]*mul;return mul*=128,val>=mul&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readIntBE=function(offset,byteLength,noAssert){offset|=0,byteLength|=0,noAssert||checkOffset(offset,byteLength,this.length);for(var i=byteLength,mul=1,val=this[offset+--i];i>0&&(mul*=256);)val+=this[offset+--i]*mul;return mul*=128,val>=mul&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readInt8=function(offset,noAssert){return noAssert||checkOffset(offset,1,this.length),128&this[offset]?(255-this[offset]+1)*-1:this[offset]},Buffer.prototype.readInt16LE=function(offset,noAssert){noAssert||checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt16BE=function(offset,noAssert){noAssert||checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt32LE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24},Buffer.prototype.readInt32BE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]},Buffer.prototype.readFloatLE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!0,23,4)},Buffer.prototype.readFloatBE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!1,23,4)},Buffer.prototype.readDoubleLE=function(offset,noAssert){return noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!0,52,8)},Buffer.prototype.readDoubleBE=function(offset,noAssert){return noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!1,52,8)},Buffer.prototype.writeUIntLE=function(value,offset,byteLength,noAssert){if(value=+value,offset|=0,byteLength|=0,!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var mul=1,i=0;for(this[offset]=255&value;++i<byteLength&&(mul*=256);)this[offset+i]=value/mul&255;return offset+byteLength},Buffer.prototype.writeUIntBE=function(value,offset,byteLength,noAssert){if(value=+value,offset|=0,byteLength|=0,!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var i=byteLength-1,mul=1;for(this[offset+i]=255&value;--i>=0&&(mul*=256);)this[offset+i]=value/mul&255;return offset+byteLength},Buffer.prototype.writeUInt8=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(value=Math.floor(value)),this[offset]=255&value,offset+1},Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,65535,0),
|
||
Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8):objectWriteUInt16(this,value,offset,!0),offset+2},Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>8,this[offset+1]=255&value):objectWriteUInt16(this,value,offset,!1),offset+2},Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset+3]=value>>>24,this[offset+2]=value>>>16,this[offset+1]=value>>>8,this[offset]=255&value):objectWriteUInt32(this,value,offset,!0),offset+4},Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeIntLE=function(value,offset,byteLength,noAssert){if(value=+value,offset|=0,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0,mul=1,sub=0;for(this[offset]=255&value;++i<byteLength&&(mul*=256);)value<0&&0===sub&&0!==this[offset+i-1]&&(sub=1),this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength},Buffer.prototype.writeIntBE=function(value,offset,byteLength,noAssert){if(value=+value,offset|=0,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1,mul=1,sub=0;for(this[offset+i]=255&value;--i>=0&&(mul*=256);)value<0&&0===sub&&0!==this[offset+i+1]&&(sub=1),this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength},Buffer.prototype.writeInt8=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(value=Math.floor(value)),value<0&&(value=255+value+1),this[offset]=255&value,offset+1},Buffer.prototype.writeInt16LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8):objectWriteUInt16(this,value,offset,!0),offset+2},Buffer.prototype.writeInt16BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>8,this[offset+1]=255&value):objectWriteUInt16(this,value,offset,!1),offset+2},Buffer.prototype.writeInt32LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8,this[offset+2]=value>>>16,this[offset+3]=value>>>24):objectWriteUInt32(this,value,offset,!0),offset+4},Buffer.prototype.writeInt32BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),value<0&&(value=4294967295+value+1),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,!0,noAssert)},Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,!1,noAssert)},Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,!0,noAssert)},Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,!1,noAssert)},Buffer.prototype.copy=function(target,targetStart,start,end){if(start||(start=0),end||0===end||(end=this.length),targetStart>=target.length&&(targetStart=target.length),targetStart||(targetStart=0),end>0&&end<start&&(end=start),end===start)return 0;if(0===target.length||0===this.length)return 0;if(targetStart<0)throw new RangeError("targetStart out of bounds");if(start<0||start>=this.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");end>this.length&&(end=this.length),target.length-targetStart<end-start&&(end=target.length-targetStart+start);var i,len=end-start;if(this===target&&start<targetStart&&targetStart<end)for(i=len-1;i>=0;--i)target[i+targetStart]=this[i+start];else if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(i=0;i<len;++i)target[i+targetStart]=this[i+start];else Uint8Array.prototype.set.call(target,this.subarray(start,start+len),targetStart);return len},Buffer.prototype.fill=function(val,start,end,encoding){if("string"==typeof val){if("string"==typeof start?(encoding=start,start=0,end=this.length):"string"==typeof end&&(encoding=end,end=this.length),1===val.length){var code=val.charCodeAt(0);code<256&&(val=code)}if(void 0!==encoding&&"string"!=typeof encoding)throw new TypeError("encoding must be a string");if("string"==typeof encoding&&!Buffer.isEncoding(encoding))throw new TypeError("Unknown encoding: "+encoding)}else"number"==typeof val&&(val&=255);if(start<0||this.length<start||this.length<end)throw new RangeError("Out of range index");if(end<=start)return this;start>>>=0,end=void 0===end?this.length:end>>>0,val||(val=0);var i;if("number"==typeof val)for(i=start;i<end;++i)this[i]=val;else{var bytes=Buffer.isBuffer(val)?val:utf8ToBytes(new Buffer(val,encoding).toString()),len=bytes.length;for(i=0;i<end-start;++i)this[i+start]=bytes[i%len]}return this};var INVALID_BASE64_RE=/[^+\/0-9A-Za-z-_]/g}).call(exports,__webpack_require__(18).Buffer,__webpack_require__(10))},function(module,exports){module.exports=function(exec){try{return!!exec()}catch(e){return!0}}},function(module,exports){module.exports=function(it){return"object"==typeof it?null!==it:"function"==typeof it}},function(module,exports,__webpack_require__){var $keys=__webpack_require__(69),enumBugKeys=__webpack_require__(40);module.exports=Object.keys||function(O){return $keys(O,enumBugKeys)}},function(module,exports){var toString={}.toString;module.exports=function(it){return toString.call(it).slice(8,-1)}},function(module,exports,__webpack_require__){var aFunction=__webpack_require__(37);module.exports=function(fn,that,length){if(aFunction(fn),void 0===that)return fn;switch(length){case 1:return function(a){return fn.call(that,a)};case 2:return function(a,b){return fn.call(that,a,b)};case 3:return function(a,b,c){return fn.call(that,a,b,c)}}return function(){return fn.apply(that,arguments)}}},function(module,exports){module.exports={}},function(module,exports){"use strict";module.exports=function(op,done){function sink(_read){return read=_read,abort?sink.abort():void function next(){for(var loop=!0,cbed=!1;loop;)if(cbed=!1,read(null,function(end,data){if(cbed=!0,end=end||abort){if(loop=!1,done)done(end===!0?null:end);else if(end&&end!==!0)throw end}else op&&!1===op(data)||abort?(loop=!1,read(abort||!0,done||function(){})):loop||next()}),!cbed)return void(loop=!1)}()}var read,abort;return sink.abort=function(err,cb){if("function"==typeof err&&(cb=err,err=!0),abort=err||!0,read)return read(abort,cb||function(){})},sink}},function(module,exports){module.exports=function(key){return key&&("string"==typeof key?function(data){return data[key]}:"object"==typeof key&&"function"==typeof key.exec?function(data){var v=key.exec(data);return v&&v[0]}:key)}},function(module,exports,__webpack_require__){(function(setImmediate,clearImmediate){function Timeout(id,clearFn){this._id=id,this._clearFn=clearFn}var nextTick=__webpack_require__(167).nextTick,apply=Function.prototype.apply,slice=Array.prototype.slice,immediateIds={},nextImmediateId=0;exports.setTimeout=function(){return new Timeout(apply.call(setTimeout,window,arguments),clearTimeout)},exports.setInterval=function(){return new Timeout(apply.call(setInterval,window,arguments),clearInterval)},exports.clearTimeout=exports.clearInterval=function(timeout){timeout.close()},Timeout.prototype.unref=Timeout.prototype.ref=function(){},Timeout.prototype.close=function(){this._clearFn.call(window,this._id)},exports.enroll=function(item,msecs){clearTimeout(item._idleTimeoutId),item._idleTimeout=msecs},exports.unenroll=function(item){clearTimeout(item._idleTimeoutId),item._idleTimeout=-1},exports._unrefActive=exports.active=function(item){clearTimeout(item._idleTimeoutId);var msecs=item._idleTimeout;msecs>=0&&(item._idleTimeoutId=setTimeout(function(){item._onTimeout&&item._onTimeout()},msecs))},exports.setImmediate="function"==typeof setImmediate?setImmediate:function(fn){var id=nextImmediateId++,args=!(arguments.length<2)&&slice.call(arguments,1);return immediateIds[id]=!0,nextTick(function(){immediateIds[id]&&(args?fn.apply(null,args):fn.call(null),exports.clearImmediate(id))}),id},exports.clearImmediate="function"==typeof clearImmediate?clearImmediate:function(id){delete immediateIds[id]}}).call(exports,__webpack_require__(27).setImmediate,__webpack_require__(27).clearImmediate)},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _promise=__webpack_require__(57),_promise2=_interopRequireDefault(_promise),_assign=__webpack_require__(5),_assign2=_interopRequireDefault(_assign),_classCallCheck2=__webpack_require__(0),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(1),_createClass3=_interopRequireDefault(_createClass2),EventEmitter=__webpack_require__(54).EventEmitter,Log=__webpack_require__(91),Index=__webpack_require__(98),DefaultOptions={Index:Index,maxHistory:256},Store=function(){function Store(ipfs,id,dbname){var options=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};(0,_classCallCheck3.default)(this,Store),this.id=id,this.dbname=dbname,this.events=new EventEmitter;var opts=(0,_assign2.default)({},DefaultOptions);(0,_assign2.default)(opts,options),this.options=opts,this._ipfs=ipfs,this._index=new this.options.Index(this.id),this._oplog=new Log(this._ipfs,this.id,this.options),this._lastWrite=[]}return(0,_createClass3.default)(Store,[{key:"loadHistory",value:function(hash){var _this=this;return this._lastWrite.includes(hash)?_promise2.default.resolve([]):(hash&&this._lastWrite.push(hash),this.events.emit("load",this.dbname,hash),hash&&this.options.maxHistory>0?Log.fromIpfsHash(this._ipfs,hash,this.options).then(function(log){return _this._oplog.join(log)}).then(function(merged){_this._index.updateIndex(_this._oplog,merged),_this.events.emit("history",_this.dbname,merged)}).then(function(){return _this.events.emit("ready",_this.dbname)}).then(function(){return _this}):(this.events.emit("ready",this.dbname),_promise2.default.resolve(this)))}},{key:"sync",value:function(hash){var _this2=this;if(!hash||this._lastWrite.includes(hash))return _promise2.default.resolve([]);var newItems=[];hash&&this._lastWrite.push(hash),this.events.emit("sync",this.dbname);(new Date).getTime();return Log.fromIpfsHash(this._ipfs,hash,this.options).then(function(log){return _this2._oplog.join(log)}).then(function(merged){return newItems=merged}).then(function(){return _this2._index.updateIndex(_this2._oplog,newItems)}).then(function(){newItems.reverse().forEach(function(e){return _this2.events.emit("data",_this2.dbname,e)})}).then(function(){return newItems})}},{key:"close",value:function(){this.delete(),this.events.emit("close",this.dbname)}},{key:"delete",value:function(){this._index=new this.options.Index(this.id),this._oplog=new Log(this._ipfs,this.id,this.options)}},{key:"_addOperation",value:function(data){var _this3=this,result=void 0,logHash=void 0;if(this._oplog)return this._oplog.add(data).then(function(res){return result=res}).then(function(){return Log.getIpfsHash(_this3._ipfs,_this3._oplog)}).then(function(hash){return logHash=hash}).then(function(){return _this3._lastWrite.push(logHash)}).then(function(){return _this3._index.updateIndex(_this3._oplog,[result])}).then(function(){return _this3.events.emit("write",_this3.dbname,logHash)}).then(function(){return _this3.events.emit("data",_this3.dbname,result)}).then(function(){return result.hash})}}]),Store}();module.exports=Store},function(module,exports){module.exports=!0},function(module,exports){exports.f={}.propertyIsEnumerable},function(module,exports){module.exports=function(bitmap,value){return{enumerable:!(1&bitmap),configurable:!(2&bitmap),writable:!(4&bitmap),value:value}}},function(module,exports,__webpack_require__){var def=__webpack_require__(9).f,has=__webpack_require__(11),TAG=__webpack_require__(3)("toStringTag");module.exports=function(it,tag,stat){it&&!has(it=stat?it:it.prototype,TAG)&&def(it,TAG,{configurable:!0,value:tag})}},function(module,exports,__webpack_require__){var defined=__webpack_require__(38);module.exports=function(it){return Object(defined(it))}},function(module,exports){var id=0,px=Math.random();module.exports=function(key){return"Symbol(".concat(void 0===key?"":key,")_",(++id+px).toString(36))}},function(module,exports,__webpack_require__){exports.nextTick=function(fn){setTimeout(fn,0)},exports.platform=exports.arch=exports.execPath=exports.title="browser",exports.pid=1,exports.browser=!0,exports.env={},exports.argv=[],exports.binding=function(name){throw new Error("No such module. (Possibly not yet loaded)")},function(){var path,cwd="/";exports.cwd=function(){return cwd},exports.chdir=function(dir){path||(path=__webpack_require__(166)),cwd=path.resolve(dir,cwd)}}(),exports.exit=exports.kill=exports.umask=exports.dlopen=exports.uptime=exports.memoryUsage=exports.uvCounters=function(){},exports.features={}},function(module,exports,__webpack_require__){module.exports={default:__webpack_require__(106),__esModule:!0}},function(module,exports){module.exports=function(it){if("function"!=typeof it)throw TypeError(it+" is not a function!");return it}},function(module,exports){module.exports=function(it){if(void 0==it)throw TypeError("Can't call method on "+it);return it}},function(module,exports,__webpack_require__){var isObject=__webpack_require__(20),document=__webpack_require__(4).document,is=isObject(document)&&isObject(document.createElement);module.exports=function(it){return is?document.createElement(it):{}}},function(module,exports){module.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(module,exports,__webpack_require__){var anObject=__webpack_require__(6),dPs=__webpack_require__(133),enumBugKeys=__webpack_require__(40),IE_PROTO=__webpack_require__(44)("IE_PROTO"),Empty=function(){},PROTOTYPE="prototype",createDict=function(){var iframeDocument,iframe=__webpack_require__(39)("iframe"),i=enumBugKeys.length,lt="<",gt=">";for(iframe.style.display="none",__webpack_require__(61).appendChild(iframe),iframe.src="javascript:",iframeDocument=iframe.contentWindow.document,iframeDocument.open(),iframeDocument.write(lt+"script"+gt+"document.F=Object"+lt+"/script"+gt),iframeDocument.close(),createDict=iframeDocument.F;i--;)delete createDict[PROTOTYPE][enumBugKeys[i]];return createDict()};module.exports=Object.create||function(O,Properties){var result;return null!==O?(Empty[PROTOTYPE]=anObject(O),result=new Empty,Empty[PROTOTYPE]=null,result[IE_PROTO]=O):result=createDict(),void 0===Properties?result:dPs(result,Properties)}},function(module,exports){exports.f=Object.getOwnPropertySymbols},function(module,exports,__webpack_require__){var $export=__webpack_require__(8),core=__webpack_require__(2),fails=__webpack_require__(19);module.exports=function(KEY,exec){var fn=(core.Object||{})[KEY]||Object[KEY],exp={};exp[KEY]=exec(fn),$export($export.S+$export.F*fails(function(){fn(1)}),"Object",exp)}},function(module,exports,__webpack_require__){var shared=__webpack_require__(45)("keys"),uid=__webpack_require__(34);module.exports=function(key){return shared[key]||(shared[key]=uid(key))}},function(module,exports,__webpack_require__){var global=__webpack_require__(4),SHARED="__core-js_shared__",store=global[SHARED]||(global[SHARED]={});module.exports=function(key){return store[key]||(store[key]={})}},function(module,exports){var ceil=Math.ceil,floor=Math.floor;module.exports=function(it){return isNaN(it=+it)?0:(it>0?floor:ceil)(it)}},function(module,exports,__webpack_require__){var isObject=__webpack_require__(20);module.exports=function(it,S){if(!isObject(it))return it;var fn,val;if(S&&"function"==typeof(fn=it.toString)&&!isObject(val=fn.call(it)))return val;if("function"==typeof(fn=it.valueOf)&&!isObject(val=fn.call(it)))return val;if(!S&&"function"==typeof(fn=it.toString)&&!isObject(val=fn.call(it)))return val;throw TypeError("Can't convert object to primitive value")}},function(module,exports,__webpack_require__){var global=__webpack_require__(4),core=__webpack_require__(2),LIBRARY=__webpack_require__(29),wksExt=__webpack_require__(49),defineProperty=__webpack_require__(9).f;module.exports=function(name){var $Symbol=core.Symbol||(core.Symbol=LIBRARY?{}:global.Symbol||{});"_"==name.charAt(0)||name in $Symbol||defineProperty($Symbol,name,{value:wksExt.f(name)})}},function(module,exports,__webpack_require__){exports.f=__webpack_require__(3)},function(module,exports,__webpack_require__){"use strict";var drain=__webpack_require__(25);module.exports=function(reducer,acc,cb){return drain(function(data){acc=reducer(acc,data)},function(err){cb(err,acc)})}},function(module,exports,__webpack_require__){"use strict";var abortCb=__webpack_require__(80);module.exports=function(array,onAbort){if(!array)return function(abort,cb){return abort?abortCb(cb,abort,onAbort):cb(!0)};Array.isArray(array)||(array=Object.keys(array).map(function(k){return array[k]}));var i=0;return function(abort,cb){return abort?abortCb(cb,abort,onAbort):void(i>=array.length?cb(!0):cb(null,array[i++]))}}},function(module,exports,__webpack_require__){"use strict";var tester=__webpack_require__(81);module.exports=function(test){return test=tester(test),function(read){return function next(end,cb){for(var sync,loop=!0;loop;)loop=!1,sync=!0,read(end,function(end,data){return end||test(data)?void cb(end,data):sync?loop=!0:next(end,cb)}),sync=!1}}}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _defineProperty2=__webpack_require__(103),_defineProperty3=_interopRequireDefault(_defineProperty2),_iterator2=__webpack_require__(58),_iterator3=_interopRequireDefault(_iterator2),_getPrototypeOf=__webpack_require__(15),_getPrototypeOf2=_interopRequireDefault(_getPrototypeOf),_assign=__webpack_require__(5),_assign2=_interopRequireDefault(_assign),_classCallCheck2=__webpack_require__(0),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(1),_createClass3=_interopRequireDefault(_createClass2),_possibleConstructorReturn2=__webpack_require__(17),_possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2),_inherits2=__webpack_require__(16),_inherits3=_interopRequireDefault(_inherits2),take=(__webpack_require__(163),__webpack_require__(76)),findIndex=__webpack_require__(161),Store=__webpack_require__(28),EventIndex=__webpack_require__(55),EventStore=function(_Store){function EventStore(ipfs,id,dbname){var options=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return(0,_classCallCheck3.default)(this,EventStore),void 0===options.Index&&(0,_assign2.default)(options,{Index:EventIndex}),(0,_possibleConstructorReturn3.default)(this,(EventStore.__proto__||(0,_getPrototypeOf2.default)(EventStore)).call(this,ipfs,id,dbname,options))}return(0,_inherits3.default)(EventStore,_Store),(0,_createClass3.default)(EventStore,[{key:"add",value:function(data){return this._addOperation({op:"ADD",key:null,value:data,meta:{ts:(new Date).getTime()}})}},{key:"get",value:function(hash){return this.iterator({gte:hash,limit:1}).collect()[0]}},{key:"iterator",value:function iterator(options){var _iterator,messages=this._query(options),currentIndex=0,iterator=(_iterator={},(0,_defineProperty3.default)(_iterator,_iterator3.default,function(){return this}),(0,_defineProperty3.default)(_iterator,"next",function(){var item={value:null,done:!0};return currentIndex<messages.length&&(item={value:messages[currentIndex],done:!1},currentIndex++),item}),(0,_defineProperty3.default)(_iterator,"collect",function(){return messages}),_iterator);return iterator}},{key:"_query",value:function(opts){opts||(opts={});var amount=opts.limit?opts.limit>-1?opts.limit:this._index.get().length:1,events=this._index.get(),result=[];return result=opts.gt||opts.gte?this._read(events,opts.gt?opts.gt:opts.gte,amount,!!opts.gte):this._read(events.reverse(),opts.lt?opts.lt:opts.lte,amount,opts.lte||!opts.lt).reverse()}},{key:"_read",value:function(ops,hash,amount,inclusive){var startIndex=Math.max(findIndex(ops,function(e){return e.hash===hash}),0);return startIndex+=inclusive?0:1,take(ops.slice(startIndex),amount)}}]),EventStore}(Store);module.exports=EventStore},function(module,exports){function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function isFunction(arg){return"function"==typeof arg}function isNumber(arg){return"number"==typeof arg}function isObject(arg){return"object"==typeof arg&&null!==arg}function isUndefined(arg){return void 0===arg}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||n<0||isNaN(n))throw TypeError("n must be a positive number");return this._maxListeners=n,this},EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(this._events||(this._events={}),"error"===type&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length)){if(er=arguments[1],er instanceof Error)throw er;var err=new Error('Uncaught, unspecified "error" event. ('+er+")");throw err.context=er,err}if(handler=this._events[type],isUndefined(handler))return!1;if(isFunction(handler))switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:args=Array.prototype.slice.call(arguments,1),handler.apply(this,args)}else if(isObject(handler))for(args=Array.prototype.slice.call(arguments,1),listeners=handler.slice(),len=listeners.length,i=0;i<len;i++)listeners[i].apply(this,args);return!0},EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",type,isFunction(listener.listener)?listener.listener:listener),this._events[type]?isObject(this._events[type])?this._events[type].push(listener):this._events[type]=[this._events[type],listener]:this._events[type]=listener,isObject(this._events[type])&&!this._events[type].warned&&(m=isUndefined(this._maxListeners)?EventEmitter.defaultMaxListeners:this._maxListeners,m&&m>0&&this._events[type].length>m&&(this._events[type].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[type].length),"function"==typeof console.trace&&console.trace())),this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(type,listener){function g(){this.removeListener(type,g),fired||(fired=!0,listener.apply(this,arguments))}if(!isFunction(listener))throw TypeError("listener must be a function");var fired=!1;return g.listener=listener,this.on(type,g),this},EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;if(list=this._events[type],length=list.length,position=-1,list===listener||isFunction(list.listener)&&list.listener===listener)delete this._events[type],this._events.removeListener&&this.emit("removeListener",type,listener);else if(isObject(list)){for(i=length;i-- >0;)if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}if(position<0)return this;1===list.length?(list.length=0,delete this._events[type]):list.splice(position,1),this._events.removeListener&&this.emit("removeListener",type,listener)}return this},EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[type]&&delete this._events[type],this;if(0===arguments.length){for(key in this._events)"removeListener"!==key&&this.removeAllListeners(key);return this.removeAllListeners("removeListener"),this._events={},this}if(listeners=this._events[type],isFunction(listeners))this.removeListener(type,listeners);else if(listeners)for(;listeners.length;)this.removeListener(type,listeners[listeners.length-1]);return delete this._events[type],this},EventEmitter.prototype.listeners=function(type){var ret;return ret=this._events&&this._events[type]?isFunction(this._events[type])?[this._events[type]]:this._events[type].slice():[]},EventEmitter.prototype.listenerCount=function(type){if(this._events){var evlistener=this._events[type];if(isFunction(evlistener))return 1;if(evlistener)return evlistener.length}return 0},EventEmitter.listenerCount=function(emitter,type){return emitter.listenerCount(type)}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _keys=__webpack_require__(14),_keys2=_interopRequireDefault(_keys),_classCallCheck2=__webpack_require__(0),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(1),_createClass3=_interopRequireDefault(_createClass2),EventIndex=function(){function EventIndex(){(0,_classCallCheck3.default)(this,EventIndex),this._index={}}return(0,_createClass3.default)(EventIndex,[{key:"get",value:function(){var _this=this;return(0,_keys2.default)(this._index).map(function(f){return _this._index[f]})}},{key:"updateIndex",value:function(oplog,added){var _this2=this;added.reduce(function(handled,item){return handled.includes(item.hash)||(handled.push(item.hash),"ADD"===item.payload.op&&(_this2._index[item.hash]=item)),handled},[])}}]),EventIndex}();module.exports=EventIndex},function(module,exports,__webpack_require__){module.exports={default:__webpack_require__(109),__esModule:!0}},function(module,exports,__webpack_require__){module.exports={default:__webpack_require__(114),__esModule:!0}},function(module,exports,__webpack_require__){module.exports={default:__webpack_require__(116),__esModule:!0}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.__esModule=!0;var _iterator=__webpack_require__(58),_iterator2=_interopRequireDefault(_iterator),_symbol=__webpack_require__(102),_symbol2=_interopRequireDefault(_symbol),_typeof="function"==typeof _symbol2.default&&"symbol"==typeof _iterator2.default?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof _symbol2.default&&obj.constructor===_symbol2.default&&obj!==_symbol2.default.prototype?"symbol":typeof obj};exports.default="function"==typeof _symbol2.default&&"symbol"===_typeof(_iterator2.default)?function(obj){return"undefined"==typeof obj?"undefined":_typeof(obj)}:function(obj){return obj&&"function"==typeof _symbol2.default&&obj.constructor===_symbol2.default&&obj!==_symbol2.default.prototype?"symbol":"undefined"==typeof obj?"undefined":_typeof(obj)}},function(module,exports,__webpack_require__){var cof=__webpack_require__(22),TAG=__webpack_require__(3)("toStringTag"),ARG="Arguments"==cof(function(){return arguments}()),tryGet=function(it,key){try{return it[key]}catch(e){}};module.exports=function(it){var O,T,B;return void 0===it?"Undefined":null===it?"Null":"string"==typeof(T=tryGet(O=Object(it),TAG))?T:ARG?cof(O):"Object"==(B=cof(O))&&"function"==typeof O.callee?"Arguments":B}},function(module,exports,__webpack_require__){module.exports=__webpack_require__(4).document&&document.documentElement},function(module,exports,__webpack_require__){module.exports=!__webpack_require__(7)&&!__webpack_require__(19)(function(){return 7!=Object.defineProperty(__webpack_require__(39)("div"),"a",{get:function(){return 7}}).a})},function(module,exports,__webpack_require__){var cof=__webpack_require__(22);module.exports=Object("z").propertyIsEnumerable(0)?Object:function(it){return"String"==cof(it)?it.split(""):Object(it)}},function(module,exports,__webpack_require__){"use strict";var LIBRARY=__webpack_require__(29),$export=__webpack_require__(8),redefine=__webpack_require__(70),hide=__webpack_require__(12),has=__webpack_require__(11),Iterators=__webpack_require__(24),$iterCreate=__webpack_require__(126),setToStringTag=__webpack_require__(32),getPrototypeOf=__webpack_require__(68),ITERATOR=__webpack_require__(3)("iterator"),BUGGY=!([].keys&&"next"in[].keys()),FF_ITERATOR="@@iterator",KEYS="keys",VALUES="values",returnThis=function(){return this};module.exports=function(Base,NAME,Constructor,next,DEFAULT,IS_SET,FORCED){$iterCreate(Constructor,NAME,next);var methods,key,IteratorPrototype,getMethod=function(kind){if(!BUGGY&&kind in proto)return proto[kind];switch(kind){case KEYS:return function(){return new Constructor(this,kind)};case VALUES:return function(){return new Constructor(this,kind)}}return function(){return new Constructor(this,kind)}},TAG=NAME+" Iterator",DEF_VALUES=DEFAULT==VALUES,VALUES_BUG=!1,proto=Base.prototype,$native=proto[ITERATOR]||proto[FF_ITERATOR]||DEFAULT&&proto[DEFAULT],$default=$native||getMethod(DEFAULT),$entries=DEFAULT?DEF_VALUES?getMethod("entries"):$default:void 0,$anyNative="Array"==NAME?proto.entries||$native:$native;if($anyNative&&(IteratorPrototype=getPrototypeOf($anyNative.call(new Base)),IteratorPrototype!==Object.prototype&&(setToStringTag(IteratorPrototype,TAG,!0),LIBRARY||has(IteratorPrototype,ITERATOR)||hide(IteratorPrototype,ITERATOR,returnThis))),DEF_VALUES&&$native&&$native.name!==VALUES&&(VALUES_BUG=!0,$default=function(){return $native.call(this)}),LIBRARY&&!FORCED||!BUGGY&&!VALUES_BUG&&proto[ITERATOR]||hide(proto,ITERATOR,$default),Iterators[NAME]=$default,Iterators[TAG]=returnThis,DEFAULT)if(methods={values:DEF_VALUES?$default:getMethod(VALUES),keys:IS_SET?$default:getMethod(KEYS),entries:$entries},FORCED)for(key in methods)key in proto||redefine(proto,key,methods[key]);else $export($export.P+$export.F*(BUGGY||VALUES_BUG),NAME,methods);return methods}},function(module,exports,__webpack_require__){var pIE=__webpack_require__(30),createDesc=__webpack_require__(31),toIObject=__webpack_require__(13),toPrimitive=__webpack_require__(47),has=__webpack_require__(11),IE8_DOM_DEFINE=__webpack_require__(62),gOPD=Object.getOwnPropertyDescriptor;exports.f=__webpack_require__(7)?gOPD:function(O,P){if(O=toIObject(O),P=toPrimitive(P,!0),IE8_DOM_DEFINE)try{return gOPD(O,P)}catch(e){}if(has(O,P))return createDesc(!pIE.f.call(O,P),O[P])}},function(module,exports,__webpack_require__){var toIObject=__webpack_require__(13),gOPN=__webpack_require__(67).f,toString={}.toString,windowNames="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],getWindowNames=function(it){try{return gOPN(it)}catch(e){return windowNames.slice()}};module.exports.f=function(it){return windowNames&&"[object Window]"==toString.call(it)?getWindowNames(it):gOPN(toIObject(it))}},function(module,exports,__webpack_require__){var $keys=__webpack_require__(69),hiddenKeys=__webpack_require__(40).concat("length","prototype");
|
||
exports.f=Object.getOwnPropertyNames||function(O){return $keys(O,hiddenKeys)}},function(module,exports,__webpack_require__){var has=__webpack_require__(11),toObject=__webpack_require__(33),IE_PROTO=__webpack_require__(44)("IE_PROTO"),ObjectProto=Object.prototype;module.exports=Object.getPrototypeOf||function(O){return O=toObject(O),has(O,IE_PROTO)?O[IE_PROTO]:"function"==typeof O.constructor&&O instanceof O.constructor?O.constructor.prototype:O instanceof Object?ObjectProto:null}},function(module,exports,__webpack_require__){var has=__webpack_require__(11),toIObject=__webpack_require__(13),arrayIndexOf=__webpack_require__(119)(!1),IE_PROTO=__webpack_require__(44)("IE_PROTO");module.exports=function(object,names){var key,O=toIObject(object),i=0,result=[];for(key in O)key!=IE_PROTO&&has(O,key)&&result.push(key);for(;names.length>i;)has(O,key=names[i++])&&(~arrayIndexOf(result,key)||result.push(key));return result}},function(module,exports,__webpack_require__){module.exports=__webpack_require__(12)},function(module,exports,__webpack_require__){var defer,channel,port,ctx=__webpack_require__(23),invoke=__webpack_require__(122),html=__webpack_require__(61),cel=__webpack_require__(39),global=__webpack_require__(4),process=global.process,setTask=global.setImmediate,clearTask=global.clearImmediate,MessageChannel=global.MessageChannel,counter=0,queue={},ONREADYSTATECHANGE="onreadystatechange",run=function(){var id=+this;if(queue.hasOwnProperty(id)){var fn=queue[id];delete queue[id],fn()}},listener=function(event){run.call(event.data)};setTask&&clearTask||(setTask=function(fn){for(var args=[],i=1;arguments.length>i;)args.push(arguments[i++]);return queue[++counter]=function(){invoke("function"==typeof fn?fn:Function(fn),args)},defer(counter),counter},clearTask=function(id){delete queue[id]},"process"==__webpack_require__(22)(process)?defer=function(id){process.nextTick(ctx(run,id,1))}:MessageChannel?(channel=new MessageChannel,port=channel.port2,channel.port1.onmessage=listener,defer=ctx(port.postMessage,port,1)):global.addEventListener&&"function"==typeof postMessage&&!global.importScripts?(defer=function(id){global.postMessage(id+"","*")},global.addEventListener("message",listener,!1)):defer=ONREADYSTATECHANGE in cel("script")?function(id){html.appendChild(cel("script"))[ONREADYSTATECHANGE]=function(){html.removeChild(this),run.call(id)}}:function(id){setTimeout(ctx(run,id,1),0)}),module.exports={set:setTask,clear:clearTask}},function(module,exports,__webpack_require__){var toInteger=__webpack_require__(46),min=Math.min;module.exports=function(it){return it>0?min(toInteger(it),9007199254740991):0}},function(module,exports){},function(module,exports,__webpack_require__){"use strict";var $at=__webpack_require__(138)(!0);__webpack_require__(64)(String,"String",function(iterated){this._t=String(iterated),this._i=0},function(){var point,O=this._t,index=this._i;return index>=O.length?{value:void 0,done:!0}:(point=$at(O,index),this._i+=point.length,{value:point,done:!1})})},function(module,exports,__webpack_require__){__webpack_require__(141);for(var global=__webpack_require__(4),hide=__webpack_require__(12),Iterators=__webpack_require__(24),TO_STRING_TAG=__webpack_require__(3)("toStringTag"),collections=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],i=0;i<5;i++){var NAME=collections[i],Collection=global[NAME],proto=Collection&&Collection.prototype;proto&&!proto[TO_STRING_TAG]&&hide(proto,TO_STRING_TAG,NAME),Iterators[NAME]=Iterators.Array}},function(module,exports){function baseSlice(array,start,end){var index=-1,length=array.length;start<0&&(start=-start>length?0:length+start),end=end>length?length:end,end<0&&(end+=length),length=start>end?0:end-start>>>0,start>>>=0;for(var result=Array(length);++index<length;)result[index]=array[index+start];return result}function take(array,n,guard){return array&&array.length?(n=guard||void 0===n?1:toInteger(n),baseSlice(array,0,n<0?0:n)):[]}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}function isObjectLike(value){return!!value&&"object"==typeof value}function isSymbol(value){return"symbol"==typeof value||isObjectLike(value)&&objectToString.call(value)==symbolTag}function toFinite(value){if(!value)return 0===value?value:0;if(value=toNumber(value),value===INFINITY||value===-INFINITY){var sign=value<0?-1:1;return sign*MAX_INTEGER}return value===value?value:0}function toInteger(value){var result=toFinite(value),remainder=result%1;return result===result?remainder?result-remainder:result:0}function toNumber(value){if("number"==typeof value)return value;if(isSymbol(value))return NAN;if(isObject(value)){var other="function"==typeof value.valueOf?value.valueOf():value;value=isObject(other)?other+"":other}if("string"!=typeof value)return 0===value?value:+value;value=value.replace(reTrim,"");var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value}var INFINITY=1/0,MAX_INTEGER=1.7976931348623157e308,NAN=NaN,symbolTag="[object Symbol]",reTrim=/^\s+|\s+$/g,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt,objectProto=Object.prototype,objectToString=objectProto.toString;module.exports=take},function(module,exports,__webpack_require__){"use strict";var sources=__webpack_require__(180),sinks=__webpack_require__(174),throughs=__webpack_require__(186);exports=module.exports=__webpack_require__(170);for(var k in sources)exports[k]=sources[k];for(var k in throughs)exports[k]=throughs[k];for(var k in sinks)exports[k]=sinks[k]},function(module,exports,__webpack_require__){"use strict";var abortCb=__webpack_require__(80);module.exports=function(value,onAbort){return function(abort,cb){if(abort)return abortCb(cb,abort,onAbort);if(null!=value){var _value=value;value=null,cb(null,_value)}else cb(!0)}}},function(module,exports,__webpack_require__){"use strict";function id(e){return e}var prop=__webpack_require__(26),filter=__webpack_require__(52);module.exports=function(field,invert){field=prop(field)||id;var seen={};return filter(function(data){var key=field(data);return seen[key]?!!invert:(seen[key]=!0,!invert)})}},function(module,exports){module.exports=function(cb,abort,onAbort){cb(abort),onAbort&&onAbort(abort===!0?null:abort)}},function(module,exports,__webpack_require__){function id(e){return e}var prop=__webpack_require__(26);module.exports=function(test){return"object"==typeof test&&"function"==typeof test.test?function(data){return test.test(data)}:prop(test)||id}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _getPrototypeOf=__webpack_require__(15),_getPrototypeOf2=_interopRequireDefault(_getPrototypeOf),_assign=__webpack_require__(5),_assign2=_interopRequireDefault(_assign),_classCallCheck2=__webpack_require__(0),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(1),_createClass3=_interopRequireDefault(_createClass2),_possibleConstructorReturn2=__webpack_require__(17),_possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2),_inherits2=__webpack_require__(16),_inherits3=_interopRequireDefault(_inherits2),Store=__webpack_require__(28),CounterIndex=__webpack_require__(93),CounterStore=function(_Store){function CounterStore(ipfs,id,dbname){var options=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return(0,_classCallCheck3.default)(this,CounterStore),options.Index||(0,_assign2.default)(options,{Index:CounterIndex}),(0,_possibleConstructorReturn3.default)(this,(CounterStore.__proto__||(0,_getPrototypeOf2.default)(CounterStore)).call(this,ipfs,id,dbname,options))}return(0,_inherits3.default)(CounterStore,_Store),(0,_createClass3.default)(CounterStore,[{key:"inc",value:function(amount){var counter=this._index.get();if(counter)return counter.increment(amount),this._addOperation({op:"COUNTER",key:null,value:counter.payload,meta:{ts:(new Date).getTime()}})}},{key:"value",get:function(){return this._index.get().value}}]),CounterStore}(Store);module.exports=CounterStore},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _keys=__webpack_require__(14),_keys2=_interopRequireDefault(_keys),_getPrototypeOf=__webpack_require__(15),_getPrototypeOf2=_interopRequireDefault(_getPrototypeOf),_assign=__webpack_require__(5),_assign2=_interopRequireDefault(_assign),_classCallCheck2=__webpack_require__(0),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(1),_createClass3=_interopRequireDefault(_createClass2),_possibleConstructorReturn2=__webpack_require__(17),_possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2),_inherits2=__webpack_require__(16),_inherits3=_interopRequireDefault(_inherits2),Store=__webpack_require__(28),DocumentIndex=__webpack_require__(94),DocumentStore=function(_Store){function DocumentStore(ipfs,id,dbname,options){return(0,_classCallCheck3.default)(this,DocumentStore),options||(options={}),options.indexBy||(0,_assign2.default)(options,{indexBy:"_id"}),options.Index||(0,_assign2.default)(options,{Index:DocumentIndex}),(0,_possibleConstructorReturn3.default)(this,(DocumentStore.__proto__||(0,_getPrototypeOf2.default)(DocumentStore)).call(this,ipfs,id,dbname,options))}return(0,_inherits3.default)(DocumentStore,_Store),(0,_createClass3.default)(DocumentStore,[{key:"get",value:function(key){var _this2=this;return(0,_keys2.default)(this._index._index).filter(function(e){return e.indexOf(key)!==-1}).map(function(e){return _this2._index.get(e)})}},{key:"query",value:function(mapper){var _this3=this;return(0,_keys2.default)(this._index._index).map(function(e){return _this3._index.get(e)}).filter(function(e){return mapper(e)})}},{key:"put",value:function(doc){return this._addOperation({op:"PUT",key:doc[this.options.indexBy],value:doc,meta:{ts:(new Date).getTime()}})}},{key:"del",value:function(key){return this._addOperation({op:"DEL",key:key,value:null,meta:{ts:(new Date).getTime()}})}}]),DocumentStore}(Store);module.exports=DocumentStore},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _getPrototypeOf=__webpack_require__(15),_getPrototypeOf2=_interopRequireDefault(_getPrototypeOf),_assign=__webpack_require__(5),_assign2=_interopRequireDefault(_assign),_classCallCheck2=__webpack_require__(0),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(1),_createClass3=_interopRequireDefault(_createClass2),_possibleConstructorReturn2=__webpack_require__(17),_possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2),_inherits2=__webpack_require__(16),_inherits3=_interopRequireDefault(_inherits2),EventStore=__webpack_require__(53),FeedIndex=__webpack_require__(95),FeedStore=function(_EventStore){function FeedStore(ipfs,id,dbname,options){return(0,_classCallCheck3.default)(this,FeedStore),options||(options={}),options.Index||(0,_assign2.default)(options,{Index:FeedIndex}),(0,_possibleConstructorReturn3.default)(this,(FeedStore.__proto__||(0,_getPrototypeOf2.default)(FeedStore)).call(this,ipfs,id,dbname,options))}return(0,_inherits3.default)(FeedStore,_EventStore),(0,_createClass3.default)(FeedStore,[{key:"remove",value:function(hash){var operation={op:"DEL",key:null,value:hash,meta:{ts:(new Date).getTime()}};return this._addOperation(operation)}}]),FeedStore}(EventStore);module.exports=FeedStore},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _getPrototypeOf=__webpack_require__(15),_getPrototypeOf2=_interopRequireDefault(_getPrototypeOf),_assign=__webpack_require__(5),_assign2=_interopRequireDefault(_assign),_classCallCheck2=__webpack_require__(0),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(1),_createClass3=_interopRequireDefault(_createClass2),_possibleConstructorReturn2=__webpack_require__(17),_possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2),_inherits2=__webpack_require__(16),_inherits3=_interopRequireDefault(_inherits2),Store=__webpack_require__(28),KeyValueIndex=__webpack_require__(96),KeyValueStore=function(_Store){function KeyValueStore(ipfs,id,dbname,options){(0,_classCallCheck3.default)(this,KeyValueStore);var opts=(0,_assign2.default)({},{Index:KeyValueIndex});return(0,_assign2.default)(opts,options),(0,_possibleConstructorReturn3.default)(this,(KeyValueStore.__proto__||(0,_getPrototypeOf2.default)(KeyValueStore)).call(this,ipfs,id,dbname,opts))}return(0,_inherits3.default)(KeyValueStore,_Store),(0,_createClass3.default)(KeyValueStore,[{key:"get",value:function(key){return this._index.get(key)}},{key:"set",value:function(key,data){this.put(key,data)}},{key:"put",value:function(key,data){return this._addOperation({op:"PUT",key:key,value:data,meta:{ts:(new Date).getTime()}})}},{key:"del",value:function(key){return this._addOperation({op:"DEL",key:key,value:null,meta:{ts:(new Date).getTime()}})}}]),KeyValueStore}(Store);module.exports=KeyValueStore},function(module,exports,__webpack_require__){"use strict";module.exports=__webpack_require__(97)},function(module,exports,__webpack_require__){"use strict";(function(Buffer){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _stringify=__webpack_require__(36),_stringify2=_interopRequireDefault(_stringify),_promise=__webpack_require__(57),_promise2=_interopRequireDefault(_promise),_classCallCheck2=__webpack_require__(0),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(1),_createClass3=_interopRequireDefault(_createClass2),pull=__webpack_require__(77),BlobStore=__webpack_require__(154),Lock=__webpack_require__(159),filePath=void 0,store=void 0,cache={},lock=new Lock,Cache=function(){function Cache(){(0,_classCallCheck3.default)(this,Cache)}return(0,_createClass3.default)(Cache,null,[{key:"set",value:function(key,value){return new _promise2.default(function(resolve,reject){cache[key]=value,filePath&&store?lock(filePath,function(release){pull(pull.values([cache]),pull.map(function(v){return(0,_stringify2.default)(v,null,2)}),store.write(filePath,release(function(err){return err?reject(err):void resolve()})))}):resolve()})}},{key:"get",value:function(key){return cache[key]}},{key:"loadCache",value:function(){var cacheFile=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"orbit-db.cache";return cache={},store=new BlobStore(cacheFile),filePath=cacheFile,new _promise2.default(function(resolve,reject){store.exists(cacheFile,function(err,exists){return err||!exists?resolve():void lock(cacheFile,function(release){pull(store.read(cacheFile),pull.collect(release(function(err,res){return err?reject(err):(cache=JSON.parse(Buffer.concat(res).toString()||"{}"),void resolve())})))})})})}},{key:"reset",value:function(){cache={}}}]),Cache}();module.exports=Cache}).call(exports,__webpack_require__(18).Buffer)},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _keys=__webpack_require__(14),_keys2=_interopRequireDefault(_keys),_classCallCheck2=__webpack_require__(0),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(1),_createClass3=_interopRequireDefault(_createClass2),isEqual=__webpack_require__(89).isEqual,GCounter=function(){function GCounter(id,payload){(0,_classCallCheck3.default)(this,GCounter),this.id=id,this._counters=payload?payload:{},this._counters[this.id]=this._counters[this.id]?this._counters[this.id]:0}return(0,_createClass3.default)(GCounter,[{key:"increment",value:function(amount){amount||(amount=1),this._counters[this.id]=this._counters[this.id]+amount}},{key:"compare",value:function(other){return other.id===this.id&&isEqual(other._counters,this._counters)}},{key:"merge",value:function(other){var _this=this;(0,_keys2.default)(other._counters).forEach(function(f){_this._counters[f]=Math.max(_this._counters[f]?_this._counters[f]:0,other._counters[f])})}},{key:"value",get:function(){var _this2=this;return(0,_keys2.default)(this._counters).map(function(f){return _this2._counters[f]}).reduce(function(previousValue,currentValue){return previousValue+currentValue},0)}},{key:"payload",get:function(){return{id:this.id,counters:this._counters}}}],[{key:"from",value:function(payload){return new GCounter(payload.id,payload.counters)}}]),GCounter}();module.exports=GCounter},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _getOwnPropertyNames=__webpack_require__(100),_getOwnPropertyNames2=_interopRequireDefault(_getOwnPropertyNames);exports.isEqual=function(a,b){var propsA=(0,_getOwnPropertyNames2.default)(a),propsB=(0,_getOwnPropertyNames2.default)(b);if(propsA.length!==propsB.length)return!1;for(var i=0;i<propsA.length;i++){var prop=propsA[i];if(a[prop]!==b[prop])return!1}return!0}},function(module,exports,__webpack_require__){"use strict";(function(Buffer){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _stringify=__webpack_require__(36),_stringify2=_interopRequireDefault(_stringify),_classCallCheck2=__webpack_require__(0),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(1),_createClass3=_interopRequireDefault(_createClass2);module.exports=function(){function Entry(){(0,_classCallCheck3.default)(this,Entry)}return(0,_createClass3.default)(Entry,null,[{key:"create",value:function(ipfs,data){var next=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!ipfs)throw new Error("Entry requires ipfs instance");var nexts=null!==next&&next instanceof Array?next.map(function(e){return e.hash?e.hash:e}):[null!==next&&next.hash?next.hash:next],entry={hash:null,payload:data,next:nexts};return Entry.toIpfsHash(ipfs,entry).then(function(hash){return entry.hash=hash,entry})}},{key:"toIpfsHash",value:function(ipfs,entry){if(!ipfs)throw new Error("Entry requires ipfs instance");var data=new Buffer((0,_stringify2.default)(entry));return ipfs.object.put(data).then(function(res){return res.toJSON().Hash})}},{key:"fromIpfsHash",value:function(ipfs,hash){if(!ipfs)throw new Error("Entry requires ipfs instance");if(!hash)throw new Error("Invalid hash: "+hash);return ipfs.object.get(hash,{enc:"base58"}).then(function(obj){var data=JSON.parse(obj.toJSON().Data),entry={hash:hash,payload:data.payload,next:data.next};return entry})}},{key:"hasChild",value:function(entry1,entry2){return entry1.next.includes(entry2.hash)}},{key:"compare",value:function(a,b){return a.hash===b.hash}}]),Entry}()}).call(exports,__webpack_require__(18).Buffer)},function(module,exports,__webpack_require__){"use strict";(function(Buffer){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _stringify=__webpack_require__(36),_stringify2=_interopRequireDefault(_stringify),_assign=__webpack_require__(5),_assign2=_interopRequireDefault(_assign),_classCallCheck2=__webpack_require__(0),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(1),_createClass3=_interopRequireDefault(_createClass2),unionWith=__webpack_require__(164),differenceWith=__webpack_require__(160),flatten=__webpack_require__(162),take=__webpack_require__(76),Promise=__webpack_require__(105),Entry=__webpack_require__(90),MaxBatchSize=10,MaxHistory=256,Log=function(){function Log(ipfs,id,opts){(0,_classCallCheck3.default)(this,Log),this.id=id,this._ipfs=ipfs,this._items=opts&&opts.items?opts.items:[],this.options={maxHistory:MaxHistory},(0,_assign2.default)(this.options,opts),delete this.options.items,this._currentBatch=[],this._heads=[]}return(0,_createClass3.default)(Log,[{key:"add",value:function(data){var _this=this;return this._currentBatch.length>=MaxBatchSize&&this._commit(),Entry.create(this._ipfs,data,this._heads).then(function(entry){return _this._heads=[entry.hash],_this._currentBatch.push(entry),entry})}},{key:"join",value:function(other){var _this2=this;if(!other.items)throw new Error("The log to join must be an instance of Log");var newItems=other.items.slice(-Math.max(this.options.maxHistory,1)),diff=differenceWith(newItems,this.items,Entry.compare),final=unionWith(this._currentBatch,diff,Entry.compare);this._items=this._items.concat(final),this._currentBatch=[];var nexts=take(flatten(diff.map(function(f){return f.next})),this.options.maxHistory);return Promise.map(nexts,function(f){var all=_this2.items.map(function(a){return a.hash});return _this2._fetchRecursive(_this2._ipfs,f,all,_this2.options.maxHistory-nexts.length,0).then(function(history){return history.forEach(function(b){return _this2._insert(b)}),history})},{concurrency:1}).then(function(res){return _this2._heads=Log.findHeads(_this2),flatten(res).concat(diff)})}},{key:"_insert",value:function(entry){var _this3=this,indices=entry.next.map(function(next){return _this3._items.map(function(f){return f.hash}).indexOf(next)}),index=indices.length>0?Math.max(Math.max.apply(null,indices)+1,0):0;return this._items.splice(index,0,entry),entry}},{key:"_commit",value:function(){this._items=this._items.concat(this._currentBatch),this._currentBatch=[]}},{key:"_fetchRecursive",value:function(ipfs,hash,all,amount,depth){var _this4=this,isReferenced=function(list,item){return void 0!==list.reverse().find(function(f){return f===item})},result=[];return isReferenced(all,hash)||depth>=amount?Promise.resolve(result):Entry.fromIpfsHash(ipfs,hash).then(function(entry){return result.push(entry),all.push(hash),depth++,Promise.map(entry.next,function(f){return _this4._fetchRecursive(ipfs,f,all,amount,depth)},{concurrency:1}).then(function(res){return flatten(res.concat(result))})})}},{key:"items",get:function(){return this._items.concat(this._currentBatch)}},{key:"snapshot",get:function(){return{id:this.id,items:this._currentBatch.map(function(f){return f.hash})}}}],[{key:"getIpfsHash",value:function(ipfs,log){if(!ipfs)throw new Error("Ipfs instance not defined");var data=new Buffer((0,_stringify2.default)(log.snapshot));return ipfs.object.put(data).then(function(res){return res.toJSON().Hash})}},{key:"fromIpfsHash",value:function(ipfs,hash,options){if(!ipfs)throw new Error("Ipfs instance not defined");if(!hash)throw new Error("Invalid hash: "+hash);options||(options={});var logData=void 0;return ipfs.object.get(hash,{enc:"base58"}).then(function(res){return logData=JSON.parse(res.toJSON().Data)}).then(function(res){if(!logData.items)throw new Error("Not a Log instance");return Promise.all(logData.items.map(function(f){return Entry.fromIpfsHash(ipfs,f)}))}).then(function(items){return(0,_assign2.default)(options,{items:items})}).then(function(items){return new Log(ipfs,logData.id,options)})}},{key:"findHeads",value:function(log){return log.items.reverse().filter(function(f){return!Log.isReferencedInChain(log,f)}).map(function(f){return f.hash})}},{key:"isReferencedInChain",value:function(log,item){return void 0!==log.items.reverse().find(function(e){return Entry.hasChild(e,item)})}},{key:"batchSize",get:function(){return MaxBatchSize}}]),Log}();module.exports=Log}).call(exports,__webpack_require__(18).Buffer)},function(module,exports,__webpack_require__){"use strict";(function(process){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _keys=__webpack_require__(14),_keys2=_interopRequireDefault(_keys),_assign=__webpack_require__(5),_assign2=_interopRequireDefault(_assign),_classCallCheck2=__webpack_require__(0),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(1),_createClass3=_interopRequireDefault(_createClass2),fs=__webpack_require__(197),format=__webpack_require__(195).format,isNodejs=!!process.version,LogLevels={DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR",NONE:"NONE"},GlobalLogLevel=LogLevels.DEBUG,GlobalLogfile=null,Colors={Black:0,Red:1,Green:2,Yellow:3,Blue:4,Magenta:5,Cyan:6,Grey:7,White:9,Default:9};isNodejs||(Colors={Black:"Black",Red:"IndianRed",Green:"LimeGreen",Yellow:"Orange",Blue:"RoyalBlue",Magenta:"Orchid",Cyan:"SkyBlue",Grey:"DimGrey",White:"White",Default:"Black"});var loglevelColors=[Colors.Cyan,Colors.Green,Colors.Yellow,Colors.Red,Colors.Default],defaultOptions={useColors:!0,color:Colors.Default,showTimestamp:!0,showLevel:!0,filename:GlobalLogfile,appendFile:!0},Logger=function(){function Logger(category,options){(0,_classCallCheck3.default)(this,Logger),this.category=category;var opts={};(0,_assign2.default)(opts,defaultOptions),(0,_assign2.default)(opts,options),this.options=opts}return(0,_createClass3.default)(Logger,[{key:"debug",value:function(){this._write(LogLevels.DEBUG,format.apply(null,arguments))}},{key:"log",value:function(){this.debug.apply(this,arguments)}},{key:"info",value:function(){this._write(LogLevels.INFO,format.apply(null,arguments))}},{key:"warn",value:function(){this._write(LogLevels.WARN,format.apply(null,arguments))}},{key:"error",value:function(){this._write(LogLevels.ERROR,format.apply(null,arguments))}},{key:"_write",value:function(level,text){if(this._shouldLog(level)){(this.options.filename||GlobalLogfile)&&!this.fileWriter&&isNodejs&&(this.fileWriter=fs.openSync(this.options.filename||GlobalLogfile,this.options.appendFile?"a+":"w+"));var format=this._format(level,text),unformattedText=this._createLogMessage(level,text),formattedText=this._createLogMessage(level,text,format.timestamp,format.level,format.category,format.text);this.fileWriter&&isNodejs&&fs.writeSync(this.fileWriter,unformattedText+"\n",null,"utf-8"),isNodejs?console.log(formattedText):level===LogLevels.ERROR?this.options.showTimestamp&&this.options.showLevel?console.error(formattedText,format.timestamp,format.level,format.category,format.text):this.options.showTimestamp&&!this.options.showLevel?console.error(formattedText,format.timestamp,format.category,format.text):!this.options.showTimestamp&&this.options.showLevel?console.error(formattedText,format.level,format.category,format.text):console.error(formattedText,format.category,format.text):this.options.showTimestamp&&this.options.showLevel?console.log(formattedText,format.timestamp,format.level,format.category,format.text):this.options.showTimestamp&&!this.options.showLevel?console.log(formattedText,format.timestamp,format.category,format.text):!this.options.showTimestamp&&this.options.showLevel?console.log(formattedText,format.level,format.category,format.text):console.log(formattedText,format.category,format.text)}}},{key:"_format",value:function(level,text){var timestampFormat="",levelFormat="",categoryFormat="",textFormat=": ";if(this.options.useColors){var levelColor=(0,_keys2.default)(LogLevels).map(function(f){return LogLevels[f]}).indexOf(level),categoryColor=this.options.color;isNodejs?(this.options.showTimestamp&&(timestampFormat="[3"+Colors.Grey+"m"),this.options.showLevel&&(levelFormat="[3"+loglevelColors[levelColor]+";22m"),categoryFormat="[3"+categoryColor+";1m",textFormat="[0m: "):(this.options.showTimestamp&&(timestampFormat="color:"+Colors.Grey),this.options.showLevel&&(levelFormat="color:"+loglevelColors[levelColor]),categoryFormat="color:"+categoryColor+"; font-weight: bold")}return{timestamp:timestampFormat,level:levelFormat,category:categoryFormat,text:textFormat}}},{key:"_createLogMessage",value:function(level,text,timestampFormat,levelFormat,categoryFormat,textFormat){timestampFormat=timestampFormat||"",levelFormat=levelFormat||"",categoryFormat=categoryFormat||"",textFormat=textFormat||": ",isNodejs||(this.options.showTimestamp&&(timestampFormat="%c"),this.options.showLevel&&(levelFormat="%c"),categoryFormat="%c",textFormat=": %c");var result="";return this.options.showTimestamp&&(result+=""+(new Date).toISOString()+" "),result=timestampFormat+result,this.options.showLevel&&(result+=levelFormat+"["+level+"]"+(level===LogLevels.INFO||level===LogLevels.WARN?" ":"")+" "),result+=categoryFormat+this.category,result+=textFormat+text}},{key:"_shouldLog",value:function(level){var logLevel=void 0!==process&&void 0!==process.env&&void 0!==process.env.LOG?process.env.LOG.toUpperCase():GlobalLogLevel,levels=(0,_keys2.default)(LogLevels).map(function(f){return LogLevels[f]}),index=levels.indexOf(level),levelIdx=levels.indexOf(logLevel);return index>=levelIdx}}]),Logger}();module.exports={Colors:Colors,LogLevels:LogLevels,setLogLevel:function(level){GlobalLogLevel=level},setLogfile:function(filename){GlobalLogfile=filename},create:function(category,options){var logger=new Logger(category,options);return logger},forceBrowserMode:function(force){return isNodejs=!force}}}).call(exports,__webpack_require__(35))},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _classCallCheck2=__webpack_require__(0),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(1),_createClass3=_interopRequireDefault(_createClass2),Counter=__webpack_require__(88),CounterIndex=function(){function CounterIndex(id){(0,_classCallCheck3.default)(this,CounterIndex),this._counter=new Counter(id)}return(0,_createClass3.default)(CounterIndex,[{key:"get",value:function(){return this._counter}},{key:"updateIndex",value:function(oplog,added){var _this=this;this._counter&&added.filter(function(f){return f&&"COUNTER"===f.payload.op}).map(function(f){return Counter.from(f.payload.value)}).forEach(function(f){return _this._counter.merge(f)})}}]),CounterIndex}();module.exports=CounterIndex},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _classCallCheck2=__webpack_require__(0),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(1),_createClass3=_interopRequireDefault(_createClass2),DocumentIndex=function(){function DocumentIndex(){(0,_classCallCheck3.default)(this,DocumentIndex),this._index={}}return(0,_createClass3.default)(DocumentIndex,[{key:"get",value:function(key){return this._index[key]}},{key:"updateIndex",value:function(oplog,added){var _this=this;added.reverse().reduce(function(handled,item){return handled.indexOf(item.payload.key)===-1&&(handled.push(item.payload.key),"PUT"===item.payload.op?_this._index[item.payload.key]=item.payload.value:"DEL"===item.payload.op&&delete _this._index[item.payload.key]),handled},[])}}]),DocumentIndex}();module.exports=DocumentIndex},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _getPrototypeOf=__webpack_require__(15),_getPrototypeOf2=_interopRequireDefault(_getPrototypeOf),_classCallCheck2=__webpack_require__(0),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(1),_createClass3=_interopRequireDefault(_createClass2),_possibleConstructorReturn2=__webpack_require__(17),_possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2),_inherits2=__webpack_require__(16),_inherits3=_interopRequireDefault(_inherits2),EventIndex=__webpack_require__(55),FeedIndex=function(_EventIndex){function FeedIndex(){return(0,_classCallCheck3.default)(this,FeedIndex),(0,_possibleConstructorReturn3.default)(this,(FeedIndex.__proto__||(0,_getPrototypeOf2.default)(FeedIndex)).apply(this,arguments))}return(0,_inherits3.default)(FeedIndex,_EventIndex),(0,_createClass3.default)(FeedIndex,[{key:"updateIndex",value:function(oplog,added){var _this2=this;added.reduce(function(handled,item){return handled.includes(item.hash)||(handled.push(item.hash),
|
||
"ADD"===item.payload.op?_this2._index[item.hash]=item:"DEL"===item.payload.op&&delete _this2._index[item.payload.value]),handled},[])}}]),FeedIndex}(EventIndex);module.exports=FeedIndex},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _classCallCheck2=__webpack_require__(0),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(1),_createClass3=_interopRequireDefault(_createClass2),KeyValueIndex=function(){function KeyValueIndex(){(0,_classCallCheck3.default)(this,KeyValueIndex),this._index={}}return(0,_createClass3.default)(KeyValueIndex,[{key:"get",value:function(key){return this._index[key]}},{key:"updateIndex",value:function(oplog,added){var _this=this;added.reverse().reduce(function(handled,item){return handled.includes(item.payload.key)||(handled.push(item.payload.key),"PUT"===item.payload.op?_this._index[item.payload.key]=item.payload.value:"DEL"===item.payload.op&&delete _this._index[item.payload.key]),handled},[])}}]),KeyValueIndex}();module.exports=KeyValueIndex},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _keys=__webpack_require__(14),_keys2=_interopRequireDefault(_keys),_classCallCheck2=__webpack_require__(0),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(1),_createClass3=_interopRequireDefault(_createClass2),logger=__webpack_require__(92).create("orbit-db.IPFSPubSub"),IPFSPubsub=function(){function IPFSPubsub(ipfs){(0,_classCallCheck3.default)(this,IPFSPubsub),this._ipfs=ipfs,this._subscriptions={}}return(0,_createClass3.default)(IPFSPubsub,[{key:"subscribe",value:function(hash,onMessageCallback){var _this=this;this._subscriptions[hash]||(this._subscriptions[hash]={onMessage:onMessageCallback},this._ipfs.pubsub.sub(encodeURIComponent(hash),{discover:!0},function(err,stream){err&&logger.error(err),stream&&stream.on("data",_this._handleMessage.bind(_this))}),this._ipfs.pubsub.pub(encodeURIComponent(hash),"/connect"))}},{key:"unsubscribe",value:function(hash){this._subscriptions[hash]&&delete this._subscriptions[hash]}},{key:"publish",value:function(hash,message){this._subscriptions[hash]&&this._ipfs.pubsub.pub(encodeURIComponent(hash),message)}},{key:"disconnect",value:function(){var _this2=this;(0,_keys2.default)(this._subscriptions).forEach(function(e){delete _this2._subscriptions[e]})}},{key:"_handleMessage",value:function(message){if("/connect"!==message.data){var hash=message.topicIDs[0],sub=this._subscriptions[hash];sub&&sub.onMessage&&sub.onMessage(hash,message.data)}}}]),IPFSPubsub}();module.exports=IPFSPubsub},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _classCallCheck2=__webpack_require__(0),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(1),_createClass3=_interopRequireDefault(_createClass2),Index=function(){function Index(id){(0,_classCallCheck3.default)(this,Index),this.id=id,this._index=[]}return(0,_createClass3.default)(Index,[{key:"get",value:function(){return this._index}},{key:"updateIndex",value:function(oplog,entries){this._index=oplog.ops}}]),Index}();module.exports=Index},function(module,exports,__webpack_require__){module.exports={default:__webpack_require__(108),__esModule:!0}},function(module,exports,__webpack_require__){module.exports={default:__webpack_require__(110),__esModule:!0}},function(module,exports,__webpack_require__){module.exports={default:__webpack_require__(113),__esModule:!0}},function(module,exports,__webpack_require__){module.exports={default:__webpack_require__(115),__esModule:!0}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.__esModule=!0;var _defineProperty=__webpack_require__(56),_defineProperty2=_interopRequireDefault(_defineProperty);exports.default=function(obj,key,value){return key in obj?(0,_defineProperty2.default)(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}},function(module,exports){"use strict";function placeHoldersCount(b64){var len=b64.length;if(len%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===b64[len-2]?2:"="===b64[len-1]?1:0}function byteLength(b64){return 3*b64.length/4-placeHoldersCount(b64)}function toByteArray(b64){var i,j,l,tmp,placeHolders,arr,len=b64.length;placeHolders=placeHoldersCount(b64),arr=new Arr(3*len/4-placeHolders),l=placeHolders>0?len-4:len;var L=0;for(i=0,j=0;i<l;i+=4,j+=3)tmp=revLookup[b64.charCodeAt(i)]<<18|revLookup[b64.charCodeAt(i+1)]<<12|revLookup[b64.charCodeAt(i+2)]<<6|revLookup[b64.charCodeAt(i+3)],arr[L++]=tmp>>16&255,arr[L++]=tmp>>8&255,arr[L++]=255&tmp;return 2===placeHolders?(tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4,arr[L++]=255&tmp):1===placeHolders&&(tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2,arr[L++]=tmp>>8&255,arr[L++]=255&tmp),arr}function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[63&num]}function encodeChunk(uint8,start,end){for(var tmp,output=[],i=start;i<end;i+=3)tmp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2],output.push(tripletToBase64(tmp));return output.join("")}function fromByteArray(uint8){for(var tmp,len=uint8.length,extraBytes=len%3,output="",parts=[],maxChunkLength=16383,i=0,len2=len-extraBytes;i<len2;i+=maxChunkLength)parts.push(encodeChunk(uint8,i,i+maxChunkLength>len2?len2:i+maxChunkLength));return 1===extraBytes?(tmp=uint8[len-1],output+=lookup[tmp>>2],output+=lookup[tmp<<4&63],output+="=="):2===extraBytes&&(tmp=(uint8[len-2]<<8)+uint8[len-1],output+=lookup[tmp>>10],output+=lookup[tmp>>4&63],output+=lookup[tmp<<2&63],output+="="),parts.push(output),parts.join("")}exports.byteLength=byteLength,exports.toByteArray=toByteArray,exports.fromByteArray=fromByteArray;for(var lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i<len;++i)lookup[i]=code[i],revLookup[code.charCodeAt(i)]=i;revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63},function(module,exports,__webpack_require__){(function(process,global,setImmediate){/* @preserve
|
||
* The MIT License (MIT)
|
||
*
|
||
* Copyright (c) 2013-2015 Petka Antonov
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to deal
|
||
* in the Software without restriction, including without limitation the rights
|
||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||
* copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||
* THE SOFTWARE.
|
||
*
|
||
*/
|
||
!function(e){module.exports=e()}(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof _dereq_&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof _dereq_&&_dereq_,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise){function any(promises){var ret=new SomePromiseArray(promises),promise=ret.promise();return ret.setHowMany(1),ret.setUnwrap(),ret.init(),promise}var SomePromiseArray=Promise._SomePromiseArray;Promise.any=function(promises){return any(promises)},Promise.prototype.any=function(){return any(this)}}},{}],2:[function(_dereq_,module,exports){"use strict";function Async(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new Queue(16),this._normalQueue=new Queue(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var self=this;this.drainQueues=function(){self._drainQueues()},this._schedule=schedule}function AsyncInvokeLater(fn,receiver,arg){this._lateQueue.push(fn,receiver,arg),this._queueTick()}function AsyncInvoke(fn,receiver,arg){this._normalQueue.push(fn,receiver,arg),this._queueTick()}function AsyncSettlePromises(promise){this._normalQueue._pushOne(promise),this._queueTick()}var firstLineError;try{throw new Error}catch(e){firstLineError=e}var schedule=_dereq_("./schedule"),Queue=_dereq_("./queue"),util=_dereq_("./util");Async.prototype.setScheduler=function(fn){var prev=this._schedule;return this._schedule=fn,this._customScheduler=!0,prev},Async.prototype.hasCustomScheduler=function(){return this._customScheduler},Async.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},Async.prototype.disableTrampolineIfNecessary=function(){util.hasDevTools&&(this._trampolineEnabled=!1)},Async.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},Async.prototype.fatalError=function(e,isNode){isNode?(process.stderr.write("Fatal "+(e instanceof Error?e.stack:e)+"\n"),process.exit(2)):this.throwLater(e)},Async.prototype.throwLater=function(fn,arg){if(1===arguments.length&&(arg=fn,fn=function(){throw arg}),"undefined"!=typeof setTimeout)setTimeout(function(){fn(arg)},0);else try{this._schedule(function(){fn(arg)})}catch(e){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},util.hasDevTools?(Async.prototype.invokeLater=function(fn,receiver,arg){this._trampolineEnabled?AsyncInvokeLater.call(this,fn,receiver,arg):this._schedule(function(){setTimeout(function(){fn.call(receiver,arg)},100)})},Async.prototype.invoke=function(fn,receiver,arg){this._trampolineEnabled?AsyncInvoke.call(this,fn,receiver,arg):this._schedule(function(){fn.call(receiver,arg)})},Async.prototype.settlePromises=function(promise){this._trampolineEnabled?AsyncSettlePromises.call(this,promise):this._schedule(function(){promise._settlePromises()})}):(Async.prototype.invokeLater=AsyncInvokeLater,Async.prototype.invoke=AsyncInvoke,Async.prototype.settlePromises=AsyncSettlePromises),Async.prototype.invokeFirst=function(fn,receiver,arg){this._normalQueue.unshift(fn,receiver,arg),this._queueTick()},Async.prototype._drainQueue=function(queue){for(;queue.length()>0;){var fn=queue.shift();if("function"==typeof fn){var receiver=queue.shift(),arg=queue.shift();fn.call(receiver,arg)}else fn._settlePromises()}},Async.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},Async.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},Async.prototype._reset=function(){this._isTickUsed=!1},module.exports=Async,module.exports.firstLineError=firstLineError},{"./queue":26,"./schedule":29,"./util":36}],3:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,INTERNAL,tryConvertToPromise,debug){var calledBind=!1,rejectThis=function(_,e){this._reject(e)},targetRejected=function(e,context){context.promiseRejectionQueued=!0,context.bindingPromise._then(rejectThis,rejectThis,null,this,e)},bindingResolved=function(thisArg,context){0===(50397184&this._bitField)&&this._resolveCallback(context.target)},bindingRejected=function(e,context){context.promiseRejectionQueued||this._reject(e)};Promise.prototype.bind=function(thisArg){calledBind||(calledBind=!0,Promise.prototype._propagateFrom=debug.propagateFromFunction(),Promise.prototype._boundValue=debug.boundValueFunction());var maybePromise=tryConvertToPromise(thisArg),ret=new Promise(INTERNAL);ret._propagateFrom(this,1);var target=this._target();if(ret._setBoundTo(maybePromise),maybePromise instanceof Promise){var context={promiseRejectionQueued:!1,promise:ret,target:target,bindingPromise:maybePromise};target._then(INTERNAL,targetRejected,void 0,ret,context),maybePromise._then(bindingResolved,bindingRejected,void 0,ret,context),ret._setOnCancel(maybePromise)}else ret._resolveCallback(target);return ret},Promise.prototype._setBoundTo=function(obj){void 0!==obj?(this._bitField=2097152|this._bitField,this._boundTo=obj):this._bitField=this._bitField&-2097153},Promise.prototype._isBound=function(){return 2097152===(2097152&this._bitField)},Promise.bind=function(thisArg,value){return Promise.resolve(value).bind(thisArg)}}},{}],4:[function(_dereq_,module,exports){"use strict";function noConflict(){try{Promise===bluebird&&(Promise=old)}catch(e){}return bluebird}var old;"undefined"!=typeof Promise&&(old=Promise);var bluebird=_dereq_("./promise")();bluebird.noConflict=noConflict,module.exports=bluebird},{"./promise":22}],5:[function(_dereq_,module,exports){"use strict";var cr=Object.create;if(cr){var callerCache=cr(null),getterCache=cr(null);callerCache[" size"]=getterCache[" size"]=0}module.exports=function(Promise){function ensureMethod(obj,methodName){var fn;if(null!=obj&&(fn=obj[methodName]),"function"!=typeof fn){var message="Object "+util.classString(obj)+" has no method '"+util.toString(methodName)+"'";throw new Promise.TypeError(message)}return fn}function caller(obj){var methodName=this.pop(),fn=ensureMethod(obj,methodName);return fn.apply(obj,this)}function namedGetter(obj){return obj[this]}function indexedGetter(obj){var index=+this;return index<0&&(index=Math.max(0,index+obj.length)),obj[index]}var getGetter,util=_dereq_("./util"),canEvaluate=util.canEvaluate;util.isIdentifier;Promise.prototype.call=function(methodName){var args=[].slice.call(arguments,1);return args.push(methodName),this._then(caller,void 0,void 0,args,void 0)},Promise.prototype.get=function(propertyName){var getter,isIndex="number"==typeof propertyName;if(isIndex)getter=indexedGetter;else if(canEvaluate){var maybeGetter=getGetter(propertyName);getter=null!==maybeGetter?maybeGetter:namedGetter}else getter=namedGetter;return this._then(getter,void 0,void 0,propertyName,void 0)}}},{"./util":36}],6:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,PromiseArray,apiRejection,debug){var util=_dereq_("./util"),tryCatch=util.tryCatch,errorObj=util.errorObj,async=Promise._async;Promise.prototype.break=Promise.prototype.cancel=function(){if(!debug.cancellation())return this._warn("cancellation is disabled");for(var promise=this,child=promise;promise._isCancellable();){if(!promise._cancelBy(child)){child._isFollowing()?child._followee().cancel():child._cancelBranched();break}var parent=promise._cancellationParent;if(null==parent||!parent._isCancellable()){promise._isFollowing()?promise._followee().cancel():promise._cancelBranched();break}promise._isFollowing()&&promise._followee().cancel(),promise._setWillBeCancelled(),child=promise,promise=parent}},Promise.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},Promise.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},Promise.prototype._cancelBy=function(canceller){return canceller===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},Promise.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},Promise.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),async.invoke(this._cancelPromises,this,void 0))},Promise.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},Promise.prototype._unsetOnCancel=function(){this._onCancelField=void 0},Promise.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},Promise.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},Promise.prototype._doInvokeOnCancel=function(onCancelCallback,internalOnly){if(util.isArray(onCancelCallback))for(var i=0;i<onCancelCallback.length;++i)this._doInvokeOnCancel(onCancelCallback[i],internalOnly);else if(void 0!==onCancelCallback)if("function"==typeof onCancelCallback){if(!internalOnly){var e=tryCatch(onCancelCallback).call(this._boundValue());e===errorObj&&(this._attachExtraTrace(e.e),async.throwLater(e.e))}}else onCancelCallback._resultCancelled(this)},Promise.prototype._invokeOnCancel=function(){var onCancelCallback=this._onCancel();this._unsetOnCancel(),async.invoke(this._doInvokeOnCancel,this,onCancelCallback)},Promise.prototype._invokeInternalOnCancel=function(){this._isCancellable()&&(this._doInvokeOnCancel(this._onCancel(),!0),this._unsetOnCancel())},Promise.prototype._resultCancelled=function(){this.cancel()}}},{"./util":36}],7:[function(_dereq_,module,exports){"use strict";module.exports=function(NEXT_FILTER){function catchFilter(instances,cb,promise){return function(e){var boundTo=promise._boundValue();predicateLoop:for(var i=0;i<instances.length;++i){var item=instances[i];if(item===Error||null!=item&&item.prototype instanceof Error){if(e instanceof item)return tryCatch(cb).call(boundTo,e)}else if("function"==typeof item){var matchesPredicate=tryCatch(item).call(boundTo,e);if(matchesPredicate===errorObj)return matchesPredicate;if(matchesPredicate)return tryCatch(cb).call(boundTo,e)}else if(util.isObject(e)){for(var keys=getKeys(item),j=0;j<keys.length;++j){var key=keys[j];if(item[key]!=e[key])continue predicateLoop}return tryCatch(cb).call(boundTo,e)}}return NEXT_FILTER}}var util=_dereq_("./util"),getKeys=_dereq_("./es5").keys,tryCatch=util.tryCatch,errorObj=util.errorObj;return catchFilter}},{"./es5":13,"./util":36}],8:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise){function Context(){this._trace=new Context.CapturedTrace(peekContext())}function createContext(){if(longStackTraces)return new Context}function peekContext(){var lastIndex=contextStack.length-1;if(lastIndex>=0)return contextStack[lastIndex]}var longStackTraces=!1,contextStack=[];return Promise.prototype._promiseCreated=function(){},Promise.prototype._pushContext=function(){},Promise.prototype._popContext=function(){return null},Promise._peekContext=Promise.prototype._peekContext=function(){},Context.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,contextStack.push(this._trace))},Context.prototype._popContext=function(){if(void 0!==this._trace){var trace=contextStack.pop(),ret=trace._promiseCreated;return trace._promiseCreated=null,ret}return null},Context.CapturedTrace=null,Context.create=createContext,Context.deactivateLongStackTraces=function(){},Context.activateLongStackTraces=function(){var Promise_pushContext=Promise.prototype._pushContext,Promise_popContext=Promise.prototype._popContext,Promise_PeekContext=Promise._peekContext,Promise_peekContext=Promise.prototype._peekContext,Promise_promiseCreated=Promise.prototype._promiseCreated;Context.deactivateLongStackTraces=function(){Promise.prototype._pushContext=Promise_pushContext,Promise.prototype._popContext=Promise_popContext,Promise._peekContext=Promise_PeekContext,Promise.prototype._peekContext=Promise_peekContext,Promise.prototype._promiseCreated=Promise_promiseCreated,longStackTraces=!1},longStackTraces=!0,Promise.prototype._pushContext=Context.prototype._pushContext,Promise.prototype._popContext=Context.prototype._popContext,Promise._peekContext=Promise.prototype._peekContext=peekContext,Promise.prototype._promiseCreated=function(){var ctx=this._peekContext();ctx&&null==ctx._promiseCreated&&(ctx._promiseCreated=this)}},Context}},{}],9:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,Context){function generatePromiseLifecycleEventObject(name,promise){return{promise:promise}}function defaultFireEvent(){return!1}function cancellationExecute(executor,resolve,reject){var promise=this;try{executor(resolve,reject,function(onCancel){if("function"!=typeof onCancel)throw new TypeError("onCancel must be a function, got: "+util.toString(onCancel));promise._attachCancellationCallback(onCancel)})}catch(e){return e}}function cancellationAttachCancellationCallback(onCancel){if(!this._isCancellable())return this;var previousOnCancel=this._onCancel();void 0!==previousOnCancel?util.isArray(previousOnCancel)?previousOnCancel.push(onCancel):this._setOnCancel([previousOnCancel,onCancel]):this._setOnCancel(onCancel)}function cancellationOnCancel(){return this._onCancelField}function cancellationSetOnCancel(onCancel){this._onCancelField=onCancel}function cancellationClearCancellationData(){this._cancellationParent=void 0,this._onCancelField=void 0}function cancellationPropagateFrom(parent,flags){if(0!==(1&flags)){this._cancellationParent=parent;var branchesRemainingToCancel=parent._branchesRemainingToCancel;void 0===branchesRemainingToCancel&&(branchesRemainingToCancel=0),parent._branchesRemainingToCancel=branchesRemainingToCancel+1}0!==(2&flags)&&parent._isBound()&&this._setBoundTo(parent._boundTo)}function bindingPropagateFrom(parent,flags){0!==(2&flags)&&parent._isBound()&&this._setBoundTo(parent._boundTo)}function boundValueFunction(){var ret=this._boundTo;return void 0!==ret&&ret instanceof Promise?ret.isFulfilled()?ret.value():void 0:ret}function longStackTracesCaptureStackTrace(){this._trace=new CapturedTrace(this._peekContext())}function longStackTracesAttachExtraTrace(error,ignoreSelf){if(canAttachTrace(error)){var trace=this._trace;if(void 0!==trace&&ignoreSelf&&(trace=trace._parent),void 0!==trace)trace.attachExtraTrace(error);else if(!error.__stackCleaned__){var parsed=parseStackAndMessage(error);util.notEnumerableProp(error,"stack",parsed.message+"\n"+parsed.stack.join("\n")),util.notEnumerableProp(error,"__stackCleaned__",!0)}}}function checkForgottenReturns(returnValue,promiseCreated,name,promise,parent){if(void 0===returnValue&&null!==promiseCreated&&wForgottenReturn){if(void 0!==parent&&parent._returnedNonUndefined())return;if(0===(65535&promise._bitField))return;name&&(name+=" ");var handlerLine="",creatorLine="";if(promiseCreated._trace){for(var traceLines=promiseCreated._trace.stack.split("\n"),stack=cleanStack(traceLines),i=stack.length-1;i>=0;--i){var line=stack[i];if(!nodeFramePattern.test(line)){var lineMatches=line.match(parseLinePattern);lineMatches&&(handlerLine="at "+lineMatches[1]+":"+lineMatches[2]+":"+lineMatches[3]+" ");break}}if(stack.length>0)for(var firstUserLine=stack[0],i=0;i<traceLines.length;++i)if(traceLines[i]===firstUserLine){i>0&&(creatorLine="\n"+traceLines[i-1]);break}}var msg="a promise was created in a "+name+"handler "+handlerLine+"but was not returned from it, see http://goo.gl/rRqMUw"+creatorLine;promise._warn(msg,!0,promiseCreated)}}function deprecated(name,replacement){var message=name+" is deprecated and will be removed in a future version.";return replacement&&(message+=" Use "+replacement+" instead."),warn(message)}function warn(message,shouldUseOwnTrace,promise){if(config.warnings){var ctx,warning=new Warning(message);if(shouldUseOwnTrace)promise._attachExtraTrace(warning);else if(config.longStackTraces&&(ctx=Promise._peekContext()))ctx.attachExtraTrace(warning);else{var parsed=parseStackAndMessage(warning);warning.stack=parsed.message+"\n"+parsed.stack.join("\n")}activeFireEvent("warning",warning)||formatAndLogError(warning,"",!0)}}function reconstructStack(message,stacks){for(var i=0;i<stacks.length-1;++i)stacks[i].push("From previous event:"),stacks[i]=stacks[i].join("\n");return i<stacks.length&&(stacks[i]=stacks[i].join("\n")),message+"\n"+stacks.join("\n")}function removeDuplicateOrEmptyJumps(stacks){for(var i=0;i<stacks.length;++i)(0===stacks[i].length||i+1<stacks.length&&stacks[i][0]===stacks[i+1][0])&&(stacks.splice(i,1),i--)}function removeCommonRoots(stacks){for(var current=stacks[0],i=1;i<stacks.length;++i){for(var prev=stacks[i],currentLastIndex=current.length-1,currentLastLine=current[currentLastIndex],commonRootMeetPoint=-1,j=prev.length-1;j>=0;--j)if(prev[j]===currentLastLine){commonRootMeetPoint=j;break}for(var j=commonRootMeetPoint;j>=0;--j){var line=prev[j];if(current[currentLastIndex]!==line)break;current.pop(),currentLastIndex--}current=prev}}function cleanStack(stack){for(var ret=[],i=0;i<stack.length;++i){var line=stack[i],isTraceLine=" (No stack trace)"===line||stackFramePattern.test(line),isInternalFrame=isTraceLine&&shouldIgnore(line);isTraceLine&&!isInternalFrame&&(indentStackFrames&&" "!==line.charAt(0)&&(line=" "+line),ret.push(line))}return ret}function stackFramesAsArray(error){for(var stack=error.stack.replace(/\s+$/g,"").split("\n"),i=0;i<stack.length;++i){var line=stack[i];if(" (No stack trace)"===line||stackFramePattern.test(line))break}return i>0&&(stack=stack.slice(i)),stack}function parseStackAndMessage(error){var stack=error.stack,message=error.toString();return stack="string"==typeof stack&&stack.length>0?stackFramesAsArray(error):[" (No stack trace)"],{message:message,stack:cleanStack(stack)}}function formatAndLogError(error,title,isSoft){if("undefined"!=typeof console){var message;if(util.isObject(error)){var stack=error.stack;message=title+formatStack(stack,error)}else message=title+String(error);"function"==typeof printWarning?printWarning(message,isSoft):"function"!=typeof console.log&&"object"!=typeof console.log||console.log(message)}}function fireRejectionEvent(name,localHandler,reason,promise){var localEventFired=!1;try{"function"==typeof localHandler&&(localEventFired=!0,"rejectionHandled"===name?localHandler(promise):localHandler(reason,promise))}catch(e){async.throwLater(e)}"unhandledRejection"===name?activeFireEvent(name,reason,promise)||localEventFired||formatAndLogError(reason,"Unhandled rejection "):activeFireEvent(name,promise)}function formatNonError(obj){var str;if("function"==typeof obj)str="[function "+(obj.name||"anonymous")+"]";else{str=obj&&"function"==typeof obj.toString?obj.toString():util.toString(obj);var ruselessToString=/\[object [a-zA-Z0-9$_]+\]/;if(ruselessToString.test(str))try{var newStr=JSON.stringify(obj);str=newStr}catch(e){}0===str.length&&(str="(empty array)")}return"(<"+snip(str)+">, no stack trace)"}function snip(str){var maxChars=41;return str.length<maxChars?str:str.substr(0,maxChars-3)+"..."}function longStackTracesIsSupported(){return"function"==typeof captureStackTrace}function parseLineInfo(line){var matches=line.match(parseLineInfoRegex);if(matches)return{fileName:matches[1],line:parseInt(matches[2],10)}}function setBounds(firstLineError,lastLineError){if(longStackTracesIsSupported()){for(var firstFileName,lastFileName,firstStackLines=firstLineError.stack.split("\n"),lastStackLines=lastLineError.stack.split("\n"),firstIndex=-1,lastIndex=-1,i=0;i<firstStackLines.length;++i){var result=parseLineInfo(firstStackLines[i]);if(result){firstFileName=result.fileName,firstIndex=result.line;break}}for(var i=0;i<lastStackLines.length;++i){var result=parseLineInfo(lastStackLines[i]);if(result){lastFileName=result.fileName,lastIndex=result.line;break}}firstIndex<0||lastIndex<0||!firstFileName||!lastFileName||firstFileName!==lastFileName||firstIndex>=lastIndex||(shouldIgnore=function(line){if(bluebirdFramePattern.test(line))return!0;var info=parseLineInfo(line);return!!(info&&info.fileName===firstFileName&&firstIndex<=info.line&&info.line<=lastIndex)})}}function CapturedTrace(parent){this._parent=parent,this._promisesCreated=0;var length=this._length=1+(void 0===parent?0:parent._length);captureStackTrace(this,CapturedTrace),length>32&&this.uncycle()}var unhandledRejectionHandled,possiblyUnhandledRejection,printWarning,getDomain=Promise._getDomain,async=Promise._async,Warning=_dereq_("./errors").Warning,util=_dereq_("./util"),canAttachTrace=util.canAttachTrace,bluebirdFramePattern=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,nodeFramePattern=/\((?:timers\.js):\d+:\d+\)/,parseLinePattern=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,stackFramePattern=null,formatStack=null,indentStackFrames=!1,debugging=!(0==util.env("BLUEBIRD_DEBUG")),warnings=!(0==util.env("BLUEBIRD_WARNINGS")||!debugging&&!util.env("BLUEBIRD_WARNINGS")),longStackTraces=!(0==util.env("BLUEBIRD_LONG_STACK_TRACES")||!debugging&&!util.env("BLUEBIRD_LONG_STACK_TRACES")),wForgottenReturn=0!=util.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(warnings||!!util.env("BLUEBIRD_W_FORGOTTEN_RETURN"));Promise.prototype.suppressUnhandledRejections=function(){var target=this._target();target._bitField=target._bitField&-1048577|524288},Promise.prototype._ensurePossibleRejectionHandled=function(){0===(524288&this._bitField)&&(this._setRejectionIsUnhandled(),async.invokeLater(this._notifyUnhandledRejection,this,void 0))},Promise.prototype._notifyUnhandledRejectionIsHandled=function(){fireRejectionEvent("rejectionHandled",unhandledRejectionHandled,void 0,this)},Promise.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},Promise.prototype._returnedNonUndefined=function(){return 0!==(268435456&this._bitField)},Promise.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var reason=this._settledValue();this._setUnhandledRejectionIsNotified(),fireRejectionEvent("unhandledRejection",possiblyUnhandledRejection,reason,this)}},Promise.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},Promise.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=this._bitField&-262145},Promise.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},Promise.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},Promise.prototype._unsetRejectionIsUnhandled=function(){this._bitField=this._bitField&-1048577,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},Promise.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},Promise.prototype._warn=function(message,shouldUseOwnTrace,promise){return warn(message,shouldUseOwnTrace,promise||this)},Promise.onPossiblyUnhandledRejection=function(fn){var domain=getDomain();possiblyUnhandledRejection="function"==typeof fn?null===domain?fn:util.domainBind(domain,fn):void 0},Promise.onUnhandledRejectionHandled=function(fn){var domain=getDomain();unhandledRejectionHandled="function"==typeof fn?null===domain?fn:util.domainBind(domain,fn):void 0};var disableLongStackTraces=function(){};Promise.longStackTraces=function(){if(async.haveItemsQueued()&&!config.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!config.longStackTraces&&longStackTracesIsSupported()){var Promise_captureStackTrace=Promise.prototype._captureStackTrace,Promise_attachExtraTrace=Promise.prototype._attachExtraTrace;config.longStackTraces=!0,disableLongStackTraces=function(){if(async.haveItemsQueued()&&!config.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");Promise.prototype._captureStackTrace=Promise_captureStackTrace,Promise.prototype._attachExtraTrace=Promise_attachExtraTrace,Context.deactivateLongStackTraces(),async.enableTrampoline(),config.longStackTraces=!1},Promise.prototype._captureStackTrace=longStackTracesCaptureStackTrace,Promise.prototype._attachExtraTrace=longStackTracesAttachExtraTrace,Context.activateLongStackTraces(),async.disableTrampolineIfNecessary()}},Promise.hasLongStackTraces=function(){return config.longStackTraces&&longStackTracesIsSupported()};var fireDomEvent=function(){try{if("function"==typeof CustomEvent){var event=new CustomEvent("CustomEvent");return util.global.dispatchEvent(event),function(name,event){var domEvent=new CustomEvent(name.toLowerCase(),{detail:event,cancelable:!0});return!util.global.dispatchEvent(domEvent)}}if("function"==typeof Event){var event=new Event("CustomEvent");return util.global.dispatchEvent(event),function(name,event){var domEvent=new Event(name.toLowerCase(),{cancelable:!0});return domEvent.detail=event,!util.global.dispatchEvent(domEvent)}}var event=document.createEvent("CustomEvent");return event.initCustomEvent("testingtheevent",!1,!0,{}),util.global.dispatchEvent(event),function(name,event){var domEvent=document.createEvent("CustomEvent");return domEvent.initCustomEvent(name.toLowerCase(),!1,!0,event),!util.global.dispatchEvent(domEvent)}}catch(e){}return function(){return!1}}(),fireGlobalEvent=function(){return util.isNode?function(){return process.emit.apply(process,arguments)}:util.global?function(name){var methodName="on"+name.toLowerCase(),method=util.global[methodName];return!!method&&(method.apply(util.global,[].slice.call(arguments,1)),!0)}:function(){return!1}}(),eventToObjectGenerator={promiseCreated:generatePromiseLifecycleEventObject,promiseFulfilled:generatePromiseLifecycleEventObject,promiseRejected:generatePromiseLifecycleEventObject,promiseResolved:generatePromiseLifecycleEventObject,promiseCancelled:generatePromiseLifecycleEventObject,promiseChained:function(name,promise,child){return{promise:promise,child:child}},warning:function(name,warning){return{warning:warning}},unhandledRejection:function(name,reason,promise){return{reason:reason,promise:promise}},rejectionHandled:generatePromiseLifecycleEventObject},activeFireEvent=function(name){var globalEventFired=!1;try{globalEventFired=fireGlobalEvent.apply(null,arguments)}catch(e){async.throwLater(e),globalEventFired=!0}var domEventFired=!1;try{domEventFired=fireDomEvent(name,eventToObjectGenerator[name].apply(null,arguments))}catch(e){async.throwLater(e),domEventFired=!0}return domEventFired||globalEventFired};Promise.config=function(opts){if(opts=Object(opts),"longStackTraces"in opts&&(opts.longStackTraces?Promise.longStackTraces():!opts.longStackTraces&&Promise.hasLongStackTraces()&&disableLongStackTraces()),"warnings"in opts){var warningsOption=opts.warnings;config.warnings=!!warningsOption,wForgottenReturn=config.warnings,util.isObject(warningsOption)&&"wForgottenReturn"in warningsOption&&(wForgottenReturn=!!warningsOption.wForgottenReturn)}if("cancellation"in opts&&opts.cancellation&&!config.cancellation){if(async.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");Promise.prototype._clearCancellationData=cancellationClearCancellationData,Promise.prototype._propagateFrom=cancellationPropagateFrom,Promise.prototype._onCancel=cancellationOnCancel,Promise.prototype._setOnCancel=cancellationSetOnCancel,Promise.prototype._attachCancellationCallback=cancellationAttachCancellationCallback,Promise.prototype._execute=cancellationExecute,propagateFromFunction=cancellationPropagateFrom,config.cancellation=!0}"monitoring"in opts&&(opts.monitoring&&!config.monitoring?(config.monitoring=!0,Promise.prototype._fireEvent=activeFireEvent):!opts.monitoring&&config.monitoring&&(config.monitoring=!1,Promise.prototype._fireEvent=defaultFireEvent))},Promise.prototype._fireEvent=defaultFireEvent,Promise.prototype._execute=function(executor,resolve,reject){try{executor(resolve,reject)}catch(e){return e}},Promise.prototype._onCancel=function(){},Promise.prototype._setOnCancel=function(handler){},Promise.prototype._attachCancellationCallback=function(onCancel){},Promise.prototype._captureStackTrace=function(){},Promise.prototype._attachExtraTrace=function(){},Promise.prototype._clearCancellationData=function(){},Promise.prototype._propagateFrom=function(parent,flags){};var propagateFromFunction=bindingPropagateFrom,shouldIgnore=function(){return!1},parseLineInfoRegex=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;util.inherits(CapturedTrace,Error),Context.CapturedTrace=CapturedTrace,CapturedTrace.prototype.uncycle=function(){var length=this._length;if(!(length<2)){for(var nodes=[],stackToIndex={},i=0,node=this;void 0!==node;++i)nodes.push(node),node=node._parent;length=this._length=i;for(var i=length-1;i>=0;--i){var stack=nodes[i].stack;void 0===stackToIndex[stack]&&(stackToIndex[stack]=i)}for(var i=0;i<length;++i){var currentStack=nodes[i].stack,index=stackToIndex[currentStack];if(void 0!==index&&index!==i){index>0&&(nodes[index-1]._parent=void 0,nodes[index-1]._length=1),nodes[i]._parent=void 0,nodes[i]._length=1;var cycleEdgeNode=i>0?nodes[i-1]:this;index<length-1?(cycleEdgeNode._parent=nodes[index+1],cycleEdgeNode._parent.uncycle(),cycleEdgeNode._length=cycleEdgeNode._parent._length+1):(cycleEdgeNode._parent=void 0,cycleEdgeNode._length=1);for(var currentChildLength=cycleEdgeNode._length+1,j=i-2;j>=0;--j)nodes[j]._length=currentChildLength,currentChildLength++;return}}}},CapturedTrace.prototype.attachExtraTrace=function(error){if(!error.__stackCleaned__){this.uncycle();for(var parsed=parseStackAndMessage(error),message=parsed.message,stacks=[parsed.stack],trace=this;void 0!==trace;)stacks.push(cleanStack(trace.stack.split("\n"))),trace=trace._parent;removeCommonRoots(stacks),removeDuplicateOrEmptyJumps(stacks),util.notEnumerableProp(error,"stack",reconstructStack(message,stacks)),util.notEnumerableProp(error,"__stackCleaned__",!0)}};var captureStackTrace=function(){var v8stackFramePattern=/^\s*at\s*/,v8stackFormatter=function(stack,error){return"string"==typeof stack?stack:void 0!==error.name&&void 0!==error.message?error.toString():formatNonError(error)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,stackFramePattern=v8stackFramePattern,formatStack=v8stackFormatter;var captureStackTrace=Error.captureStackTrace;return shouldIgnore=function(line){return bluebirdFramePattern.test(line)},function(receiver,ignoreUntil){Error.stackTraceLimit+=6,captureStackTrace(receiver,ignoreUntil),Error.stackTraceLimit-=6}}var err=new Error;if("string"==typeof err.stack&&err.stack.split("\n")[0].indexOf("stackDetection@")>=0)return stackFramePattern=/@/,formatStack=v8stackFormatter,indentStackFrames=!0,function(o){o.stack=(new Error).stack};var hasStackAfterThrow;try{throw new Error}catch(e){hasStackAfterThrow="stack"in e}return"stack"in err||!hasStackAfterThrow||"number"!=typeof Error.stackTraceLimit?(formatStack=function(stack,error){return"string"==typeof stack?stack:"object"!=typeof error&&"function"!=typeof error||void 0===error.name||void 0===error.message?formatNonError(error):error.toString()},null):(stackFramePattern=v8stackFramePattern,formatStack=v8stackFormatter,function(o){Error.stackTraceLimit+=6;try{throw new Error}catch(e){o.stack=e.stack}Error.stackTraceLimit-=6})}([]);"undefined"!=typeof console&&"undefined"!=typeof console.warn&&(printWarning=function(message){console.warn(message)},util.isNode&&process.stderr.isTTY?printWarning=function(message,isSoft){var color=isSoft?"[33m":"[31m";console.warn(color+message+"[0m\n")}:util.isNode||"string"!=typeof(new Error).stack||(printWarning=function(message,isSoft){console.warn("%c"+message,isSoft?"color: darkorange":"color: red")}));var config={warnings:warnings,longStackTraces:!1,
|
||
cancellation:!1,monitoring:!1};return longStackTraces&&Promise.longStackTraces(),{longStackTraces:function(){return config.longStackTraces},warnings:function(){return config.warnings},cancellation:function(){return config.cancellation},monitoring:function(){return config.monitoring},propagateFromFunction:function(){return propagateFromFunction},boundValueFunction:function(){return boundValueFunction},checkForgottenReturns:checkForgottenReturns,setBounds:setBounds,warn:warn,deprecated:deprecated,CapturedTrace:CapturedTrace,fireDomEvent:fireDomEvent,fireGlobalEvent:fireGlobalEvent}}},{"./errors":12,"./util":36}],10:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise){function returner(){return this.value}function thrower(){throw this.reason}Promise.prototype.return=Promise.prototype.thenReturn=function(value){return value instanceof Promise&&value.suppressUnhandledRejections(),this._then(returner,void 0,void 0,{value:value},void 0)},Promise.prototype.throw=Promise.prototype.thenThrow=function(reason){return this._then(thrower,void 0,void 0,{reason:reason},void 0)},Promise.prototype.catchThrow=function(reason){if(arguments.length<=1)return this._then(void 0,thrower,void 0,{reason:reason},void 0);var _reason=arguments[1],handler=function(){throw _reason};return this.caught(reason,handler)},Promise.prototype.catchReturn=function(value){if(arguments.length<=1)return value instanceof Promise&&value.suppressUnhandledRejections(),this._then(void 0,returner,void 0,{value:value},void 0);var _value=arguments[1];_value instanceof Promise&&_value.suppressUnhandledRejections();var handler=function(){return _value};return this.caught(value,handler)}}},{}],11:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,INTERNAL){function promiseAllThis(){return PromiseAll(this)}function PromiseMapSeries(promises,fn){return PromiseReduce(promises,fn,INTERNAL,INTERNAL)}var PromiseReduce=Promise.reduce,PromiseAll=Promise.all;Promise.prototype.each=function(fn){return PromiseReduce(this,fn,INTERNAL,0)._then(promiseAllThis,void 0,void 0,this,void 0)},Promise.prototype.mapSeries=function(fn){return PromiseReduce(this,fn,INTERNAL,INTERNAL)},Promise.each=function(promises,fn){return PromiseReduce(promises,fn,INTERNAL,0)._then(promiseAllThis,void 0,void 0,promises,void 0)},Promise.mapSeries=PromiseMapSeries}},{}],12:[function(_dereq_,module,exports){"use strict";function subError(nameProperty,defaultMessage){function SubError(message){return this instanceof SubError?(notEnumerableProp(this,"message","string"==typeof message?message:defaultMessage),notEnumerableProp(this,"name",nameProperty),void(Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this))):new SubError(message)}return inherits(SubError,Error),SubError}function OperationalError(message){return this instanceof OperationalError?(notEnumerableProp(this,"name","OperationalError"),notEnumerableProp(this,"message",message),this.cause=message,this.isOperational=!0,void(message instanceof Error?(notEnumerableProp(this,"message",message.message),notEnumerableProp(this,"stack",message.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor))):new OperationalError(message)}var _TypeError,_RangeError,es5=_dereq_("./es5"),Objectfreeze=es5.freeze,util=_dereq_("./util"),inherits=util.inherits,notEnumerableProp=util.notEnumerableProp,Warning=subError("Warning","warning"),CancellationError=subError("CancellationError","cancellation error"),TimeoutError=subError("TimeoutError","timeout error"),AggregateError=subError("AggregateError","aggregate error");try{_TypeError=TypeError,_RangeError=RangeError}catch(e){_TypeError=subError("TypeError","type error"),_RangeError=subError("RangeError","range error")}for(var methods="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),i=0;i<methods.length;++i)"function"==typeof Array.prototype[methods[i]]&&(AggregateError.prototype[methods[i]]=Array.prototype[methods[i]]);es5.defineProperty(AggregateError.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),AggregateError.prototype.isOperational=!0;var level=0;AggregateError.prototype.toString=function(){var indent=Array(4*level+1).join(" "),ret="\n"+indent+"AggregateError of:\n";level++,indent=Array(4*level+1).join(" ");for(var i=0;i<this.length;++i){for(var str=this[i]===this?"[Circular AggregateError]":this[i]+"",lines=str.split("\n"),j=0;j<lines.length;++j)lines[j]=indent+lines[j];str=lines.join("\n"),ret+=str+"\n"}return level--,ret},inherits(OperationalError,Error);var errorTypes=Error.__BluebirdErrorTypes__;errorTypes||(errorTypes=Objectfreeze({CancellationError:CancellationError,TimeoutError:TimeoutError,OperationalError:OperationalError,RejectionError:OperationalError,AggregateError:AggregateError}),es5.defineProperty(Error,"__BluebirdErrorTypes__",{value:errorTypes,writable:!1,enumerable:!1,configurable:!1})),module.exports={Error:Error,TypeError:_TypeError,RangeError:_RangeError,CancellationError:errorTypes.CancellationError,OperationalError:errorTypes.OperationalError,TimeoutError:errorTypes.TimeoutError,AggregateError:errorTypes.AggregateError,Warning:Warning}},{"./es5":13,"./util":36}],13:[function(_dereq_,module,exports){var isES5=function(){"use strict";return void 0===this}();if(isES5)module.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:isES5,propertyIsWritable:function(obj,prop){var descriptor=Object.getOwnPropertyDescriptor(obj,prop);return!(descriptor&&!descriptor.writable&&!descriptor.set)}};else{var has={}.hasOwnProperty,str={}.toString,proto={}.constructor.prototype,ObjectKeys=function(o){var ret=[];for(var key in o)has.call(o,key)&&ret.push(key);return ret},ObjectGetDescriptor=function(o,key){return{value:o[key]}},ObjectDefineProperty=function(o,key,desc){return o[key]=desc.value,o},ObjectFreeze=function(obj){return obj},ObjectGetPrototypeOf=function(obj){try{return Object(obj).constructor.prototype}catch(e){return proto}},ArrayIsArray=function(obj){try{return"[object Array]"===str.call(obj)}catch(e){return!1}};module.exports={isArray:ArrayIsArray,keys:ObjectKeys,names:ObjectKeys,defineProperty:ObjectDefineProperty,getDescriptor:ObjectGetDescriptor,freeze:ObjectFreeze,getPrototypeOf:ObjectGetPrototypeOf,isES5:isES5,propertyIsWritable:function(){return!0}}}},{}],14:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,INTERNAL){var PromiseMap=Promise.map;Promise.prototype.filter=function(fn,options){return PromiseMap(this,fn,options,INTERNAL)},Promise.filter=function(promises,fn,options){return PromiseMap(promises,fn,options,INTERNAL)}}},{}],15:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,tryConvertToPromise){function PassThroughHandlerContext(promise,type,handler){this.promise=promise,this.type=type,this.handler=handler,this.called=!1,this.cancelPromise=null}function FinallyHandlerCancelReaction(finallyHandler){this.finallyHandler=finallyHandler}function checkCancel(ctx,reason){return null!=ctx.cancelPromise&&(arguments.length>1?ctx.cancelPromise._reject(reason):ctx.cancelPromise._cancel(),ctx.cancelPromise=null,!0)}function succeed(){return finallyHandler.call(this,this.promise._target()._settledValue())}function fail(reason){if(!checkCancel(this,reason))return errorObj.e=reason,errorObj}function finallyHandler(reasonOrValue){var promise=this.promise,handler=this.handler;if(!this.called){this.called=!0;var ret=this.isFinallyHandler()?handler.call(promise._boundValue()):handler.call(promise._boundValue(),reasonOrValue);if(void 0!==ret){promise._setReturnedNonUndefined();var maybePromise=tryConvertToPromise(ret,promise);if(maybePromise instanceof Promise){if(null!=this.cancelPromise){if(maybePromise._isCancelled()){var reason=new CancellationError("late cancellation observer");return promise._attachExtraTrace(reason),errorObj.e=reason,errorObj}maybePromise.isPending()&&maybePromise._attachCancellationCallback(new FinallyHandlerCancelReaction(this))}return maybePromise._then(succeed,fail,void 0,this,void 0)}}}return promise.isRejected()?(checkCancel(this),errorObj.e=reasonOrValue,errorObj):(checkCancel(this),reasonOrValue)}var util=_dereq_("./util"),CancellationError=Promise.CancellationError,errorObj=util.errorObj;return PassThroughHandlerContext.prototype.isFinallyHandler=function(){return 0===this.type},FinallyHandlerCancelReaction.prototype._resultCancelled=function(){checkCancel(this.finallyHandler)},Promise.prototype._passThrough=function(handler,type,success,fail){return"function"!=typeof handler?this.then():this._then(success,fail,void 0,new PassThroughHandlerContext(this,type,handler),void 0)},Promise.prototype.lastly=Promise.prototype.finally=function(handler){return this._passThrough(handler,0,finallyHandler,finallyHandler)},Promise.prototype.tap=function(handler){return this._passThrough(handler,1,finallyHandler)},PassThroughHandlerContext}},{"./util":36}],16:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,apiRejection,INTERNAL,tryConvertToPromise,Proxyable,debug){function promiseFromYieldHandler(value,yieldHandlers,traceParent){for(var i=0;i<yieldHandlers.length;++i){traceParent._pushContext();var result=tryCatch(yieldHandlers[i])(value);if(traceParent._popContext(),result===errorObj){traceParent._pushContext();var ret=Promise.reject(errorObj.e);return traceParent._popContext(),ret}var maybePromise=tryConvertToPromise(result,traceParent);if(maybePromise instanceof Promise)return maybePromise}return null}function PromiseSpawn(generatorFunction,receiver,yieldHandler,stack){if(debug.cancellation()){var internal=new Promise(INTERNAL),_finallyPromise=this._finallyPromise=new Promise(INTERNAL);this._promise=internal.lastly(function(){return _finallyPromise}),internal._captureStackTrace(),internal._setOnCancel(this)}else{var promise=this._promise=new Promise(INTERNAL);promise._captureStackTrace()}this._stack=stack,this._generatorFunction=generatorFunction,this._receiver=receiver,this._generator=void 0,this._yieldHandlers="function"==typeof yieldHandler?[yieldHandler].concat(yieldHandlers):yieldHandlers,this._yieldedPromise=null,this._cancellationPhase=!1}var errors=_dereq_("./errors"),TypeError=errors.TypeError,util=_dereq_("./util"),errorObj=util.errorObj,tryCatch=util.tryCatch,yieldHandlers=[];util.inherits(PromiseSpawn,Proxyable),PromiseSpawn.prototype._isResolved=function(){return null===this._promise},PromiseSpawn.prototype._cleanup=function(){this._promise=this._generator=null,debug.cancellation()&&null!==this._finallyPromise&&(this._finallyPromise._fulfill(),this._finallyPromise=null)},PromiseSpawn.prototype._promiseCancelled=function(){if(!this._isResolved()){var result,implementsReturn="undefined"!=typeof this._generator.return;if(implementsReturn)this._promise._pushContext(),result=tryCatch(this._generator.return).call(this._generator,void 0),this._promise._popContext();else{var reason=new Promise.CancellationError("generator .return() sentinel");Promise.coroutine.returnSentinel=reason,this._promise._attachExtraTrace(reason),this._promise._pushContext(),result=tryCatch(this._generator.throw).call(this._generator,reason),this._promise._popContext()}this._cancellationPhase=!0,this._yieldedPromise=null,this._continue(result)}},PromiseSpawn.prototype._promiseFulfilled=function(value){this._yieldedPromise=null,this._promise._pushContext();var result=tryCatch(this._generator.next).call(this._generator,value);this._promise._popContext(),this._continue(result)},PromiseSpawn.prototype._promiseRejected=function(reason){this._yieldedPromise=null,this._promise._attachExtraTrace(reason),this._promise._pushContext();var result=tryCatch(this._generator.throw).call(this._generator,reason);this._promise._popContext(),this._continue(result)},PromiseSpawn.prototype._resultCancelled=function(){if(this._yieldedPromise instanceof Promise){var promise=this._yieldedPromise;this._yieldedPromise=null,promise.cancel()}},PromiseSpawn.prototype.promise=function(){return this._promise},PromiseSpawn.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=void 0,this._promiseFulfilled(void 0)},PromiseSpawn.prototype._continue=function(result){var promise=this._promise;if(result===errorObj)return this._cleanup(),this._cancellationPhase?promise.cancel():promise._rejectCallback(result.e,!1);var value=result.value;if(result.done===!0)return this._cleanup(),this._cancellationPhase?promise.cancel():promise._resolveCallback(value);var maybePromise=tryConvertToPromise(value,this._promise);if(!(maybePromise instanceof Promise)&&(maybePromise=promiseFromYieldHandler(maybePromise,this._yieldHandlers,this._promise),null===maybePromise))return void this._promiseRejected(new TypeError("A value %s was yielded that could not be treated as a promise\n\n See http://goo.gl/MqrFmX\n\n".replace("%s",value)+"From coroutine:\n"+this._stack.split("\n").slice(1,-7).join("\n")));maybePromise=maybePromise._target();var bitField=maybePromise._bitField;0===(50397184&bitField)?(this._yieldedPromise=maybePromise,maybePromise._proxy(this,null)):0!==(33554432&bitField)?Promise._async.invoke(this._promiseFulfilled,this,maybePromise._value()):0!==(16777216&bitField)?Promise._async.invoke(this._promiseRejected,this,maybePromise._reason()):this._promiseCancelled()},Promise.coroutine=function(generatorFunction,options){if("function"!=typeof generatorFunction)throw new TypeError("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var yieldHandler=Object(options).yieldHandler,PromiseSpawn$=PromiseSpawn,stack=(new Error).stack;return function(){var generator=generatorFunction.apply(this,arguments),spawn=new PromiseSpawn$(void 0,void 0,yieldHandler,stack),ret=spawn.promise();return spawn._generator=generator,spawn._promiseFulfilled(void 0),ret}},Promise.coroutine.addYieldHandler=function(fn){if("function"!=typeof fn)throw new TypeError("expecting a function but got "+util.classString(fn));yieldHandlers.push(fn)},Promise.spawn=function(generatorFunction){if(debug.deprecated("Promise.spawn()","Promise.coroutine()"),"function"!=typeof generatorFunction)return apiRejection("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var spawn=new PromiseSpawn(generatorFunction,this),ret=spawn.promise();return spawn._run(Promise.spawn),ret}}},{"./errors":12,"./util":36}],17:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,PromiseArray,tryConvertToPromise,INTERNAL,async,getDomain){var util=_dereq_("./util");util.canEvaluate,util.tryCatch,util.errorObj;Promise.join=function(){var fn,last=arguments.length-1;if(last>0&&"function"==typeof arguments[last]){fn=arguments[last];var ret}var args=[].slice.call(arguments);fn&&args.pop();var ret=new PromiseArray(args).promise();return void 0!==fn?ret.spread(fn):ret}}},{"./util":36}],18:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,PromiseArray,apiRejection,tryConvertToPromise,INTERNAL,debug){function MappingPromiseArray(promises,fn,limit,_filter){this.constructor$(promises),this._promise._captureStackTrace();var domain=getDomain();this._callback=null===domain?fn:util.domainBind(domain,fn),this._preservedValues=_filter===INTERNAL?new Array(this.length()):null,this._limit=limit,this._inFlight=0,this._queue=[],async.invoke(this._asyncInit,this,void 0)}function map(promises,fn,options,_filter){if("function"!=typeof fn)return apiRejection("expecting a function but got "+util.classString(fn));var limit=0;if(void 0!==options){if("object"!=typeof options||null===options)return Promise.reject(new TypeError("options argument must be an object but it is "+util.classString(options)));if("number"!=typeof options.concurrency)return Promise.reject(new TypeError("'concurrency' must be a number but it is "+util.classString(options.concurrency)));limit=options.concurrency}return limit="number"==typeof limit&&isFinite(limit)&&limit>=1?limit:0,new MappingPromiseArray(promises,fn,limit,_filter).promise()}var getDomain=Promise._getDomain,util=_dereq_("./util"),tryCatch=util.tryCatch,errorObj=util.errorObj,async=Promise._async;util.inherits(MappingPromiseArray,PromiseArray),MappingPromiseArray.prototype._asyncInit=function(){this._init$(void 0,-2)},MappingPromiseArray.prototype._init=function(){},MappingPromiseArray.prototype._promiseFulfilled=function(value,index){var values=this._values,length=this.length(),preservedValues=this._preservedValues,limit=this._limit;if(index<0){if(index=index*-1-1,values[index]=value,limit>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(limit>=1&&this._inFlight>=limit)return values[index]=value,this._queue.push(index),!1;null!==preservedValues&&(preservedValues[index]=value);var promise=this._promise,callback=this._callback,receiver=promise._boundValue();promise._pushContext();var ret=tryCatch(callback).call(receiver,value,index,length),promiseCreated=promise._popContext();if(debug.checkForgottenReturns(ret,promiseCreated,null!==preservedValues?"Promise.filter":"Promise.map",promise),ret===errorObj)return this._reject(ret.e),!0;var maybePromise=tryConvertToPromise(ret,this._promise);if(maybePromise instanceof Promise){maybePromise=maybePromise._target();var bitField=maybePromise._bitField;if(0===(50397184&bitField))return limit>=1&&this._inFlight++,values[index]=maybePromise,maybePromise._proxy(this,(index+1)*-1),!1;if(0===(33554432&bitField))return 0!==(16777216&bitField)?(this._reject(maybePromise._reason()),!0):(this._cancel(),!0);ret=maybePromise._value()}values[index]=ret}var totalResolved=++this._totalResolved;return totalResolved>=length&&(null!==preservedValues?this._filter(values,preservedValues):this._resolve(values),!0)},MappingPromiseArray.prototype._drainQueue=function(){for(var queue=this._queue,limit=this._limit,values=this._values;queue.length>0&&this._inFlight<limit;){if(this._isResolved())return;var index=queue.pop();this._promiseFulfilled(values[index],index)}},MappingPromiseArray.prototype._filter=function(booleans,values){for(var len=values.length,ret=new Array(len),j=0,i=0;i<len;++i)booleans[i]&&(ret[j++]=values[i]);ret.length=j,this._resolve(ret)},MappingPromiseArray.prototype.preservedValues=function(){return this._preservedValues},Promise.prototype.map=function(fn,options){return map(this,fn,options,null)},Promise.map=function(promises,fn,options,_filter){return map(promises,fn,options,_filter)}}},{"./util":36}],19:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,INTERNAL,tryConvertToPromise,apiRejection,debug){var util=_dereq_("./util"),tryCatch=util.tryCatch;Promise.method=function(fn){if("function"!=typeof fn)throw new Promise.TypeError("expecting a function but got "+util.classString(fn));return function(){var ret=new Promise(INTERNAL);ret._captureStackTrace(),ret._pushContext();var value=tryCatch(fn).apply(this,arguments),promiseCreated=ret._popContext();return debug.checkForgottenReturns(value,promiseCreated,"Promise.method",ret),ret._resolveFromSyncValue(value),ret}},Promise.attempt=Promise.try=function(fn){if("function"!=typeof fn)return apiRejection("expecting a function but got "+util.classString(fn));var ret=new Promise(INTERNAL);ret._captureStackTrace(),ret._pushContext();var value;if(arguments.length>1){debug.deprecated("calling Promise.try with more than 1 argument");var arg=arguments[1],ctx=arguments[2];value=util.isArray(arg)?tryCatch(fn).apply(ctx,arg):tryCatch(fn).call(ctx,arg)}else value=tryCatch(fn)();var promiseCreated=ret._popContext();return debug.checkForgottenReturns(value,promiseCreated,"Promise.try",ret),ret._resolveFromSyncValue(value),ret},Promise.prototype._resolveFromSyncValue=function(value){value===util.errorObj?this._rejectCallback(value.e,!1):this._resolveCallback(value,!0)}}},{"./util":36}],20:[function(_dereq_,module,exports){"use strict";function isUntypedError(obj){return obj instanceof Error&&es5.getPrototypeOf(obj)===Error.prototype}function wrapAsOperationalError(obj){var ret;if(isUntypedError(obj)){ret=new OperationalError(obj),ret.name=obj.name,ret.message=obj.message,ret.stack=obj.stack;for(var keys=es5.keys(obj),i=0;i<keys.length;++i){var key=keys[i];rErrorKey.test(key)||(ret[key]=obj[key])}return ret}return util.markAsOriginatingFromRejection(obj),obj}function nodebackForPromise(promise,multiArgs){return function(err,value){if(null!==promise){if(err){var wrapped=wrapAsOperationalError(maybeWrapAsError(err));promise._attachExtraTrace(wrapped),promise._reject(wrapped)}else if(multiArgs){var args=[].slice.call(arguments,1);promise._fulfill(args)}else promise._fulfill(value);promise=null}}}var util=_dereq_("./util"),maybeWrapAsError=util.maybeWrapAsError,errors=_dereq_("./errors"),OperationalError=errors.OperationalError,es5=_dereq_("./es5"),rErrorKey=/^(?:name|message|stack|cause)$/;module.exports=nodebackForPromise},{"./errors":12,"./es5":13,"./util":36}],21:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise){function spreadAdapter(val,nodeback){var promise=this;if(!util.isArray(val))return successAdapter.call(promise,val,nodeback);var ret=tryCatch(nodeback).apply(promise._boundValue(),[null].concat(val));ret===errorObj&&async.throwLater(ret.e)}function successAdapter(val,nodeback){var promise=this,receiver=promise._boundValue(),ret=void 0===val?tryCatch(nodeback).call(receiver,null):tryCatch(nodeback).call(receiver,null,val);ret===errorObj&&async.throwLater(ret.e)}function errorAdapter(reason,nodeback){var promise=this;if(!reason){var newReason=new Error(reason+"");newReason.cause=reason,reason=newReason}var ret=tryCatch(nodeback).call(promise._boundValue(),reason);ret===errorObj&&async.throwLater(ret.e)}var util=_dereq_("./util"),async=Promise._async,tryCatch=util.tryCatch,errorObj=util.errorObj;Promise.prototype.asCallback=Promise.prototype.nodeify=function(nodeback,options){if("function"==typeof nodeback){var adapter=successAdapter;void 0!==options&&Object(options).spread&&(adapter=spreadAdapter),this._then(adapter,errorAdapter,void 0,this,nodeback)}return this}}},{"./util":36}],22:[function(_dereq_,module,exports){"use strict";module.exports=function(){function Proxyable(){}function check(self,executor){if("function"!=typeof executor)throw new TypeError("expecting a function but got "+util.classString(executor));if(self.constructor!==Promise)throw new TypeError("the promise constructor cannot be invoked directly\n\n See http://goo.gl/MqrFmX\n")}function Promise(executor){this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,executor!==INTERNAL&&(check(this,executor),this._resolveFromExecutor(executor)),this._promiseCreated(),this._fireEvent("promiseCreated",this)}function deferResolve(v){this.promise._resolveCallback(v)}function deferReject(v){this.promise._rejectCallback(v,!1)}function fillTypes(value){var p=new Promise(INTERNAL);p._fulfillmentHandler0=value,p._rejectionHandler0=value,p._promise0=value,p._receiver0=value}var getDomain,makeSelfResolutionError=function(){return new TypeError("circular promise resolution chain\n\n See http://goo.gl/MqrFmX\n")},reflectHandler=function(){return new Promise.PromiseInspection(this._target())},apiRejection=function(msg){return Promise.reject(new TypeError(msg))},UNDEFINED_BINDING={},util=_dereq_("./util");getDomain=util.isNode?function(){var ret=process.domain;return void 0===ret&&(ret=null),ret}:function(){return null},util.notEnumerableProp(Promise,"_getDomain",getDomain);var es5=_dereq_("./es5"),Async=_dereq_("./async"),async=new Async;es5.defineProperty(Promise,"_async",{value:async});var errors=_dereq_("./errors"),TypeError=Promise.TypeError=errors.TypeError;Promise.RangeError=errors.RangeError;var CancellationError=Promise.CancellationError=errors.CancellationError;Promise.TimeoutError=errors.TimeoutError,Promise.OperationalError=errors.OperationalError,Promise.RejectionError=errors.OperationalError,Promise.AggregateError=errors.AggregateError;var INTERNAL=function(){},APPLY={},NEXT_FILTER={},tryConvertToPromise=_dereq_("./thenables")(Promise,INTERNAL),PromiseArray=_dereq_("./promise_array")(Promise,INTERNAL,tryConvertToPromise,apiRejection,Proxyable),Context=_dereq_("./context")(Promise),createContext=Context.create,debug=_dereq_("./debuggability")(Promise,Context),PassThroughHandlerContext=(debug.CapturedTrace,_dereq_("./finally")(Promise,tryConvertToPromise)),catchFilter=_dereq_("./catch_filter")(NEXT_FILTER),nodebackForPromise=_dereq_("./nodeback"),errorObj=util.errorObj,tryCatch=util.tryCatch;return Promise.prototype.toString=function(){return"[object Promise]"},Promise.prototype.caught=Promise.prototype.catch=function(fn){var len=arguments.length;if(len>1){var i,catchInstances=new Array(len-1),j=0;for(i=0;i<len-1;++i){var item=arguments[i];if(!util.isObject(item))return apiRejection("expecting an object but got A catch statement predicate "+util.classString(item));catchInstances[j++]=item}return catchInstances.length=j,fn=arguments[i],this.then(void 0,catchFilter(catchInstances,fn,this))}return this.then(void 0,fn)},Promise.prototype.reflect=function(){return this._then(reflectHandler,reflectHandler,void 0,this,void 0)},Promise.prototype.then=function(didFulfill,didReject){if(debug.warnings()&&arguments.length>0&&"function"!=typeof didFulfill&&"function"!=typeof didReject){var msg=".then() only accepts functions but was passed: "+util.classString(didFulfill);arguments.length>1&&(msg+=", "+util.classString(didReject)),this._warn(msg)}return this._then(didFulfill,didReject,void 0,void 0,void 0)},Promise.prototype.done=function(didFulfill,didReject){var promise=this._then(didFulfill,didReject,void 0,void 0,void 0);promise._setIsFinal()},Promise.prototype.spread=function(fn){return"function"!=typeof fn?apiRejection("expecting a function but got "+util.classString(fn)):this.all()._then(fn,void 0,void 0,APPLY,void 0)},Promise.prototype.toJSON=function(){var ret={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(ret.fulfillmentValue=this.value(),ret.isFulfilled=!0):this.isRejected()&&(ret.rejectionReason=this.reason(),ret.isRejected=!0),ret},Promise.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new PromiseArray(this).promise()},Promise.prototype.error=function(fn){return this.caught(util.originatesFromRejection,fn)},Promise.getNewLibraryCopy=module.exports,Promise.is=function(val){return val instanceof Promise},Promise.fromNode=Promise.fromCallback=function(fn){var ret=new Promise(INTERNAL);ret._captureStackTrace();var multiArgs=arguments.length>1&&!!Object(arguments[1]).multiArgs,result=tryCatch(fn)(nodebackForPromise(ret,multiArgs));return result===errorObj&&ret._rejectCallback(result.e,!0),ret._isFateSealed()||ret._setAsyncGuaranteed(),ret},Promise.all=function(promises){return new PromiseArray(promises).promise()},Promise.cast=function(obj){var ret=tryConvertToPromise(obj);return ret instanceof Promise||(ret=new Promise(INTERNAL),ret._captureStackTrace(),ret._setFulfilled(),ret._rejectionHandler0=obj),ret},Promise.resolve=Promise.fulfilled=Promise.cast,Promise.reject=Promise.rejected=function(reason){var ret=new Promise(INTERNAL);return ret._captureStackTrace(),ret._rejectCallback(reason,!0),ret},Promise.setScheduler=function(fn){if("function"!=typeof fn)throw new TypeError("expecting a function but got "+util.classString(fn));return async.setScheduler(fn)},Promise.prototype._then=function(didFulfill,didReject,_,receiver,internalData){var haveInternalData=void 0!==internalData,promise=haveInternalData?internalData:new Promise(INTERNAL),target=this._target(),bitField=target._bitField;haveInternalData||(promise._propagateFrom(this,3),promise._captureStackTrace(),void 0===receiver&&0!==(2097152&this._bitField)&&(receiver=0!==(50397184&bitField)?this._boundValue():target===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,promise));var domain=getDomain();if(0!==(50397184&bitField)){var handler,value,settler=target._settlePromiseCtx;0!==(33554432&bitField)?(value=target._rejectionHandler0,handler=didFulfill):0!==(16777216&bitField)?(value=target._fulfillmentHandler0,handler=didReject,target._unsetRejectionIsUnhandled()):(settler=target._settlePromiseLateCancellationObserver,value=new CancellationError("late cancellation observer"),target._attachExtraTrace(value),handler=didReject),async.invoke(settler,target,{handler:null===domain?handler:"function"==typeof handler&&util.domainBind(domain,handler),promise:promise,receiver:receiver,value:value})}else target._addCallbacks(didFulfill,didReject,promise,receiver,domain);return promise},Promise.prototype._length=function(){return 65535&this._bitField},Promise.prototype._isFateSealed=function(){return 0!==(117506048&this._bitField)},Promise.prototype._isFollowing=function(){return 67108864===(67108864&this._bitField)},Promise.prototype._setLength=function(len){this._bitField=this._bitField&-65536|65535&len},Promise.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},Promise.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},Promise.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},Promise.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},Promise.prototype._isFinal=function(){return(4194304&this._bitField)>0},Promise.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},Promise.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},Promise.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},Promise.prototype._setAsyncGuaranteed=function(){async.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},Promise.prototype._receiverAt=function(index){var ret=0===index?this._receiver0:this[4*index-4+3];if(ret!==UNDEFINED_BINDING)return void 0===ret&&this._isBound()?this._boundValue():ret},Promise.prototype._promiseAt=function(index){return this[4*index-4+2]},Promise.prototype._fulfillmentHandlerAt=function(index){return this[4*index-4+0]},Promise.prototype._rejectionHandlerAt=function(index){return this[4*index-4+1]},Promise.prototype._boundValue=function(){},Promise.prototype._migrateCallback0=function(follower){var fulfill=(follower._bitField,follower._fulfillmentHandler0),reject=follower._rejectionHandler0,promise=follower._promise0,receiver=follower._receiverAt(0);void 0===receiver&&(receiver=UNDEFINED_BINDING),this._addCallbacks(fulfill,reject,promise,receiver,null)},Promise.prototype._migrateCallbackAt=function(follower,index){var fulfill=follower._fulfillmentHandlerAt(index),reject=follower._rejectionHandlerAt(index),promise=follower._promiseAt(index),receiver=follower._receiverAt(index);void 0===receiver&&(receiver=UNDEFINED_BINDING),this._addCallbacks(fulfill,reject,promise,receiver,null)},Promise.prototype._addCallbacks=function(fulfill,reject,promise,receiver,domain){var index=this._length();if(index>=65531&&(index=0,this._setLength(0)),0===index)this._promise0=promise,this._receiver0=receiver,"function"==typeof fulfill&&(this._fulfillmentHandler0=null===domain?fulfill:util.domainBind(domain,fulfill)),"function"==typeof reject&&(this._rejectionHandler0=null===domain?reject:util.domainBind(domain,reject));else{var base=4*index-4;this[base+2]=promise,this[base+3]=receiver,"function"==typeof fulfill&&(this[base+0]=null===domain?fulfill:util.domainBind(domain,fulfill)),
|
||
"function"==typeof reject&&(this[base+1]=null===domain?reject:util.domainBind(domain,reject))}return this._setLength(index+1),index},Promise.prototype._proxy=function(proxyable,arg){this._addCallbacks(void 0,void 0,arg,proxyable,null)},Promise.prototype._resolveCallback=function(value,shouldBind){if(0===(117506048&this._bitField)){if(value===this)return this._rejectCallback(makeSelfResolutionError(),!1);var maybePromise=tryConvertToPromise(value,this);if(!(maybePromise instanceof Promise))return this._fulfill(value);shouldBind&&this._propagateFrom(maybePromise,2);var promise=maybePromise._target();if(promise===this)return void this._reject(makeSelfResolutionError());var bitField=promise._bitField;if(0===(50397184&bitField)){var len=this._length();len>0&&promise._migrateCallback0(this);for(var i=1;i<len;++i)promise._migrateCallbackAt(this,i);this._setFollowing(),this._setLength(0),this._setFollowee(promise)}else if(0!==(33554432&bitField))this._fulfill(promise._value());else if(0!==(16777216&bitField))this._reject(promise._reason());else{var reason=new CancellationError("late cancellation observer");promise._attachExtraTrace(reason),this._reject(reason)}}},Promise.prototype._rejectCallback=function(reason,synchronous,ignoreNonErrorWarnings){var trace=util.ensureErrorObject(reason),hasStack=trace===reason;if(!hasStack&&!ignoreNonErrorWarnings&&debug.warnings()){var message="a promise was rejected with a non-error: "+util.classString(reason);this._warn(message,!0)}this._attachExtraTrace(trace,!!synchronous&&hasStack),this._reject(reason)},Promise.prototype._resolveFromExecutor=function(executor){var promise=this;this._captureStackTrace(),this._pushContext();var synchronous=!0,r=this._execute(executor,function(value){promise._resolveCallback(value)},function(reason){promise._rejectCallback(reason,synchronous)});synchronous=!1,this._popContext(),void 0!==r&&promise._rejectCallback(r,!0)},Promise.prototype._settlePromiseFromHandler=function(handler,receiver,value,promise){var bitField=promise._bitField;if(0===(65536&bitField)){promise._pushContext();var x;receiver===APPLY?value&&"number"==typeof value.length?x=tryCatch(handler).apply(this._boundValue(),value):(x=errorObj,x.e=new TypeError("cannot .spread() a non-array: "+util.classString(value))):x=tryCatch(handler).call(receiver,value);var promiseCreated=promise._popContext();bitField=promise._bitField,0===(65536&bitField)&&(x===NEXT_FILTER?promise._reject(value):x===errorObj?promise._rejectCallback(x.e,!1):(debug.checkForgottenReturns(x,promiseCreated,"",promise,this),promise._resolveCallback(x)))}},Promise.prototype._target=function(){for(var ret=this;ret._isFollowing();)ret=ret._followee();return ret},Promise.prototype._followee=function(){return this._rejectionHandler0},Promise.prototype._setFollowee=function(promise){this._rejectionHandler0=promise},Promise.prototype._settlePromise=function(promise,handler,receiver,value){var isPromise=promise instanceof Promise,bitField=this._bitField,asyncGuaranteed=0!==(134217728&bitField);0!==(65536&bitField)?(isPromise&&promise._invokeInternalOnCancel(),receiver instanceof PassThroughHandlerContext&&receiver.isFinallyHandler()?(receiver.cancelPromise=promise,tryCatch(handler).call(receiver,value)===errorObj&&promise._reject(errorObj.e)):handler===reflectHandler?promise._fulfill(reflectHandler.call(receiver)):receiver instanceof Proxyable?receiver._promiseCancelled(promise):isPromise||promise instanceof PromiseArray?promise._cancel():receiver.cancel()):"function"==typeof handler?isPromise?(asyncGuaranteed&&promise._setAsyncGuaranteed(),this._settlePromiseFromHandler(handler,receiver,value,promise)):handler.call(receiver,value,promise):receiver instanceof Proxyable?receiver._isResolved()||(0!==(33554432&bitField)?receiver._promiseFulfilled(value,promise):receiver._promiseRejected(value,promise)):isPromise&&(asyncGuaranteed&&promise._setAsyncGuaranteed(),0!==(33554432&bitField)?promise._fulfill(value):promise._reject(value))},Promise.prototype._settlePromiseLateCancellationObserver=function(ctx){var handler=ctx.handler,promise=ctx.promise,receiver=ctx.receiver,value=ctx.value;"function"==typeof handler?promise instanceof Promise?this._settlePromiseFromHandler(handler,receiver,value,promise):handler.call(receiver,value,promise):promise instanceof Promise&&promise._reject(value)},Promise.prototype._settlePromiseCtx=function(ctx){this._settlePromise(ctx.promise,ctx.handler,ctx.receiver,ctx.value)},Promise.prototype._settlePromise0=function(handler,value,bitField){var promise=this._promise0,receiver=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(promise,handler,receiver,value)},Promise.prototype._clearCallbackDataAtIndex=function(index){var base=4*index-4;this[base+2]=this[base+3]=this[base+0]=this[base+1]=void 0},Promise.prototype._fulfill=function(value){var bitField=this._bitField;if(!((117506048&bitField)>>>16)){if(value===this){var err=makeSelfResolutionError();return this._attachExtraTrace(err),this._reject(err)}this._setFulfilled(),this._rejectionHandler0=value,(65535&bitField)>0&&(0!==(134217728&bitField)?this._settlePromises():async.settlePromises(this))}},Promise.prototype._reject=function(reason){var bitField=this._bitField;if(!((117506048&bitField)>>>16))return this._setRejected(),this._fulfillmentHandler0=reason,this._isFinal()?async.fatalError(reason,util.isNode):void((65535&bitField)>0?async.settlePromises(this):this._ensurePossibleRejectionHandled())},Promise.prototype._fulfillPromises=function(len,value){for(var i=1;i<len;i++){var handler=this._fulfillmentHandlerAt(i),promise=this._promiseAt(i),receiver=this._receiverAt(i);this._clearCallbackDataAtIndex(i),this._settlePromise(promise,handler,receiver,value)}},Promise.prototype._rejectPromises=function(len,reason){for(var i=1;i<len;i++){var handler=this._rejectionHandlerAt(i),promise=this._promiseAt(i),receiver=this._receiverAt(i);this._clearCallbackDataAtIndex(i),this._settlePromise(promise,handler,receiver,reason)}},Promise.prototype._settlePromises=function(){var bitField=this._bitField,len=65535&bitField;if(len>0){if(0!==(16842752&bitField)){var reason=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,reason,bitField),this._rejectPromises(len,reason)}else{var value=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,value,bitField),this._fulfillPromises(len,value)}this._setLength(0)}this._clearCancellationData()},Promise.prototype._settledValue=function(){var bitField=this._bitField;return 0!==(33554432&bitField)?this._rejectionHandler0:0!==(16777216&bitField)?this._fulfillmentHandler0:void 0},Promise.defer=Promise.pending=function(){debug.deprecated("Promise.defer","new Promise");var promise=new Promise(INTERNAL);return{promise:promise,resolve:deferResolve,reject:deferReject}},util.notEnumerableProp(Promise,"_makeSelfResolutionError",makeSelfResolutionError),_dereq_("./method")(Promise,INTERNAL,tryConvertToPromise,apiRejection,debug),_dereq_("./bind")(Promise,INTERNAL,tryConvertToPromise,debug),_dereq_("./cancel")(Promise,PromiseArray,apiRejection,debug),_dereq_("./direct_resolve")(Promise),_dereq_("./synchronous_inspection")(Promise),_dereq_("./join")(Promise,PromiseArray,tryConvertToPromise,INTERNAL,async,getDomain),Promise.Promise=Promise,Promise.version="3.4.6",_dereq_("./map.js")(Promise,PromiseArray,apiRejection,tryConvertToPromise,INTERNAL,debug),_dereq_("./call_get.js")(Promise),_dereq_("./using.js")(Promise,apiRejection,tryConvertToPromise,createContext,INTERNAL,debug),_dereq_("./timers.js")(Promise,INTERNAL,debug),_dereq_("./generators.js")(Promise,apiRejection,INTERNAL,tryConvertToPromise,Proxyable,debug),_dereq_("./nodeify.js")(Promise),_dereq_("./promisify.js")(Promise,INTERNAL),_dereq_("./props.js")(Promise,PromiseArray,tryConvertToPromise,apiRejection),_dereq_("./race.js")(Promise,INTERNAL,tryConvertToPromise,apiRejection),_dereq_("./reduce.js")(Promise,PromiseArray,apiRejection,tryConvertToPromise,INTERNAL,debug),_dereq_("./settle.js")(Promise,PromiseArray,debug),_dereq_("./some.js")(Promise,PromiseArray,apiRejection),_dereq_("./filter.js")(Promise,INTERNAL),_dereq_("./each.js")(Promise,INTERNAL),_dereq_("./any.js")(Promise),util.toFastProperties(Promise),util.toFastProperties(Promise.prototype),fillTypes({a:1}),fillTypes({b:2}),fillTypes({c:3}),fillTypes(1),fillTypes(function(){}),fillTypes(void 0),fillTypes(!1),fillTypes(new Promise(INTERNAL)),debug.setBounds(Async.firstLineError,util.lastLineError),Promise}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,INTERNAL,tryConvertToPromise,apiRejection,Proxyable){function toResolutionValue(val){switch(val){case-2:return[];case-3:return{}}}function PromiseArray(values){var promise=this._promise=new Promise(INTERNAL);values instanceof Promise&&promise._propagateFrom(values,3),promise._setOnCancel(this),this._values=values,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var util=_dereq_("./util");util.isArray;return util.inherits(PromiseArray,Proxyable),PromiseArray.prototype.length=function(){return this._length},PromiseArray.prototype.promise=function(){return this._promise},PromiseArray.prototype._init=function init(_,resolveValueIfEmpty){var values=tryConvertToPromise(this._values,this._promise);if(values instanceof Promise){values=values._target();var bitField=values._bitField;if(this._values=values,0===(50397184&bitField))return this._promise._setAsyncGuaranteed(),values._then(init,this._reject,void 0,this,resolveValueIfEmpty);if(0===(33554432&bitField))return 0!==(16777216&bitField)?this._reject(values._reason()):this._cancel();values=values._value()}if(values=util.asArray(values),null===values){var err=apiRejection("expecting an array or an iterable object but got "+util.classString(values)).reason();return void this._promise._rejectCallback(err,!1)}return 0===values.length?void(resolveValueIfEmpty===-5?this._resolveEmptyArray():this._resolve(toResolutionValue(resolveValueIfEmpty))):void this._iterate(values)},PromiseArray.prototype._iterate=function(values){var len=this.getActualLength(values.length);this._length=len,this._values=this.shouldCopyValues()?new Array(len):this._values;for(var result=this._promise,isResolved=!1,bitField=null,i=0;i<len;++i){var maybePromise=tryConvertToPromise(values[i],result);maybePromise instanceof Promise?(maybePromise=maybePromise._target(),bitField=maybePromise._bitField):bitField=null,isResolved?null!==bitField&&maybePromise.suppressUnhandledRejections():null!==bitField?0===(50397184&bitField)?(maybePromise._proxy(this,i),this._values[i]=maybePromise):isResolved=0!==(33554432&bitField)?this._promiseFulfilled(maybePromise._value(),i):0!==(16777216&bitField)?this._promiseRejected(maybePromise._reason(),i):this._promiseCancelled(i):isResolved=this._promiseFulfilled(maybePromise,i)}isResolved||result._setAsyncGuaranteed()},PromiseArray.prototype._isResolved=function(){return null===this._values},PromiseArray.prototype._resolve=function(value){this._values=null,this._promise._fulfill(value)},PromiseArray.prototype._cancel=function(){!this._isResolved()&&this._promise._isCancellable()&&(this._values=null,this._promise._cancel())},PromiseArray.prototype._reject=function(reason){this._values=null,this._promise._rejectCallback(reason,!1)},PromiseArray.prototype._promiseFulfilled=function(value,index){this._values[index]=value;var totalResolved=++this._totalResolved;return totalResolved>=this._length&&(this._resolve(this._values),!0)},PromiseArray.prototype._promiseCancelled=function(){return this._cancel(),!0},PromiseArray.prototype._promiseRejected=function(reason){return this._totalResolved++,this._reject(reason),!0},PromiseArray.prototype._resultCancelled=function(){if(!this._isResolved()){var values=this._values;if(this._cancel(),values instanceof Promise)values.cancel();else for(var i=0;i<values.length;++i)values[i]instanceof Promise&&values[i].cancel()}},PromiseArray.prototype.shouldCopyValues=function(){return!0},PromiseArray.prototype.getActualLength=function(len){return len},PromiseArray}},{"./util":36}],24:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,INTERNAL){function propsFilter(key){return!noCopyPropsPattern.test(key)}function isPromisified(fn){try{return fn.__isPromisified__===!0}catch(e){return!1}}function hasPromisified(obj,key,suffix){var val=util.getDataPropertyOrDefault(obj,key+suffix,defaultPromisified);return!!val&&isPromisified(val)}function checkValid(ret,suffix,suffixRegexp){for(var i=0;i<ret.length;i+=2){var key=ret[i];if(suffixRegexp.test(key))for(var keyWithoutAsyncSuffix=key.replace(suffixRegexp,""),j=0;j<ret.length;j+=2)if(ret[j]===keyWithoutAsyncSuffix)throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\n\n See http://goo.gl/MqrFmX\n".replace("%s",suffix))}}function promisifiableMethods(obj,suffix,suffixRegexp,filter){for(var keys=util.inheritedDataKeys(obj),ret=[],i=0;i<keys.length;++i){var key=keys[i],value=obj[key],passesDefaultFilter=filter===defaultFilter||defaultFilter(key,value,obj);"function"!=typeof value||isPromisified(value)||hasPromisified(obj,key,suffix)||!filter(key,value,obj,passesDefaultFilter)||ret.push(key,value)}return checkValid(ret,suffix,suffixRegexp),ret}function makeNodePromisifiedClosure(callback,receiver,_,fn,__,multiArgs){function promisified(){var _receiver=receiver;receiver===THIS&&(_receiver=this);var promise=new Promise(INTERNAL);promise._captureStackTrace();var cb="string"==typeof method&&this!==defaultThis?this[method]:callback,fn=nodebackForPromise(promise,multiArgs);try{cb.apply(_receiver,withAppended(arguments,fn))}catch(e){promise._rejectCallback(maybeWrapAsError(e),!0,!0)}return promise._isFateSealed()||promise._setAsyncGuaranteed(),promise}var defaultThis=function(){return this}(),method=callback;return"string"==typeof method&&(callback=fn),util.notEnumerableProp(promisified,"__isPromisified__",!0),promisified}function promisifyAll(obj,suffix,filter,promisifier,multiArgs){for(var suffixRegexp=new RegExp(escapeIdentRegex(suffix)+"$"),methods=promisifiableMethods(obj,suffix,suffixRegexp,filter),i=0,len=methods.length;i<len;i+=2){var key=methods[i],fn=methods[i+1],promisifiedKey=key+suffix;if(promisifier===makeNodePromisified)obj[promisifiedKey]=makeNodePromisified(key,THIS,key,fn,suffix,multiArgs);else{var promisified=promisifier(fn,function(){return makeNodePromisified(key,THIS,key,fn,suffix,multiArgs)});util.notEnumerableProp(promisified,"__isPromisified__",!0),obj[promisifiedKey]=promisified}}return util.toFastProperties(obj),obj}function promisify(callback,receiver,multiArgs){return makeNodePromisified(callback,receiver,void 0,callback,null,multiArgs)}var makeNodePromisifiedEval,THIS={},util=_dereq_("./util"),nodebackForPromise=_dereq_("./nodeback"),withAppended=util.withAppended,maybeWrapAsError=util.maybeWrapAsError,canEvaluate=util.canEvaluate,TypeError=_dereq_("./errors").TypeError,defaultSuffix="Async",defaultPromisified={__isPromisified__:!0},noCopyProps=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],noCopyPropsPattern=new RegExp("^(?:"+noCopyProps.join("|")+")$"),defaultFilter=function(name){return util.isIdentifier(name)&&"_"!==name.charAt(0)&&"constructor"!==name},escapeIdentRegex=function(str){return str.replace(/([$])/,"\\$")},makeNodePromisified=canEvaluate?makeNodePromisifiedEval:makeNodePromisifiedClosure;Promise.promisify=function(fn,options){if("function"!=typeof fn)throw new TypeError("expecting a function but got "+util.classString(fn));if(isPromisified(fn))return fn;options=Object(options);var receiver=void 0===options.context?THIS:options.context,multiArgs=!!options.multiArgs,ret=promisify(fn,receiver,multiArgs);return util.copyDescriptors(fn,ret,propsFilter),ret},Promise.promisifyAll=function(target,options){if("function"!=typeof target&&"object"!=typeof target)throw new TypeError("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/MqrFmX\n");options=Object(options);var multiArgs=!!options.multiArgs,suffix=options.suffix;"string"!=typeof suffix&&(suffix=defaultSuffix);var filter=options.filter;"function"!=typeof filter&&(filter=defaultFilter);var promisifier=options.promisifier;if("function"!=typeof promisifier&&(promisifier=makeNodePromisified),!util.isIdentifier(suffix))throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/MqrFmX\n");for(var keys=util.inheritedDataKeys(target),i=0;i<keys.length;++i){var value=target[keys[i]];"constructor"!==keys[i]&&util.isClass(value)&&(promisifyAll(value.prototype,suffix,filter,promisifier,multiArgs),promisifyAll(value,suffix,filter,promisifier,multiArgs))}return promisifyAll(target,suffix,filter,promisifier,multiArgs)}}},{"./errors":12,"./nodeback":20,"./util":36}],25:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,PromiseArray,tryConvertToPromise,apiRejection){function PropertiesPromiseArray(obj){var entries,isMap=!1;if(void 0!==Es6Map&&obj instanceof Es6Map)entries=mapToEntries(obj),isMap=!0;else{var keys=es5.keys(obj),len=keys.length;entries=new Array(2*len);for(var i=0;i<len;++i){var key=keys[i];entries[i]=obj[key],entries[i+len]=key}}this.constructor$(entries),this._isMap=isMap,this._init$(void 0,-3)}function props(promises){var ret,castValue=tryConvertToPromise(promises);return isObject(castValue)?(ret=castValue instanceof Promise?castValue._then(Promise.props,void 0,void 0,void 0,void 0):new PropertiesPromiseArray(castValue).promise(),castValue instanceof Promise&&ret._propagateFrom(castValue,2),ret):apiRejection("cannot await properties of a non-object\n\n See http://goo.gl/MqrFmX\n")}var Es6Map,util=_dereq_("./util"),isObject=util.isObject,es5=_dereq_("./es5");"function"==typeof Map&&(Es6Map=Map);var mapToEntries=function(){function extractEntry(value,key){this[index]=value,this[index+size]=key,index++}var index=0,size=0;return function(map){size=map.size,index=0;var ret=new Array(2*map.size);return map.forEach(extractEntry,ret),ret}}(),entriesToMap=function(entries){for(var ret=new Es6Map,length=entries.length/2|0,i=0;i<length;++i){var key=entries[length+i],value=entries[i];ret.set(key,value)}return ret};util.inherits(PropertiesPromiseArray,PromiseArray),PropertiesPromiseArray.prototype._init=function(){},PropertiesPromiseArray.prototype._promiseFulfilled=function(value,index){this._values[index]=value;var totalResolved=++this._totalResolved;if(totalResolved>=this._length){var val;if(this._isMap)val=entriesToMap(this._values);else{val={};for(var keyOffset=this.length(),i=0,len=this.length();i<len;++i)val[this._values[i+keyOffset]]=this._values[i]}return this._resolve(val),!0}return!1},PropertiesPromiseArray.prototype.shouldCopyValues=function(){return!1},PropertiesPromiseArray.prototype.getActualLength=function(len){return len>>1},Promise.prototype.props=function(){return props(this)},Promise.props=function(promises){return props(promises)}}},{"./es5":13,"./util":36}],26:[function(_dereq_,module,exports){"use strict";function arrayMove(src,srcIndex,dst,dstIndex,len){for(var j=0;j<len;++j)dst[j+dstIndex]=src[j+srcIndex],src[j+srcIndex]=void 0}function Queue(capacity){this._capacity=capacity,this._length=0,this._front=0}Queue.prototype._willBeOverCapacity=function(size){return this._capacity<size},Queue.prototype._pushOne=function(arg){var length=this.length();this._checkCapacity(length+1);var i=this._front+length&this._capacity-1;this[i]=arg,this._length=length+1},Queue.prototype._unshiftOne=function(value){var capacity=this._capacity;this._checkCapacity(this.length()+1);var front=this._front,i=(front-1&capacity-1^capacity)-capacity;this[i]=value,this._front=i,this._length=this.length()+1},Queue.prototype.unshift=function(fn,receiver,arg){this._unshiftOne(arg),this._unshiftOne(receiver),this._unshiftOne(fn)},Queue.prototype.push=function(fn,receiver,arg){var length=this.length()+3;if(this._willBeOverCapacity(length))return this._pushOne(fn),this._pushOne(receiver),void this._pushOne(arg);var j=this._front+length-3;this._checkCapacity(length);var wrapMask=this._capacity-1;this[j+0&wrapMask]=fn,this[j+1&wrapMask]=receiver,this[j+2&wrapMask]=arg,this._length=length},Queue.prototype.shift=function(){var front=this._front,ret=this[front];return this[front]=void 0,this._front=front+1&this._capacity-1,this._length--,ret},Queue.prototype.length=function(){return this._length},Queue.prototype._checkCapacity=function(size){this._capacity<size&&this._resizeTo(this._capacity<<1)},Queue.prototype._resizeTo=function(capacity){var oldCapacity=this._capacity;this._capacity=capacity;var front=this._front,length=this._length,moveItemsCount=front+length&oldCapacity-1;arrayMove(this,0,this,oldCapacity,moveItemsCount)},module.exports=Queue},{}],27:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,INTERNAL,tryConvertToPromise,apiRejection){function race(promises,parent){var maybePromise=tryConvertToPromise(promises);if(maybePromise instanceof Promise)return raceLater(maybePromise);if(promises=util.asArray(promises),null===promises)return apiRejection("expecting an array or an iterable object but got "+util.classString(promises));var ret=new Promise(INTERNAL);void 0!==parent&&ret._propagateFrom(parent,3);for(var fulfill=ret._fulfill,reject=ret._reject,i=0,len=promises.length;i<len;++i){var val=promises[i];(void 0!==val||i in promises)&&Promise.cast(val)._then(fulfill,reject,void 0,ret,null)}return ret}var util=_dereq_("./util"),raceLater=function(promise){return promise.then(function(array){return race(array,promise)})};Promise.race=function(promises){return race(promises,void 0)},Promise.prototype.race=function(){return race(this,void 0)}}},{"./util":36}],28:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,PromiseArray,apiRejection,tryConvertToPromise,INTERNAL,debug){function ReductionPromiseArray(promises,fn,initialValue,_each){this.constructor$(promises);var domain=getDomain();this._fn=null===domain?fn:util.domainBind(domain,fn),void 0!==initialValue&&(initialValue=Promise.resolve(initialValue),initialValue._attachCancellationCallback(this)),this._initialValue=initialValue,this._currentCancellable=null,_each===INTERNAL?this._eachValues=Array(this._length):0===_each?this._eachValues=null:this._eachValues=void 0,this._promise._captureStackTrace(),this._init$(void 0,-5)}function completed(valueOrReason,array){this.isFulfilled()?array._resolve(valueOrReason):array._reject(valueOrReason)}function reduce(promises,fn,initialValue,_each){if("function"!=typeof fn)return apiRejection("expecting a function but got "+util.classString(fn));var array=new ReductionPromiseArray(promises,fn,initialValue,_each);return array.promise()}function gotAccum(accum){this.accum=accum,this.array._gotAccum(accum);var value=tryConvertToPromise(this.value,this.array._promise);return value instanceof Promise?(this.array._currentCancellable=value,value._then(gotValue,void 0,void 0,this,void 0)):gotValue.call(this,value)}function gotValue(value){var array=this.array,promise=array._promise,fn=tryCatch(array._fn);promise._pushContext();var ret;ret=void 0!==array._eachValues?fn.call(promise._boundValue(),value,this.index,this.length):fn.call(promise._boundValue(),this.accum,value,this.index,this.length),ret instanceof Promise&&(array._currentCancellable=ret);var promiseCreated=promise._popContext();return debug.checkForgottenReturns(ret,promiseCreated,void 0!==array._eachValues?"Promise.each":"Promise.reduce",promise),ret}var getDomain=Promise._getDomain,util=_dereq_("./util"),tryCatch=util.tryCatch;util.inherits(ReductionPromiseArray,PromiseArray),ReductionPromiseArray.prototype._gotAccum=function(accum){void 0!==this._eachValues&&null!==this._eachValues&&accum!==INTERNAL&&this._eachValues.push(accum)},ReductionPromiseArray.prototype._eachComplete=function(value){return null!==this._eachValues&&this._eachValues.push(value),this._eachValues},ReductionPromiseArray.prototype._init=function(){},ReductionPromiseArray.prototype._resolveEmptyArray=function(){this._resolve(void 0!==this._eachValues?this._eachValues:this._initialValue)},ReductionPromiseArray.prototype.shouldCopyValues=function(){return!1},ReductionPromiseArray.prototype._resolve=function(value){this._promise._resolveCallback(value),this._values=null},ReductionPromiseArray.prototype._resultCancelled=function(sender){return sender===this._initialValue?this._cancel():void(this._isResolved()||(this._resultCancelled$(),this._currentCancellable instanceof Promise&&this._currentCancellable.cancel(),this._initialValue instanceof Promise&&this._initialValue.cancel()))},ReductionPromiseArray.prototype._iterate=function(values){this._values=values;var value,i,length=values.length;if(void 0!==this._initialValue?(value=this._initialValue,i=0):(value=Promise.resolve(values[0]),i=1),this._currentCancellable=value,!value.isRejected())for(;i<length;++i){var ctx={accum:null,value:values[i],index:i,length:length,array:this};value=value._then(gotAccum,void 0,void 0,ctx,void 0)}void 0!==this._eachValues&&(value=value._then(this._eachComplete,void 0,void 0,this,void 0)),value._then(completed,completed,void 0,value,this)},Promise.prototype.reduce=function(fn,initialValue){return reduce(this,fn,initialValue,null)},Promise.reduce=function(promises,fn,initialValue,_each){return reduce(promises,fn,initialValue,_each)}}},{"./util":36}],29:[function(_dereq_,module,exports){"use strict";var schedule,util=_dereq_("./util"),noAsyncScheduler=function(){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")},NativePromise=util.getNativePromise();if(util.isNode&&"undefined"==typeof MutationObserver){var GlobalSetImmediate=global.setImmediate,ProcessNextTick=process.nextTick;schedule=util.isRecentNode?function(fn){GlobalSetImmediate.call(global,fn)}:function(fn){ProcessNextTick.call(process,fn)}}else if("function"==typeof NativePromise&&"function"==typeof NativePromise.resolve){var nativePromise=NativePromise.resolve();schedule=function(fn){nativePromise.then(fn)}}else schedule="undefined"==typeof MutationObserver||"undefined"!=typeof window&&window.navigator&&(window.navigator.standalone||window.cordova)?"undefined"!=typeof setImmediate?function(fn){setImmediate(fn)}:"undefined"!=typeof setTimeout?function(fn){setTimeout(fn,0)}:noAsyncScheduler:function(){var div=document.createElement("div"),opts={attributes:!0},toggleScheduled=!1,div2=document.createElement("div"),o2=new MutationObserver(function(){div.classList.toggle("foo"),toggleScheduled=!1});o2.observe(div2,opts);var scheduleToggle=function(){toggleScheduled||(toggleScheduled=!0,div2.classList.toggle("foo"))};return function(fn){var o=new MutationObserver(function(){o.disconnect(),fn()});o.observe(div,opts),scheduleToggle()}}();module.exports=schedule},{"./util":36}],30:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,PromiseArray,debug){function SettledPromiseArray(values){this.constructor$(values)}var PromiseInspection=Promise.PromiseInspection,util=_dereq_("./util");util.inherits(SettledPromiseArray,PromiseArray),SettledPromiseArray.prototype._promiseResolved=function(index,inspection){this._values[index]=inspection;var totalResolved=++this._totalResolved;return totalResolved>=this._length&&(this._resolve(this._values),!0)},SettledPromiseArray.prototype._promiseFulfilled=function(value,index){var ret=new PromiseInspection;return ret._bitField=33554432,ret._settledValueField=value,this._promiseResolved(index,ret)},SettledPromiseArray.prototype._promiseRejected=function(reason,index){var ret=new PromiseInspection;return ret._bitField=16777216,ret._settledValueField=reason,this._promiseResolved(index,ret)},Promise.settle=function(promises){return debug.deprecated(".settle()",".reflect()"),new SettledPromiseArray(promises).promise()},Promise.prototype.settle=function(){return Promise.settle(this)}}},{"./util":36}],31:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,PromiseArray,apiRejection){function SomePromiseArray(values){this.constructor$(values),this._howMany=0,this._unwrap=!1,this._initialized=!1}function some(promises,howMany){if((0|howMany)!==howMany||howMany<0)return apiRejection("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var ret=new SomePromiseArray(promises),promise=ret.promise();return ret.setHowMany(howMany),ret.init(),promise}var util=_dereq_("./util"),RangeError=_dereq_("./errors").RangeError,AggregateError=_dereq_("./errors").AggregateError,isArray=util.isArray,CANCELLATION={};util.inherits(SomePromiseArray,PromiseArray),SomePromiseArray.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-5);var isArrayResolved=isArray(this._values);!this._isResolved()&&isArrayResolved&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}},SomePromiseArray.prototype.init=function(){this._initialized=!0,this._init()},SomePromiseArray.prototype.setUnwrap=function(){this._unwrap=!0},SomePromiseArray.prototype.howMany=function(){return this._howMany},SomePromiseArray.prototype.setHowMany=function(count){this._howMany=count},SomePromiseArray.prototype._promiseFulfilled=function(value){return this._addFulfilled(value),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0)},SomePromiseArray.prototype._promiseRejected=function(reason){return this._addRejected(reason),this._checkOutcome()},SomePromiseArray.prototype._promiseCancelled=function(){return this._values instanceof Promise||null==this._values?this._cancel():(this._addRejected(CANCELLATION),this._checkOutcome())},SomePromiseArray.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var e=new AggregateError,i=this.length();i<this._values.length;++i)this._values[i]!==CANCELLATION&&e.push(this._values[i]);return e.length>0?this._reject(e):this._cancel(),!0}return!1},SomePromiseArray.prototype._fulfilled=function(){return this._totalResolved},SomePromiseArray.prototype._rejected=function(){return this._values.length-this.length()},SomePromiseArray.prototype._addRejected=function(reason){this._values.push(reason)},SomePromiseArray.prototype._addFulfilled=function(value){this._values[this._totalResolved++]=value},SomePromiseArray.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},SomePromiseArray.prototype._getRangeError=function(count){var message="Input array must contain at least "+this._howMany+" items but contains only "+count+" items";return new RangeError(message)},SomePromiseArray.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},Promise.some=function(promises,howMany){return some(promises,howMany)},Promise.prototype.some=function(howMany){return some(this,howMany)},Promise._SomePromiseArray=SomePromiseArray}},{"./errors":12,"./util":36}],32:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise){function PromiseInspection(promise){void 0!==promise?(promise=promise._target(),this._bitField=promise._bitField,this._settledValueField=promise._isFateSealed()?promise._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}PromiseInspection.prototype._settledValue=function(){return this._settledValueField;
|
||
};var value=PromiseInspection.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},reason=PromiseInspection.prototype.error=PromiseInspection.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},isFulfilled=PromiseInspection.prototype.isFulfilled=function(){return 0!==(33554432&this._bitField)},isRejected=PromiseInspection.prototype.isRejected=function(){return 0!==(16777216&this._bitField)},isPending=PromiseInspection.prototype.isPending=function(){return 0===(50397184&this._bitField)},isResolved=PromiseInspection.prototype.isResolved=function(){return 0!==(50331648&this._bitField)};PromiseInspection.prototype.isCancelled=function(){return 0!==(8454144&this._bitField)},Promise.prototype.__isCancelled=function(){return 65536===(65536&this._bitField)},Promise.prototype._isCancelled=function(){return this._target().__isCancelled()},Promise.prototype.isCancelled=function(){return 0!==(8454144&this._target()._bitField)},Promise.prototype.isPending=function(){return isPending.call(this._target())},Promise.prototype.isRejected=function(){return isRejected.call(this._target())},Promise.prototype.isFulfilled=function(){return isFulfilled.call(this._target())},Promise.prototype.isResolved=function(){return isResolved.call(this._target())},Promise.prototype.value=function(){return value.call(this._target())},Promise.prototype.reason=function(){var target=this._target();return target._unsetRejectionIsUnhandled(),reason.call(target)},Promise.prototype._value=function(){return this._settledValue()},Promise.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},Promise.PromiseInspection=PromiseInspection}},{}],33:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,INTERNAL){function tryConvertToPromise(obj,context){if(isObject(obj)){if(obj instanceof Promise)return obj;var then=getThen(obj);if(then===errorObj){context&&context._pushContext();var ret=Promise.reject(then.e);return context&&context._popContext(),ret}if("function"==typeof then){if(isAnyBluebirdPromise(obj)){var ret=new Promise(INTERNAL);return obj._then(ret._fulfill,ret._reject,void 0,ret,null),ret}return doThenable(obj,then,context)}}return obj}function doGetThen(obj){return obj.then}function getThen(obj){try{return doGetThen(obj)}catch(e){return errorObj.e=e,errorObj}}function isAnyBluebirdPromise(obj){try{return hasProp.call(obj,"_promise0")}catch(e){return!1}}function doThenable(x,then,context){function resolve(value){promise&&(promise._resolveCallback(value),promise=null)}function reject(reason){promise&&(promise._rejectCallback(reason,synchronous,!0),promise=null)}var promise=new Promise(INTERNAL),ret=promise;context&&context._pushContext(),promise._captureStackTrace(),context&&context._popContext();var synchronous=!0,result=util.tryCatch(then).call(x,resolve,reject);return synchronous=!1,promise&&result===errorObj&&(promise._rejectCallback(result.e,!0,!0),promise=null),ret}var util=_dereq_("./util"),errorObj=util.errorObj,isObject=util.isObject,hasProp={}.hasOwnProperty;return tryConvertToPromise}},{"./util":36}],34:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,INTERNAL,debug){function HandleWrapper(handle){this.handle=handle}function successClear(value){return clearTimeout(this.handle),value}function failureClear(reason){throw clearTimeout(this.handle),reason}var util=_dereq_("./util"),TimeoutError=Promise.TimeoutError;HandleWrapper.prototype._resultCancelled=function(){clearTimeout(this.handle)};var afterValue=function(value){return delay(+this).thenReturn(value)},delay=Promise.delay=function(ms,value){var ret,handle;return void 0!==value?(ret=Promise.resolve(value)._then(afterValue,null,null,ms,void 0),debug.cancellation()&&value instanceof Promise&&ret._setOnCancel(value)):(ret=new Promise(INTERNAL),handle=setTimeout(function(){ret._fulfill()},+ms),debug.cancellation()&&ret._setOnCancel(new HandleWrapper(handle)),ret._captureStackTrace()),ret._setAsyncGuaranteed(),ret};Promise.prototype.delay=function(ms){return delay(ms,this)};var afterTimeout=function(promise,message,parent){var err;err="string"!=typeof message?message instanceof Error?message:new TimeoutError("operation timed out"):new TimeoutError(message),util.markAsOriginatingFromRejection(err),promise._attachExtraTrace(err),promise._reject(err),null!=parent&&parent.cancel()};Promise.prototype.timeout=function(ms,message){ms=+ms;var ret,parent,handleWrapper=new HandleWrapper(setTimeout(function(){ret.isPending()&&afterTimeout(ret,message,parent)},ms));return debug.cancellation()?(parent=this.then(),ret=parent._then(successClear,failureClear,void 0,handleWrapper,void 0),ret._setOnCancel(handleWrapper)):ret=this._then(successClear,failureClear,void 0,handleWrapper,void 0),ret}}},{"./util":36}],35:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,apiRejection,tryConvertToPromise,createContext,INTERNAL,debug){function thrower(e){setTimeout(function(){throw e},0)}function castPreservingDisposable(thenable){var maybePromise=tryConvertToPromise(thenable);return maybePromise!==thenable&&"function"==typeof thenable._isDisposable&&"function"==typeof thenable._getDisposer&&thenable._isDisposable()&&maybePromise._setDisposable(thenable._getDisposer()),maybePromise}function dispose(resources,inspection){function iterator(){if(i>=len)return ret._fulfill();var maybePromise=castPreservingDisposable(resources[i++]);if(maybePromise instanceof Promise&&maybePromise._isDisposable()){try{maybePromise=tryConvertToPromise(maybePromise._getDisposer().tryDispose(inspection),resources.promise)}catch(e){return thrower(e)}if(maybePromise instanceof Promise)return maybePromise._then(iterator,thrower,null,null,null)}iterator()}var i=0,len=resources.length,ret=new Promise(INTERNAL);return iterator(),ret}function Disposer(data,promise,context){this._data=data,this._promise=promise,this._context=context}function FunctionDisposer(fn,promise,context){this.constructor$(fn,promise,context)}function maybeUnwrapDisposer(value){return Disposer.isDisposer(value)?(this.resources[this.index]._setDisposable(value),value.promise()):value}function ResourceList(length){this.length=length,this.promise=null,this[length-1]=null}var util=_dereq_("./util"),TypeError=_dereq_("./errors").TypeError,inherits=_dereq_("./util").inherits,errorObj=util.errorObj,tryCatch=util.tryCatch,NULL={};Disposer.prototype.data=function(){return this._data},Disposer.prototype.promise=function(){return this._promise},Disposer.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():NULL},Disposer.prototype.tryDispose=function(inspection){var resource=this.resource(),context=this._context;void 0!==context&&context._pushContext();var ret=resource!==NULL?this.doDispose(resource,inspection):null;return void 0!==context&&context._popContext(),this._promise._unsetDisposable(),this._data=null,ret},Disposer.isDisposer=function(d){return null!=d&&"function"==typeof d.resource&&"function"==typeof d.tryDispose},inherits(FunctionDisposer,Disposer),FunctionDisposer.prototype.doDispose=function(resource,inspection){var fn=this.data();return fn.call(resource,resource,inspection)},ResourceList.prototype._resultCancelled=function(){for(var len=this.length,i=0;i<len;++i){var item=this[i];item instanceof Promise&&item.cancel()}},Promise.using=function(){var len=arguments.length;if(len<2)return apiRejection("you must pass at least 2 arguments to Promise.using");var fn=arguments[len-1];if("function"!=typeof fn)return apiRejection("expecting a function but got "+util.classString(fn));var input,spreadArgs=!0;2===len&&Array.isArray(arguments[0])?(input=arguments[0],len=input.length,spreadArgs=!1):(input=arguments,len--);for(var resources=new ResourceList(len),i=0;i<len;++i){var resource=input[i];if(Disposer.isDisposer(resource)){var disposer=resource;resource=resource.promise(),resource._setDisposable(disposer)}else{var maybePromise=tryConvertToPromise(resource);maybePromise instanceof Promise&&(resource=maybePromise._then(maybeUnwrapDisposer,null,null,{resources:resources,index:i},void 0))}resources[i]=resource}for(var reflectedResources=new Array(resources.length),i=0;i<reflectedResources.length;++i)reflectedResources[i]=Promise.resolve(resources[i]).reflect();var resultPromise=Promise.all(reflectedResources).then(function(inspections){for(var i=0;i<inspections.length;++i){var inspection=inspections[i];if(inspection.isRejected())return errorObj.e=inspection.error(),errorObj;if(!inspection.isFulfilled())return void resultPromise.cancel();inspections[i]=inspection.value()}promise._pushContext(),fn=tryCatch(fn);var ret=spreadArgs?fn.apply(void 0,inspections):fn(inspections),promiseCreated=promise._popContext();return debug.checkForgottenReturns(ret,promiseCreated,"Promise.using",promise),ret}),promise=resultPromise.lastly(function(){var inspection=new Promise.PromiseInspection(resultPromise);return dispose(resources,inspection)});return resources.promise=promise,promise._setOnCancel(resources),promise},Promise.prototype._setDisposable=function(disposer){this._bitField=131072|this._bitField,this._disposer=disposer},Promise.prototype._isDisposable=function(){return(131072&this._bitField)>0},Promise.prototype._getDisposer=function(){return this._disposer},Promise.prototype._unsetDisposable=function(){this._bitField=this._bitField&-131073,this._disposer=void 0},Promise.prototype.disposer=function(fn){if("function"==typeof fn)return new FunctionDisposer(fn,this,createContext());throw new TypeError}}},{"./errors":12,"./util":36}],36:[function(_dereq_,module,exports){"use strict";function tryCatcher(){try{var target=tryCatchTarget;return tryCatchTarget=null,target.apply(this,arguments)}catch(e){return errorObj.e=e,errorObj}}function tryCatch(fn){return tryCatchTarget=fn,tryCatcher}function isPrimitive(val){return null==val||val===!0||val===!1||"string"==typeof val||"number"==typeof val}function isObject(value){return"function"==typeof value||"object"==typeof value&&null!==value}function maybeWrapAsError(maybeError){return isPrimitive(maybeError)?new Error(safeToString(maybeError)):maybeError}function withAppended(target,appendee){var i,len=target.length,ret=new Array(len+1);for(i=0;i<len;++i)ret[i]=target[i];return ret[i]=appendee,ret}function getDataPropertyOrDefault(obj,key,defaultValue){if(!es5.isES5)return{}.hasOwnProperty.call(obj,key)?obj[key]:void 0;var desc=Object.getOwnPropertyDescriptor(obj,key);return null!=desc?null==desc.get&&null==desc.set?desc.value:defaultValue:void 0}function notEnumerableProp(obj,name,value){if(isPrimitive(obj))return obj;var descriptor={value:value,configurable:!0,enumerable:!1,writable:!0};return es5.defineProperty(obj,name,descriptor),obj}function thrower(r){throw r}function isClass(fn){try{if("function"==typeof fn){var keys=es5.names(fn.prototype),hasMethods=es5.isES5&&keys.length>1,hasMethodsOtherThanConstructor=keys.length>0&&!(1===keys.length&&"constructor"===keys[0]),hasThisAssignmentAndStaticMethods=thisAssignmentPattern.test(fn+"")&&es5.names(fn).length>0;if(hasMethods||hasMethodsOtherThanConstructor||hasThisAssignmentAndStaticMethods)return!0}return!1}catch(e){return!1}}function toFastProperties(obj){function FakeConstructor(){}FakeConstructor.prototype=obj;for(var l=8;l--;)new FakeConstructor;return obj}function isIdentifier(str){return rident.test(str)}function filledRange(count,prefix,suffix){for(var ret=new Array(count),i=0;i<count;++i)ret[i]=prefix+i+suffix;return ret}function safeToString(obj){try{return obj+""}catch(e){return"[no string representation]"}}function isError(obj){return null!==obj&&"object"==typeof obj&&"string"==typeof obj.message&&"string"==typeof obj.name}function markAsOriginatingFromRejection(e){try{notEnumerableProp(e,"isOperational",!0)}catch(ignore){}}function originatesFromRejection(e){return null!=e&&(e instanceof Error.__BluebirdErrorTypes__.OperationalError||e.isOperational===!0)}function canAttachTrace(obj){return isError(obj)&&es5.propertyIsWritable(obj,"stack")}function classString(obj){return{}.toString.call(obj)}function copyDescriptors(from,to,filter){for(var keys=es5.names(from),i=0;i<keys.length;++i){var key=keys[i];if(filter(key))try{es5.defineProperty(to,key,es5.getDescriptor(from,key))}catch(ignore){}}}function env(key,def){return isNode?process.env[key]:def}function getNativePromise(){if("function"==typeof Promise)try{var promise=new Promise(function(){});if("[object Promise]"==={}.toString.call(promise))return Promise}catch(e){}}function domainBind(self,cb){return self.bind(cb)}var es5=_dereq_("./es5"),canEvaluate="undefined"==typeof navigator,errorObj={e:{}},tryCatchTarget,globalObject="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0!==this?this:null,inherits=function(Child,Parent){function T(){this.constructor=Child,this.constructor$=Parent;for(var propertyName in Parent.prototype)hasProp.call(Parent.prototype,propertyName)&&"$"!==propertyName.charAt(propertyName.length-1)&&(this[propertyName+"$"]=Parent.prototype[propertyName])}var hasProp={}.hasOwnProperty;return T.prototype=Parent.prototype,Child.prototype=new T,Child.prototype},inheritedDataKeys=function(){var excludedPrototypes=[Array.prototype,Object.prototype,Function.prototype],isExcludedProto=function(val){for(var i=0;i<excludedPrototypes.length;++i)if(excludedPrototypes[i]===val)return!0;return!1};if(es5.isES5){var getKeys=Object.getOwnPropertyNames;return function(obj){for(var ret=[],visitedKeys=Object.create(null);null!=obj&&!isExcludedProto(obj);){var keys;try{keys=getKeys(obj)}catch(e){return ret}for(var i=0;i<keys.length;++i){var key=keys[i];if(!visitedKeys[key]){visitedKeys[key]=!0;var desc=Object.getOwnPropertyDescriptor(obj,key);null!=desc&&null==desc.get&&null==desc.set&&ret.push(key)}}obj=es5.getPrototypeOf(obj)}return ret}}var hasProp={}.hasOwnProperty;return function(obj){if(isExcludedProto(obj))return[];var ret=[];enumeration:for(var key in obj)if(hasProp.call(obj,key))ret.push(key);else{for(var i=0;i<excludedPrototypes.length;++i)if(hasProp.call(excludedPrototypes[i],key))continue enumeration;ret.push(key)}return ret}}(),thisAssignmentPattern=/this\s*\.\s*\S+\s*=/,rident=/^[a-z$_][a-z$_0-9]*$/i,ensureErrorObject=function(){return"stack"in new Error?function(value){return canAttachTrace(value)?value:new Error(safeToString(value))}:function(value){if(canAttachTrace(value))return value;try{throw new Error(safeToString(value))}catch(err){return err}}}(),asArray=function(v){return es5.isArray(v)?v:null};if("undefined"!=typeof Symbol&&Symbol.iterator){var ArrayFrom="function"==typeof Array.from?function(v){return Array.from(v)}:function(v){for(var itResult,ret=[],it=v[Symbol.iterator]();!(itResult=it.next()).done;)ret.push(itResult.value);return ret};asArray=function(v){return es5.isArray(v)?v:null!=v&&"function"==typeof v[Symbol.iterator]?ArrayFrom(v):null}}var isNode="undefined"!=typeof process&&"[object process]"===classString(process).toLowerCase(),ret={isClass:isClass,isIdentifier:isIdentifier,inheritedDataKeys:inheritedDataKeys,getDataPropertyOrDefault:getDataPropertyOrDefault,thrower:thrower,isArray:es5.isArray,asArray:asArray,notEnumerableProp:notEnumerableProp,isPrimitive:isPrimitive,isObject:isObject,isError:isError,canEvaluate:canEvaluate,errorObj:errorObj,tryCatch:tryCatch,inherits:inherits,withAppended:withAppended,maybeWrapAsError:maybeWrapAsError,toFastProperties:toFastProperties,filledRange:filledRange,toString:safeToString,canAttachTrace:canAttachTrace,ensureErrorObject:ensureErrorObject,originatesFromRejection:originatesFromRejection,markAsOriginatingFromRejection:markAsOriginatingFromRejection,classString:classString,copyDescriptors:copyDescriptors,hasDevTools:"undefined"!=typeof chrome&&chrome&&"function"==typeof chrome.loadTimes,isNode:isNode,env:env,global:globalObject,getNativePromise:getNativePromise,domainBind:domainBind};ret.isRecentNode=ret.isNode&&function(){var version=process.versions.node.split(".").map(Number);return 0===version[0]&&version[1]>10||version[0]>0}(),ret.isNode&&ret.toFastProperties(process);try{throw new Error}catch(e){ret.lastLineError=e}module.exports=ret},{"./es5":13}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(exports,__webpack_require__(35),__webpack_require__(10),__webpack_require__(27).setImmediate)},function(module,exports,__webpack_require__){var core=__webpack_require__(2),$JSON=core.JSON||(core.JSON={stringify:JSON.stringify});module.exports=function(it){return $JSON.stringify.apply($JSON,arguments)}},function(module,exports,__webpack_require__){__webpack_require__(142),module.exports=__webpack_require__(2).Object.assign},function(module,exports,__webpack_require__){__webpack_require__(143);var $Object=__webpack_require__(2).Object;module.exports=function(P,D){return $Object.create(P,D)}},function(module,exports,__webpack_require__){__webpack_require__(144);var $Object=__webpack_require__(2).Object;module.exports=function(it,key,desc){return $Object.defineProperty(it,key,desc)}},function(module,exports,__webpack_require__){__webpack_require__(145);var $Object=__webpack_require__(2).Object;module.exports=function(it){return $Object.getOwnPropertyNames(it)}},function(module,exports,__webpack_require__){__webpack_require__(146),module.exports=__webpack_require__(2).Object.getPrototypeOf},function(module,exports,__webpack_require__){__webpack_require__(147),module.exports=__webpack_require__(2).Object.keys},function(module,exports,__webpack_require__){__webpack_require__(148),module.exports=__webpack_require__(2).Object.setPrototypeOf},function(module,exports,__webpack_require__){__webpack_require__(73),__webpack_require__(74),__webpack_require__(75),__webpack_require__(149),module.exports=__webpack_require__(2).Promise},function(module,exports,__webpack_require__){__webpack_require__(150),__webpack_require__(73),__webpack_require__(151),__webpack_require__(152),module.exports=__webpack_require__(2).Symbol},function(module,exports,__webpack_require__){__webpack_require__(74),__webpack_require__(75),module.exports=__webpack_require__(49).f("iterator")},function(module,exports){module.exports=function(){}},function(module,exports){module.exports=function(it,Constructor,name,forbiddenField){if(!(it instanceof Constructor)||void 0!==forbiddenField&&forbiddenField in it)throw TypeError(name+": incorrect invocation!");return it}},function(module,exports,__webpack_require__){var toIObject=__webpack_require__(13),toLength=__webpack_require__(72),toIndex=__webpack_require__(139);module.exports=function(IS_INCLUDES){return function($this,el,fromIndex){var value,O=toIObject($this),length=toLength(O.length),index=toIndex(fromIndex,length);if(IS_INCLUDES&&el!=el){for(;length>index;)if(value=O[index++],value!=value)return!0}else for(;length>index;index++)if((IS_INCLUDES||index in O)&&O[index]===el)return IS_INCLUDES||index||0;return!IS_INCLUDES&&-1}}},function(module,exports,__webpack_require__){var getKeys=__webpack_require__(21),gOPS=__webpack_require__(42),pIE=__webpack_require__(30);module.exports=function(it){var result=getKeys(it),getSymbols=gOPS.f;if(getSymbols)for(var key,symbols=getSymbols(it),isEnum=pIE.f,i=0;symbols.length>i;)isEnum.call(it,key=symbols[i++])&&result.push(key);return result}},function(module,exports,__webpack_require__){var ctx=__webpack_require__(23),call=__webpack_require__(125),isArrayIter=__webpack_require__(123),anObject=__webpack_require__(6),toLength=__webpack_require__(72),getIterFn=__webpack_require__(140),BREAK={},RETURN={},exports=module.exports=function(iterable,entries,fn,that,ITERATOR){var length,step,iterator,result,iterFn=ITERATOR?function(){return iterable}:getIterFn(iterable),f=ctx(fn,that,entries?2:1),index=0;if("function"!=typeof iterFn)throw TypeError(iterable+" is not iterable!");if(isArrayIter(iterFn)){for(length=toLength(iterable.length);length>index;index++)if(result=entries?f(anObject(step=iterable[index])[0],step[1]):f(iterable[index]),result===BREAK||result===RETURN)return result}else for(iterator=iterFn.call(iterable);!(step=iterator.next()).done;)if(result=call(iterator,f,step.value,entries),result===BREAK||result===RETURN)return result};exports.BREAK=BREAK,exports.RETURN=RETURN},function(module,exports){module.exports=function(fn,args,that){var un=void 0===that;switch(args.length){case 0:return un?fn():fn.call(that);case 1:return un?fn(args[0]):fn.call(that,args[0]);case 2:return un?fn(args[0],args[1]):fn.call(that,args[0],args[1]);case 3:return un?fn(args[0],args[1],args[2]):fn.call(that,args[0],args[1],args[2]);case 4:return un?fn(args[0],args[1],args[2],args[3]):fn.call(that,args[0],args[1],args[2],args[3])}return fn.apply(that,args)}},function(module,exports,__webpack_require__){var Iterators=__webpack_require__(24),ITERATOR=__webpack_require__(3)("iterator"),ArrayProto=Array.prototype;module.exports=function(it){return void 0!==it&&(Iterators.Array===it||ArrayProto[ITERATOR]===it)}},function(module,exports,__webpack_require__){var cof=__webpack_require__(22);module.exports=Array.isArray||function(arg){return"Array"==cof(arg)}},function(module,exports,__webpack_require__){var anObject=__webpack_require__(6);module.exports=function(iterator,fn,value,entries){try{return entries?fn(anObject(value)[0],value[1]):fn(value)}catch(e){var ret=iterator.return;throw void 0!==ret&&anObject(ret.call(iterator)),e}}},function(module,exports,__webpack_require__){"use strict";var create=__webpack_require__(41),descriptor=__webpack_require__(31),setToStringTag=__webpack_require__(32),IteratorPrototype={};__webpack_require__(12)(IteratorPrototype,__webpack_require__(3)("iterator"),function(){return this}),module.exports=function(Constructor,NAME,next){Constructor.prototype=create(IteratorPrototype,{next:descriptor(1,next)}),setToStringTag(Constructor,NAME+" Iterator")}},function(module,exports,__webpack_require__){var ITERATOR=__webpack_require__(3)("iterator"),SAFE_CLOSING=!1;try{var riter=[7][ITERATOR]();riter.return=function(){SAFE_CLOSING=!0},Array.from(riter,function(){throw 2})}catch(e){}module.exports=function(exec,skipClosing){if(!skipClosing&&!SAFE_CLOSING)return!1;var safe=!1;try{var arr=[7],iter=arr[ITERATOR]();iter.next=function(){return{done:safe=!0}},arr[ITERATOR]=function(){return iter},exec(arr)}catch(e){}return safe}},function(module,exports){module.exports=function(done,value){return{value:value,done:!!done}}},function(module,exports,__webpack_require__){var getKeys=__webpack_require__(21),toIObject=__webpack_require__(13);module.exports=function(object,el){for(var key,O=toIObject(object),keys=getKeys(O),length=keys.length,index=0;length>index;)if(O[key=keys[index++]]===el)return key}},function(module,exports,__webpack_require__){var META=__webpack_require__(34)("meta"),isObject=__webpack_require__(20),has=__webpack_require__(11),setDesc=__webpack_require__(9).f,id=0,isExtensible=Object.isExtensible||function(){return!0},FREEZE=!__webpack_require__(19)(function(){return isExtensible(Object.preventExtensions({}))}),setMeta=function(it){setDesc(it,META,{value:{i:"O"+ ++id,w:{}}})},fastKey=function(it,create){if(!isObject(it))return"symbol"==typeof it?it:("string"==typeof it?"S":"P")+it;if(!has(it,META)){if(!isExtensible(it))return"F";if(!create)return"E";setMeta(it)}return it[META].i},getWeak=function(it,create){if(!has(it,META)){if(!isExtensible(it))return!0;if(!create)return!1;setMeta(it)}return it[META].w},onFreeze=function(it){return FREEZE&&meta.NEED&&isExtensible(it)&&!has(it,META)&&setMeta(it),it},meta=module.exports={KEY:META,NEED:!1,fastKey:fastKey,getWeak:getWeak,onFreeze:onFreeze}},function(module,exports,__webpack_require__){var global=__webpack_require__(4),macrotask=__webpack_require__(71).set,Observer=global.MutationObserver||global.WebKitMutationObserver,process=global.process,Promise=global.Promise,isNode="process"==__webpack_require__(22)(process);module.exports=function(){var head,last,notify,flush=function(){var parent,fn;for(isNode&&(parent=process.domain)&&parent.exit();head;){fn=head.fn,head=head.next;try{fn()}catch(e){throw head?notify():last=void 0,e}}last=void 0,parent&&parent.enter()};if(isNode)notify=function(){process.nextTick(flush)};else if(Observer){var toggle=!0,node=document.createTextNode("");new Observer(flush).observe(node,{characterData:!0}),notify=function(){node.data=toggle=!toggle}}else if(Promise&&Promise.resolve){var promise=Promise.resolve();notify=function(){promise.then(flush)}}else notify=function(){macrotask.call(global,flush)};return function(fn){var task={fn:fn,next:void 0};last&&(last.next=task),head||(head=task,notify()),last=task}}},function(module,exports,__webpack_require__){"use strict";var getKeys=__webpack_require__(21),gOPS=__webpack_require__(42),pIE=__webpack_require__(30),toObject=__webpack_require__(33),IObject=__webpack_require__(63),$assign=Object.assign;module.exports=!$assign||__webpack_require__(19)(function(){var A={},B={},S=Symbol(),K="abcdefghijklmnopqrst";return A[S]=7,K.split("").forEach(function(k){B[k]=k}),7!=$assign({},A)[S]||Object.keys($assign({},B)).join("")!=K})?function(target,source){for(var T=toObject(target),aLen=arguments.length,index=1,getSymbols=gOPS.f,isEnum=pIE.f;aLen>index;)for(var key,S=IObject(arguments[index++]),keys=getSymbols?getKeys(S).concat(getSymbols(S)):getKeys(S),length=keys.length,j=0;length>j;)isEnum.call(S,key=keys[j++])&&(T[key]=S[key]);return T}:$assign},function(module,exports,__webpack_require__){var dP=__webpack_require__(9),anObject=__webpack_require__(6),getKeys=__webpack_require__(21);module.exports=__webpack_require__(7)?Object.defineProperties:function(O,Properties){anObject(O);for(var P,keys=getKeys(Properties),length=keys.length,i=0;length>i;)dP.f(O,P=keys[i++],Properties[P]);return O}},function(module,exports,__webpack_require__){var hide=__webpack_require__(12);module.exports=function(target,src,safe){for(var key in src)safe&&target[key]?target[key]=src[key]:hide(target,key,src[key]);return target}},function(module,exports,__webpack_require__){var isObject=__webpack_require__(20),anObject=__webpack_require__(6),check=function(O,proto){if(anObject(O),!isObject(proto)&&null!==proto)throw TypeError(proto+": can't set as prototype!")};module.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(test,buggy,set){try{set=__webpack_require__(23)(Function.call,__webpack_require__(65).f(Object.prototype,"__proto__").set,2),set(test,[]),buggy=!(test instanceof Array)}catch(e){buggy=!0}return function(O,proto){return check(O,proto),buggy?O.__proto__=proto:set(O,proto),O}}({},!1):void 0),check:check}},function(module,exports,__webpack_require__){"use strict";var global=__webpack_require__(4),core=__webpack_require__(2),dP=__webpack_require__(9),DESCRIPTORS=__webpack_require__(7),SPECIES=__webpack_require__(3)("species");module.exports=function(KEY){var C="function"==typeof core[KEY]?core[KEY]:global[KEY];DESCRIPTORS&&C&&!C[SPECIES]&&dP.f(C,SPECIES,{configurable:!0,get:function(){return this}})}},function(module,exports,__webpack_require__){var anObject=__webpack_require__(6),aFunction=__webpack_require__(37),SPECIES=__webpack_require__(3)("species");module.exports=function(O,D){var S,C=anObject(O).constructor;return void 0===C||void 0==(S=anObject(C)[SPECIES])?D:aFunction(S)}},function(module,exports,__webpack_require__){var toInteger=__webpack_require__(46),defined=__webpack_require__(38);module.exports=function(TO_STRING){return function(that,pos){var a,b,s=String(defined(that)),i=toInteger(pos),l=s.length;return i<0||i>=l?TO_STRING?"":void 0:(a=s.charCodeAt(i),a<55296||a>56319||i+1===l||(b=s.charCodeAt(i+1))<56320||b>57343?TO_STRING?s.charAt(i):a:TO_STRING?s.slice(i,i+2):(a-55296<<10)+(b-56320)+65536)}}},function(module,exports,__webpack_require__){var toInteger=__webpack_require__(46),max=Math.max,min=Math.min;module.exports=function(index,length){return index=toInteger(index),index<0?max(index+length,0):min(index,length)}},function(module,exports,__webpack_require__){var classof=__webpack_require__(60),ITERATOR=__webpack_require__(3)("iterator"),Iterators=__webpack_require__(24);module.exports=__webpack_require__(2).getIteratorMethod=function(it){if(void 0!=it)return it[ITERATOR]||it["@@iterator"]||Iterators[classof(it)]}},function(module,exports,__webpack_require__){"use strict";var addToUnscopables=__webpack_require__(117),step=__webpack_require__(128),Iterators=__webpack_require__(24),toIObject=__webpack_require__(13);module.exports=__webpack_require__(64)(Array,"Array",function(iterated,kind){this._t=toIObject(iterated),this._i=0,this._k=kind},function(){var O=this._t,kind=this._k,index=this._i++;return!O||index>=O.length?(this._t=void 0,step(1)):"keys"==kind?step(0,index):"values"==kind?step(0,O[index]):step(0,[index,O[index]])},"values"),Iterators.Arguments=Iterators.Array,addToUnscopables("keys"),addToUnscopables("values"),addToUnscopables("entries")},function(module,exports,__webpack_require__){var $export=__webpack_require__(8);$export($export.S+$export.F,"Object",{assign:__webpack_require__(132)})},function(module,exports,__webpack_require__){var $export=__webpack_require__(8);$export($export.S,"Object",{create:__webpack_require__(41)})},function(module,exports,__webpack_require__){var $export=__webpack_require__(8);$export($export.S+$export.F*!__webpack_require__(7),"Object",{defineProperty:__webpack_require__(9).f})},function(module,exports,__webpack_require__){__webpack_require__(43)("getOwnPropertyNames",function(){return __webpack_require__(66).f})},function(module,exports,__webpack_require__){var toObject=__webpack_require__(33),$getPrototypeOf=__webpack_require__(68);__webpack_require__(43)("getPrototypeOf",function(){return function(it){return $getPrototypeOf(toObject(it))}})},function(module,exports,__webpack_require__){var toObject=__webpack_require__(33),$keys=__webpack_require__(21);__webpack_require__(43)("keys",function(){return function(it){return $keys(toObject(it))}})},function(module,exports,__webpack_require__){var $export=__webpack_require__(8);$export($export.S,"Object",{setPrototypeOf:__webpack_require__(135).set})},function(module,exports,__webpack_require__){"use strict";var Internal,GenericPromiseCapability,Wrapper,LIBRARY=__webpack_require__(29),global=__webpack_require__(4),ctx=__webpack_require__(23),classof=__webpack_require__(60),$export=__webpack_require__(8),isObject=__webpack_require__(20),aFunction=__webpack_require__(37),anInstance=__webpack_require__(118),forOf=__webpack_require__(121),speciesConstructor=__webpack_require__(137),task=__webpack_require__(71).set,microtask=__webpack_require__(131)(),PROMISE="Promise",TypeError=global.TypeError,process=global.process,$Promise=global[PROMISE],process=global.process,isNode="process"==classof(process),empty=function(){},USE_NATIVE=!!function(){try{var promise=$Promise.resolve(1),FakePromise=(promise.constructor={})[__webpack_require__(3)("species")]=function(exec){exec(empty,empty)};return(isNode||"function"==typeof PromiseRejectionEvent)&&promise.then(empty)instanceof FakePromise}catch(e){}}(),sameConstructor=function(a,b){return a===b||a===$Promise&&b===Wrapper},isThenable=function(it){var then;return!(!isObject(it)||"function"!=typeof(then=it.then))&&then},newPromiseCapability=function(C){return sameConstructor($Promise,C)?new PromiseCapability(C):new GenericPromiseCapability(C)},PromiseCapability=GenericPromiseCapability=function(C){var resolve,reject;this.promise=new C(function($$resolve,$$reject){if(void 0!==resolve||void 0!==reject)throw TypeError("Bad Promise constructor");resolve=$$resolve,reject=$$reject}),this.resolve=aFunction(resolve),
|
||
this.reject=aFunction(reject)},perform=function(exec){try{exec()}catch(e){return{error:e}}},notify=function(promise,isReject){if(!promise._n){promise._n=!0;var chain=promise._c;microtask(function(){for(var value=promise._v,ok=1==promise._s,i=0,run=function(reaction){var result,then,handler=ok?reaction.ok:reaction.fail,resolve=reaction.resolve,reject=reaction.reject,domain=reaction.domain;try{handler?(ok||(2==promise._h&&onHandleUnhandled(promise),promise._h=1),handler===!0?result=value:(domain&&domain.enter(),result=handler(value),domain&&domain.exit()),result===reaction.promise?reject(TypeError("Promise-chain cycle")):(then=isThenable(result))?then.call(result,resolve,reject):resolve(result)):reject(value)}catch(e){reject(e)}};chain.length>i;)run(chain[i++]);promise._c=[],promise._n=!1,isReject&&!promise._h&&onUnhandled(promise)})}},onUnhandled=function(promise){task.call(global,function(){var abrupt,handler,console,value=promise._v;if(isUnhandled(promise)&&(abrupt=perform(function(){isNode?process.emit("unhandledRejection",value,promise):(handler=global.onunhandledrejection)?handler({promise:promise,reason:value}):(console=global.console)&&console.error&&console.error("Unhandled promise rejection",value)}),promise._h=isNode||isUnhandled(promise)?2:1),promise._a=void 0,abrupt)throw abrupt.error})},isUnhandled=function(promise){if(1==promise._h)return!1;for(var reaction,chain=promise._a||promise._c,i=0;chain.length>i;)if(reaction=chain[i++],reaction.fail||!isUnhandled(reaction.promise))return!1;return!0},onHandleUnhandled=function(promise){task.call(global,function(){var handler;isNode?process.emit("rejectionHandled",promise):(handler=global.onrejectionhandled)&&handler({promise:promise,reason:promise._v})})},$reject=function(value){var promise=this;promise._d||(promise._d=!0,promise=promise._w||promise,promise._v=value,promise._s=2,promise._a||(promise._a=promise._c.slice()),notify(promise,!0))},$resolve=function(value){var then,promise=this;if(!promise._d){promise._d=!0,promise=promise._w||promise;try{if(promise===value)throw TypeError("Promise can't be resolved itself");(then=isThenable(value))?microtask(function(){var wrapper={_w:promise,_d:!1};try{then.call(value,ctx($resolve,wrapper,1),ctx($reject,wrapper,1))}catch(e){$reject.call(wrapper,e)}}):(promise._v=value,promise._s=1,notify(promise,!1))}catch(e){$reject.call({_w:promise,_d:!1},e)}}};USE_NATIVE||($Promise=function(executor){anInstance(this,$Promise,PROMISE,"_h"),aFunction(executor),Internal.call(this);try{executor(ctx($resolve,this,1),ctx($reject,this,1))}catch(err){$reject.call(this,err)}},Internal=function(executor){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},Internal.prototype=__webpack_require__(134)($Promise.prototype,{then:function(onFulfilled,onRejected){var reaction=newPromiseCapability(speciesConstructor(this,$Promise));return reaction.ok="function"!=typeof onFulfilled||onFulfilled,reaction.fail="function"==typeof onRejected&&onRejected,reaction.domain=isNode?process.domain:void 0,this._c.push(reaction),this._a&&this._a.push(reaction),this._s&¬ify(this,!1),reaction.promise},catch:function(onRejected){return this.then(void 0,onRejected)}}),PromiseCapability=function(){var promise=new Internal;this.promise=promise,this.resolve=ctx($resolve,promise,1),this.reject=ctx($reject,promise,1)}),$export($export.G+$export.W+$export.F*!USE_NATIVE,{Promise:$Promise}),__webpack_require__(32)($Promise,PROMISE),__webpack_require__(136)(PROMISE),Wrapper=__webpack_require__(2)[PROMISE],$export($export.S+$export.F*!USE_NATIVE,PROMISE,{reject:function(r){var capability=newPromiseCapability(this),$$reject=capability.reject;return $$reject(r),capability.promise}}),$export($export.S+$export.F*(LIBRARY||!USE_NATIVE),PROMISE,{resolve:function(x){if(x instanceof $Promise&&sameConstructor(x.constructor,this))return x;var capability=newPromiseCapability(this),$$resolve=capability.resolve;return $$resolve(x),capability.promise}}),$export($export.S+$export.F*!(USE_NATIVE&&__webpack_require__(127)(function(iter){$Promise.all(iter).catch(empty)})),PROMISE,{all:function(iterable){var C=this,capability=newPromiseCapability(C),resolve=capability.resolve,reject=capability.reject,abrupt=perform(function(){var values=[],index=0,remaining=1;forOf(iterable,!1,function(promise){var $index=index++,alreadyCalled=!1;values.push(void 0),remaining++,C.resolve(promise).then(function(value){alreadyCalled||(alreadyCalled=!0,values[$index]=value,--remaining||resolve(values))},reject)}),--remaining||resolve(values)});return abrupt&&reject(abrupt.error),capability.promise},race:function(iterable){var C=this,capability=newPromiseCapability(C),reject=capability.reject,abrupt=perform(function(){forOf(iterable,!1,function(promise){C.resolve(promise).then(capability.resolve,reject)})});return abrupt&&reject(abrupt.error),capability.promise}})},function(module,exports,__webpack_require__){"use strict";var global=__webpack_require__(4),has=__webpack_require__(11),DESCRIPTORS=__webpack_require__(7),$export=__webpack_require__(8),redefine=__webpack_require__(70),META=__webpack_require__(130).KEY,$fails=__webpack_require__(19),shared=__webpack_require__(45),setToStringTag=__webpack_require__(32),uid=__webpack_require__(34),wks=__webpack_require__(3),wksExt=__webpack_require__(49),wksDefine=__webpack_require__(48),keyOf=__webpack_require__(129),enumKeys=__webpack_require__(120),isArray=__webpack_require__(124),anObject=__webpack_require__(6),toIObject=__webpack_require__(13),toPrimitive=__webpack_require__(47),createDesc=__webpack_require__(31),_create=__webpack_require__(41),gOPNExt=__webpack_require__(66),$GOPD=__webpack_require__(65),$DP=__webpack_require__(9),$keys=__webpack_require__(21),gOPD=$GOPD.f,dP=$DP.f,gOPN=gOPNExt.f,$Symbol=global.Symbol,$JSON=global.JSON,_stringify=$JSON&&$JSON.stringify,PROTOTYPE="prototype",HIDDEN=wks("_hidden"),TO_PRIMITIVE=wks("toPrimitive"),isEnum={}.propertyIsEnumerable,SymbolRegistry=shared("symbol-registry"),AllSymbols=shared("symbols"),OPSymbols=shared("op-symbols"),ObjectProto=Object[PROTOTYPE],USE_NATIVE="function"==typeof $Symbol,QObject=global.QObject,setter=!QObject||!QObject[PROTOTYPE]||!QObject[PROTOTYPE].findChild,setSymbolDesc=DESCRIPTORS&&$fails(function(){return 7!=_create(dP({},"a",{get:function(){return dP(this,"a",{value:7}).a}})).a})?function(it,key,D){var protoDesc=gOPD(ObjectProto,key);protoDesc&&delete ObjectProto[key],dP(it,key,D),protoDesc&&it!==ObjectProto&&dP(ObjectProto,key,protoDesc)}:dP,wrap=function(tag){var sym=AllSymbols[tag]=_create($Symbol[PROTOTYPE]);return sym._k=tag,sym},isSymbol=USE_NATIVE&&"symbol"==typeof $Symbol.iterator?function(it){return"symbol"==typeof it}:function(it){return it instanceof $Symbol},$defineProperty=function(it,key,D){return it===ObjectProto&&$defineProperty(OPSymbols,key,D),anObject(it),key=toPrimitive(key,!0),anObject(D),has(AllSymbols,key)?(D.enumerable?(has(it,HIDDEN)&&it[HIDDEN][key]&&(it[HIDDEN][key]=!1),D=_create(D,{enumerable:createDesc(0,!1)})):(has(it,HIDDEN)||dP(it,HIDDEN,createDesc(1,{})),it[HIDDEN][key]=!0),setSymbolDesc(it,key,D)):dP(it,key,D)},$defineProperties=function(it,P){anObject(it);for(var key,keys=enumKeys(P=toIObject(P)),i=0,l=keys.length;l>i;)$defineProperty(it,key=keys[i++],P[key]);return it},$create=function(it,P){return void 0===P?_create(it):$defineProperties(_create(it),P)},$propertyIsEnumerable=function(key){var E=isEnum.call(this,key=toPrimitive(key,!0));return!(this===ObjectProto&&has(AllSymbols,key)&&!has(OPSymbols,key))&&(!(E||!has(this,key)||!has(AllSymbols,key)||has(this,HIDDEN)&&this[HIDDEN][key])||E)},$getOwnPropertyDescriptor=function(it,key){if(it=toIObject(it),key=toPrimitive(key,!0),it!==ObjectProto||!has(AllSymbols,key)||has(OPSymbols,key)){var D=gOPD(it,key);return!D||!has(AllSymbols,key)||has(it,HIDDEN)&&it[HIDDEN][key]||(D.enumerable=!0),D}},$getOwnPropertyNames=function(it){for(var key,names=gOPN(toIObject(it)),result=[],i=0;names.length>i;)has(AllSymbols,key=names[i++])||key==HIDDEN||key==META||result.push(key);return result},$getOwnPropertySymbols=function(it){for(var key,IS_OP=it===ObjectProto,names=gOPN(IS_OP?OPSymbols:toIObject(it)),result=[],i=0;names.length>i;)!has(AllSymbols,key=names[i++])||IS_OP&&!has(ObjectProto,key)||result.push(AllSymbols[key]);return result};USE_NATIVE||($Symbol=function(){if(this instanceof $Symbol)throw TypeError("Symbol is not a constructor!");var tag=uid(arguments.length>0?arguments[0]:void 0),$set=function(value){this===ObjectProto&&$set.call(OPSymbols,value),has(this,HIDDEN)&&has(this[HIDDEN],tag)&&(this[HIDDEN][tag]=!1),setSymbolDesc(this,tag,createDesc(1,value))};return DESCRIPTORS&&setter&&setSymbolDesc(ObjectProto,tag,{configurable:!0,set:$set}),wrap(tag)},redefine($Symbol[PROTOTYPE],"toString",function(){return this._k}),$GOPD.f=$getOwnPropertyDescriptor,$DP.f=$defineProperty,__webpack_require__(67).f=gOPNExt.f=$getOwnPropertyNames,__webpack_require__(30).f=$propertyIsEnumerable,__webpack_require__(42).f=$getOwnPropertySymbols,DESCRIPTORS&&!__webpack_require__(29)&&redefine(ObjectProto,"propertyIsEnumerable",$propertyIsEnumerable,!0),wksExt.f=function(name){return wrap(wks(name))}),$export($export.G+$export.W+$export.F*!USE_NATIVE,{Symbol:$Symbol});for(var symbols="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),i=0;symbols.length>i;)wks(symbols[i++]);for(var symbols=$keys(wks.store),i=0;symbols.length>i;)wksDefine(symbols[i++]);$export($export.S+$export.F*!USE_NATIVE,"Symbol",{for:function(key){return has(SymbolRegistry,key+="")?SymbolRegistry[key]:SymbolRegistry[key]=$Symbol(key)},keyFor:function(key){if(isSymbol(key))return keyOf(SymbolRegistry,key);throw TypeError(key+" is not a symbol!")},useSetter:function(){setter=!0},useSimple:function(){setter=!1}}),$export($export.S+$export.F*!USE_NATIVE,"Object",{create:$create,defineProperty:$defineProperty,defineProperties:$defineProperties,getOwnPropertyDescriptor:$getOwnPropertyDescriptor,getOwnPropertyNames:$getOwnPropertyNames,getOwnPropertySymbols:$getOwnPropertySymbols}),$JSON&&$export($export.S+$export.F*(!USE_NATIVE||$fails(function(){var S=$Symbol();return"[null]"!=_stringify([S])||"{}"!=_stringify({a:S})||"{}"!=_stringify(Object(S))})),"JSON",{stringify:function(it){if(void 0!==it&&!isSymbol(it)){for(var replacer,$replacer,args=[it],i=1;arguments.length>i;)args.push(arguments[i++]);return replacer=args[1],"function"==typeof replacer&&($replacer=replacer),!$replacer&&isArray(replacer)||(replacer=function(key,value){if($replacer&&(value=$replacer.call(this,key,value)),!isSymbol(value))return value}),args[1]=replacer,_stringify.apply($JSON,args)}}}),$Symbol[PROTOTYPE][TO_PRIMITIVE]||__webpack_require__(12)($Symbol[PROTOTYPE],TO_PRIMITIVE,$Symbol[PROTOTYPE].valueOf),setToStringTag($Symbol,"Symbol"),setToStringTag(Math,"Math",!0),setToStringTag(global.JSON,"JSON",!0)},function(module,exports,__webpack_require__){__webpack_require__(48)("asyncIterator")},function(module,exports,__webpack_require__){__webpack_require__(48)("observable")},function(module,exports,__webpack_require__){(function(global,setImmediate){!function(global,factory){module.exports=factory()}(this,function(){"use strict";function extend(obj,extension){return"object"!=typeof extension?obj:(keys(extension).forEach(function(key){obj[key]=extension[key]}),obj)}function hasOwn(obj,prop){return _hasOwn.call(obj,prop)}function props(proto,extension){"function"==typeof extension&&(extension=extension(getProto(proto))),keys(extension).forEach(function(key){setProp(proto,key,extension[key])})}function setProp(obj,prop,functionOrGetSet,options){Object.defineProperty(obj,prop,extend(functionOrGetSet&&hasOwn(functionOrGetSet,"get")&&"function"==typeof functionOrGetSet.get?{get:functionOrGetSet.get,set:functionOrGetSet.set,configurable:!0}:{value:functionOrGetSet,configurable:!0,writable:!0},options))}function derive(Child){return{from:function(Parent){return Child.prototype=Object.create(Parent.prototype),setProp(Child.prototype,"constructor",Child),{extend:props.bind(null,Child.prototype)}}}}function getPropertyDescriptor(obj,prop){var proto,pd=getOwnPropertyDescriptor(obj,prop);return pd||(proto=getProto(obj))&&getPropertyDescriptor(proto,prop)}function slice(args,start,end){return _slice.call(args,start,end)}function override(origFunc,overridedFactory){return overridedFactory(origFunc)}function doFakeAutoComplete(fn){var to=setTimeout(fn,1e3);clearTimeout(to)}function assert(b){if(!b)throw new Error("Assertion Failed")}function asap(fn){_global.setImmediate?setImmediate(fn):setTimeout(fn,0)}function arrayToObject(array,extractor){return array.reduce(function(result,item,i){var nameAndValue=extractor(item,i);return nameAndValue&&(result[nameAndValue[0]]=nameAndValue[1]),result},{})}function trycatcher(fn,reject){return function(){try{fn.apply(this,arguments)}catch(e){reject(e)}}}function tryCatch(fn,onerror,args){try{fn.apply(null,args)}catch(ex){onerror&&onerror(ex)}}function getByKeyPath(obj,keyPath){if(hasOwn(obj,keyPath))return obj[keyPath];if(!keyPath)return obj;if("string"!=typeof keyPath){for(var rv=[],i=0,l=keyPath.length;i<l;++i){var val=getByKeyPath(obj,keyPath[i]);rv.push(val)}return rv}var period=keyPath.indexOf(".");if(period!==-1){var innerObj=obj[keyPath.substr(0,period)];return void 0===innerObj?void 0:getByKeyPath(innerObj,keyPath.substr(period+1))}}function setByKeyPath(obj,keyPath,value){if(obj&&void 0!==keyPath&&!("isFrozen"in Object&&Object.isFrozen(obj)))if("string"!=typeof keyPath&&"length"in keyPath){assert("string"!=typeof value&&"length"in value);for(var i=0,l=keyPath.length;i<l;++i)setByKeyPath(obj,keyPath[i],value[i])}else{var period=keyPath.indexOf(".");if(period!==-1){var currentKeyPath=keyPath.substr(0,period),remainingKeyPath=keyPath.substr(period+1);if(""===remainingKeyPath)void 0===value?delete obj[currentKeyPath]:obj[currentKeyPath]=value;else{var innerObj=obj[currentKeyPath];innerObj||(innerObj=obj[currentKeyPath]={}),setByKeyPath(innerObj,remainingKeyPath,value)}}else void 0===value?delete obj[keyPath]:obj[keyPath]=value}}function delByKeyPath(obj,keyPath){"string"==typeof keyPath?setByKeyPath(obj,keyPath,void 0):"length"in keyPath&&[].map.call(keyPath,function(kp){setByKeyPath(obj,kp,void 0)})}function shallowClone(obj){var rv={};for(var m in obj)hasOwn(obj,m)&&(rv[m]=obj[m]);return rv}function deepClone(any){if(!any||"object"!=typeof any)return any;var rv;if(isArray(any)){rv=[];for(var i=0,l=any.length;i<l;++i)rv.push(deepClone(any[i]))}else if(any instanceof Date)rv=new Date,rv.setTime(any.getTime());else{rv=any.constructor?Object.create(any.constructor.prototype):{};for(var prop in any)hasOwn(any,prop)&&(rv[prop]=deepClone(any[prop]))}return rv}function getObjectDiff(a,b,rv,prfx){return rv=rv||{},prfx=prfx||"",keys(a).forEach(function(prop){if(hasOwn(b,prop)){var ap=a[prop],bp=b[prop];"object"==typeof ap&&"object"==typeof bp&&ap&&bp&&ap.constructor===bp.constructor?getObjectDiff(ap,bp,rv,prfx+prop+"."):ap!==bp&&(rv[prfx+prop]=b[prop])}else rv[prfx+prop]=void 0}),keys(b).forEach(function(prop){hasOwn(a,prop)||(rv[prfx+prop]=b[prop])}),rv}function getArrayOf(arrayLike){var i,a,x,it;if(1===arguments.length){if(isArray(arrayLike))return arrayLike.slice();if(this===NO_CHAR_ARRAY&&"string"==typeof arrayLike)return[arrayLike];if(it=getIteratorOf(arrayLike)){for(a=[];x=it.next(),!x.done;)a.push(x.value);return a}if(null==arrayLike)return[arrayLike];if(i=arrayLike.length,"number"==typeof i){for(a=new Array(i);i--;)a[i]=arrayLike[i];return a}return[arrayLike]}for(i=arguments.length,a=new Array(i);i--;)a[i]=arguments[i];return a}function flatten(a){return concat.apply([],a)}function nop(){}function mirror(val){return val}function pureFunctionChain(f1,f2){return null==f1||f1===mirror?f2:function(val){return f2(f1(val))}}function callBoth(on1,on2){return function(){on1.apply(this,arguments),on2.apply(this,arguments)}}function hookCreatingChain(f1,f2){return f1===nop?f2:function(){var res=f1.apply(this,arguments);void 0!==res&&(arguments[0]=res);var onsuccess=this.onsuccess,onerror=this.onerror;this.onsuccess=null,this.onerror=null;var res2=f2.apply(this,arguments);return onsuccess&&(this.onsuccess=this.onsuccess?callBoth(onsuccess,this.onsuccess):onsuccess),onerror&&(this.onerror=this.onerror?callBoth(onerror,this.onerror):onerror),void 0!==res2?res2:res}}function hookDeletingChain(f1,f2){return f1===nop?f2:function(){f1.apply(this,arguments);var onsuccess=this.onsuccess,onerror=this.onerror;this.onsuccess=this.onerror=null,f2.apply(this,arguments),onsuccess&&(this.onsuccess=this.onsuccess?callBoth(onsuccess,this.onsuccess):onsuccess),onerror&&(this.onerror=this.onerror?callBoth(onerror,this.onerror):onerror)}}function hookUpdatingChain(f1,f2){return f1===nop?f2:function(modifications){var res=f1.apply(this,arguments);extend(modifications,res);var onsuccess=this.onsuccess,onerror=this.onerror;this.onsuccess=null,this.onerror=null;var res2=f2.apply(this,arguments);return onsuccess&&(this.onsuccess=this.onsuccess?callBoth(onsuccess,this.onsuccess):onsuccess),onerror&&(this.onerror=this.onerror?callBoth(onerror,this.onerror):onerror),void 0===res?void 0===res2?void 0:res2:extend(res,res2)}}function reverseStoppableEventChain(f1,f2){return f1===nop?f2:function(){return f2.apply(this,arguments)!==!1&&f1.apply(this,arguments)}}function promisableChain(f1,f2){return f1===nop?f2:function(){var res=f1.apply(this,arguments);if(res&&"function"==typeof res.then){for(var thiz=this,i=arguments.length,args=new Array(i);i--;)args[i]=arguments[i];return res.then(function(){return f2.apply(thiz,args)})}return f2.apply(this,arguments)}}function setDebug(value,filter){debug=value,libraryFilter=filter}function getErrorWithStack(){if(NEEDS_THROW_FOR_STACK)try{throw getErrorWithStack.arguments,new Error}catch(e){return e}return new Error}function prettyStack(exception,numIgnoredFrames){var stack=exception.stack;return stack?(numIgnoredFrames=numIgnoredFrames||0,0===stack.indexOf(exception.name)&&(numIgnoredFrames+=(exception.name+exception.message).split("\n").length),stack.split("\n").slice(numIgnoredFrames).filter(libraryFilter).map(function(frame){return"\n"+frame}).join("")):""}function deprecated(what,fn){return function(){return console.warn(what+" is deprecated. See https://github.com/dfahlander/Dexie.js/wiki/Deprecations. "+prettyStack(getErrorWithStack(),1)),fn.apply(this,arguments)}}function DexieError(name,msg){this._e=getErrorWithStack(),this.name=name,this.message=msg}function getMultiErrorMessage(msg,failures){return msg+". Errors: "+failures.map(function(f){return f.toString()}).filter(function(v,i,s){return s.indexOf(v)===i}).join("\n")}function ModifyError(msg,failures,successCount,failedKeys){this._e=getErrorWithStack(),this.failures=failures,this.failedKeys=failedKeys,this.successCount=successCount}function BulkError(msg,failures){this._e=getErrorWithStack(),this.name="BulkError",this.failures=failures,this.message=getMultiErrorMessage(msg,failures)}function mapError(domError,message){if(!domError||domError instanceof DexieError||domError instanceof TypeError||domError instanceof SyntaxError||!domError.name||!exceptionMap[domError.name])return domError;var rv=new exceptionMap[domError.name](message||domError.message,domError);return"stack"in domError&&setProp(rv,"stack",{get:function(){return this.inner.stack}}),rv}function Events(ctx){function add(eventName,chainFunction,defaultFunction){if("object"==typeof eventName)return addConfiguredEvents(eventName);chainFunction||(chainFunction=reverseStoppableEventChain),defaultFunction||(defaultFunction=nop);var context={subscribers:[],fire:defaultFunction,subscribe:function(cb){context.subscribers.indexOf(cb)===-1&&(context.subscribers.push(cb),context.fire=chainFunction(context.fire,cb))},unsubscribe:function(cb){context.subscribers=context.subscribers.filter(function(fn){return fn!==cb}),context.fire=context.subscribers.reduce(chainFunction,defaultFunction)}};return evs[eventName]=rv[eventName]=context,context}function addConfiguredEvents(cfg){keys(cfg).forEach(function(eventName){var args=cfg[eventName];if(isArray(args))add(eventName,cfg[eventName][0],cfg[eventName][1]);else{if("asap"!==args)throw new exceptions.InvalidArgument("Invalid event config");var context=add(eventName,mirror,function(){for(var i=arguments.length,args=new Array(i);i--;)args[i]=arguments[i];context.subscribers.forEach(function(fn){asap(function(){fn.apply(null,args)})})})}})}var evs={},rv=function(eventName,subscriber){if(subscriber){for(var i=arguments.length,args=new Array(i-1);--i;)args[i-1]=arguments[i];return evs[eventName].subscribe.apply(null,args),ctx}if("string"==typeof eventName)return evs[eventName]};rv.addEventType=add;for(var i=1,l=arguments.length;i<l;++i)add(arguments[i]);return rv}function Promise(fn){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=nop,this._lib=!1;var psd=this._PSD=PSD;if(debug&&(this._stackHolder=getErrorWithStack(),this._prev=null,this._numPrev=0,linkToPreviousPromise(this,currentFulfiller)),"function"!=typeof fn){if(fn!==INTERNAL)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&handleRejection(this,this._value))}this._state=null,this._value=null,++psd.ref,executePromiseTask(this,fn)}function Listener(onFulfilled,onRejected,resolve,reject){this.onFulfilled="function"==typeof onFulfilled?onFulfilled:null,this.onRejected="function"==typeof onRejected?onRejected:null,this.resolve=resolve,this.reject=reject,this.psd=PSD}function executePromiseTask(promise,fn){try{fn(function(value){if(null===promise._state){if(value===promise)throw new TypeError("A promise cannot be resolved with itself.");var shouldExecuteTick=promise._lib&&beginMicroTickScope();value&&"function"==typeof value.then?executePromiseTask(promise,function(resolve,reject){value instanceof Promise?value._then(resolve,reject):value.then(resolve,reject)}):(promise._state=!0,promise._value=value,propagateAllListeners(promise)),shouldExecuteTick&&endMicroTickScope()}},handleRejection.bind(null,promise))}catch(ex){handleRejection(promise,ex)}}function handleRejection(promise,reason){if(rejectingErrors.push(reason),null===promise._state){var shouldExecuteTick=promise._lib&&beginMicroTickScope();reason=rejectionMapper(reason),promise._state=!1,promise._value=reason,debug&&null!==reason&&"object"==typeof reason&&!reason._promise&&tryCatch(function(){var origProp=getPropertyDescriptor(reason,"stack");reason._promise=promise,setProp(reason,"stack",{get:function(){return stack_being_generated?origProp&&(origProp.get?origProp.get.apply(reason):origProp.value):promise.stack}})}),addPossiblyUnhandledError(promise),propagateAllListeners(promise),shouldExecuteTick&&endMicroTickScope()}}function propagateAllListeners(promise){var listeners=promise._listeners;promise._listeners=[];for(var i=0,len=listeners.length;i<len;++i)propagateToListener(promise,listeners[i]);var psd=promise._PSD;--psd.ref||psd.finalize(),0===numScheduledCalls&&(++numScheduledCalls,asap$1(function(){0===--numScheduledCalls&&finalizePhysicalTick()},[]))}function propagateToListener(promise,listener){if(null===promise._state)return void promise._listeners.push(listener);var cb=promise._state?listener.onFulfilled:listener.onRejected;if(null===cb)return(promise._state?listener.resolve:listener.reject)(promise._value);var psd=listener.psd;++psd.ref,++numScheduledCalls,asap$1(callListener,[cb,promise,listener])}function callListener(cb,promise,listener){var outerScope=PSD,psd=listener.psd;try{psd!==outerScope&&(PSD=psd),currentFulfiller=promise;var ret,value=promise._value;promise._state?ret=cb(value):(rejectingErrors.length&&(rejectingErrors=[]),ret=cb(value),rejectingErrors.indexOf(value)===-1&&markErrorAsHandled(promise)),listener.resolve(ret)}catch(e){listener.reject(e)}finally{psd!==outerScope&&(PSD=outerScope),currentFulfiller=null,0===--numScheduledCalls&&finalizePhysicalTick(),--psd.ref||psd.finalize()}}function getStack(promise,stacks,limit){if(stacks.length===limit)return stacks;var stack="";if(promise._state===!1){var errorName,message,failure=promise._value;null!=failure?(errorName=failure.name||"Error",message=failure.message||failure,stack=prettyStack(failure,0)):(errorName=failure,message=""),stacks.push(errorName+(message?": "+message:"")+stack)}return debug&&(stack=prettyStack(promise._stackHolder,2),stack&&stacks.indexOf(stack)===-1&&stacks.push(stack),promise._prev&&getStack(promise._prev,stacks,limit)),stacks}function linkToPreviousPromise(promise,prev){var numPrev=prev?prev._numPrev+1:0;numPrev<LONG_STACKS_CLIP_LIMIT&&(promise._prev=prev,promise._numPrev=numPrev)}function physicalTick(){beginMicroTickScope()&&endMicroTickScope()}function beginMicroTickScope(){var wasRootExec=isOutsideMicroTick;return isOutsideMicroTick=!1,needsNewPhysicalTick=!1,wasRootExec}function endMicroTickScope(){var callbacks,i,l;do for(;microtickQueue.length>0;)for(callbacks=microtickQueue,microtickQueue=[],l=callbacks.length,i=0;i<l;++i){var item=callbacks[i];item[0].apply(null,item[1])}while(microtickQueue.length>0);isOutsideMicroTick=!0,needsNewPhysicalTick=!0}function finalizePhysicalTick(){var unhandledErrs=unhandledErrors;unhandledErrors=[],unhandledErrs.forEach(function(p){p._PSD.onunhandled.call(null,p._value,p)});for(var finalizers=tickFinalizers.slice(0),i=finalizers.length;i;)finalizers[--i]()}function run_at_end_of_this_or_next_physical_tick(fn){function finalizer(){fn(),tickFinalizers.splice(tickFinalizers.indexOf(finalizer),1)}tickFinalizers.push(finalizer),++numScheduledCalls,asap$1(function(){0===--numScheduledCalls&&finalizePhysicalTick()},[])}function addPossiblyUnhandledError(promise){unhandledErrors.some(function(p){return p._value===promise._value})||unhandledErrors.push(promise)}function markErrorAsHandled(promise){for(var i=unhandledErrors.length;i;)if(unhandledErrors[--i]._value===promise._value)return void unhandledErrors.splice(i,1)}function defaultErrorHandler(e){console.warn("Unhandled rejection: "+(e.stack||e))}function PromiseReject(reason){return new Promise(INTERNAL,!1,reason)}function wrap(fn,errorCatcher){var psd=PSD;return function(){var wasRootExec=beginMicroTickScope(),outerScope=PSD;try{return outerScope!==psd&&(PSD=psd),fn.apply(this,arguments)}catch(e){errorCatcher&&errorCatcher(e)}finally{outerScope!==psd&&(PSD=outerScope),wasRootExec&&endMicroTickScope()}}}function newScope(fn,a1,a2,a3){var parent=PSD,psd=Object.create(parent);psd.parent=parent,psd.ref=0,psd.global=!1,++parent.ref,psd.finalize=function(){--this.parent.ref||this.parent.finalize()};var rv=usePSD(psd,fn,a1,a2,a3);return 0===psd.ref&&psd.finalize(),rv}function usePSD(psd,fn,a1,a2,a3){var outerScope=PSD;try{return psd!==outerScope&&(PSD=psd),fn(a1,a2,a3)}finally{psd!==outerScope&&(PSD=outerScope)}}function globalError(err,promise){var rv;try{rv=promise.onuncatched(err)}catch(e){}if(rv!==!1)try{var event,eventData={promise:promise,reason:err};if(_global.document&&document.createEvent?(event=document.createEvent("Event"),event.initEvent(UNHANDLEDREJECTION,!0,!0),extend(event,eventData)):_global.CustomEvent&&(event=new CustomEvent(UNHANDLEDREJECTION,{detail:eventData}),extend(event,eventData)),event&&_global.dispatchEvent&&(dispatchEvent(event),!_global.PromiseRejectionEvent&&_global.onunhandledrejection))try{_global.onunhandledrejection(event)}catch(_){}event.defaultPrevented||Promise.on.error.fire(err,promise)}catch(e){}}function rejection(err,uncaughtHandler){var rv=Promise.reject(err);return uncaughtHandler?rv.uncaught(uncaughtHandler):rv}function Dexie(dbName,options){function init(){db.on("versionchange",function(ev){ev.newVersion>0?console.warn("Another connection wants to upgrade database '"+db.name+"'. Closing db now to resume the upgrade."):console.warn("Another connection wants to delete database '"+db.name+"'. Closing db now to resume the delete request."),db.close()}),db.on("blocked",function(ev){!ev.newVersion||ev.newVersion<ev.oldVersion?console.warn("Dexie.delete('"+db.name+"') was blocked"):console.warn("Upgrade '"+db.name+"' blocked by other connection holding version "+ev.oldVersion/10)})}function Version(versionNumber){this._cfg={version:versionNumber,storesSource:null,dbschema:{},tables:{},contentUpgrade:null},this.stores({})}function runUpgraders(oldVersion,idbtrans,reject){var trans=db._createTransaction(READWRITE,dbStoreNames,globalSchema);trans.create(idbtrans),trans._completion.catch(reject);var rejectTransaction=trans._reject.bind(trans);newScope(function(){PSD.trans=trans,0===oldVersion?(keys(globalSchema).forEach(function(tableName){createTable(idbtrans,tableName,globalSchema[tableName].primKey,globalSchema[tableName].indexes)}),Promise.follow(function(){return db.on.populate.fire(trans)}).catch(rejectTransaction)):updateTablesAndIndexes(oldVersion,trans,idbtrans).catch(rejectTransaction)})}function updateTablesAndIndexes(oldVersion,trans,idbtrans){function runQueue(){return queue.length?Promise.resolve(queue.shift()(trans.idbtrans)).then(runQueue):Promise.resolve()}var queue=[],oldVersionStruct=versions.filter(function(version){return version._cfg.version===oldVersion})[0];if(!oldVersionStruct)throw new exceptions.Upgrade("Dexie specification of currently installed DB version is missing");globalSchema=db._dbSchema=oldVersionStruct._cfg.dbschema;var anyContentUpgraderHasRun=!1,versToRun=versions.filter(function(v){return v._cfg.version>oldVersion});return versToRun.forEach(function(version){queue.push(function(){var oldSchema=globalSchema,newSchema=version._cfg.dbschema;adjustToExistingIndexNames(oldSchema,idbtrans),adjustToExistingIndexNames(newSchema,idbtrans),globalSchema=db._dbSchema=newSchema;var diff=getSchemaDiff(oldSchema,newSchema);if(diff.add.forEach(function(tuple){createTable(idbtrans,tuple[0],tuple[1].primKey,tuple[1].indexes)}),diff.change.forEach(function(change){if(change.recreate)throw new exceptions.Upgrade("Not yet support for changing primary key");var store=idbtrans.objectStore(change.name);change.add.forEach(function(idx){addIndex(store,idx)}),change.change.forEach(function(idx){store.deleteIndex(idx.name),addIndex(store,idx)}),change.del.forEach(function(idxName){store.deleteIndex(idxName)})}),version._cfg.contentUpgrade)return anyContentUpgraderHasRun=!0,Promise.follow(function(){version._cfg.contentUpgrade(trans)})}),queue.push(function(idbtrans){if(!anyContentUpgraderHasRun||!hasIEDeleteObjectStoreBug){var newSchema=version._cfg.dbschema;deleteRemovedTables(newSchema,idbtrans)}})}),runQueue().then(function(){createMissingTables(globalSchema,idbtrans)})}function getSchemaDiff(oldSchema,newSchema){var diff={del:[],add:[],change:[]};for(var table in oldSchema)newSchema[table]||diff.del.push(table);for(table in newSchema){var oldDef=oldSchema[table],newDef=newSchema[table];if(oldDef){var change={name:table,def:newDef,recreate:!1,del:[],add:[],change:[]};if(oldDef.primKey.src!==newDef.primKey.src)change.recreate=!0,diff.change.push(change);else{var oldIndexes=oldDef.idxByName,newIndexes=newDef.idxByName;for(var idxName in oldIndexes)newIndexes[idxName]||change.del.push(idxName);for(idxName in newIndexes){var oldIdx=oldIndexes[idxName],newIdx=newIndexes[idxName];oldIdx?oldIdx.src!==newIdx.src&&change.change.push(newIdx):change.add.push(newIdx)}(change.del.length>0||change.add.length>0||change.change.length>0)&&diff.change.push(change)}}else diff.add.push([table,newDef])}return diff}function createTable(idbtrans,tableName,primKey,indexes){var store=idbtrans.db.createObjectStore(tableName,primKey.keyPath?{keyPath:primKey.keyPath,autoIncrement:primKey.auto}:{autoIncrement:primKey.auto});return indexes.forEach(function(idx){addIndex(store,idx)}),store}function createMissingTables(newSchema,idbtrans){keys(newSchema).forEach(function(tableName){idbtrans.db.objectStoreNames.contains(tableName)||createTable(idbtrans,tableName,newSchema[tableName].primKey,newSchema[tableName].indexes);
|
||
})}function deleteRemovedTables(newSchema,idbtrans){for(var i=0;i<idbtrans.db.objectStoreNames.length;++i){var storeName=idbtrans.db.objectStoreNames[i];null==newSchema[storeName]&&idbtrans.db.deleteObjectStore(storeName)}}function addIndex(store,idx){store.createIndex(idx.name,idx.keyPath,{unique:idx.unique,multiEntry:idx.multi})}function dbUncaught(err){return db.on.error.fire(err)}function tempTransaction(mode,storeNames,fn){if(openComplete||PSD.letThrough){var trans=db._createTransaction(mode,storeNames,globalSchema);return trans._promise(mode,function(resolve,reject){newScope(function(){PSD.trans=trans,fn(resolve,reject,trans)})}).then(function(result){return trans._completion.then(function(){return result})})}if(!isBeingOpened){if(!autoOpen)return rejection(new exceptions.DatabaseClosed,dbUncaught);db.open().catch(nop)}return dbReadyPromise.then(function(){return tempTransaction(mode,storeNames,fn)})}function Table(name,tableSchema,collClass){this.name=name,this.schema=tableSchema,this.hook=allTables[name]?allTables[name].hook:Events(null,{creating:[hookCreatingChain,nop],reading:[pureFunctionChain,mirror],updating:[hookUpdatingChain,nop],deleting:[hookDeletingChain,nop]}),this._collClass=collClass||Collection}function WriteableTable(name,tableSchema,collClass){Table.call(this,name,tableSchema,collClass||WriteableCollection)}function BulkErrorHandlerCatchAll(errorList,done,supportHooks){return(supportHooks?hookedEventRejectHandler:eventRejectHandler)(function(e){errorList.push(e),done&&done()})}function bulkDelete(idbstore,trans,keysOrTuples,hasDeleteHook,deletingHook){return new Promise(function(resolve,reject){var len=keysOrTuples.length,lastItem=len-1;if(0===len)return resolve();if(hasDeleteHook){var hookCtx,errorHandler=hookedEventRejectHandler(reject),successHandler=hookedEventSuccessHandler(null);tryCatch(function(){for(var i=0;i<len;++i){hookCtx={onsuccess:null,onerror:null};var tuple=keysOrTuples[i];deletingHook.call(hookCtx,tuple[0],tuple[1],trans);var req=idbstore.delete(tuple[0]);req._hookCtx=hookCtx,req.onerror=errorHandler,i===lastItem?req.onsuccess=hookedEventSuccessHandler(resolve):req.onsuccess=successHandler}},function(err){throw hookCtx.onerror&&hookCtx.onerror(err),err})}else for(var i=0;i<len;++i){var req=idbstore.delete(keysOrTuples[i]);req.onerror=wrap(eventRejectHandler(reject)),i===lastItem&&(req.onsuccess=wrap(function(){return resolve()}))}}).uncaught(dbUncaught)}function Transaction(mode,storeNames,dbschema,parent){var _this2=this;this.db=db,this.mode=mode,this.storeNames=storeNames,this.idbtrans=null,this.on=Events(this,"complete","error","abort"),this.parent=parent||null,this.active=!0,this._tables=null,this._reculock=0,this._blockedFuncs=[],this._psd=null,this._dbschema=dbschema,this._resolve=null,this._reject=null,this._completion=new Promise(function(resolve,reject){_this2._resolve=resolve,_this2._reject=reject}).uncaught(dbUncaught),this._completion.then(function(){_this2.on.complete.fire()},function(e){return _this2.on.error.fire(e),_this2.parent?_this2.parent._reject(e):_this2.active&&_this2.idbtrans&&_this2.idbtrans.abort(),_this2.active=!1,rejection(e)})}function WhereClause(table,index,orCollection){this._ctx={table:table,index:":id"===index?null:index,collClass:table._collClass,or:orCollection}}function Collection(whereClause,keyRangeGenerator){var keyRange=null,error=null;if(keyRangeGenerator)try{keyRange=keyRangeGenerator()}catch(ex){error=ex}var whereCtx=whereClause._ctx,table=whereCtx.table;this._ctx={table:table,index:whereCtx.index,isPrimKey:!whereCtx.index||table.schema.primKey.keyPath&&whereCtx.index===table.schema.primKey.name,range:keyRange,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:error,or:whereCtx.or,valueMapper:table.hook.reading.fire}}function isPlainKeyRange(ctx,ignoreLimitFilter){return!(ctx.filter||ctx.algorithm||ctx.or)&&(ignoreLimitFilter?ctx.justLimit:!ctx.replayFilter)}function WriteableCollection(){Collection.apply(this,arguments)}function lowerVersionFirst(a,b){return a._cfg.version-b._cfg.version}function setApiOnPlace(objs,tableNames,mode,dbschema){tableNames.forEach(function(tableName){var tableInstance=db._tableFactory(mode,dbschema[tableName]);objs.forEach(function(obj){tableName in obj||(obj[tableName]=tableInstance)})})}function removeTablesApi(objs){objs.forEach(function(obj){for(var key in obj)obj[key]instanceof Table&&delete obj[key]})}function iterate(req,filter,fn,resolve,reject,valueMapper){var mappedFn=valueMapper?function(x,c,a){return fn(valueMapper(x),c,a)}:fn,wrappedFn=wrap(mappedFn,reject);req.onerror||(req.onerror=eventRejectHandler(reject)),filter?req.onsuccess=trycatcher(function(){var cursor=req.result;if(cursor){var c=function(){cursor.continue()};filter(cursor,function(advancer){c=advancer},resolve,reject)&&wrappedFn(cursor.value,cursor,function(advancer){c=advancer}),c()}else resolve()},reject):req.onsuccess=trycatcher(function(){var cursor=req.result;if(cursor){var c=function(){cursor.continue()};wrappedFn(cursor.value,cursor,function(advancer){c=advancer}),c()}else resolve()},reject)}function parseIndexSyntax(indexes){var rv=[];return indexes.split(",").forEach(function(index){index=index.trim();var name=index.replace(/([&*]|\+\+)/g,""),keyPath=/^\[/.test(name)?name.match(/^\[(.*)\]$/)[1].split("+"):name;rv.push(new IndexSpec(name,keyPath||null,/\&/.test(index),/\*/.test(index),/\+\+/.test(index),isArray(keyPath),/\./.test(index)))}),rv}function cmp(key1,key2){return indexedDB.cmp(key1,key2)}function min(a,b){return cmp(a,b)<0?a:b}function max(a,b){return cmp(a,b)>0?a:b}function ascending(a,b){return indexedDB.cmp(a,b)}function descending(a,b){return indexedDB.cmp(b,a)}function simpleCompare(a,b){return a<b?-1:a===b?0:1}function simpleCompareReverse(a,b){return a>b?-1:a===b?0:1}function combine(filter1,filter2){return filter1?filter2?function(){return filter1.apply(this,arguments)&&filter2.apply(this,arguments)}:filter1:filter2}function readGlobalSchema(){if(db.verno=idbdb.version/10,db._dbSchema=globalSchema={},dbStoreNames=slice(idbdb.objectStoreNames,0),0!==dbStoreNames.length){var trans=idbdb.transaction(safariMultiStoreFix(dbStoreNames),"readonly");dbStoreNames.forEach(function(storeName){for(var store=trans.objectStore(storeName),keyPath=store.keyPath,dotted=keyPath&&"string"==typeof keyPath&&keyPath.indexOf(".")!==-1,primKey=new IndexSpec(keyPath,keyPath||"",!1,!1,!!store.autoIncrement,keyPath&&"string"!=typeof keyPath,dotted),indexes=[],j=0;j<store.indexNames.length;++j){var idbindex=store.index(store.indexNames[j]);keyPath=idbindex.keyPath,dotted=keyPath&&"string"==typeof keyPath&&keyPath.indexOf(".")!==-1;var index=new IndexSpec(idbindex.name,keyPath,!!idbindex.unique,!!idbindex.multiEntry,!1,keyPath&&"string"!=typeof keyPath,dotted);indexes.push(index)}globalSchema[storeName]=new TableSchema(storeName,primKey,indexes,{})}),setApiOnPlace([allTables,Transaction.prototype],keys(globalSchema),READWRITE,globalSchema)}}function adjustToExistingIndexNames(schema,idbtrans){for(var storeNames=idbtrans.db.objectStoreNames,i=0;i<storeNames.length;++i){var storeName=storeNames[i],store=idbtrans.objectStore(storeName);hasGetAll="getAll"in store;for(var j=0;j<store.indexNames.length;++j){var indexName=store.indexNames[j],keyPath=store.index(indexName).keyPath,dexieName="string"==typeof keyPath?keyPath:"["+slice(keyPath).join("+")+"]";if(schema[storeName]){var indexSpec=schema[storeName].idxByName[dexieName];indexSpec&&(indexSpec.name=indexName)}}}}function fireOnBlocked(ev){db.on("blocked").fire(ev),connections.filter(function(c){return c.name===db.name&&c!==db&&!c._vcFired}).map(function(c){return c.on("versionchange").fire(ev)})}var dbReadyResolve,cancelOpen,hasGetAll,deps=Dexie.dependencies,opts=extend({addons:Dexie.addons,autoOpen:!0,indexedDB:deps.indexedDB,IDBKeyRange:deps.IDBKeyRange},options),addons=opts.addons,autoOpen=opts.autoOpen,indexedDB=opts.indexedDB,IDBKeyRange=opts.IDBKeyRange,globalSchema=this._dbSchema={},versions=[],dbStoreNames=[],allTables={},idbdb=null,dbOpenError=null,isBeingOpened=!1,openComplete=!1,READONLY="readonly",READWRITE="readwrite",db=this,dbReadyPromise=new Promise(function(resolve){dbReadyResolve=resolve}),openCanceller=new Promise(function(_,reject){cancelOpen=reject}),autoSchema=!0,hasNativeGetDatabaseNames=!!getNativeGetDatabaseNamesFn(indexedDB);this.version=function(versionNumber){if(idbdb||isBeingOpened)throw new exceptions.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,versionNumber);var versionInstance=versions.filter(function(v){return v._cfg.version===versionNumber})[0];return versionInstance?versionInstance:(versionInstance=new Version(versionNumber),versions.push(versionInstance),versions.sort(lowerVersionFirst),versionInstance)},extend(Version.prototype,{stores:function(stores){this._cfg.storesSource=this._cfg.storesSource?extend(this._cfg.storesSource,stores):stores;var storesSpec={};versions.forEach(function(version){extend(storesSpec,version._cfg.storesSource)});var dbschema=this._cfg.dbschema={};return this._parseStoresSpec(storesSpec,dbschema),globalSchema=db._dbSchema=dbschema,removeTablesApi([allTables,db,Transaction.prototype]),setApiOnPlace([allTables,db,Transaction.prototype,this._cfg.tables],keys(dbschema),READWRITE,dbschema),dbStoreNames=keys(dbschema),this},upgrade:function(upgradeFunction){var self=this;return fakeAutoComplete(function(){upgradeFunction(db._createTransaction(READWRITE,keys(self._cfg.dbschema),self._cfg.dbschema))}),this._cfg.contentUpgrade=upgradeFunction,this},_parseStoresSpec:function(stores,outSchema){keys(stores).forEach(function(tableName){if(null!==stores[tableName]){var instanceTemplate={},indexes=parseIndexSyntax(stores[tableName]),primKey=indexes.shift();if(primKey.multi)throw new exceptions.Schema("Primary key cannot be multi-valued");primKey.keyPath&&setByKeyPath(instanceTemplate,primKey.keyPath,primKey.auto?0:primKey.keyPath),indexes.forEach(function(idx){if(idx.auto)throw new exceptions.Schema("Only primary key can be marked as autoIncrement (++)");if(!idx.keyPath)throw new exceptions.Schema("Index must have a name and cannot be an empty string");setByKeyPath(instanceTemplate,idx.keyPath,idx.compound?idx.keyPath.map(function(){return""}):"")}),outSchema[tableName]=new TableSchema(tableName,primKey,indexes,instanceTemplate)}})}}),this._allTables=allTables,this._tableFactory=function(mode,tableSchema){return mode===READONLY?new Table(tableSchema.name,tableSchema,Collection):new WriteableTable(tableSchema.name,tableSchema)},this._createTransaction=function(mode,storeNames,dbschema,parentTransaction){return new Transaction(mode,storeNames,dbschema,parentTransaction)},this._whenReady=function(fn){return new Promise(fake||openComplete||PSD.letThrough?fn:function(resolve,reject){if(!isBeingOpened){if(!autoOpen)return void reject(new exceptions.DatabaseClosed);db.open().catch(nop)}dbReadyPromise.then(function(){fn(resolve,reject)})}).uncaught(dbUncaught)},this.verno=0,this.open=function(){if(isBeingOpened||idbdb)return dbReadyPromise.then(function(){return dbOpenError?rejection(dbOpenError,dbUncaught):db});debug&&(openCanceller._stackHolder=getErrorWithStack()),isBeingOpened=!0,dbOpenError=null,openComplete=!1;var resolveDbReady=dbReadyResolve,upgradeTransaction=null;return Promise.race([openCanceller,new Promise(function(resolve,reject){if(doFakeAutoComplete(function(){return resolve()}),versions.length>0&&(autoSchema=!1),!indexedDB)throw new exceptions.MissingAPI("indexedDB API not found. If using IE10+, make sure to run your code on a server URL (not locally). If using old Safari versions, make sure to include indexedDB polyfill.");var req=autoSchema?indexedDB.open(dbName):indexedDB.open(dbName,Math.round(10*db.verno));if(!req)throw new exceptions.MissingAPI("IndexedDB API not available");req.onerror=wrap(eventRejectHandler(reject)),req.onblocked=wrap(fireOnBlocked),req.onupgradeneeded=wrap(function(e){if(upgradeTransaction=req.transaction,autoSchema&&!db._allowEmptyDB){req.onerror=preventDefault,upgradeTransaction.abort(),req.result.close();var delreq=indexedDB.deleteDatabase(dbName);delreq.onsuccess=delreq.onerror=wrap(function(){reject(new exceptions.NoSuchDatabase("Database "+dbName+" doesnt exist"))})}else{upgradeTransaction.onerror=wrap(eventRejectHandler(reject));var oldVer=e.oldVersion>Math.pow(2,62)?0:e.oldVersion;runUpgraders(oldVer/10,upgradeTransaction,reject,req)}},reject),req.onsuccess=wrap(function(){if(upgradeTransaction=null,idbdb=req.result,connections.push(db),autoSchema)readGlobalSchema();else if(idbdb.objectStoreNames.length>0)try{adjustToExistingIndexNames(globalSchema,idbdb.transaction(safariMultiStoreFix(idbdb.objectStoreNames),READONLY))}catch(e){}idbdb.onversionchange=wrap(function(ev){db._vcFired=!0,db.on("versionchange").fire(ev)}),hasNativeGetDatabaseNames||globalDatabaseList(function(databaseNames){if(databaseNames.indexOf(dbName)===-1)return databaseNames.push(dbName)}),resolve()},reject)})]).then(function(){return Dexie.vip(db.on.ready.fire)}).then(function(){return isBeingOpened=!1,db}).catch(function(err){try{upgradeTransaction&&upgradeTransaction.abort()}catch(e){}return isBeingOpened=!1,db.close(),dbOpenError=err,rejection(dbOpenError,dbUncaught)}).finally(function(){openComplete=!0,resolveDbReady()})},this.close=function(){var idx=connections.indexOf(db);if(idx>=0&&connections.splice(idx,1),idbdb){try{idbdb.close()}catch(e){}idbdb=null}autoOpen=!1,dbOpenError=new exceptions.DatabaseClosed,isBeingOpened&&cancelOpen(dbOpenError),dbReadyPromise=new Promise(function(resolve){dbReadyResolve=resolve}),openCanceller=new Promise(function(_,reject){cancelOpen=reject})},this.delete=function(){var hasArguments=arguments.length>0;return new Promise(function(resolve,reject){function doDelete(){db.close();var req=indexedDB.deleteDatabase(dbName);req.onsuccess=wrap(function(){hasNativeGetDatabaseNames||globalDatabaseList(function(databaseNames){var pos=databaseNames.indexOf(dbName);if(pos>=0)return databaseNames.splice(pos,1)}),resolve()}),req.onerror=wrap(eventRejectHandler(reject)),req.onblocked=fireOnBlocked}if(hasArguments)throw new exceptions.InvalidArgument("Arguments not allowed in db.delete()");isBeingOpened?dbReadyPromise.then(doDelete):doDelete()}).uncaught(dbUncaught)},this.backendDB=function(){return idbdb},this.isOpen=function(){return null!==idbdb},this.hasFailed=function(){return null!==dbOpenError},this.dynamicallyOpened=function(){return autoSchema},this.name=dbName,setProp(this,"tables",{get:function(){return keys(allTables).map(function(name){return allTables[name]})}}),this.on=Events(this,"error","populate","blocked","versionchange",{ready:[promisableChain,nop]}),this.on.error.subscribe=deprecated("Dexie.on.error",this.on.error.subscribe),this.on.error.unsubscribe=deprecated("Dexie.on.error.unsubscribe",this.on.error.unsubscribe),this.on.ready.subscribe=override(this.on.ready.subscribe,function(subscribe){return function(subscriber,bSticky){Dexie.vip(function(){openComplete?(dbOpenError||Promise.resolve().then(subscriber),bSticky&&subscribe(subscriber)):(subscribe(subscriber),bSticky||subscribe(function unsubscribe(){db.on.ready.unsubscribe(subscriber),db.on.ready.unsubscribe(unsubscribe)}))})}}),fakeAutoComplete(function(){db.on("populate").fire(db._createTransaction(READWRITE,dbStoreNames,globalSchema)),db.on("error").fire(new Error)}),this.transaction=function(mode,tableInstances,scopeFunc){function enterTransactionScope(resolve){var parentPSD=PSD;resolve(Promise.resolve().then(function(){return newScope(function(){PSD.transless=PSD.transless||parentPSD;var trans=db._createTransaction(mode,storeNames,globalSchema,parentTransaction);PSD.trans=trans,parentTransaction?trans.idbtrans=parentTransaction.idbtrans:trans.create();var tableArgs=storeNames.map(function(name){return allTables[name]});tableArgs.push(trans);var returnValue;return Promise.follow(function(){if(returnValue=scopeFunc.apply(trans,tableArgs))if("function"==typeof returnValue.next&&"function"==typeof returnValue.throw)returnValue=awaitIterator(returnValue);else if("function"==typeof returnValue.then&&!hasOwn(returnValue,"_PSD"))throw new exceptions.IncompatiblePromise("Incompatible Promise returned from transaction scope (read more at http://tinyurl.com/znyqjqc). Transaction scope: "+scopeFunc.toString())}).uncaught(dbUncaught).then(function(){return parentTransaction&&trans._resolve(),trans._completion}).then(function(){return returnValue}).catch(function(e){return trans._reject(e),rejection(e)})})}))}var i=arguments.length;if(i<2)throw new exceptions.InvalidArgument("Too few arguments");for(var args=new Array(i-1);--i;)args[i-1]=arguments[i];scopeFunc=args.pop();var tables=flatten(args),parentTransaction=PSD.trans;parentTransaction&&parentTransaction.db===db&&mode.indexOf("!")===-1||(parentTransaction=null);var onlyIfCompatible=mode.indexOf("?")!==-1;mode=mode.replace("!","").replace("?","");try{var storeNames=tables.map(function(table){var storeName=table instanceof Table?table.name:table;if("string"!=typeof storeName)throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return storeName});if("r"==mode||mode==READONLY)mode=READONLY;else{if("rw"!=mode&&mode!=READWRITE)throw new exceptions.InvalidArgument("Invalid transaction mode: "+mode);mode=READWRITE}if(parentTransaction){if(parentTransaction.mode===READONLY&&mode===READWRITE){if(!onlyIfCompatible)throw new exceptions.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");parentTransaction=null}parentTransaction&&storeNames.forEach(function(storeName){if(parentTransaction&&parentTransaction.storeNames.indexOf(storeName)===-1){if(!onlyIfCompatible)throw new exceptions.SubTransaction("Table "+storeName+" not included in parent transaction.");parentTransaction=null}})}}catch(e){return parentTransaction?parentTransaction._promise(null,function(_,reject){reject(e)}):rejection(e,dbUncaught)}return parentTransaction?parentTransaction._promise(mode,enterTransactionScope,"lock"):db._whenReady(enterTransactionScope)},this.table=function(tableName){if(fake&&autoSchema)return new WriteableTable(tableName);if(!hasOwn(allTables,tableName))throw new exceptions.InvalidTable("Table "+tableName+" does not exist");return allTables[tableName]},props(Table.prototype,{_trans:function(mode,fn,writeLocked){var trans=PSD.trans;return trans&&trans.db===db?trans._promise(mode,fn,writeLocked):tempTransaction(mode,[this.name],fn)},_idbstore:function(mode,fn,writeLocked){function supplyIdbStore(resolve,reject,trans){fn(resolve,reject,trans.idbtrans.objectStore(tableName),trans)}if(fake)return new Promise(fn);var trans=PSD.trans,tableName=this.name;return trans&&trans.db===db?trans._promise(mode,supplyIdbStore,writeLocked):tempTransaction(mode,[this.name],supplyIdbStore)},get:function(key,cb){var self=this;return this._idbstore(READONLY,function(resolve,reject,idbstore){fake&&resolve(self.schema.instanceTemplate);var req=idbstore.get(key);req.onerror=eventRejectHandler(reject),req.onsuccess=wrap(function(){resolve(self.hook.reading.fire(req.result))},reject)}).then(cb)},where:function(indexName){return new WhereClause(this,indexName)},count:function(cb){return this.toCollection().count(cb)},offset:function(offset){return this.toCollection().offset(offset)},limit:function(numRows){return this.toCollection().limit(numRows)},reverse:function(){return this.toCollection().reverse()},filter:function(filterFunction){return this.toCollection().and(filterFunction)},each:function(fn){return this.toCollection().each(fn)},toArray:function(cb){return this.toCollection().toArray(cb)},orderBy:function(index){return new this._collClass(new WhereClause(this,index))},toCollection:function(){return new this._collClass(new WhereClause(this))},mapToClass:function(constructor,structure){this.schema.mappedClass=constructor;var instanceTemplate=Object.create(constructor.prototype);structure&&applyStructure(instanceTemplate,structure),this.schema.instanceTemplate=instanceTemplate;var readHook=function(obj){if(!obj)return obj;var res=Object.create(constructor.prototype);for(var m in obj)if(hasOwn(obj,m))try{res[m]=obj[m]}catch(_){}return res};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=readHook,this.hook("reading",readHook),constructor},defineClass:function(structure){return this.mapToClass(Dexie.defineClass(structure),structure)}}),derive(WriteableTable).from(Table).extend({bulkDelete:function(keys$$1){return this.hook.deleting.fire===nop?this._idbstore(READWRITE,function(resolve,reject,idbstore,trans){resolve(bulkDelete(idbstore,trans,keys$$1,!1,nop))}):this.where(":id").anyOf(keys$$1).delete().then(function(){})},bulkPut:function(objects,keys$$1){var _this=this;return this._idbstore(READWRITE,function(resolve,reject,idbstore){if(!idbstore.keyPath&&!_this.schema.primKey.auto&&!keys$$1)throw new exceptions.InvalidArgument("bulkPut() with non-inbound keys requires keys array in second argument");if(idbstore.keyPath&&keys$$1)throw new exceptions.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(keys$$1&&keys$$1.length!==objects.length)throw new exceptions.InvalidArgument("Arguments objects and keys must have the same length");if(0===objects.length)return resolve();var req,errorHandler,done=function(result){0===errorList.length?resolve(result):reject(new BulkError(_this.name+".bulkPut(): "+errorList.length+" of "+numObjs+" operations failed",errorList))},errorList=[],numObjs=objects.length,table=_this;if(_this.hook.creating.fire===nop&&_this.hook.updating.fire===nop){errorHandler=BulkErrorHandlerCatchAll(errorList);for(var i=0,l=objects.length;i<l;++i)req=keys$$1?idbstore.put(objects[i],keys$$1[i]):idbstore.put(objects[i]),req.onerror=errorHandler;req.onerror=BulkErrorHandlerCatchAll(errorList,done),req.onsuccess=eventSuccessHandler(done)}else{var effectiveKeys=keys$$1||idbstore.keyPath&&objects.map(function(o){return getByKeyPath(o,idbstore.keyPath)}),objectLookup=effectiveKeys&&arrayToObject(effectiveKeys,function(key,i){return null!=key&&[key,objects[i]]}),promise=effectiveKeys?table.where(":id").anyOf(effectiveKeys.filter(function(key){return null!=key})).modify(function(){this.value=objectLookup[this.primKey],objectLookup[this.primKey]=null}).catch(ModifyError,function(e){errorList=e.failures}).then(function(){for(var objsToAdd=[],keysToAdd=keys$$1&&[],i=effectiveKeys.length-1;i>=0;--i){var key=effectiveKeys[i];(null==key||objectLookup[key])&&(objsToAdd.push(objects[i]),keys$$1&&keysToAdd.push(key),null!=key&&(objectLookup[key]=null))}return objsToAdd.reverse(),keys$$1&&keysToAdd.reverse(),table.bulkAdd(objsToAdd,keysToAdd)}).then(function(lastAddedKey){var lastEffectiveKey=effectiveKeys[effectiveKeys.length-1];return null!=lastEffectiveKey?lastEffectiveKey:lastAddedKey}):table.bulkAdd(objects);promise.then(done).catch(BulkError,function(e){errorList=errorList.concat(e.failures),done()}).catch(reject)}},"locked")},bulkAdd:function(objects,keys$$1){var self=this,creatingHook=this.hook.creating.fire;return this._idbstore(READWRITE,function(resolve,reject,idbstore,trans){function done(result){0===errorList.length?resolve(result):reject(new BulkError(self.name+".bulkAdd(): "+errorList.length+" of "+numObjs+" operations failed",errorList))}if(!idbstore.keyPath&&!self.schema.primKey.auto&&!keys$$1)throw new exceptions.InvalidArgument("bulkAdd() with non-inbound keys requires keys array in second argument");if(idbstore.keyPath&&keys$$1)throw new exceptions.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(keys$$1&&keys$$1.length!==objects.length)throw new exceptions.InvalidArgument("Arguments objects and keys must have the same length");if(0===objects.length)return resolve();var req,errorHandler,successHandler,errorList=[],numObjs=objects.length;if(creatingHook!==nop){var hookCtx,keyPath=idbstore.keyPath;errorHandler=BulkErrorHandlerCatchAll(errorList,null,!0),successHandler=hookedEventSuccessHandler(null),tryCatch(function(){for(var i=0,l=objects.length;i<l;++i){hookCtx={onerror:null,onsuccess:null};var key=keys$$1&&keys$$1[i],obj=objects[i],effectiveKey=keys$$1?key:keyPath?getByKeyPath(obj,keyPath):void 0,keyToUse=creatingHook.call(hookCtx,effectiveKey,obj,trans);null==effectiveKey&&null!=keyToUse&&(keyPath?(obj=deepClone(obj),setByKeyPath(obj,keyPath,keyToUse)):key=keyToUse),req=null!=key?idbstore.add(obj,key):idbstore.add(obj),req._hookCtx=hookCtx,i<l-1&&(req.onerror=errorHandler,hookCtx.onsuccess&&(req.onsuccess=successHandler))}},function(err){throw hookCtx.onerror&&hookCtx.onerror(err),err}),req.onerror=BulkErrorHandlerCatchAll(errorList,done,!0),req.onsuccess=hookedEventSuccessHandler(done)}else{errorHandler=BulkErrorHandlerCatchAll(errorList);for(var i=0,l=objects.length;i<l;++i)req=keys$$1?idbstore.add(objects[i],keys$$1[i]):idbstore.add(objects[i]),req.onerror=errorHandler;req.onerror=BulkErrorHandlerCatchAll(errorList,done),req.onsuccess=eventSuccessHandler(done)}})},add:function(obj,key){var creatingHook=this.hook.creating.fire;return this._idbstore(READWRITE,function(resolve,reject,idbstore,trans){var hookCtx={onsuccess:null,onerror:null};if(creatingHook!==nop){var effectiveKey=null!=key?key:idbstore.keyPath?getByKeyPath(obj,idbstore.keyPath):void 0,keyToUse=creatingHook.call(hookCtx,effectiveKey,obj,trans);null==effectiveKey&&null!=keyToUse&&(idbstore.keyPath?setByKeyPath(obj,idbstore.keyPath,keyToUse):key=keyToUse)}try{var req=null!=key?idbstore.add(obj,key):idbstore.add(obj);req._hookCtx=hookCtx,req.onerror=hookedEventRejectHandler(reject),req.onsuccess=hookedEventSuccessHandler(function(result){var keyPath=idbstore.keyPath;keyPath&&setByKeyPath(obj,keyPath,result),resolve(result)})}catch(e){throw hookCtx.onerror&&hookCtx.onerror(e),e}})},put:function(obj,key){var self=this,creatingHook=this.hook.creating.fire,updatingHook=this.hook.updating.fire;return creatingHook!==nop||updatingHook!==nop?this._trans(READWRITE,function(resolve,reject,trans){var effectiveKey=void 0!==key?key:self.schema.primKey.keyPath&&getByKeyPath(obj,self.schema.primKey.keyPath);null==effectiveKey?self.add(obj).then(resolve,reject):(trans._lock(),obj=deepClone(obj),self.where(":id").equals(effectiveKey).modify(function(){this.value=obj}).then(function(count){return 0===count?self.add(obj,key):effectiveKey}).finally(function(){trans._unlock()}).then(resolve,reject))}):this._idbstore(READWRITE,function(resolve,reject,idbstore){var req=void 0!==key?idbstore.put(obj,key):idbstore.put(obj);req.onerror=eventRejectHandler(reject),req.onsuccess=function(ev){var keyPath=idbstore.keyPath;keyPath&&setByKeyPath(obj,keyPath,ev.target.result),resolve(req.result)}})},delete:function(key){return this.hook.deleting.subscribers.length?this.where(":id").equals(key).delete():this._idbstore(READWRITE,function(resolve,reject,idbstore){var req=idbstore.delete(key);req.onerror=eventRejectHandler(reject),req.onsuccess=function(){resolve(req.result)}})},clear:function(){return this.hook.deleting.subscribers.length?this.toCollection().delete():this._idbstore(READWRITE,function(resolve,reject,idbstore){var req=idbstore.clear();req.onerror=eventRejectHandler(reject),req.onsuccess=function(){resolve(req.result)}})},update:function(keyOrObject,modifications){if("object"!=typeof modifications||isArray(modifications))throw new exceptions.InvalidArgument("Modifications must be an object.");if("object"!=typeof keyOrObject||isArray(keyOrObject))return this.where(":id").equals(keyOrObject).modify(modifications);keys(modifications).forEach(function(keyPath){setByKeyPath(keyOrObject,keyPath,modifications[keyPath])});var key=getByKeyPath(keyOrObject,this.schema.primKey.keyPath);return void 0===key?rejection(new exceptions.InvalidArgument("Given object does not contain its primary key"),dbUncaught):this.where(":id").equals(key).modify(modifications)}}),props(Transaction.prototype,{_lock:function(){return assert(!PSD.global),++this._reculock,1!==this._reculock||PSD.global||(PSD.lockOwnerFor=this),this},_unlock:function(){if(assert(!PSD.global),0===--this._reculock)for(PSD.global||(PSD.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var fn=this._blockedFuncs.shift();try{fn()}catch(e){}}return this},_locked:function(){return this._reculock&&PSD.lockOwnerFor!==this},create:function(idbtrans){var _this3=this;if(assert(!this.idbtrans),!idbtrans&&!idbdb)switch(dbOpenError&&dbOpenError.name){case"DatabaseClosedError":throw new exceptions.DatabaseClosed(dbOpenError);case"MissingAPIError":throw new exceptions.MissingAPI(dbOpenError.message,dbOpenError);default:throw new exceptions.OpenFailed(dbOpenError)}if(!this.active)throw new exceptions.TransactionInactive;return assert(null===this._completion._state),idbtrans=this.idbtrans=idbtrans||idbdb.transaction(safariMultiStoreFix(this.storeNames),this.mode),idbtrans.onerror=wrap(function(ev){preventDefault(ev),_this3._reject(idbtrans.error)}),idbtrans.onabort=wrap(function(ev){preventDefault(ev),_this3.active&&_this3._reject(new exceptions.Abort),_this3.active=!1,_this3.on("abort").fire(ev)}),idbtrans.oncomplete=wrap(function(){_this3.active=!1,_this3._resolve()}),this},_promise:function(mode,fn,bWriteLock){var self=this;return newScope(function(){var p;return self._locked()?p=new Promise(function(resolve,reject){self._blockedFuncs.push(function(){self._promise(mode,fn,bWriteLock).then(resolve,reject)})}):(p=self.active?new Promise(function(resolve,reject){if(mode===READWRITE&&self.mode!==READWRITE)throw new exceptions.ReadOnly("Transaction is readonly");!self.idbtrans&&mode&&self.create(),bWriteLock&&self._lock(),fn(resolve,reject,self)}):rejection(new exceptions.TransactionInactive),self.active&&bWriteLock&&p.finally(function(){self._unlock()})),p._lib=!0,p.uncaught(dbUncaught)})},abort:function(){this.active&&this._reject(new exceptions.Abort),this.active=!1},tables:{get:deprecated("Transaction.tables",function(){return arrayToObject(this.storeNames,function(name){return[name,allTables[name]]})},"Use db.tables()")},complete:deprecated("Transaction.complete()",function(cb){return this.on("complete",cb)}),error:deprecated("Transaction.error()",function(cb){return this.on("error",cb)}),table:deprecated("Transaction.table()",function(name){if(this.storeNames.indexOf(name)===-1)throw new exceptions.InvalidTable("Table "+name+" not in transaction");return allTables[name]})}),props(WhereClause.prototype,function(){function fail(collectionOrWhereClause,err,T){var collection=collectionOrWhereClause instanceof WhereClause?new collectionOrWhereClause._ctx.collClass(collectionOrWhereClause):collectionOrWhereClause;return collection._ctx.error=T?new T(err):new TypeError(err),collection}function emptyCollection(whereClause){return new whereClause._ctx.collClass(whereClause,function(){return IDBKeyRange.only("")}).limit(0)}function upperFactory(dir){return"next"===dir?function(s){return s.toUpperCase()}:function(s){return s.toLowerCase()}}function lowerFactory(dir){return"next"===dir?function(s){return s.toLowerCase()}:function(s){return s.toUpperCase()}}function nextCasing(key,lowerKey,upperNeedle,lowerNeedle,cmp,dir){for(var length=Math.min(key.length,lowerNeedle.length),llp=-1,i=0;i<length;++i){var lwrKeyChar=lowerKey[i];if(lwrKeyChar!==lowerNeedle[i])return cmp(key[i],upperNeedle[i])<0?key.substr(0,i)+upperNeedle[i]+upperNeedle.substr(i+1):cmp(key[i],lowerNeedle[i])<0?key.substr(0,i)+lowerNeedle[i]+upperNeedle.substr(i+1):llp>=0?key.substr(0,llp)+lowerKey[llp]+upperNeedle.substr(llp+1):null;cmp(key[i],lwrKeyChar)<0&&(llp=i)}return length<lowerNeedle.length&&"next"===dir?key+upperNeedle.substr(key.length):length<key.length&&"prev"===dir?key.substr(0,upperNeedle.length):llp<0?null:key.substr(0,llp)+lowerNeedle[llp]+upperNeedle.substr(llp+1)}function addIgnoreCaseAlgorithm(whereClause,match,needles,suffix){
|
||
function initDirection(dir){upper=upperFactory(dir),lower=lowerFactory(dir),compare="next"===dir?simpleCompare:simpleCompareReverse;var needleBounds=needles.map(function(needle){return{lower:lower(needle),upper:upper(needle)}}).sort(function(a,b){return compare(a.lower,b.lower)});upperNeedles=needleBounds.map(function(nb){return nb.upper}),lowerNeedles=needleBounds.map(function(nb){return nb.lower}),direction=dir,nextKeySuffix="next"===dir?"":suffix}var upper,lower,compare,upperNeedles,lowerNeedles,direction,nextKeySuffix,needlesLen=needles.length;if(!needles.every(function(s){return"string"==typeof s}))return fail(whereClause,STRING_EXPECTED);initDirection("next");var c=new whereClause._ctx.collClass(whereClause,function(){return IDBKeyRange.bound(upperNeedles[0],lowerNeedles[needlesLen-1]+suffix)});c._ondirectionchange=function(direction){initDirection(direction)};var firstPossibleNeedle=0;return c._addAlgorithm(function(cursor,advance,resolve){var key=cursor.key;if("string"!=typeof key)return!1;var lowerKey=lower(key);if(match(lowerKey,lowerNeedles,firstPossibleNeedle))return!0;for(var lowestPossibleCasing=null,i=firstPossibleNeedle;i<needlesLen;++i){var casing=nextCasing(key,lowerKey,upperNeedles[i],lowerNeedles[i],compare,direction);null===casing&&null===lowestPossibleCasing?firstPossibleNeedle=i+1:(null===lowestPossibleCasing||compare(lowestPossibleCasing,casing)>0)&&(lowestPossibleCasing=casing)}return advance(null!==lowestPossibleCasing?function(){cursor.continue(lowestPossibleCasing+nextKeySuffix)}:resolve),!1}),c}return{between:function(lower,upper,includeLower,includeUpper){includeLower=includeLower!==!1,includeUpper=includeUpper===!0;try{return cmp(lower,upper)>0||0===cmp(lower,upper)&&(includeLower||includeUpper)&&(!includeLower||!includeUpper)?emptyCollection(this):new this._ctx.collClass(this,function(){return IDBKeyRange.bound(lower,upper,!includeLower,!includeUpper)})}catch(e){return fail(this,INVALID_KEY_ARGUMENT)}},equals:function(value){return new this._ctx.collClass(this,function(){return IDBKeyRange.only(value)})},above:function(value){return new this._ctx.collClass(this,function(){return IDBKeyRange.lowerBound(value,!0)})},aboveOrEqual:function(value){return new this._ctx.collClass(this,function(){return IDBKeyRange.lowerBound(value)})},below:function(value){return new this._ctx.collClass(this,function(){return IDBKeyRange.upperBound(value,!0)})},belowOrEqual:function(value){return new this._ctx.collClass(this,function(){return IDBKeyRange.upperBound(value)})},startsWith:function(str){return"string"!=typeof str?fail(this,STRING_EXPECTED):this.between(str,str+maxString,!0,!0)},startsWithIgnoreCase:function(str){return""===str?this.startsWith(str):addIgnoreCaseAlgorithm(this,function(x,a){return 0===x.indexOf(a[0])},[str],maxString)},equalsIgnoreCase:function(str){return addIgnoreCaseAlgorithm(this,function(x,a){return x===a[0]},[str],"")},anyOfIgnoreCase:function(){var set=getArrayOf.apply(NO_CHAR_ARRAY,arguments);return 0===set.length?emptyCollection(this):addIgnoreCaseAlgorithm(this,function(x,a){return a.indexOf(x)!==-1},set,"")},startsWithAnyOfIgnoreCase:function(){var set=getArrayOf.apply(NO_CHAR_ARRAY,arguments);return 0===set.length?emptyCollection(this):addIgnoreCaseAlgorithm(this,function(x,a){return a.some(function(n){return 0===x.indexOf(n)})},set,maxString)},anyOf:function(){var set=getArrayOf.apply(NO_CHAR_ARRAY,arguments),compare=ascending;try{set.sort(compare)}catch(e){return fail(this,INVALID_KEY_ARGUMENT)}if(0===set.length)return emptyCollection(this);var c=new this._ctx.collClass(this,function(){return IDBKeyRange.bound(set[0],set[set.length-1])});c._ondirectionchange=function(direction){compare="next"===direction?ascending:descending,set.sort(compare)};var i=0;return c._addAlgorithm(function(cursor,advance,resolve){for(var key=cursor.key;compare(key,set[i])>0;)if(++i,i===set.length)return advance(resolve),!1;return 0===compare(key,set[i])||(advance(function(){cursor.continue(set[i])}),!1)}),c},notEqual:function(value){return this.inAnyRange([[-(1/0),value],[value,maxKey]],{includeLowers:!1,includeUppers:!1})},noneOf:function(){var set=getArrayOf.apply(NO_CHAR_ARRAY,arguments);if(0===set.length)return new this._ctx.collClass(this);try{set.sort(ascending)}catch(e){return fail(this,INVALID_KEY_ARGUMENT)}var ranges=set.reduce(function(res,val){return res?res.concat([[res[res.length-1][1],val]]):[[-(1/0),val]]},null);return ranges.push([set[set.length-1],maxKey]),this.inAnyRange(ranges,{includeLowers:!1,includeUppers:!1})},inAnyRange:function(ranges,options){function addRange(ranges,newRange){for(var i=0,l=ranges.length;i<l;++i){var range=ranges[i];if(cmp(newRange[0],range[1])<0&&cmp(newRange[1],range[0])>0){range[0]=min(range[0],newRange[0]),range[1]=max(range[1],newRange[1]);break}}return i===l&&ranges.push(newRange),ranges}function rangeSorter(a,b){return sortDirection(a[0],b[0])}function keyWithinCurrentRange(key){return!keyIsBeyondCurrentEntry(key)&&!keyIsBeforeCurrentEntry(key)}var ctx=this._ctx;if(0===ranges.length)return emptyCollection(this);if(!ranges.every(function(range){return void 0!==range[0]&&void 0!==range[1]&&ascending(range[0],range[1])<=0}))return fail(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",exceptions.InvalidArgument);var set,includeLowers=!options||options.includeLowers!==!1,includeUppers=options&&options.includeUppers===!0,sortDirection=ascending;try{set=ranges.reduce(addRange,[]),set.sort(rangeSorter)}catch(ex){return fail(this,INVALID_KEY_ARGUMENT)}var i=0,keyIsBeyondCurrentEntry=includeUppers?function(key){return ascending(key,set[i][1])>0}:function(key){return ascending(key,set[i][1])>=0},keyIsBeforeCurrentEntry=includeLowers?function(key){return descending(key,set[i][0])>0}:function(key){return descending(key,set[i][0])>=0},checkKey=keyIsBeyondCurrentEntry,c=new ctx.collClass(this,function(){return IDBKeyRange.bound(set[0][0],set[set.length-1][1],!includeLowers,!includeUppers)});return c._ondirectionchange=function(direction){"next"===direction?(checkKey=keyIsBeyondCurrentEntry,sortDirection=ascending):(checkKey=keyIsBeforeCurrentEntry,sortDirection=descending),set.sort(rangeSorter)},c._addAlgorithm(function(cursor,advance,resolve){for(var key=cursor.key;checkKey(key);)if(++i,i===set.length)return advance(resolve),!1;return!!keyWithinCurrentRange(key)||0!==cmp(key,set[i][1])&&0!==cmp(key,set[i][0])&&(advance(function(){sortDirection===ascending?cursor.continue(set[i][0]):cursor.continue(set[i][1])}),!1)}),c},startsWithAnyOf:function(){var set=getArrayOf.apply(NO_CHAR_ARRAY,arguments);return set.every(function(s){return"string"==typeof s})?0===set.length?emptyCollection(this):this.inAnyRange(set.map(function(str){return[str,str+maxString]})):fail(this,"startsWithAnyOf() only works with strings")}}}),props(Collection.prototype,function(){function addFilter(ctx,fn){ctx.filter=combine(ctx.filter,fn)}function addReplayFilter(ctx,factory,isLimitFilter){var curr=ctx.replayFilter;ctx.replayFilter=curr?function(){return combine(curr(),factory())}:factory,ctx.justLimit=isLimitFilter&&!curr}function addMatchFilter(ctx,fn){ctx.isMatch=combine(ctx.isMatch,fn)}function getIndexOrStore(ctx,store){if(ctx.isPrimKey)return store;var indexSpec=ctx.table.schema.idxByName[ctx.index];if(!indexSpec)throw new exceptions.Schema("KeyPath "+ctx.index+" on object store "+store.name+" is not indexed");return store.index(indexSpec.name)}function openCursor(ctx,store){var idxOrStore=getIndexOrStore(ctx,store);return ctx.keysOnly&&"openKeyCursor"in idxOrStore?idxOrStore.openKeyCursor(ctx.range||null,ctx.dir+ctx.unique):idxOrStore.openCursor(ctx.range||null,ctx.dir+ctx.unique)}function iter(ctx,fn,resolve,reject,idbstore){var filter=ctx.replayFilter?combine(ctx.filter,ctx.replayFilter()):ctx.filter;ctx.or?function(){function resolveboth(){2===++resolved&&resolve()}function union(item,cursor,advance){if(!filter||filter(cursor,advance,resolveboth,reject)){var key=cursor.primaryKey.toString();hasOwn(set,key)||(set[key]=!0,fn(item,cursor,advance))}}var set={},resolved=0;ctx.or._iterate(union,resolveboth,reject,idbstore),iterate(openCursor(ctx,idbstore),ctx.algorithm,union,resolveboth,reject,!ctx.keysOnly&&ctx.valueMapper)}():iterate(openCursor(ctx,idbstore),combine(ctx.algorithm,filter),fn,resolve,reject,!ctx.keysOnly&&ctx.valueMapper)}function getInstanceTemplate(ctx){return ctx.table.schema.instanceTemplate}return{_read:function(fn,cb){var ctx=this._ctx;return ctx.error?ctx.table._trans(null,function(resolve,reject){reject(ctx.error)}):ctx.table._idbstore(READONLY,fn).then(cb)},_write:function(fn){var ctx=this._ctx;return ctx.error?ctx.table._trans(null,function(resolve,reject){reject(ctx.error)}):ctx.table._idbstore(READWRITE,fn,"locked")},_addAlgorithm:function(fn){var ctx=this._ctx;ctx.algorithm=combine(ctx.algorithm,fn)},_iterate:function(fn,resolve,reject,idbstore){return iter(this._ctx,fn,resolve,reject,idbstore)},clone:function(props$$1){var rv=Object.create(this.constructor.prototype),ctx=Object.create(this._ctx);return props$$1&&extend(ctx,props$$1),rv._ctx=ctx,rv},raw:function(){return this._ctx.valueMapper=null,this},each:function(fn){var ctx=this._ctx;if(fake){var item=getInstanceTemplate(ctx),primKeyPath=ctx.table.schema.primKey.keyPath,key=getByKeyPath(item,ctx.index?ctx.table.schema.idxByName[ctx.index].keyPath:primKeyPath),primaryKey=getByKeyPath(item,primKeyPath);fn(item,{key:key,primaryKey:primaryKey})}return this._read(function(resolve,reject,idbstore){iter(ctx,fn,resolve,reject,idbstore)})},count:function(cb){if(fake)return Promise.resolve(0).then(cb);var ctx=this._ctx;if(isPlainKeyRange(ctx,!0))return this._read(function(resolve,reject,idbstore){var idx=getIndexOrStore(ctx,idbstore),req=ctx.range?idx.count(ctx.range):idx.count();req.onerror=eventRejectHandler(reject),req.onsuccess=function(e){resolve(Math.min(e.target.result,ctx.limit))}},cb);var count=0;return this._read(function(resolve,reject,idbstore){iter(ctx,function(){return++count,!1},function(){resolve(count)},reject,idbstore)},cb)},sortBy:function(keyPath,cb){function getval(obj,i){return i?getval(obj[parts[i]],i-1):obj[lastPart]}function sorter(a,b){var aVal=getval(a,lastIndex),bVal=getval(b,lastIndex);return aVal<bVal?-order:aVal>bVal?order:0}var parts=keyPath.split(".").reverse(),lastPart=parts[0],lastIndex=parts.length-1,order="next"===this._ctx.dir?1:-1;return this.toArray(function(a){return a.sort(sorter)}).then(cb)},toArray:function(cb){var ctx=this._ctx;return this._read(function(resolve,reject,idbstore){if(fake&&resolve([getInstanceTemplate(ctx)]),hasGetAll&&"next"===ctx.dir&&isPlainKeyRange(ctx,!0)&&ctx.limit>0){var readingHook=ctx.table.hook.reading.fire,idxOrStore=getIndexOrStore(ctx,idbstore),req=ctx.limit<1/0?idxOrStore.getAll(ctx.range,ctx.limit):idxOrStore.getAll(ctx.range);req.onerror=eventRejectHandler(reject),req.onsuccess=readingHook===mirror?eventSuccessHandler(resolve):wrap(eventSuccessHandler(function(res){try{resolve(res.map(readingHook))}catch(e){reject(e)}}))}else{var a=[];iter(ctx,function(item){a.push(item)},function(){resolve(a)},reject,idbstore)}},cb)},offset:function(offset){var ctx=this._ctx;return offset<=0?this:(ctx.offset+=offset,isPlainKeyRange(ctx)?addReplayFilter(ctx,function(){var offsetLeft=offset;return function(cursor,advance){return 0===offsetLeft||(1===offsetLeft?(--offsetLeft,!1):(advance(function(){cursor.advance(offsetLeft),offsetLeft=0}),!1))}}):addReplayFilter(ctx,function(){var offsetLeft=offset;return function(){return--offsetLeft<0}}),this)},limit:function(numRows){return this._ctx.limit=Math.min(this._ctx.limit,numRows),addReplayFilter(this._ctx,function(){var rowsLeft=numRows;return function(cursor,advance,resolve){return--rowsLeft<=0&&advance(resolve),rowsLeft>=0}},!0),this},until:function(filterFunction,bIncludeStopEntry){var ctx=this._ctx;return fake&&filterFunction(getInstanceTemplate(ctx)),addFilter(this._ctx,function(cursor,advance,resolve){return!filterFunction(cursor.value)||(advance(resolve),bIncludeStopEntry)}),this},first:function(cb){return this.limit(1).toArray(function(a){return a[0]}).then(cb)},last:function(cb){return this.reverse().first(cb)},filter:function(filterFunction){return fake&&filterFunction(getInstanceTemplate(this._ctx)),addFilter(this._ctx,function(cursor){return filterFunction(cursor.value)}),addMatchFilter(this._ctx,filterFunction),this},and:function(filterFunction){return this.filter(filterFunction)},or:function(indexName){return new WhereClause(this._ctx.table,indexName,this)},reverse:function(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},desc:function(){return this.reverse()},eachKey:function(cb){var ctx=this._ctx;return ctx.keysOnly=!ctx.isMatch,this.each(function(val,cursor){cb(cursor.key,cursor)})},eachUniqueKey:function(cb){return this._ctx.unique="unique",this.eachKey(cb)},eachPrimaryKey:function(cb){var ctx=this._ctx;return ctx.keysOnly=!ctx.isMatch,this.each(function(val,cursor){cb(cursor.primaryKey,cursor)})},keys:function(cb){var ctx=this._ctx;ctx.keysOnly=!ctx.isMatch;var a=[];return this.each(function(item,cursor){a.push(cursor.key)}).then(function(){return a}).then(cb)},primaryKeys:function(cb){var ctx=this._ctx;if(hasGetAll&&"next"===ctx.dir&&isPlainKeyRange(ctx,!0)&&ctx.limit>0)return this._read(function(resolve,reject,idbstore){var idxOrStore=getIndexOrStore(ctx,idbstore),req=ctx.limit<1/0?idxOrStore.getAllKeys(ctx.range,ctx.limit):idxOrStore.getAllKeys(ctx.range);req.onerror=eventRejectHandler(reject),req.onsuccess=eventSuccessHandler(resolve)}).then(cb);ctx.keysOnly=!ctx.isMatch;var a=[];return this.each(function(item,cursor){a.push(cursor.primaryKey)}).then(function(){return a}).then(cb)},uniqueKeys:function(cb){return this._ctx.unique="unique",this.keys(cb)},firstKey:function(cb){return this.limit(1).keys(function(a){return a[0]}).then(cb)},lastKey:function(cb){return this.reverse().firstKey(cb)},distinct:function(){var ctx=this._ctx,idx=ctx.index&&ctx.table.schema.idxByName[ctx.index];if(!idx||!idx.multi)return this;var set={};return addFilter(this._ctx,function(cursor){var strKey=cursor.primaryKey.toString(),found=hasOwn(set,strKey);return set[strKey]=!0,!found}),this}}}),derive(WriteableCollection).from(Collection).extend({modify:function(changes){var self=this,ctx=this._ctx,hook=ctx.table.hook,updatingHook=hook.updating.fire,deletingHook=hook.deleting.fire;return fake&&"function"==typeof changes&&changes.call({value:ctx.table.schema.instanceTemplate},ctx.table.schema.instanceTemplate),this._write(function(resolve,reject,idbstore,trans){function modifyItem(item,cursor){function onerror(e){return failures.push(e),failKeys.push(thisContext.primKey),checkFinished(),!0}currentKey=cursor.primaryKey;var thisContext={primKey:cursor.primaryKey,value:item,onsuccess:null,onerror:null};if(modifyer.call(thisContext,item,thisContext)!==!1){var bDelete=!hasOwn(thisContext,"value");++count,tryCatch(function(){var req=bDelete?cursor.delete():cursor.update(thisContext.value);req._hookCtx=thisContext,req.onerror=hookedEventRejectHandler(onerror),req.onsuccess=hookedEventSuccessHandler(function(){++successCount,checkFinished()})},onerror)}else thisContext.onsuccess&&thisContext.onsuccess(thisContext.value)}function doReject(e){return e&&(failures.push(e),failKeys.push(currentKey)),reject(new ModifyError("Error modifying one or more objects",failures,successCount,failKeys))}function checkFinished(){iterationComplete&&successCount+failures.length===count&&(failures.length>0?doReject():resolve(successCount))}var modifyer;if("function"==typeof changes)modifyer=updatingHook===nop&&deletingHook===nop?changes:function(item){var origItem=deepClone(item);if(changes.call(this,item,this)===!1)return!1;if(hasOwn(this,"value")){var objectDiff=getObjectDiff(origItem,this.value),additionalChanges=updatingHook.call(this,objectDiff,this.primKey,origItem,trans);additionalChanges&&(item=this.value,keys(additionalChanges).forEach(function(keyPath){setByKeyPath(item,keyPath,additionalChanges[keyPath])}))}else deletingHook.call(this,this.primKey,item,trans)};else if(updatingHook===nop){var keyPaths=keys(changes),numKeys=keyPaths.length;modifyer=function(item){for(var anythingModified=!1,i=0;i<numKeys;++i){var keyPath=keyPaths[i],val=changes[keyPath];getByKeyPath(item,keyPath)!==val&&(setByKeyPath(item,keyPath,val),anythingModified=!0)}return anythingModified}}else{var origChanges=changes;changes=shallowClone(origChanges),modifyer=function(item){var anythingModified=!1,additionalChanges=updatingHook.call(this,changes,this.primKey,deepClone(item),trans);return additionalChanges&&extend(changes,additionalChanges),keys(changes).forEach(function(keyPath){var val=changes[keyPath];getByKeyPath(item,keyPath)!==val&&(setByKeyPath(item,keyPath,val),anythingModified=!0)}),additionalChanges&&(changes=shallowClone(origChanges)),anythingModified}}var count=0,successCount=0,iterationComplete=!1,failures=[],failKeys=[],currentKey=null;self.clone().raw()._iterate(modifyItem,function(){iterationComplete=!0,checkFinished()},doReject,idbstore)})},delete:function(){var _this4=this,ctx=this._ctx,range=ctx.range,deletingHook=ctx.table.hook.deleting.fire,hasDeleteHook=deletingHook!==nop;if(!hasDeleteHook&&isPlainKeyRange(ctx)&&(ctx.isPrimKey&&!hangsOnDeleteLargeKeyRange||!range))return this._write(function(resolve,reject,idbstore){var onerror=eventRejectHandler(reject),countReq=range?idbstore.count(range):idbstore.count();countReq.onerror=onerror,countReq.onsuccess=function(){var count=countReq.result;tryCatch(function(){var delReq=range?idbstore.delete(range):idbstore.clear();delReq.onerror=onerror,delReq.onsuccess=function(){return resolve(count)}},function(err){return reject(err)})}});var CHUNKSIZE=hasDeleteHook?2e3:1e4;return this._write(function(resolve,reject,idbstore,trans){var totalCount=0,collection=_this4.clone({keysOnly:!ctx.isMatch&&!hasDeleteHook}).distinct().limit(CHUNKSIZE).raw(),keysOrTuples=[],nextChunk=function(){return collection.each(hasDeleteHook?function(val,cursor){keysOrTuples.push([cursor.primaryKey,cursor.value])}:function(val,cursor){keysOrTuples.push(cursor.primaryKey)}).then(function(){return hasDeleteHook?keysOrTuples.sort(function(a,b){return ascending(a[0],b[0])}):keysOrTuples.sort(ascending),bulkDelete(idbstore,trans,keysOrTuples,hasDeleteHook,deletingHook)}).then(function(){var count=keysOrTuples.length;return totalCount+=count,keysOrTuples=[],count<CHUNKSIZE?totalCount:nextChunk()})};resolve(nextChunk())})}}),extend(this,{Collection:Collection,Table:Table,Transaction:Transaction,Version:Version,WhereClause:WhereClause,WriteableCollection:WriteableCollection,WriteableTable:WriteableTable}),init(),addons.forEach(function(fn){fn(db)})}function parseType(type){if("function"==typeof type)return new type;if(isArray(type))return[parseType(type[0])];if(type&&"object"==typeof type){var rv={};return applyStructure(rv,type),rv}return type}function applyStructure(obj,structure){return keys(structure).forEach(function(member){var value=parseType(structure[member]);obj[member]=value}),obj}function eventSuccessHandler(done){return function(ev){done(ev.target.result)}}function hookedEventSuccessHandler(resolve){return wrap(function(event){var req=event.target,result=req.result,ctx=req._hookCtx,hookSuccessHandler=ctx&&ctx.onsuccess;hookSuccessHandler&&hookSuccessHandler(result),resolve&&resolve(result)},resolve)}function eventRejectHandler(reject){return function(event){return preventDefault(event),reject(event.target.error),!1}}function hookedEventRejectHandler(reject){return wrap(function(event){var req=event.target,err=req.error,ctx=req._hookCtx,hookErrorHandler=ctx&&ctx.onerror;return hookErrorHandler&&hookErrorHandler(err),preventDefault(event),reject(err),!1})}function preventDefault(event){event.stopPropagation&&event.stopPropagation(),event.preventDefault&&event.preventDefault()}function globalDatabaseList(cb){var val,localStorage=Dexie.dependencies.localStorage;if(!localStorage)return cb([]);try{val=JSON.parse(localStorage.getItem("Dexie.DatabaseNames")||"[]")}catch(e){val=[]}cb(val)&&localStorage.setItem("Dexie.DatabaseNames",JSON.stringify(val))}function awaitIterator(iterator){function step(getNext){return function(val){var next=getNext(val),value=next.value;return next.done?value:value&&"function"==typeof value.then?value.then(onSuccess,onError):isArray(value)?Promise.all(value).then(onSuccess,onError):onSuccess(value)}}var callNext=function(result){return iterator.next(result)},doThrow=function(error){return iterator.throw(error)},onSuccess=step(callNext),onError=step(doThrow);return step(callNext)()}function IndexSpec(name,keyPath,unique,multi,auto,compound,dotted){this.name=name,this.keyPath=keyPath,this.unique=unique,this.multi=multi,this.auto=auto,this.compound=compound,this.dotted=dotted;var keyPathSrc="string"==typeof keyPath?keyPath:keyPath&&"["+[].join.call(keyPath,"+")+"]";this.src=(unique?"&":"")+(multi?"*":"")+(auto?"++":"")+keyPathSrc}function TableSchema(name,primKey,indexes,instanceTemplate){this.name=name,this.primKey=primKey||new IndexSpec,this.indexes=indexes||[new IndexSpec],this.instanceTemplate=instanceTemplate,this.mappedClass=null,this.idxByName=arrayToObject(indexes,function(index){return[index.name,index]})}function safariMultiStoreFix(storeNames){return 1===storeNames.length?storeNames[0]:storeNames}function getNativeGetDatabaseNamesFn(indexedDB){var fn=indexedDB&&(indexedDB.getDatabaseNames||indexedDB.webkitGetDatabaseNames);return fn&&fn.bind(indexedDB)}var keys=Object.keys,isArray=Array.isArray,_global="undefined"!=typeof self?self:"undefined"!=typeof window?window:global,getProto=Object.getPrototypeOf,_hasOwn={}.hasOwnProperty,getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,_slice=[].slice,iteratorSymbol="undefined"!=typeof Symbol&&Symbol.iterator,getIteratorOf=iteratorSymbol?function(x){var i;return null!=x&&(i=x[iteratorSymbol])&&i.apply(x)}:function(){return null},NO_CHAR_ARRAY={},concat=[].concat,debug="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href),libraryFilter=function(){return!0},NEEDS_THROW_FOR_STACK=!new Error("").stack,dexieErrorNames=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","IncompatiblePromise"],idbDomErrorNames=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],errorList=dexieErrorNames.concat(idbDomErrorNames),defaultTexts={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed"};derive(DexieError).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+prettyStack(this._e,2))}},toString:function(){return this.name+": "+this.message}}),derive(ModifyError).from(DexieError),derive(BulkError).from(DexieError);var errnames=errorList.reduce(function(obj,name){return obj[name]=name+"Error",obj},{}),BaseException=DexieError,exceptions=errorList.reduce(function(obj,name){function DexieError(msgOrInner,inner){this._e=getErrorWithStack(),this.name=fullName,msgOrInner?"string"==typeof msgOrInner?(this.message=msgOrInner,this.inner=inner||null):"object"==typeof msgOrInner&&(this.message=msgOrInner.name+" "+msgOrInner.message,this.inner=msgOrInner):(this.message=defaultTexts[name]||fullName,this.inner=null)}var fullName=name+"Error";return derive(DexieError).from(BaseException),obj[name]=DexieError,obj},{});exceptions.Syntax=SyntaxError,exceptions.Type=TypeError,exceptions.Range=RangeError;var exceptionMap=idbDomErrorNames.reduce(function(obj,name){return obj[name+"Error"]=exceptions[name],obj},{}),fullNameExceptions=errorList.reduce(function(obj,name){return["Syntax","Type","Range"].indexOf(name)===-1&&(obj[name+"Error"]=exceptions[name]),obj},{});fullNameExceptions.ModifyError=ModifyError,fullNameExceptions.DexieError=DexieError,fullNameExceptions.BulkError=BulkError;var INTERNAL={},LONG_STACKS_CLIP_LIMIT=100,MAX_LONG_STACKS=20,stack_being_generated=!1,schedulePhysicalTick=_global.setImmediate?setImmediate.bind(null,physicalTick):_global.MutationObserver?function(){var hiddenDiv=document.createElement("div");new MutationObserver(function(){physicalTick(),hiddenDiv=null}).observe(hiddenDiv,{attributes:!0}),hiddenDiv.setAttribute("i","1")}:function(){setTimeout(physicalTick,0)},asap$1=function(callback,args){microtickQueue.push([callback,args]),needsNewPhysicalTick&&(schedulePhysicalTick(),needsNewPhysicalTick=!1)},isOutsideMicroTick=!0,needsNewPhysicalTick=!0,unhandledErrors=[],rejectingErrors=[],currentFulfiller=null,rejectionMapper=mirror,globalPSD={global:!0,ref:0,unhandleds:[],onunhandled:globalError,finalize:function(){this.unhandleds.forEach(function(uh){try{globalError(uh[0],uh[1])}catch(e){}})}},PSD=globalPSD,microtickQueue=[],numScheduledCalls=0,tickFinalizers=[];props(Promise.prototype,{then:function(onFulfilled,onRejected){var _this=this,rv=new Promise(function(resolve,reject){propagateToListener(_this,new Listener(onFulfilled,onRejected,resolve,reject))});return debug&&(!this._prev||null===this._state)&&linkToPreviousPromise(rv,this),rv},_then:function(onFulfilled,onRejected){propagateToListener(this,new Listener(null,null,onFulfilled,onRejected))},catch:function(onRejected){if(1===arguments.length)return this.then(null,onRejected);var type=arguments[0],handler=arguments[1];return"function"==typeof type?this.then(null,function(err){return err instanceof type?handler(err):PromiseReject(err)}):this.then(null,function(err){return err&&err.name===type?handler(err):PromiseReject(err)})},finally:function(onFinally){return this.then(function(value){return onFinally(),value},function(err){return onFinally(),PromiseReject(err)})},uncaught:function(uncaughtHandler){var _this2=this;return this.onuncatched=reverseStoppableEventChain(this.onuncatched,uncaughtHandler),this._state===!1&&unhandledErrors.indexOf(this)===-1&&unhandledErrors.some(function(p,i,l){return p._value===_this2._value&&(l[i]=_this2)}),this},stack:{get:function(){if(this._stack)return this._stack;try{stack_being_generated=!0;var stacks=getStack(this,[],MAX_LONG_STACKS),stack=stacks.join("\nFrom previous: ");return null!==this._state&&(this._stack=stack),stack}finally{stack_being_generated=!1}}}}),props(Promise,{all:function(){var values=getArrayOf.apply(null,arguments);return new Promise(function(resolve,reject){0===values.length&&resolve([]);var remaining=values.length;values.forEach(function(a,i){return Promise.resolve(a).then(function(x){values[i]=x,--remaining||resolve(values)},reject)})})},resolve:function(value){return value instanceof Promise?value:value&&"function"==typeof value.then?new Promise(function(resolve,reject){value.then(resolve,reject)}):new Promise(INTERNAL,!0,value)},reject:PromiseReject,race:function(){var values=getArrayOf.apply(null,arguments);return new Promise(function(resolve,reject){values.map(function(value){return Promise.resolve(value).then(resolve,reject)})})},PSD:{get:function(){return PSD},set:function(value){return PSD=value}},newPSD:newScope,usePSD:usePSD,scheduler:{get:function(){return asap$1},set:function(value){asap$1=value}},rejectionMapper:{get:function(){return rejectionMapper},set:function(value){rejectionMapper=value}},follow:function(fn){return new Promise(function(resolve,reject){return newScope(function(resolve,reject){var psd=PSD;psd.unhandleds=[],psd.onunhandled=reject,psd.finalize=callBoth(function(){var _this3=this;run_at_end_of_this_or_next_physical_tick(function(){0===_this3.unhandleds.length?resolve():reject(_this3.unhandleds[0])})},psd.finalize),fn()},resolve,reject)})},on:Events(null,{error:[reverseStoppableEventChain,defaultErrorHandler]})});var PromiseOnError=Promise.on.error;PromiseOnError.subscribe=deprecated("Promise.on('error')",PromiseOnError.subscribe),PromiseOnError.unsubscribe=deprecated("Promise.on('error').unsubscribe",PromiseOnError.unsubscribe);var UNHANDLEDREJECTION="unhandledrejection";doFakeAutoComplete(function(){asap$1=function(fn,args){setTimeout(function(){fn.apply(null,args)},0)}});var DEXIE_VERSION="1.5.0",maxString=String.fromCharCode(65535),maxKey=function(){try{return IDBKeyRange.only([[]]),[[]]}catch(e){return maxString}}(),INVALID_KEY_ARGUMENT="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",STRING_EXPECTED="String expected.",connections=[],isIEOrEdge="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),hasIEDeleteObjectStoreBug=isIEOrEdge,hangsOnDeleteLargeKeyRange=isIEOrEdge,dexieStackFrameFilter=function(frame){return!/(dexie\.js|dexie\.min\.js)/.test(frame)};setDebug(debug,dexieStackFrameFilter);var fakeAutoComplete=function(){},fake=!1,idbshim=_global.idbModules&&_global.idbModules.shimIndexedDB?_global.idbModules:{};return props(Dexie,fullNameExceptions),props(Dexie,{delete:function(databaseName){var db=new Dexie(databaseName),promise=db.delete();return promise.onblocked=function(fn){return db.on("blocked",fn),this},promise},exists:function(name){return new Dexie(name).open().then(function(db){return db.close(),!0}).catch(Dexie.NoSuchDatabaseError,function(){return!1})},getDatabaseNames:function(cb){return new Promise(function(resolve,reject){var getDatabaseNames=getNativeGetDatabaseNamesFn(indexedDB);if(getDatabaseNames){var req=getDatabaseNames();req.onsuccess=function(event){resolve(slice(event.target.result,0))},req.onerror=eventRejectHandler(reject)}else globalDatabaseList(function(val){return resolve(val),!1})}).then(cb)},defineClass:function(structure){function Class(properties){properties?extend(this,properties):fake&&applyStructure(this,structure)}return Class},applyStructure:applyStructure,ignoreTransaction:function(scopeFunc){return PSD.trans?usePSD(PSD.transless,scopeFunc):scopeFunc()},vip:function(fn){return newScope(function(){return PSD.letThrough=!0,fn()})},async:function(generatorFn){return function(){try{var rv=awaitIterator(generatorFn.apply(this,arguments));return rv&&"function"==typeof rv.then?rv:Promise.resolve(rv)}catch(e){return rejection(e)}}},spawn:function(generatorFn,args,thiz){try{var rv=awaitIterator(generatorFn.apply(thiz,args||[]));return rv&&"function"==typeof rv.then?rv:Promise.resolve(rv)}catch(e){return rejection(e)}},currentTransaction:{get:function(){return PSD.trans||null}},Promise:Promise,debug:{get:function(){return debug},set:function(value){setDebug(value,"dexie"===value?function(){return!0}:dexieStackFrameFilter)}},derive:derive,extend:extend,props:props,override:override,Events:Events,events:{get:deprecated(function(){return Events})},getByKeyPath:getByKeyPath,setByKeyPath:setByKeyPath,delByKeyPath:delByKeyPath,shallowClone:shallowClone,deepClone:deepClone,getObjectDiff:getObjectDiff,asap:asap,maxKey:maxKey,addons:[],connections:connections,MultiModifyError:exceptions.Modify,errnames:errnames,IndexSpec:IndexSpec,TableSchema:TableSchema,dependencies:{indexedDB:idbshim.shimIndexedDB||_global.indexedDB||_global.mozIndexedDB||_global.webkitIndexedDB||_global.msIndexedDB,IDBKeyRange:idbshim.IDBKeyRange||_global.IDBKeyRange||_global.webkitIDBKeyRange},semVer:DEXIE_VERSION,version:DEXIE_VERSION.split(".").map(function(n){return parseInt(n)}).reduce(function(p,c,i){return p+c/Math.pow(10,2*i)}),fakeAutoComplete:fakeAutoComplete,default:Dexie}),tryCatch(function(){Dexie.dependencies.localStorage=null!=("undefined"!=typeof chrome&&null!==chrome?chrome.storage:void 0)?null:_global.localStorage}),Promise.rejectionMapper=mapError,doFakeAutoComplete(function(){Dexie.fakeAutoComplete=fakeAutoComplete=doFakeAutoComplete,
|
||
Dexie.fake=fake=!0}),Dexie})}).call(exports,__webpack_require__(10),__webpack_require__(27).setImmediate)},function(module,exports,__webpack_require__){"use strict";(function(Buffer){function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function lastIndex(arr){return arr.length-1}function last(arr){return arr[lastIndex(arr)]}function ensureBuffer(data){return Buffer.isBuffer(data)?data:Buffer.from(data)}var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),Dexie=__webpack_require__(153),_write=__webpack_require__(192),pushable=__webpack_require__(169),toBuffer=__webpack_require__(193),defer=__webpack_require__(168),toWindow=__webpack_require__(191).recent,pull=__webpack_require__(77);module.exports=function(){function IdbBlobStore(dbname){_classCallCheck(this,IdbBlobStore),this.path=dbname||"pull-blob-store-"+Math.random().toString().slice(2,10),this.db=new Dexie(this.path),this.db.version(1).stores(_defineProperty({},this.path,"++,key,blob"))}return _createClass(IdbBlobStore,[{key:"write",value:function(key,cb){var _this=this;cb=cb||function(){};var d=defer();return key?(this.remove(key,function(err){function writer(data,cb){var blobs=data.map(function(blob){return{key:key,blob:blob}});table.bulkPut(blobs).then(function(){return cb()}).catch(cb)}function reduce(queue,data){return queue=queue||[],Array.isArray(data)||(data=[data]),data=data.map(ensureBuffer),!queue.length||last(queue).length>99?queue.push(Buffer.concat(data)):queue[lastIndex(queue)]=Buffer.concat(last(queue).concat(data)),queue}if(err)return cb(err);var table=_this.table;d.resolve(pull(toWindow(100,10),_write(writer,reduce,100,cb)))}),d):(cb(new Error("Missing key")),d)}},{key:"read",value:function(key){var _this2=this,p=pushable();return key?(this.exists(key,function(err,exists){return err?p.end(err):exists?void _this2.table.where("key").equals(key).each(function(val){return p.push(toBuffer(val.blob))}).catch(function(err){return p.end(err)}).then(function(){return p.end()}):p.end(new Error("Not found"))}),p):(p.end(new Error("Missing key")),p)}},{key:"exists",value:function(key,cb){return cb=cb||function(){},key?void this.table.where("key").equals(key).count().then(function(val){return cb(null,Boolean(val))}).catch(cb):cb(new Error("Missing key"))}},{key:"remove",value:function(key,cb){if(cb=cb||function(){},!key)return cb(new Error("Missing key"));var coll=this.table.where("key").equals(key);coll.count(function(count){return count>0?coll.delete():null}).then(function(){return cb()}).catch(cb)}},{key:"table",get:function(){return this.db[this.path]}}]),IdbBlobStore}()}).call(exports,__webpack_require__(18).Buffer)},function(module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=8*nBytes-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];for(i+=d,e=s&(1<<-nBits)-1,s>>=-nBits,nBits+=eLen;nBits>0;e=256*e+buffer[offset+i],i+=d,nBits-=8);for(m=e&(1<<-nBits)-1,e>>=-nBits,nBits+=mLen;nBits>0;m=256*m+buffer[offset+i],i+=d,nBits-=8);if(0===e)e=1-eBias;else{if(e===eMax)return m?NaN:(s?-1:1)*(1/0);m+=Math.pow(2,mLen),e-=eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)},exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=8*nBytes-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,rt=23===mLen?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||0===value&&1/value<0?1:0;for(value=Math.abs(value),isNaN(value)||value===1/0?(m=isNaN(value)?1:0,e=eMax):(e=Math.floor(Math.log(value)/Math.LN2),value*(c=Math.pow(2,-e))<1&&(e--,c*=2),value+=e+eBias>=1?rt/c:rt*Math.pow(2,1-eBias),value*c>=2&&(e++,c/=2),e+eBias>=eMax?(m=0,e=eMax):e+eBias>=1?(m=(value*c-1)*Math.pow(2,mLen),e+=eBias):(m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen),e=0));mLen>=8;buffer[offset+i]=255&m,i+=d,m/=256,mLen-=8);for(e=e<<mLen|m,eLen+=mLen;eLen>0;buffer[offset+i]=255&e,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=128*s}},function(module,exports){"function"==typeof Object.create?module.exports=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}},function(module,exports){function isTypedArray(arr){return isStrictTypedArray(arr)||isLooseTypedArray(arr)}function isStrictTypedArray(arr){return arr instanceof Int8Array||arr instanceof Int16Array||arr instanceof Int32Array||arr instanceof Uint8Array||arr instanceof Uint8ClampedArray||arr instanceof Uint16Array||arr instanceof Uint32Array||arr instanceof Float32Array||arr instanceof Float64Array}function isLooseTypedArray(arr){return names[toString.call(arr)]}module.exports=isTypedArray,isTypedArray.strict=isStrictTypedArray,isTypedArray.loose=isLooseTypedArray;var toString=Object.prototype.toString,names={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0}},function(module,exports){var toString={}.toString;module.exports=Array.isArray||function(arr){return"[object Array]"==toString.call(arr)}},function(module,exports,__webpack_require__){(function(setImmediate){module.exports=function(){function _releaser(key,exec){return function(done){return function(){_release(key,exec),done&&done.apply(null,arguments)}}}function _release(key,exec){var i=locked[key].indexOf(exec);~i&&(locked[key].splice(i,1),isLocked(key)?next(function(){locked[key][0](_releaser(key,locked[key][0]))}):delete locked[key])}function _lock(key,exec){return isLocked(key)?(locked[key].push(exec),!1):(locked[key]=[exec],!0)}function lock(key,exec){function releaser(done){return function(){var args=[].slice.call(arguments);for(var key in l)_release(key,l[key]);done.apply(this,args)}}if(Array.isArray(key)){var keys=key.length,l={};return void key.forEach(function(key){function ready(){n++||--keys||exec(releaser)}var n=0;l[key]=ready,_lock(key,ready)&&ready()})}_lock(key,exec)&&exec(_releaser(key,exec))}function isLocked(key){return!!Array.isArray(locked[key])&&!!locked[key].length}var next="undefined"==typeof setImmediate?setTimeout:setImmediate,locked={};return lock.isLocked=isLocked,lock}}).call(exports,__webpack_require__(27).setImmediate)},function(module,exports,__webpack_require__){(function(global){function apply(func,thisArg,args){switch(args.length){case 0:return func.call(thisArg);case 1:return func.call(thisArg,args[0]);case 2:return func.call(thisArg,args[0],args[1]);case 3:return func.call(thisArg,args[0],args[1],args[2])}return func.apply(thisArg,args)}function arrayIncludes(array,value){var length=array?array.length:0;return!!length&&baseIndexOf(array,value,0)>-1}function arrayIncludesWith(array,value,comparator){for(var index=-1,length=array?array.length:0;++index<length;)if(comparator(value,array[index]))return!0;return!1}function arrayMap(array,iteratee){for(var index=-1,length=array?array.length:0,result=Array(length);++index<length;)result[index]=iteratee(array[index],index,array);return result}function arrayPush(array,values){for(var index=-1,length=values.length,offset=array.length;++index<length;)array[offset+index]=values[index];return array}function baseFindIndex(array,predicate,fromIndex,fromRight){for(var length=array.length,index=fromIndex+(fromRight?1:-1);fromRight?index--:++index<length;)if(predicate(array[index],index,array))return index;return-1}function baseIndexOf(array,value,fromIndex){if(value!==value)return baseFindIndex(array,baseIsNaN,fromIndex);for(var index=fromIndex-1,length=array.length;++index<length;)if(array[index]===value)return index;return-1}function baseIsNaN(value){return value!==value}function baseUnary(func){return function(value){return func(value)}}function cacheHas(cache,key){return cache.has(key)}function getValue(object,key){return null==object?void 0:object[key]}function isHostObject(value){var result=!1;if(null!=value&&"function"!=typeof value.toString)try{result=!!(value+"")}catch(e){}return result}function Hash(entries){var index=-1,length=entries?entries.length:0;for(this.clear();++index<length;){var entry=entries[index];this.set(entry[0],entry[1])}}function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{}}function hashDelete(key){return this.has(key)&&delete this.__data__[key]}function hashGet(key){var data=this.__data__;if(nativeCreate){var result=data[key];return result===HASH_UNDEFINED?void 0:result}return hasOwnProperty.call(data,key)?data[key]:void 0}function hashHas(key){var data=this.__data__;return nativeCreate?void 0!==data[key]:hasOwnProperty.call(data,key)}function hashSet(key,value){var data=this.__data__;return data[key]=nativeCreate&&void 0===value?HASH_UNDEFINED:value,this}function ListCache(entries){var index=-1,length=entries?entries.length:0;for(this.clear();++index<length;){var entry=entries[index];this.set(entry[0],entry[1])}}function listCacheClear(){this.__data__=[]}function listCacheDelete(key){var data=this.__data__,index=assocIndexOf(data,key);if(index<0)return!1;var lastIndex=data.length-1;return index==lastIndex?data.pop():splice.call(data,index,1),!0}function listCacheGet(key){var data=this.__data__,index=assocIndexOf(data,key);return index<0?void 0:data[index][1]}function listCacheHas(key){return assocIndexOf(this.__data__,key)>-1}function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);return index<0?data.push([key,value]):data[index][1]=value,this}function MapCache(entries){var index=-1,length=entries?entries.length:0;for(this.clear();++index<length;){var entry=entries[index];this.set(entry[0],entry[1])}}function mapCacheClear(){this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}function mapCacheDelete(key){return getMapData(this,key).delete(key)}function mapCacheGet(key){return getMapData(this,key).get(key)}function mapCacheHas(key){return getMapData(this,key).has(key)}function mapCacheSet(key,value){return getMapData(this,key).set(key,value),this}function SetCache(values){var index=-1,length=values?values.length:0;for(this.__data__=new MapCache;++index<length;)this.add(values[index])}function setCacheAdd(value){return this.__data__.set(value,HASH_UNDEFINED),this}function setCacheHas(value){return this.__data__.has(value)}function assocIndexOf(array,key){for(var length=array.length;length--;)if(eq(array[length][0],key))return length;return-1}function baseDifference(array,values,iteratee,comparator){var index=-1,includes=arrayIncludes,isCommon=!0,length=array.length,result=[],valuesLength=values.length;if(!length)return result;iteratee&&(values=arrayMap(values,baseUnary(iteratee))),comparator?(includes=arrayIncludesWith,isCommon=!1):values.length>=LARGE_ARRAY_SIZE&&(includes=cacheHas,isCommon=!1,values=new SetCache(values));outer:for(;++index<length;){var value=array[index],computed=iteratee?iteratee(value):value;if(value=comparator||0!==value?value:0,isCommon&&computed===computed){for(var valuesIndex=valuesLength;valuesIndex--;)if(values[valuesIndex]===computed)continue outer;result.push(value)}else includes(values,computed,comparator)||result.push(value)}return result}function baseFlatten(array,depth,predicate,isStrict,result){var index=-1,length=array.length;for(predicate||(predicate=isFlattenable),result||(result=[]);++index<length;){var value=array[index];depth>0&&predicate(value)?depth>1?baseFlatten(value,depth-1,predicate,isStrict,result):arrayPush(result,value):isStrict||(result[result.length]=value)}return result}function baseIsNative(value){if(!isObject(value)||isMasked(value))return!1;var pattern=isFunction(value)||isHostObject(value)?reIsNative:reIsHostCtor;return pattern.test(toSource(value))}function baseRest(func,start){return start=nativeMax(void 0===start?func.length-1:start,0),function(){for(var args=arguments,index=-1,length=nativeMax(args.length-start,0),array=Array(length);++index<length;)array[index]=args[start+index];index=-1;for(var otherArgs=Array(start+1);++index<start;)otherArgs[index]=args[index];return otherArgs[start]=array,apply(func,this,otherArgs)}}function getMapData(map,key){var data=map.__data__;return isKeyable(key)?data["string"==typeof key?"string":"hash"]:data.map}function getNative(object,key){var value=getValue(object,key);return baseIsNative(value)?value:void 0}function isFlattenable(value){return isArray(value)||isArguments(value)||!!(spreadableSymbol&&value&&value[spreadableSymbol])}function isKeyable(value){var type=typeof value;return"string"==type||"number"==type||"symbol"==type||"boolean"==type?"__proto__"!==value:null===value}function isMasked(func){return!!maskSrcKey&&maskSrcKey in func}function toSource(func){if(null!=func){try{return funcToString.call(func)}catch(e){}try{return func+""}catch(e){}}return""}function last(array){var length=array?array.length:0;return length?array[length-1]:void 0}function eq(value,other){return value===other||value!==value&&other!==other}function isArguments(value){return isArrayLikeObject(value)&&hasOwnProperty.call(value,"callee")&&(!propertyIsEnumerable.call(value,"callee")||objectToString.call(value)==argsTag)}function isArrayLike(value){return null!=value&&isLength(value.length)&&!isFunction(value)}function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value)}function isFunction(value){var tag=isObject(value)?objectToString.call(value):"";return tag==funcTag||tag==genTag}function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}function isObjectLike(value){return!!value&&"object"==typeof value}var LARGE_ARRAY_SIZE=200,HASH_UNDEFINED="__lodash_hash_undefined__",MAX_SAFE_INTEGER=9007199254740991,argsTag="[object Arguments]",funcTag="[object Function]",genTag="[object GeneratorFunction]",reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,freeGlobal="object"==typeof global&&global&&global.Object===Object&&global,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),arrayProto=Array.prototype,funcProto=Function.prototype,objectProto=Object.prototype,coreJsData=root["__core-js_shared__"],maskSrcKey=function(){var uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return uid?"Symbol(src)_1."+uid:""}(),funcToString=funcProto.toString,hasOwnProperty=objectProto.hasOwnProperty,objectToString=objectProto.toString,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Symbol=root.Symbol,propertyIsEnumerable=objectProto.propertyIsEnumerable,splice=arrayProto.splice,spreadableSymbol=Symbol?Symbol.isConcatSpreadable:void 0,nativeMax=Math.max,Map=getNative(root,"Map"),nativeCreate=getNative(Object,"create");Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet,ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet,MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet,SetCache.prototype.add=SetCache.prototype.push=setCacheAdd,SetCache.prototype.has=setCacheHas;var differenceWith=baseRest(function(array,values){var comparator=last(values);return isArrayLikeObject(comparator)&&(comparator=void 0),isArrayLikeObject(array)?baseDifference(array,baseFlatten(values,1,isArrayLikeObject,!0),void 0,comparator):[]}),isArray=Array.isArray;module.exports=differenceWith}).call(exports,__webpack_require__(10))},function(module,exports,__webpack_require__){(function(global,module){function arraySome(array,predicate){for(var index=-1,length=array?array.length:0;++index<length;)if(predicate(array[index],index,array))return!0;return!1}function baseFindIndex(array,predicate,fromIndex,fromRight){for(var length=array.length,index=fromIndex+(fromRight?1:-1);fromRight?index--:++index<length;)if(predicate(array[index],index,array))return index;return-1}function baseProperty(key){return function(object){return null==object?void 0:object[key]}}function baseTimes(n,iteratee){for(var index=-1,result=Array(n);++index<n;)result[index]=iteratee(index);return result}function baseUnary(func){return function(value){return func(value)}}function getValue(object,key){return null==object?void 0:object[key]}function isHostObject(value){var result=!1;if(null!=value&&"function"!=typeof value.toString)try{result=!!(value+"")}catch(e){}return result}function mapToArray(map){var index=-1,result=Array(map.size);return map.forEach(function(value,key){result[++index]=[key,value]}),result}function overArg(func,transform){return function(arg){return func(transform(arg))}}function setToArray(set){var index=-1,result=Array(set.size);return set.forEach(function(value){result[++index]=value}),result}function Hash(entries){var index=-1,length=entries?entries.length:0;for(this.clear();++index<length;){var entry=entries[index];this.set(entry[0],entry[1])}}function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{}}function hashDelete(key){return this.has(key)&&delete this.__data__[key]}function hashGet(key){var data=this.__data__;if(nativeCreate){var result=data[key];return result===HASH_UNDEFINED?void 0:result}return hasOwnProperty.call(data,key)?data[key]:void 0}function hashHas(key){var data=this.__data__;return nativeCreate?void 0!==data[key]:hasOwnProperty.call(data,key)}function hashSet(key,value){var data=this.__data__;return data[key]=nativeCreate&&void 0===value?HASH_UNDEFINED:value,this}function ListCache(entries){var index=-1,length=entries?entries.length:0;for(this.clear();++index<length;){var entry=entries[index];this.set(entry[0],entry[1])}}function listCacheClear(){this.__data__=[]}function listCacheDelete(key){var data=this.__data__,index=assocIndexOf(data,key);if(index<0)return!1;var lastIndex=data.length-1;return index==lastIndex?data.pop():splice.call(data,index,1),!0}function listCacheGet(key){var data=this.__data__,index=assocIndexOf(data,key);return index<0?void 0:data[index][1]}function listCacheHas(key){return assocIndexOf(this.__data__,key)>-1}function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);return index<0?data.push([key,value]):data[index][1]=value,this}function MapCache(entries){var index=-1,length=entries?entries.length:0;for(this.clear();++index<length;){var entry=entries[index];this.set(entry[0],entry[1])}}function mapCacheClear(){this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}function mapCacheDelete(key){return getMapData(this,key).delete(key)}function mapCacheGet(key){return getMapData(this,key).get(key)}function mapCacheHas(key){return getMapData(this,key).has(key)}function mapCacheSet(key,value){return getMapData(this,key).set(key,value),this}function SetCache(values){var index=-1,length=values?values.length:0;for(this.__data__=new MapCache;++index<length;)this.add(values[index])}function setCacheAdd(value){return this.__data__.set(value,HASH_UNDEFINED),this}function setCacheHas(value){return this.__data__.has(value)}function Stack(entries){this.__data__=new ListCache(entries)}function stackClear(){this.__data__=new ListCache}function stackDelete(key){return this.__data__.delete(key)}function stackGet(key){return this.__data__.get(key)}function stackHas(key){return this.__data__.has(key)}function stackSet(key,value){var cache=this.__data__;if(cache instanceof ListCache){var pairs=cache.__data__;if(!Map||pairs.length<LARGE_ARRAY_SIZE-1)return pairs.push([key,value]),this;cache=this.__data__=new MapCache(pairs)}return cache.set(key,value),this}function arrayLikeKeys(value,inherited){var result=isArray(value)||isArguments(value)?baseTimes(value.length,String):[],length=result.length,skipIndexes=!!length;for(var key in value)!inherited&&!hasOwnProperty.call(value,key)||skipIndexes&&("length"==key||isIndex(key,length))||result.push(key);return result}function assocIndexOf(array,key){for(var length=array.length;length--;)if(eq(array[length][0],key))return length;return-1}function baseGet(object,path){path=isKey(path,object)?[path]:castPath(path);for(var index=0,length=path.length;null!=object&&index<length;)object=object[toKey(path[index++])];return index&&index==length?object:void 0}function baseGetTag(value){return objectToString.call(value)}function baseHasIn(object,key){return null!=object&&key in Object(object)}function baseIsEqual(value,other,customizer,bitmask,stack){return value===other||(null==value||null==other||!isObject(value)&&!isObjectLike(other)?value!==value&&other!==other:baseIsEqualDeep(value,other,baseIsEqual,customizer,bitmask,stack))}function baseIsEqualDeep(object,other,equalFunc,customizer,bitmask,stack){var objIsArr=isArray(object),othIsArr=isArray(other),objTag=arrayTag,othTag=arrayTag;objIsArr||(objTag=getTag(object),objTag=objTag==argsTag?objectTag:objTag),othIsArr||(othTag=getTag(other),othTag=othTag==argsTag?objectTag:othTag);var objIsObj=objTag==objectTag&&!isHostObject(object),othIsObj=othTag==objectTag&&!isHostObject(other),isSameTag=objTag==othTag;if(isSameTag&&!objIsObj)return stack||(stack=new Stack),objIsArr||isTypedArray(object)?equalArrays(object,other,equalFunc,customizer,bitmask,stack):equalByTag(object,other,objTag,equalFunc,customizer,bitmask,stack);if(!(bitmask&PARTIAL_COMPARE_FLAG)){var objIsWrapped=objIsObj&&hasOwnProperty.call(object,"__wrapped__"),othIsWrapped=othIsObj&&hasOwnProperty.call(other,"__wrapped__");if(objIsWrapped||othIsWrapped){var objUnwrapped=objIsWrapped?object.value():object,othUnwrapped=othIsWrapped?other.value():other;return stack||(stack=new Stack),equalFunc(objUnwrapped,othUnwrapped,customizer,bitmask,stack)}}return!!isSameTag&&(stack||(stack=new Stack),equalObjects(object,other,equalFunc,customizer,bitmask,stack))}function baseIsMatch(object,source,matchData,customizer){var index=matchData.length,length=index,noCustomizer=!customizer;if(null==object)return!length;for(object=Object(object);index--;){var data=matchData[index];if(noCustomizer&&data[2]?data[1]!==object[data[0]]:!(data[0]in object))return!1}for(;++index<length;){data=matchData[index];var key=data[0],objValue=object[key],srcValue=data[1];if(noCustomizer&&data[2]){if(void 0===objValue&&!(key in object))return!1}else{var stack=new Stack;if(customizer)var result=customizer(objValue,srcValue,key,object,source,stack);if(!(void 0===result?baseIsEqual(srcValue,objValue,customizer,UNORDERED_COMPARE_FLAG|PARTIAL_COMPARE_FLAG,stack):result))return!1}}return!0}function baseIsNative(value){if(!isObject(value)||isMasked(value))return!1;var pattern=isFunction(value)||isHostObject(value)?reIsNative:reIsHostCtor;return pattern.test(toSource(value))}function baseIsTypedArray(value){return isObjectLike(value)&&isLength(value.length)&&!!typedArrayTags[objectToString.call(value)]}function baseIteratee(value){return"function"==typeof value?value:null==value?identity:"object"==typeof value?isArray(value)?baseMatchesProperty(value[0],value[1]):baseMatches(value):property(value)}function baseKeys(object){if(!isPrototype(object))return nativeKeys(object);var result=[];for(var key in Object(object))hasOwnProperty.call(object,key)&&"constructor"!=key&&result.push(key);return result}function baseMatches(source){var matchData=getMatchData(source);return 1==matchData.length&&matchData[0][2]?matchesStrictComparable(matchData[0][0],matchData[0][1]):function(object){return object===source||baseIsMatch(object,source,matchData)}}function baseMatchesProperty(path,srcValue){return isKey(path)&&isStrictComparable(srcValue)?matchesStrictComparable(toKey(path),srcValue):function(object){var objValue=get(object,path);return void 0===objValue&&objValue===srcValue?hasIn(object,path):baseIsEqual(srcValue,objValue,void 0,UNORDERED_COMPARE_FLAG|PARTIAL_COMPARE_FLAG)}}function basePropertyDeep(path){return function(object){return baseGet(object,path)}}function baseToString(value){if("string"==typeof value)return value;if(isSymbol(value))return symbolToString?symbolToString.call(value):"";var result=value+"";return"0"==result&&1/value==-INFINITY?"-0":result}function castPath(value){return isArray(value)?value:stringToPath(value)}function equalArrays(array,other,equalFunc,customizer,bitmask,stack){var isPartial=bitmask&PARTIAL_COMPARE_FLAG,arrLength=array.length,othLength=other.length;if(arrLength!=othLength&&!(isPartial&&othLength>arrLength))return!1;var stacked=stack.get(array);if(stacked&&stack.get(other))return stacked==other;var index=-1,result=!0,seen=bitmask&UNORDERED_COMPARE_FLAG?new SetCache:void 0;for(stack.set(array,other),stack.set(other,array);++index<arrLength;){var arrValue=array[index],othValue=other[index];if(customizer)var compared=isPartial?customizer(othValue,arrValue,index,other,array,stack):customizer(arrValue,othValue,index,array,other,stack);if(void 0!==compared){if(compared)continue;result=!1;break}if(seen){if(!arraySome(other,function(othValue,othIndex){if(!seen.has(othIndex)&&(arrValue===othValue||equalFunc(arrValue,othValue,customizer,bitmask,stack)))return seen.add(othIndex)})){result=!1;break}}else if(arrValue!==othValue&&!equalFunc(arrValue,othValue,customizer,bitmask,stack)){result=!1;break}}return stack.delete(array),stack.delete(other),result}function equalByTag(object,other,tag,equalFunc,customizer,bitmask,stack){switch(tag){case dataViewTag:if(object.byteLength!=other.byteLength||object.byteOffset!=other.byteOffset)return!1;object=object.buffer,other=other.buffer;case arrayBufferTag:return!(object.byteLength!=other.byteLength||!equalFunc(new Uint8Array(object),new Uint8Array(other)));case boolTag:case dateTag:case numberTag:return eq(+object,+other);case errorTag:return object.name==other.name&&object.message==other.message;case regexpTag:case stringTag:return object==other+"";case mapTag:var convert=mapToArray;case setTag:var isPartial=bitmask&PARTIAL_COMPARE_FLAG;if(convert||(convert=setToArray),object.size!=other.size&&!isPartial)return!1;var stacked=stack.get(object);if(stacked)return stacked==other;bitmask|=UNORDERED_COMPARE_FLAG,stack.set(object,other);var result=equalArrays(convert(object),convert(other),equalFunc,customizer,bitmask,stack);return stack.delete(object),result;case symbolTag:if(symbolValueOf)return symbolValueOf.call(object)==symbolValueOf.call(other)}return!1}function equalObjects(object,other,equalFunc,customizer,bitmask,stack){var isPartial=bitmask&PARTIAL_COMPARE_FLAG,objProps=keys(object),objLength=objProps.length,othProps=keys(other),othLength=othProps.length;if(objLength!=othLength&&!isPartial)return!1;for(var index=objLength;index--;){var key=objProps[index];if(!(isPartial?key in other:hasOwnProperty.call(other,key)))return!1}var stacked=stack.get(object);if(stacked&&stack.get(other))return stacked==other;var result=!0;stack.set(object,other),stack.set(other,object);for(var skipCtor=isPartial;++index<objLength;){key=objProps[index];var objValue=object[key],othValue=other[key];if(customizer)var compared=isPartial?customizer(othValue,objValue,key,other,object,stack):customizer(objValue,othValue,key,object,other,stack);if(!(void 0===compared?objValue===othValue||equalFunc(objValue,othValue,customizer,bitmask,stack):compared)){result=!1;break}skipCtor||(skipCtor="constructor"==key)}if(result&&!skipCtor){var objCtor=object.constructor,othCtor=other.constructor;objCtor!=othCtor&&"constructor"in object&&"constructor"in other&&!("function"==typeof objCtor&&objCtor instanceof objCtor&&"function"==typeof othCtor&&othCtor instanceof othCtor)&&(result=!1)}return stack.delete(object),stack.delete(other),result}function getMapData(map,key){var data=map.__data__;return isKeyable(key)?data["string"==typeof key?"string":"hash"]:data.map}function getMatchData(object){for(var result=keys(object),length=result.length;length--;){var key=result[length],value=object[key];result[length]=[key,value,isStrictComparable(value)]}return result}function getNative(object,key){var value=getValue(object,key);return baseIsNative(value)?value:void 0}function hasPath(object,path,hasFunc){path=isKey(path,object)?[path]:castPath(path);for(var result,index=-1,length=path.length;++index<length;){var key=toKey(path[index]);if(!(result=null!=object&&hasFunc(object,key)))break;object=object[key]}if(result)return result;var length=object?object.length:0;return!!length&&isLength(length)&&isIndex(key,length)&&(isArray(object)||isArguments(object))}function isIndex(value,length){return length=null==length?MAX_SAFE_INTEGER:length,!!length&&("number"==typeof value||reIsUint.test(value))&&value>-1&&value%1==0&&value<length}function isKey(value,object){if(isArray(value))return!1;var type=typeof value;return!("number"!=type&&"symbol"!=type&&"boolean"!=type&&null!=value&&!isSymbol(value))||(reIsPlainProp.test(value)||!reIsDeepProp.test(value)||null!=object&&value in Object(object))}function isKeyable(value){var type=typeof value;return"string"==type||"number"==type||"symbol"==type||"boolean"==type?"__proto__"!==value:null===value}function isMasked(func){return!!maskSrcKey&&maskSrcKey in func}function isPrototype(value){var Ctor=value&&value.constructor,proto="function"==typeof Ctor&&Ctor.prototype||objectProto;return value===proto}function isStrictComparable(value){return value===value&&!isObject(value)}function matchesStrictComparable(key,srcValue){return function(object){return null!=object&&(object[key]===srcValue&&(void 0!==srcValue||key in Object(object)))}}function toKey(value){if("string"==typeof value||isSymbol(value))return value;var result=value+"";return"0"==result&&1/value==-INFINITY?"-0":result}function toSource(func){if(null!=func){try{return funcToString.call(func)}catch(e){}try{return func+""}catch(e){}}return""}function findIndex(array,predicate,fromIndex){var length=array?array.length:0;if(!length)return-1;var index=null==fromIndex?0:toInteger(fromIndex);return index<0&&(index=nativeMax(length+index,0)),baseFindIndex(array,baseIteratee(predicate,3),index)}function memoize(func,resolver){if("function"!=typeof func||resolver&&"function"!=typeof resolver)throw new TypeError(FUNC_ERROR_TEXT);var memoized=function(){var args=arguments,key=resolver?resolver.apply(this,args):args[0],cache=memoized.cache;if(cache.has(key))return cache.get(key);var result=func.apply(this,args);return memoized.cache=cache.set(key,result),result};return memoized.cache=new(memoize.Cache||MapCache),memoized}function eq(value,other){return value===other||value!==value&&other!==other}function isArguments(value){return isArrayLikeObject(value)&&hasOwnProperty.call(value,"callee")&&(!propertyIsEnumerable.call(value,"callee")||objectToString.call(value)==argsTag)}function isArrayLike(value){return null!=value&&isLength(value.length)&&!isFunction(value)}function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value)}function isFunction(value){
|
||
var tag=isObject(value)?objectToString.call(value):"";return tag==funcTag||tag==genTag}function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}function isObjectLike(value){return!!value&&"object"==typeof value}function isSymbol(value){return"symbol"==typeof value||isObjectLike(value)&&objectToString.call(value)==symbolTag}function toFinite(value){if(!value)return 0===value?value:0;if(value=toNumber(value),value===INFINITY||value===-INFINITY){var sign=value<0?-1:1;return sign*MAX_INTEGER}return value===value?value:0}function toInteger(value){var result=toFinite(value),remainder=result%1;return result===result?remainder?result-remainder:result:0}function toNumber(value){if("number"==typeof value)return value;if(isSymbol(value))return NAN;if(isObject(value)){var other="function"==typeof value.valueOf?value.valueOf():value;value=isObject(other)?other+"":other}if("string"!=typeof value)return 0===value?value:+value;value=value.replace(reTrim,"");var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value}function toString(value){return null==value?"":baseToString(value)}function get(object,path,defaultValue){var result=null==object?void 0:baseGet(object,path);return void 0===result?defaultValue:result}function hasIn(object,path){return null!=object&&hasPath(object,path,baseHasIn)}function keys(object){return isArrayLike(object)?arrayLikeKeys(object):baseKeys(object)}function identity(value){return value}function property(path){return isKey(path)?baseProperty(toKey(path)):basePropertyDeep(path)}var LARGE_ARRAY_SIZE=200,FUNC_ERROR_TEXT="Expected a function",HASH_UNDEFINED="__lodash_hash_undefined__",UNORDERED_COMPARE_FLAG=1,PARTIAL_COMPARE_FLAG=2,INFINITY=1/0,MAX_SAFE_INTEGER=9007199254740991,MAX_INTEGER=1.7976931348623157e308,NAN=NaN,argsTag="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag="[object Function]",genTag="[object GeneratorFunction]",mapTag="[object Map]",numberTag="[object Number]",objectTag="[object Object]",promiseTag="[object Promise]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",symbolTag="[object Symbol]",weakMapTag="[object WeakMap]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/,reLeadingDot=/^\./,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reTrim=/^\s+|\s+$/g,reEscapeChar=/\\(\\)?/g,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsHostCtor=/^\[object .+?Constructor\]$/,reIsOctal=/^0o[0-7]+$/i,reIsUint=/^(?:0|[1-9]\d*)$/,typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=!0,typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=!1;var freeParseInt=parseInt,freeGlobal="object"==typeof global&&global&&global.Object===Object&&global,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),freeExports="object"==typeof exports&&exports&&!exports.nodeType&&exports,freeModule=freeExports&&"object"==typeof module&&module&&!module.nodeType&&module,moduleExports=freeModule&&freeModule.exports===freeExports,freeProcess=moduleExports&&freeGlobal.process,nodeUtil=function(){try{return freeProcess&&freeProcess.binding("util")}catch(e){}}(),nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,arrayProto=Array.prototype,funcProto=Function.prototype,objectProto=Object.prototype,coreJsData=root["__core-js_shared__"],maskSrcKey=function(){var uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return uid?"Symbol(src)_1."+uid:""}(),funcToString=funcProto.toString,hasOwnProperty=objectProto.hasOwnProperty,objectToString=objectProto.toString,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Symbol=root.Symbol,Uint8Array=root.Uint8Array,propertyIsEnumerable=objectProto.propertyIsEnumerable,splice=arrayProto.splice,nativeKeys=overArg(Object.keys,Object),nativeMax=Math.max,DataView=getNative(root,"DataView"),Map=getNative(root,"Map"),Promise=getNative(root,"Promise"),Set=getNative(root,"Set"),WeakMap=getNative(root,"WeakMap"),nativeCreate=getNative(Object,"create"),dataViewCtorString=toSource(DataView),mapCtorString=toSource(Map),promiseCtorString=toSource(Promise),setCtorString=toSource(Set),weakMapCtorString=toSource(WeakMap),symbolProto=Symbol?Symbol.prototype:void 0,symbolValueOf=symbolProto?symbolProto.valueOf:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet,ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet,MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet,SetCache.prototype.add=SetCache.prototype.push=setCacheAdd,SetCache.prototype.has=setCacheHas,Stack.prototype.clear=stackClear,Stack.prototype.delete=stackDelete,Stack.prototype.get=stackGet,Stack.prototype.has=stackHas,Stack.prototype.set=stackSet;var getTag=baseGetTag;(DataView&&getTag(new DataView(new ArrayBuffer(1)))!=dataViewTag||Map&&getTag(new Map)!=mapTag||Promise&&getTag(Promise.resolve())!=promiseTag||Set&&getTag(new Set)!=setTag||WeakMap&&getTag(new WeakMap)!=weakMapTag)&&(getTag=function(value){var result=objectToString.call(value),Ctor=result==objectTag?value.constructor:void 0,ctorString=Ctor?toSource(Ctor):void 0;if(ctorString)switch(ctorString){case dataViewCtorString:return dataViewTag;case mapCtorString:return mapTag;case promiseCtorString:return promiseTag;case setCtorString:return setTag;case weakMapCtorString:return weakMapTag}return result});var stringToPath=memoize(function(string){string=toString(string);var result=[];return reLeadingDot.test(string)&&result.push(""),string.replace(rePropName,function(match,number,quote,string){result.push(quote?string.replace(reEscapeChar,"$1"):number||match)}),result});memoize.Cache=MapCache;var isArray=Array.isArray,isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray;module.exports=findIndex}).call(exports,__webpack_require__(10),__webpack_require__(196)(module))},function(module,exports,__webpack_require__){(function(global){function arrayPush(array,values){for(var index=-1,length=values.length,offset=array.length;++index<length;)array[offset+index]=values[index];return array}function baseFlatten(array,depth,predicate,isStrict,result){var index=-1,length=array.length;for(predicate||(predicate=isFlattenable),result||(result=[]);++index<length;){var value=array[index];depth>0&&predicate(value)?depth>1?baseFlatten(value,depth-1,predicate,isStrict,result):arrayPush(result,value):isStrict||(result[result.length]=value)}return result}function isFlattenable(value){return isArray(value)||isArguments(value)||!!(spreadableSymbol&&value&&value[spreadableSymbol])}function flatten(array){var length=array?array.length:0;return length?baseFlatten(array,1):[]}function isArguments(value){return isArrayLikeObject(value)&&hasOwnProperty.call(value,"callee")&&(!propertyIsEnumerable.call(value,"callee")||objectToString.call(value)==argsTag)}function isArrayLike(value){return null!=value&&isLength(value.length)&&!isFunction(value)}function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value)}function isFunction(value){var tag=isObject(value)?objectToString.call(value):"";return tag==funcTag||tag==genTag}function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}function isObjectLike(value){return!!value&&"object"==typeof value}var MAX_SAFE_INTEGER=9007199254740991,argsTag="[object Arguments]",funcTag="[object Function]",genTag="[object GeneratorFunction]",freeGlobal="object"==typeof global&&global&&global.Object===Object&&global,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,objectToString=objectProto.toString,Symbol=root.Symbol,propertyIsEnumerable=objectProto.propertyIsEnumerable,spreadableSymbol=Symbol?Symbol.isConcatSpreadable:void 0,isArray=Array.isArray;module.exports=flatten}).call(exports,__webpack_require__(10))},function(module,exports){function baseSlice(array,start,end){var index=-1,length=array.length;start<0&&(start=-start>length?0:length+start),end=end>length?length:end,end<0&&(end+=length),length=start>end?0:end-start>>>0,start>>>=0;for(var result=Array(length);++index<length;)result[index]=array[index+start];return result}function isIndex(value,length){return length=null==length?MAX_SAFE_INTEGER:length,!!length&&("number"==typeof value||reIsUint.test(value))&&value>-1&&value%1==0&&value<length}function isIterateeCall(value,index,object){if(!isObject(object))return!1;var type=typeof index;return!!("number"==type?isArrayLike(object)&&isIndex(index,object.length):"string"==type&&index in object)&&eq(object[index],value)}function slice(array,start,end){var length=array?array.length:0;return length?(end&&"number"!=typeof end&&isIterateeCall(array,start,end)?(start=0,end=length):(start=null==start?0:toInteger(start),end=void 0===end?length:toInteger(end)),baseSlice(array,start,end)):[]}function eq(value,other){return value===other||value!==value&&other!==other}function isArrayLike(value){return null!=value&&isLength(value.length)&&!isFunction(value)}function isFunction(value){var tag=isObject(value)?objectToString.call(value):"";return tag==funcTag||tag==genTag}function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}function isObjectLike(value){return!!value&&"object"==typeof value}function isSymbol(value){return"symbol"==typeof value||isObjectLike(value)&&objectToString.call(value)==symbolTag}function toFinite(value){if(!value)return 0===value?value:0;if(value=toNumber(value),value===INFINITY||value===-INFINITY){var sign=value<0?-1:1;return sign*MAX_INTEGER}return value===value?value:0}function toInteger(value){var result=toFinite(value),remainder=result%1;return result===result?remainder?result-remainder:result:0}function toNumber(value){if("number"==typeof value)return value;if(isSymbol(value))return NAN;if(isObject(value)){var other="function"==typeof value.valueOf?value.valueOf():value;value=isObject(other)?other+"":other}if("string"!=typeof value)return 0===value?value:+value;value=value.replace(reTrim,"");var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value}var INFINITY=1/0,MAX_SAFE_INTEGER=9007199254740991,MAX_INTEGER=1.7976931348623157e308,NAN=NaN,funcTag="[object Function]",genTag="[object GeneratorFunction]",symbolTag="[object Symbol]",reTrim=/^\s+|\s+$/g,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,reIsUint=/^(?:0|[1-9]\d*)$/,freeParseInt=parseInt,objectProto=Object.prototype,objectToString=objectProto.toString;module.exports=slice},function(module,exports,__webpack_require__){(function(global){function apply(func,thisArg,args){switch(args.length){case 0:return func.call(thisArg);case 1:return func.call(thisArg,args[0]);case 2:return func.call(thisArg,args[0],args[1]);case 3:return func.call(thisArg,args[0],args[1],args[2])}return func.apply(thisArg,args)}function arrayIncludes(array,value){var length=array?array.length:0;return!!length&&baseIndexOf(array,value,0)>-1}function arrayIncludesWith(array,value,comparator){for(var index=-1,length=array?array.length:0;++index<length;)if(comparator(value,array[index]))return!0;return!1}function arrayPush(array,values){for(var index=-1,length=values.length,offset=array.length;++index<length;)array[offset+index]=values[index];return array}function baseFindIndex(array,predicate,fromIndex,fromRight){for(var length=array.length,index=fromIndex+(fromRight?1:-1);fromRight?index--:++index<length;)if(predicate(array[index],index,array))return index;return-1}function baseIndexOf(array,value,fromIndex){if(value!==value)return baseFindIndex(array,baseIsNaN,fromIndex);for(var index=fromIndex-1,length=array.length;++index<length;)if(array[index]===value)return index;return-1}function baseIsNaN(value){return value!==value}function cacheHas(cache,key){return cache.has(key)}function getValue(object,key){return null==object?void 0:object[key]}function isHostObject(value){var result=!1;if(null!=value&&"function"!=typeof value.toString)try{result=!!(value+"")}catch(e){}return result}function setToArray(set){var index=-1,result=Array(set.size);return set.forEach(function(value){result[++index]=value}),result}function Hash(entries){var index=-1,length=entries?entries.length:0;for(this.clear();++index<length;){var entry=entries[index];this.set(entry[0],entry[1])}}function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{}}function hashDelete(key){return this.has(key)&&delete this.__data__[key]}function hashGet(key){var data=this.__data__;if(nativeCreate){var result=data[key];return result===HASH_UNDEFINED?void 0:result}return hasOwnProperty.call(data,key)?data[key]:void 0}function hashHas(key){var data=this.__data__;return nativeCreate?void 0!==data[key]:hasOwnProperty.call(data,key)}function hashSet(key,value){var data=this.__data__;return data[key]=nativeCreate&&void 0===value?HASH_UNDEFINED:value,this}function ListCache(entries){var index=-1,length=entries?entries.length:0;for(this.clear();++index<length;){var entry=entries[index];this.set(entry[0],entry[1])}}function listCacheClear(){this.__data__=[]}function listCacheDelete(key){var data=this.__data__,index=assocIndexOf(data,key);if(index<0)return!1;var lastIndex=data.length-1;return index==lastIndex?data.pop():splice.call(data,index,1),!0}function listCacheGet(key){var data=this.__data__,index=assocIndexOf(data,key);return index<0?void 0:data[index][1]}function listCacheHas(key){return assocIndexOf(this.__data__,key)>-1}function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);return index<0?data.push([key,value]):data[index][1]=value,this}function MapCache(entries){var index=-1,length=entries?entries.length:0;for(this.clear();++index<length;){var entry=entries[index];this.set(entry[0],entry[1])}}function mapCacheClear(){this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}function mapCacheDelete(key){return getMapData(this,key).delete(key)}function mapCacheGet(key){return getMapData(this,key).get(key)}function mapCacheHas(key){return getMapData(this,key).has(key)}function mapCacheSet(key,value){return getMapData(this,key).set(key,value),this}function SetCache(values){var index=-1,length=values?values.length:0;for(this.__data__=new MapCache;++index<length;)this.add(values[index])}function setCacheAdd(value){return this.__data__.set(value,HASH_UNDEFINED),this}function setCacheHas(value){return this.__data__.has(value)}function assocIndexOf(array,key){for(var length=array.length;length--;)if(eq(array[length][0],key))return length;return-1}function baseFlatten(array,depth,predicate,isStrict,result){var index=-1,length=array.length;for(predicate||(predicate=isFlattenable),result||(result=[]);++index<length;){var value=array[index];depth>0&&predicate(value)?depth>1?baseFlatten(value,depth-1,predicate,isStrict,result):arrayPush(result,value):isStrict||(result[result.length]=value)}return result}function baseIsNative(value){if(!isObject(value)||isMasked(value))return!1;var pattern=isFunction(value)||isHostObject(value)?reIsNative:reIsHostCtor;return pattern.test(toSource(value))}function baseRest(func,start){return start=nativeMax(void 0===start?func.length-1:start,0),function(){for(var args=arguments,index=-1,length=nativeMax(args.length-start,0),array=Array(length);++index<length;)array[index]=args[start+index];index=-1;for(var otherArgs=Array(start+1);++index<start;)otherArgs[index]=args[index];return otherArgs[start]=array,apply(func,this,otherArgs)}}function baseUniq(array,iteratee,comparator){var index=-1,includes=arrayIncludes,length=array.length,isCommon=!0,result=[],seen=result;if(comparator)isCommon=!1,includes=arrayIncludesWith;else if(length>=LARGE_ARRAY_SIZE){var set=iteratee?null:createSet(array);if(set)return setToArray(set);isCommon=!1,includes=cacheHas,seen=new SetCache}else seen=iteratee?[]:result;outer:for(;++index<length;){var value=array[index],computed=iteratee?iteratee(value):value;if(value=comparator||0!==value?value:0,isCommon&&computed===computed){for(var seenIndex=seen.length;seenIndex--;)if(seen[seenIndex]===computed)continue outer;iteratee&&seen.push(computed),result.push(value)}else includes(seen,computed,comparator)||(seen!==result&&seen.push(computed),result.push(value))}return result}function getMapData(map,key){var data=map.__data__;return isKeyable(key)?data["string"==typeof key?"string":"hash"]:data.map}function getNative(object,key){var value=getValue(object,key);return baseIsNative(value)?value:void 0}function isFlattenable(value){return isArray(value)||isArguments(value)||!!(spreadableSymbol&&value&&value[spreadableSymbol])}function isKeyable(value){var type=typeof value;return"string"==type||"number"==type||"symbol"==type||"boolean"==type?"__proto__"!==value:null===value}function isMasked(func){return!!maskSrcKey&&maskSrcKey in func}function toSource(func){if(null!=func){try{return funcToString.call(func)}catch(e){}try{return func+""}catch(e){}}return""}function last(array){var length=array?array.length:0;return length?array[length-1]:void 0}function eq(value,other){return value===other||value!==value&&other!==other}function isArguments(value){return isArrayLikeObject(value)&&hasOwnProperty.call(value,"callee")&&(!propertyIsEnumerable.call(value,"callee")||objectToString.call(value)==argsTag)}function isArrayLike(value){return null!=value&&isLength(value.length)&&!isFunction(value)}function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value)}function isFunction(value){var tag=isObject(value)?objectToString.call(value):"";return tag==funcTag||tag==genTag}function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}function isObjectLike(value){return!!value&&"object"==typeof value}function noop(){}var LARGE_ARRAY_SIZE=200,HASH_UNDEFINED="__lodash_hash_undefined__",INFINITY=1/0,MAX_SAFE_INTEGER=9007199254740991,argsTag="[object Arguments]",funcTag="[object Function]",genTag="[object GeneratorFunction]",reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,freeGlobal="object"==typeof global&&global&&global.Object===Object&&global,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),arrayProto=Array.prototype,funcProto=Function.prototype,objectProto=Object.prototype,coreJsData=root["__core-js_shared__"],maskSrcKey=function(){var uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return uid?"Symbol(src)_1."+uid:""}(),funcToString=funcProto.toString,hasOwnProperty=objectProto.hasOwnProperty,objectToString=objectProto.toString,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Symbol=root.Symbol,propertyIsEnumerable=objectProto.propertyIsEnumerable,splice=arrayProto.splice,spreadableSymbol=Symbol?Symbol.isConcatSpreadable:void 0,nativeMax=Math.max,Map=getNative(root,"Map"),Set=getNative(root,"Set"),nativeCreate=getNative(Object,"create");Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet,ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet,MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet,SetCache.prototype.add=SetCache.prototype.push=setCacheAdd,SetCache.prototype.has=setCacheHas;var createSet=Set&&1/setToArray(new Set([,-0]))[1]==INFINITY?function(values){return new Set(values)}:noop,unionWith=baseRest(function(arrays){var comparator=last(arrays);return isArrayLikeObject(comparator)&&(comparator=void 0),baseUniq(baseFlatten(arrays,1,isArrayLikeObject,!0),void 0,comparator)}),isArray=Array.isArray;module.exports=unionWith}).call(exports,__webpack_require__(10))},function(module,exports){module.exports=function(fun){return function next(a,b,c){var loop=!0,sync=!1;do sync=!0,loop=!1,fun.call(function(x,y,z){sync?(a=x,b=y,c=z,loop=!0):next(x,y,z)},a,b,c),sync=!1;while(loop)}}},function(module,exports,__webpack_require__){(function(process){function normalizeArray(parts,allowAboveRoot){for(var up=0,i=parts.length-1;i>=0;i--){var last=parts[i];"."===last?parts.splice(i,1):".."===last?(parts.splice(i,1),up++):up&&(parts.splice(i,1),up--)}if(allowAboveRoot)for(;up--;up)parts.unshift("..");return parts}function filter(xs,f){if(xs.filter)return xs.filter(f);for(var res=[],i=0;i<xs.length;i++)f(xs[i],i,xs)&&res.push(xs[i]);return res}var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,splitPath=function(filename){return splitPathRe.exec(filename).slice(1)};exports.resolve=function(){for(var resolvedPath="",resolvedAbsolute=!1,i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if("string"!=typeof path)throw new TypeError("Arguments to path.resolve must be strings");path&&(resolvedPath=path+"/"+resolvedPath,resolvedAbsolute="/"===path.charAt(0))}return resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/"),(resolvedAbsolute?"/":"")+resolvedPath||"."},exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash="/"===substr(path,-1);return path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/"),path||isAbsolute||(path="."),path&&trailingSlash&&(path+="/"),(isAbsolute?"/":"")+path},exports.isAbsolute=function(path){return"/"===path.charAt(0)},exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if("string"!=typeof p)throw new TypeError("Arguments to path.join must be strings");return p}).join("/"))},exports.relative=function(from,to){function trim(arr){for(var start=0;start<arr.length&&""===arr[start];start++);for(var end=arr.length-1;end>=0&&""===arr[end];end--);return start>end?[]:arr.slice(start,end-start+1)}from=exports.resolve(from).substr(1),to=exports.resolve(to).substr(1);for(var fromParts=trim(from.split("/")),toParts=trim(to.split("/")),length=Math.min(fromParts.length,toParts.length),samePartsLength=length,i=0;i<length;i++)if(fromParts[i]!==toParts[i]){samePartsLength=i;break}for(var outputParts=[],i=samePartsLength;i<fromParts.length;i++)outputParts.push("..");return outputParts=outputParts.concat(toParts.slice(samePartsLength)),outputParts.join("/")},exports.sep="/",exports.delimiter=":",exports.dirname=function(path){var result=splitPath(path),root=result[0],dir=result[1];return root||dir?(dir&&(dir=dir.substr(0,dir.length-1)),root+dir):"."},exports.basename=function(path,ext){var f=splitPath(path)[2];return ext&&f.substr(-1*ext.length)===ext&&(f=f.substr(0,f.length-ext.length)),f},exports.extname=function(path){return splitPath(path)[3]};var substr="b"==="ab".substr(-1)?function(str,start,len){return str.substr(start,len)}:function(str,start,len){return start<0&&(start=str.length+start),str.substr(start,len)}}).call(exports,__webpack_require__(35))},function(module,exports){function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(fun){if(cachedSetTimeout===setTimeout)return setTimeout(fun,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(fun,0);try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout)return clearTimeout(marker);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(marker);try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var timeout=runTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex<len;)currentQueue&¤tQueue[queueIndex].run();queueIndex=-1,len=queue.length}currentQueue=null,draining=!1,runClearTimeout(timeout)}}function Item(fun,array){this.fun=fun,this.array=array}function noop(){}var cachedSetTimeout,cachedClearTimeout,process=module.exports={};!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)args[i-1]=arguments[i];queue.push(new Item(fun,args)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.binding=function(name){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(dir){throw new Error("process.chdir is not supported")},process.umask=function(){return 0}},function(module,exports){module.exports=function(stream){function consume(_read){if(!_read)throw new Error("must be passed a readable");read=_read,started&&stream(read)}var read,started=!1;Math.random();return consume.resolve=consume.ready=consume.start=function(_stream){return started=!0,stream=_stream||stream,read&&stream(read),consume},consume}},function(module,exports){function pullPushable(onClose){function read(_abort,_cb){_abort&&(abort=_abort,cb&&callback(abort)),cb=_cb,drain()}function drain(){cb&&(abort?callback(abort):!buffer.length&&ended?callback(ended):buffer.length&&callback(null,buffer.shift()))}function callback(err,val){var _cb=cb;if(err&&onClose){var c=onClose;onClose=null,c(err===!0?null:err)}cb=null,_cb(err,val)}var abort,cb,ended,buffer=[];return read.end=function(end){ended=ended||end||!0,drain()},read.push=function(data){if(!ended){if(cb)return void callback(abort,data);buffer.push(data),drain()}},read}module.exports=pullPushable},function(module,exports){"use strict";module.exports=function pull(a){var length=arguments.length;if("function"==typeof a&&1===a.length){for(var args=new Array(length),i=0;i<length;i++)args[i]=arguments[i];return function(read){if(null==args)throw new TypeError("partial sink should only be called once!");var ref=args;switch(args=null,length){case 1:return pull(read,ref[0]);case 2:return pull(read,ref[0],ref[1]);case 3:return pull(read,ref[0],ref[1],ref[2]);case 4:return pull(read,ref[0],ref[1],ref[2],ref[3]);default:return ref.unshift(read),pull.apply(null,ref)}}}var read=a;read&&"function"==typeof read.source&&(read=read.source);for(var i=1;i<length;i++){var s=arguments[i];"function"==typeof s?read=s(read):s&&"object"==typeof s&&(s.sink(read),read=s.source)}return read}},function(module,exports,__webpack_require__){"use strict";var reduce=__webpack_require__(50);module.exports=function(cb){return reduce(function(arr,item){return arr.push(item),arr},[],cb)}},function(module,exports,__webpack_require__){"use strict";var reduce=__webpack_require__(50);module.exports=function(cb){return reduce(function(a,b){return a+b},"",cb)}},function(module,exports,__webpack_require__){"use strict";function id(e){return e}var prop=__webpack_require__(26),drain=__webpack_require__(25);module.exports=function(test,cb){var ended=!1;return cb?test=prop(test)||id:(cb=test,test=id),drain(function(data){if(test(data))return ended=!0,cb(null,data),!1},function(err){ended||cb(err===!0?null:err,null)})}},function(module,exports,__webpack_require__){"use strict";module.exports={drain:__webpack_require__(25),onEnd:__webpack_require__(176),log:__webpack_require__(175),find:__webpack_require__(173),reduce:__webpack_require__(50),collect:__webpack_require__(171),concat:__webpack_require__(172)}},function(module,exports,__webpack_require__){"use strict";var drain=__webpack_require__(25);module.exports=function(done){return drain(function(data){console.log(data)},done)}},function(module,exports,__webpack_require__){"use strict";var drain=__webpack_require__(25);module.exports=function(done){return drain(null,done)}},function(module,exports){"use strict";module.exports=function(max){var i=0;return max=max||1/0,function(end,cb){return end?cb&&cb(end):i>max?cb(!0):void cb(null,i++)}}},function(module,exports){"use strict";module.exports=function(){return function(abort,cb){cb(!0)}}},function(module,exports){"use strict";module.exports=function(err){return function(abort,cb){cb(err)}}},function(module,exports,__webpack_require__){"use strict";module.exports={keys:__webpack_require__(182),once:__webpack_require__(78),values:__webpack_require__(51),count:__webpack_require__(177),infinite:__webpack_require__(181),empty:__webpack_require__(178),error:__webpack_require__(179)}},function(module,exports){"use strict";module.exports=function(generate){return generate=generate||Math.random,
|
||
function(end,cb){return end?cb&&cb(end):cb(null,generate())}}},function(module,exports,__webpack_require__){"use strict";var values=__webpack_require__(51);module.exports=function(object){return values(Object.keys(object))}},function(module,exports,__webpack_require__){"use strict";function id(e){return e}var prop=__webpack_require__(26);module.exports=function(map){if(!map)return id;map=prop(map);var abortCb,aborted,busy=!1;return function(read){return function next(abort,cb){return aborted?cb(aborted):void(abort?(aborted=abort,busy?read(abort,function(){busy?abortCb=cb:cb(abort)}):read(abort,cb)):read(null,function(end,data){end?cb(end):aborted?cb(aborted):(busy=!0,map(data,function(err,data){busy=!1,aborted?(cb(aborted),abortCb(aborted)):err?next(err,cb):cb(null,data)}))}))}}}},function(module,exports,__webpack_require__){"use strict";var tester=__webpack_require__(81),filter=__webpack_require__(52);module.exports=function(test){return test=tester(test),filter(function(data){return!test(data)})}},function(module,exports,__webpack_require__){"use strict";var values=__webpack_require__(51),once=__webpack_require__(78);module.exports=function(){return function(read){var _read;return function(abort,cb){function nextChunk(){_read(null,function(err,data){err===!0?nextStream():err?read(!0,function(abortErr){cb(err)}):cb(null,data)})}function nextStream(){_read=null,read(null,function(end,stream){return end?cb(end):(Array.isArray(stream)||stream&&"object"==typeof stream?stream=values(stream):"function"!=typeof stream&&(stream=once(stream)),_read=stream,void nextChunk())})}abort?_read?_read(abort,function(err){read(err||abort,cb)}):read(abort,cb):_read?nextChunk():nextStream()}}}},function(module,exports,__webpack_require__){"use strict";module.exports={map:__webpack_require__(187),asyncMap:__webpack_require__(183),filter:__webpack_require__(52),filterNot:__webpack_require__(184),through:__webpack_require__(190),take:__webpack_require__(189),unique:__webpack_require__(79),nonUnique:__webpack_require__(188),flatten:__webpack_require__(185)}},function(module,exports,__webpack_require__){"use strict";function id(e){return e}var prop=__webpack_require__(26);module.exports=function(mapper){return mapper?(mapper=prop(mapper),function(read){return function(abort,cb){read(abort,function(end,data){try{data=end?null:mapper(data)}catch(err){return read(err,function(){return cb(err)})}cb(end,data)})}}):id}},function(module,exports,__webpack_require__){"use strict";var unique=__webpack_require__(79);module.exports=function(field){return unique(field,!0)}},function(module,exports){"use strict";module.exports=function(test,opts){opts=opts||{};var last=opts.last||!1,ended=!1;if("number"==typeof test){last=!0;var n=test;test=function(){return--n}}return function(read){function terminate(cb){read(!0,function(err){last=!1,cb(err||!0)})}return function(end,cb){ended?last?terminate(cb):cb(ended):(ended=end)?read(ended,cb):read(null,function(end,data){(ended=ended||end)?cb(ended):test(data)?cb(null,data):(ended=!0,last?cb(null,data):terminate(cb))})}}}},function(module,exports){"use strict";module.exports=function(op,onEnd){function once(abort){!a&&onEnd&&(a=!0,onEnd(abort===!0?null:abort))}var a=!1;return function(read){return function(end,cb){return end&&once(end),read(end,function(end,data){end?once(end):op&&op(data),cb(end,data)})}}}},function(module,exports,__webpack_require__){var looper=__webpack_require__(165),window=module.exports=function(init,start){return function(read){start=start||function(start,data){return{start:start,data:data}};var windows=[],output=[],ended=null,j=0;return function(abort,cb){if(output.length)return cb(null,output.shift());if(ended)return cb(ended);j++;read(abort,looper(function(end,data){function _update(end,_data){once||(once=!0,delete windows[windows.indexOf(update)],output.push(start(data,_data)))}var update,next=this,once=!1;return end&&(ended=end),ended||(update=init(data,_update)),update?windows.push(update):once=!0,windows.forEach(function(update,i){update(end,data)}),output.length?cb(null,output.shift()):ended?cb(ended):void read(null,next)}))}}};window.recent=function(size,time){var current=null;return window(function(data,cb){function done(){var _current=current;current=null,clearTimeout(timer),cb(null,_current)}if(!current){current=[];var timer;return time&&(timer=setTimeout(done,time)),function(end,data){return end?done():(current.push(data),void(null!=size&¤t.length>=size&&done()))}}},function(_,data){return data})},window.sliding=function(reduce,width){width=width||10;var k=0;return window(function(data,cb){var acc,i=0;k++;return function(end,data){end||(acc=reduce(acc,data),width<=++i&&cb(null,acc))}})}},function(module,exports){function append(array,item){return(array=array||[]).push(item),array}module.exports=function(write,reduce,max,cb){function reader(read){function more(){reading||ended||(reading=!0,read(null,function(err,data){reading=!1,next(err,data)}))}function flush(){if(!writing){var _queue=queue;queue=null,writing=!0,length=0,write(_queue,function(err){writing=!1,ended!==!0||length?ended&&ended!==!0?(cb(ended),_cb&&_cb()):err?read(ended=err,cb):length?flush():more():cb(err)})}}function next(end,data){ended||(ended=end,ended?writing||cb(ended===!0?null:ended):(queue=reduce(queue,data),length=queue&&queue.length||0,null!=queue&&flush(),length<max&&more()))}var queue=null,writing=!1,length=0;if(_read=read,ended)return read(ended,function(err){cb(err),_cb&&_cb()});var reading=!1;reader.abort=function(__cb){_cb=function(end){__cb&&__cb()},read(ended=new Error("aborted"),function(end){end=end===!0?null:end,writing||(cb&&cb(end),_cb&&_cb(end))})},more()}reduce=reduce||append;var ended,_cb,_read;return reader.abort=function(cb){ended=new Error("aborted before connecting"),_cb=function(err){cb&&cb()}},reader}},function(module,exports,__webpack_require__){(function(Buffer){var isTypedArray=__webpack_require__(157).strict;module.exports=function(arr){if(isTypedArray(arr)){var buf=new Buffer(arr.buffer);return arr.byteLength!==arr.buffer.byteLength&&(buf=buf.slice(arr.byteOffset,arr.byteOffset+arr.byteLength)),buf}return new Buffer(arr)}}).call(exports,__webpack_require__(18).Buffer)},function(module,exports){module.exports=function(arg){return arg&&"object"==typeof arg&&"function"==typeof arg.copy&&"function"==typeof arg.fill&&"function"==typeof arg.readUInt8}},function(module,exports,__webpack_require__){(function(global,process){function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};return arguments.length>=3&&(ctx.depth=arguments[2]),arguments.length>=4&&(ctx.colors=arguments[3]),isBoolean(opts)?ctx.showHidden=opts:opts&&exports._extend(ctx,opts),isUndefined(ctx.showHidden)&&(ctx.showHidden=!1),isUndefined(ctx.depth)&&(ctx.depth=2),isUndefined(ctx.colors)&&(ctx.colors=!1),isUndefined(ctx.customInspect)&&(ctx.customInspect=!0),ctx.colors&&(ctx.stylize=stylizeWithColor),formatValue(ctx,obj,ctx.depth)}function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];return style?"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m":str}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};return array.forEach(function(val,idx){hash[val]=!0}),hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&(!value.constructor||value.constructor.prototype!==value)){var ret=value.inspect(recurseTimes,ctx);return isString(ret)||(ret=formatValue(ctx,ret,recurseTimes)),ret}var primitive=formatPrimitive(ctx,value);if(primitive)return primitive;var keys=Object.keys(value),visibleKeys=arrayToHash(keys);if(ctx.showHidden&&(keys=Object.getOwnPropertyNames(value)),isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0))return formatError(value);if(0===keys.length){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),"regexp");if(isDate(value))return ctx.stylize(Date.prototype.toString.call(value),"date");if(isError(value))return formatError(value)}var base="",array=!1,braces=["{","}"];if(isArray(value)&&(array=!0,braces=["[","]"]),isFunction(value)){var n=value.name?": "+value.name:"";base=" [Function"+n+"]"}if(isRegExp(value)&&(base=" "+RegExp.prototype.toString.call(value)),isDate(value)&&(base=" "+Date.prototype.toUTCString.call(value)),isError(value)&&(base=" "+formatError(value)),0===keys.length&&(!array||0==value.length))return braces[0]+base+braces[1];if(recurseTimes<0)return isRegExp(value)?ctx.stylize(RegExp.prototype.toString.call(value),"regexp"):ctx.stylize("[Object]","special");ctx.seen.push(value);var output;return output=array?formatArray(ctx,value,recurseTimes,visibleKeys,keys):keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)}),ctx.seen.pop(),reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}return isNumber(value)?ctx.stylize(""+value,"number"):isBoolean(value)?ctx.stylize(""+value,"boolean"):isNull(value)?ctx.stylize("null","null"):void 0}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){for(var output=[],i=0,l=value.length;i<l;++i)hasOwnProperty(value,String(i))?output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),!0)):output.push("");return keys.forEach(function(key){key.match(/^\d+$/)||output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,!0))}),output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;if(desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]},desc.get?str=desc.set?ctx.stylize("[Getter/Setter]","special"):ctx.stylize("[Getter]","special"):desc.set&&(str=ctx.stylize("[Setter]","special")),hasOwnProperty(visibleKeys,key)||(name="["+key+"]"),str||(ctx.seen.indexOf(desc.value)<0?(str=isNull(recurseTimes)?formatValue(ctx,desc.value,null):formatValue(ctx,desc.value,recurseTimes-1),str.indexOf("\n")>-1&&(str=array?str.split("\n").map(function(line){return" "+line}).join("\n").substr(2):"\n"+str.split("\n").map(function(line){return" "+line}).join("\n"))):str=ctx.stylize("[Circular]","special")),isUndefined(name)){if(array&&key.match(/^\d+$/))return str;name=JSON.stringify(""+key),name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(name=name.substr(1,name.length-2),name=ctx.stylize(name,"name")):(name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),name=ctx.stylize(name,"string"))}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0,length=output.reduce(function(prev,cur){return numLinesEst++,cur.indexOf("\n")>=0&&numLinesEst++,prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0);return length>60?braces[0]+(""===base?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]:braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray(ar){return Array.isArray(ar)}function isBoolean(arg){return"boolean"==typeof arg}function isNull(arg){return null===arg}function isNullOrUndefined(arg){return null==arg}function isNumber(arg){return"number"==typeof arg}function isString(arg){return"string"==typeof arg}function isSymbol(arg){return"symbol"==typeof arg}function isUndefined(arg){return void 0===arg}function isRegExp(re){return isObject(re)&&"[object RegExp]"===objectToString(re)}function isObject(arg){return"object"==typeof arg&&null!==arg}function isDate(d){return isObject(d)&&"[object Date]"===objectToString(d)}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function isFunction(arg){return"function"==typeof arg}function isPrimitive(arg){return null===arg||"boolean"==typeof arg||"number"==typeof arg||"string"==typeof arg||"symbol"==typeof arg||"undefined"==typeof arg}function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}function timestamp(){var d=new Date,time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){for(var objects=[],i=0;i<arguments.length;i++)objects.push(inspect(arguments[i]));return objects.join(" ")}for(var i=1,args=arguments,len=args.length,str=String(f).replace(formatRegExp,function(x){if("%%"===x)return"%";if(i>=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}}),x=args[i];i<len;x=args[++i])str+=isNull(x)||!isObject(x)?" "+x:" "+inspect(x);return str},exports.deprecate=function(fn,msg){function deprecated(){if(!warned){if(process.throwDeprecation)throw new Error(msg);process.traceDeprecation?console.trace(msg):console.error(msg),warned=!0}return fn.apply(this,arguments)}if(isUndefined(global.process))return function(){return exports.deprecate(fn,msg).apply(this,arguments)};if(process.noDeprecation===!0)return fn;var warned=!1;return deprecated};var debugEnviron,debugs={};exports.debuglog=function(set){if(isUndefined(debugEnviron)&&(debugEnviron=process.env.NODE_DEBUG||""),set=set.toUpperCase(),!debugs[set])if(new RegExp("\\b"+set+"\\b","i").test(debugEnviron)){var pid=process.pid;debugs[set]=function(){var msg=exports.format.apply(exports,arguments);console.error("%s %d: %s",set,pid,msg)}}else debugs[set]=function(){};return debugs[set]},exports.inspect=inspect,inspect.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]},inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},exports.isArray=isArray,exports.isBoolean=isBoolean,exports.isNull=isNull,exports.isNullOrUndefined=isNullOrUndefined,exports.isNumber=isNumber,exports.isString=isString,exports.isSymbol=isSymbol,exports.isUndefined=isUndefined,exports.isRegExp=isRegExp,exports.isObject=isObject,exports.isDate=isDate,exports.isError=isError,exports.isFunction=isFunction,exports.isPrimitive=isPrimitive,exports.isBuffer=__webpack_require__(194);var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];exports.log=function(){console.log("%s - %s",timestamp(),exports.format.apply(exports,arguments))},exports.inherits=__webpack_require__(156),exports._extend=function(origin,add){if(!add||!isObject(add))return origin;for(var keys=Object.keys(add),i=keys.length;i--;)origin[keys[i]]=add[keys[i]];return origin}}).call(exports,__webpack_require__(10),__webpack_require__(35))},function(module,exports){module.exports=function(module){return module.webpackPolyfill||(module.deprecate=function(){},module.paths=[],module.children||(module.children=[]),Object.defineProperty(module,"loaded",{enumerable:!0,configurable:!1,get:function(){return module.l}}),Object.defineProperty(module,"id",{enumerable:!0,configurable:!1,get:function(){return module.i}}),module.webpackPolyfill=1),module}},function(module,exports){},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _keys=__webpack_require__(14),_keys2=_interopRequireDefault(_keys),_classCallCheck2=__webpack_require__(0),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(1),_createClass3=_interopRequireDefault(_createClass2),EventEmitter=__webpack_require__(54).EventEmitter,EventStore=__webpack_require__(53),FeedStore=__webpack_require__(84),KeyValueStore=__webpack_require__(85),CounterStore=__webpack_require__(82),DocumentStore=__webpack_require__(83),Pubsub=__webpack_require__(86),Cache=__webpack_require__(87),defaultNetworkName="Orbit DEV Network",OrbitDB=function(){function OrbitDB(ipfs){var id=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",options=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(0,_classCallCheck3.default)(this,OrbitDB),this._ipfs=ipfs,this._pubsub=options&&options.broker?new options.broker(ipfs):new Pubsub(ipfs),this.user={id:id},this.network={name:defaultNetworkName},this.events=new EventEmitter,this.stores={}}return(0,_createClass3.default)(OrbitDB,[{key:"feed",value:function(dbname,options){return this._createStore(FeedStore,dbname,options)}},{key:"eventlog",value:function(dbname,options){return this._createStore(EventStore,dbname,options)}},{key:"kvstore",value:function(dbname,options){return this._createStore(KeyValueStore,dbname,options)}},{key:"counter",value:function(dbname,options){return this._createStore(CounterStore,dbname,options)}},{key:"docstore",value:function(dbname,options){return this._createStore(DocumentStore,dbname,options)}},{key:"disconnect",value:function(){var _this=this;this._pubsub&&this._pubsub.disconnect(),this.events.removeAllListeners("data"),(0,_keys2.default)(this.stores).map(function(e){return _this.stores[e]}).forEach(function(store){store.events.removeAllListeners("data"),store.events.removeAllListeners("write"),store.events.removeAllListeners("close")}),this.stores={},this.user=null,this.network=null}},{key:"_createStore",value:function(Store,dbname){var options=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{subscribe:!0,cacheFile:"orbit-db.json"},store=new Store(this._ipfs,this.user.id,dbname,options);return this.stores[dbname]=store,this._subscribe(store,dbname,options.subscribe,options)}},{key:"_subscribe",value:function(store,dbname){var subscribe=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],options=arguments[3];return store.events.on("data",this._onData.bind(this)),store.events.on("write",this._onWrite.bind(this)),store.events.on("close",this._onClose.bind(this)),subscribe&&this._pubsub?this._pubsub.subscribe(dbname,this._onMessage.bind(this),this._onConnected.bind(this),store.options.maxHistory>0):store.loadHistory().catch(function(e){return console.error(e.stack)}),Cache.loadCache(options.cacheFile).then(function(){var hash=Cache.get(dbname);store.loadHistory(hash).catch(function(e){return console.error(e.stack)})}),store}},{key:"_onConnected",value:function(dbname,hash){var store=this.stores[dbname];store.loadHistory(hash).catch(function(e){return console.error(e.stack)})}},{key:"_onMessage",value:function(dbname,hash){var store=this.stores[dbname];store.sync(hash).then(function(res){return Cache.set(dbname,hash)}).catch(function(e){return console.error(e.stack)})}},{key:"_onWrite",value:function(dbname,hash){if(!hash)throw new Error("Hash can't be null!");this._pubsub&&this._pubsub.publish(dbname,hash),Cache.set(dbname,hash)}},{key:"_onData",value:function(dbname,item){this.events.emit("data",dbname,item)}},{key:"_onClose",value:function(dbname){this._pubsub&&this._pubsub.unsubscribe(dbname),delete this.stores[dbname]}}]),OrbitDB}();module.exports=OrbitDB}]); |