diffusion
Version:
Diffusion JavaScript client
1 lines • 308 kB
JavaScript
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).diffusion=t()}}((function(){var t,e=function(t){var e;return function(r){return e||t(e={exports:{},parent:r},e.exports),e.exports}},r=e((function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DataTypes=void 0;var r=n({}),o=function(){function t(){this.recordv2Impl=new qo.RecordV2DataTypeImpl,this.binaryImpl=new Wr.BinaryDataTypeImpl,this.stringImpl=new qn.StringDataTypeImpl,this.doubleImpl=new Mn.DoubleDataTypeImpl,this.int64Impl=new Un.Int64DataTypeImpl,this.jsonImpl=new Nn.JSONDataTypeImpl,this.anyImpl=new Ye.AnyDataTypeImpl}return t.prototype.binary=function(){return this.binaryImpl},t.prototype.string=function(){return this.stringImpl},t.prototype.double=function(){return this.doubleImpl},t.prototype.int64=function(){return this.int64Impl},t.prototype.json=function(){return this.jsonImpl},t.prototype.recordv2=function(){return this.recordv2Impl},t.prototype.any=function(){return this.anyImpl},t.prototype.timeseries=function(t){return r.TimeSeriesEventDataType.create(t)},t.prototype.getByName=function(t){switch(t.toLowerCase()){case"json":return this.json();case"int64":return this.int64();case"binary":return this.binary();case"string":return this.string();case"double":return this.double();case"record_v2":return this.recordv2();default:return}},t.prototype.getByValue=function(t){return t===je.TopicTypeEnum.BINARY||t instanceof Gr.BinaryImpl||kt.isUint8Array(t)?this.binary():t===je.TopicTypeEnum.JSON||t instanceof bn.JSONImpl||t.constructor===Object||"boolean"==typeof t?this.json():t===je.TopicTypeEnum.STRING||"string"==typeof t?this.string():t===je.TopicTypeEnum.DOUBLE||"number"==typeof t?this.double():t===je.TopicTypeEnum.INT64||t instanceof Je.Int64Impl?this.int64():t===je.TopicTypeEnum.RECORD_V2||t instanceof Eo.RecordV2Impl?this.recordv2():void 0},t.prototype.get=function(t){var e;return"string"==typeof t&&(e=this.getByName(t)),e||(e=this.getByValue(t)),e||(e=this.getByClassSafely(t)),e||null},t.prototype.getChecked=function(t){if(null==t)throw new s.IllegalArgumentError("No data type for "+t);if(t instanceof qo.RecordV2DataTypeImpl||t instanceof Wr.BinaryDataTypeImpl||t instanceof qn.StringDataTypeImpl||t instanceof Mn.DoubleDataTypeImpl||t instanceof Un.Int64DataTypeImpl||t instanceof Nn.JSONDataTypeImpl)return t;var e=this.get(t);if(null===e)throw new s.IllegalArgumentError("No data type for "+t);return e},t.prototype.getValueClassChecked=function(t){switch(this.getChecked(t)){case this.jsonImpl:return bn.JSONImpl;case this.binaryImpl:return Gr.BinaryImpl;case this.stringImpl:return String;case this.doubleImpl:return Number;case this.int64Impl:return Je.Int64Impl;case this.recordv2Impl:return Eo.RecordV2Impl;default:return}},t.prototype.getByClassSafely=function(t){switch(t){case bn.JSONImpl:return this.jsonImpl;case Gr.BinaryImpl:return this.binaryImpl;case String:return this.stringImpl;case Number:return this.doubleImpl;case Je.Int64Impl:return this.int64Impl;case Eo.RecordV2Impl:return this.recordv2Impl;default:return}},t.prototype.getByClass=function(t){var e=this.getByClassSafely(t);if(e)return e;throw new s.IllegalArgumentError("No data type for "+t)},t}(),i=new o;e.DataTypes=i})),n=e((function(t,e){(function(t){(function(){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.TimeSeriesEventDataType=void 0;var i,a=r({});function u(t,e){var r=new ce.BufferOutputStream;e.isEditEvent?(Lt.writeByte(r,i.EDIT_EVENT),Ko.EventMetadataImplSerialiser.write(r,e.originalEvent)):Lt.writeByte(r,i.ORIGINAL_EVENT),Ko.EventMetadataImplSerialiser.write(r,e);var n=t(e.value);return Lt.writeBytes(r,n.$buffer),r.getBuffer()}function c(t,e){var r=new ae.BufferInputStream(e.$buffer),n=Lt.readByte(r);switch(n){case i.ORIGINAL_EVENT:return function(t,e){var r=Ko.EventMetadataImplSerialiser.read(e),n=t(Lt.readBytes(e));return Yo.EventImpl.create(r,r,n)}(t,r);case i.EDIT_EVENT:return function(t,e){var r=Ko.EventMetadataImplSerialiser.read(e),n=Ko.EventMetadataImplSerialiser.read(e),o=t(Lt.readBytes(e));return Yo.EventImpl.create(n,r,o)}(t,r);default:throw new s.InvalidDataError("Unrecognised event type: "+n)}}!function(t){t[t.ORIGINAL_EVENT=0]="ORIGINAL_EVENT",t[t.EDIT_EVENT=1]="EDIT_EVENT"}(i||(i={}));var l=function(e){function r(t,r,n,o){var i=this,l=a.DataTypes.getByName(r),f=void 0!==l?[{name:l.valueClass.toString(),convert:function(t,e,r){var o=new Vr.BytesImpl(t,e,r);return c(n,o).value}}]:[];return(i=e.call(this,t,Yo.EventImpl,Vr.BytesImpl,(function(t){return function(t,e){if(!e)throw new s.IllegalArgumentError("Cannot convert null event to Bytes");return new Vr.BytesImpl(u(t,e))}(o,t)}),(function(t){return c(n,t)}),f,!0)||this).valueToBytes=o,i.valueTypeName=r,i}return o(r,e),r.create=function(t){return new r("timeseriesevent-"+t.name(),t.name(),t.readValue.bind(t),t.toBytes.bind(t))},r.prototype.writeValue=function(e){return t.from(u(this.valueToBytes,e))},r.prototype.writeValueToArray=function(t){return u(this.valueToBytes,t)},r.prototype.validate=function(){},r.prototype.from=function(t){return t instanceof cr.BufferSlice?t:this.valueToBytes(t.value)},r}(Fr.AbstractDataType);e.TimeSeriesEventDataType=l}).call(this)}).call(this,i({}).Buffer)})),o=e((function(t,e){(function(t){(function(){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decompressSync=void 0;var r=require("zlib");e.decompressSync=function(e){var n=e instanceof Uint8Array?void 0===t?e:t.from(e):e;return r.inflateSync(n)}}).call(this)}).call(this,i({}).Buffer)})),i=e((function(t,e){(function(t){(function(){"use strict";e.Buffer=r,e.INSPECT_MAX_BYTES=50;function t(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=r.prototype,e}function r(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return i(t)}return n(t,e,r)}function n(e,n,o){if("string"==typeof e)return function(e,n){"string"==typeof n&&""!==n||(n="utf8");if(!r.isEncoding(n))throw new TypeError("Unknown encoding: "+n);var o=0|u(e,n),i=t(o),s=i.write(e,n);s!==o&&(i=i.slice(0,s));return i}(e,n);if(ArrayBuffer.isView(e))return s(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(k(e,ArrayBuffer)||e&&k(e.buffer,ArrayBuffer))return function(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');var o;o=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n);return o.__proto__=r.prototype,o}(e,n,o);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return r.from(i,n,o);var c=function(e){if(r.isBuffer(e)){var n=0|a(e.length),o=t(n);return 0===o.length||e.copy(o,0,0,n),o}if(void 0!==e.length)return"number"!=typeof e.length||L(e.length)?t(0):s(e);if("Buffer"===e.type&&Array.isArray(e.data))return s(e.data)}(e);if(c)return c;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return r.from(e[Symbol.toPrimitive]("string"),n,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function o(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function i(e){return o(e),t(e<0?0:0|a(e))}function s(e){for(var r=e.length<0?0:0|a(e.length),n=t(r),o=0;o<r;o+=1)n[o]=255&e[o];return n}function a(t){if(t>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function u(t,e){if(r.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||k(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var n=t.length,o=arguments.length>2&&!0===arguments[2];if(!o&&0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return D(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return x(t).length;default:if(i)return o?-1:D(t).length;e=(""+e).toLowerCase(),i=!0}}function c(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return b(this,e,r);case"utf8":case"utf-8":return S(this,e,r);case"ascii":return w(this,e,r);case"latin1":case"binary":return _(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function l(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function f(t,e,n,o,i){if(0===t.length)return-1;if("string"==typeof n?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),L(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=r.from(e,o)),r.isBuffer(e))return 0===e.length?-1:p(t,e,n,o,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):p(t,[e],n,o,i);throw new TypeError("val must be string, number or Buffer")}function p(t,e,r,n,o){var i,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){var l=-1;for(i=r;i<a;i++)if(c(t,i)===c(e,-1===l?0:i-l)){if(-1===l&&(l=i),i-l+1===u)return l*s}else-1!==l&&(i-=i-l),l=-1}else for(r+u>a&&(r=a-u),i=r;i>=0;i--){for(var f=!0,p=0;p<u;p++)if(c(t,i+p)!==c(e,p)){f=!1;break}if(f)return i}return-1}function h(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(L(a))return s;t[r+s]=a}return s}function d(t,e,r,n){return M(D(e,t.length-r),t,r,n)}function y(t,e,r,n){return M(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function v(t,e,r,n){return y(t,e,r,n)}function m(t,e,r,n){return M(x(e),t,r,n)}function g(t,e,r,n){return M(function(t,e){for(var r,n,o,i=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function E(t,e,r){return 0===e&&r===t.length?Ot.fromByteArray(t):Ot.fromByteArray(t.slice(e,r))}function S(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,s,a,u,c=t[o],l=null,f=c>239?4:c>223?3:c>191?2:1;if(o+f<=r)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&c)<<6|63&i)>127&&(l=u);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&(u=(15&c)<<12|(63&i)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=t[o+1],s=t[o+2],a=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),o+=f}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}r.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),r.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(r.prototype,"parent",{enumerable:!0,get:function(){if(r.isBuffer(this))return this.buffer}}),Object.defineProperty(r.prototype,"offset",{enumerable:!0,get:function(){if(r.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&r[Symbol.species]===r&&Object.defineProperty(r,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),r.poolSize=8192,r.from=function(t,e,r){return n(t,e,r)},r.prototype.__proto__=Uint8Array.prototype,r.__proto__=Uint8Array,r.alloc=function(e,r,n){return function(e,r,n){return o(e),e<=0?t(e):void 0!==r?"string"==typeof n?t(e).fill(r,n):t(e).fill(r):t(e)}(e,r,n)},r.allocUnsafe=function(t){return i(t)},r.allocUnsafeSlow=function(t){return i(t)},r.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==r.prototype},r.compare=function(t,e){if(k(t,Uint8Array)&&(t=r.from(t,t.offset,t.byteLength)),k(e,Uint8Array)&&(e=r.from(e,e.offset,e.byteLength)),!r.isBuffer(t)||!r.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var n=t.length,o=e.length,i=0,s=Math.min(n,o);i<s;++i)if(t[i]!==e[i]){n=t[i],o=e[i];break}return n<o?-1:o<n?1:0},r.isEncoding=function(t){switch(String(t).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}},r.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return r.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var o=r.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var s=t[n];if(k(s,Uint8Array)&&(s=r.from(s)),!r.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(o,i),i+=s.length}return o},r.byteLength=u,r.prototype._isBuffer=!0,r.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)l(this,e,e+1);return this},r.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)l(this,e,e+3),l(this,e+1,e+2);return this},r.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)l(this,e,e+7),l(this,e+1,e+6),l(this,e+2,e+5),l(this,e+3,e+4);return this},r.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?S(this,0,t):c.apply(this,arguments)},r.prototype.toLocaleString=r.prototype.toString,r.prototype.equals=function(t){if(!r.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===r.compare(this,t)},r.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},r.prototype.compare=function(t,e,n,o,i){if(k(t,Uint8Array)&&(t=r.from(t,t.offset,t.byteLength)),!r.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===o&&(o=0),void 0===i&&(i=this.length),e<0||n>t.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&e>=n)return 0;if(o>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var s=(i>>>=0)-(o>>>=0),a=(n>>>=0)-(e>>>=0),u=Math.min(s,a),c=this.slice(o,i),l=t.slice(e,n),f=0;f<u;++f)if(c[f]!==l[f]){s=c[f],a=l[f];break}return s<a?-1:a<s?1:0},r.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},r.prototype.indexOf=function(t,e,r){return f(this,t,e,r,!0)},r.prototype.lastIndexOf=function(t,e,r){return f(this,t,e,r,!1)},r.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return h(this,t,e,r);case"utf8":case"utf-8":return d(this,t,e,r);case"ascii":return y(this,t,e,r);case"latin1":case"binary":return v(this,t,e,r);case"base64":return m(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return g(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function w(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function _(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function b(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=P(t[i]);return o}function I(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function O(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function T(t,e,n,o,i,s){if(!r.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(n+o>t.length)throw new RangeError("Index out of range")}function R(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function C(t,e,r,n,o){return e=+e,r>>>=0,o||R(t,0,r,4),Mt.write(t,e,r,n,23,4),r+4}function A(t,e,r,n,o){return e=+e,r>>>=0,o||R(t,0,r,8),Mt.write(t,e,r,n,52,8),r+8}r.prototype.slice=function(t,e){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);var o=this.subarray(t,e);return o.__proto__=r.prototype,o},r.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},r.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},r.prototype.readUInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),this[t]},r.prototype.readUInt16LE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]|this[t+1]<<8},r.prototype.readUInt16BE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]<<8|this[t+1]},r.prototype.readUInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},r.prototype.readUInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},r.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},r.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},r.prototype.readInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},r.prototype.readInt16LE=function(t,e){t>>>=0,e||O(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},r.prototype.readInt16BE=function(t,e){t>>>=0,e||O(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},r.prototype.readInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},r.prototype.readInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},r.prototype.readFloatLE=function(t,e){return t>>>=0,e||O(t,4,this.length),Mt.read(this,t,!0,23,4)},r.prototype.readFloatBE=function(t,e){return t>>>=0,e||O(t,4,this.length),Mt.read(this,t,!1,23,4)},r.prototype.readDoubleLE=function(t,e){return t>>>=0,e||O(t,8,this.length),Mt.read(this,t,!0,52,8)},r.prototype.readDoubleBE=function(t,e){return t>>>=0,e||O(t,8,this.length),Mt.read(this,t,!1,52,8)},r.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||T(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},r.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||T(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},r.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,1,255,0),this[e]=255&t,e+1},r.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},r.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},r.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},r.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},r.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);T(this,t,e,r,o-1,-o)}var i=0,s=1,a=0;for(this[e]=255&t;++i<r&&(s*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+r},r.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);T(this,t,e,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+r},r.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},r.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},r.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},r.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},r.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},r.prototype.writeFloatLE=function(t,e,r){return C(this,t,e,!0,r)},r.prototype.writeFloatBE=function(t,e,r){return C(this,t,e,!1,r)},r.prototype.writeDoubleLE=function(t,e,r){return A(this,t,e,!0,r)},r.prototype.writeDoubleBE=function(t,e,r){return A(this,t,e,!1,r)},r.prototype.copy=function(t,e,n,o){if(!r.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),o||0===o||(o=this.length),e>=t.length&&(e=t.length),e||(e=0),o>0&&o<n&&(o=n),o===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),t.length-e<o-n&&(o=t.length-e+n);var i=o-n;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(e,n,o);else if(this===t&&n<e&&e<o)for(var s=i-1;s>=0;--s)t[s+e]=this[s+n];else Uint8Array.prototype.set.call(t,this.subarray(n,o),e);return i},r.prototype.fill=function(t,e,n,o){if("string"==typeof t){if("string"==typeof e?(o=e,e=0,n=this.length):"string"==typeof n&&(o=n,n=this.length),void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!r.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(1===t.length){var i=t.charCodeAt(0);("utf8"===o&&i<128||"latin1"===o)&&(t=i)}}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var s;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=e;s<n;++s)this[s]=t;else{var a=r.isBuffer(t)?t:r.from(t,o),u=a.length;if(0===u)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<n-e;++s)this[s+e]=a[s%u]}return this};var N=/[^+/0-9A-Za-z-_]/g;function P(t){return t<16?"0"+t.toString(16):t.toString(16)}function D(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function x(t){return Ot.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(N,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function M(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function k(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function L(t){return t!=t}}).call(this)}).call(this,i({}).Buffer)})),s={},a=this&&this.__extends||(t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)},function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)});Object.defineProperty(s,"__esModule",{value:!0}),s.InternalError=s.IllegalStateError=s.SchemaParseError=s.SchemaViolationError=s.OutOfBoundsError=s.IllegalArgumentError=s.SessionError=s.IOError=s.InvalidDataError=s.AssertionError=s.RuntimeError=s.NullValueError=void 0;var u=function(t){function e(e){return t.call(this,e)||this}return a(e,t),e.prototype.getType=function(){return e.type},e.type="null_value_error",e}(Error);s.NullValueError=u;var c=function(t){function e(e,r){var n=t.call(this,e)||this;return n.cause=r,n}return a(e,t),e.prototype.getType=function(){return e.type},e.type="runtime_error",e}(Error);s.RuntimeError=c;var l=function(t){function e(e){return t.call(this,e)||this}return a(e,t),e.prototype.getType=function(){return e.type},e.type="assertion_error",e}(Error);s.AssertionError=l;var f=function(t){function e(e){return t.call(this,e)||this}return a(e,t),e.prototype.getType=function(){return e.type},e.type="invalid_data_error",e}(Error);s.InvalidDataError=f;var p=function(t){function e(e){return t.call(this,e)||this}return a(e,t),e.prototype.getType=function(){return e.type},e.type="io_error",e}(Error);s.IOError=p;var h=function(t){function e(e,r){var n=t.call(this,e)||this;return n.cause=r,n}return a(e,t),e.prototype.getType=function(){return e.type},e.type="session_error",e}(Error);s.SessionError=h;var d=function(t){function e(e){return t.call(this,e)||this}return a(e,t),e.prototype.getType=function(){return e.type},e.type="illegal_argument_error",e}(Error);s.IllegalArgumentError=d;var y=function(t){function e(e){return t.call(this,e)||this}return a(e,t),e.prototype.getType=function(){return e.type},e.type="out_of_bounds_error",e}(Error);s.OutOfBoundsError=y;!function(t){function e(e,r){var n=t.call(this,e)||this;return n.errors=r,n}a(e,t),e.prototype.getType=function(){return e.type},e.type="invalid_filter_error"}(Error);var v=function(t){function e(e){return t.call(this,e)||this}return a(e,t),e.prototype.getType=function(){return e.type},e.type="schema_violation_error",e}(Error);s.SchemaViolationError=v;var m=function(t){function e(e){return t.call(this,e)||this}return a(e,t),e.prototype.getType=function(){return e.type},e.type="schema_parse_error",e}(Error);s.SchemaParseError=m;!function(t){function e(e){return t.call(this,e)||this}a(e,t),e.prototype.getType=function(){return e.type},e.type="retry_limit_error"}(Error);var g=function(t){function e(e){return t.call(this,e)||this}return a(e,t),e.prototype.getType=function(){return e.type},e.type="illegal_state_error",e}(Error);s.IllegalStateError=g;var E=function(t){function e(e){return t.call(this,e)||this}return a(e,t),e.prototype.getType=function(){return e.type},e.type="internal_error",e}(Error);s.InternalError=E;var S=_,w=null;try{w=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(t){}function _(t,e,r){this.low=0|t,this.high=0|e,this.unsigned=!!r}function b(t){return!0===(t&&t.__isLong__)}_.prototype.__isLong__,Object.defineProperty(_.prototype,"__isLong__",{value:!0}),_.isLong=b;var I={},O={};function T(t,e){var r,n,o;return e?(o=0<=(t>>>=0)&&t<256)&&(n=O[t])?n:(r=C(t,(0|t)<0?-1:0,!0),o&&(O[t]=r),r):(o=-128<=(t|=0)&&t<128)&&(n=I[t])?n:(r=C(t,t<0?-1:0,!1),o&&(I[t]=r),r)}function R(t,e){if(isNaN(t))return e?B:L;if(e){if(t<0)return B;if(t>=x)return q}else{if(t<=-M)return H;if(t+1>=M)return F}return t<0?R(-t,e).neg():C(t%D|0,t/D|0,e)}function C(t,e,r){return new _(t,e,r)}_.fromInt=T,_.fromNumber=R,_.fromBits=C;var A=Math.pow;function N(t,e,r){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return L;if("number"==typeof e?(r=e,e=!1):e=!!e,(r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=t.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return N(t.substring(1),e,r).neg();for(var o=R(A(r,8)),i=L,s=0;s<t.length;s+=8){var a=Math.min(8,t.length-s),u=parseInt(t.substring(s,s+a),r);if(a<8){var c=R(A(r,a));i=i.mul(c).add(R(u))}else i=(i=i.mul(o)).add(R(u))}return i.unsigned=e,i}function P(t,e){return"number"==typeof t?R(t,e):"string"==typeof t?N(t,e):C(t.low,t.high,"boolean"==typeof e?e:t.unsigned)}_.fromString=N,_.fromValue=P;var D=4294967296,x=D*D,M=x/2,k=T(1<<24),L=T(0);_.ZERO=L;var B=T(0,!0);_.UZERO=B;var U=T(1);_.ONE=U;var j=T(1,!0);_.UONE=j;var V=T(-1);_.NEG_ONE=V;var F=C(-1,2147483647,!1);_.MAX_VALUE=F;var q=C(-1,-1,!0);_.MAX_UNSIGNED_VALUE=q;var H=C(0,-2147483648,!1);_.MIN_VALUE=H;var G=_.prototype;G.toInt=function(){return this.unsigned?this.low>>>0:this.low},G.toNumber=function(){return this.unsigned?(this.high>>>0)*D+(this.low>>>0):this.high*D+(this.low>>>0)},G.toString=function(t){if((t=t||10)<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(H)){var e=R(t),r=this.div(e),n=r.mul(e).sub(this);return r.toString(t)+n.toInt().toString(t)}return"-"+this.neg().toString(t)}for(var o=R(A(t,6),this.unsigned),i=this,s="";;){var a=i.div(o),u=(i.sub(a.mul(o)).toInt()>>>0).toString(t);if((i=a).isZero())return u+s;for(;u.length<6;)u="0"+u;s=""+u+s}},G.getHighBits=function(){return this.high},G.getHighBitsUnsigned=function(){return this.high>>>0},G.getLowBits=function(){return this.low},G.getLowBitsUnsigned=function(){return this.low>>>0},G.getNumBitsAbs=function(){if(this.isNegative())return this.eq(H)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&0==(t&1<<e);e--);return 0!=this.high?e+33:e+1},G.isZero=function(){return 0===this.high&&0===this.low},G.eqz=G.isZero,G.isNegative=function(){return!this.unsigned&&this.high<0},G.isPositive=function(){return this.unsigned||this.high>=0},G.isOdd=function(){return 1==(1&this.low)},G.isEven=function(){return 0==(1&this.low)},G.equals=function(t){return b(t)||(t=P(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&(this.high===t.high&&this.low===t.low)},G.eq=G.equals,G.notEquals=function(t){return!this.eq(t)},G.neq=G.notEquals,G.ne=G.notEquals,G.lessThan=function(t){return this.comp(t)<0},G.lt=G.lessThan,G.lessThanOrEqual=function(t){return this.comp(t)<=0},G.lte=G.lessThanOrEqual,G.le=G.lessThanOrEqual,G.greaterThan=function(t){return this.comp(t)>0},G.gt=G.greaterThan,G.greaterThanOrEqual=function(t){return this.comp(t)>=0},G.gte=G.greaterThanOrEqual,G.ge=G.greaterThanOrEqual,G.compare=function(t){if(b(t)||(t=P(t)),this.eq(t))return 0;var e=this.isNegative(),r=t.isNegative();return e&&!r?-1:!e&&r?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},G.comp=G.compare,G.negate=function(){return!this.unsigned&&this.eq(H)?H:this.not().add(U)},G.neg=G.negate,G.add=function(t){b(t)||(t=P(t));var e=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,i=t.high>>>16,s=65535&t.high,a=t.low>>>16,u=0,c=0,l=0,f=0;return l+=(f+=o+(65535&t.low))>>>16,c+=(l+=n+a)>>>16,u+=(c+=r+s)>>>16,u+=e+i,C((l&=65535)<<16|(f&=65535),(u&=65535)<<16|(c&=65535),this.unsigned)},G.subtract=function(t){return b(t)||(t=P(t)),this.add(t.neg())},G.sub=G.subtract,G.multiply=function(t){if(this.isZero())return L;if(b(t)||(t=P(t)),w)return C(w.mul(this.low,this.high,t.low,t.high),w.get_high(),this.unsigned);if(t.isZero())return L;if(this.eq(H))return t.isOdd()?H:L;if(t.eq(H))return this.isOdd()?H:L;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(k)&&t.lt(k))return R(this.toNumber()*t.toNumber(),this.unsigned);var e=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,i=t.high>>>16,s=65535&t.high,a=t.low>>>16,u=65535&t.low,c=0,l=0,f=0,p=0;return f+=(p+=o*u)>>>16,l+=(f+=n*u)>>>16,f&=65535,l+=(f+=o*a)>>>16,c+=(l+=r*u)>>>16,l&=65535,c+=(l+=n*a)>>>16,l&=65535,c+=(l+=o*s)>>>16,c+=e*u+r*a+n*s+o*i,C((f&=65535)<<16|(p&=65535),(c&=65535)<<16|(l&=65535),this.unsigned)},G.mul=G.multiply,G.divide=function(t){if(b(t)||(t=P(t)),t.isZero())throw Error("division by zero");var e,r,n;if(w)return this.unsigned||-2147483648!==this.high||-1!==t.low||-1!==t.high?C((this.unsigned?w.div_u:w.div_s)(this.low,this.high,t.low,t.high),w.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?B:L;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return B;if(t.gt(this.shru(1)))return j;n=B}else{if(this.eq(H))return t.eq(U)||t.eq(V)?H:t.eq(H)?U:(e=this.shr(1).div(t).shl(1)).eq(L)?t.isNegative()?U:V:(r=this.sub(t.mul(e)),n=e.add(r.div(t)));if(t.eq(H))return this.unsigned?B:L;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();n=L}for(r=this;r.gte(t);){e=Math.max(1,Math.floor(r.toNumber()/t.toNumber()));for(var o=Math.ceil(Math.log(e)/Math.LN2),i=o<=48?1:A(2,o-48),s=R(e),a=s.mul(t);a.isNegative()||a.gt(r);)a=(s=R(e-=i,this.unsigned)).mul(t);s.isZero()&&(s=U),n=n.add(s),r=r.sub(a)}return n},G.div=G.divide,G.modulo=function(t){return b(t)||(t=P(t)),w?C((this.unsigned?w.rem_u:w.rem_s)(this.low,this.high,t.low,t.high),w.get_high(),this.unsigned):this.sub(this.div(t).mul(t))},G.mod=G.modulo,G.rem=G.modulo,G.not=function(){return C(~this.low,~this.high,this.unsigned)},G.and=function(t){return b(t)||(t=P(t)),C(this.low&t.low,this.high&t.high,this.unsigned)},G.or=function(t){return b(t)||(t=P(t)),C(this.low|t.low,this.high|t.high,this.unsigned)},G.xor=function(t){return b(t)||(t=P(t)),C(this.low^t.low,this.high^t.high,this.unsigned)},G.shiftLeft=function(t){return b(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?C(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):C(0,this.low<<t-32,this.unsigned)},G.shl=G.shiftLeft,G.shiftRight=function(t){return b(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?C(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):C(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},G.shr=G.shiftRight,G.shiftRightUnsigned=function(t){if(b(t)&&(t=t.toInt()),0===(t&=63))return this;var e=this.high;return t<32?C(this.low>>>t|e<<32-t,e>>>t,this.unsigned):C(32===t?e:e>>>t-32,0,this.unsigned)},G.shru=G.shiftRightUnsigned,G.shr_u=G.shiftRightUnsigned,G.toSigned=function(){return this.unsigned?C(this.low,this.high,!1):this},G.toUnsigned=function(){return this.unsigned?this:C(this.low,this.high,!0)},G.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},G.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},G.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},_.fromBytes=function(t,e,r){return r?_.fromBytesLE(t,e):_.fromBytesBE(t,e)},_.fromBytesLE=function(t,e){return new _(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,e)},_.fromBytesBE=function(t,e){return new _(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],e)};var W={};Object.defineProperty(W,"__esModule",{value:!0}),W.ONEWAY_CID=W.ConversationId=void 0;var Y=function(){function t(t){this.val=t}return t.fromString=function(e){return new t(S.fromString(e,!1))},t.prototype.toString=function(){return this.val.toString(10)},t.prototype.equals=function(t){return t.val&&this.val.equals(t.val)},t}();W.ConversationId=Y,W.ONEWAY_CID=new Y(S.fromNumber(0));var $={exports:{}};!function(t,e){"use strict";$.exports?$.exports=e():t.log=e()}(this,(function(){"use strict";var t=function(){},e="undefined"!=typeof window&&void 0!==window.navigator&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"];function n(t,e){var r=t[e];if("function"==typeof r.bind)return r.bind(t);try{return Function.prototype.bind.call(r,t)}catch(e){return function(){return Function.prototype.apply.apply(r,[t,arguments])}}}function o(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function i(r){return"debug"===r&&(r="log"),"undefined"!=typeof console&&("trace"===r&&e?o:void 0!==console[r]?n(console,r):void 0!==console.log?n(console,"log"):t)}function s(e,n){for(var o=0;o<r.length;o++){var i=r[o];this[i]=o<e?t:this.methodFactory(i,e,n)}this.log=this.debug}function a(t,e,r){return function(){"undefined"!=typeof console&&(s.call(this,e,r),this[t].apply(this,arguments))}}function u(t,e,r){return i(t)||a.apply(this,arguments)}function c(t,e,n){var o,i=this,a="loglevel";function c(){var t;if("undefined"!=typeof window&&a){try{t=window.localStorage[a]}catch(t){}if(void 0===t)try{var e=window.document.cookie,r=e.indexOf(encodeURIComponent(a)+"=");-1!==r&&(t=/^([^;]+)/.exec(e.slice(r))[1])}catch(t){}return void 0===i.levels[t]&&(t=void 0),t}}"string"==typeof t?a+=":"+t:"symbol"==typeof t&&(a=void 0),i.name=t,i.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},i.methodFactory=n||u,i.getLevel=function(){return o},i.setLevel=function(e,n){if("string"==typeof e&&void 0!==i.levels[e.toUpperCase()]&&(e=i.levels[e.toUpperCase()]),!("number"==typeof e&&e>=0&&e<=i.levels.SILENT))throw"log.setLevel() called with invalid level: "+e;if(o=e,!1!==n&&function(t){var e=(r[t]||"silent").toUpperCase();if("undefined"!=typeof window&&a){try{return void(window.localStorage[a]=e)}catch(t){}try{window.document.cookie=encodeURIComponent(a)+"="+e+";"}catch(t){}}}(e),s.call(i,e,t),"undefined"==typeof console&&e<i.levels.SILENT)return"No console available for logging"},i.setDefaultLevel=function(t){c()||i.setLevel(t,!1)},i.enableAll=function(t){i.setLevel(i.levels.TRACE,t)},i.disableAll=function(t){i.setLevel(i.levels.SILENT,t)};var l=c();null==l&&(l=null==e?"WARN":e),i.setLevel(l,!1)}var l=new c,f={};l.getLogger=function(t){if("symbol"!=typeof t&&"string"!=typeof t||""===t)throw new TypeError("You must supply a name when creating a logger.");var e=f[t];return e||(e=f[t]=new c(t,l.getLevel(),l.methodFactory)),e};var p="undefined"!=typeof window?window.log:void 0;return l.noConflict=function(){return"undefined"!=typeof window&&window.log===l&&(window.log=p),l},l.getLoggers=function(){return f},l.default=l,l})),$=$.exports;var J,z={},K=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};function Q(t,e){var r="|"+t.toUpperCase()+"|"+e+"|",n=function(){return new Date};return function(e,o){o?$[t](n()+r+e,o):$[t](n()+r+e)}}Object.defineProperty(z,"__esModule",{value:!0}),z.create=z.LoggingLevel=void 0,function(t){t.trace="trace",t.debug="debug",t.info="info",t.warn="warn",t.error="error"}(J=z.LoggingLevel||(z.LoggingLevel={})),z.create=function(t){var e,r,n={};try{for(var o=K(Object.keys(J)),i=o.next();!i.done;i=o.next()){var s=i.value;n[s]=Q(s,t)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return n},$.setLevel;var X={},Z=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),tt=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},et=this&&this.__generator||function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},rt=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(X,"__esModule",{value:!0}),X.create=X.ConversationSet=X.Result=X.ConversationIdGenerator=void 0;var nt,ot,it=(nt=new S(0),function(){return tt(void 0,void 0,void 0,(function(){return et(this,(function(t){return nt=nt.add(1),[2,new W.ConversationId(nt)]}))}))});X.ConversationIdGenerator=it,function(t){t[t.ALREADY_FINISHED=0]="ALREADY_FINISHED",t[t.HANDLED_AND_ACTIVE=1]="HANDLED_AND_ACTIVE",t[t.HANDLED_AND_FINISHED=2]="HANDLED_AND_FINISHED"}(ot=X.Result||(X.Result={}));var st=z.create("Conversation Set"),at=function(t){function e(e){var r=t.call(this,e)||this;return r.name="NoSuchConversationError",r}return Z(e,t),e}(Error),ut=function(){function t(t,e){this.reserved=!1,this.closed=!1,this.handler=t,this.completedExceptionally=e}return t.prototype.open=function(t){this.handler.onOpen(t)},t.prototype.respond=function(t,e){if(this.closed)return ot.ALREADY_FINISHED;var r,n=this.reserved;this.reserved=!0;try{r=this.handler.onResponse(t,e)}catch(e){throw this.completedExceptionally(t,this,e),e}return this.closed?(st.debug("Conversation already closed",t),ot.HANDLED_AND_FINISHED):r?(st.debug("Response handler closed conversation",t),this.closed=!0,ot.HANDLED_AND_FINISHED):this.pendingDiscard?(st.debug("Conversation closed with pending reason",t),this.notifyDiscard(t,this.pendingDiscard),ot.HANDLED_AND_FINISHED):(this.reserved=n,ot.HANDLED_AND_ACTIVE)},t.prototype.discard=function(t,e){this.reserved?this.pendingDiscard=e:this.notifyDiscard(t,e)},t.prototype.close=function(){this.closed=!0},t.prototype.notifyDiscard=function(t,e){if(!this.closed){this.closed=!0;try{this.handler.onDiscard(t,e)}catch(e){throw st.error("Application handler threw exception [cid="+t+"]",e.stack),e}}},t}(),ct=function(){function t(t){this.nextCID=t,this.conversations={}}return t.prototype.completedExceptionally=function(t,e,r){st.debug("Application handler threw exception [cid="+t+"]",r.stack),e.close(),delete this.conversations[t.toString()]},t.prototype.newConversation=function(t){return tt(this,void 0,void 0,(function(){var e,r;return et(this,(function(n){switch(n.label){case 0:return e=new ut(t,this.completedExceptionally.bind(this)),[4,this.nextCID()];case 1:r=n.sent(),this.conversations[r.toString()]=e;try{e.open(r)}catch(t){throw this.completedExceptionally(r,e,t),t}return void 0!==this.discardReason&&this.discard(r,this.discardReason),[2,r]}}))}))},t.prototype.respond=function(t,e){var r=this.conversations[t.toString()];if(void 0===r)throw st.debug("No conversation for cid: "+t+", response: ",e),new at("No such conversation");switch(r.respond(t,e)){case ot.ALREADY_FINISHED:throw new at("No such conversation");case ot.HANDLED_AND_ACTIVE:break;default:delete this.conversations[t.toString()]}},t.prototype.respondIfPresent=function(t,e){try{this.respond(t,e)}catch(t){if("NoSuchConversationError"!==t.name)throw t}},t.prototype.discard=function(t,e){var r=this.conversations[t.toString()];delete this.conversations[t.toString()],r&&r.discard(t,e)},t.prototype.discardAll=function(t){var e,r;if(void 0===this.discardReason){this.discardReason=t;try{for(var n=rt(Object.keys(this.conversations)),o=n.next();!o.done;o=n.next()){var i=o.value;this.discard(W.ConversationId.fromString(i),t)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}}},t.prototype.size=function(){return Object.keys(this.conversations).length},t}();X.ConversationSet=ct,X.create=function(){return new ct(it)};var lt={};Object.defineProperty(lt,"__esModule",{value:!0}),lt.MAX_SAFE_INTEGER=lt.MAX_INT32=lt.findNextPowerOfTwo=lt.approximateSquareRoot=void 0,lt.approximateSquareRoot=function(t){if(t<0)throw new s.IllegalArgumentError("Value must be great or equal to 0");if(0===t)return 0;var e=32-function(t){if(0===t)return 32;var e=1;return t>>>16==0&&(e+=16,t<<=16),t>>>24==0&&(e+=8,t<<=8),t>>>28==0&&(e+=4,t<<=4),t>>>30==0&&(e+=2,t<<=2),e-=t>>>31}(t);return 1<<Math.round(e/2)},lt.findNextPowerOfTwo=function(t){if(t<0||t>1<<30)throw new s.IllegalArgumentError("Illegal argument: "+t);return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t},lt.MAX_INT32=2147483647,lt.MAX_SAFE_INTEGER=9007199254740991;var ft={};Object.defineProperty(ft,"__esModule",{value:!0}),ft.requireNonNull=void 0,ft.requireNonNull=function(t,e){if(null==t)throw new s.NullValueError(e+" is null");return t};var pt={};(function(t){(function(){"use strict";var e,r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(pt,"__esModule",{value:!0}),pt.OptionsImpl=pt.MIN_MAX_MESSAGE_SIZE=pt.DEFAULT_RETRY_STRATEGY=void 0;var o="undefined"!=type