(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":226,"./patch.js":232,"./randomid.js":233,"./struct.js":237}],222:[function(require,module,exports){"use strict";varImmutable=require("immutable");var_Dataspace=require("./dataspace.js");varDataspace=_Dataspace.Dataspace;var__=_Dataspace.__;varMux=require("./mux.js");varPatch=require("./patch.js");varTrie=require("./trie.js");varUtil=require("./util.js");varDataflow=require("./dataflow.js");functionspawnActor(bootFn,optName){Dataspace.spawn(newActor(bootFn,optName))}functionActor(bootFn,optName){this.fields={};this.facets=Immutable.Set();this.mux=newMux.Mux;this.previousKnowledge=Trie.emptyTrie;this.knowledge=Trie.emptyTrie;this.pendingActions=[];this.dataflowGraph=newDataflow.Graph;if(typeofoptName!=="undefined"){this.name=optName}this.boot=function(){varself=this;withCurrentFacet(self,null,function(){bootFn.call(self.fields)});this.quiesce()}}Actor.current=null;(function(){varpriorities=["PRIORITY_QUERY_HIGH","PRIORITY_QUERY","PRIORITY_QUERY_HANDLER","PRIORITY_NORMAL"];for(vari=0;i<priorities.length;i++){Actor[priorities[i]]=i}})();Actor.prototype.nextPendingAction=function(probe){for(vari=0;i<this.pendingActions.length;i++){varq=this.pendingActions[i];if(q.length>0){returnprobe?true:q.shift()}}returnfalse};Actor.prototype.handleEvent=function(e){varactor=this;if(e.type==="stateChange"){this.previousKnowledge=this.knowledge;this.knowledge=e.patch.updateInterests(this.knowledge)}if(this.nextPendingAction(true)){thrownewError("Syndicate: pendingActions must not be nonempty at start of handleEvent")}this.facets.forEach(function(f){withCurrentFacet(actor,f,function(){f.handleEvent(e)})});this.quiesce()};Actor.prototype.quiesce=function(){varactor=this;while(true){varentry=this.nextPendingAction(false);if(!entry)break;withCurrentFacet(actor,entry.facet,entry.action);this.dataflowGraph.repairDamage(function(subjectId){varfacet=subjectId[0];varendpoint=subjectId[1];withCurrentFacet(actor,facet,function(){varaggregate=Patch.emptyPatch;varpatch=Patch.retract(__).andThen(endpoint.subscriptionFn.call(facet.fields));varr=facet.actor.mux.updateStream(endpoint.eid,patch);aggregate=aggregate.andThen(r.deltaAggregate);Dataspace.stateChange(aggregate)})})}this.checkForTermination()};Actor.prototype.pushAction=function(a,priorityOpt){varpriority=typeofpriorityOpt==="undefine
functiontaskFn(){self.startTask(Trie.captureToObject(captures,self.demandProjectionNames))}functiononTaskExit(){self.onTaskExit(Trie.captureToObject(captures,self.demandProjectionNames))}vardemandState=computeState(self.currentDemand,addedDemand,removedDemand,captures);varsupplyState=computeState(self.currentSupply,addedSupply,removedSupply,captures);varoldSupervisionState=self.supervisionStates.get(captures,null);varnewSupervisionState=self.taskSupervisor(demandState,supplyState,oldSupervisionState,taskFn,onTaskExit);if(newSupervisionState===null){self.supervisionStates=self.supervisionStates.remove(captures)}else{self.supervisionStates=self.supervisionStates.set(captures,newSupervisionState)}});self.currentSupply=self.currentSupply.union(addedSupply).subtract(removedSupply);self.currentDemand=self.currentDemand.union(addedDemand).subtract(removedDemand)};DemandMatcher.prototype.extractKeys=function(trie,projections,keyCount,whichSide){varks=Immutable.Set();projections.forEach(function(proj){varmoreKs=Trie.trieKeys(Trie.project(trie,proj),keyCount);if(!moreKs){thrownewError("Syndicate: wildcard "+whichSide+" detected:\n"+JSON.stringify(proj)+"\n"+Trie.prettyTrie(trie))}ks=ks.union(moreKs)});returnks};functioncomputeState(current,added,removed,captures){varisPresent=current.has(captures);varisChanging=added.has(captures)||removed.has(captures);return(isPresent?IS_PRESENT:0)|(isChanging?IS_CHANGING:0)}module.exports.DemandMatcher=DemandMatcher},{"./patch.js":232,"./trie.js":239,"./util.js":241,immutable:220}],228:[function(require,module,exports){"use strict";varImmutable=require("immutable");varDataspace=require("./dataspace.js").Dataspace;functionGround(bootFn){varself=this;this.stepperId=null;this.stepping=false;this.startingFuel=100;this.baseStack=Immutable.List.of({dataspace:this,activePid:-1});Dataspace.withDataspaceStack(this.baseStack,function(){self.dataspace=newDataspace(bootFn)})}Ground.prototype.step=function(){varself=this;returnDataspace.withDataspaceStack(this.baseStack,function(){returnself.dataspace.step()})};Ground.prototype.checkPid=function(pid){if(pid!==-1)console.error("Weird pid in Ground",pid)};Ground.prototype.markRunnable=function(pid){this.checkPid(pid);this.startStepping()};Ground.prototype.startStepping=function(){varself=this;if(this.stepperId)return;if(this.stepping)return;this.stepping=true;try{varstillBusy=false;for(varfuel=this.startingFuel;fuel>0;fuel--){stillBusy=this.step();if(!stillBusy)break}if(stillBusy){this.stepperId=setTimeout(function(){self.stepperId=null;self.startStepping()},0)}}catch(e){this.stepping=false;throwe}this.stepping=false;returnthis};Ground.prototype.stopStepping=function(){if(this.stepperId){clearTimeout(this.stepperId);this.stepperId=null}};Ground.prototype.kill=function(pid,exn){this.checkPid(pid);console.log("Ground dataspace terminated");this.stopStepping()};Ground.prototype.enqueueAction=function(pid,action){this.checkPid(pid);switch(action.type){case"stateChange":if(action.patch.isNonEmpty()){console.error("You have subscribed to a nonexistent event source.",action.patch.pretty())}break;case"message":console.error("You have sent a message into the outer void.",action);break;default:console.error("Internal error: unexpected action at ground level",action);break}};module.exports.Ground=Ground},{"./dataspace.js":226,immutable:220}],229:[function(require,module,exports){"use strict";functioncopyKeys(keys,to,from){for(vari=0;i<keys.length;i++){to[keys[i]]=from[keys[i]]}}module.exports=require("./dataspace.js");module.exports.Trie=require("./trie.js");copyKeys(["__","_$","$Capture","$Special","is_emptyTrie","emptyTrie","embeddedTrie","compilePattern","project","projectObjects","prettyTrie"],module.exports,module.exports.Trie);module.exports.Struct=require("./struct.js");varSeal=require("./seal.js");copyKeys(["Seal","seal"],module.exports,Seal);module.exports.DemandMatcher=require("./demand-matcher.js").DemandMatcher;module.exports.Ack=require("./ack.js").Ack;module.exports.RandomID=require("./randomid.js");module.exports.UI=require(
returnwalk(m);functionwalk(m){if(is_emptyTrie(m))returnemptyTrie;if(minstanceof$Success)returnmTailFn(m.value);vartarget=newEmptyBranch();target.wild=walk(m.wild);m.edges.forEach(function(keymap,arity){keymap.forEach(function(k,key){rupdate_inplace(target,arity,key,walk(k))})});returncollapse(target)}}functiontrieStep(m,arity,key){if(typeofkey==="undefined"){die("trieStep: missing 'key' argument")}if(is_emptyTrie(m))returnemptyTrie;if(minstanceof$Success)returnemptyTrie;returnrlookup(m,arity,key)}functionrelabel(m,f){returnappendTrie(m,function(v){varv1=f(v);returnv1?rsuccess(v1):emptyTrie})}functionprojectionNames(p){varnames=[];walk(p);returnnames;functionwalk(p){if(isCapture(p)){names.push(captureName(p));walk(capturePattern(p));return}if(Array.isArray(p)){for(vari=0;i<p.length;i++)walk(p[i]);return}if(Struct.isStructure(p)){for(vari=0;i<p.meta.arity;i++)walk(p[i]);return}}}functionprojectionArity(p){returnprojectionNames(p).length}functionprojectionToPattern(p){returnwalk(p);functionwalk(p){if(isCapture(p))returnwalk(capturePattern(p));if(Array.isArray(p)){varresult=[];for(vari=0;i<p.length;i++){result.push(walk(p[i]))}returnresult}if(Struct.isStructure(p)){varresultFields=[];for(vari=0;i<p.meta.arity;i++){resultFields[i]=walk(p[i])}returnnewStruct.Structure(p.meta,resultFields)}returnp}}functionproject(t,wholeSpec,projectSuccessOpt,combinerOpt){returnprojectMany(t,Immutable.List.of(wholeSpec),projectSuccessOpt,combinerOpt)}functionprojectMany(t,wholeSpecs,projectSuccessOpt,combinerOpt){varprojectSuccess=projectSuccessOpt||rsuccess;varcombiner=combinerOpt||unionSuccessesDefault;returnwalk(false,t,Immutable.List(wholeSpecs),function(t){if(tinstanceof$Success){returnprojectSuccess(t.value)}else{returnemptyTrie}});functionwalk(isCapturing,t,specs,kont){if(specs.isEmpty())returnkont(t);if(!(tinstanceof$Branch))returnemptyTrie;varspec=specs.first();varspecsRest=specs.rest();if(isCapture(spec)){if(isCapturing){die("projectMany: nested capture in projection: "+wholeSpecs)}returnwalk(true,t,Immutable.List.of(capturePattern(spec)),function(intermediate){returnwalk(false,intermediate,specsRest,kont)})}if(spec===__){if(isCapturing){vartarget=newEmptyBranch();target.wild=walk(isCapturing,t.wild,specsRest,kont);t.edges.forEach(function(keymap,arity){varinnerSpecs=Immutable.Repeat(__,arity);keymap.forEach(function(k,key){rupdate_inplace(target,arity,key,walk(isCapturing,k,innerSpecs,function(intermediate){returnwalk(isCapturing,intermediate,specsRest,kont)}))})});returncollapse(target)}else{varseed=walk(isCapturing,t.wild,specsRest,kont);t.edges.forEach(function(keymap,arity){varinnerSpecs=Immutable.Repeat(__,arity);keymap.forEach(function(k,key){seed=union(seed,walk(isCapturing,k,innerSpecs,function(intermediate){returnwalk(isCapturing,intermediate,specsRest,kont)}),combiner)})});returnseed}returntarget}if(Struct.isStructure(spec)){varintermediate=walk(isCapturing,rlookup(t,spec.meta.arity,spec.meta),Immutable.List(spec.fields),function(intermediate){returnwalk(isCapturing,intermediate,specsRest,kont)});returnisCapturing?rseq(spec.meta.arity,spec.meta,intermediate):intermediate}if(Array.isArray(spec)){varintermediate=walk(isCapturing,rlookup(t,spec.length,SOA),Immutable.List(spec),function(intermediate){returnwalk(isCapturing,intermediate,specsRest,kont)});returnisCapturing?rseq(spec.length,SOA,intermediate):intermediate}if(specinstanceof$Embedded){die("$Embedded patterns not supported in projectMany()")}varintermediate=walk(isCapturing,rlookup(t,0,spec),specsRest,kont);returnisCapturing?rseq(0,spec,intermediate):intermediate}}functionreconstructSequence(key,items){if(key===SOA){returnitems.toArray()}else{returnkey.instantiate(items.toArray())}}functiontrieKeys(m,takeCount0){if(typeoftakeCount0!=="number"){die("Missing mandatory argument 'takeCount' to Trie.trieKeys")}if(is_emptyTrie(m))returnImmutable.Set();returnwalk(m,takeCount0,Immutable.List(),function(items,tail){if(is_emptyTrie(tail))returnImmutable.Set();if(tailinstanceof$Success)retur