(function(f){if(typeofexports==="object"&&typeofmodule!=="undefined"){module.exports=f()}elseif(typeofdefine==="function"&&define.amd){define([],f)}else{varg;if(typeofwindow!=="undefined"){g=window}elseif(typeofglobal!=="undefined"){g=global}elseif(typeofself!=="undefined"){g=self}else{g=this}g.Syndicate=f()}})(function(){vardefine,module,exports;returnfunctione(t,n,r){functions(o,u){if(!n[o]){if(!t[o]){vara=typeofrequire=="function"&&require;if(!u&&a)returna(o,!0);if(i)returni(o,!0);varf=newError("Cannot find module '"+o+"'");throwf.code="MODULE_NOT_FOUND",f}varl=n[o]={exports:{}};t[o][0].call(l.exports,function(e){varn=t[o][1][e];returns(n?n:e)},l,l.exports,e,t,n,r)}returnn[o].exports}vari=typeofrequire=="function"&&require;for(varo=0;o<r.length;o++)s(r[o]);returns}({1:[function(require,module,exports){},{}],2:[function(require,module,exports){(function(global){"use strict";varbase64=require("base64-js");varieee754=require("ieee754");varisArray=require("isarray");exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;Buffer.TYPED_ARRAY_SUPPORT=global.TYPED_ARRAY_SUPPORT!==undefined?global.TYPED_ARRAY_SUPPORT:typedArraySupport();exports.kMaxLength=kMaxLength();functiontypedArraySupport(){try{vararr=newUint8Array(1);arr.foo=function(){return42};returnarr.foo()===42&&typeofarr.subarray==="function"&&arr.subarray(1,1).byteLength===0}catch(e){returnfalse}}functionkMaxLength(){returnBuffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}functioncreateBuffer(that,length){if(kMaxLength()<length){thrownewRangeError("Invalid typed array length")}if(Buffer.TYPED_ARRAY_SUPPORT){that=newUint8Array(length);that.__proto__=Buffer.prototype}else{if(that===null){that=newBuffer(length)}that.length=length}returnthat}functionBuffer(arg,encodingOrOffset,length){if(!Buffer.TYPED_ARRAY_SUPPORT&&!(thisinstanceofBuffer)){returnnewBuffer(arg,encodingOrOffset,length)}if(typeofarg==="number"){if(typeofencodingOrOffset==="string"){thrownewError("If encoding is specified then the first argument must be a string")}returnallocUnsafe(this,arg)}returnfrom(this,arg,encodingOrOffset,length)}Buffer.poolSize=8192;Buffer._augment=function(arr){arr.__proto__=Buffer.prototype;returnarr};functionfrom(that,value,encodingOrOffset,length){if(typeofvalue==="number"){thrownewTypeError('"value" argument must not be a number')}if(typeofArrayBuffer!=="undefined"&&valueinstanceofArrayBuffer){returnfromArrayBuffer(that,value,encodingOrOffset,length)}if(typeofvalue==="string"){returnfromString(that,value,encodingOrOffset)}returnfromObject(that,value)}Buffer.from=function(value,encodingOrOffset,length){returnfrom(null,value,encodingOrOffset,length)};if(Buffer.TYPED_ARRAY_SUPPORT){Buffer.prototype.__proto__=Uint8Array.prototype;Buffer.__proto__=Uint8Array;if(typeofSymbol!=="undefined"&&Symbol.species&&Buffer[Symbol.species]===Buffer){Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:true})}}functionassertSize(size){if(typeofsize!=="number"){thrownewTypeError('"size" argument must be a number')}}functionalloc(that,size,fill,encoding){assertSize(size);if(size<=0){returncreateBuffer(that,size)}if(fill!==undefined){returntypeofencoding==="string"?createBuffer(that,size).fill(fill,encoding):createBuffer(that,size).fill(fill)}returncreateBuffer(that,size)}Buffer.alloc=function(size,fill,encoding){returnalloc(null,size,fill,encoding)};functionallocUnsafe(that,size){assertSize(size);that=createBuffer(that,size<0?0:checked(size)|0);if(!Buffer.TYPED_ARRAY_SUPPORT){for(vari=0;i<size;i++){that[i]=0}}returnthat}Buffer.allocUnsafe=function(size){returnallocUnsafe(null,size)};Buffer.allocUnsafeSlow=function(size){returnallocUnsafe(null,size)};functionfromString(that,string,encoding){if(typeofencoding!=="string"||encoding===""){encoding="utf8"}if(!Buffer.isEncoding(encoding)){thrownewTypeError('"encoding" must be a valid string encoding')}varlength=byteLength(string,encoding)|0;that=createBuffer(that,length);that.write(string,encoding);returnthat}functionfro
varArr=typeofUint8Array!=="undefined"?Uint8Array:Array;functioninit(){varcode="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(vari=0,len=code.length;i<len;++i){lookup[i]=code[i];revLookup[code.charCodeAt(i)]=i}revLookup["-".charCodeAt(0)]=62;revLookup["_".charCodeAt(0)]=63}init();functiontoByteArray(b64){vari,j,l,tmp,placeHolders,arr;varlen=b64.length;if(len%4>0){thrownewError("Invalid string. Length must be a multiple of 4")}placeHolders=b64[len-2]==="="?2:b64[len-1]==="="?1:0;arr=newArr(len*3/4-placeHolders);l=placeHolders>0?len-4:len;varL=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++]=tmp&255}if(placeHolders===2){tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4;arr[L++]=tmp&255}elseif(placeHolders===1){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++]=tmp&255}returnarr}functiontripletToBase64(num){returnlookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[num&63]}functionencodeChunk(uint8,start,end){vartmp;varoutput=[];for(vari=start;i<end;i+=3){tmp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2];output.push(tripletToBase64(tmp))}returnoutput.join("")}functionfromByteArray(uint8){vartmp;varlen=uint8.length;varextraBytes=len%3;varoutput="";varparts=[];varmaxChunkLength=16383;for(vari=0,len2=len-extraBytes;i<len2;i+=maxChunkLength){parts.push(encodeChunk(uint8,i,i+maxChunkLength>len2?len2:i+maxChunkLength))}if(extraBytes===1){tmp=uint8[len-1];output+=lookup[tmp>>2];output+=lookup[tmp<<4&63];output+="=="}elseif(extraBytes===2){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);returnparts.join("")}},{}],4:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){vare,m;vareLen=nBytes*8-mLen-1;vareMax=(1<<eLen)-1;vareBias=eMax>>1;varnBits=-7;vari=isLE?nBytes-1:0;vard=isLE?-1:1;vars=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias}elseif(e===eMax){returnm?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){vare,m,c;vareLen=nBytes*8-mLen-1;vareMax=(1<<eLen)-1;vareBias=eMax>>1;varrt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;vari=isLE?0:nBytes-1;vard=isLE?1:-1;vars=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}elseif(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8){}e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128}},{}],5:[function(require,module,exports){vartoString={}.toString;module.exports=Array.isArray||function(arr){returntoString.call(arr)=="[object Array]"}},{}],6:[function(require,module,exports){"use strict";exports.randomBytes=exports.rng=exports.pseudoRandomBytes=exports.prng=require("randombytes");exports.createHash=exports.Hash=require("create-hash");exports.createHmac=exports.Hmac=require("create-hmac");varhashes=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(Object.keys(require("browserify-sign/algos")));exports.getHashes=function(){returnhashes};varp=require("pbkdf2");exports.pbkdf2=p.pbkdf2;exports.pbkdf2Sync=p.pbkdf2Sync;varaes=require("browserify-cipher");["Cipher","createCipher","Cipheriv","createC
this._des=mode.create({key:key,iv:iv,type:type})}DES.prototype._update=function(data){returnnewBuffer(this._des.update(data))};DES.prototype._final=function(){returnnewBuffer(this._des.final())}}).call(this,require("buffer").Buffer)},{buffer:2,"cipher-base":27,"des.js":28,inherits:199}],26:[function(require,module,exports){exports["des-ecb"]={key:8,iv:0};exports["des-cbc"]=exports.des={key:8,iv:8};exports["des-ede3-cbc"]=exports.des3={key:24,iv:8};exports["des-ede3"]={key:24,iv:0};exports["des-ede-cbc"]={key:16,iv:8};exports["des-ede"]={key:16,iv:0}},{}],27:[function(require,module,exports){arguments[4][23][0].apply(exports,arguments)},{buffer:2,dup:23,inherits:199,stream:216,string_decoder:217}],28:[function(require,module,exports){"use strict";exports.utils=require("./des/utils");exports.Cipher=require("./des/cipher");exports.DES=require("./des/des");exports.CBC=require("./des/cbc");exports.EDE=require("./des/ede")},{"./des/cbc":29,"./des/cipher":30,"./des/des":31,"./des/ede":32,"./des/utils":33}],29:[function(require,module,exports){"use strict";varassert=require("minimalistic-assert");varinherits=require("inherits");varproto={};functionCBCState(iv){assert.equal(iv.length,8,"Invalid IV length");this.iv=newArray(8);for(vari=0;i<this.iv.length;i++)this.iv[i]=iv[i]}functioninstantiate(Base){functionCBC(options){Base.call(this,options);this._cbcInit()}inherits(CBC,Base);varkeys=Object.keys(proto);for(vari=0;i<keys.length;i++){varkey=keys[i];CBC.prototype[key]=proto[key]}CBC.create=functioncreate(options){returnnewCBC(options)};returnCBC}exports.instantiate=instantiate;proto._cbcInit=function_cbcInit(){varstate=newCBCState(this.options.iv);this._cbcState=state};proto._update=function_update(inp,inOff,out,outOff){varstate=this._cbcState;varsuperProto=this.constructor.super_.prototype;variv=state.iv;if(this.type==="encrypt"){for(vari=0;i<this.blockSize;i++)iv[i]^=inp[inOff+i];superProto._update.call(this,iv,0,out,outOff);for(vari=0;i<this.blockSize;i++)iv[i]=out[outOff+i]}else{superProto._update.call(this,inp,inOff,out,outOff);for(vari=0;i<this.blockSize;i++)out[outOff+i]^=iv[i];for(vari=0;i<this.blockSize;i++)iv[i]=inp[inOff+i]}}},{inherits:199,"minimalistic-assert":34}],30:[function(require,module,exports){"use strict";varassert=require("minimalistic-assert");functionCipher(options){this.options=options;this.type=this.options.type;this.blockSize=8;this._init();this.buffer=newArray(this.blockSize);this.bufferOff=0}module.exports=Cipher;Cipher.prototype._init=function_init(){};Cipher.prototype.update=functionupdate(data){if(data.length===0)return[];if(this.type==="decrypt")returnthis._updateDecrypt(data);elsereturnthis._updateEncrypt(data)};Cipher.prototype._buffer=function_buffer(data,off){varmin=Math.min(this.buffer.length-this.bufferOff,data.length-off);for(vari=0;i<min;i++)this.buffer[this.bufferOff+i]=data[off+i];this.bufferOff+=min;returnmin};Cipher.prototype._flushBuffer=function_flushBuffer(out,off){this._update(this.buffer,0,out,off);this.bufferOff=0;returnthis.blockSize};Cipher.prototype._updateEncrypt=function_updateEncrypt(data){varinputOff=0;varoutputOff=0;varcount=(this.bufferOff+data.length)/this.blockSize|0;varout=newArray(count*this.blockSize);if(this.bufferOff!==0){inputOff+=this._buffer(data,inputOff);if(this.bufferOff===this.buffer.length)outputOff+=this._flushBuffer(out,outputOff)}varmax=data.length-(data.length-inputOff)%this.blockSize;for(;inputOff<max;inputOff+=this.blockSize){this._update(data,inputOff,out,outputOff);outputOff+=this.blockSize}for(;inputOff<data.length;inputOff++,this.bufferOff++)this.buffer[this.bufferOff]=data[inputOff];returnout};Cipher.prototype._updateDecrypt=function_updateDecrypt(data){varinputOff=0;varoutputOff=0;varcount=Math.ceil((this.bufferOff+data.length)/this.blockSize)-1;varout=newArray(count*this.blockSize);for(;count>0;count--){inputOff+=this._buffer(data,inputOff);outputOff+=this._flushBuffer(out,outputOff)}inputOff+=this._buffer(data,inputOff);returnout};Cipher.prototype.final=functionfinal(buffer){varfir
}prev>>>=22;input.words[i-10]=prev;if(prev===0&&input.length>10){input.length-=10}else{input.length-=9}};K256.prototype.imulK=functionimulK(num){num.words[num.length]=0;num.words[num.length+1]=0;num.length+=2;varlo=0;for(vari=0;i<num.length;i++){varw=num.words[i]|0;lo+=w*977;num.words[i]=lo&67108863;lo=w*64+(lo/67108864|0)}if(num.words[num.length-1]===0){num.length--;if(num.words[num.length-1]===0){num.length--}}returnnum};functionP224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}inherits(P224,MPrime);functionP192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}inherits(P192,MPrime);functionP25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}inherits(P25519,MPrime);P25519.prototype.imulK=functionimulK(num){varcarry=0;for(vari=0;i<num.length;i++){varhi=(num.words[i]|0)*19+carry;varlo=hi&67108863;hi>>>=26;num.words[i]=lo;carry=hi}if(carry!==0){num.words[num.length++]=carry}returnnum};BN._prime=functionprime(name){if(primes[name])returnprimes[name];varprime;if(name==="k256"){prime=newK256}elseif(name==="p224"){prime=newP224}elseif(name==="p192"){prime=newP192}elseif(name==="p25519"){prime=newP25519}else{thrownewError("Unknown prime "+name)}primes[name]=prime;returnprime};functionRed(m){if(typeofm==="string"){varprime=BN._prime(m);this.m=prime.p;this.prime=prime}else{assert(m.gtn(1),"modulus must be greater than 1");this.m=m;this.prime=null}}Red.prototype._verify1=function_verify1(a){assert(a.negative===0,"red works only with positives");assert(a.red,"red works only with red numbers")};Red.prototype._verify2=function_verify2(a,b){assert((a.negative|b.negative)===0,"red works only with positives");assert(a.red&&a.red===b.red,"red works only with red numbers")};Red.prototype.imod=functionimod(a){if(this.prime)returnthis.prime.ireduce(a)._forceRed(this);returna.umod(this.m)._forceRed(this)};Red.prototype.neg=functionneg(a){if(a.isZero()){returna.clone()}returnthis.m.sub(a)._forceRed(this)};Red.prototype.add=functionadd(a,b){this._verify2(a,b);varres=a.add(b);if(res.cmp(this.m)>=0){res.isub(this.m)}returnres._forceRed(this)};Red.prototype.iadd=functioniadd(a,b){this._verify2(a,b);varres=a.iadd(b);if(res.cmp(this.m)>=0){res.isub(this.m)}returnres};Red.prototype.sub=functionsub(a,b){this._verify2(a,b);varres=a.sub(b);if(res.cmpn(0)<0){res.iadd(this.m)}returnres._forceRed(this)};Red.prototype.isub=functionisub(a,b){this._verify2(a,b);varres=a.isub(b);if(res.cmpn(0)<0){res.iadd(this.m)}returnres};Red.prototype.shl=functionshl(a,num){this._verify1(a);returnthis.imod(a.ushln(num))};Red.prototype.imul=functionimul(a,b){this._verify2(a,b);returnthis.imod(a.imul(b))};Red.prototype.mul=functionmul(a,b){this._verify2(a,b);returnthis.imod(a.mul(b))};Red.prototype.isqr=functionisqr(a){returnthis.imul(a,a.clone())};Red.prototype.sqr=functionsqr(a){returnthis.mul(a,a)};Red.prototype.sqrt=functionsqrt(a){if(a.isZero())returna.clone();varmod3=this.m.andln(3);assert(mod3%2===1);if(mod3===3){varpow=this.m.add(newBN(1)).iushrn(2);returnthis.pow(a,pow)}varq=this.m.subn(1);vars=0;while(!q.isZero()&&q.andln(1)===0){s++;q.iushrn(1)}assert(!q.isZero());varone=newBN(1).toRed(this);varnOne=one.redNeg();varlpow=this.m.subn(1).iushrn(1);varz=this.m.bitLength();z=newBN(2*z*z).toRed(this);while(this.pow(z,lpow).cmp(nOne)!==0){z.redIAdd(nOne)}varc=this.pow(z,q);varr=this.pow(a,q.addn(1).iushrn(1));vart=this.pow(a,q);varm=s;while(t.cmp(one)!==0){vartmp=t;for(vari=0;tmp.cmp(one)!==0;i++){tmp=tmp.redSqr()}assert(i<m);varb=this.pow(c,newBN(1).iushln(m-i-1));r=r.redMul(b);c=b.redSqr();t=t.redMul(c);m=i}returnr};Red.prototype.invm=functioninvm(a){varinv=a._invmp(this.m);if(inv.negative!==0){inv.negative=0;returnthis.imod(inv).redNeg()}else{returnthis.imod(inv)}};Red.prototype.pow=functionpow(a,num){if(num.isZero())returnnewBN(1);if(num.cmpn(1)===0)returna.clone();varwindowSize=4;varwnd=newArray(1<<windowSize);wnd[0]=newBN(1).toRed(this);wn
varres=child._encode(data[child._baseState.key],reporter,data);reporter.leaveKey(prevKey);returnres},this).filter(function(child){returnchild});content=this._createEncoderBuffer(content)}else{if(state.tag==="seqof"||state.tag==="setof"){if(!(state.args&&state.args.length===1))returnreporter.error("Too many args for : "+state.tag);if(!Array.isArray(data))returnreporter.error("seqof/setof, but data is not Array");varchild=this.clone();child._baseState.implicit=null;content=this._createEncoderBuffer(data.map(function(item){varstate=this._baseState;returnthis._getUse(state.args[0],data)._encode(item,reporter)},child))}elseif(state.use!==null){result=this._getUse(state.use,parent)._encode(data,reporter)}else{content=this._encodePrimitive(state.tag,data);primitive=true}}varresult;if(!state.any&&state.choice===null){vartag=state.implicit!==null?state.implicit:state.tag;varcls=state.implicit===null?"universal":"context";if(tag===null){if(state.use===null)reporter.error("Tag could be ommited only for .use()")}else{if(state.use===null)result=this._encodeComposite(tag,primitive,cls,content)}}if(state.explicit!==null)result=this._encodeComposite(state.explicit,false,"context",result);returnresult};Node.prototype._encodeChoice=functionencodeChoice(data,reporter){varstate=this._baseState;varnode=state.choice[data.type];if(!node){assert(false,data.type+" not found in "+JSON.stringify(Object.keys(state.choice)))}returnnode._encode(data.value,reporter)};Node.prototype._encodePrimitive=functionencodePrimitive(tag,data){varstate=this._baseState;if(/str$/.test(tag))returnthis._encodeStr(data,tag);elseif(tag==="objid"&&state.args)returnthis._encodeObjid(data,state.reverseArgs[0],state.args[1]);elseif(tag==="objid")returnthis._encodeObjid(data,null,null);elseif(tag==="gentime"||tag==="utctime")returnthis._encodeTime(data,tag);elseif(tag==="null_")returnthis._encodeNull();elseif(tag==="int"||tag==="enum")returnthis._encodeInt(data,state.args&&state.reverseArgs[0]);elseif(tag==="bool")returnthis._encodeBool(data);elsethrownewError("Unsupported tag: "+tag)};Node.prototype._isNumstr=functionisNumstr(str){return/^[0-9 ]*$/.test(str)};Node.prototype._isPrintstr=functionisPrintstr(str){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(str)}},{"../base":72,"minimalistic-assert":83}],74:[function(require,module,exports){varinherits=require("inherits");functionReporter(options){this._reporterState={obj:null,path:[],options:options||{},errors:[]}}exports.Reporter=Reporter;Reporter.prototype.isError=functionisError(obj){returnobjinstanceofReporterError};Reporter.prototype.save=functionsave(){varstate=this._reporterState;return{obj:state.obj,pathLen:state.path.length}};Reporter.prototype.restore=functionrestore(data){varstate=this._reporterState;state.obj=data.obj;state.path=state.path.slice(0,data.pathLen)};Reporter.prototype.enterKey=functionenterKey(key){returnthis._reporterState.path.push(key)};Reporter.prototype.leaveKey=functionleaveKey(index,key,value){varstate=this._reporterState;state.path=state.path.slice(0,index-1);if(state.obj!==null)state.obj[key]=value};Reporter.prototype.enterObject=functionenterObject(){varstate=this._reporterState;varprev=state.obj;state.obj={};returnprev};Reporter.prototype.leaveObject=functionleaveObject(prev){varstate=this._reporterState;varnow=state.obj;state.obj=prev;returnnow};Reporter.prototype.error=functionerror(msg){varerr;varstate=this._reporterState;varinherited=msginstanceofReporterError;if(inherited){err=msg}else{err=newReporterError(state.path.map(function(elem){return"["+JSON.stringify(elem)+"]"}).join(""),msg.message||msg,msg.stack)}if(!state.options.partial)throwerr;if(!inherited)state.errors.push(err);returnerr};Reporter.prototype.wrapResult=functionwrapResult(result){varstate=this._reporterState;if(!state.options.partial)returnresult;return{result:this.isError(result)?null:result,errors:state.errors}};functionReporterError(path,msg){this.path=path;this.rethrow(msg)}inherits(ReporterError,Error);ReporterError.prototype.rethrow=functio
returna<b?1:a>b?-1:0}functionhashIterable(iterable){if(iterable.size===Infinity){return0}varordered=isOrdered(iterable);varkeyed=isKeyed(iterable);varh=ordered?1:0;varsize=iterable.__iterate(keyed?ordered?function(v,k){h=31*h+hashMerge(hash(v),hash(k))|0}:function(v,k){h=h+hashMerge(hash(v),hash(k))|0}:ordered?function(v){h=31*h+hash(v)|0}:function(v){h=h+hash(v)|0});returnmurmurHashOfSize(size,h)}functionmurmurHashOfSize(size,h){h=imul(h,3432918353);h=imul(h<<15|h>>>-15,461845907);h=imul(h<<13|h>>>-13,5);h=(h+3864292196|0)^size;h=imul(h^h>>>16,2246822507);h=imul(h^h>>>13,3266489909);h=smi(h^h>>>16);returnh}functionhashMerge(a,b){returna^b+2654435769+(a<<6)+(a>>2)|0}varImmutable={Iterable:Iterable,Seq:Seq,Collection:Collection,Map:Map,OrderedMap:OrderedMap,List:List,Stack:Stack,Set:Set,OrderedSet:OrderedSet,Record:Record,Range:Range,Repeat:Repeat,is:is,fromJS:fromJS};returnImmutable})},{}],221:[function(require,module,exports){varRandomID=require("./randomid.js");varDataspace=require("./dataspace.js").Dataspace;varStruct=require("./struct.js");varPatch=require("./patch.js");varack=Struct.makeConstructor("ack",["id"]);functionAck(metaLevel,id){this.metaLevel=metaLevel||0;this.id=id||RandomID.randomId(16);this.done=false}Ack.prototype.arm=function(){Dataspace.stateChange(Patch.sub(ack(this.id),this.metaLevel));Dataspace.send(ack(this.id),this.metaLevel)};Ack.prototype.disarm=function(){Dataspace.stateChange(Patch.unsub(ack(this.id),this.metaLevel))};Ack.prototype.check=function(e){if(!this.done){if(e.type==="message"){varm=Patch.stripAtMeta(e.message,this.metaLevel);if(ack.isClassOf(m)&&m[0]===this.id){this.disarm();this.done=true}}}returnthis.done};module.exports.ack=ack;module.exports.Ack=Ack},{"./dataspace.js":225,"./patch.js":230,"./randomid.js":231,"./struct.js":235}],222:[function(require,module,exports){"use strict";varImmutable=require("immutable");var_Dataspace=require("./dataspace.js");varDataspace=_Dataspace.Dataspace;varMux=require("./mux.js");varPatch=require("./patch.js");varTrie=require("./trie.js");varUtil=require("./util.js");functionspawnActor(state,bootFn){Dataspace.spawn(newActor(state,bootFn))}functionActor(state,bootFn){this.state=state;this.facets=Immutable.Set();this.mux=newMux.Mux;this.knowledge=Trie.emptyTrie;this.pendingActions=[];this.boot=function(){varself=this;withCurrentFacet(null,function(){bootFn.call(self.state)});self.checkForTermination()}}Actor.prototype.handleEvent=function(e){if(e.type==="stateChange"){this.knowledge=e.patch.updateInterests(this.knowledge)}if(this.pendingActions.length>0){thrownewError("Syndicate: pendingActions must not be nonempty at start of handleEvent")}this.facets.forEach(function(f){withCurrentFacet(f,function(){f.handleEvent(e)})});while(this.pendingActions.length){varentry=this.pendingActions.shift();withCurrentFacet(entry.facet,entry.action)}this.facets.forEach(function(f){withCurrentFacet(f,function(){f.refresh()})});this.checkForTermination()};Actor.prototype.pushAction=function(a){this.pendingActions.push({facet:Facet.current,action:a})};Actor.prototype.addFacet=function(facet){this.facets=this.facets.add(facet)};Actor.prototype.removeFacet=function(facet){this.facets=this.facets.remove(facet)};Actor.prototype.checkForTermination=function(){if(this.facets.isEmpty()){Dataspace.exit()}};functioncreateFacet(){returnnewFacet(Dataspace.activeBehavior())}functionFacet(actor){this.actor=actor;this.endpoints=Immutable.Map();this.initBlocks=Immutable.List();this.doneBlocks=Immutable.List();this.children=Immutable.Set();this.parent=Facet.current}Facet.current=null;functionwithCurrentFacet(facet,f){varprevious=Facet.current;Facet.current=facet;varresult;try{result=f()}catch(e){Facet.current=previous;throwe}Facet.current=previous;returnresult}Facet.prototype.handleEvent=function(e){varfacet=this;facet.endpoints.forEach(function(endpoint){endpoint.handlerFn.call(facet.actor.state,e)})};Facet.prototype.addAssertion=function(assertionFn){returnthis.addEndpoint(newEndpoint(assertionFn,function(e){}))};Facet.prototype.add
vardeltaAggregate=delta.computeAggregate(pid,oldRoutingTable);varnewInterests=delta.applyTo(oldInterests);varnewRoutingTable=delta.applyTo(oldRoutingTable);this.routingTable=newRoutingTable;if(Trie.is_emptyTrie(newInterests)){this.interestTable=this.interestTable.remove(pid)}else{this.interestTable=this.interestTable.set(pid,newInterests)}return{pid:pid,delta:delta,deltaAggregate:deltaAggregate}};varatMetaEverything=Trie.compilePattern(true,Patch.atMeta(Trie.__));varatMetaBranchKeys=Immutable.List([[Patch.atMeta.meta.arity,Patch.atMeta.meta]]);varonlyMeta=Trie.trieSuccess(Immutable.Set.of("meta"));functionechoCancelledTrie(t){returnTrie.subtract(t,atMetaEverything,function(v1,v2){returnv1.has("meta")?onlyMeta:Trie.emptyTrie})}functioncomputeEvents(oldMux,newMux,updateStreamResult){varactingPid=updateStreamResult.pid;vardelta=updateStreamResult.delta;vardeltaAggregate=updateStreamResult.deltaAggregate;vardeltaAggregateNoEcho=actingPid==="meta"?delta:deltaAggregate.withoutAtMeta();varoldRoutingTable=oldMux.routingTable;varnewRoutingTable=newMux.routingTable;varaffectedPids=computeAffectedPids(oldRoutingTable,deltaAggregateNoEcho).add(actingPid).remove("meta");return{eventMap:Immutable.Map().withMutations(function(result){affectedPids.forEach(function(pid){varpatchForPid;if(pid===actingPid){varpart1=newPatch.Patch(echoCancelledTrie(Patch.biasedIntersection(newRoutingTable,delta.added)),echoCancelledTrie(Patch.biasedIntersection(oldRoutingTable,delta.removed)));varpart2=newPatch.Patch(Patch.biasedIntersection(deltaAggregateNoEcho.added,newMux.interestsOf(pid)),Patch.biasedIntersection(deltaAggregateNoEcho.removed,oldMux.interestsOf(pid)));patchForPid=part1.unsafeUnion(part2)}else{patchForPid=deltaAggregateNoEcho.viewFrom(oldMux.interestsOf(pid))}if(patchForPid.isNonEmpty()){result.set(pid,patchForPid)}})}),metaEvents:actingPid==="meta"?Immutable.List():Immutable.List.of(delta.computeAggregate(actingPid,oldRoutingTable,true).drop())}}functioncomputeAffectedPids(routingTable,delta){varcover=Trie._union(delta.added,delta.removed);routingTable=Trie.trieStep(routingTable,Patch.observe.meta.arity,Patch.observe.meta);returnTrie.matchTrie(cover,routingTable,Immutable.Set(),function(v1,v2,acc){returnacc.union(v2)})}Mux.prototype.routeMessage=function(body){if(Trie.matchValue(this.routingTable,body)===null){returnTrie.matchValue(this.routingTable,Patch.observe(body))||Immutable.Set()}else{returnImmutable.Set()}};Mux.prototype.interestsOf=function(pid){returnthis.interestTable.get(pid,Trie.emptyTrie)};module.exports.Mux=Mux;module.exports.computeEvents=computeEvents;module.exports.computeAffectedPids=computeAffectedPids},{"./patch.js":230,"./trie.js":237,immutable:220}],230:[function(require,module,exports){"use strict";varTrie=require("./trie.js");varStruct=require("./struct.js");varImmutable=require("immutable");var__=Trie.__;var_$=Trie._$;functionPatch(added,removed){this.added=added;this.removed=removed}varemptyPatch=newPatch(Trie.emptyTrie,Trie.emptyTrie);varremoveEverythingPatch=newPatch(Trie.emptyTrie,Trie.compilePattern(true,__));vartrueLabel=Trie.trieSuccess(true);varobserve=Struct.makeConstructor("observe",["assertion"]);varatMeta=Struct.makeConstructor("at-meta",["assertion"]);varadvertise=Struct.makeConstructor("advertise",["assertion"]);functionprependAtMeta(p,level){while(level--){p=atMeta(p)}returnp}functionstripAtMeta(p,level){while(level--){if(atMeta.isClassOf(p)){p=p[0]}else{returnnull}}returnp}functionobserveAtMeta(p,level){if(level===0){returnTrie.compilePattern(true,observe(p))}else{returnTrie._union(Trie.compilePattern(true,observe(prependAtMeta(p,level))),Trie.compilePattern(true,atMeta(Trie.embeddedTrie(observeAtMeta(p,level-1)))))}}function_check(p){if(pinstanceofPatch){thrownewError("Cannot construct patch pattern using an embedded patch")}returnp}functionassert(p,metaLevel){returnnewPatch(Trie.compilePattern(true,prependAtMeta(_check(p),metaLevel||0)),Trie.emptyTrie)}functionretract(p,metaLevel){returnnewPatch(Trie.emptyTrie,Trie.compilePattern(t