nexskills 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/nexskills.min.js +1 -1
  2. package/package.json +1 -1
package/nexskills.min.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see nexskills.min.js.LICENSE.txt */
2
- !function(){"use strict";var __webpack_require__={};__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();for(var byteLength_1=function byteLength(b64){var lens=getLens(b64),validLen=lens[0],placeHoldersLen=lens[1];return 3*(validLen+placeHoldersLen)/4-placeHoldersLen},toByteArray_1=function toByteArray(b64){var tmp,i,lens=getLens(b64),validLen=lens[0],placeHoldersLen=lens[1],arr=new Arr(function _byteLength(b64,validLen,placeHoldersLen){return 3*(validLen+placeHoldersLen)/4-placeHoldersLen}(0,validLen,placeHoldersLen)),curByte=0,len=placeHoldersLen>0?validLen-4:validLen;for(i=0;i<len;i+=4)tmp=revLookup[b64.charCodeAt(i)]<<18|revLookup[b64.charCodeAt(i+1)]<<12|revLookup[b64.charCodeAt(i+2)]<<6|revLookup[b64.charCodeAt(i+3)],arr[curByte++]=tmp>>16&255,arr[curByte++]=tmp>>8&255,arr[curByte++]=255&tmp;2===placeHoldersLen&&(tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4,arr[curByte++]=255&tmp);1===placeHoldersLen&&(tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2,arr[curByte++]=tmp>>8&255,arr[curByte++]=255&tmp);return arr},fromByteArray_1=function fromByteArray(uint8){for(var tmp,len=uint8.length,extraBytes=len%3,parts=[],i=0,len2=len-extraBytes;i<len2;i+=16383)parts.push(encodeChunk(uint8,i,i+16383>len2?len2:i+16383));1===extraBytes?(tmp=uint8[len-1],parts.push(lookup[tmp>>2]+lookup[tmp<<4&63]+"==")):2===extraBytes&&(tmp=(uint8[len-2]<<8)+uint8[len-1],parts.push(lookup[tmp>>10]+lookup[tmp>>4&63]+lookup[tmp<<2&63]+"="));return parts.join("")},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;function getLens(b64){var len=b64.length;if(len%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var validLen=b64.indexOf("=");return-1===validLen&&(validLen=len),[validLen,validLen===len?0:4-validLen%4]}function encodeChunk(uint8,start,end){for(var tmp,num,output=[],i=start;i<end;i+=3)tmp=(uint8[i]<<16&16711680)+(uint8[i+1]<<8&65280)+(255&uint8[i+2]),output.push(lookup[(num=tmp)>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[63&num]);return output.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63;var base64Js={byteLength:byteLength_1,toByteArray:toByteArray_1,fromByteArray:fromByteArray_1},ieee754_read=function read(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:1/0*(s?-1:1);m+=Math.pow(2,mLen),e-=eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)},ieee754_write=function write(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))*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},buffer$1=function createCommonjsModule(fn,module){return fn(module={exports:{}},module.exports),module.exports}((function(module,exports){var customInspectSymbol="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;exports.Buffer=Buffer,exports.SlowBuffer=function SlowBuffer(length){+length!=length&&(length=0);return Buffer.alloc(+length)},exports.INSPECT_MAX_BYTES=50;function createBuffer(length){if(length>2147483647)throw new RangeError('The value "'+length+'" is invalid for option "size"');var buf=new Uint8Array(length);return Object.setPrototypeOf(buf,Buffer.prototype),buf}function Buffer(arg,encodingOrOffset,length){if("number"==typeof arg){if("string"==typeof encodingOrOffset)throw new TypeError('The "string" argument must be of type string. Received type number');return allocUnsafe(arg)}return from(arg,encodingOrOffset,length)}function from(value,encodingOrOffset,length){if("string"==typeof value)return function fromString(string,encoding){"string"==typeof encoding&&""!==encoding||(encoding="utf8");if(!Buffer.isEncoding(encoding))throw new TypeError("Unknown encoding: "+encoding);var length=0|byteLength(string,encoding),buf=createBuffer(length),actual=buf.write(string,encoding);actual!==length&&(buf=buf.slice(0,actual));return buf}(value,encodingOrOffset);if(ArrayBuffer.isView(value))return function fromArrayView(arrayView){if(isInstance(arrayView,Uint8Array)){var copy=new Uint8Array(arrayView);return fromArrayBuffer(copy.buffer,copy.byteOffset,copy.byteLength)}return fromArrayLike(arrayView)}(value);if(null==value)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(value));if(isInstance(value,ArrayBuffer)||value&&isInstance(value.buffer,ArrayBuffer))return fromArrayBuffer(value,encodingOrOffset,length);if("undefined"!=typeof SharedArrayBuffer&&(isInstance(value,SharedArrayBuffer)||value&&isInstance(value.buffer,SharedArrayBuffer)))return fromArrayBuffer(value,encodingOrOffset,length);if("number"==typeof value)throw new TypeError('The "value" argument must not be of type number. Received type number');var valueOf=value.valueOf&&value.valueOf();if(null!=valueOf&&valueOf!==value)return Buffer.from(valueOf,encodingOrOffset,length);var b=function fromObject(obj){if(Buffer.isBuffer(obj)){var len=0|checked(obj.length),buf=createBuffer(len);return 0===buf.length||obj.copy(buf,0,0,len),buf}if(void 0!==obj.length)return"number"!=typeof obj.length||numberIsNaN(obj.length)?createBuffer(0):fromArrayLike(obj);if("Buffer"===obj.type&&Array.isArray(obj.data))return fromArrayLike(obj.data)}(value);if(b)return b;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof value[Symbol.toPrimitive])return Buffer.from(value[Symbol.toPrimitive]("string"),encodingOrOffset,length);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(value))}function assertSize(size){if("number"!=typeof size)throw new TypeError('"size" argument must be of type number');if(size<0)throw new RangeError('The value "'+size+'" is invalid for option "size"')}function allocUnsafe(size){return assertSize(size),createBuffer(size<0?0:0|checked(size))}function fromArrayLike(array){for(var length=array.length<0?0:0|checked(array.length),buf=createBuffer(length),i=0;i<length;i+=1)buf[i]=255&array[i];return buf}function fromArrayBuffer(array,byteOffset,length){if(byteOffset<0||array.byteLength<byteOffset)throw new RangeError('"offset" is outside of buffer bounds');if(array.byteLength<byteOffset+(length||0))throw new RangeError('"length" is outside of buffer bounds');var buf;return buf=void 0===byteOffset&&void 0===length?new Uint8Array(array):void 0===length?new Uint8Array(array,byteOffset):new Uint8Array(array,byteOffset,length),Object.setPrototypeOf(buf,Buffer.prototype),buf}function checked(length){if(length>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|length}function byteLength(string,encoding){if(Buffer.isBuffer(string))return string.length;if(ArrayBuffer.isView(string)||isInstance(string,ArrayBuffer))return string.byteLength;if("string"!=typeof string)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(string));var len=string.length,mustMatch=arguments.length>2&&!0===arguments[2];if(!mustMatch&&0===len)return 0;for(var loweredCase=!1;;)switch(encoding){case"ascii":case"latin1":case"binary":return len;case"utf8":case"utf-8":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 mustMatch?-1: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))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),numberIsNaN(byteOffset=+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,"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){var i,indexSize=1,arrLength=arr.length,valLength=val.length;if(void 0!==encoding&&("ucs2"===(encoding=String(encoding).toLowerCase())||"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}function read(buf,i){return 1===indexSize?buf[i]:buf.readUInt16BE(i*indexSize)}if(dir){var foundIndex=-1;for(i=byteOffset;i<arrLength;i++)if(read(arr,i)===read(val,-1===foundIndex?0:i-foundIndex)){if(-1===foundIndex&&(foundIndex=i),i-foundIndex+1===valLength)return foundIndex*indexSize}else-1!==foundIndex&&(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))>remaining&&(length=remaining):length=remaining;var strLen=string.length;length>strLen/2&&(length=strLen/2);for(var i=0;i<length;++i){var parsed=parseInt(string.substr(2*i,2),16);if(numberIsNaN(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(function asciiToBytes(str){for(var byteArray=[],i=0;i<str.length;++i)byteArray.push(255&str.charCodeAt(i));return byteArray}(string),buf,offset,length)}function base64Write(buf,string,offset,length){return blitBuffer(base64ToBytes(string),buf,offset,length)}function ucs2Write(buf,string,offset,length){return blitBuffer(function utf16leToBytes(str,units){for(var c,hi,lo,byteArray=[],i=0;i<str.length&&!((units-=2)<0);++i)hi=(c=str.charCodeAt(i))>>8,lo=c%256,byteArray.push(lo),byteArray.push(hi);return byteArray}(string,buf.length-offset),buf,offset,length)}function base64Slice(buf,start,end){return 0===start&&end===buf.length?base64Js.fromByteArray(buf):base64Js.fromByteArray(buf.slice(start,end))}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);for(var res=[],i=start;i<end;){var secondByte,thirdByte,fourthByte,tempCodePoint,firstByte=buf[i],codePoint=null,bytesPerSequence=firstByte>239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end)switch(bytesPerSequence){case 1:firstByte<128&&(codePoint=firstByte);break;case 2:128==(192&(secondByte=buf[i+1]))&&(tempCodePoint=(31&firstByte)<<6|63&secondByte)>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)>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)>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 function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=4096)return String.fromCharCode.apply(String,codePoints);var res="",i=0;for(;i<len;)res+=String.fromCharCode.apply(String,codePoints.slice(i,i+=4096));return res}(res)}exports.kMaxLength=2147483647,Buffer.TYPED_ARRAY_SUPPORT=function typedArraySupport(){try{var arr=new Uint8Array(1),proto={foo:function foo(){return 42}};return Object.setPrototypeOf(proto,Uint8Array.prototype),Object.setPrototypeOf(arr,proto),42===arr.foo()}catch(e){return!1}}(),Buffer.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(Buffer.prototype,"parent",{enumerable:!0,get:function get(){if(Buffer.isBuffer(this))return this.buffer}}),Object.defineProperty(Buffer.prototype,"offset",{enumerable:!0,get:function get(){if(Buffer.isBuffer(this))return this.byteOffset}}),Buffer.poolSize=8192,Buffer.from=function(value,encodingOrOffset,length){return from(value,encodingOrOffset,length)},Object.setPrototypeOf(Buffer.prototype,Uint8Array.prototype),Object.setPrototypeOf(Buffer,Uint8Array),Buffer.alloc=function(size,fill,encoding){return function alloc(size,fill,encoding){return assertSize(size),size<=0?createBuffer(size):void 0!==fill?"string"==typeof encoding?createBuffer(size).fill(fill,encoding):createBuffer(size).fill(fill):createBuffer(size)}(size,fill,encoding)},Buffer.allocUnsafe=function(size){return allocUnsafe(size)},Buffer.allocUnsafeSlow=function(size){return allocUnsafe(size)},Buffer.isBuffer=function isBuffer(b){return null!=b&&!0===b._isBuffer&&b!==Buffer.prototype},Buffer.compare=function compare(a,b){if(isInstance(a,Uint8Array)&&(a=Buffer.from(a,a.offset,a.byteLength)),isInstance(b,Uint8Array)&&(b=Buffer.from(b,b.offset,b.byteLength)),!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');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 isEncoding(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 concat(list,length){if(!Array.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(isInstance(buf,Uint8Array))pos+buf.length>buffer.length?Buffer.from(buf).copy(buffer,pos):Uint8Array.prototype.set.call(buffer,buf,pos);else{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 swap16(){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 swap32(){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 swap64(){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 toString(){var length=this.length;return 0===length?"":0===arguments.length?utf8Slice(this,0,length):slowToString.apply(this,arguments)},Buffer.prototype.toLocaleString=Buffer.prototype.toString,Buffer.prototype.equals=function equals(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 inspect(){var str="",max=exports.INSPECT_MAX_BYTES;return str=this.toString("hex",0,max).replace(/(.{2})/g,"$1 ").trim(),this.length>max&&(str+=" ... "),"<Buffer "+str+">"},customInspectSymbol&&(Buffer.prototype[customInspectSymbol]=Buffer.prototype.inspect),Buffer.prototype.compare=function compare(target,start,end,thisStart,thisEnd){if(isInstance(target,Uint8Array)&&(target=Buffer.from(target,target.offset,target.byteLength)),!Buffer.isBuffer(target))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(target));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(this===target)return 0;for(var x=(thisEnd>>>=0)-(thisStart>>>=0),y=(end>>>=0)-(start>>>=0),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 includes(val,byteOffset,encoding){return-1!==this.indexOf(val,byteOffset,encoding)},Buffer.prototype.indexOf=function indexOf(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,!0)},Buffer.prototype.lastIndexOf=function lastIndexOf(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,!1)},Buffer.prototype.write=function write(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":case"latin1":case"binary":return asciiWrite(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 toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};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+=hexSliceLookupTable[buf[i]];return out}function utf16leSlice(buf,start,end){for(var bytes=buf.slice(start,end),res="",i=0;i<bytes.length-1;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 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 value=+value,offset>>>=0,noAssert||checkIEEE754(buf,0,offset,4),ieee754_write(buf,value,offset,littleEndian,23,4),offset+4}function writeDouble(buf,value,offset,littleEndian,noAssert){return value=+value,offset>>>=0,noAssert||checkIEEE754(buf,0,offset,8),ieee754_write(buf,value,offset,littleEndian,52,8),offset+8}Buffer.prototype.slice=function slice(start,end){var len=this.length;(start=~~start)<0?(start+=len)<0&&(start=0):start>len&&(start=len),(end=void 0===end?len:~~end)<0?(end+=len)<0&&(end=0):end>len&&(end=len),end<start&&(end=start);var newBuf=this.subarray(start,end);return Object.setPrototypeOf(newBuf,Buffer.prototype),newBuf},Buffer.prototype.readUintLE=Buffer.prototype.readUIntLE=function readUIntLE(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=Buffer.prototype.readUIntBE=function readUIntBE(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=Buffer.prototype.readUInt8=function readUInt8(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,1,this.length),this[offset]},Buffer.prototype.readUint16LE=Buffer.prototype.readUInt16LE=function readUInt16LE(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,2,this.length),this[offset]|this[offset+1]<<8},Buffer.prototype.readUint16BE=Buffer.prototype.readUInt16BE=function readUInt16BE(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,2,this.length),this[offset]<<8|this[offset+1]},Buffer.prototype.readUint32LE=Buffer.prototype.readUInt32LE=function readUInt32LE(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+16777216*this[offset+3]},Buffer.prototype.readUint32BE=Buffer.prototype.readUInt32BE=function readUInt32BE(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),16777216*this[offset]+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])},Buffer.prototype.readIntLE=function readIntLE(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>=(mul*=128)&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readIntBE=function readIntBE(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 val>=(mul*=128)&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readInt8=function readInt8(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,1,this.length),128&this[offset]?-1*(255-this[offset]+1):this[offset]},Buffer.prototype.readInt16LE=function readInt16LE(offset,noAssert){offset>>>=0,noAssert||checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt16BE=function readInt16BE(offset,noAssert){offset>>>=0,noAssert||checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt32LE=function readInt32LE(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24},Buffer.prototype.readInt32BE=function readInt32BE(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]},Buffer.prototype.readFloatLE=function readFloatLE(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),ieee754_read(this,offset,!0,23,4)},Buffer.prototype.readFloatBE=function readFloatBE(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),ieee754_read(this,offset,!1,23,4)},Buffer.prototype.readDoubleLE=function readDoubleLE(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,8,this.length),ieee754_read(this,offset,!0,52,8)},Buffer.prototype.readDoubleBE=function readDoubleBE(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,8,this.length),ieee754_read(this,offset,!1,52,8)},Buffer.prototype.writeUintLE=Buffer.prototype.writeUIntLE=function writeUIntLE(value,offset,byteLength,noAssert){(value=+value,offset>>>=0,byteLength>>>=0,noAssert)||checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength)-1,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=Buffer.prototype.writeUIntBE=function writeUIntBE(value,offset,byteLength,noAssert){(value=+value,offset>>>=0,byteLength>>>=0,noAssert)||checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength)-1,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=Buffer.prototype.writeUInt8=function writeUInt8(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,1,255,0),this[offset]=255&value,offset+1},Buffer.prototype.writeUint16LE=Buffer.prototype.writeUInt16LE=function writeUInt16LE(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,2,65535,0),this[offset]=255&value,this[offset+1]=value>>>8,offset+2},Buffer.prototype.writeUint16BE=Buffer.prototype.writeUInt16BE=function writeUInt16BE(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,2,65535,0),this[offset]=value>>>8,this[offset+1]=255&value,offset+2},Buffer.prototype.writeUint32LE=Buffer.prototype.writeUInt32LE=function writeUInt32LE(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,4,4294967295,0),this[offset+3]=value>>>24,this[offset+2]=value>>>16,this[offset+1]=value>>>8,this[offset]=255&value,offset+4},Buffer.prototype.writeUint32BE=Buffer.prototype.writeUInt32BE=function writeUInt32BE(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,4,4294967295,0),this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value,offset+4},Buffer.prototype.writeIntLE=function writeIntLE(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 writeIntBE(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 writeInt8(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,1,127,-128),value<0&&(value=255+value+1),this[offset]=255&value,offset+1},Buffer.prototype.writeInt16LE=function writeInt16LE(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,2,32767,-32768),this[offset]=255&value,this[offset+1]=value>>>8,offset+2},Buffer.prototype.writeInt16BE=function writeInt16BE(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,2,32767,-32768),this[offset]=value>>>8,this[offset+1]=255&value,offset+2},Buffer.prototype.writeInt32LE=function writeInt32LE(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),this[offset]=255&value,this[offset+1]=value>>>8,this[offset+2]=value>>>16,this[offset+3]=value>>>24,offset+4},Buffer.prototype.writeInt32BE=function writeInt32BE(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),value<0&&(value=4294967295+value+1),this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value,offset+4},Buffer.prototype.writeFloatLE=function writeFloatLE(value,offset,noAssert){return writeFloat(this,value,offset,!0,noAssert)},Buffer.prototype.writeFloatBE=function writeFloatBE(value,offset,noAssert){return writeFloat(this,value,offset,!1,noAssert)},Buffer.prototype.writeDoubleLE=function writeDoubleLE(value,offset,noAssert){return writeDouble(this,value,offset,!0,noAssert)},Buffer.prototype.writeDoubleBE=function writeDoubleBE(value,offset,noAssert){return writeDouble(this,value,offset,!1,noAssert)},Buffer.prototype.copy=function copy(target,targetStart,start,end){if(!Buffer.isBuffer(target))throw new TypeError("argument should be a Buffer");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("Index out of range");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 len=end-start;return this===target&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(targetStart,start,end):Uint8Array.prototype.set.call(target,this.subarray(start,end),targetStart),len},Buffer.prototype.fill=function fill(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),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);if(1===val.length){var code=val.charCodeAt(0);("utf8"===encoding&&code<128||"latin1"===encoding)&&(val=code)}}else"number"==typeof val?val&=255:"boolean"==typeof val&&(val=Number(val));if(start<0||this.length<start||this.length<end)throw new RangeError("Out of range index");if(end<=start)return this;var i;if(start>>>=0,end=void 0===end?this.length:end>>>0,val||(val=0),"number"==typeof val)for(i=start;i<end;++i)this[i]=val;else{var bytes=Buffer.isBuffer(val)?val:Buffer.from(val,encoding),len=bytes.length;if(0===len)throw new TypeError('The value "'+val+'" is invalid for argument "value"');for(i=0;i<end-start;++i)this[i+start]=bytes[i%len]}return this};var INVALID_BASE64_RE=/[^+/0-9A-Za-z-_]/g;function utf8ToBytes(string,units){var codePoint;units=units||1/0;for(var length=string.length,leadSurrogate=null,bytes=[],i=0;i<length;++i){if((codePoint=string.charCodeAt(i))>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=65536+(leadSurrogate-55296<<10|codePoint-56320)}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 base64ToBytes(str){return base64Js.toByteArray(function base64clean(str){if((str=(str=str.split("=")[0]).trim().replace(INVALID_BASE64_RE,"")).length<2)return"";for(;str.length%4!=0;)str+="=";return str}(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 isInstance(obj,type){return obj instanceof type||null!=obj&&null!=obj.constructor&&null!=obj.constructor.name&&obj.constructor.name===type.name}function numberIsNaN(obj){return obj!=obj}var hexSliceLookupTable=function(){for(var table=new Array(256),i=0;i<16;++i)for(var i16=16*i,j=0;j<16;++j)table[i16+j]="0123456789abcdef"[i]+"0123456789abcdef"[j];return table}()})),buffer_1=buffer$1.Buffer;buffer$1.SlowBuffer,buffer$1.INSPECT_MAX_BYTES,buffer$1.kMaxLength;var _extendStatics=function extendStatics(d,b){return _extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},_extendStatics(d,b)};function __extends(d,b){function __(){this.constructor=d}_extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var BSONError=function(_super){function BSONError(message){var _this=_super.call(this,message)||this;return Object.setPrototypeOf(_this,BSONError.prototype),_this}return __extends(BSONError,_super),Object.defineProperty(BSONError.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),BSONError}(Error),BSONTypeError=function(_super){function BSONTypeError(message){var _this=_super.call(this,message)||this;return Object.setPrototypeOf(_this,BSONTypeError.prototype),_this}return __extends(BSONTypeError,_super),Object.defineProperty(BSONTypeError.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),BSONTypeError}(TypeError);function checkForMath(potentialGlobal){return potentialGlobal&&potentialGlobal.Math==Math&&potentialGlobal}function getGlobal(){return checkForMath("object"==typeof globalThis&&globalThis)||checkForMath("object"==typeof window&&window)||checkForMath("object"==typeof self&&self)||checkForMath("object"==typeof __webpack_require__.g&&__webpack_require__.g)||Function("return this")()}var insecureRandomBytes=function insecureRandomBytes(size){var insecureWarning=function isReactNative(){var g=getGlobal();return"object"==typeof g.navigator&&"ReactNative"===g.navigator.product}()?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(insecureWarning);for(var result=buffer_1.alloc(size),i=0;i<size;++i)result[i]=Math.floor(256*Math.random());return result},randomBytes=function(){if("undefined"!=typeof window){var target_1=window.crypto||window.msCrypto;if(target_1&&target_1.getRandomValues)return function(size){return target_1.getRandomValues(buffer_1.alloc(size))}}return void 0!==__webpack_require__.g&&__webpack_require__.g.crypto&&__webpack_require__.g.crypto.getRandomValues?function(size){return __webpack_require__.g.crypto.getRandomValues(buffer_1.alloc(size))}:insecureRandomBytes}();function isAnyArrayBuffer(value){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(value))}function isUint8Array(value){return"[object Uint8Array]"===Object.prototype.toString.call(value)}function isRegExp(d){return"[object RegExp]"===Object.prototype.toString.call(d)}function isDate(d){return isObjectLike(d)&&"[object Date]"===Object.prototype.toString.call(d)}function isObjectLike(candidate){return"object"==typeof candidate&&null!==candidate}function deprecate(fn,message){var warned=!1;return function deprecated(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];return warned||(console.warn(message),warned=!0),fn.apply(this,args)}}function ensureBuffer(potentialBuffer){if(ArrayBuffer.isView(potentialBuffer))return buffer_1.from(potentialBuffer.buffer,potentialBuffer.byteOffset,potentialBuffer.byteLength);if(isAnyArrayBuffer(potentialBuffer))return buffer_1.from(potentialBuffer);throw new BSONTypeError("Must use either Buffer or TypedArray")}var VALIDATION_REGEX=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i,uuidValidateString=function(str){return"string"==typeof str&&VALIDATION_REGEX.test(str)},uuidHexStringToBuffer=function(hexString){if(!uuidValidateString(hexString))throw new BSONTypeError('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var sanitizedHexString=hexString.replace(/-/g,"");return buffer_1.from(sanitizedHexString,"hex")},bufferToUuidHexString=function(buffer,includeDashes){return void 0===includeDashes&&(includeDashes=!0),includeDashes?buffer.toString("hex",0,4)+"-"+buffer.toString("hex",4,6)+"-"+buffer.toString("hex",6,8)+"-"+buffer.toString("hex",8,10)+"-"+buffer.toString("hex",10,16):buffer.toString("hex")},JS_INT_MAX=(Math.pow(2,63),Math.pow(2,63),Math.pow(2,53)),JS_INT_MIN=-Math.pow(2,53),Binary=function(){function Binary(buffer,subType){if(!(this instanceof Binary))return new Binary(buffer,subType);if(!(null==buffer||"string"==typeof buffer||ArrayBuffer.isView(buffer)||buffer instanceof ArrayBuffer||Array.isArray(buffer)))throw new BSONTypeError("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=null!=subType?subType:Binary.BSON_BINARY_SUBTYPE_DEFAULT,null==buffer?(this.buffer=buffer_1.alloc(Binary.BUFFER_SIZE),this.position=0):("string"==typeof buffer?this.buffer=buffer_1.from(buffer,"binary"):Array.isArray(buffer)?this.buffer=buffer_1.from(buffer):this.buffer=ensureBuffer(buffer),this.position=this.buffer.byteLength)}return Binary.prototype.put=function(byteValue){if("string"==typeof byteValue&&1!==byteValue.length)throw new BSONTypeError("only accepts single character String");if("number"!=typeof byteValue&&1!==byteValue.length)throw new BSONTypeError("only accepts single character Uint8Array or Array");var decodedByte;if((decodedByte="string"==typeof byteValue?byteValue.charCodeAt(0):"number"==typeof byteValue?byteValue:byteValue[0])<0||decodedByte>255)throw new BSONTypeError("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=decodedByte;else{var buffer=buffer_1.alloc(Binary.BUFFER_SIZE+this.buffer.length);this.buffer.copy(buffer,0,0,this.buffer.length),this.buffer=buffer,this.buffer[this.position++]=decodedByte}},Binary.prototype.write=function(sequence,offset){if(offset="number"==typeof offset?offset:this.position,this.buffer.length<offset+sequence.length){var buffer=buffer_1.alloc(this.buffer.length+sequence.length);this.buffer.copy(buffer,0,0,this.buffer.length),this.buffer=buffer}ArrayBuffer.isView(sequence)?(this.buffer.set(ensureBuffer(sequence),offset),this.position=offset+sequence.byteLength>this.position?offset+sequence.length:this.position):"string"==typeof sequence&&(this.buffer.write(sequence,offset,sequence.length,"binary"),this.position=offset+sequence.length>this.position?offset+sequence.length:this.position)},Binary.prototype.read=function(position,length){return length=length&&length>0?length:this.position,this.buffer.slice(position,position+length)},Binary.prototype.value=function(asRaw){return(asRaw=!!asRaw)&&this.buffer.length===this.position?this.buffer:asRaw?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},Binary.prototype.length=function(){return this.position},Binary.prototype.toJSON=function(){return this.buffer.toString("base64")},Binary.prototype.toString=function(format){return this.buffer.toString(format)},Binary.prototype.toExtendedJSON=function(options){options=options||{};var base64String=this.buffer.toString("base64"),subType=Number(this.sub_type).toString(16);return options.legacy?{$binary:base64String,$type:1===subType.length?"0"+subType:subType}:{$binary:{base64:base64String,subType:1===subType.length?"0"+subType:subType}}},Binary.prototype.toUUID=function(){if(this.sub_type===Binary.SUBTYPE_UUID)return new UUID(this.buffer.slice(0,this.position));throw new BSONError('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(Binary.SUBTYPE_UUID,'" is currently supported.'))},Binary.fromExtendedJSON=function(doc,options){var data,type;if(options=options||{},"$binary"in doc?options.legacy&&"string"==typeof doc.$binary&&"$type"in doc?(type=doc.$type?parseInt(doc.$type,16):0,data=buffer_1.from(doc.$binary,"base64")):"string"!=typeof doc.$binary&&(type=doc.$binary.subType?parseInt(doc.$binary.subType,16):0,data=buffer_1.from(doc.$binary.base64,"base64")):"$uuid"in doc&&(type=4,data=uuidHexStringToBuffer(doc.$uuid)),!data)throw new BSONTypeError("Unexpected Binary Extended JSON format ".concat(JSON.stringify(doc)));return 4===type?new UUID(data):new Binary(data,type)},Binary.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},Binary.prototype.inspect=function(){var asBuffer=this.value(!0);return'new Binary(Buffer.from("'.concat(asBuffer.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},Binary.BSON_BINARY_SUBTYPE_DEFAULT=0,Binary.BUFFER_SIZE=256,Binary.SUBTYPE_DEFAULT=0,Binary.SUBTYPE_FUNCTION=1,Binary.SUBTYPE_BYTE_ARRAY=2,Binary.SUBTYPE_UUID_OLD=3,Binary.SUBTYPE_UUID=4,Binary.SUBTYPE_MD5=5,Binary.SUBTYPE_ENCRYPTED=6,Binary.SUBTYPE_COLUMN=7,Binary.SUBTYPE_USER_DEFINED=128,Binary}();Object.defineProperty(Binary.prototype,"_bsontype",{value:"Binary"});var UUID=function(_super){function UUID(input){var bytes,hexStr,_this=this;if(null==input)bytes=UUID.generate();else if(input instanceof UUID)bytes=buffer_1.from(input.buffer),hexStr=input.__id;else if(ArrayBuffer.isView(input)&&16===input.byteLength)bytes=ensureBuffer(input);else{if("string"!=typeof input)throw new BSONTypeError("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");bytes=uuidHexStringToBuffer(input)}return(_this=_super.call(this,bytes,4)||this).__id=hexStr,_this}return __extends(UUID,_super),Object.defineProperty(UUID.prototype,"id",{get:function(){return this.buffer},set:function(value){this.buffer=value,UUID.cacheHexString&&(this.__id=bufferToUuidHexString(value))},enumerable:!1,configurable:!0}),UUID.prototype.toHexString=function(includeDashes){if(void 0===includeDashes&&(includeDashes=!0),UUID.cacheHexString&&this.__id)return this.__id;var uuidHexString=bufferToUuidHexString(this.id,includeDashes);return UUID.cacheHexString&&(this.__id=uuidHexString),uuidHexString},UUID.prototype.toString=function(encoding){return encoding?this.id.toString(encoding):this.toHexString()},UUID.prototype.toJSON=function(){return this.toHexString()},UUID.prototype.equals=function(otherId){if(!otherId)return!1;if(otherId instanceof UUID)return otherId.id.equals(this.id);try{return new UUID(otherId).id.equals(this.id)}catch(_a){return!1}},UUID.prototype.toBinary=function(){return new Binary(this.id,Binary.SUBTYPE_UUID)},UUID.generate=function(){var bytes=randomBytes(16);return bytes[6]=15&bytes[6]|64,bytes[8]=63&bytes[8]|128,buffer_1.from(bytes)},UUID.isValid=function(input){return!!input&&(input instanceof UUID||("string"==typeof input?uuidValidateString(input):!!isUint8Array(input)&&(16===input.length&&(64==(240&input[6])&&128==(128&input[8])))))},UUID.createFromHexString=function(hexString){return new UUID(uuidHexStringToBuffer(hexString))},UUID.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},UUID.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},UUID}(Binary),Code=function(){function Code(code,scope){if(!(this instanceof Code))return new Code(code,scope);this.code=code,this.scope=scope}return Code.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},Code.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},Code.fromExtendedJSON=function(doc){return new Code(doc.$code,doc.$scope)},Code.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},Code.prototype.inspect=function(){var codeJson=this.toJSON();return'new Code("'.concat(String(codeJson.code),'"').concat(codeJson.scope?", ".concat(JSON.stringify(codeJson.scope)):"",")")},Code}();function isDBRefLike(value){return isObjectLike(value)&&null!=value.$id&&"string"==typeof value.$ref&&(null==value.$db||"string"==typeof value.$db)}Object.defineProperty(Code.prototype,"_bsontype",{value:"Code"});var DBRef=function(){function DBRef(collection,oid,db,fields){if(!(this instanceof DBRef))return new DBRef(collection,oid,db,fields);var parts=collection.split(".");2===parts.length&&(db=parts.shift(),collection=parts.shift()),this.collection=collection,this.oid=oid,this.db=db,this.fields=fields||{}}return Object.defineProperty(DBRef.prototype,"namespace",{get:function(){return this.collection},set:function(value){this.collection=value},enumerable:!1,configurable:!0}),DBRef.prototype.toJSON=function(){var o=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return null!=this.db&&(o.$db=this.db),o},DBRef.prototype.toExtendedJSON=function(options){options=options||{};var o={$ref:this.collection,$id:this.oid};return options.legacy?o:(this.db&&(o.$db=this.db),o=Object.assign(o,this.fields))},DBRef.fromExtendedJSON=function(doc){var copy=Object.assign({},doc);return delete copy.$ref,delete copy.$id,delete copy.$db,new DBRef(doc.$ref,doc.$id,doc.$db,copy)},DBRef.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},DBRef.prototype.inspect=function(){var oid=void 0===this.oid||void 0===this.oid.toString?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(oid),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},DBRef}();Object.defineProperty(DBRef.prototype,"_bsontype",{value:"DBRef"});var wasm=void 0;try{wasm=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(_a){}var INT_CACHE={},UINT_CACHE={},Long=function(){function Long(low,high,unsigned){if(void 0===low&&(low=0),!(this instanceof Long))return new Long(low,high,unsigned);"bigint"==typeof low?Object.assign(this,Long.fromBigInt(low,!!high)):"string"==typeof low?Object.assign(this,Long.fromString(low,!!high)):(this.low=0|low,this.high=0|high,this.unsigned=!!unsigned),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return Long.fromBits=function(lowBits,highBits,unsigned){return new Long(lowBits,highBits,unsigned)},Long.fromInt=function(value,unsigned){var obj,cachedObj,cache;return unsigned?(cache=0<=(value>>>=0)&&value<256)&&(cachedObj=UINT_CACHE[value])?cachedObj:(obj=Long.fromBits(value,(0|value)<0?-1:0,!0),cache&&(UINT_CACHE[value]=obj),obj):(cache=-128<=(value|=0)&&value<128)&&(cachedObj=INT_CACHE[value])?cachedObj:(obj=Long.fromBits(value,value<0?-1:0,!1),cache&&(INT_CACHE[value]=obj),obj)},Long.fromNumber=function(value,unsigned){if(isNaN(value))return unsigned?Long.UZERO:Long.ZERO;if(unsigned){if(value<0)return Long.UZERO;if(value>=0x10000000000000000)return Long.MAX_UNSIGNED_VALUE}else{if(value<=-0x8000000000000000)return Long.MIN_VALUE;if(value+1>=0x8000000000000000)return Long.MAX_VALUE}return value<0?Long.fromNumber(-value,unsigned).neg():Long.fromBits(value%4294967296|0,value/4294967296|0,unsigned)},Long.fromBigInt=function(value,unsigned){return Long.fromString(value.toString(),unsigned)},Long.fromString=function(str,unsigned,radix){if(0===str.length)throw Error("empty string");if("NaN"===str||"Infinity"===str||"+Infinity"===str||"-Infinity"===str)return Long.ZERO;if("number"==typeof unsigned?(radix=unsigned,unsigned=!1):unsigned=!!unsigned,(radix=radix||10)<2||36<radix)throw RangeError("radix");var p;if((p=str.indexOf("-"))>0)throw Error("interior hyphen");if(0===p)return Long.fromString(str.substring(1),unsigned,radix).neg();for(var radixToPower=Long.fromNumber(Math.pow(radix,8)),result=Long.ZERO,i=0;i<str.length;i+=8){var size=Math.min(8,str.length-i),value=parseInt(str.substring(i,i+size),radix);if(size<8){var power=Long.fromNumber(Math.pow(radix,size));result=result.mul(power).add(Long.fromNumber(value))}else result=(result=result.mul(radixToPower)).add(Long.fromNumber(value))}return result.unsigned=unsigned,result},Long.fromBytes=function(bytes,unsigned,le){return le?Long.fromBytesLE(bytes,unsigned):Long.fromBytesBE(bytes,unsigned)},Long.fromBytesLE=function(bytes,unsigned){return new Long(bytes[0]|bytes[1]<<8|bytes[2]<<16|bytes[3]<<24,bytes[4]|bytes[5]<<8|bytes[6]<<16|bytes[7]<<24,unsigned)},Long.fromBytesBE=function(bytes,unsigned){return new Long(bytes[4]<<24|bytes[5]<<16|bytes[6]<<8|bytes[7],bytes[0]<<24|bytes[1]<<16|bytes[2]<<8|bytes[3],unsigned)},Long.isLong=function(value){return isObjectLike(value)&&!0===value.__isLong__},Long.fromValue=function(val,unsigned){return"number"==typeof val?Long.fromNumber(val,unsigned):"string"==typeof val?Long.fromString(val,unsigned):Long.fromBits(val.low,val.high,"boolean"==typeof unsigned?unsigned:val.unsigned)},Long.prototype.add=function(addend){Long.isLong(addend)||(addend=Long.fromValue(addend));var a48=this.high>>>16,a32=65535&this.high,a16=this.low>>>16,a00=65535&this.low,b48=addend.high>>>16,b32=65535&addend.high,b16=addend.low>>>16,c48=0,c32=0,c16=0,c00=0;return c16+=(c00+=a00+(65535&addend.low))>>>16,c00&=65535,c32+=(c16+=a16+b16)>>>16,c16&=65535,c48+=(c32+=a32+b32)>>>16,c32&=65535,c48+=a48+b48,c48&=65535,Long.fromBits(c16<<16|c00,c48<<16|c32,this.unsigned)},Long.prototype.and=function(other){return Long.isLong(other)||(other=Long.fromValue(other)),Long.fromBits(this.low&other.low,this.high&other.high,this.unsigned)},Long.prototype.compare=function(other){if(Long.isLong(other)||(other=Long.fromValue(other)),this.eq(other))return 0;var thisNeg=this.isNegative(),otherNeg=other.isNegative();return thisNeg&&!otherNeg?-1:!thisNeg&&otherNeg?1:this.unsigned?other.high>>>0>this.high>>>0||other.high===this.high&&other.low>>>0>this.low>>>0?-1:1:this.sub(other).isNegative()?-1:1},Long.prototype.comp=function(other){return this.compare(other)},Long.prototype.divide=function(divisor){if(Long.isLong(divisor)||(divisor=Long.fromValue(divisor)),divisor.isZero())throw Error("division by zero");if(wasm){if(!this.unsigned&&-2147483648===this.high&&-1===divisor.low&&-1===divisor.high)return this;var low=(this.unsigned?wasm.div_u:wasm.div_s)(this.low,this.high,divisor.low,divisor.high);return Long.fromBits(low,wasm.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Long.UZERO:Long.ZERO;var approx,rem,res;if(this.unsigned){if(divisor.unsigned||(divisor=divisor.toUnsigned()),divisor.gt(this))return Long.UZERO;if(divisor.gt(this.shru(1)))return Long.UONE;res=Long.UZERO}else{if(this.eq(Long.MIN_VALUE))return divisor.eq(Long.ONE)||divisor.eq(Long.NEG_ONE)?Long.MIN_VALUE:divisor.eq(Long.MIN_VALUE)?Long.ONE:(approx=this.shr(1).div(divisor).shl(1)).eq(Long.ZERO)?divisor.isNegative()?Long.ONE:Long.NEG_ONE:(rem=this.sub(divisor.mul(approx)),res=approx.add(rem.div(divisor)));if(divisor.eq(Long.MIN_VALUE))return this.unsigned?Long.UZERO:Long.ZERO;if(this.isNegative())return divisor.isNegative()?this.neg().div(divisor.neg()):this.neg().div(divisor).neg();if(divisor.isNegative())return this.div(divisor.neg()).neg();res=Long.ZERO}for(rem=this;rem.gte(divisor);){approx=Math.max(1,Math.floor(rem.toNumber()/divisor.toNumber()));for(var log2=Math.ceil(Math.log(approx)/Math.LN2),delta=log2<=48?1:Math.pow(2,log2-48),approxRes=Long.fromNumber(approx),approxRem=approxRes.mul(divisor);approxRem.isNegative()||approxRem.gt(rem);)approx-=delta,approxRem=(approxRes=Long.fromNumber(approx,this.unsigned)).mul(divisor);approxRes.isZero()&&(approxRes=Long.ONE),res=res.add(approxRes),rem=rem.sub(approxRem)}return res},Long.prototype.div=function(divisor){return this.divide(divisor)},Long.prototype.equals=function(other){return Long.isLong(other)||(other=Long.fromValue(other)),(this.unsigned===other.unsigned||this.high>>>31!=1||other.high>>>31!=1)&&(this.high===other.high&&this.low===other.low)},Long.prototype.eq=function(other){return this.equals(other)},Long.prototype.getHighBits=function(){return this.high},Long.prototype.getHighBitsUnsigned=function(){return this.high>>>0},Long.prototype.getLowBits=function(){return this.low},Long.prototype.getLowBitsUnsigned=function(){return this.low>>>0},Long.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Long.MIN_VALUE)?64:this.neg().getNumBitsAbs();var bit,val=0!==this.high?this.high:this.low;for(bit=31;bit>0&&0==(val&1<<bit);bit--);return 0!==this.high?bit+33:bit+1},Long.prototype.greaterThan=function(other){return this.comp(other)>0},Long.prototype.gt=function(other){return this.greaterThan(other)},Long.prototype.greaterThanOrEqual=function(other){return this.comp(other)>=0},Long.prototype.gte=function(other){return this.greaterThanOrEqual(other)},Long.prototype.ge=function(other){return this.greaterThanOrEqual(other)},Long.prototype.isEven=function(){return 0==(1&this.low)},Long.prototype.isNegative=function(){return!this.unsigned&&this.high<0},Long.prototype.isOdd=function(){return 1==(1&this.low)},Long.prototype.isPositive=function(){return this.unsigned||this.high>=0},Long.prototype.isZero=function(){return 0===this.high&&0===this.low},Long.prototype.lessThan=function(other){return this.comp(other)<0},Long.prototype.lt=function(other){return this.lessThan(other)},Long.prototype.lessThanOrEqual=function(other){return this.comp(other)<=0},Long.prototype.lte=function(other){return this.lessThanOrEqual(other)},Long.prototype.modulo=function(divisor){if(Long.isLong(divisor)||(divisor=Long.fromValue(divisor)),wasm){var low=(this.unsigned?wasm.rem_u:wasm.rem_s)(this.low,this.high,divisor.low,divisor.high);return Long.fromBits(low,wasm.get_high(),this.unsigned)}return this.sub(this.div(divisor).mul(divisor))},Long.prototype.mod=function(divisor){return this.modulo(divisor)},Long.prototype.rem=function(divisor){return this.modulo(divisor)},Long.prototype.multiply=function(multiplier){if(this.isZero())return Long.ZERO;if(Long.isLong(multiplier)||(multiplier=Long.fromValue(multiplier)),wasm){var low=wasm.mul(this.low,this.high,multiplier.low,multiplier.high);return Long.fromBits(low,wasm.get_high(),this.unsigned)}if(multiplier.isZero())return Long.ZERO;if(this.eq(Long.MIN_VALUE))return multiplier.isOdd()?Long.MIN_VALUE:Long.ZERO;if(multiplier.eq(Long.MIN_VALUE))return this.isOdd()?Long.MIN_VALUE:Long.ZERO;if(this.isNegative())return multiplier.isNegative()?this.neg().mul(multiplier.neg()):this.neg().mul(multiplier).neg();if(multiplier.isNegative())return this.mul(multiplier.neg()).neg();if(this.lt(Long.TWO_PWR_24)&&multiplier.lt(Long.TWO_PWR_24))return Long.fromNumber(this.toNumber()*multiplier.toNumber(),this.unsigned);var a48=this.high>>>16,a32=65535&this.high,a16=this.low>>>16,a00=65535&this.low,b48=multiplier.high>>>16,b32=65535&multiplier.high,b16=multiplier.low>>>16,b00=65535&multiplier.low,c48=0,c32=0,c16=0,c00=0;return c16+=(c00+=a00*b00)>>>16,c00&=65535,c32+=(c16+=a16*b00)>>>16,c16&=65535,c32+=(c16+=a00*b16)>>>16,c16&=65535,c48+=(c32+=a32*b00)>>>16,c32&=65535,c48+=(c32+=a16*b16)>>>16,c32&=65535,c48+=(c32+=a00*b32)>>>16,c32&=65535,c48+=a48*b00+a32*b16+a16*b32+a00*b48,c48&=65535,Long.fromBits(c16<<16|c00,c48<<16|c32,this.unsigned)},Long.prototype.mul=function(multiplier){return this.multiply(multiplier)},Long.prototype.negate=function(){return!this.unsigned&&this.eq(Long.MIN_VALUE)?Long.MIN_VALUE:this.not().add(Long.ONE)},Long.prototype.neg=function(){return this.negate()},Long.prototype.not=function(){return Long.fromBits(~this.low,~this.high,this.unsigned)},Long.prototype.notEquals=function(other){return!this.equals(other)},Long.prototype.neq=function(other){return this.notEquals(other)},Long.prototype.ne=function(other){return this.notEquals(other)},Long.prototype.or=function(other){return Long.isLong(other)||(other=Long.fromValue(other)),Long.fromBits(this.low|other.low,this.high|other.high,this.unsigned)},Long.prototype.shiftLeft=function(numBits){return Long.isLong(numBits)&&(numBits=numBits.toInt()),0==(numBits&=63)?this:numBits<32?Long.fromBits(this.low<<numBits,this.high<<numBits|this.low>>>32-numBits,this.unsigned):Long.fromBits(0,this.low<<numBits-32,this.unsigned)},Long.prototype.shl=function(numBits){return this.shiftLeft(numBits)},Long.prototype.shiftRight=function(numBits){return Long.isLong(numBits)&&(numBits=numBits.toInt()),0==(numBits&=63)?this:numBits<32?Long.fromBits(this.low>>>numBits|this.high<<32-numBits,this.high>>numBits,this.unsigned):Long.fromBits(this.high>>numBits-32,this.high>=0?0:-1,this.unsigned)},Long.prototype.shr=function(numBits){return this.shiftRight(numBits)},Long.prototype.shiftRightUnsigned=function(numBits){if(Long.isLong(numBits)&&(numBits=numBits.toInt()),0===(numBits&=63))return this;var high=this.high;if(numBits<32){var low=this.low;return Long.fromBits(low>>>numBits|high<<32-numBits,high>>>numBits,this.unsigned)}return 32===numBits?Long.fromBits(high,0,this.unsigned):Long.fromBits(high>>>numBits-32,0,this.unsigned)},Long.prototype.shr_u=function(numBits){return this.shiftRightUnsigned(numBits)},Long.prototype.shru=function(numBits){return this.shiftRightUnsigned(numBits)},Long.prototype.subtract=function(subtrahend){return Long.isLong(subtrahend)||(subtrahend=Long.fromValue(subtrahend)),this.add(subtrahend.neg())},Long.prototype.sub=function(subtrahend){return this.subtract(subtrahend)},Long.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},Long.prototype.toNumber=function(){return this.unsigned?4294967296*(this.high>>>0)+(this.low>>>0):4294967296*this.high+(this.low>>>0)},Long.prototype.toBigInt=function(){return BigInt(this.toString())},Long.prototype.toBytes=function(le){return le?this.toBytesLE():this.toBytesBE()},Long.prototype.toBytesLE=function(){var hi=this.high,lo=this.low;return[255&lo,lo>>>8&255,lo>>>16&255,lo>>>24,255&hi,hi>>>8&255,hi>>>16&255,hi>>>24]},Long.prototype.toBytesBE=function(){var hi=this.high,lo=this.low;return[hi>>>24,hi>>>16&255,hi>>>8&255,255&hi,lo>>>24,lo>>>16&255,lo>>>8&255,255&lo]},Long.prototype.toSigned=function(){return this.unsigned?Long.fromBits(this.low,this.high,!1):this},Long.prototype.toString=function(radix){if((radix=radix||10)<2||36<radix)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(Long.MIN_VALUE)){var radixLong=Long.fromNumber(radix),div=this.div(radixLong),rem1=div.mul(radixLong).sub(this);return div.toString(radix)+rem1.toInt().toString(radix)}return"-"+this.neg().toString(radix)}for(var radixToPower=Long.fromNumber(Math.pow(radix,6),this.unsigned),rem=this,result="";;){var remDiv=rem.div(radixToPower),digits=(rem.sub(remDiv.mul(radixToPower)).toInt()>>>0).toString(radix);if((rem=remDiv).isZero())return digits+result;for(;digits.length<6;)digits="0"+digits;result=""+digits+result}},Long.prototype.toUnsigned=function(){return this.unsigned?this:Long.fromBits(this.low,this.high,!0)},Long.prototype.xor=function(other){return Long.isLong(other)||(other=Long.fromValue(other)),Long.fromBits(this.low^other.low,this.high^other.high,this.unsigned)},Long.prototype.eqz=function(){return this.isZero()},Long.prototype.le=function(other){return this.lessThanOrEqual(other)},Long.prototype.toExtendedJSON=function(options){return options&&options.relaxed?this.toNumber():{$numberLong:this.toString()}},Long.fromExtendedJSON=function(doc,options){var result=Long.fromString(doc.$numberLong);return options&&options.relaxed?result.toNumber():result},Long.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},Long.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},Long.TWO_PWR_24=Long.fromInt(16777216),Long.MAX_UNSIGNED_VALUE=Long.fromBits(-1,-1,!0),Long.ZERO=Long.fromInt(0),Long.UZERO=Long.fromInt(0,!0),Long.ONE=Long.fromInt(1),Long.UONE=Long.fromInt(1,!0),Long.NEG_ONE=Long.fromInt(-1),Long.MAX_VALUE=Long.fromBits(-1,2147483647,!1),Long.MIN_VALUE=Long.fromBits(0,-2147483648,!1),Long}();Object.defineProperty(Long.prototype,"__isLong__",{value:!0}),Object.defineProperty(Long.prototype,"_bsontype",{value:"Long"});var PARSE_STRING_REGEXP=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,PARSE_INF_REGEXP=/^(\+|-)?(Infinity|inf)$/i,PARSE_NAN_REGEXP=/^(\+|-)?NaN$/i,NAN_BUFFER=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),INF_NEGATIVE_BUFFER=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),INF_POSITIVE_BUFFER=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),EXPONENT_REGEX=/^([-+])?(\d+)?$/;function isDigit(value){return!isNaN(parseInt(value,10))}function divideu128(value){var DIVISOR=Long.fromNumber(1e9),_rem=Long.fromNumber(0);if(!(value.parts[0]||value.parts[1]||value.parts[2]||value.parts[3]))return{quotient:value,rem:_rem};for(var i=0;i<=3;i++)_rem=(_rem=_rem.shiftLeft(32)).add(new Long(value.parts[i],0)),value.parts[i]=_rem.div(DIVISOR).low,_rem=_rem.modulo(DIVISOR);return{quotient:value,rem:_rem}}function invalidErr(string,message){throw new BSONTypeError('"'.concat(string,'" is not a valid Decimal128 string - ').concat(message))}var Decimal128=function(){function Decimal128(bytes){if(!(this instanceof Decimal128))return new Decimal128(bytes);if("string"==typeof bytes)this.bytes=Decimal128.fromString(bytes).bytes;else{if(!isUint8Array(bytes))throw new BSONTypeError("Decimal128 must take a Buffer or string");if(16!==bytes.byteLength)throw new BSONTypeError("Decimal128 must take a Buffer of 16 bytes");this.bytes=bytes}}return Decimal128.fromString=function(representation){var biasedExponent,isNegative=!1,sawRadix=!1,foundNonZero=!1,significantDigits=0,nDigitsRead=0,nDigits=0,radixPosition=0,firstNonZero=0,digits=[0],nDigitsStored=0,digitsInsert=0,firstDigit=0,lastDigit=0,exponent=0,i=0,significandHigh=new Long(0,0),significandLow=new Long(0,0),index=0;if(representation.length>=7e3)throw new BSONTypeError(representation+" not a valid Decimal128 string");var stringMatch=representation.match(PARSE_STRING_REGEXP),infMatch=representation.match(PARSE_INF_REGEXP),nanMatch=representation.match(PARSE_NAN_REGEXP);if(!stringMatch&&!infMatch&&!nanMatch||0===representation.length)throw new BSONTypeError(representation+" not a valid Decimal128 string");if(stringMatch){var unsignedNumber=stringMatch[2],e=stringMatch[4],expSign=stringMatch[5],expNumber=stringMatch[6];e&&void 0===expNumber&&invalidErr(representation,"missing exponent power"),e&&void 0===unsignedNumber&&invalidErr(representation,"missing exponent base"),void 0===e&&(expSign||expNumber)&&invalidErr(representation,"missing e before exponent")}if("+"!==representation[index]&&"-"!==representation[index]||(isNegative="-"===representation[index++]),!isDigit(representation[index])&&"."!==representation[index]){if("i"===representation[index]||"I"===representation[index])return new Decimal128(buffer_1.from(isNegative?INF_NEGATIVE_BUFFER:INF_POSITIVE_BUFFER));if("N"===representation[index])return new Decimal128(buffer_1.from(NAN_BUFFER))}for(;isDigit(representation[index])||"."===representation[index];)"."!==representation[index]?(nDigitsStored<34&&("0"!==representation[index]||foundNonZero)&&(foundNonZero||(firstNonZero=nDigitsRead),foundNonZero=!0,digits[digitsInsert++]=parseInt(representation[index],10),nDigitsStored+=1),foundNonZero&&(nDigits+=1),sawRadix&&(radixPosition+=1),nDigitsRead+=1,index+=1):(sawRadix&&invalidErr(representation,"contains multiple periods"),sawRadix=!0,index+=1);if(sawRadix&&!nDigitsRead)throw new BSONTypeError(representation+" not a valid Decimal128 string");if("e"===representation[index]||"E"===representation[index]){var match=representation.substr(++index).match(EXPONENT_REGEX);if(!match||!match[2])return new Decimal128(buffer_1.from(NAN_BUFFER));exponent=parseInt(match[0],10),index+=match[0].length}if(representation[index])return new Decimal128(buffer_1.from(NAN_BUFFER));if(firstDigit=0,nDigitsStored){if(lastDigit=nDigitsStored-1,1!==(significantDigits=nDigits))for(;0===digits[firstNonZero+significantDigits-1];)significantDigits-=1}else firstDigit=0,lastDigit=0,digits[0]=0,nDigits=1,nDigitsStored=1,significantDigits=0;for(exponent<=radixPosition&&radixPosition-exponent>16384?exponent=-6176:exponent-=radixPosition;exponent>6111;){if((lastDigit+=1)-firstDigit>34){if(digits.join("").match(/^0+$/)){exponent=6111;break}invalidErr(representation,"overflow")}exponent-=1}for(;exponent<-6176||nDigitsStored<nDigits;){if(0===lastDigit&&significantDigits<nDigitsStored){exponent=-6176,significantDigits=0;break}if(nDigitsStored<nDigits?nDigits-=1:lastDigit-=1,exponent<6111)exponent+=1;else{if(digits.join("").match(/^0+$/)){exponent=6111;break}invalidErr(representation,"overflow")}}if(lastDigit-firstDigit+1<significantDigits){var endOfString=nDigitsRead;sawRadix&&(firstNonZero+=1,endOfString+=1),isNegative&&(firstNonZero+=1,endOfString+=1);var roundDigit=parseInt(representation[firstNonZero+lastDigit+1],10),roundBit=0;if(roundDigit>=5&&(roundBit=1,5===roundDigit))for(roundBit=digits[lastDigit]%2==1?1:0,i=firstNonZero+lastDigit+2;i<endOfString;i++)if(parseInt(representation[i],10)){roundBit=1;break}if(roundBit)for(var dIdx=lastDigit;dIdx>=0;dIdx--)if(++digits[dIdx]>9&&(digits[dIdx]=0,0===dIdx)){if(!(exponent<6111))return new Decimal128(buffer_1.from(isNegative?INF_NEGATIVE_BUFFER:INF_POSITIVE_BUFFER));exponent+=1,digits[dIdx]=1}}if(significandHigh=Long.fromNumber(0),significandLow=Long.fromNumber(0),0===significantDigits)significandHigh=Long.fromNumber(0),significandLow=Long.fromNumber(0);else if(lastDigit-firstDigit<17){dIdx=firstDigit;for(significandLow=Long.fromNumber(digits[dIdx++]),significandHigh=new Long(0,0);dIdx<=lastDigit;dIdx++)significandLow=(significandLow=significandLow.multiply(Long.fromNumber(10))).add(Long.fromNumber(digits[dIdx]))}else{dIdx=firstDigit;for(significandHigh=Long.fromNumber(digits[dIdx++]);dIdx<=lastDigit-17;dIdx++)significandHigh=(significandHigh=significandHigh.multiply(Long.fromNumber(10))).add(Long.fromNumber(digits[dIdx]));for(significandLow=Long.fromNumber(digits[dIdx++]);dIdx<=lastDigit;dIdx++)significandLow=(significandLow=significandLow.multiply(Long.fromNumber(10))).add(Long.fromNumber(digits[dIdx]))}var significand=function multiply64x2(left,right){if(!left&&!right)return{high:Long.fromNumber(0),low:Long.fromNumber(0)};var leftHigh=left.shiftRightUnsigned(32),leftLow=new Long(left.getLowBits(),0),rightHigh=right.shiftRightUnsigned(32),rightLow=new Long(right.getLowBits(),0),productHigh=leftHigh.multiply(rightHigh),productMid=leftHigh.multiply(rightLow),productMid2=leftLow.multiply(rightHigh),productLow=leftLow.multiply(rightLow);return productHigh=productHigh.add(productMid.shiftRightUnsigned(32)),productMid=new Long(productMid.getLowBits(),0).add(productMid2).add(productLow.shiftRightUnsigned(32)),{high:productHigh=productHigh.add(productMid.shiftRightUnsigned(32)),low:productLow=productMid.shiftLeft(32).add(new Long(productLow.getLowBits(),0))}}(significandHigh,Long.fromString("100000000000000000"));significand.low=significand.low.add(significandLow),function lessThan(left,right){var uhleft=left.high>>>0,uhright=right.high>>>0;return uhleft<uhright||uhleft===uhright&&left.low>>>0<right.low>>>0}(significand.low,significandLow)&&(significand.high=significand.high.add(Long.fromNumber(1))),biasedExponent=exponent+6176;var dec={low:Long.fromNumber(0),high:Long.fromNumber(0)};significand.high.shiftRightUnsigned(49).and(Long.fromNumber(1)).equals(Long.fromNumber(1))?(dec.high=dec.high.or(Long.fromNumber(3).shiftLeft(61)),dec.high=dec.high.or(Long.fromNumber(biasedExponent).and(Long.fromNumber(16383).shiftLeft(47))),dec.high=dec.high.or(significand.high.and(Long.fromNumber(0x7fffffffffff)))):(dec.high=dec.high.or(Long.fromNumber(16383&biasedExponent).shiftLeft(49)),dec.high=dec.high.or(significand.high.and(Long.fromNumber(562949953421311)))),dec.low=significand.low,isNegative&&(dec.high=dec.high.or(Long.fromString("9223372036854775808")));var buffer=buffer_1.alloc(16);return index=0,buffer[index++]=255&dec.low.low,buffer[index++]=dec.low.low>>8&255,buffer[index++]=dec.low.low>>16&255,buffer[index++]=dec.low.low>>24&255,buffer[index++]=255&dec.low.high,buffer[index++]=dec.low.high>>8&255,buffer[index++]=dec.low.high>>16&255,buffer[index++]=dec.low.high>>24&255,buffer[index++]=255&dec.high.low,buffer[index++]=dec.high.low>>8&255,buffer[index++]=dec.high.low>>16&255,buffer[index++]=dec.high.low>>24&255,buffer[index++]=255&dec.high.high,buffer[index++]=dec.high.high>>8&255,buffer[index++]=dec.high.high>>16&255,buffer[index++]=dec.high.high>>24&255,new Decimal128(buffer)},Decimal128.prototype.toString=function(){for(var biased_exponent,significand_digits=0,significand=new Array(36),i=0;i<significand.length;i++)significand[i]=0;var significand_msb,j,k,index=0,is_zero=!1,significand128={parts:[0,0,0,0]},string=[];index=0;var buffer=this.bytes,low=buffer[index++]|buffer[index++]<<8|buffer[index++]<<16|buffer[index++]<<24,midl=buffer[index++]|buffer[index++]<<8|buffer[index++]<<16|buffer[index++]<<24,midh=buffer[index++]|buffer[index++]<<8|buffer[index++]<<16|buffer[index++]<<24,high=buffer[index++]|buffer[index++]<<8|buffer[index++]<<16|buffer[index++]<<24;index=0,{low:new Long(low,midl),high:new Long(midh,high)}.high.lessThan(Long.ZERO)&&string.push("-");var combination=high>>26&31;if(combination>>3==3){if(30===combination)return string.join("")+"Infinity";if(31===combination)return"NaN";biased_exponent=high>>15&16383,significand_msb=8+(high>>14&1)}else significand_msb=high>>14&7,biased_exponent=high>>17&16383;var exponent=biased_exponent-6176;if(significand128.parts[0]=(16383&high)+((15&significand_msb)<<14),significand128.parts[1]=midh,significand128.parts[2]=midl,significand128.parts[3]=low,0===significand128.parts[0]&&0===significand128.parts[1]&&0===significand128.parts[2]&&0===significand128.parts[3])is_zero=!0;else for(k=3;k>=0;k--){var least_digits=0,result=divideu128(significand128);if(significand128=result.quotient,least_digits=result.rem.low)for(j=8;j>=0;j--)significand[9*k+j]=least_digits%10,least_digits=Math.floor(least_digits/10)}if(is_zero)significand_digits=1,significand[index]=0;else for(significand_digits=36;!significand[index];)significand_digits-=1,index+=1;var scientific_exponent=significand_digits-1+exponent;if(scientific_exponent>=34||scientific_exponent<=-7||exponent>0){if(significand_digits>34)return string.push("".concat(0)),exponent>0?string.push("E+".concat(exponent)):exponent<0&&string.push("E".concat(exponent)),string.join("");string.push("".concat(significand[index++])),(significand_digits-=1)&&string.push(".");for(i=0;i<significand_digits;i++)string.push("".concat(significand[index++]));string.push("E"),scientific_exponent>0?string.push("+".concat(scientific_exponent)):string.push("".concat(scientific_exponent))}else if(exponent>=0)for(i=0;i<significand_digits;i++)string.push("".concat(significand[index++]));else{var radix_position=significand_digits+exponent;if(radix_position>0)for(i=0;i<radix_position;i++)string.push("".concat(significand[index++]));else string.push("0");for(string.push(".");radix_position++<0;)string.push("0");for(i=0;i<significand_digits-Math.max(radix_position-1,0);i++)string.push("".concat(significand[index++]))}return string.join("")},Decimal128.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},Decimal128.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},Decimal128.fromExtendedJSON=function(doc){return Decimal128.fromString(doc.$numberDecimal)},Decimal128.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},Decimal128.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},Decimal128}();Object.defineProperty(Decimal128.prototype,"_bsontype",{value:"Decimal128"});var Double=function(){function Double(value){if(!(this instanceof Double))return new Double(value);value instanceof Number&&(value=value.valueOf()),this.value=+value}return Double.prototype.valueOf=function(){return this.value},Double.prototype.toJSON=function(){return this.value},Double.prototype.toString=function(radix){return this.value.toString(radix)},Double.prototype.toExtendedJSON=function(options){return options&&(options.legacy||options.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:(Number.isInteger(this.value)?($numberDouble=this.value.toFixed(1)).length>=13&&($numberDouble=this.value.toExponential(13).toUpperCase()):$numberDouble=this.value.toString(),{$numberDouble:$numberDouble});var $numberDouble},Double.fromExtendedJSON=function(doc,options){var doubleValue=parseFloat(doc.$numberDouble);return options&&options.relaxed?doubleValue:new Double(doubleValue)},Double.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},Double.prototype.inspect=function(){var eJSON=this.toExtendedJSON();return"new Double(".concat(eJSON.$numberDouble,")")},Double}();Object.defineProperty(Double.prototype,"_bsontype",{value:"Double"});var Int32=function(){function Int32(value){if(!(this instanceof Int32))return new Int32(value);value instanceof Number&&(value=value.valueOf()),this.value=0|+value}return Int32.prototype.valueOf=function(){return this.value},Int32.prototype.toString=function(radix){return this.value.toString(radix)},Int32.prototype.toJSON=function(){return this.value},Int32.prototype.toExtendedJSON=function(options){return options&&(options.relaxed||options.legacy)?this.value:{$numberInt:this.value.toString()}},Int32.fromExtendedJSON=function(doc,options){return options&&options.relaxed?parseInt(doc.$numberInt,10):new Int32(doc.$numberInt)},Int32.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},Int32.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},Int32}();Object.defineProperty(Int32.prototype,"_bsontype",{value:"Int32"});var MaxKey=function(){function MaxKey(){if(!(this instanceof MaxKey))return new MaxKey}return MaxKey.prototype.toExtendedJSON=function(){return{$maxKey:1}},MaxKey.fromExtendedJSON=function(){return new MaxKey},MaxKey.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},MaxKey.prototype.inspect=function(){return"new MaxKey()"},MaxKey}();Object.defineProperty(MaxKey.prototype,"_bsontype",{value:"MaxKey"});var MinKey=function(){function MinKey(){if(!(this instanceof MinKey))return new MinKey}return MinKey.prototype.toExtendedJSON=function(){return{$minKey:1}},MinKey.fromExtendedJSON=function(){return new MinKey},MinKey.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},MinKey.prototype.inspect=function(){return"new MinKey()"},MinKey}();Object.defineProperty(MinKey.prototype,"_bsontype",{value:"MinKey"});var checkForHexRegExp=new RegExp("^[0-9a-fA-F]{24}$"),PROCESS_UNIQUE=null,kId=Symbol("id"),ObjectId=function(){function ObjectId(inputId){if(!(this instanceof ObjectId))return new ObjectId(inputId);var workingId;if("object"==typeof inputId&&inputId&&"id"in inputId){if("string"!=typeof inputId.id&&!ArrayBuffer.isView(inputId.id))throw new BSONTypeError("Argument passed in must have an id that is of type string or Buffer");workingId="toHexString"in inputId&&"function"==typeof inputId.toHexString?buffer_1.from(inputId.toHexString(),"hex"):inputId.id}else workingId=inputId;if(null==workingId||"number"==typeof workingId)this[kId]=ObjectId.generate("number"==typeof workingId?workingId:void 0);else if(ArrayBuffer.isView(workingId)&&12===workingId.byteLength)this[kId]=workingId instanceof buffer_1?workingId:ensureBuffer(workingId);else{if("string"!=typeof workingId)throw new BSONTypeError("Argument passed in does not match the accepted types");if(12===workingId.length){var bytes=buffer_1.from(workingId);if(12!==bytes.byteLength)throw new BSONTypeError("Argument passed in must be a string of 12 bytes");this[kId]=bytes}else{if(24!==workingId.length||!checkForHexRegExp.test(workingId))throw new BSONTypeError("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");this[kId]=buffer_1.from(workingId,"hex")}}ObjectId.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(ObjectId.prototype,"id",{get:function(){return this[kId]},set:function(value){this[kId]=value,ObjectId.cacheHexString&&(this.__id=value.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(ObjectId.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(value){this.id.writeUInt32BE(value,0)},enumerable:!1,configurable:!0}),ObjectId.prototype.toHexString=function(){if(ObjectId.cacheHexString&&this.__id)return this.__id;var hexString=this.id.toString("hex");return ObjectId.cacheHexString&&!this.__id&&(this.__id=hexString),hexString},ObjectId.getInc=function(){return ObjectId.index=(ObjectId.index+1)%16777215},ObjectId.generate=function(time){"number"!=typeof time&&(time=Math.floor(Date.now()/1e3));var inc=ObjectId.getInc(),buffer=buffer_1.alloc(12);return buffer.writeUInt32BE(time,0),null===PROCESS_UNIQUE&&(PROCESS_UNIQUE=randomBytes(5)),buffer[4]=PROCESS_UNIQUE[0],buffer[5]=PROCESS_UNIQUE[1],buffer[6]=PROCESS_UNIQUE[2],buffer[7]=PROCESS_UNIQUE[3],buffer[8]=PROCESS_UNIQUE[4],buffer[11]=255&inc,buffer[10]=inc>>8&255,buffer[9]=inc>>16&255,buffer},ObjectId.prototype.toString=function(format){return format?this.id.toString(format):this.toHexString()},ObjectId.prototype.toJSON=function(){return this.toHexString()},ObjectId.prototype.equals=function(otherId){if(null==otherId)return!1;if(otherId instanceof ObjectId)return this[kId][11]===otherId[kId][11]&&this[kId].equals(otherId[kId]);if("string"==typeof otherId&&ObjectId.isValid(otherId)&&12===otherId.length&&isUint8Array(this.id))return otherId===buffer_1.prototype.toString.call(this.id,"latin1");if("string"==typeof otherId&&ObjectId.isValid(otherId)&&24===otherId.length)return otherId.toLowerCase()===this.toHexString();if("string"==typeof otherId&&ObjectId.isValid(otherId)&&12===otherId.length)return buffer_1.from(otherId).equals(this.id);if("object"==typeof otherId&&"toHexString"in otherId&&"function"==typeof otherId.toHexString){var otherIdString=otherId.toHexString(),thisIdString=this.toHexString().toLowerCase();return"string"==typeof otherIdString&&otherIdString.toLowerCase()===thisIdString}return!1},ObjectId.prototype.getTimestamp=function(){var timestamp=new Date,time=this.id.readUInt32BE(0);return timestamp.setTime(1e3*Math.floor(time)),timestamp},ObjectId.createPk=function(){return new ObjectId},ObjectId.createFromTime=function(time){var buffer=buffer_1.from([0,0,0,0,0,0,0,0,0,0,0,0]);return buffer.writeUInt32BE(time,0),new ObjectId(buffer)},ObjectId.createFromHexString=function(hexString){if(void 0===hexString||null!=hexString&&24!==hexString.length)throw new BSONTypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new ObjectId(buffer_1.from(hexString,"hex"))},ObjectId.isValid=function(id){if(null==id)return!1;try{return new ObjectId(id),!0}catch(_a){return!1}},ObjectId.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},ObjectId.fromExtendedJSON=function(doc){return new ObjectId(doc.$oid)},ObjectId.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},ObjectId.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},ObjectId.index=Math.floor(16777215*Math.random()),ObjectId}();Object.defineProperty(ObjectId.prototype,"generate",{value:deprecate((function(time){return ObjectId.generate(time)}),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(ObjectId.prototype,"getInc",{value:deprecate((function(){return ObjectId.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(ObjectId.prototype,"get_inc",{value:deprecate((function(){return ObjectId.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(ObjectId,"get_inc",{value:deprecate((function(){return ObjectId.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(ObjectId.prototype,"_bsontype",{value:"ObjectID"});var BSONRegExp=function(){function BSONRegExp(pattern,options){if(!(this instanceof BSONRegExp))return new BSONRegExp(pattern,options);if(this.pattern=pattern,this.options=function alphabetize(str){return str.split("").sort().join("")}(null!=options?options:""),-1!==this.pattern.indexOf("\0"))throw new BSONError("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(-1!==this.options.indexOf("\0"))throw new BSONError("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var i=0;i<this.options.length;i++)if("i"!==this.options[i]&&"m"!==this.options[i]&&"x"!==this.options[i]&&"l"!==this.options[i]&&"s"!==this.options[i]&&"u"!==this.options[i])throw new BSONError("The regular expression option [".concat(this.options[i],"] is not supported"))}return BSONRegExp.parseOptions=function(options){return options?options.split("").sort().join(""):""},BSONRegExp.prototype.toExtendedJSON=function(options){return(options=options||{}).legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},BSONRegExp.fromExtendedJSON=function(doc){if("$regex"in doc){if("string"==typeof doc.$regex)return new BSONRegExp(doc.$regex,BSONRegExp.parseOptions(doc.$options));if("BSONRegExp"===doc.$regex._bsontype)return doc}if("$regularExpression"in doc)return new BSONRegExp(doc.$regularExpression.pattern,BSONRegExp.parseOptions(doc.$regularExpression.options));throw new BSONTypeError("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(doc)))},BSONRegExp}();Object.defineProperty(BSONRegExp.prototype,"_bsontype",{value:"BSONRegExp"});var BSONSymbol=function(){function BSONSymbol(value){if(!(this instanceof BSONSymbol))return new BSONSymbol(value);this.value=value}return BSONSymbol.prototype.valueOf=function(){return this.value},BSONSymbol.prototype.toString=function(){return this.value},BSONSymbol.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},BSONSymbol.prototype.toJSON=function(){return this.value},BSONSymbol.prototype.toExtendedJSON=function(){return{$symbol:this.value}},BSONSymbol.fromExtendedJSON=function(doc){return new BSONSymbol(doc.$symbol)},BSONSymbol.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},BSONSymbol}();Object.defineProperty(BSONSymbol.prototype,"_bsontype",{value:"Symbol"});var Timestamp=function(_super){function Timestamp(low,high){var _this=this;return _this instanceof Timestamp?(_this=Long.isLong(low)?_super.call(this,low.low,low.high,!0)||this:isObjectLike(low)&&void 0!==low.t&&void 0!==low.i?_super.call(this,low.i,low.t,!0)||this:_super.call(this,low,high,!0)||this,Object.defineProperty(_this,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),_this):new Timestamp(low,high)}return __extends(Timestamp,_super),Timestamp.prototype.toJSON=function(){return{$timestamp:this.toString()}},Timestamp.fromInt=function(value){return new Timestamp(Long.fromInt(value,!0))},Timestamp.fromNumber=function(value){return new Timestamp(Long.fromNumber(value,!0))},Timestamp.fromBits=function(lowBits,highBits){return new Timestamp(lowBits,highBits)},Timestamp.fromString=function(str,optRadix){return new Timestamp(Long.fromString(str,!0,optRadix))},Timestamp.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},Timestamp.fromExtendedJSON=function(doc){return new Timestamp(doc.$timestamp)},Timestamp.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},Timestamp.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},Timestamp.MAX_VALUE=Long.MAX_UNSIGNED_VALUE,Timestamp}(Long);function isBSONType(value){return isObjectLike(value)&&Reflect.has(value,"_bsontype")&&"string"==typeof value._bsontype}var keysToCodecs={$oid:ObjectId,$binary:Binary,$uuid:Binary,$symbol:BSONSymbol,$numberInt:Int32,$numberDecimal:Decimal128,$numberDouble:Double,$numberLong:Long,$minKey:MinKey,$maxKey:MaxKey,$regex:BSONRegExp,$regularExpression:BSONRegExp,$timestamp:Timestamp};function deserializeValue(value,options){if(void 0===options&&(options={}),"number"==typeof value){if(options.relaxed||options.legacy)return value;if(Math.floor(value)===value){if(value>=-2147483648&&value<=2147483647)return new Int32(value);if(value>=-0x8000000000000000&&value<=0x8000000000000000)return Long.fromNumber(value)}return new Double(value)}if(null==value||"object"!=typeof value)return value;if(value.$undefined)return null;for(var keys=Object.keys(value).filter((function(k){return k.startsWith("$")&&null!=value[k]})),i=0;i<keys.length;i++){var c=keysToCodecs[keys[i]];if(c)return c.fromExtendedJSON(value,options)}if(null!=value.$date){var d=value.$date,date=new Date;return options.legacy?"number"==typeof d?date.setTime(d):"string"==typeof d&&date.setTime(Date.parse(d)):"string"==typeof d?date.setTime(Date.parse(d)):Long.isLong(d)?date.setTime(d.toNumber()):"number"==typeof d&&options.relaxed&&date.setTime(d),date}if(null!=value.$code){var copy=Object.assign({},value);return value.$scope&&(copy.$scope=deserializeValue(value.$scope)),Code.fromExtendedJSON(value)}if(isDBRefLike(value)||value.$dbPointer){var v=value.$ref?value:value.$dbPointer;if(v instanceof DBRef)return v;var dollarKeys=Object.keys(v).filter((function(k){return k.startsWith("$")})),valid_1=!0;if(dollarKeys.forEach((function(k){-1===["$ref","$id","$db"].indexOf(k)&&(valid_1=!1)})),valid_1)return DBRef.fromExtendedJSON(v)}return value}function getISOString(date){var isoStr=date.toISOString();return 0!==date.getUTCMilliseconds()?isoStr:isoStr.slice(0,-5)+"Z"}function serializeValue(value,options){if(("object"==typeof value||"function"==typeof value)&&null!==value){var index=options.seenObjects.findIndex((function(entry){return entry.obj===value}));if(-1!==index){var props=options.seenObjects.map((function(entry){return entry.propertyName})),leadingPart=props.slice(0,index).map((function(prop){return"".concat(prop," -> ")})).join(""),alreadySeen=props[index],circularPart=" -> "+props.slice(index+1,props.length-1).map((function(prop){return"".concat(prop," -> ")})).join(""),current=props[props.length-1],leadingSpace=" ".repeat(leadingPart.length+alreadySeen.length/2),dashes="-".repeat(circularPart.length+(alreadySeen.length+current.length)/2-1);throw new BSONTypeError("Converting circular structure to EJSON:\n"+" ".concat(leadingPart).concat(alreadySeen).concat(circularPart).concat(current,"\n")+" ".concat(leadingSpace,"\\").concat(dashes,"/"))}options.seenObjects[options.seenObjects.length-1].obj=value}if(Array.isArray(value))return function serializeArray(array,options){return array.map((function(v,index){options.seenObjects.push({propertyName:"index ".concat(index),obj:null});try{return serializeValue(v,options)}finally{options.seenObjects.pop()}}))}(value,options);if(void 0===value)return null;if(value instanceof Date||isDate(value)){var dateNum=value.getTime(),inRange=dateNum>-1&&dateNum<2534023188e5;return options.legacy?options.relaxed&&inRange?{$date:value.getTime()}:{$date:getISOString(value)}:options.relaxed&&inRange?{$date:getISOString(value)}:{$date:{$numberLong:value.getTime().toString()}}}if(!("number"!=typeof value||options.relaxed&&isFinite(value))){if(Math.floor(value)===value){var int64Range=value>=-0x8000000000000000&&value<=0x8000000000000000;if(value>=-2147483648&&value<=2147483647)return{$numberInt:value.toString()};if(int64Range)return{$numberLong:value.toString()}}return{$numberDouble:value.toString()}}if(value instanceof RegExp||isRegExp(value)){var flags=value.flags;if(void 0===flags){var match=value.toString().match(/[gimuy]*$/);match&&(flags=match[0])}return new BSONRegExp(value.source,flags).toExtendedJSON(options)}return null!=value&&"object"==typeof value?function serializeDocument(doc,options){if(null==doc||"object"!=typeof doc)throw new BSONError("not an object instance");var bsontype=doc._bsontype;if(void 0===bsontype){var _doc={};for(var name in doc){options.seenObjects.push({propertyName:name,obj:null});try{var value=serializeValue(doc[name],options);"__proto__"===name?Object.defineProperty(_doc,name,{value:value,writable:!0,enumerable:!0,configurable:!0}):_doc[name]=value}finally{options.seenObjects.pop()}}return _doc}if(isBSONType(doc)){var outDoc=doc;if("function"!=typeof outDoc.toExtendedJSON){var mapper=BSON_TYPE_MAPPINGS[doc._bsontype];if(!mapper)throw new BSONTypeError("Unrecognized or invalid _bsontype: "+doc._bsontype);outDoc=mapper(outDoc)}return"Code"===bsontype&&outDoc.scope?outDoc=new Code(outDoc.code,serializeValue(outDoc.scope,options)):"DBRef"===bsontype&&outDoc.oid&&(outDoc=new DBRef(serializeValue(outDoc.collection,options),serializeValue(outDoc.oid,options),serializeValue(outDoc.db,options),serializeValue(outDoc.fields,options))),outDoc.toExtendedJSON(options)}throw new BSONError("_bsontype must be a string, but was: "+typeof bsontype)}(value,options):value}var EJSON,BSON_TYPE_MAPPINGS={Binary:function(o){return new Binary(o.value(),o.sub_type)},Code:function(o){return new Code(o.code,o.scope)},DBRef:function(o){return new DBRef(o.collection||o.namespace,o.oid,o.db,o.fields)},Decimal128:function(o){return new Decimal128(o.bytes)},Double:function(o){return new Double(o.value)},Int32:function(o){return new Int32(o.value)},Long:function(o){return Long.fromBits(null!=o.low?o.low:o.low_,null!=o.low?o.high:o.high_,null!=o.low?o.unsigned:o.unsigned_)},MaxKey:function(){return new MaxKey},MinKey:function(){return new MinKey},ObjectID:function(o){return new ObjectId(o)},ObjectId:function(o){return new ObjectId(o)},BSONRegExp:function(o){return new BSONRegExp(o.pattern,o.options)},Symbol:function(o){return new BSONSymbol(o.value)},Timestamp:function(o){return Timestamp.fromBits(o.low,o.high)}};!function(EJSON){function parse(text,options){var finalOptions=Object.assign({},{relaxed:!0,legacy:!1},options);return"boolean"==typeof finalOptions.relaxed&&(finalOptions.strict=!finalOptions.relaxed),"boolean"==typeof finalOptions.strict&&(finalOptions.relaxed=!finalOptions.strict),JSON.parse(text,(function(key,value){if(-1!==key.indexOf("\0"))throw new BSONError("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(key)));return deserializeValue(value,finalOptions)}))}function stringify(value,replacer,space,options){null!=space&&"object"==typeof space&&(options=space,space=0),null==replacer||"object"!=typeof replacer||Array.isArray(replacer)||(options=replacer,replacer=void 0,space=0);var doc=serializeValue(value,Object.assign({relaxed:!0,legacy:!1},options,{seenObjects:[{propertyName:"(root)",obj:null}]}));return JSON.stringify(doc,replacer,space)}EJSON.parse=parse,EJSON.stringify=stringify,EJSON.serialize=function serialize(value,options){return options=options||{},JSON.parse(stringify(value,options))},EJSON.deserialize=function deserialize(ejson,options){return options=options||{},parse(JSON.stringify(ejson),options)}}(EJSON||(EJSON={}));var bsonGlobal=getGlobal();bsonGlobal.Map?bsonGlobal.Map:function(){function Map(array){void 0===array&&(array=[]),this._keys=[],this._values={};for(var i=0;i<array.length;i++)if(null!=array[i]){var entry=array[i],key=entry[0],value=entry[1];this._keys.push(key),this._values[key]={v:value,i:this._keys.length-1}}}Map.prototype.clear=function(){this._keys=[],this._values={}},Map.prototype.delete=function(key){var value=this._values[key];return null!=value&&(delete this._values[key],this._keys.splice(value.i,1),!0)},Map.prototype.entries=function(){var _this=this,index=0;return{next:function(){var key=_this._keys[index++];return{value:void 0!==key?[key,_this._values[key].v]:void 0,done:void 0===key}}}},Map.prototype.forEach=function(callback,self){self=self||this;for(var i=0;i<this._keys.length;i++){var key=this._keys[i];callback.call(self,this._values[key].v,key,self)}},Map.prototype.get=function(key){return this._values[key]?this._values[key].v:void 0},Map.prototype.has=function(key){return null!=this._values[key]},Map.prototype.keys=function(){var _this=this,index=0;return{next:function(){var key=_this._keys[index++];return{value:void 0!==key?key:void 0,done:void 0===key}}}},Map.prototype.set=function(key,value){return this._values[key]?(this._values[key].v=value,this):(this._keys.push(key),this._values[key]={v:value,i:this._keys.length-1},this)},Map.prototype.values=function(){var _this=this,index=0;return{next:function(){var key=_this._keys[index++];return{value:void 0!==key?_this._values[key].v:void 0,done:void 0===key}}}},Object.defineProperty(Map.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0})}();Long.fromNumber(JS_INT_MAX),Long.fromNumber(JS_INT_MIN);new Set(["$db","$ref","$id","$clusterTime"]);var SPACE_FOR_FLOAT64=new Uint8Array(8);new DataView(SPACE_FOR_FLOAT64.buffer,SPACE_FOR_FLOAT64.byteOffset,SPACE_FOR_FLOAT64.byteLength);buffer_1.alloc(17825792);var __spreadArray=function(to,from,pack){if(pack||2===arguments.length)for(var ar,i=0,l=from.length;i<l;i++)!ar&&i in from||(ar||(ar=Array.prototype.slice.call(from,0,i)),ar[i]=from[i]);return to.concat(ar||Array.prototype.slice.call(from))},BrowserInfo=function BrowserInfo(name,version,os){this.name=name,this.version=version,this.os=os,this.type="browser"},NodeInfo=function NodeInfo(version){this.version=version,this.type="node",this.name="node",this.os=process.platform},SearchBotDeviceInfo=function SearchBotDeviceInfo(name,version,os,bot){this.name=name,this.version=version,this.os=os,this.bot=bot,this.type="bot-device"},BotInfo=function BotInfo(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null},ReactNativeInfo=function ReactNativeInfo(){this.type="react-native",this.name="react-native",this.version=null,this.os=null},SEARCHBOT_OS_REGEX=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,userAgentRules=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],operatingSystemRules=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function parseUserAgent(ua){var matchedRule=function matchUserAgent(ua){return""!==ua&&userAgentRules.reduce((function(matched,_a){var browser=_a[0],regex=_a[1];if(matched)return matched;var uaMatch=regex.exec(ua);return!!uaMatch&&[browser,uaMatch]}),!1)}(ua);if(!matchedRule)return null;var name=matchedRule[0],match=matchedRule[1];if("searchbot"===name)return new BotInfo;var versionParts=match[1]&&match[1].split(".").join("_").split("_").slice(0,3);versionParts?versionParts.length<3&&(versionParts=__spreadArray(__spreadArray([],versionParts,!0),function createVersionParts(count){for(var output=[],ii=0;ii<count;ii++)output.push("0");return output}(3-versionParts.length),!0)):versionParts=[];var version=versionParts.join("."),os=function detectOS(ua){for(var ii=0,count=operatingSystemRules.length;ii<count;ii++){var _a=operatingSystemRules[ii],os=_a[0];if(_a[1].exec(ua))return os}return null}(ua),searchBotMatch=SEARCHBOT_OS_REGEX.exec(ua);return searchBotMatch&&searchBotMatch[1]?new SearchBotDeviceInfo(name,version,os,searchBotMatch[1]):new BrowserInfo(name,version,os)}class DefaultNetworkTransport{constructor(){if(!DefaultNetworkTransport.fetch)throw new Error("DefaultNetworkTransport.fetch must be set before it's used");if(!DefaultNetworkTransport.AbortController)throw new Error("DefaultNetworkTransport.AbortController must be set before it's used")}fetchWithCallbacks(request,handler){this.fetch(request).then((async response=>{const decodedBody=await response.text(),responseHeaders={};return response.headers.forEach(((value,key)=>{responseHeaders[key]=value})),{statusCode:response.status,headers:responseHeaders,body:decodedBody}})).then((r=>handler.onSuccess(r))).catch((e=>handler.onError(e)))}async fetch(request){const{timeoutMs:timeoutMs,url:url,...rest}=request,{signal:signal,cancelTimeout:cancelTimeout}=this.createTimeoutSignal(timeoutMs);try{return await DefaultNetworkTransport.fetch(url,{...DefaultNetworkTransport.extraFetchOptions,signal:signal,...rest})}finally{cancelTimeout()}}createTimeoutSignal(timeoutMs){if("number"==typeof timeoutMs){const controller=new DefaultNetworkTransport.AbortController,timeout=setTimeout((()=>{controller.abort()}),timeoutMs);return{signal:controller.signal,cancelTimeout:()=>{clearTimeout(timeout)}}}return{signal:void 0,cancelTimeout:()=>{}}}}DefaultNetworkTransport.DEFAULT_HEADERS={"Content-Type":"application/json"};const check=function(it){return it&&it.Math==Math&&it},safeGlobalThis=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof __webpack_require__.g&&__webpack_require__.g)||function(){return this}()||Function("return this")();"undefined"!=typeof __DEV__&&__DEV__,DefaultNetworkTransport.fetch=safeGlobalThis.fetch.bind(safeGlobalThis),DefaultNetworkTransport.AbortController=safeGlobalThis.AbortController.bind(safeGlobalThis);const _hasatob="function"==typeof atob,_hasbtoa="function"==typeof btoa,_hasBuffer="function"==typeof Buffer,_TD="function"==typeof TextDecoder?new TextDecoder:void 0,_TE="function"==typeof TextEncoder?new TextEncoder:void 0,b64chs=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),b64tab=(a=>{let tab={};return a.forEach(((c,i)=>tab[c]=i)),tab})(b64chs),b64re=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,_fromCC=String.fromCharCode.bind(String),_U8Afrom="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):(it,fn=(x=>x))=>new Uint8Array(Array.prototype.slice.call(it,0).map(fn)),_mkUriSafe=src=>src.replace(/=/g,"").replace(/[+\/]/g,(m0=>"+"==m0?"-":"_")),_tidyB64=s=>s.replace(/[^A-Za-z0-9\+\/]/g,""),btoaPolyfill=bin=>{let u32,c0,c1,c2,asc="";const pad=bin.length%3;for(let i=0;i<bin.length;){if((c0=bin.charCodeAt(i++))>255||(c1=bin.charCodeAt(i++))>255||(c2=bin.charCodeAt(i++))>255)throw new TypeError("invalid character found");u32=c0<<16|c1<<8|c2,asc+=b64chs[u32>>18&63]+b64chs[u32>>12&63]+b64chs[u32>>6&63]+b64chs[63&u32]}return pad?asc.slice(0,pad-3)+"===".substring(pad):asc},_btoa=_hasbtoa?bin=>btoa(bin):_hasBuffer?bin=>Buffer.from(bin,"binary").toString("base64"):btoaPolyfill,_fromUint8Array=_hasBuffer?u8a=>Buffer.from(u8a).toString("base64"):u8a=>{let strs=[];for(let i=0,l=u8a.length;i<l;i+=4096)strs.push(_fromCC.apply(null,u8a.subarray(i,i+4096)));return _btoa(strs.join(""))},cb_utob=c=>{if(c.length<2)return(cc=c.charCodeAt(0))<128?c:cc<2048?_fromCC(192|cc>>>6)+_fromCC(128|63&cc):_fromCC(224|cc>>>12&15)+_fromCC(128|cc>>>6&63)+_fromCC(128|63&cc);var cc=65536+1024*(c.charCodeAt(0)-55296)+(c.charCodeAt(1)-56320);return _fromCC(240|cc>>>18&7)+_fromCC(128|cc>>>12&63)+_fromCC(128|cc>>>6&63)+_fromCC(128|63&cc)},re_utob=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,utob=u=>u.replace(re_utob,cb_utob),_encode=_hasBuffer?s=>Buffer.from(s,"utf8").toString("base64"):_TE?s=>_fromUint8Array(_TE.encode(s)):s=>_btoa(utob(s)),encode=(src,urlsafe=!1)=>urlsafe?_mkUriSafe(_encode(src)):_encode(src),re_btou=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,cb_btou=cccc=>{switch(cccc.length){case 4:var offset=((7&cccc.charCodeAt(0))<<18|(63&cccc.charCodeAt(1))<<12|(63&cccc.charCodeAt(2))<<6|63&cccc.charCodeAt(3))-65536;return _fromCC(55296+(offset>>>10))+_fromCC(56320+(1023&offset));case 3:return _fromCC((15&cccc.charCodeAt(0))<<12|(63&cccc.charCodeAt(1))<<6|63&cccc.charCodeAt(2));default:return _fromCC((31&cccc.charCodeAt(0))<<6|63&cccc.charCodeAt(1))}},btou=b=>b.replace(re_btou,cb_btou),atobPolyfill=asc=>{if(asc=asc.replace(/\s+/g,""),!b64re.test(asc))throw new TypeError("malformed base64.");asc+="==".slice(2-(3&asc.length));let u24,r1,r2,bin="";for(let i=0;i<asc.length;)u24=b64tab[asc.charAt(i++)]<<18|b64tab[asc.charAt(i++)]<<12|(r1=b64tab[asc.charAt(i++)])<<6|(r2=b64tab[asc.charAt(i++)]),bin+=64===r1?_fromCC(u24>>16&255):64===r2?_fromCC(u24>>16&255,u24>>8&255):_fromCC(u24>>16&255,u24>>8&255,255&u24);return bin},_atob=_hasatob?asc=>atob(_tidyB64(asc)):_hasBuffer?asc=>Buffer.from(asc,"base64").toString("binary"):atobPolyfill,_toUint8Array=_hasBuffer?a=>_U8Afrom(Buffer.from(a,"base64")):a=>_U8Afrom(_atob(a),(c=>c.charCodeAt(0))),_decode=_hasBuffer?a=>Buffer.from(a,"base64").toString("utf8"):_TD?a=>_TD.decode(_toUint8Array(a)):a=>btou(_atob(a)),_unURI=a=>_tidyB64(a.replace(/[-_]/g,(m0=>"-"==m0?"+":"/"))),decode=src=>_decode(_unURI(src)),gBase64_encode=encode,gBase64_decode=decode,SERIALIZATION_OPTIONS={relaxed:!1};function bundle_dom_es_serialize(obj){return EJSON.serialize(obj,SERIALIZATION_OPTIONS)}function bundle_dom_es_deserialize(obj){return Array.isArray(obj)?obj.map((doc=>EJSON.deserialize(doc))):EJSON.deserialize(obj)}var UserType,DataKey;!function(UserType){UserType.Normal="normal",UserType.Server="server"}(UserType||(UserType={})),function(DataKey){DataKey.NAME="name",DataKey.EMAIL="email",DataKey.PICTURE="picture",DataKey.FIRST_NAME="first_name",DataKey.LAST_NAME="last_name",DataKey.GENDER="gender",DataKey.BIRTHDAY="birthday",DataKey.MIN_AGE="min_age",DataKey.MAX_AGE="max_age"}(DataKey||(DataKey={}));const DATA_MAPPING={[DataKey.NAME]:"name",[DataKey.EMAIL]:"email",[DataKey.PICTURE]:"pictureUrl",[DataKey.FIRST_NAME]:"firstName",[DataKey.LAST_NAME]:"lastName",[DataKey.GENDER]:"gender",[DataKey.BIRTHDAY]:"birthday",[DataKey.MIN_AGE]:"minAge",[DataKey.MAX_AGE]:"maxAge"};class UserProfile{constructor(response){if(this.type=UserType.Normal,this.identities=[],"object"==typeof response&&null!==response){const{type:type,identities:identities,data:data}=response;if("string"!=typeof type)throw new Error("Expected 'type' in the response body");if(this.type=type,!Array.isArray(identities))throw new Error("Expected 'identities' in the response body");if(this.identities=identities.map((identity=>{const{id:id,provider_type:providerType}=identity;return{id:id,providerType:providerType}})),"object"!=typeof data||null===data)throw new Error("Expected 'data' in the response body");{const mappedData=Object.fromEntries(Object.entries(data).map((([key,value])=>key in DATA_MAPPING?[DATA_MAPPING[key],value]:[key,value])));this.data=bundle_dom_es_deserialize(mappedData)}}else this.data={}}}class PrefixedStorage{constructor(storage,keyPart){this.storage=storage,this.keyPart=keyPart}get(key){return this.storage.get(this.keyPart+PrefixedStorage.PART_SEPARATOR+key)}set(key,value){return this.storage.set(this.keyPart+PrefixedStorage.PART_SEPARATOR+key,value)}remove(key){return this.storage.remove(this.keyPart+PrefixedStorage.PART_SEPARATOR+key)}prefix(keyPart){return new PrefixedStorage(this,keyPart)}clear(prefix=""){return this.storage.clear(this.keyPart+PrefixedStorage.PART_SEPARATOR+prefix)}addListener(listener){return this.storage.addListener(listener)}removeListener(listener){return this.storage.addListener(listener)}}PrefixedStorage.PART_SEPARATOR=":";class UserStorage extends PrefixedStorage{constructor(storage,userId){super(storage,`user(${userId})`)}get accessToken(){return this.get("accessToken")}set accessToken(value){null===value?this.remove("accessToken"):this.set("accessToken",value)}get refreshToken(){return this.get("refreshToken")}set refreshToken(value){null===value?this.remove("refreshToken"):this.set("refreshToken",value)}get profile(){const value=this.get("profile");if(value){const profile=new UserProfile;return Object.assign(profile,JSON.parse(value)),profile}}set profile(value){value?this.set("profile",JSON.stringify(value)):this.remove("profile")}get providerType(){const value=this.get("providerType");if(value)return value}set providerType(value){value?this.set("providerType",value):this.remove("providerType")}}function removeKeysWithUndefinedValues(obj){return Object.fromEntries(Object.entries(obj).filter((entry=>void 0!==entry[1])))}function encodeQueryString(params,prefixed=!0){const cleanedParams=removeKeysWithUndefinedValues(params);return(prefixed&&Object.keys(cleanedParams).length>0?"?":"")+Object.entries(cleanedParams).map((([k,v])=>`${k}=${encodeURIComponent(v)}`)).join("&")}const RESERVED_NAMES=["inspect","callFunction","callFunctionStreaming",...Object.getOwnPropertyNames(Object.prototype)];function cleanArgsAndSerialize(args){const cleaned=function cleanArgs(args){for(const arg of args)if("object"==typeof arg&&arg)for(const[key,value]of Object.entries(arg))void 0===value&&delete arg[key];return args}(args);return cleaned.map((arg=>"object"==typeof arg?bundle_dom_es_serialize(arg):arg))}class FunctionsFactory{constructor(fetcher,config={}){this.fetcher=fetcher,this.serviceName=config.serviceName,this.argsTransformation=config.argsTransformation||cleanArgsAndSerialize}static create(fetcher,config={}){const factory=new FunctionsFactory(fetcher,config);return new Proxy(factory,{get(target,p,receiver){if("string"==typeof p&&-1===RESERVED_NAMES.indexOf(p))return target.callFunction.bind(target,p);{const prop=Reflect.get(target,p,receiver);return"function"==typeof prop?prop.bind(target):prop}}})}async callFunction(name,...args){const body={name:name,arguments:this.argsTransformation?this.argsTransformation(args):args};this.serviceName&&(body.service=this.serviceName);const appRoute=this.fetcher.appRoute;return this.fetcher.fetchJSON({method:"POST",path:appRoute.functionsCall().path,body:body})}callFunctionStreaming(name,...args){const body={name:name,arguments:this.argsTransformation?this.argsTransformation(args):args};this.serviceName&&(body.service=this.serviceName);const appRoute=this.fetcher.appRoute,qs=encodeQueryString({baas_request:gBase64_encode(JSON.stringify(body))});return this.fetcher.fetchStream({method:"GET",path:appRoute.functionsCall().path+qs})}}class EmailPasswordAuth{constructor(fetcher,providerName="local-userpass"){this.fetcher=fetcher,this.providerName=providerName}async registerUser(details){const appRoute=this.fetcher.appRoute;await this.fetcher.fetchJSON({method:"POST",path:appRoute.emailPasswordAuth(this.providerName).register().path,body:details})}async confirmUser(details){const appRoute=this.fetcher.appRoute;await this.fetcher.fetchJSON({method:"POST",path:appRoute.emailPasswordAuth(this.providerName).confirm().path,body:details})}async resendConfirmationEmail(details){const appRoute=this.fetcher.appRoute;await this.fetcher.fetchJSON({method:"POST",path:appRoute.emailPasswordAuth(this.providerName).confirmSend().path,body:details})}async retryCustomConfirmation(details){const appRoute=this.fetcher.appRoute;await this.fetcher.fetchJSON({method:"POST",path:appRoute.emailPasswordAuth(this.providerName).confirmCall().path,body:details})}async resetPassword(details){const appRoute=this.fetcher.appRoute;await this.fetcher.fetchJSON({method:"POST",path:appRoute.emailPasswordAuth(this.providerName).reset().path,body:details})}async sendResetPasswordEmail(details){const appRoute=this.fetcher.appRoute;await this.fetcher.fetchJSON({method:"POST",path:appRoute.emailPasswordAuth(this.providerName).resetSend().path,body:details})}async callResetPasswordFunction(details,...args){const appRoute=this.fetcher.appRoute;await this.fetcher.fetchJSON({method:"POST",path:appRoute.emailPasswordAuth(this.providerName).resetCall().path,body:{...details,arguments:args}})}}var routes={api:function api(){return{path:"/api/client/v2.0",app(appId){return{path:this.path+`/app/${appId}`,location(){return{path:this.path+"/location"}},authProvider(providerName){return{path:this.path+`/auth/providers/${providerName}`,login(){return{path:this.path+"/login"}}}},emailPasswordAuth(providerName){return{...this.authProvider(providerName),register(){return{path:this.path+"/register"}},confirm(){return{path:this.path+"/confirm"}},confirmSend(){return{path:this.path+"/confirm/send"}},confirmCall(){return{path:this.path+"/confirm/call"}},reset(){return{path:this.path+"/reset"}},resetSend(){return{path:this.path+"/reset/send"}},resetCall(){return{path:this.path+"/reset/call"}}}},functionsCall(){return{path:this.path+"/functions/call"}}}},auth(){return{path:this.path+"/auth",apiKeys(){return{path:this.path+"/api_keys",key(id){return{path:this.path+`/${id}`,enable(){return{path:this.path+"/enable"}},disable(){return{path:this.path+"/disable"}}}}}},profile(){return{path:this.path+"/profile"}},session(){return{path:this.path+"/session"}},delete(){return{path:this.path+"/delete"}}}}}}};class ApiKeyAuth{constructor(fetcher){this.fetcher=fetcher}create(name){return this.fetcher.fetchJSON({method:"POST",body:{name:name},path:routes.api().auth().apiKeys().path,tokenType:"refresh"})}fetch(keyId){return this.fetcher.fetchJSON({method:"GET",path:routes.api().auth().apiKeys().key(keyId).path,tokenType:"refresh"})}fetchAll(){return this.fetcher.fetchJSON({method:"GET",tokenType:"refresh",path:routes.api().auth().apiKeys().path})}async delete(keyId){await this.fetcher.fetchJSON({method:"DELETE",path:routes.api().auth().apiKeys().key(keyId).path,tokenType:"refresh"})}async enable(keyId){await this.fetcher.fetchJSON({method:"PUT",path:routes.api().auth().apiKeys().key(keyId).enable().path,tokenType:"refresh"})}async disable(keyId){await this.fetcher.fetchJSON({method:"PUT",path:routes.api().auth().apiKeys().key(keyId).disable().path,tokenType:"refresh"})}}let environment=null;function getEnvironment(){if(environment)return environment;throw new Error("Cannot get environment before it's set")}class WatchError extends Error{constructor({message:message,code:code}){super(message),this.name="WatchError",this.code=code}}var WatchStreamState;!function(WatchStreamState){WatchStreamState.NEED_DATA="NEED_DATA",WatchStreamState.HAVE_EVENT="HAVE_EVENT",WatchStreamState.HAVE_ERROR="HAVE_ERROR"}(WatchStreamState||(WatchStreamState={}));class WatchStream{constructor(){this._state=WatchStreamState.NEED_DATA,this._error=null,this._textDecoder=new(getEnvironment().TextDecoder),this._buffer="",this._bufferOffset=0,this._eventType="",this._dataBuffer=""}feedBuffer(buffer){this.assertState(WatchStreamState.NEED_DATA),this._buffer+=this._textDecoder.decode(buffer,{stream:!0}),this.advanceBufferState()}feedLine(line){if(this.assertState(WatchStreamState.NEED_DATA),line.endsWith("\n")&&(line=line.substr(0,line.length-1)),line.endsWith("\r")&&(line=line.substr(0,line.length-1)),0===line.length){if(0===this._dataBuffer.length)return void(this._eventType="");this._dataBuffer.endsWith("\n")&&(this._dataBuffer=this._dataBuffer.substr(0,this._dataBuffer.length-1)),this.feedSse({data:this._dataBuffer,eventType:this._eventType}),this._dataBuffer="",this._eventType=""}if(":"===line[0])return;const colon=line.indexOf(":"),field=line.substr(0,colon);let value=-1===colon?"":line.substr(colon+1);value.startsWith(" ")&&(value=value.substr(1)),"event"===field?this._eventType=value:"data"===field&&(this._dataBuffer+=value,this._dataBuffer+="\n")}feedSse(sse){this.assertState(WatchStreamState.NEED_DATA);const firstPercentIndex=sse.data.indexOf("%");if(-1!==firstPercentIndex){let buffer="",start=0;for(let percentIndex=firstPercentIndex;-1!==percentIndex;percentIndex=sse.data.indexOf("%",start)){buffer+=sse.data.substr(start,percentIndex-start);const encoded=sse.data.substr(percentIndex,3);buffer+="%25"===encoded?"%":"%0A"===encoded?"\n":"%0D"===encoded?"\r":encoded,start=percentIndex+encoded.length}buffer+=sse.data.substr(start),sse.data=buffer}if(sse.eventType&&"message"!==sse.eventType){if("error"===sse.eventType){this._state=WatchStreamState.HAVE_ERROR,this._error=new WatchError({message:sse.data,code:"unknown"});try{const{error_code:errorCode,error:error}=EJSON.parse(sse.data);if("string"!=typeof errorCode)return;if("string"!=typeof error)return;this._error=new WatchError({message:error,code:errorCode})}catch{return}}}else{try{const parsed=EJSON.parse(sse.data);if("object"==typeof parsed)return this._nextEvent=parsed,void(this._state=WatchStreamState.HAVE_EVENT)}catch{}this._state=WatchStreamState.HAVE_ERROR,this._error=new WatchError({message:"server returned malformed event: "+sse.data,code:"bad bson parse"})}}get state(){return this._state}nextEvent(){this.assertState(WatchStreamState.HAVE_EVENT);const out=this._nextEvent;return this._state=WatchStreamState.NEED_DATA,this.advanceBufferState(),out}get error(){return this._error}advanceBufferState(){for(this.assertState(WatchStreamState.NEED_DATA);this.state===WatchStreamState.NEED_DATA;){if(this._bufferOffset===this._buffer.length)return this._buffer="",void(this._bufferOffset=0);const nextNewlineIndex=this._buffer.indexOf("\n",this._bufferOffset);if(-1===nextNewlineIndex)return void(0!==this._bufferOffset&&(this._buffer=this._buffer.substr(this._bufferOffset,this._buffer.length-this._bufferOffset),this._bufferOffset=0));this.feedLine(this._buffer.substr(this._bufferOffset,nextNewlineIndex-this._bufferOffset)),this._bufferOffset=nextNewlineIndex+1}}assertState(state){if(this._state!==state)throw Error(`Expected WatchStream to be in state ${state}, but in state ${this._state}`)}}class MongoDBCollection{constructor(fetcher,serviceName,databaseName,collectionName){this.functions=FunctionsFactory.create(fetcher,{serviceName:serviceName}),this.databaseName=databaseName,this.collectionName=collectionName,this.serviceName=serviceName,this.fetcher=fetcher}find(filter={},options={}){return this.functions.find({database:this.databaseName,collection:this.collectionName,query:filter,project:options.projection,sort:options.sort,limit:options.limit})}findOne(filter={},options={}){return this.functions.findOne({database:this.databaseName,collection:this.collectionName,query:filter,project:options.projection,sort:options.sort})}findOneAndUpdate(filter={},update,options={}){return this.functions.findOneAndUpdate({database:this.databaseName,collection:this.collectionName,filter:filter,update:update,sort:options.sort,projection:options.projection,upsert:options.upsert,returnNewDocument:options.returnNewDocument})}findOneAndReplace(filter={},replacement,options={}){return this.functions.findOneAndReplace({database:this.databaseName,collection:this.collectionName,filter:filter,update:replacement,sort:options.sort,projection:options.projection,upsert:options.upsert,returnNewDocument:options.returnNewDocument})}findOneAndDelete(filter={},options={}){return this.functions.findOneAndReplace({database:this.databaseName,collection:this.collectionName,filter:filter,sort:options.sort,projection:options.projection})}aggregate(pipeline){return this.functions.aggregate({database:this.databaseName,collection:this.collectionName,pipeline:pipeline})}count(filter={},options={}){return this.functions.count({database:this.databaseName,collection:this.collectionName,query:filter,limit:options.limit})}insertOne(document){return this.functions.insertOne({database:this.databaseName,collection:this.collectionName,document:document})}insertMany(documents){return this.functions.insertMany({database:this.databaseName,collection:this.collectionName,documents:documents})}deleteOne(filter={}){return this.functions.deleteOne({database:this.databaseName,collection:this.collectionName,query:filter})}deleteMany(filter={}){return this.functions.deleteMany({database:this.databaseName,collection:this.collectionName,query:filter})}updateOne(filter,update,options={}){return this.functions.updateOne({database:this.databaseName,collection:this.collectionName,query:filter,update:update,upsert:options.upsert,arrayFilters:options.arrayFilters})}updateMany(filter,update,options={}){return this.functions.updateMany({database:this.databaseName,collection:this.collectionName,query:filter,update:update,upsert:options.upsert,arrayFilters:options.arrayFilters})}watch({ids:ids,filter:filter}={}){const iterator=this.functions.callFunctionStreaming("watch",{database:this.databaseName,collection:this.collectionName,ids:ids,filter:filter}).then((i=>i[Symbol.asyncIterator]())),stream=this.watchImpl(iterator),originalReturn=stream.return;return Object.assign(stream,{return(value){return iterator.then((i=>i.return?i.return(value):void 0)),originalReturn.call(stream,value)}})}async*watchImpl(iterator){const watchStream=new WatchStream,iterable=iterator.then((i=>({[Symbol.asyncIterator]:()=>i})));for await(const chunk of await iterable)if(chunk){for(watchStream.feedBuffer(chunk);watchStream.state==WatchStreamState.HAVE_EVENT;)yield watchStream.nextEvent();if(watchStream.state==WatchStreamState.HAVE_ERROR)throw watchStream.error}}}function createCollection(fetcher,serviceName,databaseName,collectionName){return new MongoDBCollection(fetcher,serviceName,databaseName,collectionName)}function createDatabase(fetcher,serviceName,databaseName){return{collection:createCollection.bind(null,fetcher,serviceName,databaseName)}}var UserState,UserType$1;!function(UserState){UserState.Active="active",UserState.LoggedOut="logged-out",UserState.Removed="removed"}(UserState||(UserState={})),function(UserType){UserType.Normal="normal",UserType.Server="server"}(UserType$1||(UserType$1={}));class User{constructor(parameters){if(this.app=parameters.app,this.id=parameters.id,this.storage=new UserStorage(this.app.storage,this.id),"accessToken"in parameters&&"refreshToken"in parameters&&"providerType"in parameters)this._accessToken=parameters.accessToken,this._refreshToken=parameters.refreshToken,this.providerType=parameters.providerType,this.storage.accessToken=parameters.accessToken,this.storage.refreshToken=parameters.refreshToken,this.storage.providerType=parameters.providerType;else{this._accessToken=this.storage.accessToken,this._refreshToken=this.storage.refreshToken;const providerType=this.storage.providerType;if(this._profile=this.storage.profile,!providerType)throw new Error("Storage is missing a provider type");this.providerType=providerType}this.fetcher=this.app.fetcher.clone({userContext:{currentUser:this}}),this.apiKeys=new ApiKeyAuth(this.fetcher),this.functions=FunctionsFactory.create(this.fetcher)}get accessToken(){return this._accessToken}set accessToken(token){this._accessToken=token,this.storage.accessToken=token}get refreshToken(){return this._refreshToken}set refreshToken(token){this._refreshToken=token,this.storage.refreshToken=token}get state(){return this.id in this.app.allUsers?null===this.refreshToken?UserState.LoggedOut:UserState.Active:UserState.Removed}get isLoggedIn(){return this.state===UserState.Active}get customData(){if(this.accessToken){return this.decodeAccessToken().userData}throw new Error("Cannot read custom data without an access token")}get profile(){if(this._profile)return this._profile.data;throw new Error("A profile was never fetched for this user")}get identities(){if(this._profile)return this._profile.identities;throw new Error("A profile was never fetched for this user")}get deviceId(){if(this.accessToken){const payload=this.accessToken.split(".")[1];if(payload){const deviceId=JSON.parse(gBase64_decode(payload)).baas_device_id;if("string"==typeof deviceId&&"000000000000000000000000"!==deviceId)return deviceId}}return null}async refreshProfile(){const response=await this.fetcher.fetchJSON({method:"GET",path:routes.api().auth().profile().path});this._profile=new UserProfile(response),this.storage.profile=this._profile}async logOut(){try{null!==this._refreshToken&&await this.fetcher.fetchJSON({method:"DELETE",path:routes.api().auth().session().path,tokenType:"refresh"})}catch(err){if(!(err instanceof Error&&err.message.includes("failed to find refresh token")))throw err}finally{this.accessToken=null,this.refreshToken=null}}async linkCredentials(credentials){const response=await this.app.authenticator.authenticate(credentials,this);if(this.id!==response.userId){const details=`got user id ${response.userId} expected ${this.id}`;throw new Error(`Link response ment for another user (${details})`)}this.accessToken=response.accessToken,await this.refreshProfile()}async refreshAccessToken(){const response=await this.fetcher.fetchJSON({method:"POST",path:routes.api().auth().session().path,tokenType:"refresh"}),{access_token:accessToken}=response;if("string"!=typeof accessToken)throw new Error("Expected an 'access_token' in the response");this.accessToken=accessToken}async refreshCustomData(){return await this.refreshAccessToken(),this.customData}addListener(){throw new Error("Not yet implemented")}removeListener(){throw new Error("Not yet implemented")}removeAllListeners(){throw new Error("Not yet implemented")}callFunction(name,...args){return this.functions.callFunction(name,...args)}toJSON(){return{id:this.id,accessToken:this.accessToken,refreshToken:this.refreshToken,profile:this._profile,state:this.state,customData:this.customData}}push(){throw new Error("Not yet implemented")}mongoClient(serviceName){return function createService(fetcher,serviceName="mongo-db"){return{db:createDatabase.bind(null,fetcher,serviceName)}}(this.fetcher,serviceName)}decodeAccessToken(){if(this.accessToken){const parts=this.accessToken.split(".");if(3!==parts.length)throw new Error("Expected an access token with three parts");const encodedPayload=parts[1],decodedPayload=gBase64_decode(encodedPayload),parsedPayload=JSON.parse(decodedPayload),{exp:expires,iat:issuedAt,sub:subject,user_data:userData={}}=parsedPayload;if("number"!=typeof expires)throw new Error("Failed to decode access token 'exp'");if("number"!=typeof issuedAt)throw new Error("Failed to decode access token 'iat'");return{expires:expires,issuedAt:issuedAt,subject:subject,userData:userData}}throw new Error("Missing an access token")}}class Credentials{constructor(providerName,providerType,payload){this.providerName=providerName,this.providerType=providerType,this.payload=payload}static anonymous(){return new Credentials("anon-user","anon-user",{})}static apiKey(key){return new Credentials("api-key","api-key",{key:key})}static emailPassword(email,password){return new Credentials("local-userpass","local-userpass",{username:email,password:password})}static function(payload){return new Credentials("custom-function","custom-function",payload)}static jwt(token){return new Credentials("custom-token","custom-token",{token:token})}static google(payload){return new Credentials("oauth2-google","oauth2-google",Credentials.derivePayload(payload))}static derivePayload(payload){if("string"==typeof payload)throw new Error("`google(<tokenString>)` has been deprecated. Please use `google(<authCodeObject>).");if(1===Object.keys(payload).length){if("authCode"in payload||"redirectUrl"in payload)return payload;if("idToken"in payload)return{id_token:payload.idToken};throw new Error("Unexpected payload: "+JSON.stringify(payload))}throw new Error("Expected only one property in payload, got "+JSON.stringify(payload))}static facebook(redirectUrlOrAccessToken){return new Credentials("oauth2-facebook","oauth2-facebook",redirectUrlOrAccessToken.includes("://")?{redirectUrl:redirectUrlOrAccessToken}:{accessToken:redirectUrlOrAccessToken})}static apple(redirectUrlOrIdToken){return new Credentials("oauth2-apple","oauth2-apple",redirectUrlOrIdToken.includes("://")?{redirectUrl:redirectUrlOrIdToken}:{id_token:redirectUrlOrIdToken})}}class AppStorage extends PrefixedStorage{constructor(storage,appId){super(storage,`app(${appId})`)}getUserIds(){const userIdsString=this.get("userIds"),userIds=userIdsString?JSON.parse(userIdsString):[];if(Array.isArray(userIds))return[...new Set(userIds)];throw new Error("Expected the user ids to be an array")}setUserIds(userIds,mergeWithExisting){if(mergeWithExisting){const existingIds=this.getUserIds();for(const id of existingIds)-1===userIds.indexOf(id)&&userIds.push(id)}this.set("userIds",JSON.stringify(userIds))}removeUserId(userId){const userIds=this.getUserIds().filter((id=>id!==userId));this.setUserIds(userIds,!1)}getDeviceId(){return this.get("deviceId")}setDeviceId(deviceId){this.set("deviceId",deviceId)}}const REDIRECT_HASH_TO_RESULT={_stitch_client_app_id:"appId",_baas_client_app_id:"appId",_stitch_ua:"userAuth",_baas_ua:"userAuth",_stitch_link:"link",_baas_link:"link",_stitch_error:"error",_baas_error:"error",_stitch_state:"state",_baas_state:"state"};class OAuth2Helper{constructor(storage,openWindow=getEnvironment().openWindow){this.storage=storage.prefix("oauth2"),this.openWindow=openWindow}static parseRedirectLocation(queryString){const params=function decodeQueryString(str){const cleanStr="?"===str[0]?str.substr(1):str;return Object.fromEntries(cleanStr.split("&").filter((s=>s.length>0)).map((kvp=>kvp.split("="))).map((([k,v])=>[k,decodeURIComponent(v)])))}(queryString),result={};for(const[p,r]of Object.entries(REDIRECT_HASH_TO_RESULT)){const value=params[p];value&&(result[r]=value)}return result}static handleRedirect(queryString,storage=getEnvironment().defaultStorage){const result=OAuth2Helper.parseRedirectLocation(queryString),{state:state,error:error}=result;if("string"!=typeof state)throw error?new Error(`Failed to handle OAuth 2.0 redirect: ${error}`):new Error("Failed to handle OAuth 2.0 redirect.");{const oauth2Storage=storage.prefix("oauth2");OAuth2Helper.getStateStorage(oauth2Storage,state).set("result",JSON.stringify(result))}}static decodeAuthInfo(authInfo){const parts=(authInfo||"").split("$");if(4===parts.length){const[accessToken,refreshToken,userId,deviceId]=parts;return{accessToken:accessToken,refreshToken:refreshToken,userId:userId,deviceId:deviceId}}throw new Error("Failed to decode 'authInfo' into ids and tokens")}static getStateStorage(storage,state){return storage.prefix(`state(${state})`)}openWindowAndWaitForRedirect(url,state){const stateStorage=OAuth2Helper.getStateStorage(this.storage,state);return new Promise(((resolve,reject)=>{let windowClosedInterval,redirectWindow=null;const handleStorageUpdate=()=>{const result=stateStorage.get("result");if(result){const parsedResult=JSON.parse(result);stateStorage.removeListener(handleStorageUpdate),stateStorage.clear();try{redirectWindow&&(clearInterval(windowClosedInterval),redirectWindow.close())}catch(err){console.warn(`Failed closing redirect window: ${err}`)}finally{resolve(parsedResult)}}};stateStorage.addListener(handleStorageUpdate),redirectWindow=this.openWindow(url),windowClosedInterval=setInterval((()=>{if(redirectWindow){if(redirectWindow.closed){clearInterval(windowClosedInterval),stateStorage.removeListener(handleStorageUpdate);const err=new Error("Window closed");reject(err)}}else clearInterval(windowClosedInterval)}),100)}))}generateState(){return function generateRandomString(length,alphabet){let result="";for(let i=0;i<length;i++)result+=alphabet[Math.floor(Math.random()*alphabet.length)];return result}(12,"abcdefghijklmnopqrstuvwxyz")}}class Authenticator{constructor(fetcher,storage,getDeviceInformation){this.fetcher=fetcher,this.oauth2=new OAuth2Helper(storage),this.getDeviceInformation=getDeviceInformation}async authenticate(credentials,linkingUser){const deviceInformation=this.getDeviceInformation(),isLinking="object"==typeof linkingUser;if(credentials.providerType.startsWith("oauth2")&&"string"==typeof credentials.payload.redirectUrl){const state=this.oauth2.generateState(),url=await this.getLogInUrl(credentials,isLinking,{state:state,redirect:credentials.payload.redirectUrl,providerRedirectHeader:!!isLinking||void 0,device:isLinking?void 0:deviceInformation.encode()});if(isLinking){const redirectUrl=(await this.fetcher.fetch({method:"GET",url:url,tokenType:isLinking?"access":"none",user:linkingUser,mode:"cors",credentials:"include"})).headers.get("x-baas-location");if(redirectUrl)return this.openWindowAndWaitForAuthResponse(redirectUrl,state);throw new Error("Missing x-baas-location header")}return this.openWindowAndWaitForAuthResponse(url,state)}{const logInUrl=await this.getLogInUrl(credentials,isLinking),response=await this.fetcher.fetchJSON({method:"POST",url:logInUrl,body:{...credentials.payload,options:{device:deviceInformation.toJSON()}},tokenType:isLinking?"access":"none",user:linkingUser}),{user_id:userId,access_token:accessToken,refresh_token:refreshToken=null,device_id:deviceId}=response;if("string"!=typeof userId)throw new Error("Expected a user id in the response");if("string"!=typeof accessToken)throw new Error("Expected an access token in the response");if("string"!=typeof refreshToken&&null!==refreshToken)throw new Error("Expected refresh token to be a string or null");if("string"!=typeof deviceId)throw new Error("Expected device id to be a string");return{userId:userId,accessToken:accessToken,refreshToken:refreshToken,deviceId:deviceId}}}async getLogInUrl(credentials,link=!1,extraQueryParams={}){const loginRoute=this.fetcher.appRoute.authProvider(credentials.providerName).login(),qs=encodeQueryString({link:link?"true":void 0,...extraQueryParams});return await this.fetcher.locationUrl+loginRoute.path+qs}async openWindowAndWaitForAuthResponse(redirectUrl,state){const redirectResult=await this.oauth2.openWindowAndWaitForRedirect(redirectUrl,state);return OAuth2Helper.decodeAuthInfo(redirectResult.userAuth)}}class MongoDBRealmError extends Error{constructor(method,url,statusCode,statusText,error,errorCode,link){const summary=statusText?`status ${statusCode} ${statusText}`:`status ${statusCode}`;super("string"==typeof error?`Request failed (${method} ${url}): ${error} (${summary})`:`Request failed (${method} ${url}): (${summary})`),this.method=method,this.url=url,this.statusText=statusText,this.statusCode=statusCode,this.error=error,this.errorCode=errorCode,this.link=link}static async fromRequestAndResponse(request,response){var _a;const{url:url,method:method}=request,{status:status,statusText:statusText}=response;if(null===(_a=response.headers.get("content-type"))||void 0===_a?void 0:_a.startsWith("application/json")){const body=await response.json();if("object"==typeof body&&body){const{error:error,error_code:errorCode,link:link}=body;return new MongoDBRealmError(method,url,status,statusText,"string"==typeof error?error:void 0,"string"==typeof errorCode?errorCode:void 0,"string"==typeof link?link:void 0)}}return new MongoDBRealmError(method,url,status,statusText)}}class Fetcher{constructor({appId:appId,transport:transport,userContext:userContext,locationUrlContext:locationUrlContext}){this.appId=appId,this.transport=transport,this.userContext=userContext,this.locationUrlContext=locationUrlContext}static buildAuthorizationHeader(user,tokenType){if(user&&"none"!==tokenType){if("access"===tokenType)return{Authorization:`Bearer ${user.accessToken}`};if("refresh"===tokenType)return{Authorization:`Bearer ${user.refreshToken}`};throw new Error(`Unexpected token type (${tokenType})`)}return{}}static buildBody(body){if(body){if("object"==typeof body&&null!==body)return JSON.stringify(bundle_dom_es_serialize(body));if("string"==typeof body)return body;throw console.log("body is",body),new Error("Unexpected type of body")}}static buildJsonHeader(body){return body&&body.length>0?{"Content-Type":"application/json"}:{}}clone(config){return new Fetcher({appId:this.appId,transport:this.transport,userContext:this.userContext,locationUrlContext:this.locationUrlContext,...config})}async fetch(request){const{path:path,url:url,tokenType:tokenType="access",user:user=this.userContext.currentUser,...restOfRequest}=request;if("string"==typeof path&&"string"==typeof url)throw new Error("Use of 'url' and 'path' mutually exclusive");if("string"==typeof path){const url=await this.locationUrlContext.locationUrl+path;return this.fetch({...request,path:void 0,url:url})}if("string"==typeof url){const response=await this.transport.fetch({...restOfRequest,url:url,headers:{...Fetcher.buildAuthorizationHeader(user,tokenType),...request.headers}});if(response.ok)return response;if(user&&401===response.status&&"access"===tokenType)return await user.refreshAccessToken(),this.fetch({...request,user:user});throw user&&401===response.status&&"refresh"===tokenType&&(user.accessToken=null,user.refreshToken=null),await MongoDBRealmError.fromRequestAndResponse(request,response)}throw new Error("Expected either 'url' or 'path'")}async fetchJSON(request){const{body:body}=request,serializedBody=Fetcher.buildBody(body),contentTypeHeaders=Fetcher.buildJsonHeader(serializedBody),response=await this.fetch({...request,body:serializedBody,headers:{Accept:"application/json",...contentTypeHeaders,...request.headers}}),contentType=response.headers.get("content-type");if(null==contentType?void 0:contentType.startsWith("application/json")){return bundle_dom_es_deserialize(await response.json())}if(null===contentType)return null;throw new Error(`Expected JSON response, got "${contentType}"`)}async fetchStream(request){const{body:body}=await this.fetch({...request,headers:{Accept:"text/event-stream",...request.headers}});return function asyncIteratorFromResponseBody(body){if("object"!=typeof body||null===body)throw new Error("Expected a non-null object");if(Symbol.asyncIterator in body)return body;if("getReader"in body){const stream=body;return{[Symbol.asyncIterator](){const reader=stream.getReader();return{next(){return reader.read()},async return(){return await reader.cancel(),{done:!0,value:null}}}}}}throw new Error("Expected an AsyncIterable or a ReadableStream")}(body)}get appRoute(){return routes.api().app(this.appId)}get locationUrl(){return this.locationUrlContext.locationUrl}}var DeviceFields;!function(DeviceFields){DeviceFields.DEVICE_ID="deviceId",DeviceFields.APP_ID="appId",DeviceFields.APP_VERSION="appVersion",DeviceFields.PLATFORM="platform",DeviceFields.PLATFORM_VERSION="platformVersion",DeviceFields.SDK_VERSION="sdkVersion"}(DeviceFields||(DeviceFields={}));class DeviceInformation{constructor({appId:appId,appVersion:appVersion,deviceId:deviceId}){this.sdkVersion="2.0.0";const environment=getEnvironment();this.platform=environment.platform,this.platformVersion=environment.platformVersion,this.appId=appId,this.appVersion=appVersion,this.deviceId=deviceId}encode(){const obj=removeKeysWithUndefinedValues(this);return gBase64_encode(JSON.stringify(obj))}toJSON(){return removeKeysWithUndefinedValues(this)}}class App{constructor(idOrConfiguration){this.users=[],this._locationUrl=null;const configuration="string"==typeof idOrConfiguration?{id:idOrConfiguration}:idOrConfiguration;if("object"!=typeof configuration||"string"!=typeof configuration.id)throw new Error("Missing an Atlas App Services app-id");this.id=configuration.id,this.baseUrl=configuration.baseUrl||"https://realm.mongodb.com",configuration.skipLocationRequest&&(this._locationUrl=Promise.resolve(this.baseUrl)),this.localApp=configuration.app;const{storage:storage,transport:transport=new DefaultNetworkTransport}=configuration;this.fetcher=new Fetcher({appId:this.id,userContext:this,locationUrlContext:this,transport:transport}),this.emailPasswordAuth=new EmailPasswordAuth(this.fetcher);const baseStorage=storage||getEnvironment().defaultStorage;this.storage=new AppStorage(baseStorage,this.id),this.authenticator=new Authenticator(this.fetcher,baseStorage,(()=>this.deviceInformation));try{this.hydrate()}catch(err){this.storage.clear(),console.warn("Realm app hydration failed:",err instanceof Error?err.message:err)}}static getApp(id){if(id in App.appCache)return App.appCache[id];{const instance=new App(id);return App.appCache[id]=instance,instance}}switchUser(nextUser){const index=this.users.findIndex((u=>u===nextUser));if(-1===index)throw new Error("The user was never logged into this app");const[user]=this.users.splice(index,1);this.users.unshift(user)}async logIn(credentials,fetchProfile=!0){const response=await this.authenticator.authenticate(credentials),user=this.createOrUpdateUser(response,credentials.providerType);this.switchUser(user),fetchProfile&&await user.refreshProfile(),this.storage.setUserIds(this.users.map((u=>u.id)),!0);const deviceId=response.deviceId;return deviceId&&"000000000000000000000000"!==deviceId&&this.storage.set("deviceId",deviceId),user}async removeUser(user){const index=this.users.findIndex((u=>u===user));if(-1===index)throw new Error("The user was never logged into this app");this.users.splice(index,1),await user.logOut(),this.storage.remove(`user(${user.id}):profile`),this.storage.removeUserId(user.id)}async deleteUser(user){await this.fetcher.fetchJSON({method:"DELETE",path:routes.api().auth().delete().path}),await this.removeUser(user)}addListener(){throw new Error("Not yet implemented")}removeListener(){throw new Error("Not yet implemented")}removeAllListeners(){throw new Error("Not yet implemented")}get currentUser(){const activeUsers=this.users.filter((user=>user.state===UserState.Active));return 0===activeUsers.length?null:activeUsers[0]}get allUsers(){return Object.fromEntries(this.users.map((user=>[user.id,user])))}get locationUrl(){if(!this._locationUrl){const path=routes.api().app(this.id).location().path;this._locationUrl=this.fetcher.fetchJSON({method:"GET",url:this.baseUrl+path,tokenType:"none"}).then((body=>{if("object"!=typeof body)throw new Error("Expected response body be an object");return body})).then((({hostname:hostname})=>{if("string"!=typeof hostname)throw new Error("Expected response to contain a 'hostname'");return hostname})).catch((err=>{throw this._locationUrl=null,err}))}return this._locationUrl}get deviceInformation(){const deviceIdStr=this.storage.getDeviceId(),deviceId="string"==typeof deviceIdStr&&"000000000000000000000000"!==deviceIdStr?new ObjectId(deviceIdStr):void 0;return new DeviceInformation({appId:this.localApp?this.localApp.name:void 0,appVersion:this.localApp?this.localApp.version:void 0,deviceId:deviceId})}createOrUpdateUser(response,providerType){const existingUser=this.users.find((u=>u.id===response.userId));if(existingUser)return existingUser.accessToken=response.accessToken,existingUser.refreshToken=response.refreshToken,existingUser;{if(!response.refreshToken)throw new Error("No refresh token in response from server");const user=new User({app:this,id:response.userId,accessToken:response.accessToken,refreshToken:response.refreshToken,providerType:providerType});return this.users.unshift(user),user}}hydrate(){const userIds=this.storage.getUserIds();this.users=userIds.map((id=>new User({app:this,id:id})))}}App.appCache={},App.Credentials=Credentials;const check$1=function(it){return it&&it.Math==Math&&it},safeGlobalThis$1=check$1("object"==typeof globalThis&&globalThis)||check$1("object"==typeof window&&window)||check$1("object"==typeof self&&self)||check$1("object"==typeof __webpack_require__.g&&__webpack_require__.g)||function(){return this}()||Function("return this")();"undefined"!=typeof __DEV__&&__DEV__;const browser=function detect(userAgent){return userAgent?parseUserAgent(userAgent):"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new ReactNativeInfo:"undefined"!=typeof navigator?parseUserAgent(navigator.userAgent):function getNodeVersion(){return"undefined"!=typeof process&&process.version?new NodeInfo(process.version.slice(1)):null}()}(),DefaultStorage="localStorage"in safeGlobalThis$1?class LocalStorage{constructor(){if("object"!=typeof safeGlobalThis$1.localStorage)throw new Error("Cannot use LocalStorage without a global localStorage object");this.global=safeGlobalThis$1}get(key){return this.global.localStorage.getItem(key)}set(key,value){return this.global.localStorage.setItem(key,value)}remove(key){return this.global.localStorage.removeItem(key)}prefix(keyPart){return new PrefixedStorage(this,keyPart)}clear(prefix){const keys=[];for(let i=0;i<this.global.localStorage.length;i++){const key=this.global.localStorage.key(i);!key||prefix&&!key.startsWith(prefix)||keys.push(key)}for(const key of keys)this.global.localStorage.removeItem(key)}addListener(listener){return this.global.addEventListener("storage",listener)}removeListener(listener){return this.global.removeEventListener("storage",listener)}}:class MemoryStorage{constructor(){this.storage={},this.listeners=new Set}get(key){return key in this.storage?this.storage[key]:null}set(key,value){this.storage[key]=value,this.fireListeners()}remove(key){delete this.storage[key],this.fireListeners()}prefix(keyPart){return new PrefixedStorage(this,keyPart)}clear(prefix){for(const key of Object.keys(this.storage))prefix&&!key.startsWith(prefix)||delete this.storage[key];this.fireListeners()}addListener(listener){this.listeners.add(listener)}removeListener(listener){this.listeners.delete(listener)}fireListeners(){this.listeners.forEach((listener=>listener()))}};const environment$1={defaultStorage:(new DefaultStorage).prefix("realm-web"),openWindow:function openWindow(url){return"function"==typeof safeGlobalThis$1.open?safeGlobalThis$1.open(url):(console.log(`Please open ${url}`),null)},platform:(null==browser?void 0:browser.name)||"web",platformVersion:(null==browser?void 0:browser.version)||"0.0.0",TextDecoder:TextDecoder};function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}function _regeneratorRuntime(){_regeneratorRuntime=function _regeneratorRuntime(){return exports};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,defineProperty=Object.defineProperty||function(obj,key,desc){obj[key]=desc.value},$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key]}try{define({},"")}catch(err){define=function define(obj,key,value){return obj[key]=value}}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return defineProperty(generator,"_invoke",{value:makeInvokeMethod(innerFn,self,context)}),generator}function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)}}catch(err){return{type:"throw",arg:err}}}exports.wrap=wrap;var ContinueSentinel={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,(function(){return this}));var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);function defineIteratorMethods(prototype){["next","throw","return"].forEach((function(method){define(prototype,method,(function(arg){return this._invoke(method,arg)}))}))}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==_typeof(value)&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then((function(value){invoke("next",value,resolve,reject)}),(function(err){invoke("throw",err,resolve,reject)})):PromiseImpl.resolve(value).then((function(unwrapped){result.value=unwrapped,resolve(result)}),(function(error){return invoke("throw",error,resolve,reject)}))}reject(record.arg)}var previousPromise;defineProperty(this,"_invoke",{value:function value(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl((function(resolve,reject){invoke(method,arg,resolve,reject)}))}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult()}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg)}else"return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return{value:record.arg,done:context.done}}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg)}}}function maybeInvokeDelegate(delegate,context){var methodName=context.method,method=delegate.iterator[methodName];if(void 0===method)return context.delegate=null,"throw"===methodName&&delegate.iterator.return&&(context.method="return",context.arg=void 0,maybeInvokeDelegate(delegate,context),"throw"===context.method)||"return"!==methodName&&(context.method="throw",context.arg=new TypeError("The iterator does not provide a '"+methodName+"' method")),ContinueSentinel;var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=void 0),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel)}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry)}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0)}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;)if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return next.next=next}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,defineProperty(Gp,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),defineProperty(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return!!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name))},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun},exports.awrap=function(arg){return{__await:arg}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,(function(){return this})),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then((function(result){return result.done?result.value:iter.next()}))},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,(function(){return this})),define(Gp,"toString",(function(){return"[object Generator]"})),exports.keys=function(val){var object=Object(val),keys=[];for(var key in object)keys.push(key);return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next}return next.done=!0,next}},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this)"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=void 0)},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval},dispatchException:function dispatchException(exception){if(this.done)throw exception;var context=this;function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=void 0),!!caught}for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(hasCatch){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0)}else{if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}}}},abrupt:function abrupt(type,arg){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break}}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record)},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return"break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel},finish:function finish(finallyLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel}},catch:function _catch(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry)}return thrown}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=void 0),ContinueSentinel}},exports}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}!function setEnvironment(e){environment=e}(environment$1);var startUp=function(){var _ref=function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise((function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(void 0)}))}}(_regeneratorRuntime().mark((function _callee(){var app,credentials,mongo,db;return _regeneratorRuntime().wrap((function _callee$(_context){for(;;)switch(_context.prev=_context.next){case 0:return app=new App({id:"nexmap-izeal"}),"iYUg10Ymuo2sIF1JPIvUrfCbxvQ7SQ78WFxRvY8wc1wSfe9xHwwdNqlo7NgGw89g",credentials=Credentials.apiKey("iYUg10Ymuo2sIF1JPIvUrfCbxvQ7SQ78WFxRvY8wc1wSfe9xHwwdNqlo7NgGw89g"),_context.next=5,app.logIn(credentials);case 5:return mongo=app.currentUser.mongoClient("mongodb-atlas"),db=mongo.db("nexAction").collection("skills"),_context.abrupt("return",db);case 8:case"end":return _context.stop()}}),_callee)})));return function startUp(){return _ref.apply(this,arguments)}}();function depthswalker_typeof(obj){return depthswalker_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},depthswalker_typeof(obj)}function _wrapRegExp(){_wrapRegExp=function _wrapRegExp(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),_setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return _inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result){result.groups=buildGroups(result,this);var indices=result.indices;indices&&(indices.groups=buildGroups(indices,this))}return result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\$<([^>]+)>/g,(function(_,name){var group=groups[name];return"$"+(Array.isArray(group)?group.join("$"):group)})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=depthswalker_typeof(args[args.length-1])&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},_wrapRegExp.apply(this,arguments)}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},_setPrototypeOf(o,p)}var actions=[{id:"reap",fullName:"Reap",firstPerson:!1,secondPerson:!1,thirdPerson:_wrapRegExp(/^(.+?) lashes out with a swift, reaping blow at (.+?)\.$/,{user:1,target:2}),profession:["depthswalker"],skill:"shadowmancy",balance:"balance",multiLine:1,tags:[],length:2.2},{id:"instillleach",fullName:"Instill - Leach",firstPerson:!1,secondPerson:!1,thirdPerson:_wrapRegExp(/^As the weapon strikes (.+?), he seems greatly diminished\.$/,{target:1}),profession:["depthswalker"],skill:"shadowmancy",balance:"balance",multiLine:1,tags:[],length:2.2}];function dragon_typeof(obj){return dragon_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},dragon_typeof(obj)}function dragon_wrapRegExp(){dragon_wrapRegExp=function _wrapRegExp(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),dragon_setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return dragon_inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result){result.groups=buildGroups(result,this);var indices=result.indices;indices&&(indices.groups=buildGroups(indices,this))}return result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\$<([^>]+)>/g,(function(_,name){var group=groups[name];return"$"+(Array.isArray(group)?group.join("$"):group)})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=dragon_typeof(args[args.length-1])&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},dragon_wrapRegExp.apply(this,arguments)}function dragon_inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&dragon_setPrototypeOf(subClass,superClass)}function dragon_setPrototypeOf(o,p){return dragon_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},dragon_setPrototypeOf(o,p)}var dragon_actions=[{id:"gut",fullName:"Gut",firstPerson:dragon_wrapRegExp(/^You rip into (.+?) with your massive, deadly claws\.$/,{target:1}),secondPerson:!1,thirdPerson:dragon_wrapRegExp(/^(\w+?) rips into (.+?) with \w+ massive, deadly claws\.$/,{user:1,target:2}),profession:["red dragon","green dragon","black dragon","blue dragon","gold dragon","silver dragon"],skill:"dragoncraft",balance:"balance",tags:[],length:3},{id:"incantation",fullName:"Incantation",firstPerson:dragon_wrapRegExp(/^Drawing from the well of your puissance, you invoke a dramatic chant in the dragon tongue\. Your voice resonates with each word, culminating in a wave of magical energy that you bend to your will and thrust towards (.+), bombarding \w+ with the ancient power\.$/,{target:1}),secondPerson:!1,thirdPerson:dragon_wrapRegExp(/^A resonant vibration emanates from (\w+) as \w+ invokes a rumbling, sonorous chant in the dragon tongue\. As the sound increases, (.+?) jerks violently, \w+ body wracked by an unseen force\.$/,{user:1,target:2}),profession:["red dragon","green dragon","black dragon","blue dragon","gold dragon","silver dragon"],skill:"dragoncraft",balance:"equilibrium",tags:[],length:3},{id:"dragoncurse",fullName:"Dragoncurse",firstPerson:!1,secondPerson:!1,thirdPerson:dragon_wrapRegExp(/^(\w+) draws himself up to his full height, staring imperiously down at (.+?)\.$/,{user:1,target:2}),profession:["red dragon","green dragon","black dragon","blue dragon","gold dragon","silver dragon"],skill:"dragoncraft",balance:"equilibrium",tags:[],length:4,multiline:0},{id:"rend",fullName:"Rend",firstPerson:!1,secondPerson:!1,thirdPerson:dragon_wrapRegExp(/^(\w+) draws himself up to his full height, staring imperiously down at (.+?)\.$/,{user:1,target:2}),profession:["red dragon","green dragon","black dragon","blue dragon","gold dragon","silver dragon"],skill:"dragoncraft",balance:"balance",tags:[],length:2.5,multiline:0},{id:"glaciate",fullName:"Glaciate",firstPerson:dragon_wrapRegExp(/^You breathe a column of icy air at (.+?)'s head, stunning \w+\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["blue dragon"],skill:"attainment",balance:"battlerage",tags:["battlerage","stun"],length:3},{id:"frostrive",fullName:"Frostrive",firstPerson:dragon_wrapRegExp(/^(.+?)'s translucent shield cracks and fades away as you breathe an icy blast at it\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["blue dragon"],skill:"attainment",balance:"battlerage",tags:["battlerage"],length:3},{id:"override",fullName:"Override",firstPerson:dragon_wrapRegExp(/^You barrel into (.+?) and knock \w+ to the ground before stomping over \w+ prone form\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["blue dragon"],skill:"attainment",balance:"battlerage",tags:["battlerage"],length:3},{id:"tailsmash",fullName:"Tailsmash",firstPerson:dragon_wrapRegExp(/^You flick your tail at (.+?), dismissively brushing aside the paltry shield protecting \w+\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["dragon"],skill:"dragoncraft",balance:"balance",tags:[],length:2},{id:"ague",fullName:"Ague",firstPerson:dragon_wrapRegExp(/^You let loose a steady stream of cold air around (.+?), who begins to shiver uncontrollably\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["blue dragon"],skill:"attainment",balance:"battlerage",tags:["battlerage"],length:3},{id:"dragonchill",fullName:"Dragonchill",firstPerson:dragon_wrapRegExp(/^You form small chunks of ice in your enormous maw, then spit them at (.+?) in a barrage\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["blue dragon"],skill:"attainment",balance:"battlerage",tags:["battlerage"],length:3},{id:"frostwave",fullName:"Frostwave",firstPerson:dragon_wrapRegExp(/^You breathe a wave of icy air at (.+?)\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["blue dragon"],skill:"attainment",balance:"battlerage",tags:["battlerage"],length:3},{id:"corrode",fullName:"Corrode",firstPerson:!1,secondPerson:!1,thirdPerson:dragon_wrapRegExp(/^(\w+) opens \w+ gigantic maw and spews acid on (.+?)\. \w+ is too clumsy to dodge and is covered in the corrosive slime\.$/,{user:1,target:2}),profession:["black dragon"],skill:"attainment",balance:"battlerage",tags:["battlerage"],length:3},{id:"dragonblaze",fullName:"Dragonblaze",firstPerson:dragon_wrapRegExp(/^You breathe a long torrent of flame at (.+?), igniting \w+ skin\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["red dragon"],skill:"attainment",balance:"battlerage",tags:["battlerage"],length:3},{id:"dragonblazeTick",fullName:"Dragonblaze tick",firstPerson:!1,secondPerson:!1,thirdPerson:dragon_wrapRegExp(/^(.+?) is wracked with pain as the flames of dragonbreath wreathe over \w+ skin\.$/,{target:1}),profession:["red dragon"],skill:"attainment",balance:"battlerage",tags:["battlerage"],length:3},{id:"scorch",fullName:"Scorch",firstPerson:dragon_wrapRegExp(/^You blacken (.+?)'s flesh with a quick blast of flame, slowing \w+ healing process\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["red dragon"],skill:"attainment",balance:"battlerage",tags:["battlerage"],length:3},{id:"overwhelm",fullName:"Overwhelm",firstPerson:dragon_wrapRegExp(/^You charge quickly at (.+?), throwing your mighty form into \w+ and sending \w+ staggering back\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["red dragon"],skill:"attainment",balance:"battlerage",tags:["battlerage"],length:3},{id:"dragontaunt",fullName:"Dragontaunt",firstPerson:dragon_wrapRegExp(/^You slap your tail on the ground while growling at (.+?), forcing \w+ to recklessly attack\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["red dragon"],skill:"attainment",balance:"battlerage",tags:["battlerage"],length:3},{id:"flamebath",fullName:"Flamebath",firstPerson:dragon_wrapRegExp(/^You blast (.+?) with a bath of flame, but \w+ is able to avoid the brunt of the blast\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["red dragon"],skill:"attainment",balance:"battlerage",tags:["battlerage"],length:3},{id:"melt",fullName:"Melt",firstPerson:dragon_wrapRegExp(/^You breathe a white\x2Dhot blast of flame at (.+?) and burn away \w+ translucent shield\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["red dragon"],skill:"attainment",balance:"battlerage",tags:["battlerage"],length:3}];function occultist_typeof(obj){return occultist_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},occultist_typeof(obj)}function occultist_wrapRegExp(){occultist_wrapRegExp=function _wrapRegExp(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),occultist_setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return occultist_inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result){result.groups=buildGroups(result,this);var indices=result.indices;indices&&(indices.groups=buildGroups(indices,this))}return result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\$<([^>]+)>/g,(function(_,name){var group=groups[name];return"$"+(Array.isArray(group)?group.join("$"):group)})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=occultist_typeof(args[args.length-1])&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},occultist_wrapRegExp.apply(this,arguments)}function occultist_inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&occultist_setPrototypeOf(subClass,superClass)}function occultist_setPrototypeOf(o,p){return occultist_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},occultist_setPrototypeOf(o,p)}var occultist_actions=[{id:"warp",fullName:"Warp",firstPerson:occultist_wrapRegExp(/^You reach out and clench a fist before (.+?), who screams and doubles over in agony as \w+ skin suddenly bubbles with gangrenous growths\.$/,{target:1}),secondPerson:!1,thirdPerson:occultist_wrapRegExp(/^(\w+?) reaches out and clenches a fist before (.+?), who screams and doubles over in agony as \w+ skin suddenly bubbles with gangrenous growths\.$/,{user:1,target:2}),profession:["occultist"],skill:"occultism",balance:"equilibrium",tags:["damage"],length:3},{id:"priestess",fullName:"Priestess",firstPerson:/Raising the High Priestess tarot over your head, parallel to the ground, you release it. It instantly expands and moves downward, healing you as your body passes through it\.$/,secondPerson:!1,thirdPerson:occultist_wrapRegExp(/^(\w+?) raises a tarot over \w+ head, parallel to the ground. Upon releasing it, it instantly expands and moves downward until \w+ entire body has been passed through it\.$/,{user:1}),profession:["occultist","jester"],skill:"tarot",balance:"balance",tags:["heal"],length:3},{id:"harry",fullName:"Harry",firstPerson:occultist_wrapRegExp(/^Raising your hands in the air, you summon horrific visions to torment (.+?)\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["occultist"],skill:"attainment",balance:"battlerage",tags:["battlerage"],length:3},{id:"harryTick",fullName:"Harry tick",firstPerson:occultist_wrapRegExp(/^(.+?) is tormented by horrific visions from the Plane of Chaos\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["occultist"],skill:"attainment",balance:"battlerage",tags:["battlerage"],length:3},{id:"chaosgate",fullName:"Chaosgate",firstPerson:occultist_wrapRegExp(/^You cup your hands together and fling them outwards, sending a spiral of shimmering portals into (.+?)'s body\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["occultist"],skill:"attainment",balance:"battlerage",tags:["battlerage"],length:3},{id:"stagnate",fullName:"Stagnate",firstPerson:occultist_wrapRegExp(/^You wave one arm at (.+?), causing a small time rift to form around her\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["occultist"],skill:"attainment",balance:"battlerage",tags:["battlerage"],length:3}];function pariah_typeof(obj){return pariah_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},pariah_typeof(obj)}function pariah_wrapRegExp(){pariah_wrapRegExp=function _wrapRegExp(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),pariah_setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return pariah_inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result){result.groups=buildGroups(result,this);var indices=result.indices;indices&&(indices.groups=buildGroups(indices,this))}return result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\$<([^>]+)>/g,(function(_,name){var group=groups[name];return"$"+(Array.isArray(group)?group.join("$"):group)})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=pariah_typeof(args[args.length-1])&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},pariah_wrapRegExp.apply(this,arguments)}function pariah_inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&pariah_setPrototypeOf(subClass,superClass)}function pariah_setPrototypeOf(o,p){return pariah_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},pariah_setPrototypeOf(o,p)}var pariah_actions=[{id:"fissure",fullName:"Epitaph Fissure",firstPerson:!1,secondPerson:!1,thirdPerson:pariah_wrapRegExp(/^Crimson fire trails the knife of (\w+) as \w+ slashes \w+ knife through the air before (.+?), a jagged logograph hanging in its passing\.$/,{user:1,target:2}),profession:["pariah"],skill:"memorium",balance:"balance",multiLine:0,tags:["raze"],length:2.2,reaction:function reaction(){}},{id:"serpent",fullName:"Epitaph Serpent",firstPerson:!1,secondPerson:!1,thirdPerson:pariah_wrapRegExp(/^(\w+) traces a writhing logograph in the air before (.+?), the blood upon \w+ knife bursting into arcane flame as it hangs in the wake of the blade's passage\.$/,{user:1,target:2}),profession:["pariah"],skill:"memorium",balance:"balance",multiLine:0,tags:["paralysis"],length:2.2},{id:"skein",fullName:"Epitaph Skein",firstPerson:!1,secondPerson:!1,thirdPerson:pariah_wrapRegExp(/^(\w+) traces a logograph shaped like a skein in the air before (.+?), the blood upon \w+ knife bursting into arcane flame as it hangs in the wake of the blade's passage\.$/,{user:1,target:2}),profession:["pariah"],skill:"memorium",balance:"balance",multiLine:0,tags:[],length:2.2},{id:"sun",fullName:"Epitaph Sun",firstPerson:!1,secondPerson:!1,thirdPerson:pariah_wrapRegExp(/^(\w+) traces a logograph shaped like a sunburst in the air before (.+?), the blood upon \w+ knife bursting into arcane flame as it hangs in the wake of the blade's passage\.$/,{user:1,target:2}),profession:["pariah"],skill:"memorium",balance:"balance",multiLine:0,tags:["epilepsy"],length:2.2},{id:"jackal",fullName:"Epitaph Jackal",firstPerson:!1,secondPerson:!1,thirdPerson:pariah_wrapRegExp(/^(\w+) traces a logograph depicting a leaping jackal in the air before (.+?), the blood upon \w+ knife bursting into arcane flame as it hangs in the wake of the blade's passage\.$/,{user:1,target:2}),profession:["pariah"],skill:"memorium",balance:"balance",multiLine:0,tags:["asthma"],length:2.2},{id:"scales",fullName:"Epitaph Scales",firstPerson:!1,secondPerson:!1,thirdPerson:pariah_wrapRegExp(/^(\w+) traces a logograph shaped like a set of scales in the air before (.+?), the blood upon \w+ knife bursting into arcane flame as it hangs in the wake of the blade's passage\.$/,{user:1,target:2}),profession:["pariah"],skill:"memorium",balance:"balance",multiLine:0,tags:["clumsiness"],length:2.2},{id:"scorpion",fullName:"Epitaph Scorpion",firstPerson:!1,secondPerson:!1,thirdPerson:pariah_wrapRegExp(/^(\w+) traces a logograph depicting a striking scorpion in the air before (.+?), the blood upon \w+ knife bursting into arcane flame as it hangs in the wake of the blade's passage\.$/,{user:1,target:2}),profession:["pariah"],skill:"memorium",balance:"balance",multiLine:0,tags:["scytherus"],length:2.2},{id:"bear",fullName:"Epitaph Bear",firstPerson:!1,secondPerson:!1,thirdPerson:pariah_wrapRegExp(/^(\w+) traces a logograph depicting a lunging bear in the air before (.+?), the blood upon \w+ knife bursting into arcane flame as it hangs in the wake of the blade's passage\.$/,{user:1,target:2}),profession:["pariah"],skill:"memorium",balance:"balance",multiLine:0,tags:["haemophilia","bleeding"],length:2.2},{id:"nest",fullName:"Epitaph Nest",firstPerson:!1,secondPerson:!1,thirdPerson:pariah_wrapRegExp(/^(\w+) traces a logograph that is all twisted lines and angles in the air before (.+?), the blood upon \w+ knife bursting into arcane flame as it hangs in the wake of the blade's passage\.$/,{user:1,target:2}),profession:["pariah"],skill:"memorium",balance:"balance",multiLine:0,tags:["weariness"],length:2.2}];function priest_typeof(obj){return priest_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},priest_typeof(obj)}function priest_wrapRegExp(){priest_wrapRegExp=function _wrapRegExp(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),priest_setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return priest_inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result){result.groups=buildGroups(result,this);var indices=result.indices;indices&&(indices.groups=buildGroups(indices,this))}return result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\$<([^>]+)>/g,(function(_,name){var group=groups[name];return"$"+(Array.isArray(group)?group.join("$"):group)})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=priest_typeof(args[args.length-1])&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},priest_wrapRegExp.apply(this,arguments)}function priest_inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&priest_setPrototypeOf(subClass,superClass)}function priest_setPrototypeOf(o,p){return priest_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},priest_setPrototypeOf(o,p)}var priest_actions=[{id:"chasten",fullName:"Chasten",firstPerson:!1,secondPerson:!1,thirdPerson:priest_wrapRegExp(/^A dark bolt of energy erupts from the mace held by (\w+), afflicting (.+?) with a chastening magic\.$/,{user:1,target:2}),profession:["priest"],skill:"spirituality",balance:"balance",multiLine:0,tags:[],length:2.9},{id:"smite",fullName:"Smite",firstPerson:!1,secondPerson:!1,thirdPerson:priest_wrapRegExp(/^(\w+) utters a prayer and smites (.+?)'s (.+?) with an Auroran Mace\.$/,{user:1,target:2,limb:3}),profession:["priest"],skill:"spirituality",balance:"equilibrium",multiLine:0,tags:[],length:2.8},{id:"guilt",fullName:"Guilt",firstPerson:!1,secondPerson:!1,thirdPerson:priest_wrapRegExp(/^"And your guilt will be made plain," (\w+) proselytises, finger raised to point at (.+?)\.$/,{user:1,target:2}),profession:["priest"],skill:"zeal",balance:"prayer",multiLine:0,tags:["aff"],affs:["guilt"],length:1.7},{id:"guilt2",fullName:"Guilt",firstPerson:!1,secondPerson:!1,thirdPerson:priest_wrapRegExp(/^"Know the pain which you have caused," (\w+) proselytises, finger raised to point at (.+?)\.$/,{user:1,target:2}),profession:["priest"],skill:"zeal",balance:"prayer",multiLine:0,tags:["aff"],affs:["guilt"],length:1.7},{id:"purge",fullName:"Purge",firstPerson:!1,secondPerson:!1,thirdPerson:priest_wrapRegExp(/^"I deem you unfit for Creation!" (\w+) proclaims, pointing an imperious finger at (.+?)\.$/,{user:1,target:2}),profession:["priest"],skill:"zeal",balance:"prayer",multiLine:0,tags:["aff"],affs:["ablaze"],length:2.3},{id:"penance",fullName:"Penance",firstPerson:!1,secondPerson:!1,thirdPerson:priest_wrapRegExp(/^"And face your penance!" denounces (\w+), hand raised in warding against (.+?)\.$/,{user:1,target:2}),profession:["priest"],skill:"zeal",balance:"prayer",multiLine:0,tags:["aff"],affs:["paralysis"],length:1.6},{id:"light",fullName:"Light",firstPerson:!1,secondPerson:!1,thirdPerson:priest_wrapRegExp(/^"May the Light lead, and we never fail to follow!" cries out (\w+)\.$/,{user:1}),profession:["priest"],skill:"zeal",balance:"prayer",multiLine:0,tags:["heal","cure"],affs:[],length:3},{id:"inquisition",fullName:"Inquisition",firstPerson:!1,secondPerson:!1,thirdPerson:priest_wrapRegExp(/^Pointing at \w+ with a single raised finger, (\w+) recites a list of (.+?)'s transgressions, condemning \w+ actions and words\. A blaze of holy fire surges about \w+ as he dictates \w+'s sentence\.$/,{user:1,target:2}),profession:["priest"],skill:"devotion",balance:"equilibrium",multiLine:0,tags:["aff"],affs:["inquisition"],length:3.5}];function psion_typeof(obj){return psion_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},psion_typeof(obj)}function psion_wrapRegExp(){psion_wrapRegExp=function _wrapRegExp(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),psion_setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return psion_inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result){result.groups=buildGroups(result,this);var indices=result.indices;indices&&(indices.groups=buildGroups(indices,this))}return result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\$<([^>]+)>/g,(function(_,name){var group=groups[name];return"$"+(Array.isArray(group)?group.join("$"):group)})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=psion_typeof(args[args.length-1])&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},psion_wrapRegExp.apply(this,arguments)}function psion_inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&psion_setPrototypeOf(subClass,superClass)}function psion_setPrototypeOf(o,p){return psion_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},psion_setPrototypeOf(o,p)}var psion_actions=[{id:"overhand",fullName:"Overhand",firstPerson:!1,secondPerson:!1,thirdPerson:psion_wrapRegExp(/^(.+?) brings a translucent mace around in a savage overhand strike, smashing it into the head of (.+?)\.$/,{user:1,target:2}),profession:["psion"],skill:"weaving",balance:"balance",multiLine:1,tags:[],length:2.2},{id:"deathblow",fullName:"Deathblow",firstPerson:!1,secondPerson:!1,thirdPerson:psion_wrapRegExp(/^Almost too swift to perceive, (.+?) lashes out with a translucent dagger, tracing a bloody line across the throat of (.+?)\.$/,{user:1,target:2}),profession:["psion"],skill:"weaving",balance:"balance",multiLine:1,tags:["asthma","bleeding"],length:2.2}];function tattoos_typeof(obj){return tattoos_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},tattoos_typeof(obj)}function tattoos_wrapRegExp(){tattoos_wrapRegExp=function _wrapRegExp(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),tattoos_setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return tattoos_inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result){result.groups=buildGroups(result,this);var indices=result.indices;indices&&(indices.groups=buildGroups(indices,this))}return result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\$<([^>]+)>/g,(function(_,name){var group=groups[name];return"$"+(Array.isArray(group)?group.join("$"):group)})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=tattoos_typeof(args[args.length-1])&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},tattoos_wrapRegExp.apply(this,arguments)}function tattoos_inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&tattoos_setPrototypeOf(subClass,superClass)}function tattoos_setPrototypeOf(o,p){return tattoos_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},tattoos_setPrototypeOf(o,p)}var tattoos_actions=[{id:"shield",fullName:"Shield",firstPerson:/^You touch the tattoo and a nearly invisible magical shield forms around you\.$/,secondPerson:!1,thirdPerson:tattoos_wrapRegExp(/^A nearly invisible magical shield forms around (.+?)\.$/,{user:1}),profession:["general"],skill:"tattoos",balance:"equilibrium",multiLine:1,tags:[],length:4},{id:"tree",fullName:"Tree",firstPerson:!1,secondPerson:!1,thirdPerson:tattoos_wrapRegExp(/^(\w+) touches a tree of life tattoo\.$/,{user:1}),profession:["general"],skill:"tattoos",balance:"equilibrium",multiLine:1,tags:[],length:4}];function curing_typeof(obj){return curing_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},curing_typeof(obj)}function curing_wrapRegExp(){curing_wrapRegExp=function _wrapRegExp(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),curing_setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return curing_inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result){result.groups=buildGroups(result,this);var indices=result.indices;indices&&(indices.groups=buildGroups(indices,this))}return result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\$<([^>]+)>/g,(function(_,name){var group=groups[name];return"$"+(Array.isArray(group)?group.join("$"):group)})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=curing_typeof(args[args.length-1])&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},curing_wrapRegExp.apply(this,arguments)}function curing_inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&curing_setPrototypeOf(subClass,superClass)}function curing_setPrototypeOf(o,p){return curing_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},curing_setPrototypeOf(o,p)}var curing_actions=[{id:"eat",fullName:"Eat",firstPerson:!1,secondPerson:!1,thirdPerson:curing_wrapRegExp(/^(\w+) eats (.+)\.$/,{user:1,target:2}),profession:["general"],skill:"",balance:"herb",multiLine:0,tags:[],length:1.6},{id:"apply",fullName:"Apply",firstPerson:!1,secondPerson:!1,thirdPerson:curing_wrapRegExp(/^(\w+) takes some salve from a vial and rubs it on \w+ (.+)\.$/,{user:1,target:2}),profession:["general"],skill:"",balance:"salve",multiLine:0,tags:[],length:1},{id:"smoke",fullName:"Smoke",firstPerson:!1,secondPerson:!1,thirdPerson:curing_wrapRegExp(/^(\w+) takes a long drag off \w+ (.+)\.$/,{user:1,target:2}),profession:["general"],skill:"",balance:"smoke",multiLine:0,tags:[],length:1.6},{id:"sip",fullName:"Sip",firstPerson:!1,secondPerson:!1,thirdPerson:curing_wrapRegExp(/^(\w+) takes a drink from (?:a|an) (.+)\.$/,{user:1,target:2}),profession:["general"],skill:"",balance:"sip",multiLine:0,tags:[],length:1.6},{id:"focus",fullName:"Focus",firstPerson:!1,secondPerson:!1,thirdPerson:curing_wrapRegExp(/^A look of extreme focus crosses the face of (\w+)\.$/,{user:1}),profession:["general"],skill:"",balance:"focus",multiLine:0,tags:[],length:2.5}];function general_typeof(obj){return general_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},general_typeof(obj)}function general_wrapRegExp(){general_wrapRegExp=function _wrapRegExp(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),general_setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return general_inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result){result.groups=buildGroups(result,this);var indices=result.indices;indices&&(indices.groups=buildGroups(indices,this))}return result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\$<([^>]+)>/g,(function(_,name){var group=groups[name];return"$"+(Array.isArray(group)?group.join("$"):group)})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=general_typeof(args[args.length-1])&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},general_wrapRegExp.apply(this,arguments)}function general_inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&general_setPrototypeOf(subClass,superClass)}function general_setPrototypeOf(o,p){return general_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},general_setPrototypeOf(o,p)}var general_actions=[{id:"npcSlain",fullName:"SLAIN",firstPerson:general_wrapRegExp(/^You have slain (.+), retrieving the corpse\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["general"],skill:"slain",balance:"free",multiLine:0,tags:[],length:0}];function nur_typeof(obj){return nur_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},nur_typeof(obj)}function nur_wrapRegExp(){nur_wrapRegExp=function _wrapRegExp(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),nur_setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return nur_inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result){result.groups=buildGroups(result,this);var indices=result.indices;indices&&(indices.groups=buildGroups(indices,this))}return result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\$<([^>]+)>/g,(function(_,name){var group=groups[name];return"$"+(Array.isArray(group)?group.join("$"):group)})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=nur_typeof(args[args.length-1])&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},nur_wrapRegExp.apply(this,arguments)}function nur_inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&nur_setPrototypeOf(subClass,superClass)}function nur_setPrototypeOf(o,p){return nur_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},nur_setPrototypeOf(o,p)}var nur_npcs=[{user:"a translucent butterfly",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^A translucent butterfly beats his wings rapidly and his translucent body takes on a viridescent tinge. Discharging the vivid energy, he sends a toxic blast to impact with you\.$/,thirdPerson:!1,tags:["damage","loki"],length:2},{user:"a translucent butterfly",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^A translucent butterfly beats his wings rapidly and his translucent body takes on a bright violet tinge. Discharging the vivid energy, he sends a blast of power to impact with you\.$/,thirdPerson:!1,tags:["damage","transfix??? (fix this)"],length:4},{user:"a translucent butterfly",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^A translucent butterfly beats his wings rapidly and his translucent body turns ghostly white. Discharging the pale energy, he sends a blast of power to impact with you\.$/,thirdPerson:!1,tags:["damage","paralysis"],length:4},{user:"a translucent butterfly",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^A translucent butterfly beats his wings rapidly and his translucent body takes on a bright crimson tinge. Discharging the blazing energy, he sends a blast of power to impact with you\.$/,thirdPerson:!1,tags:["damage","burning"],length:4},{user:"a translucent butterfly",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^A translucent butterfly beats his wings rapidly and his translucent body takes on a dark amber tinge. Discharging the crackling energy, he sends a blast of power to impact with you\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"an elder angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^An elder angel flicks his fingers in your direction and you are consumed by pure agony\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"an elder angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^An elder angel sweeps his wings forward in a fiery wave, sending a cascade of fire to consume the area\.$/,thirdPerson:!1,tags:["damage","burning"],length:2},{user:"an angel spearbearer",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^In a trained motion, an angel spearbearer drives the pointy end of his spear into both of your shoulders with two well-placed jabs\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"an angel spearbearer",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^With force and precision, an angel spearbearer drives his spear into your torso, impaling you frightfully\.$/,thirdPerson:!1,tags:["damage","webbed"],length:2},{user:"an angel spearbearer",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^Flipping his spear around in a trained motion, an angel spearbearer hits you on the side of the head with the weapon's blunt end\.$/,thirdPerson:!1,tags:["damage","stun"],length:2},{user:"an angel spearbearer",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^Wielding his spear in one hand and lifting it above his head, an angel spearbearer chants ancient words before throwing the sizzling spear at you as coruscating energy crackles along the weapon's surface\.$/,thirdPerson:!1,tags:["damage","stun"],length:2},{user:"an angel spearbearer",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^Spinning his spear in one hand, an angel spearbearer ducks down low and jabs his spear between your legs before twisting it, causing you to fall to the ground\.$/,thirdPerson:!1,tags:["damage","prone","brokenleftleg"],length:2},{user:"an angel spearbearer",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^A look of sheer determination clear on his face, an angel spearbearer sweeps his spear in a wide arc with practiced control\.$/,thirdPerson:!1,tags:["damage","prone"],length:2},{user:"a vanguard angel",areaId:[401,400,398,397,396],areaName:"First Circle of Nur",firstPerson:/^The form of a vanguard angel shifts abruptly to an incorporeal mist which passes through your body, leaving abject terror and searing agony in his wake, before regaining physicality on the other side\.$/,thirdPerson:nur_wrapRegExp(/^The form of a vanguard angel shifts abruptly to an incorporeal mist which passes through (.+?)'s convulsing body before regaining physicality on the other side\.$/,{target:1}),tags:["damage","blackout","heal"],length:2},{user:"a vanguard angel",areaId:[401,400,398,397,396],areaName:"First Circle of Nur",firstPerson:/^A vanguard angel points his radiant sword directly at you, a bolt of pure energy bursting forth and slamming into your chest\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"a vanguard angel",areaId:[401,400,398,397,396],areaName:"First Circle of Nur",firstPerson:/^A vanguard angel whirls his fiery sword in a controlled arc that slices you from shoulder to sternum\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"a vanguard angel",areaId:[401,400,398,397,396],areaName:"First Circle of Nur",firstPerson:/^His luminous sword a blur of fiery strikes, a vanguard angel stabs you repeatedly, causing notable damage with each thrust\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"a vanguard angel",areaId:[401,400,398,397,396],areaName:"First Circle of Nur",firstPerson:/^With a snap, the angel's ethereal wings solidify into twin appendages of finely honed death\. He deploys them with a graceful pivot, mercilessly slicing all in their path\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"an expulsor angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^Gliding effortlessly through your defences, an expulsor angel smashes her buckler into your extremities with dreadful force\.$/,thirdPerson:!1,tags:["damage","brokenleftleg"],length:2},{user:"an expulsor angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^With a snap, an expulsor angel's wings solidify into a stone-like substance. She effortlessly sweeps them forward, slamming them unrelentingly into your vulnerable form\.$/,thirdPerson:!1,tags:["damage","stun"],length:2},{user:"an expulsor angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^An expulsor angel slams her buckler into your sternum with brutal force\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"an expulsor angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^A single beat of her wings carries an expulsor angel briefly aloft before she dives towards you in a silent blur, driving her javelin deep into the juncture of your neck and shoulder\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"an expulsor angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^Batting away your defences, an expulsor angel drives her javelin deep into your exposed body\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"an expulsor angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^An expulsor angel slams her buckler into your sternum with brutal force\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"an inquisitor angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^An inquisitor angel opens her mouth and speaks a single word. The sound of a multitude blasts forth, slamming relentlessly into you in a blast of power\.$/,thirdPerson:!1,tags:["damage","undeaf","confusion","dementia"],length:2},{user:"an inquisitor angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^An inquisitor angel tilts her head slightly to the side and immediately a multitude of bleeding wounds open up on your body\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"an inquisitor angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^An inquisitor angel raises her palm and sends a wave of energy to slam painfully into you\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"an inquisitor angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^Pivoting in a tight circle, an inquisitor angel transforms her wings into a fiery blaze that sweeps relentlessly through the room, engulfing you in flames\.$/,thirdPerson:!1,tags:["damage","burning"],length:2},{user:"a watcher angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^A watcher angel opens his mouth and speaks a single word. The sound of a multitude blasts forth, slamming relentlessly into you in a blast of power\.$/,thirdPerson:!1,tags:["damage","undeaf","confusion","dementia"],length:2},{user:"a watcher angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^A watcher angel walks calmly forward, his form turning into ethereal mist between one step and the next. You convulse helplessly in agony as the luminous gas enters your body in a haze of fiery retribution\.$/,thirdPerson:!1,tags:["damage","burning"],length:2},{user:"a watcher angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^A watcher angel turns his burning, sightless gaze in your direction, causing searing agony to erupt throughout your body\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"a watcher angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^Reaching forward, a watcher angel calmly lays his hands on you resulting in agonizing, burning pain\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"a muscular angelic razer",areaId:[398,400],areaName:"Fifth Circle of Nur",firstPerson:/^Taking a brisk step backwards, a muscular angelic razer glares piercingly at you with unseeing eyes, his movements filled with contempt\. Without warning, pain flares in your consciousness, radiating from your cranium to fill your body with rending agony\.$/,thirdPerson:!1,tags:["damage","stupidity"],length:2},{user:"a muscular angelic razer",areaId:[398,400],areaName:"Fifth Circle of Nur",firstPerson:/^Closing with you briskly, a muscular angelic razer punches out with his sheathed sword, winding you with a hefty blow to the stomach\. Stepping back unhurriedly, he pulls the sword from its scabbard and slashes at you twice in quick succession\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"a muscular angelic razer",areaId:[398,400],areaName:"Fifth Circle of Nur",firstPerson:/^A muscular angelic razer's wings flare powerfully, sending him colliding into you with his shoulder\. The impact tosses you to the ground like a rag doll, and you can do naught but watch as his hands move in a blur, liberating from its sheath a bastard sword, and guiding it through the air to slice painfully into your exposed form\.$/,thirdPerson:!1,tags:["damage","prone"],length:2},{user:"a lithe angelic razer",areaId:[398,400],areaName:"Fifth Circle of Nur",firstPerson:/^Taking a brisk step backwards, a lithe angelic razer glares piercingly at you with unseeing eyes, her movements filled with contempt\. Without warning, pain flares in your consciousness, radiating from your cranium to fill your body with rending agony\.$/,thirdPerson:!1,tags:["damage","stupidity"],length:2},{user:"a lithe angelic razer",areaId:[398,400],areaName:"Fifth Circle of Nur",firstPerson:/^A lithe angelic razer abruptly blurs into motion, leaping through the air and slicing into you with her longswords\. An instant later, her full weight crashes into you as she plants one foot on your chest and kicks off, before floating to the ground a few paces away\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"a lithe angelic razer",areaId:[398,400],areaName:"Fifth Circle of Nur",firstPerson:/^Advancing upon you swiftly, a lithe angelic razer swings her left-hand longsword in a powerful overarm arc, inflicting a withering strike that crushes your bones\.$/,thirdPerson:!1,tags:["damage","brokenleftarm"],length:2},{user:"a solemn angel",areaId:[397],areaName:"Sixth Circle of Nur",firstPerson:/^Looking down on you with primal ire, a solemn angel jerks her hand up, causing shafts of light to burst through the ground, impaling you in place\.$/,thirdPerson:!1,tags:["damage","impaled"],length:2},{user:"a solemn angel",areaId:[397],areaName:"Sixth Circle of Nur",firstPerson:/^Darting towards you with blinding speed, a solemn angel slashes her hand across your chest, leaving a ghastly glowing wound behind\.$/,thirdPerson:!1,tags:["damage","burning"],length:2},{user:"a solemn angel",areaId:[397],areaName:"Sixth Circle of Nur",firstPerson:/^Drawing her wings out to full length, a solemn angel swiftly claps them together, buffeting you with a massive gust of wind\.$/,thirdPerson:!1,tags:["damage","prone"],length:2}];function _toConsumableArray(arr){return function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}(arr)||function _iterableToArray(iter){if("undefined"!=typeof Symbol&&null!=iter[Symbol.iterator]||null!=iter["@@iterator"])return Array.from(iter)}(arr)||function _unsupportedIterableToArray(o,minLen){if(!o)return;if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);"Object"===n&&o.constructor&&(n=o.constructor.name);if("Map"===n||"Set"===n)return Array.from(o);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}(arr)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}var nexSkills_npcs=[].concat(_toConsumableArray([{user:"a heavily armoured warrior sylphid beetle",areaId:[343],areaName:"Battlesite of Mourning Pass",firstPerson:/^Rearing back on his hind legs, a heavily armoured warrior sylphid beetle lifts his head and spits a glob of saliva at your face\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"a heavily armoured warrior sylphid beetle",areaId:[343],areaName:"Battlesite of Mourning Pass",firstPerson:/^A heavily armoured warrior sylphid beetle snaps at you with his serrated pincers, tearing off chunks of bloody flesh\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"a queen sylphid beetle",areaId:[343],areaName:"Battlesite of Mourning Pass",firstPerson:/^Raising and extending the spines on her quiff, a queen sylphid beetle smacks them into your body, piercing your skin\.$/,thirdPerson:!1,tags:["damage","voyria"],length:2.5}]),_toConsumableArray([{user:"a Migri warrior",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^A Migri warrior's eyes narrow as he grasps his longsword with both hands and raises it over his head before bringing it down across your chest\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"a Migri warrior",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^In a skillful display of swordsmanship, a Migri warrior slashes diagonally across your body before striking you again with a jab through your belly\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"a Migri warrior",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^A Migri warrior bares his teeth and lunges at you with his longsword, the blade easily sliding into your body\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"a Migri warrior",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^A Migri warrior strikes you in the face with the hilt of his sword\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"an undead minion",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^An undead minion leaps forward and rips through your flesh with his teeth, leaving a gaping wound\.$/,thirdPerson:!1,tags:["damage"],length:2.7},{user:"an undead minion",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^Running between your legs, an undead minion strikes your knee with his tail, throwing you off balance\.$/,thirdPerson:!1,tags:["off-balance"],length:2.7},{user:"an undead minion",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^Rearing back and then leaping, an undead minion strikes your chest, causing you to fall to the ground\.$/,thirdPerson:!1,tags:["damage","prone"],length:2.7},{user:"Dakk, leader of the Migri",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^Dakk, leader of the Migri ducks his head and thrusts his blade towards you, jabbing it deep within your chest cavity and striking an artery. The blood pours from your body with each pump of your heart, covering the ground with blood\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"Dakk, leader of the Migri",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^Muttering an incantation, Dakk, leader of the Migri summons flames from his fingertips before balling them up and hurling the fireball towards you\.$/,thirdPerson:!1,tags:["damage","burning"],length:2},{user:"Dakk, leader of the Migri",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^Slashing his blade across your chest, Dakk, leader of the Migri cuts a piece of flesh from your body before striking you with the hilt of his sword, knocking you to the ground\.$/,thirdPerson:!1,tags:["damage","prone"],length:2},{user:"Begath, the Migri mage",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^Begath, the Migri mage snaps both of his fingers. Instantly, flames erupt from the floor and travel towards you, enveloping your body\.$/,thirdPerson:!1,tags:["damage","burning"],length:2.5},{user:"Begath, the Migri mage",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^Begath, the Migri mage reaches towards the ground with an outstretched hand. Pulling up, he forces several large rocks from the ground and then hurls them in your direction, pummeling you\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"Begath, the Migri mage",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^Begath, the Migri mage blows gently over his fingertips, causing them to turn blue and frost over before reaching towards you and sending several ice spikes in your direction\.$/,thirdPerson:!1,tags:["damage"],length:2.5}]),_toConsumableArray([{user:"an energetic turtle",areaId:[335],areaName:"Grukai Swamp",firstPerson:/^An energetic red turtle slams his body into your leg, shattering it in the process.\.$/,thirdPerson:!1,tags:["damage","brokenleftleg"],length:1.5},{user:"a sinister glubber",areaId:[335],areaName:"Grukai Swamp",firstPerson:/^A sinister glubber claws viciously at your arm, severing the joints\.$/,thirdPerson:!1,tags:["damage","brokenleftarm"],length:1.5},{user:"a sinister glubber",areaId:[335],areaName:"Grukai Swamp",firstPerson:/^A sinister glubber claws viciously at your leg, severing the joints\.$/,thirdPerson:!1,tags:["damage","brokenleftleg"],length:1.5},{user:"a sinister glubber",areaId:[335],areaName:"Grukai Swamp",firstPerson:/^A sinister glubber scrapes his nails across your eyes, leaving you unable to see\.$/,thirdPerson:!1,tags:["damage","blindness"],length:1.5},{user:"a sinister glubber",areaId:[335],areaName:"Grukai Swamp",firstPerson:/^Staring intensely at you, a sinister glubber causes his scales to fly off his body and into yours, painfully piercing the skin\.$/,thirdPerson:!1,tags:["damage","voyria"],length:1.5},{user:"a tentacled polyp",areaId:[335],areaName:"Grukai Swamp",firstPerson:/^Flinging his rope-like tentacles around, a tentacled polyp hits you firmly in the chest, leaving a number of noticeable lacerations\.$/,thirdPerson:!1,tags:["damage"],length:11},{user:"a tentacled polyp",areaId:[335],areaName:"Grukai Swamp",firstPerson:/^Waving his appendages before your face, a tentacled polyp leaves a number of deep lacerations and manages to leave you transfixed\.$/,thirdPerson:!1,tags:["damage"],length:11},{user:"a tentacled polyp",areaId:[335],areaName:"Grukai Swamp",firstPerson:/^A tentacled polyp quickly stabs you with his bizarre limbs, leaving a number of deep cuts\.$/,thirdPerson:!1,tags:["damage"],length:11},{user:"a tentacled polyp",areaId:[335],areaName:"Grukai Swamp",firstPerson:/^Wrapping his tentacles around your legs, a tentacled polyp causes you to come crashing to the floor, your legs entangled with his bizarre appendages\.$/,thirdPerson:!1,tags:["damage","prone","webbed"],length:11}]),_toConsumableArray([{user:"an austere Tsol'dasi",areaId:[263],areaName:"Istarion",firstPerson:/^An austere Tsol'dasi withdraws a long, slender blade from beneath the folds of her dress, slashing deeply into your flesh with the sharpened edge\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"an austere Tsol'dasi",areaId:[263],areaName:"Istarion",firstPerson:/^Clenching her fists in brooding anger, an austere Tsol'dasi runs towards you, slamming into your chest and knocking you backwards\.$/,thirdPerson:!1,tags:["damage","balance"],length:4},{user:"an austere Tsol'dasi",areaId:[263],areaName:"Istarion",firstPerson:/^Moving her agile body quickly behind you, an austere Tsol'dasi jabs her long blade swiftly into your side\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a Tsol'dasi villager",areaId:[263],areaName:"Istarion",firstPerson:/^A Tsol'dasi villager withdraws a long, slender blade from beneath the folds of her dress, slashing deeply into your flesh with the sharpened edge\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a Tsol'dasi villager",areaId:[263],areaName:"Istarion",firstPerson:/^Moving her agile body quickly behind you, a Tsol'dasi villager jabs her long blade swiftly into your side\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a Tsol'dasi villager",areaId:[263],areaName:"Istarion",firstPerson:/^Clenching her fists in brooding anger, a Tsol'dasi villager runs towards you, slamming into your chest and knocking you backwards\.$/,thirdPerson:!1,tags:["damage","balance"],length:4},{user:"a hooded Tsol'dasi villager",areaId:[263],areaName:"Istarion",firstPerson:/^Moving her agile body quickly behind you, a hooded Tsol'dasi villager jabs her long blade swiftly into your side\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a hooded Tsol'dasi villager",areaId:[263],areaName:"Istarion",firstPerson:/^Clenching her fists in brooding anger, a hooded Tsol'dasi villager runs towards you, slamming into your chest and knocking you backwards\.$/,thirdPerson:!1,tags:["damage","balance"],length:4},{user:"a hooded Tsol'dasi villager",areaId:[263],areaName:"Istarion",firstPerson:/^A hooded Tsol'dasi villager withdraws a long, slender blade from beneath the folds of her dress, slashing deeply into your flesh with the sharpened edge\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a watch spider outrider",areaId:[263],areaName:"Istarion",firstPerson:/^Swinging her staff in a wide vertical arc, a watch spider outrider brings it down hard upon your head\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a watch spider outrider",areaId:[263],areaName:"Istarion",firstPerson:/^A watch spider outrider sends the sphere end of her staff into one of your kneecaps, causing your bones to crack and pop unpleasantly\.$/,thirdPerson:!1,tags:["damage","brokenrightleg"],length:4},{user:"a watch spider outrider",areaId:[263],areaName:"Istarion",firstPerson:/^Pointing the spherical tip of the staff towards you, a watch spider outrider smiles before tapping it gently\. A torrent of fire erupts from its surface, setting you aflame with its incandescence\.$/,thirdPerson:!1,tags:["damage","burning"],length:4},{user:"a whisper spider outrider",areaId:[263],areaName:"Istarion",firstPerson:/^A whisper spider outrider swings a quick jab at your face, connecting on the jaw\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a whisper spider outrider",areaId:[263],areaName:"Istarion",firstPerson:/^A whisper spider outrider swings a quick jab at your face, connecting on the jaw\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a whisper spider outrider",areaId:[263],areaName:"Istarion",firstPerson:/^A whisper spider outrider sends one of his hands out to your throat\. A triumphant look crosses his face as he grips tightly on your windpipe\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a whisper spider outrider",areaId:[263],areaName:"Istarion",firstPerson:/^A whisper spider outrider moves close to you with speed, grabbing an arm while slamming into your body\. The force of the impact causes you to somersault onto the ground, dislocating your arm in the process\.$/,thirdPerson:!1,tags:["damage","prone","brokenleftarm"],length:4},{user:"a sword spider outrider",areaId:[263],areaName:"Istarion",firstPerson:/^His blades swimming through the air in a series of complex movements, a sword spider outrider slashes into you with incredible force\.$/,thirdPerson:!1,tags:["damage"],length:3},{user:"a sword spider outrider",areaId:[263],areaName:"Istarion",firstPerson:/^Feinting a jab, a sword spider outrider brings the hilt of his other sword towards you, stunning you with its forceful impact into your skull\.$/,thirdPerson:!1,tags:["damage","stun"],length:3},{user:"a sword spider outrider",areaId:[263],areaName:"Istarion",firstPerson:/^Finding both hands preoccupied, a sword spider outrider draws his head back, slamming it into your face\.$/,thirdPerson:!1,tags:["damage"],length:3},{user:"Eriador, the Tsol'dasi merchant",areaId:[263],areaName:"Istarion",firstPerson:/^Eriador, the Tsol'dasi merchant master throws his weight forward and forcefully rams his closed fist into your chest\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"Maal'ryn Asgarai, Outrider Ascendant",areaId:[263],areaName:"Istarion",firstPerson:/^With a great sweep of his mighty staff, Maal'ryn Asgarai, Outrider Ascendant summons a great geyser of brightly burning liquid fire behind him that arcs upwards into the air and rains down furiously upon you\.$/,thirdPerson:!1,tags:["damage","burning"],length:3},{user:"Maal'ryn Asgarai, Outrider Ascendant",areaId:[263],areaName:"Istarion",firstPerson:/^With a single word, Maal'ryn Asgarai, Outrider Ascendant causes the wounds gaping in your flesh to bleed and ebb freshly, draining you of life\.$/,thirdPerson:!1,tags:["damage","heal"],length:3}]),_toConsumableArray(nur_npcs),_toConsumableArray([{user:"a gigantic angler fish",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A gigantic angler fish rapidly lunges towards you, its razor-sharp teeth snapping shut on your arm\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"a gigantic angler fish",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A gigantic angler fish throws itself at you, clamping its sickening jaw tight around your throat\.$/,thirdPerson:!1,tags:["damage","blackout"],length:2},{user:"a gigantic angler fish",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A gigantic angler fish hurls itself at you in a vicious frontal attack, connecting painfully with your chest\.$/,thirdPerson:!1,tags:["damage","stun"],length:2},{user:"a burly troll guard",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A burly troll guard lowers his head and charges at you, slamming powerfully into your abdomen\.$/,thirdPerson:!1,tags:["damage","stun"],length:4},{user:"a burly troll guard",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A burly troll guard lowers his head and charges at you, slamming powerfully into your abdomen\.$/,thirdPerson:!1,tags:["damage","stun"],length:4},{user:"a burly troll guard",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A burly troll guard batters you with an overhead blow\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a burly troll guard",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A burly troll guard screams with rage and drives his spear deep into your chest\.$/,thirdPerson:!1,tags:["damage","balance"],length:4},{user:"a burly troll guard",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A look of absolute rage takes over a burly troll guard as he lunges at you, sinking his abnormally sharp teeth deep into your throat\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a sturdy troll woman",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A sturdy troll woman screams with rage and drives her spear deep into your chest\.$/,thirdPerson:!1,tags:["damage","balance"],length:4},{user:"a sturdy troll woman",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A look of absolute rage takes over a sturdy troll woman as she lunges at you, sinking her abnormally sharp teeth deep into your throat\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a sturdy troll woman",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A sturdy troll woman lowers her head and charges at you, slamming powerfully into your abdomen\.$/,thirdPerson:!1,tags:["damage","stun"],length:4},{user:"Rinaga",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^His trusty shovel held firmly in both hands, Rinaga batters you powerfully around the head with it\.$/,thirdPerson:!1,tags:["damage"],length:3},{user:"Rinaga",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^Rinaga swings a red-hot poker at you with considerable force, slamming it powerfully into the side of your head\.$/,thirdPerson:!1,tags:["damage"],length:3},{user:"Rinaga",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^Using his shovel with outstanding accuracy, Rinaga scoops a pile of burning coals from his fire and launches them at you\.$/,thirdPerson:!1,tags:["damage","burning"],length:3}]),_toConsumableArray([{user:"a House Feranki mage",areaId:[145],areaName:"Tir Murann",firstPerson:/^A House Feranki mage pulls out a small box the size of a human fist, shakes it, and throws it at you. On contact it explodes, burning you horribly\.$/,thirdPerson:!1,tags:["damage","burning"],length:2.5},{user:"a House Feranki mage",areaId:[145],areaName:"Tir Murann",firstPerson:/^A House Feranki mage causes some needles to levitate above his palm. With a gesture, they fly unerringly toward you, pricking your skin. You scream in pain as toxins sear through your body\.$/,thirdPerson:!1,tags:["damage","epilepsy"],length:2.5},{user:"a House Feranki mage",areaId:[145],areaName:"Tir Murann",firstPerson:/^A House Feranki mage throws a piece of rope at you. In mid-air, it expands into a mesh of netting that contracts around you\.$/,thirdPerson:!1,tags:["entagle"],length:2.5},{user:"a House Tsez air mage",areaId:[145],areaName:"Tir Murann",firstPerson:/^A House Tsez air mage clasps her hands in front her face, and in response you find yourself gasping for air, unable to breathe\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"a House Tsez air mage",areaId:[145],areaName:"Tir Murann",firstPerson:/^A House Tsez air mage gives a dismissive wave of her hand at you, and you feel a tremendous blast of biting wind that threatens to knock you down\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"a Vertani guard",areaId:[145],areaName:"Tir Murann",firstPerson:/^A Vertani guard sideswipes your ankle with the blunt end of his weapon, the force of the blow causing you to tumble to the ground\.$/,thirdPerson:!1,tags:["damage","prone"],length:2.5},{user:"a Vertani guard",areaId:[145],areaName:"Tir Murann",firstPerson:/^A Vertani guard vaults towards you with surprising speed, bringing the bladed side of his weapon bearing down on you\.$/,thirdPerson:!1,tags:["damage"],length:2.5,multiLine:1},{user:"a Vertani guard",areaId:[145],areaName:"Tir Murann",firstPerson:/^A Vertani guard jabs forward with a powerful blow, skewering through your ribs\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"a scimitar-wielding Vertani soldier",areaId:[145],areaName:"Tir Murann",firstPerson:/^You gnash your teeth as a scimitar-wielding Vertani soldier brings the butt of his scimitar down on your head, splitting your skull\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"a scimitar-wielding Vertani soldier",areaId:[145],areaName:"Tir Murann",firstPerson:/^Lunging at you, a scimitar-wielding Vertani soldier slams his gigantic head into yours. You are stunned from the blow\.$/,thirdPerson:!1,tags:["damage","stun"],length:2.5},{user:"a scimitar-wielding Vertani soldier",areaId:[145],areaName:"Tir Murann",firstPerson:/^You are nearly bisected as a scimitar-wielding Vertani soldier grunts and slashes into you with a huge scimitar\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"Dynas, the gour trainer",areaId:[145],areaName:"Tir Murann",firstPerson:/^Dynas, the gour trainer flicks his staff at your face, connecting square on the nose, which begins to gush blood\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"Dynas, the gour trainer",areaId:[145],areaName:"Tir Murann",firstPerson:/^Dynas, the gour trainer brings his staff crashing down onto your head\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"a drunken Vertani",areaId:[145],areaName:"Tir Murann",firstPerson:/^A drunken Vertani throws a wide haymaker punch at you, connecting against your jaw\.$/,thirdPerson:!1,tags:["damage"],length:3},{user:"a drunken Vertani",areaId:[145],areaName:"Tir Murann",firstPerson:/^A drunken Vertani unsheathes the dagger from his belt and slashes wildly into you with it\.$/,thirdPerson:!1,tags:["damage"],length:3},{user:"a drunken Vertani",areaId:[145],areaName:"Tir Murann",firstPerson:/^A drunken Vertani wraps his huge hands around your throat and throttles you violently\.$/,thirdPerson:!1,tags:["damage"],length:3},{user:"Ohmut, the Vertan craftswoman",areaId:[145],areaName:"Tir Murann",firstPerson:/^Ohmut, the Vertan craftswoman quickly scoops up a jagged rock from the ground before pelting you with it painfully\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"Ohmut, the Vertan craftswoman",areaId:[145],areaName:"Tir Murann",firstPerson:/^Ohmut, the Vertan craftswoman swings her pick horizontally, puncturing the side of your torso\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"Rohase, Captain of the Guard",areaId:[145],areaName:"Tir Murann",firstPerson:/^Rohase, Captain of the Guard jabs forward with a powerful blow, skewering through your ribs\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"Rohase, Captain of the Guard",areaId:[145],areaName:"Tir Murann",firstPerson:/^Rohase, Captain of the Guard vaults towards you with surprising speed, bringing the bladed side of her weapon bearing down on you\.$/,thirdPerson:!1,tags:["damage"],length:2,multiLine:1}]),_toConsumableArray([{user:"a Nelbennir scout",areaId:[207],areaName:"the Island of Tuar",firstPerson:/^Drawing one long, bony hand from beneath his grey robes a Nelbennir scout grabs at you, seizing your shoulder and sending stabbing pain through your entire body\.$/,thirdPerson:!1,tags:["damage"],length:0},{user:"a Nelbennir scout",areaId:[207],areaName:"the Island of Tuar",firstPerson:/^As a Nelbennir scout focuses intently upon you, his round, bulbous eyes cloud over darkly\.$/,thirdPerson:!1,tags:["damage"],length:0},{user:"a Nelbennir dart-thrower",areaId:[207],areaName:"the Island of Tuar",firstPerson:/^With a swift flick of his supple wrist, a Nelbennir dart-thrower lets fly a tiny, whistling dart towards you\.$/,thirdPerson:!1,tags:["damage","loki"],length:0},{user:"a Nelbennir dart-thrower",areaId:[207],areaName:"the Island of Tuar",firstPerson:/^A Nelbennir dart-thrower swiftly looses a handful of thin, narrow darts, sending their wickedly barbed heads deep into your soft flesh\.$/,thirdPerson:!1,tags:["damage"],length:0},{user:"a spotted pernicon",areaId:[207],areaName:"the Island of Tuar",firstPerson:/^A spotted pernicon rears up on its hind legs and snaps its body forwards, impaling you with its long, sickle-shaped mandibles\.$/,thirdPerson:!1,tags:["damage"],length:0}]),_toConsumableArray([{user:"a rajamala slaver",areaId:[337],areaName:"the fathomless expanse of the World Tree",firstPerson:/^Moving with astonishing speed, a rajamala slaver unleashes the power of his feline claws against your skin\.$/,thirdPerson:!1,tags:["damage","loki"],length:4},{user:"a rajamala slaver",areaId:[337],areaName:"the fathomless expanse of the World Tree",firstPerson:/^A rajamala slaver uses his massive bulk to slam your body to the ground\.$/,thirdPerson:!1,tags:["damage","brokenleftleg","brokenrightleg","prone"],length:4},{user:"a rajamala slaver",areaId:[337],areaName:"the fathomless expanse of the World Tree",firstPerson:/^A rajamala slaver leaps into the air and hurtles towards you\.$/,thirdPerson:!1,tags:["damage","brokenleftleg","brokenrightleg","prone"],length:4},{user:"a huge rat",areaId:[338],areaName:"the fathomless expanse of the World Tree",firstPerson:/^A huge rat snarls in fury as he bites down on your arm, sending a series of spasms racing through your body\.$/,thirdPerson:!1,tags:["damage","loki","loki"],length:4},{user:"a huge rat",areaId:[338],areaName:"the fathomless expanse of the World Tree",firstPerson:/^Hissing with rage, a huge rat swipes a claw across your knees\.$/,thirdPerson:!1,tags:["damage","loki"],length:4},{user:"a huge rat",areaId:[338],areaName:"the fathomless expanse of the World Tree",firstPerson:/^Snarling as he leaps at your legs, a huge rat rips and tears into your flesh, his mouth filling with blood and saliva\.$/,thirdPerson:!1,tags:["damage","loki","torntendons","clumsiness"],length:4}])),nexSkills_actions=[].concat(_toConsumableArray(dragon_actions),_toConsumableArray(actions),_toConsumableArray(occultist_actions),_toConsumableArray(pariah_actions),_toConsumableArray(priest_actions),_toConsumableArray(psion_actions),_toConsumableArray(tattoos_actions),_toConsumableArray(curing_actions),_toConsumableArray(general_actions)),checkNpcs=function checkNpcs(text){var result=!1,action=!1,areaNpcs=nexSkills_npcs.filter((function(e){return e.areaId.includes(GMCP.Location.areaid)}));if(0===areaNpcs.length)return!1;for(var i=0;i<areaNpcs.length;i++){if(action=areaNpcs[i],result=text.match(action.firstPerson)){var _result$groups;action.target="self",null!==(_result$groups=result.groups)&&void 0!==_result$groups&&_result$groups.user&&(action.user=result.groups.user);break}if(result=text.match(action.thirdPerson)){action.target=result.groups.target;break}}return result&&(action.args=result,eventStream.raiseEvent("nexSkillNpcMatch",action)),result||!1},nexSkills={actions:nexSkills_actions,npcs:nexSkills_npcs,checkSkills:function checkSkills(text){for(var result=!1,action=!1,i=0;i<nexSkills_actions.length;i++){if(((action=nexSkills_actions[i]).profession.includes(GMCP.Char.Status.class.toLowerCase())||action.profession.includes("general"))&&(result=text.match(action.firstPerson))){action.user="self",action.target=result.groups.target;break}if(result=text.match(action.secondPerson)){action.user=result.groups.user,action.target="self";break}if(result=text.match(action.thirdPerson)){action.user=result.groups.user,action.target=result.groups.target;break}}return result&&(action.args=result,action.reaction&&action.reaction(),eventStream.raiseEvent("nexSkillMatch",action)),result?action:checkNpcs(text)},checkNpcs:checkNpcs,startUp:startUp};globalThis.nexSkills=nexSkills}();
2
+ !function(){"use strict";var __webpack_require__={};__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();for(var byteLength_1=function byteLength(b64){var lens=getLens(b64),validLen=lens[0],placeHoldersLen=lens[1];return 3*(validLen+placeHoldersLen)/4-placeHoldersLen},toByteArray_1=function toByteArray(b64){var tmp,i,lens=getLens(b64),validLen=lens[0],placeHoldersLen=lens[1],arr=new Arr(function _byteLength(b64,validLen,placeHoldersLen){return 3*(validLen+placeHoldersLen)/4-placeHoldersLen}(0,validLen,placeHoldersLen)),curByte=0,len=placeHoldersLen>0?validLen-4:validLen;for(i=0;i<len;i+=4)tmp=revLookup[b64.charCodeAt(i)]<<18|revLookup[b64.charCodeAt(i+1)]<<12|revLookup[b64.charCodeAt(i+2)]<<6|revLookup[b64.charCodeAt(i+3)],arr[curByte++]=tmp>>16&255,arr[curByte++]=tmp>>8&255,arr[curByte++]=255&tmp;2===placeHoldersLen&&(tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4,arr[curByte++]=255&tmp);1===placeHoldersLen&&(tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2,arr[curByte++]=tmp>>8&255,arr[curByte++]=255&tmp);return arr},fromByteArray_1=function fromByteArray(uint8){for(var tmp,len=uint8.length,extraBytes=len%3,parts=[],i=0,len2=len-extraBytes;i<len2;i+=16383)parts.push(encodeChunk(uint8,i,i+16383>len2?len2:i+16383));1===extraBytes?(tmp=uint8[len-1],parts.push(lookup[tmp>>2]+lookup[tmp<<4&63]+"==")):2===extraBytes&&(tmp=(uint8[len-2]<<8)+uint8[len-1],parts.push(lookup[tmp>>10]+lookup[tmp>>4&63]+lookup[tmp<<2&63]+"="));return parts.join("")},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;function getLens(b64){var len=b64.length;if(len%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var validLen=b64.indexOf("=");return-1===validLen&&(validLen=len),[validLen,validLen===len?0:4-validLen%4]}function encodeChunk(uint8,start,end){for(var tmp,num,output=[],i=start;i<end;i+=3)tmp=(uint8[i]<<16&16711680)+(uint8[i+1]<<8&65280)+(255&uint8[i+2]),output.push(lookup[(num=tmp)>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[63&num]);return output.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63;var base64Js={byteLength:byteLength_1,toByteArray:toByteArray_1,fromByteArray:fromByteArray_1},ieee754_read=function read(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:1/0*(s?-1:1);m+=Math.pow(2,mLen),e-=eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)},ieee754_write=function write(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))*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},buffer$1=function createCommonjsModule(fn,module){return fn(module={exports:{}},module.exports),module.exports}((function(module,exports){var customInspectSymbol="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;exports.Buffer=Buffer,exports.SlowBuffer=function SlowBuffer(length){+length!=length&&(length=0);return Buffer.alloc(+length)},exports.INSPECT_MAX_BYTES=50;function createBuffer(length){if(length>2147483647)throw new RangeError('The value "'+length+'" is invalid for option "size"');var buf=new Uint8Array(length);return Object.setPrototypeOf(buf,Buffer.prototype),buf}function Buffer(arg,encodingOrOffset,length){if("number"==typeof arg){if("string"==typeof encodingOrOffset)throw new TypeError('The "string" argument must be of type string. Received type number');return allocUnsafe(arg)}return from(arg,encodingOrOffset,length)}function from(value,encodingOrOffset,length){if("string"==typeof value)return function fromString(string,encoding){"string"==typeof encoding&&""!==encoding||(encoding="utf8");if(!Buffer.isEncoding(encoding))throw new TypeError("Unknown encoding: "+encoding);var length=0|byteLength(string,encoding),buf=createBuffer(length),actual=buf.write(string,encoding);actual!==length&&(buf=buf.slice(0,actual));return buf}(value,encodingOrOffset);if(ArrayBuffer.isView(value))return function fromArrayView(arrayView){if(isInstance(arrayView,Uint8Array)){var copy=new Uint8Array(arrayView);return fromArrayBuffer(copy.buffer,copy.byteOffset,copy.byteLength)}return fromArrayLike(arrayView)}(value);if(null==value)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(value));if(isInstance(value,ArrayBuffer)||value&&isInstance(value.buffer,ArrayBuffer))return fromArrayBuffer(value,encodingOrOffset,length);if("undefined"!=typeof SharedArrayBuffer&&(isInstance(value,SharedArrayBuffer)||value&&isInstance(value.buffer,SharedArrayBuffer)))return fromArrayBuffer(value,encodingOrOffset,length);if("number"==typeof value)throw new TypeError('The "value" argument must not be of type number. Received type number');var valueOf=value.valueOf&&value.valueOf();if(null!=valueOf&&valueOf!==value)return Buffer.from(valueOf,encodingOrOffset,length);var b=function fromObject(obj){if(Buffer.isBuffer(obj)){var len=0|checked(obj.length),buf=createBuffer(len);return 0===buf.length||obj.copy(buf,0,0,len),buf}if(void 0!==obj.length)return"number"!=typeof obj.length||numberIsNaN(obj.length)?createBuffer(0):fromArrayLike(obj);if("Buffer"===obj.type&&Array.isArray(obj.data))return fromArrayLike(obj.data)}(value);if(b)return b;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof value[Symbol.toPrimitive])return Buffer.from(value[Symbol.toPrimitive]("string"),encodingOrOffset,length);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(value))}function assertSize(size){if("number"!=typeof size)throw new TypeError('"size" argument must be of type number');if(size<0)throw new RangeError('The value "'+size+'" is invalid for option "size"')}function allocUnsafe(size){return assertSize(size),createBuffer(size<0?0:0|checked(size))}function fromArrayLike(array){for(var length=array.length<0?0:0|checked(array.length),buf=createBuffer(length),i=0;i<length;i+=1)buf[i]=255&array[i];return buf}function fromArrayBuffer(array,byteOffset,length){if(byteOffset<0||array.byteLength<byteOffset)throw new RangeError('"offset" is outside of buffer bounds');if(array.byteLength<byteOffset+(length||0))throw new RangeError('"length" is outside of buffer bounds');var buf;return buf=void 0===byteOffset&&void 0===length?new Uint8Array(array):void 0===length?new Uint8Array(array,byteOffset):new Uint8Array(array,byteOffset,length),Object.setPrototypeOf(buf,Buffer.prototype),buf}function checked(length){if(length>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|length}function byteLength(string,encoding){if(Buffer.isBuffer(string))return string.length;if(ArrayBuffer.isView(string)||isInstance(string,ArrayBuffer))return string.byteLength;if("string"!=typeof string)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(string));var len=string.length,mustMatch=arguments.length>2&&!0===arguments[2];if(!mustMatch&&0===len)return 0;for(var loweredCase=!1;;)switch(encoding){case"ascii":case"latin1":case"binary":return len;case"utf8":case"utf-8":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 mustMatch?-1: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))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),numberIsNaN(byteOffset=+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,"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){var i,indexSize=1,arrLength=arr.length,valLength=val.length;if(void 0!==encoding&&("ucs2"===(encoding=String(encoding).toLowerCase())||"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}function read(buf,i){return 1===indexSize?buf[i]:buf.readUInt16BE(i*indexSize)}if(dir){var foundIndex=-1;for(i=byteOffset;i<arrLength;i++)if(read(arr,i)===read(val,-1===foundIndex?0:i-foundIndex)){if(-1===foundIndex&&(foundIndex=i),i-foundIndex+1===valLength)return foundIndex*indexSize}else-1!==foundIndex&&(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))>remaining&&(length=remaining):length=remaining;var strLen=string.length;length>strLen/2&&(length=strLen/2);for(var i=0;i<length;++i){var parsed=parseInt(string.substr(2*i,2),16);if(numberIsNaN(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(function asciiToBytes(str){for(var byteArray=[],i=0;i<str.length;++i)byteArray.push(255&str.charCodeAt(i));return byteArray}(string),buf,offset,length)}function base64Write(buf,string,offset,length){return blitBuffer(base64ToBytes(string),buf,offset,length)}function ucs2Write(buf,string,offset,length){return blitBuffer(function utf16leToBytes(str,units){for(var c,hi,lo,byteArray=[],i=0;i<str.length&&!((units-=2)<0);++i)hi=(c=str.charCodeAt(i))>>8,lo=c%256,byteArray.push(lo),byteArray.push(hi);return byteArray}(string,buf.length-offset),buf,offset,length)}function base64Slice(buf,start,end){return 0===start&&end===buf.length?base64Js.fromByteArray(buf):base64Js.fromByteArray(buf.slice(start,end))}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);for(var res=[],i=start;i<end;){var secondByte,thirdByte,fourthByte,tempCodePoint,firstByte=buf[i],codePoint=null,bytesPerSequence=firstByte>239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end)switch(bytesPerSequence){case 1:firstByte<128&&(codePoint=firstByte);break;case 2:128==(192&(secondByte=buf[i+1]))&&(tempCodePoint=(31&firstByte)<<6|63&secondByte)>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)>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)>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 function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=4096)return String.fromCharCode.apply(String,codePoints);var res="",i=0;for(;i<len;)res+=String.fromCharCode.apply(String,codePoints.slice(i,i+=4096));return res}(res)}exports.kMaxLength=2147483647,Buffer.TYPED_ARRAY_SUPPORT=function typedArraySupport(){try{var arr=new Uint8Array(1),proto={foo:function foo(){return 42}};return Object.setPrototypeOf(proto,Uint8Array.prototype),Object.setPrototypeOf(arr,proto),42===arr.foo()}catch(e){return!1}}(),Buffer.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(Buffer.prototype,"parent",{enumerable:!0,get:function get(){if(Buffer.isBuffer(this))return this.buffer}}),Object.defineProperty(Buffer.prototype,"offset",{enumerable:!0,get:function get(){if(Buffer.isBuffer(this))return this.byteOffset}}),Buffer.poolSize=8192,Buffer.from=function(value,encodingOrOffset,length){return from(value,encodingOrOffset,length)},Object.setPrototypeOf(Buffer.prototype,Uint8Array.prototype),Object.setPrototypeOf(Buffer,Uint8Array),Buffer.alloc=function(size,fill,encoding){return function alloc(size,fill,encoding){return assertSize(size),size<=0?createBuffer(size):void 0!==fill?"string"==typeof encoding?createBuffer(size).fill(fill,encoding):createBuffer(size).fill(fill):createBuffer(size)}(size,fill,encoding)},Buffer.allocUnsafe=function(size){return allocUnsafe(size)},Buffer.allocUnsafeSlow=function(size){return allocUnsafe(size)},Buffer.isBuffer=function isBuffer(b){return null!=b&&!0===b._isBuffer&&b!==Buffer.prototype},Buffer.compare=function compare(a,b){if(isInstance(a,Uint8Array)&&(a=Buffer.from(a,a.offset,a.byteLength)),isInstance(b,Uint8Array)&&(b=Buffer.from(b,b.offset,b.byteLength)),!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');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 isEncoding(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 concat(list,length){if(!Array.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(isInstance(buf,Uint8Array))pos+buf.length>buffer.length?Buffer.from(buf).copy(buffer,pos):Uint8Array.prototype.set.call(buffer,buf,pos);else{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 swap16(){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 swap32(){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 swap64(){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 toString(){var length=this.length;return 0===length?"":0===arguments.length?utf8Slice(this,0,length):slowToString.apply(this,arguments)},Buffer.prototype.toLocaleString=Buffer.prototype.toString,Buffer.prototype.equals=function equals(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 inspect(){var str="",max=exports.INSPECT_MAX_BYTES;return str=this.toString("hex",0,max).replace(/(.{2})/g,"$1 ").trim(),this.length>max&&(str+=" ... "),"<Buffer "+str+">"},customInspectSymbol&&(Buffer.prototype[customInspectSymbol]=Buffer.prototype.inspect),Buffer.prototype.compare=function compare(target,start,end,thisStart,thisEnd){if(isInstance(target,Uint8Array)&&(target=Buffer.from(target,target.offset,target.byteLength)),!Buffer.isBuffer(target))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(target));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(this===target)return 0;for(var x=(thisEnd>>>=0)-(thisStart>>>=0),y=(end>>>=0)-(start>>>=0),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 includes(val,byteOffset,encoding){return-1!==this.indexOf(val,byteOffset,encoding)},Buffer.prototype.indexOf=function indexOf(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,!0)},Buffer.prototype.lastIndexOf=function lastIndexOf(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,!1)},Buffer.prototype.write=function write(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":case"latin1":case"binary":return asciiWrite(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 toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};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+=hexSliceLookupTable[buf[i]];return out}function utf16leSlice(buf,start,end){for(var bytes=buf.slice(start,end),res="",i=0;i<bytes.length-1;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 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 value=+value,offset>>>=0,noAssert||checkIEEE754(buf,0,offset,4),ieee754_write(buf,value,offset,littleEndian,23,4),offset+4}function writeDouble(buf,value,offset,littleEndian,noAssert){return value=+value,offset>>>=0,noAssert||checkIEEE754(buf,0,offset,8),ieee754_write(buf,value,offset,littleEndian,52,8),offset+8}Buffer.prototype.slice=function slice(start,end){var len=this.length;(start=~~start)<0?(start+=len)<0&&(start=0):start>len&&(start=len),(end=void 0===end?len:~~end)<0?(end+=len)<0&&(end=0):end>len&&(end=len),end<start&&(end=start);var newBuf=this.subarray(start,end);return Object.setPrototypeOf(newBuf,Buffer.prototype),newBuf},Buffer.prototype.readUintLE=Buffer.prototype.readUIntLE=function readUIntLE(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=Buffer.prototype.readUIntBE=function readUIntBE(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=Buffer.prototype.readUInt8=function readUInt8(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,1,this.length),this[offset]},Buffer.prototype.readUint16LE=Buffer.prototype.readUInt16LE=function readUInt16LE(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,2,this.length),this[offset]|this[offset+1]<<8},Buffer.prototype.readUint16BE=Buffer.prototype.readUInt16BE=function readUInt16BE(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,2,this.length),this[offset]<<8|this[offset+1]},Buffer.prototype.readUint32LE=Buffer.prototype.readUInt32LE=function readUInt32LE(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+16777216*this[offset+3]},Buffer.prototype.readUint32BE=Buffer.prototype.readUInt32BE=function readUInt32BE(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),16777216*this[offset]+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])},Buffer.prototype.readIntLE=function readIntLE(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>=(mul*=128)&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readIntBE=function readIntBE(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 val>=(mul*=128)&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readInt8=function readInt8(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,1,this.length),128&this[offset]?-1*(255-this[offset]+1):this[offset]},Buffer.prototype.readInt16LE=function readInt16LE(offset,noAssert){offset>>>=0,noAssert||checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt16BE=function readInt16BE(offset,noAssert){offset>>>=0,noAssert||checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt32LE=function readInt32LE(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24},Buffer.prototype.readInt32BE=function readInt32BE(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]},Buffer.prototype.readFloatLE=function readFloatLE(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),ieee754_read(this,offset,!0,23,4)},Buffer.prototype.readFloatBE=function readFloatBE(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),ieee754_read(this,offset,!1,23,4)},Buffer.prototype.readDoubleLE=function readDoubleLE(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,8,this.length),ieee754_read(this,offset,!0,52,8)},Buffer.prototype.readDoubleBE=function readDoubleBE(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,8,this.length),ieee754_read(this,offset,!1,52,8)},Buffer.prototype.writeUintLE=Buffer.prototype.writeUIntLE=function writeUIntLE(value,offset,byteLength,noAssert){(value=+value,offset>>>=0,byteLength>>>=0,noAssert)||checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength)-1,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=Buffer.prototype.writeUIntBE=function writeUIntBE(value,offset,byteLength,noAssert){(value=+value,offset>>>=0,byteLength>>>=0,noAssert)||checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength)-1,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=Buffer.prototype.writeUInt8=function writeUInt8(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,1,255,0),this[offset]=255&value,offset+1},Buffer.prototype.writeUint16LE=Buffer.prototype.writeUInt16LE=function writeUInt16LE(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,2,65535,0),this[offset]=255&value,this[offset+1]=value>>>8,offset+2},Buffer.prototype.writeUint16BE=Buffer.prototype.writeUInt16BE=function writeUInt16BE(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,2,65535,0),this[offset]=value>>>8,this[offset+1]=255&value,offset+2},Buffer.prototype.writeUint32LE=Buffer.prototype.writeUInt32LE=function writeUInt32LE(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,4,4294967295,0),this[offset+3]=value>>>24,this[offset+2]=value>>>16,this[offset+1]=value>>>8,this[offset]=255&value,offset+4},Buffer.prototype.writeUint32BE=Buffer.prototype.writeUInt32BE=function writeUInt32BE(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,4,4294967295,0),this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value,offset+4},Buffer.prototype.writeIntLE=function writeIntLE(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 writeIntBE(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 writeInt8(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,1,127,-128),value<0&&(value=255+value+1),this[offset]=255&value,offset+1},Buffer.prototype.writeInt16LE=function writeInt16LE(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,2,32767,-32768),this[offset]=255&value,this[offset+1]=value>>>8,offset+2},Buffer.prototype.writeInt16BE=function writeInt16BE(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,2,32767,-32768),this[offset]=value>>>8,this[offset+1]=255&value,offset+2},Buffer.prototype.writeInt32LE=function writeInt32LE(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),this[offset]=255&value,this[offset+1]=value>>>8,this[offset+2]=value>>>16,this[offset+3]=value>>>24,offset+4},Buffer.prototype.writeInt32BE=function writeInt32BE(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),value<0&&(value=4294967295+value+1),this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value,offset+4},Buffer.prototype.writeFloatLE=function writeFloatLE(value,offset,noAssert){return writeFloat(this,value,offset,!0,noAssert)},Buffer.prototype.writeFloatBE=function writeFloatBE(value,offset,noAssert){return writeFloat(this,value,offset,!1,noAssert)},Buffer.prototype.writeDoubleLE=function writeDoubleLE(value,offset,noAssert){return writeDouble(this,value,offset,!0,noAssert)},Buffer.prototype.writeDoubleBE=function writeDoubleBE(value,offset,noAssert){return writeDouble(this,value,offset,!1,noAssert)},Buffer.prototype.copy=function copy(target,targetStart,start,end){if(!Buffer.isBuffer(target))throw new TypeError("argument should be a Buffer");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("Index out of range");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 len=end-start;return this===target&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(targetStart,start,end):Uint8Array.prototype.set.call(target,this.subarray(start,end),targetStart),len},Buffer.prototype.fill=function fill(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),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);if(1===val.length){var code=val.charCodeAt(0);("utf8"===encoding&&code<128||"latin1"===encoding)&&(val=code)}}else"number"==typeof val?val&=255:"boolean"==typeof val&&(val=Number(val));if(start<0||this.length<start||this.length<end)throw new RangeError("Out of range index");if(end<=start)return this;var i;if(start>>>=0,end=void 0===end?this.length:end>>>0,val||(val=0),"number"==typeof val)for(i=start;i<end;++i)this[i]=val;else{var bytes=Buffer.isBuffer(val)?val:Buffer.from(val,encoding),len=bytes.length;if(0===len)throw new TypeError('The value "'+val+'" is invalid for argument "value"');for(i=0;i<end-start;++i)this[i+start]=bytes[i%len]}return this};var INVALID_BASE64_RE=/[^+/0-9A-Za-z-_]/g;function utf8ToBytes(string,units){var codePoint;units=units||1/0;for(var length=string.length,leadSurrogate=null,bytes=[],i=0;i<length;++i){if((codePoint=string.charCodeAt(i))>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=65536+(leadSurrogate-55296<<10|codePoint-56320)}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 base64ToBytes(str){return base64Js.toByteArray(function base64clean(str){if((str=(str=str.split("=")[0]).trim().replace(INVALID_BASE64_RE,"")).length<2)return"";for(;str.length%4!=0;)str+="=";return str}(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 isInstance(obj,type){return obj instanceof type||null!=obj&&null!=obj.constructor&&null!=obj.constructor.name&&obj.constructor.name===type.name}function numberIsNaN(obj){return obj!=obj}var hexSliceLookupTable=function(){for(var table=new Array(256),i=0;i<16;++i)for(var i16=16*i,j=0;j<16;++j)table[i16+j]="0123456789abcdef"[i]+"0123456789abcdef"[j];return table}()})),buffer_1=buffer$1.Buffer;buffer$1.SlowBuffer,buffer$1.INSPECT_MAX_BYTES,buffer$1.kMaxLength;var _extendStatics=function extendStatics(d,b){return _extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},_extendStatics(d,b)};function __extends(d,b){function __(){this.constructor=d}_extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var BSONError=function(_super){function BSONError(message){var _this=_super.call(this,message)||this;return Object.setPrototypeOf(_this,BSONError.prototype),_this}return __extends(BSONError,_super),Object.defineProperty(BSONError.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),BSONError}(Error),BSONTypeError=function(_super){function BSONTypeError(message){var _this=_super.call(this,message)||this;return Object.setPrototypeOf(_this,BSONTypeError.prototype),_this}return __extends(BSONTypeError,_super),Object.defineProperty(BSONTypeError.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),BSONTypeError}(TypeError);function checkForMath(potentialGlobal){return potentialGlobal&&potentialGlobal.Math==Math&&potentialGlobal}function getGlobal(){return checkForMath("object"==typeof globalThis&&globalThis)||checkForMath("object"==typeof window&&window)||checkForMath("object"==typeof self&&self)||checkForMath("object"==typeof __webpack_require__.g&&__webpack_require__.g)||Function("return this")()}var insecureRandomBytes=function insecureRandomBytes(size){var insecureWarning=function isReactNative(){var g=getGlobal();return"object"==typeof g.navigator&&"ReactNative"===g.navigator.product}()?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(insecureWarning);for(var result=buffer_1.alloc(size),i=0;i<size;++i)result[i]=Math.floor(256*Math.random());return result},randomBytes=function(){if("undefined"!=typeof window){var target_1=window.crypto||window.msCrypto;if(target_1&&target_1.getRandomValues)return function(size){return target_1.getRandomValues(buffer_1.alloc(size))}}return void 0!==__webpack_require__.g&&__webpack_require__.g.crypto&&__webpack_require__.g.crypto.getRandomValues?function(size){return __webpack_require__.g.crypto.getRandomValues(buffer_1.alloc(size))}:insecureRandomBytes}();function isAnyArrayBuffer(value){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(value))}function isUint8Array(value){return"[object Uint8Array]"===Object.prototype.toString.call(value)}function isRegExp(d){return"[object RegExp]"===Object.prototype.toString.call(d)}function isDate(d){return isObjectLike(d)&&"[object Date]"===Object.prototype.toString.call(d)}function isObjectLike(candidate){return"object"==typeof candidate&&null!==candidate}function deprecate(fn,message){var warned=!1;return function deprecated(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];return warned||(console.warn(message),warned=!0),fn.apply(this,args)}}function ensureBuffer(potentialBuffer){if(ArrayBuffer.isView(potentialBuffer))return buffer_1.from(potentialBuffer.buffer,potentialBuffer.byteOffset,potentialBuffer.byteLength);if(isAnyArrayBuffer(potentialBuffer))return buffer_1.from(potentialBuffer);throw new BSONTypeError("Must use either Buffer or TypedArray")}var VALIDATION_REGEX=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i,uuidValidateString=function(str){return"string"==typeof str&&VALIDATION_REGEX.test(str)},uuidHexStringToBuffer=function(hexString){if(!uuidValidateString(hexString))throw new BSONTypeError('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var sanitizedHexString=hexString.replace(/-/g,"");return buffer_1.from(sanitizedHexString,"hex")},bufferToUuidHexString=function(buffer,includeDashes){return void 0===includeDashes&&(includeDashes=!0),includeDashes?buffer.toString("hex",0,4)+"-"+buffer.toString("hex",4,6)+"-"+buffer.toString("hex",6,8)+"-"+buffer.toString("hex",8,10)+"-"+buffer.toString("hex",10,16):buffer.toString("hex")},JS_INT_MAX=(Math.pow(2,63),Math.pow(2,63),Math.pow(2,53)),JS_INT_MIN=-Math.pow(2,53),Binary=function(){function Binary(buffer,subType){if(!(this instanceof Binary))return new Binary(buffer,subType);if(!(null==buffer||"string"==typeof buffer||ArrayBuffer.isView(buffer)||buffer instanceof ArrayBuffer||Array.isArray(buffer)))throw new BSONTypeError("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=null!=subType?subType:Binary.BSON_BINARY_SUBTYPE_DEFAULT,null==buffer?(this.buffer=buffer_1.alloc(Binary.BUFFER_SIZE),this.position=0):("string"==typeof buffer?this.buffer=buffer_1.from(buffer,"binary"):Array.isArray(buffer)?this.buffer=buffer_1.from(buffer):this.buffer=ensureBuffer(buffer),this.position=this.buffer.byteLength)}return Binary.prototype.put=function(byteValue){if("string"==typeof byteValue&&1!==byteValue.length)throw new BSONTypeError("only accepts single character String");if("number"!=typeof byteValue&&1!==byteValue.length)throw new BSONTypeError("only accepts single character Uint8Array or Array");var decodedByte;if((decodedByte="string"==typeof byteValue?byteValue.charCodeAt(0):"number"==typeof byteValue?byteValue:byteValue[0])<0||decodedByte>255)throw new BSONTypeError("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=decodedByte;else{var buffer=buffer_1.alloc(Binary.BUFFER_SIZE+this.buffer.length);this.buffer.copy(buffer,0,0,this.buffer.length),this.buffer=buffer,this.buffer[this.position++]=decodedByte}},Binary.prototype.write=function(sequence,offset){if(offset="number"==typeof offset?offset:this.position,this.buffer.length<offset+sequence.length){var buffer=buffer_1.alloc(this.buffer.length+sequence.length);this.buffer.copy(buffer,0,0,this.buffer.length),this.buffer=buffer}ArrayBuffer.isView(sequence)?(this.buffer.set(ensureBuffer(sequence),offset),this.position=offset+sequence.byteLength>this.position?offset+sequence.length:this.position):"string"==typeof sequence&&(this.buffer.write(sequence,offset,sequence.length,"binary"),this.position=offset+sequence.length>this.position?offset+sequence.length:this.position)},Binary.prototype.read=function(position,length){return length=length&&length>0?length:this.position,this.buffer.slice(position,position+length)},Binary.prototype.value=function(asRaw){return(asRaw=!!asRaw)&&this.buffer.length===this.position?this.buffer:asRaw?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},Binary.prototype.length=function(){return this.position},Binary.prototype.toJSON=function(){return this.buffer.toString("base64")},Binary.prototype.toString=function(format){return this.buffer.toString(format)},Binary.prototype.toExtendedJSON=function(options){options=options||{};var base64String=this.buffer.toString("base64"),subType=Number(this.sub_type).toString(16);return options.legacy?{$binary:base64String,$type:1===subType.length?"0"+subType:subType}:{$binary:{base64:base64String,subType:1===subType.length?"0"+subType:subType}}},Binary.prototype.toUUID=function(){if(this.sub_type===Binary.SUBTYPE_UUID)return new UUID(this.buffer.slice(0,this.position));throw new BSONError('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(Binary.SUBTYPE_UUID,'" is currently supported.'))},Binary.fromExtendedJSON=function(doc,options){var data,type;if(options=options||{},"$binary"in doc?options.legacy&&"string"==typeof doc.$binary&&"$type"in doc?(type=doc.$type?parseInt(doc.$type,16):0,data=buffer_1.from(doc.$binary,"base64")):"string"!=typeof doc.$binary&&(type=doc.$binary.subType?parseInt(doc.$binary.subType,16):0,data=buffer_1.from(doc.$binary.base64,"base64")):"$uuid"in doc&&(type=4,data=uuidHexStringToBuffer(doc.$uuid)),!data)throw new BSONTypeError("Unexpected Binary Extended JSON format ".concat(JSON.stringify(doc)));return 4===type?new UUID(data):new Binary(data,type)},Binary.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},Binary.prototype.inspect=function(){var asBuffer=this.value(!0);return'new Binary(Buffer.from("'.concat(asBuffer.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},Binary.BSON_BINARY_SUBTYPE_DEFAULT=0,Binary.BUFFER_SIZE=256,Binary.SUBTYPE_DEFAULT=0,Binary.SUBTYPE_FUNCTION=1,Binary.SUBTYPE_BYTE_ARRAY=2,Binary.SUBTYPE_UUID_OLD=3,Binary.SUBTYPE_UUID=4,Binary.SUBTYPE_MD5=5,Binary.SUBTYPE_ENCRYPTED=6,Binary.SUBTYPE_COLUMN=7,Binary.SUBTYPE_USER_DEFINED=128,Binary}();Object.defineProperty(Binary.prototype,"_bsontype",{value:"Binary"});var UUID=function(_super){function UUID(input){var bytes,hexStr,_this=this;if(null==input)bytes=UUID.generate();else if(input instanceof UUID)bytes=buffer_1.from(input.buffer),hexStr=input.__id;else if(ArrayBuffer.isView(input)&&16===input.byteLength)bytes=ensureBuffer(input);else{if("string"!=typeof input)throw new BSONTypeError("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");bytes=uuidHexStringToBuffer(input)}return(_this=_super.call(this,bytes,4)||this).__id=hexStr,_this}return __extends(UUID,_super),Object.defineProperty(UUID.prototype,"id",{get:function(){return this.buffer},set:function(value){this.buffer=value,UUID.cacheHexString&&(this.__id=bufferToUuidHexString(value))},enumerable:!1,configurable:!0}),UUID.prototype.toHexString=function(includeDashes){if(void 0===includeDashes&&(includeDashes=!0),UUID.cacheHexString&&this.__id)return this.__id;var uuidHexString=bufferToUuidHexString(this.id,includeDashes);return UUID.cacheHexString&&(this.__id=uuidHexString),uuidHexString},UUID.prototype.toString=function(encoding){return encoding?this.id.toString(encoding):this.toHexString()},UUID.prototype.toJSON=function(){return this.toHexString()},UUID.prototype.equals=function(otherId){if(!otherId)return!1;if(otherId instanceof UUID)return otherId.id.equals(this.id);try{return new UUID(otherId).id.equals(this.id)}catch(_a){return!1}},UUID.prototype.toBinary=function(){return new Binary(this.id,Binary.SUBTYPE_UUID)},UUID.generate=function(){var bytes=randomBytes(16);return bytes[6]=15&bytes[6]|64,bytes[8]=63&bytes[8]|128,buffer_1.from(bytes)},UUID.isValid=function(input){return!!input&&(input instanceof UUID||("string"==typeof input?uuidValidateString(input):!!isUint8Array(input)&&(16===input.length&&(64==(240&input[6])&&128==(128&input[8])))))},UUID.createFromHexString=function(hexString){return new UUID(uuidHexStringToBuffer(hexString))},UUID.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},UUID.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},UUID}(Binary),Code=function(){function Code(code,scope){if(!(this instanceof Code))return new Code(code,scope);this.code=code,this.scope=scope}return Code.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},Code.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},Code.fromExtendedJSON=function(doc){return new Code(doc.$code,doc.$scope)},Code.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},Code.prototype.inspect=function(){var codeJson=this.toJSON();return'new Code("'.concat(String(codeJson.code),'"').concat(codeJson.scope?", ".concat(JSON.stringify(codeJson.scope)):"",")")},Code}();function isDBRefLike(value){return isObjectLike(value)&&null!=value.$id&&"string"==typeof value.$ref&&(null==value.$db||"string"==typeof value.$db)}Object.defineProperty(Code.prototype,"_bsontype",{value:"Code"});var DBRef=function(){function DBRef(collection,oid,db,fields){if(!(this instanceof DBRef))return new DBRef(collection,oid,db,fields);var parts=collection.split(".");2===parts.length&&(db=parts.shift(),collection=parts.shift()),this.collection=collection,this.oid=oid,this.db=db,this.fields=fields||{}}return Object.defineProperty(DBRef.prototype,"namespace",{get:function(){return this.collection},set:function(value){this.collection=value},enumerable:!1,configurable:!0}),DBRef.prototype.toJSON=function(){var o=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return null!=this.db&&(o.$db=this.db),o},DBRef.prototype.toExtendedJSON=function(options){options=options||{};var o={$ref:this.collection,$id:this.oid};return options.legacy?o:(this.db&&(o.$db=this.db),o=Object.assign(o,this.fields))},DBRef.fromExtendedJSON=function(doc){var copy=Object.assign({},doc);return delete copy.$ref,delete copy.$id,delete copy.$db,new DBRef(doc.$ref,doc.$id,doc.$db,copy)},DBRef.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},DBRef.prototype.inspect=function(){var oid=void 0===this.oid||void 0===this.oid.toString?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(oid),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},DBRef}();Object.defineProperty(DBRef.prototype,"_bsontype",{value:"DBRef"});var wasm=void 0;try{wasm=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(_a){}var INT_CACHE={},UINT_CACHE={},Long=function(){function Long(low,high,unsigned){if(void 0===low&&(low=0),!(this instanceof Long))return new Long(low,high,unsigned);"bigint"==typeof low?Object.assign(this,Long.fromBigInt(low,!!high)):"string"==typeof low?Object.assign(this,Long.fromString(low,!!high)):(this.low=0|low,this.high=0|high,this.unsigned=!!unsigned),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return Long.fromBits=function(lowBits,highBits,unsigned){return new Long(lowBits,highBits,unsigned)},Long.fromInt=function(value,unsigned){var obj,cachedObj,cache;return unsigned?(cache=0<=(value>>>=0)&&value<256)&&(cachedObj=UINT_CACHE[value])?cachedObj:(obj=Long.fromBits(value,(0|value)<0?-1:0,!0),cache&&(UINT_CACHE[value]=obj),obj):(cache=-128<=(value|=0)&&value<128)&&(cachedObj=INT_CACHE[value])?cachedObj:(obj=Long.fromBits(value,value<0?-1:0,!1),cache&&(INT_CACHE[value]=obj),obj)},Long.fromNumber=function(value,unsigned){if(isNaN(value))return unsigned?Long.UZERO:Long.ZERO;if(unsigned){if(value<0)return Long.UZERO;if(value>=0x10000000000000000)return Long.MAX_UNSIGNED_VALUE}else{if(value<=-0x8000000000000000)return Long.MIN_VALUE;if(value+1>=0x8000000000000000)return Long.MAX_VALUE}return value<0?Long.fromNumber(-value,unsigned).neg():Long.fromBits(value%4294967296|0,value/4294967296|0,unsigned)},Long.fromBigInt=function(value,unsigned){return Long.fromString(value.toString(),unsigned)},Long.fromString=function(str,unsigned,radix){if(0===str.length)throw Error("empty string");if("NaN"===str||"Infinity"===str||"+Infinity"===str||"-Infinity"===str)return Long.ZERO;if("number"==typeof unsigned?(radix=unsigned,unsigned=!1):unsigned=!!unsigned,(radix=radix||10)<2||36<radix)throw RangeError("radix");var p;if((p=str.indexOf("-"))>0)throw Error("interior hyphen");if(0===p)return Long.fromString(str.substring(1),unsigned,radix).neg();for(var radixToPower=Long.fromNumber(Math.pow(radix,8)),result=Long.ZERO,i=0;i<str.length;i+=8){var size=Math.min(8,str.length-i),value=parseInt(str.substring(i,i+size),radix);if(size<8){var power=Long.fromNumber(Math.pow(radix,size));result=result.mul(power).add(Long.fromNumber(value))}else result=(result=result.mul(radixToPower)).add(Long.fromNumber(value))}return result.unsigned=unsigned,result},Long.fromBytes=function(bytes,unsigned,le){return le?Long.fromBytesLE(bytes,unsigned):Long.fromBytesBE(bytes,unsigned)},Long.fromBytesLE=function(bytes,unsigned){return new Long(bytes[0]|bytes[1]<<8|bytes[2]<<16|bytes[3]<<24,bytes[4]|bytes[5]<<8|bytes[6]<<16|bytes[7]<<24,unsigned)},Long.fromBytesBE=function(bytes,unsigned){return new Long(bytes[4]<<24|bytes[5]<<16|bytes[6]<<8|bytes[7],bytes[0]<<24|bytes[1]<<16|bytes[2]<<8|bytes[3],unsigned)},Long.isLong=function(value){return isObjectLike(value)&&!0===value.__isLong__},Long.fromValue=function(val,unsigned){return"number"==typeof val?Long.fromNumber(val,unsigned):"string"==typeof val?Long.fromString(val,unsigned):Long.fromBits(val.low,val.high,"boolean"==typeof unsigned?unsigned:val.unsigned)},Long.prototype.add=function(addend){Long.isLong(addend)||(addend=Long.fromValue(addend));var a48=this.high>>>16,a32=65535&this.high,a16=this.low>>>16,a00=65535&this.low,b48=addend.high>>>16,b32=65535&addend.high,b16=addend.low>>>16,c48=0,c32=0,c16=0,c00=0;return c16+=(c00+=a00+(65535&addend.low))>>>16,c00&=65535,c32+=(c16+=a16+b16)>>>16,c16&=65535,c48+=(c32+=a32+b32)>>>16,c32&=65535,c48+=a48+b48,c48&=65535,Long.fromBits(c16<<16|c00,c48<<16|c32,this.unsigned)},Long.prototype.and=function(other){return Long.isLong(other)||(other=Long.fromValue(other)),Long.fromBits(this.low&other.low,this.high&other.high,this.unsigned)},Long.prototype.compare=function(other){if(Long.isLong(other)||(other=Long.fromValue(other)),this.eq(other))return 0;var thisNeg=this.isNegative(),otherNeg=other.isNegative();return thisNeg&&!otherNeg?-1:!thisNeg&&otherNeg?1:this.unsigned?other.high>>>0>this.high>>>0||other.high===this.high&&other.low>>>0>this.low>>>0?-1:1:this.sub(other).isNegative()?-1:1},Long.prototype.comp=function(other){return this.compare(other)},Long.prototype.divide=function(divisor){if(Long.isLong(divisor)||(divisor=Long.fromValue(divisor)),divisor.isZero())throw Error("division by zero");if(wasm){if(!this.unsigned&&-2147483648===this.high&&-1===divisor.low&&-1===divisor.high)return this;var low=(this.unsigned?wasm.div_u:wasm.div_s)(this.low,this.high,divisor.low,divisor.high);return Long.fromBits(low,wasm.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Long.UZERO:Long.ZERO;var approx,rem,res;if(this.unsigned){if(divisor.unsigned||(divisor=divisor.toUnsigned()),divisor.gt(this))return Long.UZERO;if(divisor.gt(this.shru(1)))return Long.UONE;res=Long.UZERO}else{if(this.eq(Long.MIN_VALUE))return divisor.eq(Long.ONE)||divisor.eq(Long.NEG_ONE)?Long.MIN_VALUE:divisor.eq(Long.MIN_VALUE)?Long.ONE:(approx=this.shr(1).div(divisor).shl(1)).eq(Long.ZERO)?divisor.isNegative()?Long.ONE:Long.NEG_ONE:(rem=this.sub(divisor.mul(approx)),res=approx.add(rem.div(divisor)));if(divisor.eq(Long.MIN_VALUE))return this.unsigned?Long.UZERO:Long.ZERO;if(this.isNegative())return divisor.isNegative()?this.neg().div(divisor.neg()):this.neg().div(divisor).neg();if(divisor.isNegative())return this.div(divisor.neg()).neg();res=Long.ZERO}for(rem=this;rem.gte(divisor);){approx=Math.max(1,Math.floor(rem.toNumber()/divisor.toNumber()));for(var log2=Math.ceil(Math.log(approx)/Math.LN2),delta=log2<=48?1:Math.pow(2,log2-48),approxRes=Long.fromNumber(approx),approxRem=approxRes.mul(divisor);approxRem.isNegative()||approxRem.gt(rem);)approx-=delta,approxRem=(approxRes=Long.fromNumber(approx,this.unsigned)).mul(divisor);approxRes.isZero()&&(approxRes=Long.ONE),res=res.add(approxRes),rem=rem.sub(approxRem)}return res},Long.prototype.div=function(divisor){return this.divide(divisor)},Long.prototype.equals=function(other){return Long.isLong(other)||(other=Long.fromValue(other)),(this.unsigned===other.unsigned||this.high>>>31!=1||other.high>>>31!=1)&&(this.high===other.high&&this.low===other.low)},Long.prototype.eq=function(other){return this.equals(other)},Long.prototype.getHighBits=function(){return this.high},Long.prototype.getHighBitsUnsigned=function(){return this.high>>>0},Long.prototype.getLowBits=function(){return this.low},Long.prototype.getLowBitsUnsigned=function(){return this.low>>>0},Long.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Long.MIN_VALUE)?64:this.neg().getNumBitsAbs();var bit,val=0!==this.high?this.high:this.low;for(bit=31;bit>0&&0==(val&1<<bit);bit--);return 0!==this.high?bit+33:bit+1},Long.prototype.greaterThan=function(other){return this.comp(other)>0},Long.prototype.gt=function(other){return this.greaterThan(other)},Long.prototype.greaterThanOrEqual=function(other){return this.comp(other)>=0},Long.prototype.gte=function(other){return this.greaterThanOrEqual(other)},Long.prototype.ge=function(other){return this.greaterThanOrEqual(other)},Long.prototype.isEven=function(){return 0==(1&this.low)},Long.prototype.isNegative=function(){return!this.unsigned&&this.high<0},Long.prototype.isOdd=function(){return 1==(1&this.low)},Long.prototype.isPositive=function(){return this.unsigned||this.high>=0},Long.prototype.isZero=function(){return 0===this.high&&0===this.low},Long.prototype.lessThan=function(other){return this.comp(other)<0},Long.prototype.lt=function(other){return this.lessThan(other)},Long.prototype.lessThanOrEqual=function(other){return this.comp(other)<=0},Long.prototype.lte=function(other){return this.lessThanOrEqual(other)},Long.prototype.modulo=function(divisor){if(Long.isLong(divisor)||(divisor=Long.fromValue(divisor)),wasm){var low=(this.unsigned?wasm.rem_u:wasm.rem_s)(this.low,this.high,divisor.low,divisor.high);return Long.fromBits(low,wasm.get_high(),this.unsigned)}return this.sub(this.div(divisor).mul(divisor))},Long.prototype.mod=function(divisor){return this.modulo(divisor)},Long.prototype.rem=function(divisor){return this.modulo(divisor)},Long.prototype.multiply=function(multiplier){if(this.isZero())return Long.ZERO;if(Long.isLong(multiplier)||(multiplier=Long.fromValue(multiplier)),wasm){var low=wasm.mul(this.low,this.high,multiplier.low,multiplier.high);return Long.fromBits(low,wasm.get_high(),this.unsigned)}if(multiplier.isZero())return Long.ZERO;if(this.eq(Long.MIN_VALUE))return multiplier.isOdd()?Long.MIN_VALUE:Long.ZERO;if(multiplier.eq(Long.MIN_VALUE))return this.isOdd()?Long.MIN_VALUE:Long.ZERO;if(this.isNegative())return multiplier.isNegative()?this.neg().mul(multiplier.neg()):this.neg().mul(multiplier).neg();if(multiplier.isNegative())return this.mul(multiplier.neg()).neg();if(this.lt(Long.TWO_PWR_24)&&multiplier.lt(Long.TWO_PWR_24))return Long.fromNumber(this.toNumber()*multiplier.toNumber(),this.unsigned);var a48=this.high>>>16,a32=65535&this.high,a16=this.low>>>16,a00=65535&this.low,b48=multiplier.high>>>16,b32=65535&multiplier.high,b16=multiplier.low>>>16,b00=65535&multiplier.low,c48=0,c32=0,c16=0,c00=0;return c16+=(c00+=a00*b00)>>>16,c00&=65535,c32+=(c16+=a16*b00)>>>16,c16&=65535,c32+=(c16+=a00*b16)>>>16,c16&=65535,c48+=(c32+=a32*b00)>>>16,c32&=65535,c48+=(c32+=a16*b16)>>>16,c32&=65535,c48+=(c32+=a00*b32)>>>16,c32&=65535,c48+=a48*b00+a32*b16+a16*b32+a00*b48,c48&=65535,Long.fromBits(c16<<16|c00,c48<<16|c32,this.unsigned)},Long.prototype.mul=function(multiplier){return this.multiply(multiplier)},Long.prototype.negate=function(){return!this.unsigned&&this.eq(Long.MIN_VALUE)?Long.MIN_VALUE:this.not().add(Long.ONE)},Long.prototype.neg=function(){return this.negate()},Long.prototype.not=function(){return Long.fromBits(~this.low,~this.high,this.unsigned)},Long.prototype.notEquals=function(other){return!this.equals(other)},Long.prototype.neq=function(other){return this.notEquals(other)},Long.prototype.ne=function(other){return this.notEquals(other)},Long.prototype.or=function(other){return Long.isLong(other)||(other=Long.fromValue(other)),Long.fromBits(this.low|other.low,this.high|other.high,this.unsigned)},Long.prototype.shiftLeft=function(numBits){return Long.isLong(numBits)&&(numBits=numBits.toInt()),0==(numBits&=63)?this:numBits<32?Long.fromBits(this.low<<numBits,this.high<<numBits|this.low>>>32-numBits,this.unsigned):Long.fromBits(0,this.low<<numBits-32,this.unsigned)},Long.prototype.shl=function(numBits){return this.shiftLeft(numBits)},Long.prototype.shiftRight=function(numBits){return Long.isLong(numBits)&&(numBits=numBits.toInt()),0==(numBits&=63)?this:numBits<32?Long.fromBits(this.low>>>numBits|this.high<<32-numBits,this.high>>numBits,this.unsigned):Long.fromBits(this.high>>numBits-32,this.high>=0?0:-1,this.unsigned)},Long.prototype.shr=function(numBits){return this.shiftRight(numBits)},Long.prototype.shiftRightUnsigned=function(numBits){if(Long.isLong(numBits)&&(numBits=numBits.toInt()),0===(numBits&=63))return this;var high=this.high;if(numBits<32){var low=this.low;return Long.fromBits(low>>>numBits|high<<32-numBits,high>>>numBits,this.unsigned)}return 32===numBits?Long.fromBits(high,0,this.unsigned):Long.fromBits(high>>>numBits-32,0,this.unsigned)},Long.prototype.shr_u=function(numBits){return this.shiftRightUnsigned(numBits)},Long.prototype.shru=function(numBits){return this.shiftRightUnsigned(numBits)},Long.prototype.subtract=function(subtrahend){return Long.isLong(subtrahend)||(subtrahend=Long.fromValue(subtrahend)),this.add(subtrahend.neg())},Long.prototype.sub=function(subtrahend){return this.subtract(subtrahend)},Long.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},Long.prototype.toNumber=function(){return this.unsigned?4294967296*(this.high>>>0)+(this.low>>>0):4294967296*this.high+(this.low>>>0)},Long.prototype.toBigInt=function(){return BigInt(this.toString())},Long.prototype.toBytes=function(le){return le?this.toBytesLE():this.toBytesBE()},Long.prototype.toBytesLE=function(){var hi=this.high,lo=this.low;return[255&lo,lo>>>8&255,lo>>>16&255,lo>>>24,255&hi,hi>>>8&255,hi>>>16&255,hi>>>24]},Long.prototype.toBytesBE=function(){var hi=this.high,lo=this.low;return[hi>>>24,hi>>>16&255,hi>>>8&255,255&hi,lo>>>24,lo>>>16&255,lo>>>8&255,255&lo]},Long.prototype.toSigned=function(){return this.unsigned?Long.fromBits(this.low,this.high,!1):this},Long.prototype.toString=function(radix){if((radix=radix||10)<2||36<radix)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(Long.MIN_VALUE)){var radixLong=Long.fromNumber(radix),div=this.div(radixLong),rem1=div.mul(radixLong).sub(this);return div.toString(radix)+rem1.toInt().toString(radix)}return"-"+this.neg().toString(radix)}for(var radixToPower=Long.fromNumber(Math.pow(radix,6),this.unsigned),rem=this,result="";;){var remDiv=rem.div(radixToPower),digits=(rem.sub(remDiv.mul(radixToPower)).toInt()>>>0).toString(radix);if((rem=remDiv).isZero())return digits+result;for(;digits.length<6;)digits="0"+digits;result=""+digits+result}},Long.prototype.toUnsigned=function(){return this.unsigned?this:Long.fromBits(this.low,this.high,!0)},Long.prototype.xor=function(other){return Long.isLong(other)||(other=Long.fromValue(other)),Long.fromBits(this.low^other.low,this.high^other.high,this.unsigned)},Long.prototype.eqz=function(){return this.isZero()},Long.prototype.le=function(other){return this.lessThanOrEqual(other)},Long.prototype.toExtendedJSON=function(options){return options&&options.relaxed?this.toNumber():{$numberLong:this.toString()}},Long.fromExtendedJSON=function(doc,options){var result=Long.fromString(doc.$numberLong);return options&&options.relaxed?result.toNumber():result},Long.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},Long.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},Long.TWO_PWR_24=Long.fromInt(16777216),Long.MAX_UNSIGNED_VALUE=Long.fromBits(-1,-1,!0),Long.ZERO=Long.fromInt(0),Long.UZERO=Long.fromInt(0,!0),Long.ONE=Long.fromInt(1),Long.UONE=Long.fromInt(1,!0),Long.NEG_ONE=Long.fromInt(-1),Long.MAX_VALUE=Long.fromBits(-1,2147483647,!1),Long.MIN_VALUE=Long.fromBits(0,-2147483648,!1),Long}();Object.defineProperty(Long.prototype,"__isLong__",{value:!0}),Object.defineProperty(Long.prototype,"_bsontype",{value:"Long"});var PARSE_STRING_REGEXP=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,PARSE_INF_REGEXP=/^(\+|-)?(Infinity|inf)$/i,PARSE_NAN_REGEXP=/^(\+|-)?NaN$/i,NAN_BUFFER=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),INF_NEGATIVE_BUFFER=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),INF_POSITIVE_BUFFER=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),EXPONENT_REGEX=/^([-+])?(\d+)?$/;function isDigit(value){return!isNaN(parseInt(value,10))}function divideu128(value){var DIVISOR=Long.fromNumber(1e9),_rem=Long.fromNumber(0);if(!(value.parts[0]||value.parts[1]||value.parts[2]||value.parts[3]))return{quotient:value,rem:_rem};for(var i=0;i<=3;i++)_rem=(_rem=_rem.shiftLeft(32)).add(new Long(value.parts[i],0)),value.parts[i]=_rem.div(DIVISOR).low,_rem=_rem.modulo(DIVISOR);return{quotient:value,rem:_rem}}function invalidErr(string,message){throw new BSONTypeError('"'.concat(string,'" is not a valid Decimal128 string - ').concat(message))}var Decimal128=function(){function Decimal128(bytes){if(!(this instanceof Decimal128))return new Decimal128(bytes);if("string"==typeof bytes)this.bytes=Decimal128.fromString(bytes).bytes;else{if(!isUint8Array(bytes))throw new BSONTypeError("Decimal128 must take a Buffer or string");if(16!==bytes.byteLength)throw new BSONTypeError("Decimal128 must take a Buffer of 16 bytes");this.bytes=bytes}}return Decimal128.fromString=function(representation){var biasedExponent,isNegative=!1,sawRadix=!1,foundNonZero=!1,significantDigits=0,nDigitsRead=0,nDigits=0,radixPosition=0,firstNonZero=0,digits=[0],nDigitsStored=0,digitsInsert=0,firstDigit=0,lastDigit=0,exponent=0,i=0,significandHigh=new Long(0,0),significandLow=new Long(0,0),index=0;if(representation.length>=7e3)throw new BSONTypeError(representation+" not a valid Decimal128 string");var stringMatch=representation.match(PARSE_STRING_REGEXP),infMatch=representation.match(PARSE_INF_REGEXP),nanMatch=representation.match(PARSE_NAN_REGEXP);if(!stringMatch&&!infMatch&&!nanMatch||0===representation.length)throw new BSONTypeError(representation+" not a valid Decimal128 string");if(stringMatch){var unsignedNumber=stringMatch[2],e=stringMatch[4],expSign=stringMatch[5],expNumber=stringMatch[6];e&&void 0===expNumber&&invalidErr(representation,"missing exponent power"),e&&void 0===unsignedNumber&&invalidErr(representation,"missing exponent base"),void 0===e&&(expSign||expNumber)&&invalidErr(representation,"missing e before exponent")}if("+"!==representation[index]&&"-"!==representation[index]||(isNegative="-"===representation[index++]),!isDigit(representation[index])&&"."!==representation[index]){if("i"===representation[index]||"I"===representation[index])return new Decimal128(buffer_1.from(isNegative?INF_NEGATIVE_BUFFER:INF_POSITIVE_BUFFER));if("N"===representation[index])return new Decimal128(buffer_1.from(NAN_BUFFER))}for(;isDigit(representation[index])||"."===representation[index];)"."!==representation[index]?(nDigitsStored<34&&("0"!==representation[index]||foundNonZero)&&(foundNonZero||(firstNonZero=nDigitsRead),foundNonZero=!0,digits[digitsInsert++]=parseInt(representation[index],10),nDigitsStored+=1),foundNonZero&&(nDigits+=1),sawRadix&&(radixPosition+=1),nDigitsRead+=1,index+=1):(sawRadix&&invalidErr(representation,"contains multiple periods"),sawRadix=!0,index+=1);if(sawRadix&&!nDigitsRead)throw new BSONTypeError(representation+" not a valid Decimal128 string");if("e"===representation[index]||"E"===representation[index]){var match=representation.substr(++index).match(EXPONENT_REGEX);if(!match||!match[2])return new Decimal128(buffer_1.from(NAN_BUFFER));exponent=parseInt(match[0],10),index+=match[0].length}if(representation[index])return new Decimal128(buffer_1.from(NAN_BUFFER));if(firstDigit=0,nDigitsStored){if(lastDigit=nDigitsStored-1,1!==(significantDigits=nDigits))for(;0===digits[firstNonZero+significantDigits-1];)significantDigits-=1}else firstDigit=0,lastDigit=0,digits[0]=0,nDigits=1,nDigitsStored=1,significantDigits=0;for(exponent<=radixPosition&&radixPosition-exponent>16384?exponent=-6176:exponent-=radixPosition;exponent>6111;){if((lastDigit+=1)-firstDigit>34){if(digits.join("").match(/^0+$/)){exponent=6111;break}invalidErr(representation,"overflow")}exponent-=1}for(;exponent<-6176||nDigitsStored<nDigits;){if(0===lastDigit&&significantDigits<nDigitsStored){exponent=-6176,significantDigits=0;break}if(nDigitsStored<nDigits?nDigits-=1:lastDigit-=1,exponent<6111)exponent+=1;else{if(digits.join("").match(/^0+$/)){exponent=6111;break}invalidErr(representation,"overflow")}}if(lastDigit-firstDigit+1<significantDigits){var endOfString=nDigitsRead;sawRadix&&(firstNonZero+=1,endOfString+=1),isNegative&&(firstNonZero+=1,endOfString+=1);var roundDigit=parseInt(representation[firstNonZero+lastDigit+1],10),roundBit=0;if(roundDigit>=5&&(roundBit=1,5===roundDigit))for(roundBit=digits[lastDigit]%2==1?1:0,i=firstNonZero+lastDigit+2;i<endOfString;i++)if(parseInt(representation[i],10)){roundBit=1;break}if(roundBit)for(var dIdx=lastDigit;dIdx>=0;dIdx--)if(++digits[dIdx]>9&&(digits[dIdx]=0,0===dIdx)){if(!(exponent<6111))return new Decimal128(buffer_1.from(isNegative?INF_NEGATIVE_BUFFER:INF_POSITIVE_BUFFER));exponent+=1,digits[dIdx]=1}}if(significandHigh=Long.fromNumber(0),significandLow=Long.fromNumber(0),0===significantDigits)significandHigh=Long.fromNumber(0),significandLow=Long.fromNumber(0);else if(lastDigit-firstDigit<17){dIdx=firstDigit;for(significandLow=Long.fromNumber(digits[dIdx++]),significandHigh=new Long(0,0);dIdx<=lastDigit;dIdx++)significandLow=(significandLow=significandLow.multiply(Long.fromNumber(10))).add(Long.fromNumber(digits[dIdx]))}else{dIdx=firstDigit;for(significandHigh=Long.fromNumber(digits[dIdx++]);dIdx<=lastDigit-17;dIdx++)significandHigh=(significandHigh=significandHigh.multiply(Long.fromNumber(10))).add(Long.fromNumber(digits[dIdx]));for(significandLow=Long.fromNumber(digits[dIdx++]);dIdx<=lastDigit;dIdx++)significandLow=(significandLow=significandLow.multiply(Long.fromNumber(10))).add(Long.fromNumber(digits[dIdx]))}var significand=function multiply64x2(left,right){if(!left&&!right)return{high:Long.fromNumber(0),low:Long.fromNumber(0)};var leftHigh=left.shiftRightUnsigned(32),leftLow=new Long(left.getLowBits(),0),rightHigh=right.shiftRightUnsigned(32),rightLow=new Long(right.getLowBits(),0),productHigh=leftHigh.multiply(rightHigh),productMid=leftHigh.multiply(rightLow),productMid2=leftLow.multiply(rightHigh),productLow=leftLow.multiply(rightLow);return productHigh=productHigh.add(productMid.shiftRightUnsigned(32)),productMid=new Long(productMid.getLowBits(),0).add(productMid2).add(productLow.shiftRightUnsigned(32)),{high:productHigh=productHigh.add(productMid.shiftRightUnsigned(32)),low:productLow=productMid.shiftLeft(32).add(new Long(productLow.getLowBits(),0))}}(significandHigh,Long.fromString("100000000000000000"));significand.low=significand.low.add(significandLow),function lessThan(left,right){var uhleft=left.high>>>0,uhright=right.high>>>0;return uhleft<uhright||uhleft===uhright&&left.low>>>0<right.low>>>0}(significand.low,significandLow)&&(significand.high=significand.high.add(Long.fromNumber(1))),biasedExponent=exponent+6176;var dec={low:Long.fromNumber(0),high:Long.fromNumber(0)};significand.high.shiftRightUnsigned(49).and(Long.fromNumber(1)).equals(Long.fromNumber(1))?(dec.high=dec.high.or(Long.fromNumber(3).shiftLeft(61)),dec.high=dec.high.or(Long.fromNumber(biasedExponent).and(Long.fromNumber(16383).shiftLeft(47))),dec.high=dec.high.or(significand.high.and(Long.fromNumber(0x7fffffffffff)))):(dec.high=dec.high.or(Long.fromNumber(16383&biasedExponent).shiftLeft(49)),dec.high=dec.high.or(significand.high.and(Long.fromNumber(562949953421311)))),dec.low=significand.low,isNegative&&(dec.high=dec.high.or(Long.fromString("9223372036854775808")));var buffer=buffer_1.alloc(16);return index=0,buffer[index++]=255&dec.low.low,buffer[index++]=dec.low.low>>8&255,buffer[index++]=dec.low.low>>16&255,buffer[index++]=dec.low.low>>24&255,buffer[index++]=255&dec.low.high,buffer[index++]=dec.low.high>>8&255,buffer[index++]=dec.low.high>>16&255,buffer[index++]=dec.low.high>>24&255,buffer[index++]=255&dec.high.low,buffer[index++]=dec.high.low>>8&255,buffer[index++]=dec.high.low>>16&255,buffer[index++]=dec.high.low>>24&255,buffer[index++]=255&dec.high.high,buffer[index++]=dec.high.high>>8&255,buffer[index++]=dec.high.high>>16&255,buffer[index++]=dec.high.high>>24&255,new Decimal128(buffer)},Decimal128.prototype.toString=function(){for(var biased_exponent,significand_digits=0,significand=new Array(36),i=0;i<significand.length;i++)significand[i]=0;var significand_msb,j,k,index=0,is_zero=!1,significand128={parts:[0,0,0,0]},string=[];index=0;var buffer=this.bytes,low=buffer[index++]|buffer[index++]<<8|buffer[index++]<<16|buffer[index++]<<24,midl=buffer[index++]|buffer[index++]<<8|buffer[index++]<<16|buffer[index++]<<24,midh=buffer[index++]|buffer[index++]<<8|buffer[index++]<<16|buffer[index++]<<24,high=buffer[index++]|buffer[index++]<<8|buffer[index++]<<16|buffer[index++]<<24;index=0,{low:new Long(low,midl),high:new Long(midh,high)}.high.lessThan(Long.ZERO)&&string.push("-");var combination=high>>26&31;if(combination>>3==3){if(30===combination)return string.join("")+"Infinity";if(31===combination)return"NaN";biased_exponent=high>>15&16383,significand_msb=8+(high>>14&1)}else significand_msb=high>>14&7,biased_exponent=high>>17&16383;var exponent=biased_exponent-6176;if(significand128.parts[0]=(16383&high)+((15&significand_msb)<<14),significand128.parts[1]=midh,significand128.parts[2]=midl,significand128.parts[3]=low,0===significand128.parts[0]&&0===significand128.parts[1]&&0===significand128.parts[2]&&0===significand128.parts[3])is_zero=!0;else for(k=3;k>=0;k--){var least_digits=0,result=divideu128(significand128);if(significand128=result.quotient,least_digits=result.rem.low)for(j=8;j>=0;j--)significand[9*k+j]=least_digits%10,least_digits=Math.floor(least_digits/10)}if(is_zero)significand_digits=1,significand[index]=0;else for(significand_digits=36;!significand[index];)significand_digits-=1,index+=1;var scientific_exponent=significand_digits-1+exponent;if(scientific_exponent>=34||scientific_exponent<=-7||exponent>0){if(significand_digits>34)return string.push("".concat(0)),exponent>0?string.push("E+".concat(exponent)):exponent<0&&string.push("E".concat(exponent)),string.join("");string.push("".concat(significand[index++])),(significand_digits-=1)&&string.push(".");for(i=0;i<significand_digits;i++)string.push("".concat(significand[index++]));string.push("E"),scientific_exponent>0?string.push("+".concat(scientific_exponent)):string.push("".concat(scientific_exponent))}else if(exponent>=0)for(i=0;i<significand_digits;i++)string.push("".concat(significand[index++]));else{var radix_position=significand_digits+exponent;if(radix_position>0)for(i=0;i<radix_position;i++)string.push("".concat(significand[index++]));else string.push("0");for(string.push(".");radix_position++<0;)string.push("0");for(i=0;i<significand_digits-Math.max(radix_position-1,0);i++)string.push("".concat(significand[index++]))}return string.join("")},Decimal128.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},Decimal128.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},Decimal128.fromExtendedJSON=function(doc){return Decimal128.fromString(doc.$numberDecimal)},Decimal128.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},Decimal128.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},Decimal128}();Object.defineProperty(Decimal128.prototype,"_bsontype",{value:"Decimal128"});var Double=function(){function Double(value){if(!(this instanceof Double))return new Double(value);value instanceof Number&&(value=value.valueOf()),this.value=+value}return Double.prototype.valueOf=function(){return this.value},Double.prototype.toJSON=function(){return this.value},Double.prototype.toString=function(radix){return this.value.toString(radix)},Double.prototype.toExtendedJSON=function(options){return options&&(options.legacy||options.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:(Number.isInteger(this.value)?($numberDouble=this.value.toFixed(1)).length>=13&&($numberDouble=this.value.toExponential(13).toUpperCase()):$numberDouble=this.value.toString(),{$numberDouble:$numberDouble});var $numberDouble},Double.fromExtendedJSON=function(doc,options){var doubleValue=parseFloat(doc.$numberDouble);return options&&options.relaxed?doubleValue:new Double(doubleValue)},Double.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},Double.prototype.inspect=function(){var eJSON=this.toExtendedJSON();return"new Double(".concat(eJSON.$numberDouble,")")},Double}();Object.defineProperty(Double.prototype,"_bsontype",{value:"Double"});var Int32=function(){function Int32(value){if(!(this instanceof Int32))return new Int32(value);value instanceof Number&&(value=value.valueOf()),this.value=0|+value}return Int32.prototype.valueOf=function(){return this.value},Int32.prototype.toString=function(radix){return this.value.toString(radix)},Int32.prototype.toJSON=function(){return this.value},Int32.prototype.toExtendedJSON=function(options){return options&&(options.relaxed||options.legacy)?this.value:{$numberInt:this.value.toString()}},Int32.fromExtendedJSON=function(doc,options){return options&&options.relaxed?parseInt(doc.$numberInt,10):new Int32(doc.$numberInt)},Int32.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},Int32.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},Int32}();Object.defineProperty(Int32.prototype,"_bsontype",{value:"Int32"});var MaxKey=function(){function MaxKey(){if(!(this instanceof MaxKey))return new MaxKey}return MaxKey.prototype.toExtendedJSON=function(){return{$maxKey:1}},MaxKey.fromExtendedJSON=function(){return new MaxKey},MaxKey.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},MaxKey.prototype.inspect=function(){return"new MaxKey()"},MaxKey}();Object.defineProperty(MaxKey.prototype,"_bsontype",{value:"MaxKey"});var MinKey=function(){function MinKey(){if(!(this instanceof MinKey))return new MinKey}return MinKey.prototype.toExtendedJSON=function(){return{$minKey:1}},MinKey.fromExtendedJSON=function(){return new MinKey},MinKey.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},MinKey.prototype.inspect=function(){return"new MinKey()"},MinKey}();Object.defineProperty(MinKey.prototype,"_bsontype",{value:"MinKey"});var checkForHexRegExp=new RegExp("^[0-9a-fA-F]{24}$"),PROCESS_UNIQUE=null,kId=Symbol("id"),ObjectId=function(){function ObjectId(inputId){if(!(this instanceof ObjectId))return new ObjectId(inputId);var workingId;if("object"==typeof inputId&&inputId&&"id"in inputId){if("string"!=typeof inputId.id&&!ArrayBuffer.isView(inputId.id))throw new BSONTypeError("Argument passed in must have an id that is of type string or Buffer");workingId="toHexString"in inputId&&"function"==typeof inputId.toHexString?buffer_1.from(inputId.toHexString(),"hex"):inputId.id}else workingId=inputId;if(null==workingId||"number"==typeof workingId)this[kId]=ObjectId.generate("number"==typeof workingId?workingId:void 0);else if(ArrayBuffer.isView(workingId)&&12===workingId.byteLength)this[kId]=workingId instanceof buffer_1?workingId:ensureBuffer(workingId);else{if("string"!=typeof workingId)throw new BSONTypeError("Argument passed in does not match the accepted types");if(12===workingId.length){var bytes=buffer_1.from(workingId);if(12!==bytes.byteLength)throw new BSONTypeError("Argument passed in must be a string of 12 bytes");this[kId]=bytes}else{if(24!==workingId.length||!checkForHexRegExp.test(workingId))throw new BSONTypeError("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");this[kId]=buffer_1.from(workingId,"hex")}}ObjectId.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(ObjectId.prototype,"id",{get:function(){return this[kId]},set:function(value){this[kId]=value,ObjectId.cacheHexString&&(this.__id=value.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(ObjectId.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(value){this.id.writeUInt32BE(value,0)},enumerable:!1,configurable:!0}),ObjectId.prototype.toHexString=function(){if(ObjectId.cacheHexString&&this.__id)return this.__id;var hexString=this.id.toString("hex");return ObjectId.cacheHexString&&!this.__id&&(this.__id=hexString),hexString},ObjectId.getInc=function(){return ObjectId.index=(ObjectId.index+1)%16777215},ObjectId.generate=function(time){"number"!=typeof time&&(time=Math.floor(Date.now()/1e3));var inc=ObjectId.getInc(),buffer=buffer_1.alloc(12);return buffer.writeUInt32BE(time,0),null===PROCESS_UNIQUE&&(PROCESS_UNIQUE=randomBytes(5)),buffer[4]=PROCESS_UNIQUE[0],buffer[5]=PROCESS_UNIQUE[1],buffer[6]=PROCESS_UNIQUE[2],buffer[7]=PROCESS_UNIQUE[3],buffer[8]=PROCESS_UNIQUE[4],buffer[11]=255&inc,buffer[10]=inc>>8&255,buffer[9]=inc>>16&255,buffer},ObjectId.prototype.toString=function(format){return format?this.id.toString(format):this.toHexString()},ObjectId.prototype.toJSON=function(){return this.toHexString()},ObjectId.prototype.equals=function(otherId){if(null==otherId)return!1;if(otherId instanceof ObjectId)return this[kId][11]===otherId[kId][11]&&this[kId].equals(otherId[kId]);if("string"==typeof otherId&&ObjectId.isValid(otherId)&&12===otherId.length&&isUint8Array(this.id))return otherId===buffer_1.prototype.toString.call(this.id,"latin1");if("string"==typeof otherId&&ObjectId.isValid(otherId)&&24===otherId.length)return otherId.toLowerCase()===this.toHexString();if("string"==typeof otherId&&ObjectId.isValid(otherId)&&12===otherId.length)return buffer_1.from(otherId).equals(this.id);if("object"==typeof otherId&&"toHexString"in otherId&&"function"==typeof otherId.toHexString){var otherIdString=otherId.toHexString(),thisIdString=this.toHexString().toLowerCase();return"string"==typeof otherIdString&&otherIdString.toLowerCase()===thisIdString}return!1},ObjectId.prototype.getTimestamp=function(){var timestamp=new Date,time=this.id.readUInt32BE(0);return timestamp.setTime(1e3*Math.floor(time)),timestamp},ObjectId.createPk=function(){return new ObjectId},ObjectId.createFromTime=function(time){var buffer=buffer_1.from([0,0,0,0,0,0,0,0,0,0,0,0]);return buffer.writeUInt32BE(time,0),new ObjectId(buffer)},ObjectId.createFromHexString=function(hexString){if(void 0===hexString||null!=hexString&&24!==hexString.length)throw new BSONTypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new ObjectId(buffer_1.from(hexString,"hex"))},ObjectId.isValid=function(id){if(null==id)return!1;try{return new ObjectId(id),!0}catch(_a){return!1}},ObjectId.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},ObjectId.fromExtendedJSON=function(doc){return new ObjectId(doc.$oid)},ObjectId.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},ObjectId.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},ObjectId.index=Math.floor(16777215*Math.random()),ObjectId}();Object.defineProperty(ObjectId.prototype,"generate",{value:deprecate((function(time){return ObjectId.generate(time)}),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(ObjectId.prototype,"getInc",{value:deprecate((function(){return ObjectId.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(ObjectId.prototype,"get_inc",{value:deprecate((function(){return ObjectId.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(ObjectId,"get_inc",{value:deprecate((function(){return ObjectId.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(ObjectId.prototype,"_bsontype",{value:"ObjectID"});var BSONRegExp=function(){function BSONRegExp(pattern,options){if(!(this instanceof BSONRegExp))return new BSONRegExp(pattern,options);if(this.pattern=pattern,this.options=function alphabetize(str){return str.split("").sort().join("")}(null!=options?options:""),-1!==this.pattern.indexOf("\0"))throw new BSONError("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(-1!==this.options.indexOf("\0"))throw new BSONError("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var i=0;i<this.options.length;i++)if("i"!==this.options[i]&&"m"!==this.options[i]&&"x"!==this.options[i]&&"l"!==this.options[i]&&"s"!==this.options[i]&&"u"!==this.options[i])throw new BSONError("The regular expression option [".concat(this.options[i],"] is not supported"))}return BSONRegExp.parseOptions=function(options){return options?options.split("").sort().join(""):""},BSONRegExp.prototype.toExtendedJSON=function(options){return(options=options||{}).legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},BSONRegExp.fromExtendedJSON=function(doc){if("$regex"in doc){if("string"==typeof doc.$regex)return new BSONRegExp(doc.$regex,BSONRegExp.parseOptions(doc.$options));if("BSONRegExp"===doc.$regex._bsontype)return doc}if("$regularExpression"in doc)return new BSONRegExp(doc.$regularExpression.pattern,BSONRegExp.parseOptions(doc.$regularExpression.options));throw new BSONTypeError("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(doc)))},BSONRegExp}();Object.defineProperty(BSONRegExp.prototype,"_bsontype",{value:"BSONRegExp"});var BSONSymbol=function(){function BSONSymbol(value){if(!(this instanceof BSONSymbol))return new BSONSymbol(value);this.value=value}return BSONSymbol.prototype.valueOf=function(){return this.value},BSONSymbol.prototype.toString=function(){return this.value},BSONSymbol.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},BSONSymbol.prototype.toJSON=function(){return this.value},BSONSymbol.prototype.toExtendedJSON=function(){return{$symbol:this.value}},BSONSymbol.fromExtendedJSON=function(doc){return new BSONSymbol(doc.$symbol)},BSONSymbol.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},BSONSymbol}();Object.defineProperty(BSONSymbol.prototype,"_bsontype",{value:"Symbol"});var Timestamp=function(_super){function Timestamp(low,high){var _this=this;return _this instanceof Timestamp?(_this=Long.isLong(low)?_super.call(this,low.low,low.high,!0)||this:isObjectLike(low)&&void 0!==low.t&&void 0!==low.i?_super.call(this,low.i,low.t,!0)||this:_super.call(this,low,high,!0)||this,Object.defineProperty(_this,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),_this):new Timestamp(low,high)}return __extends(Timestamp,_super),Timestamp.prototype.toJSON=function(){return{$timestamp:this.toString()}},Timestamp.fromInt=function(value){return new Timestamp(Long.fromInt(value,!0))},Timestamp.fromNumber=function(value){return new Timestamp(Long.fromNumber(value,!0))},Timestamp.fromBits=function(lowBits,highBits){return new Timestamp(lowBits,highBits)},Timestamp.fromString=function(str,optRadix){return new Timestamp(Long.fromString(str,!0,optRadix))},Timestamp.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},Timestamp.fromExtendedJSON=function(doc){return new Timestamp(doc.$timestamp)},Timestamp.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},Timestamp.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},Timestamp.MAX_VALUE=Long.MAX_UNSIGNED_VALUE,Timestamp}(Long);function isBSONType(value){return isObjectLike(value)&&Reflect.has(value,"_bsontype")&&"string"==typeof value._bsontype}var keysToCodecs={$oid:ObjectId,$binary:Binary,$uuid:Binary,$symbol:BSONSymbol,$numberInt:Int32,$numberDecimal:Decimal128,$numberDouble:Double,$numberLong:Long,$minKey:MinKey,$maxKey:MaxKey,$regex:BSONRegExp,$regularExpression:BSONRegExp,$timestamp:Timestamp};function deserializeValue(value,options){if(void 0===options&&(options={}),"number"==typeof value){if(options.relaxed||options.legacy)return value;if(Math.floor(value)===value){if(value>=-2147483648&&value<=2147483647)return new Int32(value);if(value>=-0x8000000000000000&&value<=0x8000000000000000)return Long.fromNumber(value)}return new Double(value)}if(null==value||"object"!=typeof value)return value;if(value.$undefined)return null;for(var keys=Object.keys(value).filter((function(k){return k.startsWith("$")&&null!=value[k]})),i=0;i<keys.length;i++){var c=keysToCodecs[keys[i]];if(c)return c.fromExtendedJSON(value,options)}if(null!=value.$date){var d=value.$date,date=new Date;return options.legacy?"number"==typeof d?date.setTime(d):"string"==typeof d&&date.setTime(Date.parse(d)):"string"==typeof d?date.setTime(Date.parse(d)):Long.isLong(d)?date.setTime(d.toNumber()):"number"==typeof d&&options.relaxed&&date.setTime(d),date}if(null!=value.$code){var copy=Object.assign({},value);return value.$scope&&(copy.$scope=deserializeValue(value.$scope)),Code.fromExtendedJSON(value)}if(isDBRefLike(value)||value.$dbPointer){var v=value.$ref?value:value.$dbPointer;if(v instanceof DBRef)return v;var dollarKeys=Object.keys(v).filter((function(k){return k.startsWith("$")})),valid_1=!0;if(dollarKeys.forEach((function(k){-1===["$ref","$id","$db"].indexOf(k)&&(valid_1=!1)})),valid_1)return DBRef.fromExtendedJSON(v)}return value}function getISOString(date){var isoStr=date.toISOString();return 0!==date.getUTCMilliseconds()?isoStr:isoStr.slice(0,-5)+"Z"}function serializeValue(value,options){if(("object"==typeof value||"function"==typeof value)&&null!==value){var index=options.seenObjects.findIndex((function(entry){return entry.obj===value}));if(-1!==index){var props=options.seenObjects.map((function(entry){return entry.propertyName})),leadingPart=props.slice(0,index).map((function(prop){return"".concat(prop," -> ")})).join(""),alreadySeen=props[index],circularPart=" -> "+props.slice(index+1,props.length-1).map((function(prop){return"".concat(prop," -> ")})).join(""),current=props[props.length-1],leadingSpace=" ".repeat(leadingPart.length+alreadySeen.length/2),dashes="-".repeat(circularPart.length+(alreadySeen.length+current.length)/2-1);throw new BSONTypeError("Converting circular structure to EJSON:\n"+" ".concat(leadingPart).concat(alreadySeen).concat(circularPart).concat(current,"\n")+" ".concat(leadingSpace,"\\").concat(dashes,"/"))}options.seenObjects[options.seenObjects.length-1].obj=value}if(Array.isArray(value))return function serializeArray(array,options){return array.map((function(v,index){options.seenObjects.push({propertyName:"index ".concat(index),obj:null});try{return serializeValue(v,options)}finally{options.seenObjects.pop()}}))}(value,options);if(void 0===value)return null;if(value instanceof Date||isDate(value)){var dateNum=value.getTime(),inRange=dateNum>-1&&dateNum<2534023188e5;return options.legacy?options.relaxed&&inRange?{$date:value.getTime()}:{$date:getISOString(value)}:options.relaxed&&inRange?{$date:getISOString(value)}:{$date:{$numberLong:value.getTime().toString()}}}if(!("number"!=typeof value||options.relaxed&&isFinite(value))){if(Math.floor(value)===value){var int64Range=value>=-0x8000000000000000&&value<=0x8000000000000000;if(value>=-2147483648&&value<=2147483647)return{$numberInt:value.toString()};if(int64Range)return{$numberLong:value.toString()}}return{$numberDouble:value.toString()}}if(value instanceof RegExp||isRegExp(value)){var flags=value.flags;if(void 0===flags){var match=value.toString().match(/[gimuy]*$/);match&&(flags=match[0])}return new BSONRegExp(value.source,flags).toExtendedJSON(options)}return null!=value&&"object"==typeof value?function serializeDocument(doc,options){if(null==doc||"object"!=typeof doc)throw new BSONError("not an object instance");var bsontype=doc._bsontype;if(void 0===bsontype){var _doc={};for(var name in doc){options.seenObjects.push({propertyName:name,obj:null});try{var value=serializeValue(doc[name],options);"__proto__"===name?Object.defineProperty(_doc,name,{value:value,writable:!0,enumerable:!0,configurable:!0}):_doc[name]=value}finally{options.seenObjects.pop()}}return _doc}if(isBSONType(doc)){var outDoc=doc;if("function"!=typeof outDoc.toExtendedJSON){var mapper=BSON_TYPE_MAPPINGS[doc._bsontype];if(!mapper)throw new BSONTypeError("Unrecognized or invalid _bsontype: "+doc._bsontype);outDoc=mapper(outDoc)}return"Code"===bsontype&&outDoc.scope?outDoc=new Code(outDoc.code,serializeValue(outDoc.scope,options)):"DBRef"===bsontype&&outDoc.oid&&(outDoc=new DBRef(serializeValue(outDoc.collection,options),serializeValue(outDoc.oid,options),serializeValue(outDoc.db,options),serializeValue(outDoc.fields,options))),outDoc.toExtendedJSON(options)}throw new BSONError("_bsontype must be a string, but was: "+typeof bsontype)}(value,options):value}var EJSON,BSON_TYPE_MAPPINGS={Binary:function(o){return new Binary(o.value(),o.sub_type)},Code:function(o){return new Code(o.code,o.scope)},DBRef:function(o){return new DBRef(o.collection||o.namespace,o.oid,o.db,o.fields)},Decimal128:function(o){return new Decimal128(o.bytes)},Double:function(o){return new Double(o.value)},Int32:function(o){return new Int32(o.value)},Long:function(o){return Long.fromBits(null!=o.low?o.low:o.low_,null!=o.low?o.high:o.high_,null!=o.low?o.unsigned:o.unsigned_)},MaxKey:function(){return new MaxKey},MinKey:function(){return new MinKey},ObjectID:function(o){return new ObjectId(o)},ObjectId:function(o){return new ObjectId(o)},BSONRegExp:function(o){return new BSONRegExp(o.pattern,o.options)},Symbol:function(o){return new BSONSymbol(o.value)},Timestamp:function(o){return Timestamp.fromBits(o.low,o.high)}};!function(EJSON){function parse(text,options){var finalOptions=Object.assign({},{relaxed:!0,legacy:!1},options);return"boolean"==typeof finalOptions.relaxed&&(finalOptions.strict=!finalOptions.relaxed),"boolean"==typeof finalOptions.strict&&(finalOptions.relaxed=!finalOptions.strict),JSON.parse(text,(function(key,value){if(-1!==key.indexOf("\0"))throw new BSONError("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(key)));return deserializeValue(value,finalOptions)}))}function stringify(value,replacer,space,options){null!=space&&"object"==typeof space&&(options=space,space=0),null==replacer||"object"!=typeof replacer||Array.isArray(replacer)||(options=replacer,replacer=void 0,space=0);var doc=serializeValue(value,Object.assign({relaxed:!0,legacy:!1},options,{seenObjects:[{propertyName:"(root)",obj:null}]}));return JSON.stringify(doc,replacer,space)}EJSON.parse=parse,EJSON.stringify=stringify,EJSON.serialize=function serialize(value,options){return options=options||{},JSON.parse(stringify(value,options))},EJSON.deserialize=function deserialize(ejson,options){return options=options||{},parse(JSON.stringify(ejson),options)}}(EJSON||(EJSON={}));var bsonGlobal=getGlobal();bsonGlobal.Map?bsonGlobal.Map:function(){function Map(array){void 0===array&&(array=[]),this._keys=[],this._values={};for(var i=0;i<array.length;i++)if(null!=array[i]){var entry=array[i],key=entry[0],value=entry[1];this._keys.push(key),this._values[key]={v:value,i:this._keys.length-1}}}Map.prototype.clear=function(){this._keys=[],this._values={}},Map.prototype.delete=function(key){var value=this._values[key];return null!=value&&(delete this._values[key],this._keys.splice(value.i,1),!0)},Map.prototype.entries=function(){var _this=this,index=0;return{next:function(){var key=_this._keys[index++];return{value:void 0!==key?[key,_this._values[key].v]:void 0,done:void 0===key}}}},Map.prototype.forEach=function(callback,self){self=self||this;for(var i=0;i<this._keys.length;i++){var key=this._keys[i];callback.call(self,this._values[key].v,key,self)}},Map.prototype.get=function(key){return this._values[key]?this._values[key].v:void 0},Map.prototype.has=function(key){return null!=this._values[key]},Map.prototype.keys=function(){var _this=this,index=0;return{next:function(){var key=_this._keys[index++];return{value:void 0!==key?key:void 0,done:void 0===key}}}},Map.prototype.set=function(key,value){return this._values[key]?(this._values[key].v=value,this):(this._keys.push(key),this._values[key]={v:value,i:this._keys.length-1},this)},Map.prototype.values=function(){var _this=this,index=0;return{next:function(){var key=_this._keys[index++];return{value:void 0!==key?_this._values[key].v:void 0,done:void 0===key}}}},Object.defineProperty(Map.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0})}();Long.fromNumber(JS_INT_MAX),Long.fromNumber(JS_INT_MIN);new Set(["$db","$ref","$id","$clusterTime"]);var SPACE_FOR_FLOAT64=new Uint8Array(8);new DataView(SPACE_FOR_FLOAT64.buffer,SPACE_FOR_FLOAT64.byteOffset,SPACE_FOR_FLOAT64.byteLength);buffer_1.alloc(17825792);var __spreadArray=function(to,from,pack){if(pack||2===arguments.length)for(var ar,i=0,l=from.length;i<l;i++)!ar&&i in from||(ar||(ar=Array.prototype.slice.call(from,0,i)),ar[i]=from[i]);return to.concat(ar||Array.prototype.slice.call(from))},BrowserInfo=function BrowserInfo(name,version,os){this.name=name,this.version=version,this.os=os,this.type="browser"},NodeInfo=function NodeInfo(version){this.version=version,this.type="node",this.name="node",this.os=process.platform},SearchBotDeviceInfo=function SearchBotDeviceInfo(name,version,os,bot){this.name=name,this.version=version,this.os=os,this.bot=bot,this.type="bot-device"},BotInfo=function BotInfo(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null},ReactNativeInfo=function ReactNativeInfo(){this.type="react-native",this.name="react-native",this.version=null,this.os=null},SEARCHBOT_OS_REGEX=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,userAgentRules=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],operatingSystemRules=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function parseUserAgent(ua){var matchedRule=function matchUserAgent(ua){return""!==ua&&userAgentRules.reduce((function(matched,_a){var browser=_a[0],regex=_a[1];if(matched)return matched;var uaMatch=regex.exec(ua);return!!uaMatch&&[browser,uaMatch]}),!1)}(ua);if(!matchedRule)return null;var name=matchedRule[0],match=matchedRule[1];if("searchbot"===name)return new BotInfo;var versionParts=match[1]&&match[1].split(".").join("_").split("_").slice(0,3);versionParts?versionParts.length<3&&(versionParts=__spreadArray(__spreadArray([],versionParts,!0),function createVersionParts(count){for(var output=[],ii=0;ii<count;ii++)output.push("0");return output}(3-versionParts.length),!0)):versionParts=[];var version=versionParts.join("."),os=function detectOS(ua){for(var ii=0,count=operatingSystemRules.length;ii<count;ii++){var _a=operatingSystemRules[ii],os=_a[0];if(_a[1].exec(ua))return os}return null}(ua),searchBotMatch=SEARCHBOT_OS_REGEX.exec(ua);return searchBotMatch&&searchBotMatch[1]?new SearchBotDeviceInfo(name,version,os,searchBotMatch[1]):new BrowserInfo(name,version,os)}class DefaultNetworkTransport{constructor(){if(!DefaultNetworkTransport.fetch)throw new Error("DefaultNetworkTransport.fetch must be set before it's used");if(!DefaultNetworkTransport.AbortController)throw new Error("DefaultNetworkTransport.AbortController must be set before it's used")}fetchWithCallbacks(request,handler){this.fetch(request).then((async response=>{const decodedBody=await response.text(),responseHeaders={};return response.headers.forEach(((value,key)=>{responseHeaders[key]=value})),{statusCode:response.status,headers:responseHeaders,body:decodedBody}})).then((r=>handler.onSuccess(r))).catch((e=>handler.onError(e)))}async fetch(request){const{timeoutMs:timeoutMs,url:url,...rest}=request,{signal:signal,cancelTimeout:cancelTimeout}=this.createTimeoutSignal(timeoutMs);try{return await DefaultNetworkTransport.fetch(url,{...DefaultNetworkTransport.extraFetchOptions,signal:signal,...rest})}finally{cancelTimeout()}}createTimeoutSignal(timeoutMs){if("number"==typeof timeoutMs){const controller=new DefaultNetworkTransport.AbortController,timeout=setTimeout((()=>{controller.abort()}),timeoutMs);return{signal:controller.signal,cancelTimeout:()=>{clearTimeout(timeout)}}}return{signal:void 0,cancelTimeout:()=>{}}}}DefaultNetworkTransport.DEFAULT_HEADERS={"Content-Type":"application/json"};const check=function(it){return it&&it.Math==Math&&it},safeGlobalThis=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof __webpack_require__.g&&__webpack_require__.g)||function(){return this}()||Function("return this")();"undefined"!=typeof __DEV__&&__DEV__,DefaultNetworkTransport.fetch=safeGlobalThis.fetch.bind(safeGlobalThis),DefaultNetworkTransport.AbortController=safeGlobalThis.AbortController.bind(safeGlobalThis);const _hasatob="function"==typeof atob,_hasbtoa="function"==typeof btoa,_hasBuffer="function"==typeof Buffer,_TD="function"==typeof TextDecoder?new TextDecoder:void 0,_TE="function"==typeof TextEncoder?new TextEncoder:void 0,b64chs=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),b64tab=(a=>{let tab={};return a.forEach(((c,i)=>tab[c]=i)),tab})(b64chs),b64re=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,_fromCC=String.fromCharCode.bind(String),_U8Afrom="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):(it,fn=(x=>x))=>new Uint8Array(Array.prototype.slice.call(it,0).map(fn)),_mkUriSafe=src=>src.replace(/=/g,"").replace(/[+\/]/g,(m0=>"+"==m0?"-":"_")),_tidyB64=s=>s.replace(/[^A-Za-z0-9\+\/]/g,""),btoaPolyfill=bin=>{let u32,c0,c1,c2,asc="";const pad=bin.length%3;for(let i=0;i<bin.length;){if((c0=bin.charCodeAt(i++))>255||(c1=bin.charCodeAt(i++))>255||(c2=bin.charCodeAt(i++))>255)throw new TypeError("invalid character found");u32=c0<<16|c1<<8|c2,asc+=b64chs[u32>>18&63]+b64chs[u32>>12&63]+b64chs[u32>>6&63]+b64chs[63&u32]}return pad?asc.slice(0,pad-3)+"===".substring(pad):asc},_btoa=_hasbtoa?bin=>btoa(bin):_hasBuffer?bin=>Buffer.from(bin,"binary").toString("base64"):btoaPolyfill,_fromUint8Array=_hasBuffer?u8a=>Buffer.from(u8a).toString("base64"):u8a=>{let strs=[];for(let i=0,l=u8a.length;i<l;i+=4096)strs.push(_fromCC.apply(null,u8a.subarray(i,i+4096)));return _btoa(strs.join(""))},cb_utob=c=>{if(c.length<2)return(cc=c.charCodeAt(0))<128?c:cc<2048?_fromCC(192|cc>>>6)+_fromCC(128|63&cc):_fromCC(224|cc>>>12&15)+_fromCC(128|cc>>>6&63)+_fromCC(128|63&cc);var cc=65536+1024*(c.charCodeAt(0)-55296)+(c.charCodeAt(1)-56320);return _fromCC(240|cc>>>18&7)+_fromCC(128|cc>>>12&63)+_fromCC(128|cc>>>6&63)+_fromCC(128|63&cc)},re_utob=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,utob=u=>u.replace(re_utob,cb_utob),_encode=_hasBuffer?s=>Buffer.from(s,"utf8").toString("base64"):_TE?s=>_fromUint8Array(_TE.encode(s)):s=>_btoa(utob(s)),encode=(src,urlsafe=!1)=>urlsafe?_mkUriSafe(_encode(src)):_encode(src),re_btou=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,cb_btou=cccc=>{switch(cccc.length){case 4:var offset=((7&cccc.charCodeAt(0))<<18|(63&cccc.charCodeAt(1))<<12|(63&cccc.charCodeAt(2))<<6|63&cccc.charCodeAt(3))-65536;return _fromCC(55296+(offset>>>10))+_fromCC(56320+(1023&offset));case 3:return _fromCC((15&cccc.charCodeAt(0))<<12|(63&cccc.charCodeAt(1))<<6|63&cccc.charCodeAt(2));default:return _fromCC((31&cccc.charCodeAt(0))<<6|63&cccc.charCodeAt(1))}},btou=b=>b.replace(re_btou,cb_btou),atobPolyfill=asc=>{if(asc=asc.replace(/\s+/g,""),!b64re.test(asc))throw new TypeError("malformed base64.");asc+="==".slice(2-(3&asc.length));let u24,r1,r2,bin="";for(let i=0;i<asc.length;)u24=b64tab[asc.charAt(i++)]<<18|b64tab[asc.charAt(i++)]<<12|(r1=b64tab[asc.charAt(i++)])<<6|(r2=b64tab[asc.charAt(i++)]),bin+=64===r1?_fromCC(u24>>16&255):64===r2?_fromCC(u24>>16&255,u24>>8&255):_fromCC(u24>>16&255,u24>>8&255,255&u24);return bin},_atob=_hasatob?asc=>atob(_tidyB64(asc)):_hasBuffer?asc=>Buffer.from(asc,"base64").toString("binary"):atobPolyfill,_toUint8Array=_hasBuffer?a=>_U8Afrom(Buffer.from(a,"base64")):a=>_U8Afrom(_atob(a),(c=>c.charCodeAt(0))),_decode=_hasBuffer?a=>Buffer.from(a,"base64").toString("utf8"):_TD?a=>_TD.decode(_toUint8Array(a)):a=>btou(_atob(a)),_unURI=a=>_tidyB64(a.replace(/[-_]/g,(m0=>"-"==m0?"+":"/"))),decode=src=>_decode(_unURI(src)),gBase64_encode=encode,gBase64_decode=decode,SERIALIZATION_OPTIONS={relaxed:!1};function bundle_dom_es_serialize(obj){return EJSON.serialize(obj,SERIALIZATION_OPTIONS)}function bundle_dom_es_deserialize(obj){return Array.isArray(obj)?obj.map((doc=>EJSON.deserialize(doc))):EJSON.deserialize(obj)}var UserType,DataKey;!function(UserType){UserType.Normal="normal",UserType.Server="server"}(UserType||(UserType={})),function(DataKey){DataKey.NAME="name",DataKey.EMAIL="email",DataKey.PICTURE="picture",DataKey.FIRST_NAME="first_name",DataKey.LAST_NAME="last_name",DataKey.GENDER="gender",DataKey.BIRTHDAY="birthday",DataKey.MIN_AGE="min_age",DataKey.MAX_AGE="max_age"}(DataKey||(DataKey={}));const DATA_MAPPING={[DataKey.NAME]:"name",[DataKey.EMAIL]:"email",[DataKey.PICTURE]:"pictureUrl",[DataKey.FIRST_NAME]:"firstName",[DataKey.LAST_NAME]:"lastName",[DataKey.GENDER]:"gender",[DataKey.BIRTHDAY]:"birthday",[DataKey.MIN_AGE]:"minAge",[DataKey.MAX_AGE]:"maxAge"};class UserProfile{constructor(response){if(this.type=UserType.Normal,this.identities=[],"object"==typeof response&&null!==response){const{type:type,identities:identities,data:data}=response;if("string"!=typeof type)throw new Error("Expected 'type' in the response body");if(this.type=type,!Array.isArray(identities))throw new Error("Expected 'identities' in the response body");if(this.identities=identities.map((identity=>{const{id:id,provider_type:providerType}=identity;return{id:id,providerType:providerType}})),"object"!=typeof data||null===data)throw new Error("Expected 'data' in the response body");{const mappedData=Object.fromEntries(Object.entries(data).map((([key,value])=>key in DATA_MAPPING?[DATA_MAPPING[key],value]:[key,value])));this.data=bundle_dom_es_deserialize(mappedData)}}else this.data={}}}class PrefixedStorage{constructor(storage,keyPart){this.storage=storage,this.keyPart=keyPart}get(key){return this.storage.get(this.keyPart+PrefixedStorage.PART_SEPARATOR+key)}set(key,value){return this.storage.set(this.keyPart+PrefixedStorage.PART_SEPARATOR+key,value)}remove(key){return this.storage.remove(this.keyPart+PrefixedStorage.PART_SEPARATOR+key)}prefix(keyPart){return new PrefixedStorage(this,keyPart)}clear(prefix=""){return this.storage.clear(this.keyPart+PrefixedStorage.PART_SEPARATOR+prefix)}addListener(listener){return this.storage.addListener(listener)}removeListener(listener){return this.storage.addListener(listener)}}PrefixedStorage.PART_SEPARATOR=":";class UserStorage extends PrefixedStorage{constructor(storage,userId){super(storage,`user(${userId})`)}get accessToken(){return this.get("accessToken")}set accessToken(value){null===value?this.remove("accessToken"):this.set("accessToken",value)}get refreshToken(){return this.get("refreshToken")}set refreshToken(value){null===value?this.remove("refreshToken"):this.set("refreshToken",value)}get profile(){const value=this.get("profile");if(value){const profile=new UserProfile;return Object.assign(profile,JSON.parse(value)),profile}}set profile(value){value?this.set("profile",JSON.stringify(value)):this.remove("profile")}get providerType(){const value=this.get("providerType");if(value)return value}set providerType(value){value?this.set("providerType",value):this.remove("providerType")}}function removeKeysWithUndefinedValues(obj){return Object.fromEntries(Object.entries(obj).filter((entry=>void 0!==entry[1])))}function encodeQueryString(params,prefixed=!0){const cleanedParams=removeKeysWithUndefinedValues(params);return(prefixed&&Object.keys(cleanedParams).length>0?"?":"")+Object.entries(cleanedParams).map((([k,v])=>`${k}=${encodeURIComponent(v)}`)).join("&")}const RESERVED_NAMES=["inspect","callFunction","callFunctionStreaming",...Object.getOwnPropertyNames(Object.prototype)];function cleanArgsAndSerialize(args){const cleaned=function cleanArgs(args){for(const arg of args)if("object"==typeof arg&&arg)for(const[key,value]of Object.entries(arg))void 0===value&&delete arg[key];return args}(args);return cleaned.map((arg=>"object"==typeof arg?bundle_dom_es_serialize(arg):arg))}class FunctionsFactory{constructor(fetcher,config={}){this.fetcher=fetcher,this.serviceName=config.serviceName,this.argsTransformation=config.argsTransformation||cleanArgsAndSerialize}static create(fetcher,config={}){const factory=new FunctionsFactory(fetcher,config);return new Proxy(factory,{get(target,p,receiver){if("string"==typeof p&&-1===RESERVED_NAMES.indexOf(p))return target.callFunction.bind(target,p);{const prop=Reflect.get(target,p,receiver);return"function"==typeof prop?prop.bind(target):prop}}})}async callFunction(name,...args){const body={name:name,arguments:this.argsTransformation?this.argsTransformation(args):args};this.serviceName&&(body.service=this.serviceName);const appRoute=this.fetcher.appRoute;return this.fetcher.fetchJSON({method:"POST",path:appRoute.functionsCall().path,body:body})}callFunctionStreaming(name,...args){const body={name:name,arguments:this.argsTransformation?this.argsTransformation(args):args};this.serviceName&&(body.service=this.serviceName);const appRoute=this.fetcher.appRoute,qs=encodeQueryString({baas_request:gBase64_encode(JSON.stringify(body))});return this.fetcher.fetchStream({method:"GET",path:appRoute.functionsCall().path+qs})}}class EmailPasswordAuth{constructor(fetcher,providerName="local-userpass"){this.fetcher=fetcher,this.providerName=providerName}async registerUser(details){const appRoute=this.fetcher.appRoute;await this.fetcher.fetchJSON({method:"POST",path:appRoute.emailPasswordAuth(this.providerName).register().path,body:details})}async confirmUser(details){const appRoute=this.fetcher.appRoute;await this.fetcher.fetchJSON({method:"POST",path:appRoute.emailPasswordAuth(this.providerName).confirm().path,body:details})}async resendConfirmationEmail(details){const appRoute=this.fetcher.appRoute;await this.fetcher.fetchJSON({method:"POST",path:appRoute.emailPasswordAuth(this.providerName).confirmSend().path,body:details})}async retryCustomConfirmation(details){const appRoute=this.fetcher.appRoute;await this.fetcher.fetchJSON({method:"POST",path:appRoute.emailPasswordAuth(this.providerName).confirmCall().path,body:details})}async resetPassword(details){const appRoute=this.fetcher.appRoute;await this.fetcher.fetchJSON({method:"POST",path:appRoute.emailPasswordAuth(this.providerName).reset().path,body:details})}async sendResetPasswordEmail(details){const appRoute=this.fetcher.appRoute;await this.fetcher.fetchJSON({method:"POST",path:appRoute.emailPasswordAuth(this.providerName).resetSend().path,body:details})}async callResetPasswordFunction(details,...args){const appRoute=this.fetcher.appRoute;await this.fetcher.fetchJSON({method:"POST",path:appRoute.emailPasswordAuth(this.providerName).resetCall().path,body:{...details,arguments:args}})}}var routes={api:function api(){return{path:"/api/client/v2.0",app(appId){return{path:this.path+`/app/${appId}`,location(){return{path:this.path+"/location"}},authProvider(providerName){return{path:this.path+`/auth/providers/${providerName}`,login(){return{path:this.path+"/login"}}}},emailPasswordAuth(providerName){return{...this.authProvider(providerName),register(){return{path:this.path+"/register"}},confirm(){return{path:this.path+"/confirm"}},confirmSend(){return{path:this.path+"/confirm/send"}},confirmCall(){return{path:this.path+"/confirm/call"}},reset(){return{path:this.path+"/reset"}},resetSend(){return{path:this.path+"/reset/send"}},resetCall(){return{path:this.path+"/reset/call"}}}},functionsCall(){return{path:this.path+"/functions/call"}}}},auth(){return{path:this.path+"/auth",apiKeys(){return{path:this.path+"/api_keys",key(id){return{path:this.path+`/${id}`,enable(){return{path:this.path+"/enable"}},disable(){return{path:this.path+"/disable"}}}}}},profile(){return{path:this.path+"/profile"}},session(){return{path:this.path+"/session"}},delete(){return{path:this.path+"/delete"}}}}}}};class ApiKeyAuth{constructor(fetcher){this.fetcher=fetcher}create(name){return this.fetcher.fetchJSON({method:"POST",body:{name:name},path:routes.api().auth().apiKeys().path,tokenType:"refresh"})}fetch(keyId){return this.fetcher.fetchJSON({method:"GET",path:routes.api().auth().apiKeys().key(keyId).path,tokenType:"refresh"})}fetchAll(){return this.fetcher.fetchJSON({method:"GET",tokenType:"refresh",path:routes.api().auth().apiKeys().path})}async delete(keyId){await this.fetcher.fetchJSON({method:"DELETE",path:routes.api().auth().apiKeys().key(keyId).path,tokenType:"refresh"})}async enable(keyId){await this.fetcher.fetchJSON({method:"PUT",path:routes.api().auth().apiKeys().key(keyId).enable().path,tokenType:"refresh"})}async disable(keyId){await this.fetcher.fetchJSON({method:"PUT",path:routes.api().auth().apiKeys().key(keyId).disable().path,tokenType:"refresh"})}}let environment=null;function getEnvironment(){if(environment)return environment;throw new Error("Cannot get environment before it's set")}class WatchError extends Error{constructor({message:message,code:code}){super(message),this.name="WatchError",this.code=code}}var WatchStreamState;!function(WatchStreamState){WatchStreamState.NEED_DATA="NEED_DATA",WatchStreamState.HAVE_EVENT="HAVE_EVENT",WatchStreamState.HAVE_ERROR="HAVE_ERROR"}(WatchStreamState||(WatchStreamState={}));class WatchStream{constructor(){this._state=WatchStreamState.NEED_DATA,this._error=null,this._textDecoder=new(getEnvironment().TextDecoder),this._buffer="",this._bufferOffset=0,this._eventType="",this._dataBuffer=""}feedBuffer(buffer){this.assertState(WatchStreamState.NEED_DATA),this._buffer+=this._textDecoder.decode(buffer,{stream:!0}),this.advanceBufferState()}feedLine(line){if(this.assertState(WatchStreamState.NEED_DATA),line.endsWith("\n")&&(line=line.substr(0,line.length-1)),line.endsWith("\r")&&(line=line.substr(0,line.length-1)),0===line.length){if(0===this._dataBuffer.length)return void(this._eventType="");this._dataBuffer.endsWith("\n")&&(this._dataBuffer=this._dataBuffer.substr(0,this._dataBuffer.length-1)),this.feedSse({data:this._dataBuffer,eventType:this._eventType}),this._dataBuffer="",this._eventType=""}if(":"===line[0])return;const colon=line.indexOf(":"),field=line.substr(0,colon);let value=-1===colon?"":line.substr(colon+1);value.startsWith(" ")&&(value=value.substr(1)),"event"===field?this._eventType=value:"data"===field&&(this._dataBuffer+=value,this._dataBuffer+="\n")}feedSse(sse){this.assertState(WatchStreamState.NEED_DATA);const firstPercentIndex=sse.data.indexOf("%");if(-1!==firstPercentIndex){let buffer="",start=0;for(let percentIndex=firstPercentIndex;-1!==percentIndex;percentIndex=sse.data.indexOf("%",start)){buffer+=sse.data.substr(start,percentIndex-start);const encoded=sse.data.substr(percentIndex,3);buffer+="%25"===encoded?"%":"%0A"===encoded?"\n":"%0D"===encoded?"\r":encoded,start=percentIndex+encoded.length}buffer+=sse.data.substr(start),sse.data=buffer}if(sse.eventType&&"message"!==sse.eventType){if("error"===sse.eventType){this._state=WatchStreamState.HAVE_ERROR,this._error=new WatchError({message:sse.data,code:"unknown"});try{const{error_code:errorCode,error:error}=EJSON.parse(sse.data);if("string"!=typeof errorCode)return;if("string"!=typeof error)return;this._error=new WatchError({message:error,code:errorCode})}catch{return}}}else{try{const parsed=EJSON.parse(sse.data);if("object"==typeof parsed)return this._nextEvent=parsed,void(this._state=WatchStreamState.HAVE_EVENT)}catch{}this._state=WatchStreamState.HAVE_ERROR,this._error=new WatchError({message:"server returned malformed event: "+sse.data,code:"bad bson parse"})}}get state(){return this._state}nextEvent(){this.assertState(WatchStreamState.HAVE_EVENT);const out=this._nextEvent;return this._state=WatchStreamState.NEED_DATA,this.advanceBufferState(),out}get error(){return this._error}advanceBufferState(){for(this.assertState(WatchStreamState.NEED_DATA);this.state===WatchStreamState.NEED_DATA;){if(this._bufferOffset===this._buffer.length)return this._buffer="",void(this._bufferOffset=0);const nextNewlineIndex=this._buffer.indexOf("\n",this._bufferOffset);if(-1===nextNewlineIndex)return void(0!==this._bufferOffset&&(this._buffer=this._buffer.substr(this._bufferOffset,this._buffer.length-this._bufferOffset),this._bufferOffset=0));this.feedLine(this._buffer.substr(this._bufferOffset,nextNewlineIndex-this._bufferOffset)),this._bufferOffset=nextNewlineIndex+1}}assertState(state){if(this._state!==state)throw Error(`Expected WatchStream to be in state ${state}, but in state ${this._state}`)}}class MongoDBCollection{constructor(fetcher,serviceName,databaseName,collectionName){this.functions=FunctionsFactory.create(fetcher,{serviceName:serviceName}),this.databaseName=databaseName,this.collectionName=collectionName,this.serviceName=serviceName,this.fetcher=fetcher}find(filter={},options={}){return this.functions.find({database:this.databaseName,collection:this.collectionName,query:filter,project:options.projection,sort:options.sort,limit:options.limit})}findOne(filter={},options={}){return this.functions.findOne({database:this.databaseName,collection:this.collectionName,query:filter,project:options.projection,sort:options.sort})}findOneAndUpdate(filter={},update,options={}){return this.functions.findOneAndUpdate({database:this.databaseName,collection:this.collectionName,filter:filter,update:update,sort:options.sort,projection:options.projection,upsert:options.upsert,returnNewDocument:options.returnNewDocument})}findOneAndReplace(filter={},replacement,options={}){return this.functions.findOneAndReplace({database:this.databaseName,collection:this.collectionName,filter:filter,update:replacement,sort:options.sort,projection:options.projection,upsert:options.upsert,returnNewDocument:options.returnNewDocument})}findOneAndDelete(filter={},options={}){return this.functions.findOneAndReplace({database:this.databaseName,collection:this.collectionName,filter:filter,sort:options.sort,projection:options.projection})}aggregate(pipeline){return this.functions.aggregate({database:this.databaseName,collection:this.collectionName,pipeline:pipeline})}count(filter={},options={}){return this.functions.count({database:this.databaseName,collection:this.collectionName,query:filter,limit:options.limit})}insertOne(document){return this.functions.insertOne({database:this.databaseName,collection:this.collectionName,document:document})}insertMany(documents){return this.functions.insertMany({database:this.databaseName,collection:this.collectionName,documents:documents})}deleteOne(filter={}){return this.functions.deleteOne({database:this.databaseName,collection:this.collectionName,query:filter})}deleteMany(filter={}){return this.functions.deleteMany({database:this.databaseName,collection:this.collectionName,query:filter})}updateOne(filter,update,options={}){return this.functions.updateOne({database:this.databaseName,collection:this.collectionName,query:filter,update:update,upsert:options.upsert,arrayFilters:options.arrayFilters})}updateMany(filter,update,options={}){return this.functions.updateMany({database:this.databaseName,collection:this.collectionName,query:filter,update:update,upsert:options.upsert,arrayFilters:options.arrayFilters})}watch({ids:ids,filter:filter}={}){const iterator=this.functions.callFunctionStreaming("watch",{database:this.databaseName,collection:this.collectionName,ids:ids,filter:filter}).then((i=>i[Symbol.asyncIterator]())),stream=this.watchImpl(iterator),originalReturn=stream.return;return Object.assign(stream,{return(value){return iterator.then((i=>i.return?i.return(value):void 0)),originalReturn.call(stream,value)}})}async*watchImpl(iterator){const watchStream=new WatchStream,iterable=iterator.then((i=>({[Symbol.asyncIterator]:()=>i})));for await(const chunk of await iterable)if(chunk){for(watchStream.feedBuffer(chunk);watchStream.state==WatchStreamState.HAVE_EVENT;)yield watchStream.nextEvent();if(watchStream.state==WatchStreamState.HAVE_ERROR)throw watchStream.error}}}function createCollection(fetcher,serviceName,databaseName,collectionName){return new MongoDBCollection(fetcher,serviceName,databaseName,collectionName)}function createDatabase(fetcher,serviceName,databaseName){return{collection:createCollection.bind(null,fetcher,serviceName,databaseName)}}var UserState,UserType$1;!function(UserState){UserState.Active="active",UserState.LoggedOut="logged-out",UserState.Removed="removed"}(UserState||(UserState={})),function(UserType){UserType.Normal="normal",UserType.Server="server"}(UserType$1||(UserType$1={}));class User{constructor(parameters){if(this.app=parameters.app,this.id=parameters.id,this.storage=new UserStorage(this.app.storage,this.id),"accessToken"in parameters&&"refreshToken"in parameters&&"providerType"in parameters)this._accessToken=parameters.accessToken,this._refreshToken=parameters.refreshToken,this.providerType=parameters.providerType,this.storage.accessToken=parameters.accessToken,this.storage.refreshToken=parameters.refreshToken,this.storage.providerType=parameters.providerType;else{this._accessToken=this.storage.accessToken,this._refreshToken=this.storage.refreshToken;const providerType=this.storage.providerType;if(this._profile=this.storage.profile,!providerType)throw new Error("Storage is missing a provider type");this.providerType=providerType}this.fetcher=this.app.fetcher.clone({userContext:{currentUser:this}}),this.apiKeys=new ApiKeyAuth(this.fetcher),this.functions=FunctionsFactory.create(this.fetcher)}get accessToken(){return this._accessToken}set accessToken(token){this._accessToken=token,this.storage.accessToken=token}get refreshToken(){return this._refreshToken}set refreshToken(token){this._refreshToken=token,this.storage.refreshToken=token}get state(){return this.id in this.app.allUsers?null===this.refreshToken?UserState.LoggedOut:UserState.Active:UserState.Removed}get isLoggedIn(){return this.state===UserState.Active}get customData(){if(this.accessToken){return this.decodeAccessToken().userData}throw new Error("Cannot read custom data without an access token")}get profile(){if(this._profile)return this._profile.data;throw new Error("A profile was never fetched for this user")}get identities(){if(this._profile)return this._profile.identities;throw new Error("A profile was never fetched for this user")}get deviceId(){if(this.accessToken){const payload=this.accessToken.split(".")[1];if(payload){const deviceId=JSON.parse(gBase64_decode(payload)).baas_device_id;if("string"==typeof deviceId&&"000000000000000000000000"!==deviceId)return deviceId}}return null}async refreshProfile(){const response=await this.fetcher.fetchJSON({method:"GET",path:routes.api().auth().profile().path});this._profile=new UserProfile(response),this.storage.profile=this._profile}async logOut(){try{null!==this._refreshToken&&await this.fetcher.fetchJSON({method:"DELETE",path:routes.api().auth().session().path,tokenType:"refresh"})}catch(err){if(!(err instanceof Error&&err.message.includes("failed to find refresh token")))throw err}finally{this.accessToken=null,this.refreshToken=null}}async linkCredentials(credentials){const response=await this.app.authenticator.authenticate(credentials,this);if(this.id!==response.userId){const details=`got user id ${response.userId} expected ${this.id}`;throw new Error(`Link response ment for another user (${details})`)}this.accessToken=response.accessToken,await this.refreshProfile()}async refreshAccessToken(){const response=await this.fetcher.fetchJSON({method:"POST",path:routes.api().auth().session().path,tokenType:"refresh"}),{access_token:accessToken}=response;if("string"!=typeof accessToken)throw new Error("Expected an 'access_token' in the response");this.accessToken=accessToken}async refreshCustomData(){return await this.refreshAccessToken(),this.customData}addListener(){throw new Error("Not yet implemented")}removeListener(){throw new Error("Not yet implemented")}removeAllListeners(){throw new Error("Not yet implemented")}callFunction(name,...args){return this.functions.callFunction(name,...args)}toJSON(){return{id:this.id,accessToken:this.accessToken,refreshToken:this.refreshToken,profile:this._profile,state:this.state,customData:this.customData}}push(){throw new Error("Not yet implemented")}mongoClient(serviceName){return function createService(fetcher,serviceName="mongo-db"){return{db:createDatabase.bind(null,fetcher,serviceName)}}(this.fetcher,serviceName)}decodeAccessToken(){if(this.accessToken){const parts=this.accessToken.split(".");if(3!==parts.length)throw new Error("Expected an access token with three parts");const encodedPayload=parts[1],decodedPayload=gBase64_decode(encodedPayload),parsedPayload=JSON.parse(decodedPayload),{exp:expires,iat:issuedAt,sub:subject,user_data:userData={}}=parsedPayload;if("number"!=typeof expires)throw new Error("Failed to decode access token 'exp'");if("number"!=typeof issuedAt)throw new Error("Failed to decode access token 'iat'");return{expires:expires,issuedAt:issuedAt,subject:subject,userData:userData}}throw new Error("Missing an access token")}}class Credentials{constructor(providerName,providerType,payload){this.providerName=providerName,this.providerType=providerType,this.payload=payload}static anonymous(){return new Credentials("anon-user","anon-user",{})}static apiKey(key){return new Credentials("api-key","api-key",{key:key})}static emailPassword(email,password){return new Credentials("local-userpass","local-userpass",{username:email,password:password})}static function(payload){return new Credentials("custom-function","custom-function",payload)}static jwt(token){return new Credentials("custom-token","custom-token",{token:token})}static google(payload){return new Credentials("oauth2-google","oauth2-google",Credentials.derivePayload(payload))}static derivePayload(payload){if("string"==typeof payload)throw new Error("`google(<tokenString>)` has been deprecated. Please use `google(<authCodeObject>).");if(1===Object.keys(payload).length){if("authCode"in payload||"redirectUrl"in payload)return payload;if("idToken"in payload)return{id_token:payload.idToken};throw new Error("Unexpected payload: "+JSON.stringify(payload))}throw new Error("Expected only one property in payload, got "+JSON.stringify(payload))}static facebook(redirectUrlOrAccessToken){return new Credentials("oauth2-facebook","oauth2-facebook",redirectUrlOrAccessToken.includes("://")?{redirectUrl:redirectUrlOrAccessToken}:{accessToken:redirectUrlOrAccessToken})}static apple(redirectUrlOrIdToken){return new Credentials("oauth2-apple","oauth2-apple",redirectUrlOrIdToken.includes("://")?{redirectUrl:redirectUrlOrIdToken}:{id_token:redirectUrlOrIdToken})}}class AppStorage extends PrefixedStorage{constructor(storage,appId){super(storage,`app(${appId})`)}getUserIds(){const userIdsString=this.get("userIds"),userIds=userIdsString?JSON.parse(userIdsString):[];if(Array.isArray(userIds))return[...new Set(userIds)];throw new Error("Expected the user ids to be an array")}setUserIds(userIds,mergeWithExisting){if(mergeWithExisting){const existingIds=this.getUserIds();for(const id of existingIds)-1===userIds.indexOf(id)&&userIds.push(id)}this.set("userIds",JSON.stringify(userIds))}removeUserId(userId){const userIds=this.getUserIds().filter((id=>id!==userId));this.setUserIds(userIds,!1)}getDeviceId(){return this.get("deviceId")}setDeviceId(deviceId){this.set("deviceId",deviceId)}}const REDIRECT_HASH_TO_RESULT={_stitch_client_app_id:"appId",_baas_client_app_id:"appId",_stitch_ua:"userAuth",_baas_ua:"userAuth",_stitch_link:"link",_baas_link:"link",_stitch_error:"error",_baas_error:"error",_stitch_state:"state",_baas_state:"state"};class OAuth2Helper{constructor(storage,openWindow=getEnvironment().openWindow){this.storage=storage.prefix("oauth2"),this.openWindow=openWindow}static parseRedirectLocation(queryString){const params=function decodeQueryString(str){const cleanStr="?"===str[0]?str.substr(1):str;return Object.fromEntries(cleanStr.split("&").filter((s=>s.length>0)).map((kvp=>kvp.split("="))).map((([k,v])=>[k,decodeURIComponent(v)])))}(queryString),result={};for(const[p,r]of Object.entries(REDIRECT_HASH_TO_RESULT)){const value=params[p];value&&(result[r]=value)}return result}static handleRedirect(queryString,storage=getEnvironment().defaultStorage){const result=OAuth2Helper.parseRedirectLocation(queryString),{state:state,error:error}=result;if("string"!=typeof state)throw error?new Error(`Failed to handle OAuth 2.0 redirect: ${error}`):new Error("Failed to handle OAuth 2.0 redirect.");{const oauth2Storage=storage.prefix("oauth2");OAuth2Helper.getStateStorage(oauth2Storage,state).set("result",JSON.stringify(result))}}static decodeAuthInfo(authInfo){const parts=(authInfo||"").split("$");if(4===parts.length){const[accessToken,refreshToken,userId,deviceId]=parts;return{accessToken:accessToken,refreshToken:refreshToken,userId:userId,deviceId:deviceId}}throw new Error("Failed to decode 'authInfo' into ids and tokens")}static getStateStorage(storage,state){return storage.prefix(`state(${state})`)}openWindowAndWaitForRedirect(url,state){const stateStorage=OAuth2Helper.getStateStorage(this.storage,state);return new Promise(((resolve,reject)=>{let windowClosedInterval,redirectWindow=null;const handleStorageUpdate=()=>{const result=stateStorage.get("result");if(result){const parsedResult=JSON.parse(result);stateStorage.removeListener(handleStorageUpdate),stateStorage.clear();try{redirectWindow&&(clearInterval(windowClosedInterval),redirectWindow.close())}catch(err){console.warn(`Failed closing redirect window: ${err}`)}finally{resolve(parsedResult)}}};stateStorage.addListener(handleStorageUpdate),redirectWindow=this.openWindow(url),windowClosedInterval=setInterval((()=>{if(redirectWindow){if(redirectWindow.closed){clearInterval(windowClosedInterval),stateStorage.removeListener(handleStorageUpdate);const err=new Error("Window closed");reject(err)}}else clearInterval(windowClosedInterval)}),100)}))}generateState(){return function generateRandomString(length,alphabet){let result="";for(let i=0;i<length;i++)result+=alphabet[Math.floor(Math.random()*alphabet.length)];return result}(12,"abcdefghijklmnopqrstuvwxyz")}}class Authenticator{constructor(fetcher,storage,getDeviceInformation){this.fetcher=fetcher,this.oauth2=new OAuth2Helper(storage),this.getDeviceInformation=getDeviceInformation}async authenticate(credentials,linkingUser){const deviceInformation=this.getDeviceInformation(),isLinking="object"==typeof linkingUser;if(credentials.providerType.startsWith("oauth2")&&"string"==typeof credentials.payload.redirectUrl){const state=this.oauth2.generateState(),url=await this.getLogInUrl(credentials,isLinking,{state:state,redirect:credentials.payload.redirectUrl,providerRedirectHeader:!!isLinking||void 0,device:isLinking?void 0:deviceInformation.encode()});if(isLinking){const redirectUrl=(await this.fetcher.fetch({method:"GET",url:url,tokenType:isLinking?"access":"none",user:linkingUser,mode:"cors",credentials:"include"})).headers.get("x-baas-location");if(redirectUrl)return this.openWindowAndWaitForAuthResponse(redirectUrl,state);throw new Error("Missing x-baas-location header")}return this.openWindowAndWaitForAuthResponse(url,state)}{const logInUrl=await this.getLogInUrl(credentials,isLinking),response=await this.fetcher.fetchJSON({method:"POST",url:logInUrl,body:{...credentials.payload,options:{device:deviceInformation.toJSON()}},tokenType:isLinking?"access":"none",user:linkingUser}),{user_id:userId,access_token:accessToken,refresh_token:refreshToken=null,device_id:deviceId}=response;if("string"!=typeof userId)throw new Error("Expected a user id in the response");if("string"!=typeof accessToken)throw new Error("Expected an access token in the response");if("string"!=typeof refreshToken&&null!==refreshToken)throw new Error("Expected refresh token to be a string or null");if("string"!=typeof deviceId)throw new Error("Expected device id to be a string");return{userId:userId,accessToken:accessToken,refreshToken:refreshToken,deviceId:deviceId}}}async getLogInUrl(credentials,link=!1,extraQueryParams={}){const loginRoute=this.fetcher.appRoute.authProvider(credentials.providerName).login(),qs=encodeQueryString({link:link?"true":void 0,...extraQueryParams});return await this.fetcher.locationUrl+loginRoute.path+qs}async openWindowAndWaitForAuthResponse(redirectUrl,state){const redirectResult=await this.oauth2.openWindowAndWaitForRedirect(redirectUrl,state);return OAuth2Helper.decodeAuthInfo(redirectResult.userAuth)}}class MongoDBRealmError extends Error{constructor(method,url,statusCode,statusText,error,errorCode,link){const summary=statusText?`status ${statusCode} ${statusText}`:`status ${statusCode}`;super("string"==typeof error?`Request failed (${method} ${url}): ${error} (${summary})`:`Request failed (${method} ${url}): (${summary})`),this.method=method,this.url=url,this.statusText=statusText,this.statusCode=statusCode,this.error=error,this.errorCode=errorCode,this.link=link}static async fromRequestAndResponse(request,response){var _a;const{url:url,method:method}=request,{status:status,statusText:statusText}=response;if(null===(_a=response.headers.get("content-type"))||void 0===_a?void 0:_a.startsWith("application/json")){const body=await response.json();if("object"==typeof body&&body){const{error:error,error_code:errorCode,link:link}=body;return new MongoDBRealmError(method,url,status,statusText,"string"==typeof error?error:void 0,"string"==typeof errorCode?errorCode:void 0,"string"==typeof link?link:void 0)}}return new MongoDBRealmError(method,url,status,statusText)}}class Fetcher{constructor({appId:appId,transport:transport,userContext:userContext,locationUrlContext:locationUrlContext}){this.appId=appId,this.transport=transport,this.userContext=userContext,this.locationUrlContext=locationUrlContext}static buildAuthorizationHeader(user,tokenType){if(user&&"none"!==tokenType){if("access"===tokenType)return{Authorization:`Bearer ${user.accessToken}`};if("refresh"===tokenType)return{Authorization:`Bearer ${user.refreshToken}`};throw new Error(`Unexpected token type (${tokenType})`)}return{}}static buildBody(body){if(body){if("object"==typeof body&&null!==body)return JSON.stringify(bundle_dom_es_serialize(body));if("string"==typeof body)return body;throw console.log("body is",body),new Error("Unexpected type of body")}}static buildJsonHeader(body){return body&&body.length>0?{"Content-Type":"application/json"}:{}}clone(config){return new Fetcher({appId:this.appId,transport:this.transport,userContext:this.userContext,locationUrlContext:this.locationUrlContext,...config})}async fetch(request){const{path:path,url:url,tokenType:tokenType="access",user:user=this.userContext.currentUser,...restOfRequest}=request;if("string"==typeof path&&"string"==typeof url)throw new Error("Use of 'url' and 'path' mutually exclusive");if("string"==typeof path){const url=await this.locationUrlContext.locationUrl+path;return this.fetch({...request,path:void 0,url:url})}if("string"==typeof url){const response=await this.transport.fetch({...restOfRequest,url:url,headers:{...Fetcher.buildAuthorizationHeader(user,tokenType),...request.headers}});if(response.ok)return response;if(user&&401===response.status&&"access"===tokenType)return await user.refreshAccessToken(),this.fetch({...request,user:user});throw user&&401===response.status&&"refresh"===tokenType&&(user.accessToken=null,user.refreshToken=null),await MongoDBRealmError.fromRequestAndResponse(request,response)}throw new Error("Expected either 'url' or 'path'")}async fetchJSON(request){const{body:body}=request,serializedBody=Fetcher.buildBody(body),contentTypeHeaders=Fetcher.buildJsonHeader(serializedBody),response=await this.fetch({...request,body:serializedBody,headers:{Accept:"application/json",...contentTypeHeaders,...request.headers}}),contentType=response.headers.get("content-type");if(null==contentType?void 0:contentType.startsWith("application/json")){return bundle_dom_es_deserialize(await response.json())}if(null===contentType)return null;throw new Error(`Expected JSON response, got "${contentType}"`)}async fetchStream(request){const{body:body}=await this.fetch({...request,headers:{Accept:"text/event-stream",...request.headers}});return function asyncIteratorFromResponseBody(body){if("object"!=typeof body||null===body)throw new Error("Expected a non-null object");if(Symbol.asyncIterator in body)return body;if("getReader"in body){const stream=body;return{[Symbol.asyncIterator](){const reader=stream.getReader();return{next(){return reader.read()},async return(){return await reader.cancel(),{done:!0,value:null}}}}}}throw new Error("Expected an AsyncIterable or a ReadableStream")}(body)}get appRoute(){return routes.api().app(this.appId)}get locationUrl(){return this.locationUrlContext.locationUrl}}var DeviceFields;!function(DeviceFields){DeviceFields.DEVICE_ID="deviceId",DeviceFields.APP_ID="appId",DeviceFields.APP_VERSION="appVersion",DeviceFields.PLATFORM="platform",DeviceFields.PLATFORM_VERSION="platformVersion",DeviceFields.SDK_VERSION="sdkVersion"}(DeviceFields||(DeviceFields={}));class DeviceInformation{constructor({appId:appId,appVersion:appVersion,deviceId:deviceId}){this.sdkVersion="2.0.0";const environment=getEnvironment();this.platform=environment.platform,this.platformVersion=environment.platformVersion,this.appId=appId,this.appVersion=appVersion,this.deviceId=deviceId}encode(){const obj=removeKeysWithUndefinedValues(this);return gBase64_encode(JSON.stringify(obj))}toJSON(){return removeKeysWithUndefinedValues(this)}}class App{constructor(idOrConfiguration){this.users=[],this._locationUrl=null;const configuration="string"==typeof idOrConfiguration?{id:idOrConfiguration}:idOrConfiguration;if("object"!=typeof configuration||"string"!=typeof configuration.id)throw new Error("Missing an Atlas App Services app-id");this.id=configuration.id,this.baseUrl=configuration.baseUrl||"https://realm.mongodb.com",configuration.skipLocationRequest&&(this._locationUrl=Promise.resolve(this.baseUrl)),this.localApp=configuration.app;const{storage:storage,transport:transport=new DefaultNetworkTransport}=configuration;this.fetcher=new Fetcher({appId:this.id,userContext:this,locationUrlContext:this,transport:transport}),this.emailPasswordAuth=new EmailPasswordAuth(this.fetcher);const baseStorage=storage||getEnvironment().defaultStorage;this.storage=new AppStorage(baseStorage,this.id),this.authenticator=new Authenticator(this.fetcher,baseStorage,(()=>this.deviceInformation));try{this.hydrate()}catch(err){this.storage.clear(),console.warn("Realm app hydration failed:",err instanceof Error?err.message:err)}}static getApp(id){if(id in App.appCache)return App.appCache[id];{const instance=new App(id);return App.appCache[id]=instance,instance}}switchUser(nextUser){const index=this.users.findIndex((u=>u===nextUser));if(-1===index)throw new Error("The user was never logged into this app");const[user]=this.users.splice(index,1);this.users.unshift(user)}async logIn(credentials,fetchProfile=!0){const response=await this.authenticator.authenticate(credentials),user=this.createOrUpdateUser(response,credentials.providerType);this.switchUser(user),fetchProfile&&await user.refreshProfile(),this.storage.setUserIds(this.users.map((u=>u.id)),!0);const deviceId=response.deviceId;return deviceId&&"000000000000000000000000"!==deviceId&&this.storage.set("deviceId",deviceId),user}async removeUser(user){const index=this.users.findIndex((u=>u===user));if(-1===index)throw new Error("The user was never logged into this app");this.users.splice(index,1),await user.logOut(),this.storage.remove(`user(${user.id}):profile`),this.storage.removeUserId(user.id)}async deleteUser(user){await this.fetcher.fetchJSON({method:"DELETE",path:routes.api().auth().delete().path}),await this.removeUser(user)}addListener(){throw new Error("Not yet implemented")}removeListener(){throw new Error("Not yet implemented")}removeAllListeners(){throw new Error("Not yet implemented")}get currentUser(){const activeUsers=this.users.filter((user=>user.state===UserState.Active));return 0===activeUsers.length?null:activeUsers[0]}get allUsers(){return Object.fromEntries(this.users.map((user=>[user.id,user])))}get locationUrl(){if(!this._locationUrl){const path=routes.api().app(this.id).location().path;this._locationUrl=this.fetcher.fetchJSON({method:"GET",url:this.baseUrl+path,tokenType:"none"}).then((body=>{if("object"!=typeof body)throw new Error("Expected response body be an object");return body})).then((({hostname:hostname})=>{if("string"!=typeof hostname)throw new Error("Expected response to contain a 'hostname'");return hostname})).catch((err=>{throw this._locationUrl=null,err}))}return this._locationUrl}get deviceInformation(){const deviceIdStr=this.storage.getDeviceId(),deviceId="string"==typeof deviceIdStr&&"000000000000000000000000"!==deviceIdStr?new ObjectId(deviceIdStr):void 0;return new DeviceInformation({appId:this.localApp?this.localApp.name:void 0,appVersion:this.localApp?this.localApp.version:void 0,deviceId:deviceId})}createOrUpdateUser(response,providerType){const existingUser=this.users.find((u=>u.id===response.userId));if(existingUser)return existingUser.accessToken=response.accessToken,existingUser.refreshToken=response.refreshToken,existingUser;{if(!response.refreshToken)throw new Error("No refresh token in response from server");const user=new User({app:this,id:response.userId,accessToken:response.accessToken,refreshToken:response.refreshToken,providerType:providerType});return this.users.unshift(user),user}}hydrate(){const userIds=this.storage.getUserIds();this.users=userIds.map((id=>new User({app:this,id:id})))}}App.appCache={},App.Credentials=Credentials;const check$1=function(it){return it&&it.Math==Math&&it},safeGlobalThis$1=check$1("object"==typeof globalThis&&globalThis)||check$1("object"==typeof window&&window)||check$1("object"==typeof self&&self)||check$1("object"==typeof __webpack_require__.g&&__webpack_require__.g)||function(){return this}()||Function("return this")();"undefined"!=typeof __DEV__&&__DEV__;const browser=function detect(userAgent){return userAgent?parseUserAgent(userAgent):"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new ReactNativeInfo:"undefined"!=typeof navigator?parseUserAgent(navigator.userAgent):function getNodeVersion(){return"undefined"!=typeof process&&process.version?new NodeInfo(process.version.slice(1)):null}()}(),DefaultStorage="localStorage"in safeGlobalThis$1?class LocalStorage{constructor(){if("object"!=typeof safeGlobalThis$1.localStorage)throw new Error("Cannot use LocalStorage without a global localStorage object");this.global=safeGlobalThis$1}get(key){return this.global.localStorage.getItem(key)}set(key,value){return this.global.localStorage.setItem(key,value)}remove(key){return this.global.localStorage.removeItem(key)}prefix(keyPart){return new PrefixedStorage(this,keyPart)}clear(prefix){const keys=[];for(let i=0;i<this.global.localStorage.length;i++){const key=this.global.localStorage.key(i);!key||prefix&&!key.startsWith(prefix)||keys.push(key)}for(const key of keys)this.global.localStorage.removeItem(key)}addListener(listener){return this.global.addEventListener("storage",listener)}removeListener(listener){return this.global.removeEventListener("storage",listener)}}:class MemoryStorage{constructor(){this.storage={},this.listeners=new Set}get(key){return key in this.storage?this.storage[key]:null}set(key,value){this.storage[key]=value,this.fireListeners()}remove(key){delete this.storage[key],this.fireListeners()}prefix(keyPart){return new PrefixedStorage(this,keyPart)}clear(prefix){for(const key of Object.keys(this.storage))prefix&&!key.startsWith(prefix)||delete this.storage[key];this.fireListeners()}addListener(listener){this.listeners.add(listener)}removeListener(listener){this.listeners.delete(listener)}fireListeners(){this.listeners.forEach((listener=>listener()))}};const environment$1={defaultStorage:(new DefaultStorage).prefix("realm-web"),openWindow:function openWindow(url){return"function"==typeof safeGlobalThis$1.open?safeGlobalThis$1.open(url):(console.log(`Please open ${url}`),null)},platform:(null==browser?void 0:browser.name)||"web",platformVersion:(null==browser?void 0:browser.version)||"0.0.0",TextDecoder:TextDecoder};function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}function _regeneratorRuntime(){_regeneratorRuntime=function _regeneratorRuntime(){return exports};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,defineProperty=Object.defineProperty||function(obj,key,desc){obj[key]=desc.value},$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key]}try{define({},"")}catch(err){define=function define(obj,key,value){return obj[key]=value}}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return defineProperty(generator,"_invoke",{value:makeInvokeMethod(innerFn,self,context)}),generator}function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)}}catch(err){return{type:"throw",arg:err}}}exports.wrap=wrap;var ContinueSentinel={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,(function(){return this}));var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);function defineIteratorMethods(prototype){["next","throw","return"].forEach((function(method){define(prototype,method,(function(arg){return this._invoke(method,arg)}))}))}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==_typeof(value)&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then((function(value){invoke("next",value,resolve,reject)}),(function(err){invoke("throw",err,resolve,reject)})):PromiseImpl.resolve(value).then((function(unwrapped){result.value=unwrapped,resolve(result)}),(function(error){return invoke("throw",error,resolve,reject)}))}reject(record.arg)}var previousPromise;defineProperty(this,"_invoke",{value:function value(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl((function(resolve,reject){invoke(method,arg,resolve,reject)}))}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult()}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg)}else"return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return{value:record.arg,done:context.done}}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg)}}}function maybeInvokeDelegate(delegate,context){var methodName=context.method,method=delegate.iterator[methodName];if(void 0===method)return context.delegate=null,"throw"===methodName&&delegate.iterator.return&&(context.method="return",context.arg=void 0,maybeInvokeDelegate(delegate,context),"throw"===context.method)||"return"!==methodName&&(context.method="throw",context.arg=new TypeError("The iterator does not provide a '"+methodName+"' method")),ContinueSentinel;var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=void 0),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel)}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry)}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0)}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;)if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return next.next=next}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,defineProperty(Gp,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),defineProperty(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return!!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name))},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun},exports.awrap=function(arg){return{__await:arg}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,(function(){return this})),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then((function(result){return result.done?result.value:iter.next()}))},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,(function(){return this})),define(Gp,"toString",(function(){return"[object Generator]"})),exports.keys=function(val){var object=Object(val),keys=[];for(var key in object)keys.push(key);return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next}return next.done=!0,next}},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this)"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=void 0)},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval},dispatchException:function dispatchException(exception){if(this.done)throw exception;var context=this;function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=void 0),!!caught}for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(hasCatch){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0)}else{if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}}}},abrupt:function abrupt(type,arg){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break}}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record)},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return"break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel},finish:function finish(finallyLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel}},catch:function _catch(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry)}return thrown}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=void 0),ContinueSentinel}},exports}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}!function setEnvironment(e){environment=e}(environment$1);var startUp=function(){var _ref=function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise((function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(void 0)}))}}(_regeneratorRuntime().mark((function _callee(){var app,credentials,mongo,db;return _regeneratorRuntime().wrap((function _callee$(_context){for(;;)switch(_context.prev=_context.next){case 0:return app=new App({id:"nexmap-izeal"}),"iYUg10Ymuo2sIF1JPIvUrfCbxvQ7SQ78WFxRvY8wc1wSfe9xHwwdNqlo7NgGw89g",credentials=Credentials.apiKey("iYUg10Ymuo2sIF1JPIvUrfCbxvQ7SQ78WFxRvY8wc1wSfe9xHwwdNqlo7NgGw89g"),_context.next=5,app.logIn(credentials);case 5:return mongo=app.currentUser.mongoClient("mongodb-atlas"),db=mongo.db("nexAction").collection("skills"),_context.abrupt("return",db);case 8:case"end":return _context.stop()}}),_callee)})));return function startUp(){return _ref.apply(this,arguments)}}();function depthswalker_typeof(obj){return depthswalker_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},depthswalker_typeof(obj)}function _wrapRegExp(){_wrapRegExp=function _wrapRegExp(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),_setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return _inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result){result.groups=buildGroups(result,this);var indices=result.indices;indices&&(indices.groups=buildGroups(indices,this))}return result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\$<([^>]+)>/g,(function(_,name){var group=groups[name];return"$"+(Array.isArray(group)?group.join("$"):group)})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=depthswalker_typeof(args[args.length-1])&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},_wrapRegExp.apply(this,arguments)}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},_setPrototypeOf(o,p)}var actions=[{id:"reap",fullName:"Reap",firstPerson:!1,secondPerson:!1,thirdPerson:_wrapRegExp(/^(.+?) lashes out with a swift, reaping blow at (.+?)\.$/,{user:1,target:2}),profession:["depthswalker"],skill:"shadowmancy",balance:"balance",multiLine:1,tags:[],length:2.2},{id:"instillleach",fullName:"Instill - Leach",firstPerson:!1,secondPerson:!1,thirdPerson:_wrapRegExp(/^As the weapon strikes (.+?), he seems greatly diminished\.$/,{target:1}),profession:["depthswalker"],skill:"shadowmancy",balance:"balance",multiLine:1,tags:[],length:2.2}];function dragon_typeof(obj){return dragon_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},dragon_typeof(obj)}function dragon_wrapRegExp(){dragon_wrapRegExp=function _wrapRegExp(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),dragon_setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return dragon_inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result){result.groups=buildGroups(result,this);var indices=result.indices;indices&&(indices.groups=buildGroups(indices,this))}return result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\$<([^>]+)>/g,(function(_,name){var group=groups[name];return"$"+(Array.isArray(group)?group.join("$"):group)})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=dragon_typeof(args[args.length-1])&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},dragon_wrapRegExp.apply(this,arguments)}function dragon_inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&dragon_setPrototypeOf(subClass,superClass)}function dragon_setPrototypeOf(o,p){return dragon_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},dragon_setPrototypeOf(o,p)}var dragon_actions=[{id:"gut",fullName:"Gut",firstPerson:dragon_wrapRegExp(/^You rip into (.+?) with your massive, deadly claws\.$/,{target:1}),secondPerson:!1,thirdPerson:dragon_wrapRegExp(/^(\w+?) rips into (.+?) with \w+ massive, deadly claws\.$/,{user:1,target:2}),profession:["red dragon","green dragon","black dragon","blue dragon","gold dragon","silver dragon"],skill:"dragoncraft",balance:"balance",tags:[],length:3},{id:"incantation",fullName:"Incantation",firstPerson:dragon_wrapRegExp(/^Drawing from the well of your puissance, you invoke a dramatic chant in the dragon tongue\. Your voice resonates with each word, culminating in a wave of magical energy that you bend to your will and thrust towards (.+), bombarding \w+ with the ancient power\.$/,{target:1}),secondPerson:!1,thirdPerson:dragon_wrapRegExp(/^A resonant vibration emanates from (\w+) as \w+ invokes a rumbling, sonorous chant in the dragon tongue\. As the sound increases, (.+?) jerks violently, \w+ body wracked by an unseen force\.$/,{user:1,target:2}),profession:["red dragon","green dragon","black dragon","blue dragon","gold dragon","silver dragon"],skill:"dragoncraft",balance:"equilibrium",tags:[],length:3},{id:"dragoncurse",fullName:"Dragoncurse",firstPerson:!1,secondPerson:!1,thirdPerson:dragon_wrapRegExp(/^(\w+) draws himself up to his full height, staring imperiously down at (.+?)\.$/,{user:1,target:2}),profession:["red dragon","green dragon","black dragon","blue dragon","gold dragon","silver dragon"],skill:"dragoncraft",balance:"equilibrium",tags:[],length:4,multiline:0},{id:"rend",fullName:"Rend",firstPerson:!1,secondPerson:!1,thirdPerson:dragon_wrapRegExp(/^(\w+) draws himself up to his full height, staring imperiously down at (.+?)\.$/,{user:1,target:2}),profession:["red dragon","green dragon","black dragon","blue dragon","gold dragon","silver dragon"],skill:"dragoncraft",balance:"balance",tags:[],length:2.5,multiline:0},{id:"tailsmash",fullName:"Tailsmash",firstPerson:dragon_wrapRegExp(/^You flick your tail at (.+?), dismissively brushing aside the paltry shield protecting \w+\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["dragon"],skill:"dragoncraft",balance:"balance",tags:["raze"],length:2},{id:"glaciate",fullName:"Glaciate",firstPerson:dragon_wrapRegExp(/^You breathe a column of icy air at (.+?)'s head, stunning \w+\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["blue dragon"],skill:"attainment",balance:"battlerage",tags:["stun"],length:3},{id:"frostrive",fullName:"Frostrive",firstPerson:dragon_wrapRegExp(/^(.+?)'s translucent shield cracks and fades away as you breathe an icy blast at it\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["blue dragon"],skill:"attainment",balance:"battlerage",tags:["raze"],length:3},{id:"override",fullName:"Override",firstPerson:dragon_wrapRegExp(/^You barrel into (.+?) and knock \w+ to the ground before stomping over \w+ prone form\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["blue dragon"],skill:"attainment",balance:"battlerage",tags:["damage"],length:3},{id:"ague",fullName:"Ague",firstPerson:dragon_wrapRegExp(/^You let loose a steady stream of cold air around (.+?), who begins to shiver uncontrollably\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["blue dragon"],skill:"attainment",balance:"battlerage",tags:["clumsy"],length:3},{id:"dragonchill",fullName:"Dragonchill",firstPerson:dragon_wrapRegExp(/^You form small chunks of ice in your enormous maw, then spit them at (.+?) in a barrage\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["blue dragon"],skill:"attainment",balance:"battlerage",tags:["damage"],length:3},{id:"frostwave",fullName:"Frostwave",firstPerson:dragon_wrapRegExp(/^You breathe a wave of icy air at (.+?)\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["blue dragon"],skill:"attainment",balance:"battlerage",tags:["damage"],length:3},{id:"corrode",fullName:"Corrode",firstPerson:!1,secondPerson:!1,thirdPerson:dragon_wrapRegExp(/^(\w+) opens \w+ gigantic maw and spews acid on (.+?)\. \w+ is too clumsy to dodge and is covered in the corrosive slime\.$/,{user:1,target:2}),profession:["black dragon"],skill:"attainment",balance:"battlerage",tags:["damage"],length:3},{id:"dragonblaze",fullName:"Dragonblaze",firstPerson:dragon_wrapRegExp(/^You breathe a long torrent of flame at (.+?), igniting \w+ skin\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["red dragon"],skill:"attainment",balance:"battlerage",tags:["damage"],length:3},{id:"dragonblazeTick",fullName:"Dragonblaze tick",firstPerson:!1,secondPerson:!1,thirdPerson:dragon_wrapRegExp(/^(.+?) is wracked with pain as the flames of dragonbreath wreathe over \w+ skin\.$/,{target:1}),profession:["red dragon"],skill:"attainment",balance:"battlerage",tags:["damage"],length:3},{id:"scorch",fullName:"Scorch",firstPerson:dragon_wrapRegExp(/^You blacken (.+?)'s flesh with a quick blast of flame, slowing \w+ healing process\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["red dragon"],skill:"attainment",balance:"battlerage",tags:["inhibit"],length:3},{id:"overwhelm",fullName:"Overwhelm",firstPerson:dragon_wrapRegExp(/^You charge quickly at (.+?), throwing your mighty form into \w+ and sending \w+ staggering back\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["red dragon"],skill:"attainment",balance:"battlerage",tags:["damage"],length:3},{id:"dragontaunt",fullName:"Dragontaunt",firstPerson:dragon_wrapRegExp(/^You slap your tail on the ground while growling at (.+?), forcing \w+ to recklessly attack\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["red dragon"],skill:"attainment",balance:"battlerage",tags:["recklessness"],length:3},{id:"flamebath",fullName:"Flamebath",firstPerson:dragon_wrapRegExp(/^You blast (.+?) with a bath of flame, but \w+ is able to avoid the brunt of the blast\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["red dragon"],skill:"attainment",balance:"battlerage",tags:["damage"],length:3},{id:"melt",fullName:"Melt",firstPerson:dragon_wrapRegExp(/^You breathe a white\x2Dhot blast of flame at (.+?) and burn away \w+ translucent shield\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["red dragon"],skill:"attainment",balance:"battlerage",tags:["raze"],length:3}];function occultist_typeof(obj){return occultist_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},occultist_typeof(obj)}function occultist_wrapRegExp(){occultist_wrapRegExp=function _wrapRegExp(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),occultist_setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return occultist_inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result){result.groups=buildGroups(result,this);var indices=result.indices;indices&&(indices.groups=buildGroups(indices,this))}return result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\$<([^>]+)>/g,(function(_,name){var group=groups[name];return"$"+(Array.isArray(group)?group.join("$"):group)})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=occultist_typeof(args[args.length-1])&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},occultist_wrapRegExp.apply(this,arguments)}function occultist_inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&occultist_setPrototypeOf(subClass,superClass)}function occultist_setPrototypeOf(o,p){return occultist_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},occultist_setPrototypeOf(o,p)}var occultist_actions=[{id:"warp",fullName:"Warp",firstPerson:occultist_wrapRegExp(/^You reach out and clench a fist before (.+?), who screams and doubles over in agony as \w+ skin suddenly bubbles with gangrenous growths\.$/,{target:1}),secondPerson:!1,thirdPerson:occultist_wrapRegExp(/^(\w+?) reaches out and clenches a fist before (.+?), who screams and doubles over in agony as \w+ skin suddenly bubbles with gangrenous growths\.$/,{user:1,target:2}),profession:["occultist"],skill:"occultism",balance:"equilibrium",tags:["damage"],length:3},{id:"priestess",fullName:"Priestess",firstPerson:/Raising the High Priestess tarot over your head, parallel to the ground, you release it. It instantly expands and moves downward, healing you as your body passes through it\.$/,secondPerson:!1,thirdPerson:occultist_wrapRegExp(/^(\w+?) raises a tarot over \w+ head, parallel to the ground. Upon releasing it, it instantly expands and moves downward until \w+ entire body has been passed through it\.$/,{user:1}),profession:["occultist","jester"],skill:"tarot",balance:"balance",tags:["heal"],length:3},{id:"harry",fullName:"Harry",firstPerson:occultist_wrapRegExp(/^Raising your hands in the air, you summon horrific visions to torment (.+?)\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["occultist"],skill:"attainment",balance:"battlerage",tags:["battlerage"],length:3},{id:"harryTick",fullName:"Harry tick",firstPerson:occultist_wrapRegExp(/^(.+?) is tormented by horrific visions from the Plane of Chaos\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["occultist"],skill:"attainment",balance:"battlerage",tags:["battlerage"],length:3},{id:"chaosgate",fullName:"Chaosgate",firstPerson:occultist_wrapRegExp(/^You cup your hands together and fling them outwards, sending a spiral of shimmering portals into (.+?)'s body\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["occultist"],skill:"attainment",balance:"battlerage",tags:["battlerage"],length:3},{id:"stagnate",fullName:"Stagnate",firstPerson:occultist_wrapRegExp(/^You wave one arm at (.+?), causing a small time rift to form around her\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["occultist"],skill:"attainment",balance:"battlerage",tags:["battlerage"],length:3}];function pariah_typeof(obj){return pariah_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},pariah_typeof(obj)}function pariah_wrapRegExp(){pariah_wrapRegExp=function _wrapRegExp(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),pariah_setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return pariah_inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result){result.groups=buildGroups(result,this);var indices=result.indices;indices&&(indices.groups=buildGroups(indices,this))}return result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\$<([^>]+)>/g,(function(_,name){var group=groups[name];return"$"+(Array.isArray(group)?group.join("$"):group)})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=pariah_typeof(args[args.length-1])&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},pariah_wrapRegExp.apply(this,arguments)}function pariah_inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&pariah_setPrototypeOf(subClass,superClass)}function pariah_setPrototypeOf(o,p){return pariah_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},pariah_setPrototypeOf(o,p)}var pariah_actions=[{id:"fissure",fullName:"Epitaph Fissure",firstPerson:!1,secondPerson:!1,thirdPerson:pariah_wrapRegExp(/^Crimson fire trails the knife of (\w+) as \w+ slashes \w+ knife through the air before (.+?), a jagged logograph hanging in its passing\.$/,{user:1,target:2}),profession:["pariah"],skill:"memorium",balance:"balance",multiLine:0,tags:["raze"],length:2.2,reaction:function reaction(){}},{id:"serpent",fullName:"Epitaph Serpent",firstPerson:!1,secondPerson:!1,thirdPerson:pariah_wrapRegExp(/^(\w+) traces a writhing logograph in the air before (.+?), the blood upon \w+ knife bursting into arcane flame as it hangs in the wake of the blade's passage\.$/,{user:1,target:2}),profession:["pariah"],skill:"memorium",balance:"balance",multiLine:0,tags:["paralysis"],length:2.2},{id:"skein",fullName:"Epitaph Skein",firstPerson:!1,secondPerson:!1,thirdPerson:pariah_wrapRegExp(/^(\w+) traces a logograph shaped like a skein in the air before (.+?), the blood upon \w+ knife bursting into arcane flame as it hangs in the wake of the blade's passage\.$/,{user:1,target:2}),profession:["pariah"],skill:"memorium",balance:"balance",multiLine:0,tags:[],length:2.2},{id:"sun",fullName:"Epitaph Sun",firstPerson:!1,secondPerson:!1,thirdPerson:pariah_wrapRegExp(/^(\w+) traces a logograph shaped like a sunburst in the air before (.+?), the blood upon \w+ knife bursting into arcane flame as it hangs in the wake of the blade's passage\.$/,{user:1,target:2}),profession:["pariah"],skill:"memorium",balance:"balance",multiLine:0,tags:["epilepsy"],length:2.2},{id:"jackal",fullName:"Epitaph Jackal",firstPerson:!1,secondPerson:!1,thirdPerson:pariah_wrapRegExp(/^(\w+) traces a logograph depicting a leaping jackal in the air before (.+?), the blood upon \w+ knife bursting into arcane flame as it hangs in the wake of the blade's passage\.$/,{user:1,target:2}),profession:["pariah"],skill:"memorium",balance:"balance",multiLine:0,tags:["asthma"],length:2.2},{id:"scales",fullName:"Epitaph Scales",firstPerson:!1,secondPerson:!1,thirdPerson:pariah_wrapRegExp(/^(\w+) traces a logograph shaped like a set of scales in the air before (.+?), the blood upon \w+ knife bursting into arcane flame as it hangs in the wake of the blade's passage\.$/,{user:1,target:2}),profession:["pariah"],skill:"memorium",balance:"balance",multiLine:0,tags:["clumsiness"],length:2.2},{id:"scorpion",fullName:"Epitaph Scorpion",firstPerson:!1,secondPerson:!1,thirdPerson:pariah_wrapRegExp(/^(\w+) traces a logograph depicting a striking scorpion in the air before (.+?), the blood upon \w+ knife bursting into arcane flame as it hangs in the wake of the blade's passage\.$/,{user:1,target:2}),profession:["pariah"],skill:"memorium",balance:"balance",multiLine:0,tags:["scytherus"],length:2.2},{id:"bear",fullName:"Epitaph Bear",firstPerson:!1,secondPerson:!1,thirdPerson:pariah_wrapRegExp(/^(\w+) traces a logograph depicting a lunging bear in the air before (.+?), the blood upon \w+ knife bursting into arcane flame as it hangs in the wake of the blade's passage\.$/,{user:1,target:2}),profession:["pariah"],skill:"memorium",balance:"balance",multiLine:0,tags:["haemophilia","bleeding"],length:2.2},{id:"nest",fullName:"Epitaph Nest",firstPerson:!1,secondPerson:!1,thirdPerson:pariah_wrapRegExp(/^(\w+) traces a logograph that is all twisted lines and angles in the air before (.+?), the blood upon \w+ knife bursting into arcane flame as it hangs in the wake of the blade's passage\.$/,{user:1,target:2}),profession:["pariah"],skill:"memorium",balance:"balance",multiLine:0,tags:["weariness"],length:2.2}];function priest_typeof(obj){return priest_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},priest_typeof(obj)}function priest_wrapRegExp(){priest_wrapRegExp=function _wrapRegExp(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),priest_setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return priest_inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result){result.groups=buildGroups(result,this);var indices=result.indices;indices&&(indices.groups=buildGroups(indices,this))}return result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\$<([^>]+)>/g,(function(_,name){var group=groups[name];return"$"+(Array.isArray(group)?group.join("$"):group)})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=priest_typeof(args[args.length-1])&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},priest_wrapRegExp.apply(this,arguments)}function priest_inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&priest_setPrototypeOf(subClass,superClass)}function priest_setPrototypeOf(o,p){return priest_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},priest_setPrototypeOf(o,p)}var priest_actions=[{id:"chasten",fullName:"Chasten",firstPerson:!1,secondPerson:!1,thirdPerson:priest_wrapRegExp(/^A dark bolt of energy erupts from the mace held by (\w+), afflicting (.+?) with a chastening magic\.$/,{user:1,target:2}),profession:["priest"],skill:"spirituality",balance:"balance",multiLine:0,tags:[],length:2.9},{id:"smite",fullName:"Smite",firstPerson:!1,secondPerson:!1,thirdPerson:priest_wrapRegExp(/^(\w+) utters a prayer and smites (.+?)'s (.+?) with an Auroran Mace\.$/,{user:1,target:2,limb:3}),profession:["priest"],skill:"spirituality",balance:"equilibrium",multiLine:0,tags:[],length:2.8},{id:"guilt",fullName:"Guilt",firstPerson:!1,secondPerson:!1,thirdPerson:priest_wrapRegExp(/^"And your guilt will be made plain," (\w+) proselytises, finger raised to point at (.+?)\.$/,{user:1,target:2}),profession:["priest"],skill:"zeal",balance:"prayer",multiLine:0,tags:["aff"],affs:["guilt"],length:1.7},{id:"guilt2",fullName:"Guilt",firstPerson:!1,secondPerson:!1,thirdPerson:priest_wrapRegExp(/^"Know the pain which you have caused," (\w+) proselytises, finger raised to point at (.+?)\.$/,{user:1,target:2}),profession:["priest"],skill:"zeal",balance:"prayer",multiLine:0,tags:["aff"],affs:["guilt"],length:1.7},{id:"purge",fullName:"Purge",firstPerson:!1,secondPerson:!1,thirdPerson:priest_wrapRegExp(/^"I deem you unfit for Creation!" (\w+) proclaims, pointing an imperious finger at (.+?)\.$/,{user:1,target:2}),profession:["priest"],skill:"zeal",balance:"prayer",multiLine:0,tags:["aff"],affs:["ablaze"],length:2.3},{id:"penance",fullName:"Penance",firstPerson:!1,secondPerson:!1,thirdPerson:priest_wrapRegExp(/^"And face your penance!" denounces (\w+), hand raised in warding against (.+?)\.$/,{user:1,target:2}),profession:["priest"],skill:"zeal",balance:"prayer",multiLine:0,tags:["aff"],affs:["paralysis"],length:1.6},{id:"penance2",fullName:"Penance",firstPerson:!1,secondPerson:!1,thirdPerson:priest_wrapRegExp(/^"Repent for your crimes!" denounces (\w+), hand raised in warding against (.+?)\.$/,{user:1,target:2}),profession:["priest"],skill:"zeal",balance:"prayer",multiLine:0,tags:["aff"],affs:["paralysis"],length:1.6},{id:"revelations",fullName:"Revelations",firstPerson:!1,secondPerson:!1,thirdPerson:priest_wrapRegExp(/^"And see that which Evil reaps!" (\w+) recites to (.+?), righteous fury blazing in \w+ eyes\.$/,{user:1,target:2}),profession:["priest"],skill:"zeal",balance:"prayer",multiLine:0,tags:["aff"],affs:["hellsight"],length:1.6},{id:"light",fullName:"Light",firstPerson:!1,secondPerson:!1,thirdPerson:priest_wrapRegExp(/^"May the Light lead, and we never fail to follow!" cries out (\w+)\.$/,{user:1}),profession:["priest"],skill:"zeal",balance:"prayer",multiLine:0,tags:["heal","cure"],affs:[],length:3},{id:"inquisition",fullName:"Inquisition",firstPerson:!1,secondPerson:!1,thirdPerson:priest_wrapRegExp(/^Pointing at \w+ with a single raised finger, (\w+) recites a list of (.+?)'s transgressions, condemning \w+ actions and words\. A blaze of holy fire surges about \w+ as he dictates \w+'s sentence\.$/,{user:1,target:2}),profession:["priest"],skill:"devotion",balance:"equilibrium",multiLine:0,tags:["aff"],affs:["inquisition"],length:3.5},{id:"dazzle",fullName:"Dazzle",firstPerson:!1,secondPerson:!1,thirdPerson:priest_wrapRegExp(/^(\w+) directs a dazzling ray of light at (.+?)\.$/,{user:1,target:2}),profession:["priest"],skill:"devotion",balance:"equilibrium",multiLine:0,tags:["aff"],affs:["stupidity"],length:2.5}];function psion_typeof(obj){return psion_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},psion_typeof(obj)}function psion_wrapRegExp(){psion_wrapRegExp=function _wrapRegExp(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),psion_setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return psion_inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result){result.groups=buildGroups(result,this);var indices=result.indices;indices&&(indices.groups=buildGroups(indices,this))}return result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\$<([^>]+)>/g,(function(_,name){var group=groups[name];return"$"+(Array.isArray(group)?group.join("$"):group)})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=psion_typeof(args[args.length-1])&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},psion_wrapRegExp.apply(this,arguments)}function psion_inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&psion_setPrototypeOf(subClass,superClass)}function psion_setPrototypeOf(o,p){return psion_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},psion_setPrototypeOf(o,p)}var psion_actions=[{id:"overhand",fullName:"Overhand",firstPerson:!1,secondPerson:!1,thirdPerson:psion_wrapRegExp(/^(.+?) brings a translucent mace around in a savage overhand strike, smashing it into the head of (.+?)\.$/,{user:1,target:2}),profession:["psion"],skill:"weaving",balance:"balance",multiLine:1,tags:[],length:2.2},{id:"deathblow",fullName:"Deathblow",firstPerson:!1,secondPerson:!1,thirdPerson:psion_wrapRegExp(/^Almost too swift to perceive, (.+?) lashes out with a translucent dagger, tracing a bloody line across the throat of (.+?)\.$/,{user:1,target:2}),profession:["psion"],skill:"weaving",balance:"balance",multiLine:1,tags:["asthma","bleeding"],length:2.2}];function tattoos_typeof(obj){return tattoos_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},tattoos_typeof(obj)}function tattoos_wrapRegExp(){tattoos_wrapRegExp=function _wrapRegExp(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),tattoos_setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return tattoos_inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result){result.groups=buildGroups(result,this);var indices=result.indices;indices&&(indices.groups=buildGroups(indices,this))}return result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\$<([^>]+)>/g,(function(_,name){var group=groups[name];return"$"+(Array.isArray(group)?group.join("$"):group)})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=tattoos_typeof(args[args.length-1])&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},tattoos_wrapRegExp.apply(this,arguments)}function tattoos_inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&tattoos_setPrototypeOf(subClass,superClass)}function tattoos_setPrototypeOf(o,p){return tattoos_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},tattoos_setPrototypeOf(o,p)}var tattoos_actions=[{id:"shield",fullName:"Shield",firstPerson:/^You touch the tattoo and a nearly invisible magical shield forms around you\.$/,secondPerson:!1,thirdPerson:tattoos_wrapRegExp(/^A nearly invisible magical shield forms around (.+?)\.$/,{user:1}),profession:["general"],skill:"tattoos",balance:"equilibrium",multiLine:1,tags:[],length:4},{id:"tree",fullName:"Tree",firstPerson:!1,secondPerson:!1,thirdPerson:tattoos_wrapRegExp(/^(\w+) touches a tree of life tattoo\.$/,{user:1}),profession:["general"],skill:"tattoos",balance:"equilibrium",multiLine:1,tags:[],length:4}];function curing_typeof(obj){return curing_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},curing_typeof(obj)}function curing_wrapRegExp(){curing_wrapRegExp=function _wrapRegExp(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),curing_setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return curing_inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result){result.groups=buildGroups(result,this);var indices=result.indices;indices&&(indices.groups=buildGroups(indices,this))}return result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\$<([^>]+)>/g,(function(_,name){var group=groups[name];return"$"+(Array.isArray(group)?group.join("$"):group)})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=curing_typeof(args[args.length-1])&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},curing_wrapRegExp.apply(this,arguments)}function curing_inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&curing_setPrototypeOf(subClass,superClass)}function curing_setPrototypeOf(o,p){return curing_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},curing_setPrototypeOf(o,p)}var curing_actions=[{id:"eat",fullName:"Eat",firstPerson:!1,secondPerson:!1,thirdPerson:curing_wrapRegExp(/^(\w+) eats (.+)\.$/,{user:1,target:2}),profession:["general"],skill:"",balance:"herb",multiLine:0,tags:[],length:1.6},{id:"apply",fullName:"Apply",firstPerson:!1,secondPerson:!1,thirdPerson:curing_wrapRegExp(/^(\w+) takes some salve from a vial and rubs it on \w+ (.+)\.$/,{user:1,target:2}),profession:["general"],skill:"",balance:"salve",multiLine:0,tags:[],length:1},{id:"smoke",fullName:"Smoke",firstPerson:!1,secondPerson:!1,thirdPerson:curing_wrapRegExp(/^(\w+) takes a long drag off \w+ (.+)\.$/,{user:1,target:2}),profession:["general"],skill:"",balance:"smoke",multiLine:0,tags:[],length:1.6},{id:"sip",fullName:"Sip",firstPerson:!1,secondPerson:!1,thirdPerson:curing_wrapRegExp(/^(\w+) takes a drink from (?:a|an) (.+)\.$/,{user:1,target:2}),profession:["general"],skill:"",balance:"sip",multiLine:0,tags:[],length:1.6},{id:"focus",fullName:"Focus",firstPerson:!1,secondPerson:!1,thirdPerson:curing_wrapRegExp(/^A look of extreme focus crosses the face of (\w+)\.$/,{user:1}),profession:["general"],skill:"",balance:"focus",multiLine:0,tags:[],length:2.5}];function general_typeof(obj){return general_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},general_typeof(obj)}function general_wrapRegExp(){general_wrapRegExp=function _wrapRegExp(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),general_setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return general_inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result){result.groups=buildGroups(result,this);var indices=result.indices;indices&&(indices.groups=buildGroups(indices,this))}return result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\$<([^>]+)>/g,(function(_,name){var group=groups[name];return"$"+(Array.isArray(group)?group.join("$"):group)})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=general_typeof(args[args.length-1])&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},general_wrapRegExp.apply(this,arguments)}function general_inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&general_setPrototypeOf(subClass,superClass)}function general_setPrototypeOf(o,p){return general_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},general_setPrototypeOf(o,p)}var general_actions=[{id:"npcSlain",fullName:"SLAIN",firstPerson:general_wrapRegExp(/^You have slain (.+), retrieving the corpse\.$/,{target:1}),secondPerson:!1,thirdPerson:!1,profession:["general"],skill:"slain",balance:"free",multiLine:0,tags:[],length:0}];function nur_typeof(obj){return nur_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},nur_typeof(obj)}function nur_wrapRegExp(){nur_wrapRegExp=function _wrapRegExp(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),nur_setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return nur_inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result){result.groups=buildGroups(result,this);var indices=result.indices;indices&&(indices.groups=buildGroups(indices,this))}return result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\$<([^>]+)>/g,(function(_,name){var group=groups[name];return"$"+(Array.isArray(group)?group.join("$"):group)})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=nur_typeof(args[args.length-1])&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},nur_wrapRegExp.apply(this,arguments)}function nur_inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&nur_setPrototypeOf(subClass,superClass)}function nur_setPrototypeOf(o,p){return nur_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},nur_setPrototypeOf(o,p)}var nur_npcs=[{user:"a translucent butterfly",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^A translucent butterfly beats his wings rapidly and his translucent body takes on a viridescent tinge. Discharging the vivid energy, he sends a toxic blast to impact with you\.$/,thirdPerson:!1,tags:["damage","loki"],length:2},{user:"a translucent butterfly",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^A translucent butterfly beats his wings rapidly and his translucent body takes on a bright violet tinge. Discharging the vivid energy, he sends a blast of power to impact with you\.$/,thirdPerson:!1,tags:["damage","transfix??? (fix this)"],length:4},{user:"a translucent butterfly",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^A translucent butterfly beats his wings rapidly and his translucent body turns ghostly white. Discharging the pale energy, he sends a blast of power to impact with you\.$/,thirdPerson:!1,tags:["damage","paralysis"],length:4},{user:"a translucent butterfly",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^A translucent butterfly beats his wings rapidly and his translucent body takes on a bright crimson tinge. Discharging the blazing energy, he sends a blast of power to impact with you\.$/,thirdPerson:!1,tags:["damage","burning"],length:4},{user:"a translucent butterfly",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^A translucent butterfly beats his wings rapidly and his translucent body takes on a dark amber tinge. Discharging the crackling energy, he sends a blast of power to impact with you\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"an elder angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^An elder angel flicks his fingers in your direction and you are consumed by pure agony\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"an elder angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^An elder angel sweeps his wings forward in a fiery wave, sending a cascade of fire to consume the area\.$/,thirdPerson:!1,tags:["damage","burning"],length:2},{user:"an angel spearbearer",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^In a trained motion, an angel spearbearer drives the pointy end of his spear into both of your shoulders with two well-placed jabs\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"an angel spearbearer",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^With force and precision, an angel spearbearer drives his spear into your torso, impaling you frightfully\.$/,thirdPerson:!1,tags:["damage","webbed"],length:2},{user:"an angel spearbearer",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^Flipping his spear around in a trained motion, an angel spearbearer hits you on the side of the head with the weapon's blunt end\.$/,thirdPerson:!1,tags:["damage","stun"],length:2},{user:"an angel spearbearer",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^Wielding his spear in one hand and lifting it above his head, an angel spearbearer chants ancient words before throwing the sizzling spear at you as coruscating energy crackles along the weapon's surface\.$/,thirdPerson:!1,tags:["damage","stun"],length:2},{user:"an angel spearbearer",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^Spinning his spear in one hand, an angel spearbearer ducks down low and jabs his spear between your legs before twisting it, causing you to fall to the ground\.$/,thirdPerson:!1,tags:["damage","prone","brokenleftleg"],length:2,reaction:function reaction(){}},{user:"an angel spearbearer",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^A look of sheer determination clear on his face, an angel spearbearer sweeps his spear in a wide arc with practiced control\.$/,thirdPerson:!1,tags:["damage","prone"],length:2},{user:"a vanguard angel",areaId:[401,400,398,397,396],areaName:"First Circle of Nur",firstPerson:/^The form of a vanguard angel shifts abruptly to an incorporeal mist which passes through your body, leaving abject terror and searing agony in his wake, before regaining physicality on the other side\.$/,thirdPerson:nur_wrapRegExp(/^The form of a vanguard angel shifts abruptly to an incorporeal mist which passes through (.+?)'s convulsing body before regaining physicality on the other side\.$/,{target:1}),tags:["damage","blackout","heal"],length:2},{user:"a vanguard angel",areaId:[401,400,398,397,396],areaName:"First Circle of Nur",firstPerson:/^A vanguard angel points his radiant sword directly at you, a bolt of pure energy bursting forth and slamming into your chest\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"a vanguard angel",areaId:[401,400,398,397,396],areaName:"First Circle of Nur",firstPerson:/^A vanguard angel whirls his fiery sword in a controlled arc that slices you from shoulder to sternum\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"a vanguard angel",areaId:[401,400,398,397,396],areaName:"First Circle of Nur",firstPerson:/^His luminous sword a blur of fiery strikes, a vanguard angel stabs you repeatedly, causing notable damage with each thrust\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"a vanguard angel",areaId:[401,400,398,397,396],areaName:"First Circle of Nur",firstPerson:/^With a snap, the angel's ethereal wings solidify into twin appendages of finely honed death\. He deploys them with a graceful pivot, mercilessly slicing all in their path\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"an expulsor angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^Gliding effortlessly through your defences, an expulsor angel smashes her buckler into your extremities with dreadful force\.$/,thirdPerson:!1,tags:["damage","brokenleftleg"],length:2},{user:"an expulsor angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^With a snap, an expulsor angel's wings solidify into a stone-like substance. She effortlessly sweeps them forward, slamming them unrelentingly into your vulnerable form\.$/,thirdPerson:!1,tags:["damage","stun"],length:2},{user:"an expulsor angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^An expulsor angel slams her buckler into your sternum with brutal force\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"an expulsor angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^A single beat of her wings carries an expulsor angel briefly aloft before she dives towards you in a silent blur, driving her javelin deep into the juncture of your neck and shoulder\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"an expulsor angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^Batting away your defences, an expulsor angel drives her javelin deep into your exposed body\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"an expulsor angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^An expulsor angel slams her buckler into your sternum with brutal force\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"an inquisitor angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^An inquisitor angel opens her mouth and speaks a single word. The sound of a multitude blasts forth, slamming relentlessly into you in a blast of power\.$/,thirdPerson:!1,tags:["damage","undeaf","confusion","dementia"],length:2},{user:"an inquisitor angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^An inquisitor angel tilts her head slightly to the side and immediately a multitude of bleeding wounds open up on your body\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"an inquisitor angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^An inquisitor angel raises her palm and sends a wave of energy to slam painfully into you\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"an inquisitor angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^Pivoting in a tight circle, an inquisitor angel transforms her wings into a fiery blaze that sweeps relentlessly through the room, engulfing you in flames\.$/,thirdPerson:!1,tags:["damage","burning"],length:2},{user:"a watcher angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^A watcher angel opens his mouth and speaks a single word. The sound of a multitude blasts forth, slamming relentlessly into you in a blast of power\.$/,thirdPerson:!1,tags:["damage","undeaf","confusion","dementia"],length:2},{user:"a watcher angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^A watcher angel walks calmly forward, his form turning into ethereal mist between one step and the next. You convulse helplessly in agony as the luminous gas enters your body in a haze of fiery retribution\.$/,thirdPerson:!1,tags:["damage","burning"],length:2},{user:"a watcher angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^A watcher angel turns his burning, sightless gaze in your direction, causing searing agony to erupt throughout your body\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"a watcher angel",areaId:[401],areaName:"First Circle of Nur",firstPerson:/^Reaching forward, a watcher angel calmly lays his hands on you resulting in agonizing, burning pain\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"a muscular angelic razer",areaId:[398,400],areaName:"Fifth Circle of Nur",firstPerson:/^Taking a brisk step backwards, a muscular angelic razer glares piercingly at you with unseeing eyes, his movements filled with contempt\. Without warning, pain flares in your consciousness, radiating from your cranium to fill your body with rending agony\.$/,thirdPerson:!1,tags:["damage","stupidity"],length:2},{user:"a muscular angelic razer",areaId:[398,400],areaName:"Fifth Circle of Nur",firstPerson:/^Closing with you briskly, a muscular angelic razer punches out with his sheathed sword, winding you with a hefty blow to the stomach\. Stepping back unhurriedly, he pulls the sword from its scabbard and slashes at you twice in quick succession\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"a muscular angelic razer",areaId:[398,400],areaName:"Fifth Circle of Nur",firstPerson:/^A muscular angelic razer's wings flare powerfully, sending him colliding into you with his shoulder\. The impact tosses you to the ground like a rag doll, and you can do naught but watch as his hands move in a blur, liberating from its sheath a bastard sword, and guiding it through the air to slice painfully into your exposed form\.$/,thirdPerson:!1,tags:["damage","prone"],length:2},{user:"a lithe angelic razer",areaId:[398,400],areaName:"Fifth Circle of Nur",firstPerson:/^Taking a brisk step backwards, a lithe angelic razer glares piercingly at you with unseeing eyes, her movements filled with contempt\. Without warning, pain flares in your consciousness, radiating from your cranium to fill your body with rending agony\.$/,thirdPerson:!1,tags:["damage","stupidity"],length:2},{user:"a lithe angelic razer",areaId:[398,400],areaName:"Fifth Circle of Nur",firstPerson:/^A lithe angelic razer abruptly blurs into motion, leaping through the air and slicing into you with her longswords\. An instant later, her full weight crashes into you as she plants one foot on your chest and kicks off, before floating to the ground a few paces away\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"a lithe angelic razer",areaId:[398,400],areaName:"Fifth Circle of Nur",firstPerson:/^Advancing upon you swiftly, a lithe angelic razer swings her left-hand longsword in a powerful overarm arc, inflicting a withering strike that crushes your bones\.$/,thirdPerson:!1,tags:["damage","brokenleftarm"],length:2},{user:"a solemn angel",areaId:[397],areaName:"Sixth Circle of Nur",firstPerson:/^Looking down on you with primal ire, a solemn angel jerks her hand up, causing shafts of light to burst through the ground, impaling you in place\.$/,thirdPerson:!1,tags:["damage","impaled"],length:2},{user:"a solemn angel",areaId:[397],areaName:"Sixth Circle of Nur",firstPerson:/^Darting towards you with blinding speed, a solemn angel slashes her hand across your chest, leaving a ghastly glowing wound behind\.$/,thirdPerson:!1,tags:["damage","burning"],length:2},{user:"a solemn angel",areaId:[397],areaName:"Sixth Circle of Nur",firstPerson:/^Drawing her wings out to full length, a solemn angel swiftly claps them together, buffeting you with a massive gust of wind\.$/,thirdPerson:!1,tags:["damage","prone"],length:2}];function _toConsumableArray(arr){return function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}(arr)||function _iterableToArray(iter){if("undefined"!=typeof Symbol&&null!=iter[Symbol.iterator]||null!=iter["@@iterator"])return Array.from(iter)}(arr)||function _unsupportedIterableToArray(o,minLen){if(!o)return;if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);"Object"===n&&o.constructor&&(n=o.constructor.name);if("Map"===n||"Set"===n)return Array.from(o);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}(arr)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}var nexSkills_npcs=[].concat(_toConsumableArray([{user:"a heavily armoured warrior sylphid beetle",areaId:[343],areaName:"Battlesite of Mourning Pass",firstPerson:/^Rearing back on his hind legs, a heavily armoured warrior sylphid beetle lifts his head and spits a glob of saliva at your face\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"a heavily armoured warrior sylphid beetle",areaId:[343],areaName:"Battlesite of Mourning Pass",firstPerson:/^A heavily armoured warrior sylphid beetle snaps at you with his serrated pincers, tearing off chunks of bloody flesh\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"a queen sylphid beetle",areaId:[343],areaName:"Battlesite of Mourning Pass",firstPerson:/^Raising and extending the spines on her quiff, a queen sylphid beetle smacks them into your body, piercing your skin\.$/,thirdPerson:!1,tags:["damage","voyria"],length:2.5}]),_toConsumableArray([{user:"a Migri warrior",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^A Migri warrior's eyes narrow as he grasps his longsword with both hands and raises it over his head before bringing it down across your chest\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"a Migri warrior",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^In a skillful display of swordsmanship, a Migri warrior slashes diagonally across your body before striking you again with a jab through your belly\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"a Migri warrior",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^A Migri warrior bares his teeth and lunges at you with his longsword, the blade easily sliding into your body\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"a Migri warrior",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^A Migri warrior strikes you in the face with the hilt of his sword\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"an undead minion",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^An undead minion leaps forward and rips through your flesh with his teeth, leaving a gaping wound\.$/,thirdPerson:!1,tags:["damage"],length:2.7},{user:"an undead minion",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^Running between your legs, an undead minion strikes your knee with his tail, throwing you off balance\.$/,thirdPerson:!1,tags:["off-balance"],length:2.7},{user:"an undead minion",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^Rearing back and then leaping, an undead minion strikes your chest, causing you to fall to the ground\.$/,thirdPerson:!1,tags:["damage","prone"],length:2.7},{user:"Dakk, leader of the Migri",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^Dakk, leader of the Migri ducks his head and thrusts his blade towards you, jabbing it deep within your chest cavity and striking an artery. The blood pours from your body with each pump of your heart, covering the ground with blood\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"Dakk, leader of the Migri",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^Muttering an incantation, Dakk, leader of the Migri summons flames from his fingertips before balling them up and hurling the fireball towards you\.$/,thirdPerson:!1,tags:["damage","burning"],length:2},{user:"Dakk, leader of the Migri",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^Slashing his blade across your chest, Dakk, leader of the Migri cuts a piece of flesh from your body before striking you with the hilt of his sword, knocking you to the ground\.$/,thirdPerson:!1,tags:["damage","prone"],length:2},{user:"Begath, the Migri mage",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^Begath, the Migri mage snaps both of his fingers. Instantly, flames erupt from the floor and travel towards you, enveloping your body\.$/,thirdPerson:!1,tags:["damage","burning"],length:2.5},{user:"Begath, the Migri mage",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^Begath, the Migri mage reaches towards the ground with an outstretched hand. Pulling up, he forces several large rocks from the ground and then hurls them in your direction, pummeling you\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"Begath, the Migri mage",areaId:[257],areaName:"Judgement Mountain",firstPerson:/^Begath, the Migri mage blows gently over his fingertips, causing them to turn blue and frost over before reaching towards you and sending several ice spikes in your direction\.$/,thirdPerson:!1,tags:["damage"],length:2.5}]),_toConsumableArray([{user:"an energetic turtle",areaId:[335],areaName:"Grukai Swamp",firstPerson:/^An energetic red turtle slams his body into your leg, shattering it in the process.\.$/,thirdPerson:!1,tags:["damage","brokenleftleg"],length:1.5},{user:"a sinister glubber",areaId:[335],areaName:"Grukai Swamp",firstPerson:/^A sinister glubber claws viciously at your arm, severing the joints\.$/,thirdPerson:!1,tags:["damage","brokenleftarm"],length:1.5},{user:"a sinister glubber",areaId:[335],areaName:"Grukai Swamp",firstPerson:/^A sinister glubber claws viciously at your leg, severing the joints\.$/,thirdPerson:!1,tags:["damage","brokenleftleg"],length:1.5},{user:"a sinister glubber",areaId:[335],areaName:"Grukai Swamp",firstPerson:/^A sinister glubber scrapes his nails across your eyes, leaving you unable to see\.$/,thirdPerson:!1,tags:["damage","blindness"],length:1.5},{user:"a sinister glubber",areaId:[335],areaName:"Grukai Swamp",firstPerson:/^Staring intensely at you, a sinister glubber causes his scales to fly off his body and into yours, painfully piercing the skin\.$/,thirdPerson:!1,tags:["damage","voyria"],length:1.5},{user:"a tentacled polyp",areaId:[335],areaName:"Grukai Swamp",firstPerson:/^Flinging his rope-like tentacles around, a tentacled polyp hits you firmly in the chest, leaving a number of noticeable lacerations\.$/,thirdPerson:!1,tags:["damage"],length:11},{user:"a tentacled polyp",areaId:[335],areaName:"Grukai Swamp",firstPerson:/^Waving his appendages before your face, a tentacled polyp leaves a number of deep lacerations and manages to leave you transfixed\.$/,thirdPerson:!1,tags:["damage"],length:11},{user:"a tentacled polyp",areaId:[335],areaName:"Grukai Swamp",firstPerson:/^A tentacled polyp quickly stabs you with his bizarre limbs, leaving a number of deep cuts\.$/,thirdPerson:!1,tags:["damage"],length:11},{user:"a tentacled polyp",areaId:[335],areaName:"Grukai Swamp",firstPerson:/^Wrapping his tentacles around your legs, a tentacled polyp causes you to come crashing to the floor, your legs entangled with his bizarre appendages\.$/,thirdPerson:!1,tags:["damage","prone","webbed"],length:11}]),_toConsumableArray([{user:"an austere Tsol'dasi",areaId:[263],areaName:"Istarion",firstPerson:/^An austere Tsol'dasi withdraws a long, slender blade from beneath the folds of her dress, slashing deeply into your flesh with the sharpened edge\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"an austere Tsol'dasi",areaId:[263],areaName:"Istarion",firstPerson:/^Clenching her fists in brooding anger, an austere Tsol'dasi runs towards you, slamming into your chest and knocking you backwards\.$/,thirdPerson:!1,tags:["damage","balance"],length:4},{user:"an austere Tsol'dasi",areaId:[263],areaName:"Istarion",firstPerson:/^Moving her agile body quickly behind you, an austere Tsol'dasi jabs her long blade swiftly into your side\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a Tsol'dasi villager",areaId:[263],areaName:"Istarion",firstPerson:/^A Tsol'dasi villager withdraws a long, slender blade from beneath the folds of her dress, slashing deeply into your flesh with the sharpened edge\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a Tsol'dasi villager",areaId:[263],areaName:"Istarion",firstPerson:/^Moving her agile body quickly behind you, a Tsol'dasi villager jabs her long blade swiftly into your side\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a Tsol'dasi villager",areaId:[263],areaName:"Istarion",firstPerson:/^Clenching her fists in brooding anger, a Tsol'dasi villager runs towards you, slamming into your chest and knocking you backwards\.$/,thirdPerson:!1,tags:["damage","balance"],length:4},{user:"a hooded Tsol'dasi villager",areaId:[263],areaName:"Istarion",firstPerson:/^Moving her agile body quickly behind you, a hooded Tsol'dasi villager jabs her long blade swiftly into your side\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a hooded Tsol'dasi villager",areaId:[263],areaName:"Istarion",firstPerson:/^Clenching her fists in brooding anger, a hooded Tsol'dasi villager runs towards you, slamming into your chest and knocking you backwards\.$/,thirdPerson:!1,tags:["damage","balance"],length:4},{user:"a hooded Tsol'dasi villager",areaId:[263],areaName:"Istarion",firstPerson:/^A hooded Tsol'dasi villager withdraws a long, slender blade from beneath the folds of her dress, slashing deeply into your flesh with the sharpened edge\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a watch spider outrider",areaId:[263],areaName:"Istarion",firstPerson:/^Swinging her staff in a wide vertical arc, a watch spider outrider brings it down hard upon your head\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a watch spider outrider",areaId:[263],areaName:"Istarion",firstPerson:/^A watch spider outrider sends the sphere end of her staff into one of your kneecaps, causing your bones to crack and pop unpleasantly\.$/,thirdPerson:!1,tags:["damage","brokenrightleg"],length:4},{user:"a watch spider outrider",areaId:[263],areaName:"Istarion",firstPerson:/^Pointing the spherical tip of the staff towards you, a watch spider outrider smiles before tapping it gently\. A torrent of fire erupts from its surface, setting you aflame with its incandescence\.$/,thirdPerson:!1,tags:["damage","burning"],length:4},{user:"a whisper spider outrider",areaId:[263],areaName:"Istarion",firstPerson:/^A whisper spider outrider swings a quick jab at your face, connecting on the jaw\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a whisper spider outrider",areaId:[263],areaName:"Istarion",firstPerson:/^A whisper spider outrider swings a quick jab at your face, connecting on the jaw\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a whisper spider outrider",areaId:[263],areaName:"Istarion",firstPerson:/^A whisper spider outrider sends one of his hands out to your throat\. A triumphant look crosses his face as he grips tightly on your windpipe\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a whisper spider outrider",areaId:[263],areaName:"Istarion",firstPerson:/^A whisper spider outrider moves close to you with speed, grabbing an arm while slamming into your body\. The force of the impact causes you to somersault onto the ground, dislocating your arm in the process\.$/,thirdPerson:!1,tags:["damage","prone","brokenleftarm"],length:4},{user:"a sword spider outrider",areaId:[263],areaName:"Istarion",firstPerson:/^His blades swimming through the air in a series of complex movements, a sword spider outrider slashes into you with incredible force\.$/,thirdPerson:!1,tags:["damage"],length:3},{user:"a sword spider outrider",areaId:[263],areaName:"Istarion",firstPerson:/^Feinting a jab, a sword spider outrider brings the hilt of his other sword towards you, stunning you with its forceful impact into your skull\.$/,thirdPerson:!1,tags:["damage","stun"],length:3},{user:"a sword spider outrider",areaId:[263],areaName:"Istarion",firstPerson:/^Finding both hands preoccupied, a sword spider outrider draws his head back, slamming it into your face\.$/,thirdPerson:!1,tags:["damage"],length:3},{user:"Eriador, the Tsol'dasi merchant",areaId:[263],areaName:"Istarion",firstPerson:/^Eriador, the Tsol'dasi merchant master throws his weight forward and forcefully rams his closed fist into your chest\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"Maal'ryn Asgarai, Outrider Ascendant",areaId:[263],areaName:"Istarion",firstPerson:/^With a great sweep of his mighty staff, Maal'ryn Asgarai, Outrider Ascendant summons a great geyser of brightly burning liquid fire behind him that arcs upwards into the air and rains down furiously upon you\.$/,thirdPerson:!1,tags:["damage","burning"],length:3},{user:"Maal'ryn Asgarai, Outrider Ascendant",areaId:[263],areaName:"Istarion",firstPerson:/^With a single word, Maal'ryn Asgarai, Outrider Ascendant causes the wounds gaping in your flesh to bleed and ebb freshly, draining you of life\.$/,thirdPerson:!1,tags:["damage","heal"],length:3}]),_toConsumableArray(nur_npcs),_toConsumableArray([{user:"a gigantic angler fish",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A gigantic angler fish rapidly lunges towards you, its razor-sharp teeth snapping shut on your arm\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"a gigantic angler fish",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A gigantic angler fish throws itself at you, clamping its sickening jaw tight around your throat\.$/,thirdPerson:!1,tags:["damage","blackout"],length:2},{user:"a gigantic angler fish",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A gigantic angler fish hurls itself at you in a vicious frontal attack, connecting painfully with your chest\.$/,thirdPerson:!1,tags:["damage","stun"],length:2},{user:"a burly troll guard",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A burly troll guard lowers his head and charges at you, slamming powerfully into your abdomen\.$/,thirdPerson:!1,tags:["damage","stun"],length:4},{user:"a burly troll guard",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A burly troll guard lowers his head and charges at you, slamming powerfully into your abdomen\.$/,thirdPerson:!1,tags:["damage","stun"],length:4},{user:"a burly troll guard",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A burly troll guard batters you with an overhead blow\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a burly troll guard",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A burly troll guard screams with rage and drives his spear deep into your chest\.$/,thirdPerson:!1,tags:["damage","balance"],length:4},{user:"a burly troll guard",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A look of absolute rage takes over a burly troll guard as he lunges at you, sinking his abnormally sharp teeth deep into your throat\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a sturdy troll woman",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A sturdy troll woman screams with rage and drives her spear deep into your chest\.$/,thirdPerson:!1,tags:["damage","balance"],length:4},{user:"a sturdy troll woman",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A look of absolute rage takes over a sturdy troll woman as she lunges at you, sinking her abnormally sharp teeth deep into your throat\.$/,thirdPerson:!1,tags:["damage"],length:4},{user:"a sturdy troll woman",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^A sturdy troll woman lowers her head and charges at you, slamming powerfully into your abdomen\.$/,thirdPerson:!1,tags:["damage","stun"],length:4},{user:"Rinaga",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^His trusty shovel held firmly in both hands, Rinaga batters you powerfully around the head with it\.$/,thirdPerson:!1,tags:["damage"],length:3},{user:"Rinaga",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^Rinaga swings a red-hot poker at you with considerable force, slamming it powerfully into the side of your head\.$/,thirdPerson:!1,tags:["damage"],length:3},{user:"Rinaga",areaId:[260],areaName:"the Caverns of Riagath",firstPerson:/^Using his shovel with outstanding accuracy, Rinaga scoops a pile of burning coals from his fire and launches them at you\.$/,thirdPerson:!1,tags:["damage","burning"],length:3}]),_toConsumableArray([{user:"a House Feranki mage",areaId:[145],areaName:"Tir Murann",firstPerson:/^A House Feranki mage pulls out a small box the size of a human fist, shakes it, and throws it at you. On contact it explodes, burning you horribly\.$/,thirdPerson:!1,tags:["damage","burning"],length:2.5},{user:"a House Feranki mage",areaId:[145],areaName:"Tir Murann",firstPerson:/^A House Feranki mage causes some needles to levitate above his palm. With a gesture, they fly unerringly toward you, pricking your skin. You scream in pain as toxins sear through your body\.$/,thirdPerson:!1,tags:["damage","epilepsy"],length:2.5},{user:"a House Feranki mage",areaId:[145],areaName:"Tir Murann",firstPerson:/^A House Feranki mage throws a piece of rope at you. In mid-air, it expands into a mesh of netting that contracts around you\.$/,thirdPerson:!1,tags:["entagle"],length:2.5},{user:"a House Tsez air mage",areaId:[145],areaName:"Tir Murann",firstPerson:/^A House Tsez air mage clasps her hands in front her face, and in response you find yourself gasping for air, unable to breathe\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"a House Tsez air mage",areaId:[145],areaName:"Tir Murann",firstPerson:/^A House Tsez air mage gives a dismissive wave of her hand at you, and you feel a tremendous blast of biting wind that threatens to knock you down\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"a Vertani guard",areaId:[145],areaName:"Tir Murann",firstPerson:/^A Vertani guard sideswipes your ankle with the blunt end of his weapon, the force of the blow causing you to tumble to the ground\.$/,thirdPerson:!1,tags:["damage","prone"],length:2.5},{user:"a Vertani guard",areaId:[145],areaName:"Tir Murann",firstPerson:/^A Vertani guard vaults towards you with surprising speed, bringing the bladed side of his weapon bearing down on you\.$/,thirdPerson:!1,tags:["damage"],length:2.5,multiLine:1},{user:"a Vertani guard",areaId:[145],areaName:"Tir Murann",firstPerson:/^A Vertani guard jabs forward with a powerful blow, skewering through your ribs\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"a scimitar-wielding Vertani soldier",areaId:[145],areaName:"Tir Murann",firstPerson:/^You gnash your teeth as a scimitar-wielding Vertani soldier brings the butt of his scimitar down on your head, splitting your skull\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"a scimitar-wielding Vertani soldier",areaId:[145],areaName:"Tir Murann",firstPerson:/^Lunging at you, a scimitar-wielding Vertani soldier slams his gigantic head into yours. You are stunned from the blow\.$/,thirdPerson:!1,tags:["damage","stun"],length:2.5},{user:"a scimitar-wielding Vertani soldier",areaId:[145],areaName:"Tir Murann",firstPerson:/^You are nearly bisected as a scimitar-wielding Vertani soldier grunts and slashes into you with a huge scimitar\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"Dynas, the gour trainer",areaId:[145],areaName:"Tir Murann",firstPerson:/^Dynas, the gour trainer flicks his staff at your face, connecting square on the nose, which begins to gush blood\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"Dynas, the gour trainer",areaId:[145],areaName:"Tir Murann",firstPerson:/^Dynas, the gour trainer brings his staff crashing down onto your head\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"a drunken Vertani",areaId:[145],areaName:"Tir Murann",firstPerson:/^A drunken Vertani throws a wide haymaker punch at you, connecting against your jaw\.$/,thirdPerson:!1,tags:["damage"],length:3},{user:"a drunken Vertani",areaId:[145],areaName:"Tir Murann",firstPerson:/^A drunken Vertani unsheathes the dagger from his belt and slashes wildly into you with it\.$/,thirdPerson:!1,tags:["damage"],length:3},{user:"a drunken Vertani",areaId:[145],areaName:"Tir Murann",firstPerson:/^A drunken Vertani wraps his huge hands around your throat and throttles you violently\.$/,thirdPerson:!1,tags:["damage"],length:3},{user:"Ohmut, the Vertan craftswoman",areaId:[145],areaName:"Tir Murann",firstPerson:/^Ohmut, the Vertan craftswoman quickly scoops up a jagged rock from the ground before pelting you with it painfully\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"Ohmut, the Vertan craftswoman",areaId:[145],areaName:"Tir Murann",firstPerson:/^Ohmut, the Vertan craftswoman swings her pick horizontally, puncturing the side of your torso\.$/,thirdPerson:!1,tags:["damage"],length:2.5},{user:"Rohase, Captain of the Guard",areaId:[145],areaName:"Tir Murann",firstPerson:/^Rohase, Captain of the Guard jabs forward with a powerful blow, skewering through your ribs\.$/,thirdPerson:!1,tags:["damage"],length:2},{user:"Rohase, Captain of the Guard",areaId:[145],areaName:"Tir Murann",firstPerson:/^Rohase, Captain of the Guard vaults towards you with surprising speed, bringing the bladed side of her weapon bearing down on you\.$/,thirdPerson:!1,tags:["damage"],length:2,multiLine:1}]),_toConsumableArray([{user:"a Nelbennir scout",areaId:[207],areaName:"the Island of Tuar",firstPerson:/^Drawing one long, bony hand from beneath his grey robes a Nelbennir scout grabs at you, seizing your shoulder and sending stabbing pain through your entire body\.$/,thirdPerson:!1,tags:["damage"],length:0},{user:"a Nelbennir scout",areaId:[207],areaName:"the Island of Tuar",firstPerson:/^As a Nelbennir scout focuses intently upon you, his round, bulbous eyes cloud over darkly\.$/,thirdPerson:!1,tags:["damage"],length:0},{user:"a Nelbennir dart-thrower",areaId:[207],areaName:"the Island of Tuar",firstPerson:/^With a swift flick of his supple wrist, a Nelbennir dart-thrower lets fly a tiny, whistling dart towards you\.$/,thirdPerson:!1,tags:["damage","loki"],length:0},{user:"a Nelbennir dart-thrower",areaId:[207],areaName:"the Island of Tuar",firstPerson:/^A Nelbennir dart-thrower swiftly looses a handful of thin, narrow darts, sending their wickedly barbed heads deep into your soft flesh\.$/,thirdPerson:!1,tags:["damage"],length:0},{user:"a spotted pernicon",areaId:[207],areaName:"the Island of Tuar",firstPerson:/^A spotted pernicon rears up on its hind legs and snaps its body forwards, impaling you with its long, sickle-shaped mandibles\.$/,thirdPerson:!1,tags:["damage"],length:0}]),_toConsumableArray([{user:"a rajamala slaver",areaId:[337],areaName:"the fathomless expanse of the World Tree",firstPerson:/^Moving with astonishing speed, a rajamala slaver unleashes the power of his feline claws against your skin\.$/,thirdPerson:!1,tags:["damage","loki"],length:4},{user:"a rajamala slaver",areaId:[337],areaName:"the fathomless expanse of the World Tree",firstPerson:/^A rajamala slaver uses his massive bulk to slam your body to the ground\.$/,thirdPerson:!1,tags:["damage","brokenleftleg","brokenrightleg","prone"],length:4},{user:"a rajamala slaver",areaId:[337],areaName:"the fathomless expanse of the World Tree",firstPerson:/^A rajamala slaver leaps into the air and hurtles towards you\.$/,thirdPerson:!1,tags:["damage","brokenleftleg","brokenrightleg","prone"],length:4},{user:"a huge rat",areaId:[338],areaName:"the fathomless expanse of the World Tree",firstPerson:/^A huge rat snarls in fury as he bites down on your arm, sending a series of spasms racing through your body\.$/,thirdPerson:!1,tags:["damage","loki","loki"],length:4},{user:"a huge rat",areaId:[338],areaName:"the fathomless expanse of the World Tree",firstPerson:/^Hissing with rage, a huge rat swipes a claw across your knees\.$/,thirdPerson:!1,tags:["damage","loki"],length:4},{user:"a huge rat",areaId:[338],areaName:"the fathomless expanse of the World Tree",firstPerson:/^Snarling as he leaps at your legs, a huge rat rips and tears into your flesh, his mouth filling with blood and saliva\.$/,thirdPerson:!1,tags:["damage","loki","torntendons","clumsiness"],length:4}])),nexSkills_actions=[].concat(_toConsumableArray(dragon_actions),_toConsumableArray(actions),_toConsumableArray(occultist_actions),_toConsumableArray(pariah_actions),_toConsumableArray(priest_actions),_toConsumableArray(psion_actions),_toConsumableArray(tattoos_actions),_toConsumableArray(curing_actions),_toConsumableArray(general_actions)),checkNpcs=function checkNpcs(text){var result=!1,action=!1,areaNpcs=nexSkills_npcs.filter((function(e){return e.areaId.includes(GMCP.Location.areaid)}));if(0===areaNpcs.length)return!1;for(var i=0;i<areaNpcs.length;i++){if(action=areaNpcs[i],result=text.match(action.firstPerson)){var _result$groups;action.target="self",null!==(_result$groups=result.groups)&&void 0!==_result$groups&&_result$groups.user&&(action.user=result.groups.user);break}if(result=text.match(action.thirdPerson)){action.target=result.groups.target;break}}return result&&(action.args=result,eventStream.raiseEvent("nexSkillNpcMatch",action)),result||!1},nexSkills={actions:nexSkills_actions,npcs:nexSkills_npcs,checkSkills:function checkSkills(text){for(var result=!1,action=!1,i=0;i<nexSkills_actions.length;i++){if(((action=nexSkills_actions[i]).profession.includes(GMCP.Char.Status.class.toLowerCase())||action.profession.includes("general"))&&(result=text.match(action.firstPerson))){action.user="self",action.target=result.groups.target;break}if(result=text.match(action.secondPerson)){action.user=result.groups.user,action.target="self";break}if(result=text.match(action.thirdPerson)){action.user=result.groups.user,action.target=result.groups.target;break}}return result&&(action.args=result,action.reaction&&action.reaction(),eventStream.raiseEvent("nexSkillMatch",action)),result?action:checkNpcs(text)},checkNpcs:checkNpcs,startUp:startUp};globalThis.nexSkills=nexSkills}();