Some checks failed
morphit-release / Build + publish release tarball (push) Has been cancelled
2 lines
No EOL
423 KiB
JavaScript
2 lines
No EOL
423 KiB
JavaScript
!function(f){"object"==typeof exports&&"undefined"!=typeof module?module.exports=f():"function"==typeof define&&define.amd?define([],f):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).dblurt=f()}(function(){return function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);f=new Error("Cannot find module '"+i+"'");throw f.code="MODULE_NOT_FOUND",f}c=n[i]={exports:{}};e[i][0].call(c.exports,function(r){return o(e[i][1][r]||r)},c,c.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}({1:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.evaluateAuthorityForKey=evaluateAuthorityForKey,exports.validateAccountAuthority=validateAccountAuthority,exports.validatePostingAuthority=function(account,key,options={}){return validateAccountAuthority(account,key,"posting",options)};let DEFAULT_MAX_RECURSION=2,DEFAULT_MAX_MEMBERSHIP=40,DEFAULT_MAX_ACCOUNT_AUTHS=125;function keyToString(key){return"string"==typeof key?key:("createPublic"in key&&"function"==typeof key.createPublic?key.createPublic():key).toString()}function unique(values){return Array.from(new Set(values))}function evaluateAuthorityForKey(authority,key,options={}){let publicKey=keyToString(key),maxRecursion=options.maxRecursion??DEFAULT_MAX_RECURSION,maxMembership=options.maxMembership??DEFAULT_MAX_MEMBERSHIP,maxAccountAuths=options.maxAccountAuths??DEFAULT_MAX_ACCOUNT_AUTHS,approvedAccounts=new Set,visitedAccounts=[],missingAccounts=[],limitReason=null,evaluate=(auth,depth,accountAuthCount)=>{let totalWeight=0,membership=0;var account,weight,matchedKeys=[];for(let[authorityKey,weight]of auth.key_auths||[]){var key="string"==typeof(key=authorityKey)?key:key.toString();if(key===publicKey&&(totalWeight+=weight,matchedKeys.push(key),totalWeight>=auth.weight_threshold))return{authorized:!0,matchedKeys:matchedKeys,totalWeight:totalWeight};if(membership++,0<maxMembership&&membership>=maxMembership)return{authorized:!(limitReason="membership_limit_exceeded"),matchedKeys:matchedKeys,totalWeight:totalWeight}}for([account,weight]of auth.account_auths||[]){if(approvedAccounts.has(account)){if((totalWeight+=weight)>=auth.weight_threshold)return{authorized:!0,matchedKeys:matchedKeys,totalWeight:totalWeight}}else if(depth!==maxRecursion){if(0<maxAccountAuths&&accountAuthCount.value>=maxAccountAuths)return{authorized:!(limitReason="account_auths_limit_exceeded"),matchedKeys:matchedKeys,totalWeight:totalWeight};accountAuthCount.value++,visitedAccounts.push(account);var delegatedAuthority=options.getAuthority?options.getAuthority(account):void 0;if(delegatedAuthority){delegatedAuthority=evaluate(delegatedAuthority,depth+1,accountAuthCount);if(matchedKeys.push(...delegatedAuthority.matchedKeys),delegatedAuthority.authorized&&(approvedAccounts.add(account),(totalWeight+=weight)>=auth.weight_threshold))return{authorized:!0,matchedKeys:matchedKeys,totalWeight:totalWeight}}else missingAccounts.push(account)}if(membership++,0<maxMembership&&membership>=maxMembership)return{authorized:!(limitReason="membership_limit_exceeded"),matchedKeys:matchedKeys,totalWeight:totalWeight}}return{authorized:totalWeight>=auth.weight_threshold,matchedKeys:matchedKeys,totalWeight:totalWeight}},evaluated=evaluate(authority,0,{value:0}),authorized=evaluated.authorized,reason=authorized?"authority_satisfied":limitReason||(missingAccounts.length?"missing_delegated_authority":"authority_not_satisfied");return{approvedAccounts:Array.from(approvedAccounts),authorized:authorized,matchedKey:evaluated.matchedKeys[0]||null,matchedKeys:unique(evaluated.matchedKeys),missingAccounts:unique(missingAccounts),reason:reason,threshold:authority.weight_threshold,totalWeight:evaluated.totalWeight,visitedAccounts:unique(visitedAccounts)}}function validateAccountAuthority(account,key,authority,options={}){var evaluationOptions={getAuthority:name=>{name=options.getAccount?options.getAccount(name):void 0;return name?name[authority]:void 0},maxAccountAuths:options.maxAccountAuths,maxMembership:options.maxMembership,maxRecursion:options.maxRecursion},evaluationOptions={active:evaluateAuthorityForKey(account.active,key,{...evaluationOptions,getAuthority:name=>options.getAccount?options.getAccount(name)?.active:void 0}),owner:evaluateAuthorityForKey(account.owner,key,{...evaluationOptions,getAuthority:name=>options.getAccount?options.getAccount(name)?.owner:void 0}),posting:evaluateAuthorityForKey(account.posting,key,{...evaluationOptions,getAuthority:name=>options.getAccount?options.getAccount(name)?.posting:void 0})},selected=evaluationOptions[authority],reason=selected.authorized?"authority_satisfied":"posting"===authority?"posting_authority_not_satisfied":selected.reason;return{account:account.name,authority:authority,authorized:selected.authorized,key:keyToString(key),matches:evaluationOptions,missingAccounts:unique([...evaluationOptions.owner.missingAccounts,...evaluationOptions.active.missingAccounts,...evaluationOptions.posting.missingAccounts]),reason:reason}}},{}],2:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.Authority=void 0;let crypto_1=_dereq_("../crypto");exports.Authority=class Authority{constructor({weight_threshold,account_auths,key_auths}){this.weight_threshold=weight_threshold,this.account_auths=account_auths,this.key_auths=key_auths}static from(value){return value instanceof Authority?value:"string"==typeof value||value instanceof crypto_1.PublicKey?new Authority({account_auths:[],key_auths:[[value,1]],weight_threshold:1}):new Authority(value)}}},{"../crypto":18}],3:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.VirtualOperationTypeRegexp=exports.OperationTypeRegexp=void 0,exports.OperationTypeRegexp=new RegExp("^vote_operation$|^comment_operation$|^transfer_operation$|^transfer_to_vesting_operation$|^withdraw_vesting_operation$|^account_create_operation$|^account_update_operation$|^witness_update_operation$|^account_witness_vote_operation$|^account_witness_proxy_operation$|^custom_operation$|^delete_comment_operation$|^custom_json_operation$|^comment_options_operation$|^set_withdraw_vesting_route_operation$|^claim_account_operation$|^create_claimed_account_operation$|^request_account_recovery_operation$|^recover_account_operation$|^change_recovery_account_operation$|^escrow_transfer_operation$|^escrow_dispute_operation$|^escrow_release_operation$|^escrow_approve_operation$|^transfer_to_savings_operation$|^transfer_from_savings_operation$|^cancel_transfer_from_savings_operation$|^custom_binary_operation$|^decline_voting_rights_operation$|^reset_account_operation$|^set_reset_account_operation$|^claim_reward_balance_operation$|^delegate_vesting_shares_operation$|^witness_set_properties_operation$|^create_proposal_operation$|^update_proposal_votes_operation$|^remove_proposal_operation$"),exports.VirtualOperationTypeRegexp=new RegExp("^author_reward_operation$|^curation_reward_operation$|^comment_reward_operation$|^fill_vesting_withdraw_operation$|^shutdown_witness_operation$|^fill_transfer_from_savings_operation$|^hardfork_operation$|^comment_payout_update_operation$|^return_vesting_delegation_operation$|^comment_benefactor_reward_operation$|^producer_reward_operation$|^clear_null_account_balance_operation$|^proposal_pay_operation$|^sps_fund_operation$|^fee_pay_operation$")},{}],4:[function(_dereq_,module,exports){var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Price=exports.Asset=exports.AssetSymbolRegexp=void 0;let assert_1=__importDefault(_dereq_("assert"));exports.AssetSymbolRegexp=new RegExp("^HIVE$|^VESTS$|^HBD$|^TESTS$|^TBD$|^STEEM$|^SBD$|^BLURT$");class Asset{constructor(amount,symbol,serializedAmount){this.amount=amount,this.symbol=symbol,this.serializedAmount=serializedAmount}static fromString(string,expectedSymbol){var[string,symbol]=string.split(" ");if(!["HIVE","VESTS","HBD","TESTS","TBD","SBD","STEEM","BLURT"].includes(symbol))throw new Error("Invalid asset symbol: "+symbol);if(expectedSymbol&&symbol!==expectedSymbol)throw new Error(`Invalid asset, expected symbol: ${expectedSymbol} got: `+symbol);expectedSymbol=Number.parseFloat(string);if(Number.isFinite(expectedSymbol))return new Asset(expectedSymbol,symbol,string);throw new Error("Invalid asset amount: "+string)}static fromNai(value){if(!Number(value.precision))throw new Error("Invalid asset symbol: "+value.precision);if("@@000000021"!==value.nai&&"@@000000037"!==value.nai)throw new Error("Invalid asset symbol: "+value.nai);var symbol="@@000000021"===value.nai?"BLURT":"VESTS",scaledAmount=value.amount.replace(/^\+/,""),amount=parseFloat((Number(value.amount)/Math.pow(10,value.precision)).toFixed(value.precision));if(Number.isFinite(amount))return new Asset(amount,symbol,Asset.formatScaledAmount(scaledAmount,value.precision));throw new Error(`Invalid asset amount: ${amount} `+symbol)}static from(value,symbol){if(value instanceof Asset){if(symbol&&value.symbol!==symbol)throw new Error(`Invalid asset, expected symbol: ${symbol} got: `+value.symbol);return value}if("number"==typeof value&&Number.isFinite(value))return new Asset(value,symbol||"STEEM");if("string"==typeof value)return Asset.fromString(value,symbol);throw new Error(`Invalid asset '${String(value)}'`)}static min(a,b){return(0,assert_1.default)(a.symbol===b.symbol,"can not compare assets with different symbols"),a.amount<b.amount?a:b}static max(a,b){return(0,assert_1.default)(a.symbol===b.symbol,"can not compare assets with different symbols"),a.amount>b.amount?a:b}static parseAmountToSmallestUnit(amount,precision){var match=/^([+-]?)(\d+)(?:\.(\d+))?$/.exec(amount);if(!match)throw new Error("Invalid asset amount: "+amount);var[,amount,match,fraction=""]=match;if(fraction.length>precision)throw new Error(`Invalid asset precision: expected at most ${precision} decimals`);return("-"===amount?"-":"")+((""+match+fraction.padEnd(precision,"0")).replace(/^0+(?=\d)/,"")||"0")}static formatScaledAmount(amount,precision){var sign=amount.startsWith("-")?"-":"",amount=(amount.replace(/^[+-]/,"").replace(/^0+(?=\d)/,"")||"0").padStart(precision+1,"0"),whole=amount.slice(0,-precision)||"0",amount=0<precision?amount.slice(-precision):"";return 0<precision?sign+whole+"."+amount:sign+whole}toSmallestUnitString(){return Asset.parseAmountToSmallestUnit(this.serializedAmount||this.amount.toFixed(this.getPrecision()),this.getPrecision())}getPrecision(){switch(this.symbol){case"TESTS":case"TBD":case"HIVE":case"HBD":case"SBD":case"STEEM":case"BLURT":return 3;case"VESTS":return 6;default:return 3}}symbols(){return this}toString(){return this.amount.toFixed(this.getPrecision())+" "+this.symbol}add(amount){amount=Asset.from(amount,this.symbol);return(0,assert_1.default)(this.symbol===amount.symbol,"can not add with different symbols"),new Asset(this.amount+amount.amount,this.symbol)}subtract(amount){amount=Asset.from(amount,this.symbol);return(0,assert_1.default)(this.symbol===amount.symbol,"can not subtract with different symbols"),new Asset(this.amount-amount.amount,this.symbol)}multiply(factor){factor=Asset.from(factor,this.symbol);return(0,assert_1.default)(this.symbol===factor.symbol,"can not multiply with different symbols"),new Asset(this.amount*factor.amount,this.symbol)}divide(divisor){divisor=Asset.from(divisor,this.symbol);return(0,assert_1.default)(this.symbol===divisor.symbol,"can not divide with different symbols"),new Asset(this.amount/divisor.amount,this.symbol)}toJSON(){return this.toString()}}exports.Asset=Asset,exports.Price=class Price{constructor(base,quote){this.base=base,this.quote=quote,(0,assert_1.default)(0!==base.amount&&0!==quote.amount,"base and quote assets must be non-zero"),(0,assert_1.default)(base.symbol!==quote.symbol,"base and quote can not have the same symbol")}static from(value){return value instanceof Price?value:new Price(Asset.from(value.base),Asset.from(value.quote))}toString(){return this.base+":"+this.quote}convert(asset){if(asset.symbol===this.base.symbol)return(0,assert_1.default)(0<this.base.amount),new Asset(asset.amount*this.quote.amount/this.base.amount,this.quote.symbol);if(asset.symbol===this.quote.symbol)return(0,assert_1.default)(0<this.quote.amount),new Asset(asset.amount*this.base.amount/this.quote.amount,this.base.symbol);throw new Error(`Can not convert ${asset} with `+this)}}},{assert:47}],5:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0})},{}],6:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0})},{}],7:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0})},{}],8:[function(_dereq_,module,exports){!function(Buffer){!function(){Object.defineProperty(exports,"__esModule",{value:!0}),exports.EncryptedMemoDeserializer=void 0;let crypto_1=_dereq_("../crypto"),RuntimeByteBuffer=_dereq_("bytebuffer/dist/bytebuffer");var keyDeserializers,PublicKeyDeserializer=buf=>{buf=(b=>{var b_copy;if(b)return b_copy=b.copy(b.offset,b.offset+33),b.skip(33),Buffer.from(b_copy.toBinary(),"binary");throw Error("No buffer found on first parameter")})(buf);return crypto_1.PublicKey.fromBuffer(buf)};exports.EncryptedMemoDeserializer=(keyDeserializers=[["from",PublicKeyDeserializer],["to",PublicKeyDeserializer],["nonce",b=>b.readUint64()],["check",b=>b.readUint32()],["encrypted",b=>{var len=b.readVarint32(),b_copy=b.copy(b.offset,b.offset+len);return b.skip(len),Buffer.from(b_copy.toBinary(),"binary")}]],buf=>{var key,deserializer,obj={};for([key,deserializer]of keyDeserializers)try{buf=RuntimeByteBuffer.fromBinary(buf.toString("binary"),RuntimeByteBuffer.LITTLE_ENDIAN),obj[key]=deserializer(buf)}catch(error){throw error.message=key+": "+error.message,error}return obj})}.call(this)}.call(this,_dereq_("buffer").Buffer)},{"../crypto":18,buffer:55,"bytebuffer/dist/bytebuffer":56}],9:[function(_dereq_,module,exports){!function(Buffer){!function(){Object.defineProperty(exports,"__esModule",{value:!0}),exports.getVests=exports.getVestingSharePrice=exports.HexBuffer=void 0;let asset_1=_dereq_("./asset");exports.HexBuffer=class HexBuffer{constructor(buffer){this.buffer=buffer}static from(value){return value instanceof HexBuffer?value:value instanceof Buffer?new HexBuffer(value):"string"==typeof value?new HexBuffer(Buffer.from(value,"hex")):new HexBuffer(Buffer.from(value))}toString(encoding="hex"){return this.buffer.toString(encoding)}toJSON(){return this.toString()}},exports.getVestingSharePrice=props=>{var totalVestingFund=asset_1.Asset.from(props.total_vesting_fund_blurt),props=asset_1.Asset.from(props.total_vesting_shares);return 0===totalVestingFund.amount||0===props.amount?new asset_1.Price(new asset_1.Asset(1,"VESTS"),new asset_1.Asset(1,"BLURT")):new asset_1.Price(props,totalVestingFund)},exports.getVests=(account,subtract_delegated=!0,add_received=!0)=>{let vests=asset_1.Asset.from(account.vesting_shares),vests_delegated=asset_1.Asset.from(account.delegated_vesting_shares),vests_received=asset_1.Asset.from(account.received_vesting_shares),withdraw_rate=asset_1.Asset.from(account.vesting_withdraw_rate),already_withdrawn=(Number(account.to_withdraw)-Number(account.withdrawn))/1e6,withdraw_vests=Math.min(withdraw_rate.amount,already_withdrawn);return vests=vests.subtract(withdraw_vests),subtract_delegated&&(vests=vests.subtract(vests_delegated)),(vests=add_received?vests.add(vests_received):vests).amount}}.call(this)}.call(this,_dereq_("buffer").Buffer)},{"./asset":4,buffer:55}],10:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.isValidCommunityAccountRegexp=exports.communityAccountRegexp=void 0,exports.communityAccountRegexp=/^blurt-[1-3]\d{4,6}$/,exports.isValidCommunityAccountRegexp=communityAccount=>new RegExp(exports.communityAccountRegexp).test(communityAccount)},{}],11:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.VirtualOperationNameRegexp=exports.OperationNameRegexp=void 0,exports.OperationNameRegexp=new RegExp("^vote$|^comment$|^transfer$|^transfer_to_vesting$|^withdraw_vesting$|^account_create$|^account_update$|^witness_update$|^account_witness_vote$|^account_witness_proxy$|^custom$|^delete_comment$|^custom_json$|^comment_options$|^set_withdraw_vesting_route$|^claim_account$|^create_claimed_account$|^request_account_recovery$|^recover_account$|^change_recovery_account$|^escrow_transfer$|^escrow_dispute$|^escrow_release$|^escrow_approve$|^transfer_to_savings$|^transfer_from_savings$|^cancel_transfer_from_savings$|^custom_binary$|^decline_voting_rights$|^reset_account$|^set_reset_account$|^claim_reward_balance$|^delegate_vesting_shares$|^witness_set_properties$|^create_proposal$|^update_proposal_votes$|^remove_proposal$"),exports.VirtualOperationNameRegexp=new RegExp("^author_reward$|^curation_reward$|^comment_reward$|^fill_vesting_withdraw$|^shutdown_witness$|^fill_transfer_from_savings$|^hardfork$|^comment_payout_update$|^return_vesting_delegation$|^comment_benefactor_reward$|^producer_reward$|^clear_null_account_balance$|^proposal_pay$|^sps_fund$|^fee_pay$")},{}],12:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0})},{}],13:[function(_dereq_,module,exports){!function(Buffer){!function(){Object.defineProperty(exports,"__esModule",{value:!0}),exports.Types=void 0;let crypto_1=_dereq_("../crypto"),asset_1=_dereq_("./asset"),misc_1=_dereq_("./misc"),RuntimeByteBuffer=_dereq_("bytebuffer/dist/bytebuffer"),PublicKeySerializer=(buffer,data)=>{null===data||"string"==typeof data&&data.endsWith("1111111111111111111111111111111114T1Anm")?buffer.append(Buffer.alloc(33,0)):buffer.append(crypto_1.PublicKey.from(data).key)},VoidSerializer=buffer=>{throw new Error("Void can not be serialized")},StringSerializer=(buffer,data)=>{buffer.writeVString(data)},DateSerializer=(buffer,data)=>{buffer.writeUint32(Math.floor(new Date(data+"Z").getTime()/1e3))},BooleanSerializer=(buffer,data)=>{buffer.writeByte(data?1:0)},FlatMapSerializer=(keySerializer,valueSerializer)=>(buffer,data)=>{buffer.writeVarint32(data.length);for(var[key,value]of data)keySerializer(buffer,key),valueSerializer(buffer,value)},ArraySerializer=itemSerializer=>(buffer,data)=>{buffer.writeVarint32(data.length);for(var item of data)itemSerializer(buffer,item)},StaticVariantSerializer=itemSerializers=>(buffer,data)=>{var[data,item]=data;buffer.writeVarint32(data),itemSerializers[data](buffer,item)},AssetSerializer=(buffer,data)=>{var asset=asset_1.Asset.from(data).symbols(),data=asset.getPrecision();buffer.writeInt64(RuntimeByteBuffer.Long.fromString(asset.toSmallestUnitString())),buffer.writeUint8(data);for(let i=0;i<7;i++)buffer.writeUint8(asset.symbol.charCodeAt(i)||0)},BinarySerializer=size=>(buffer,data)=>{var len=(data=misc_1.HexBuffer.from(data)).buffer.length;if(size){if(len!==size)throw new Error(`Unable to serialize binary. Expected ${size} bytes, got `+len)}else buffer.writeVarint32(len);buffer.append(data.buffer)},VariableBinarySerializer=BinarySerializer(),Int16Serializer=(buffer,data)=>{buffer.writeInt16(data)},Int64Serializer=(buffer,data)=>{buffer.writeInt64(data)},UInt16Serializer=(buffer,data)=>{buffer.writeUint16(data)},UInt32Serializer=(buffer,data)=>{buffer.writeUint32(data)},UInt64Serializer=(buffer,data)=>{buffer.writeUint64(data)},OperationDataSerializer=(operationId,definitions)=>{let objectSerializer=ObjectSerializer(definitions);return(buffer,data)=>{buffer.writeVarint32(operationId),objectSerializer(buffer,data)}},ObjectSerializer=keySerializers=>(buffer,data)=>{for(var[key,serializer]of keySerializers)try{serializer(buffer,data[key])}catch(error){throw error.message=key+": "+error.message,error}},EncryptedMemoSerializer=ObjectSerializer([["from",PublicKeySerializer],["to",PublicKeySerializer],["nonce",UInt64Serializer],["check",UInt32Serializer],["encrypted",BinarySerializer()]]),OptionalSerializer=valueSerializer=>(buffer,data)=>{data?(buffer.writeByte(1),valueSerializer(buffer,data)):buffer.writeByte(0)},AuthoritySerializer=ObjectSerializer([["weight_threshold",UInt32Serializer],["account_auths",FlatMapSerializer(StringSerializer,UInt16Serializer)],["key_auths",FlatMapSerializer(PublicKeySerializer,UInt16Serializer)]]),BeneficiarySerializer=ObjectSerializer([["account",StringSerializer],["weight",UInt16Serializer]]),WitnessUpdatePropertiesSerializer=ObjectSerializer([["account_creation_fee",AssetSerializer],["maximum_block_size",UInt32Serializer]]),OperationSerializers={};OperationSerializers.account_create=OperationDataSerializer(5,[["fee",AssetSerializer],["creator",StringSerializer],["new_account_name",StringSerializer],["owner",AuthoritySerializer],["active",AuthoritySerializer],["posting",AuthoritySerializer],["memo_key",PublicKeySerializer],["json_metadata",StringSerializer]]),OperationSerializers.account_update=OperationDataSerializer(6,[["account",StringSerializer],["owner",OptionalSerializer(AuthoritySerializer)],["active",OptionalSerializer(AuthoritySerializer)],["posting",OptionalSerializer(AuthoritySerializer)],["memo_key",OptionalSerializer(PublicKeySerializer)],["json_metadata",StringSerializer],["posting_json_metadata",StringSerializer],["extensions",ArraySerializer(StringSerializer)]]),OperationSerializers.account_witness_vote=OperationDataSerializer(8,[["account",StringSerializer],["witness",StringSerializer],["approve",BooleanSerializer]]),OperationSerializers.account_witness_proxy=OperationDataSerializer(9,[["account",StringSerializer],["proxy",StringSerializer]]),OperationSerializers.change_recovery_account=OperationDataSerializer(19,[["account_to_recover",StringSerializer],["new_recovery_account",StringSerializer],["extensions",ArraySerializer(StringSerializer)]]),OperationSerializers.claim_account=OperationDataSerializer(15,[["creator",StringSerializer],["fee",AssetSerializer],["extensions",ArraySerializer(VoidSerializer)]]),OperationSerializers.create_claimed_account=OperationDataSerializer(16,[["creator",StringSerializer],["new_account_name",StringSerializer],["owner",AuthoritySerializer],["active",AuthoritySerializer],["posting",AuthoritySerializer],["memo_key",PublicKeySerializer],["json_metadata",StringSerializer],["extensions",ArraySerializer(VoidSerializer)]]),OperationSerializers.claim_reward_balance=OperationDataSerializer(31,[["account",StringSerializer],["reward_blurt",AssetSerializer],["reward_vests",AssetSerializer]]),OperationSerializers.cancel_transfer_from_savings=OperationDataSerializer(26,[["from",StringSerializer],["request_id",UInt32Serializer]]),OperationSerializers.comment=OperationDataSerializer(1,[["parent_author",StringSerializer],["parent_permlink",StringSerializer],["author",StringSerializer],["permlink",StringSerializer],["title",StringSerializer],["body",StringSerializer],["json_metadata",StringSerializer]]),OperationSerializers.comment_options=OperationDataSerializer(13,[["author",StringSerializer],["permlink",StringSerializer],["max_accepted_payout",AssetSerializer],["allow_votes",BooleanSerializer],["allow_curation_rewards",BooleanSerializer],["extensions",ArraySerializer(StaticVariantSerializer([ObjectSerializer([["beneficiaries",ArraySerializer(BeneficiarySerializer)]]),ObjectSerializer([["percent_blurt",UInt16Serializer]])]))]]),OperationSerializers.custom_json=OperationDataSerializer(12,[["required_auths",ArraySerializer(StringSerializer)],["required_posting_auths",ArraySerializer(StringSerializer)],["id",StringSerializer],["json",StringSerializer]]),OperationSerializers.delete_comment=OperationDataSerializer(11,[["author",StringSerializer],["permlink",StringSerializer]]),OperationSerializers.delegate_vesting_shares=OperationDataSerializer(32,[["delegator",StringSerializer],["delegatee",StringSerializer],["vesting_shares",AssetSerializer]]),OperationSerializers.escrow_transfer=OperationDataSerializer(20,[["from",StringSerializer],["to",StringSerializer],["blurt_amount",AssetSerializer],["escrow_id",UInt32Serializer],["agent",StringSerializer],["fee",AssetSerializer],["json_meta",StringSerializer],["ratification_deadline",DateSerializer],["escrow_expiration",DateSerializer]]),OperationSerializers.escrow_approve=OperationDataSerializer(23,[["from",StringSerializer],["to",StringSerializer],["agent",StringSerializer],["who",StringSerializer],["escrow_id",UInt32Serializer],["approve",BooleanSerializer]]),OperationSerializers.escrow_dispute=OperationDataSerializer(21,[["from",StringSerializer],["to",StringSerializer],["agent",StringSerializer],["who",StringSerializer],["escrow_id",UInt32Serializer]]),OperationSerializers.escrow_release=OperationDataSerializer(22,[["from",StringSerializer],["to",StringSerializer],["agent",StringSerializer],["who",StringSerializer],["receiver",StringSerializer],["escrow_id",UInt32Serializer],["blurt_amount",AssetSerializer]]),OperationSerializers.transfer=OperationDataSerializer(2,[["from",StringSerializer],["to",StringSerializer],["amount",AssetSerializer],["memo",StringSerializer]]),OperationSerializers.transfer_to_vesting=OperationDataSerializer(3,[["from",StringSerializer],["to",StringSerializer],["amount",AssetSerializer]]),OperationSerializers.withdraw_vesting=OperationDataSerializer(4,[["account",StringSerializer],["vesting_shares",AssetSerializer]]),OperationSerializers.set_withdraw_vesting_route=OperationDataSerializer(14,[["from_account",StringSerializer],["to_account",StringSerializer],["percent",UInt16Serializer],["auto_vest",BooleanSerializer]]),OperationSerializers.transfer_to_savings=OperationDataSerializer(24,[["from",StringSerializer],["to",StringSerializer],["amount",AssetSerializer],["memo",StringSerializer]]),OperationSerializers.transfer_from_savings=OperationDataSerializer(25,[["from",StringSerializer],["request_id",UInt32Serializer],["to",StringSerializer],["amount",AssetSerializer],["memo",StringSerializer]]),OperationSerializers.vote=OperationDataSerializer(0,[["voter",StringSerializer],["author",StringSerializer],["permlink",StringSerializer],["weight",Int16Serializer]]),OperationSerializers.witness_update=OperationDataSerializer(7,[["owner",StringSerializer],["url",StringSerializer],["block_signing_key",PublicKeySerializer],["props",WitnessUpdatePropertiesSerializer],["fee",AssetSerializer]]),OperationSerializers.witness_set_properties=OperationDataSerializer(33,[["owner",StringSerializer],["props",FlatMapSerializer(StringSerializer,VariableBinarySerializer)],["extensions",ArraySerializer(VoidSerializer)]]),OperationSerializers.create_proposal=OperationDataSerializer(34,[["creator",StringSerializer],["receiver",StringSerializer],["start_date",DateSerializer],["end_date",DateSerializer],["daily_pay",AssetSerializer],["subject",StringSerializer],["permlink",StringSerializer],["extensions",ArraySerializer(VoidSerializer)]]),OperationSerializers.update_proposal_votes=OperationDataSerializer(35,[["voter",StringSerializer],["proposal_ids",ArraySerializer(Int64Serializer)],["approve",BooleanSerializer],["extensions",ArraySerializer(VoidSerializer)]]),OperationSerializers.remove_proposal=OperationDataSerializer(36,[["proposal_owner",StringSerializer],["proposal_ids",ArraySerializer(Int64Serializer)],["extensions",ArraySerializer(VoidSerializer)]]),OperationSerializers.request_account_recovery=OperationDataSerializer(17,[["recovery_account",StringSerializer],["account_to_recover",StringSerializer],["new_owner_authority",AuthoritySerializer],["extensions",ArraySerializer(VoidSerializer)]]),OperationSerializers.recover_account=OperationDataSerializer(18,[["account_to_recover",StringSerializer],["new_owner_authority",AuthoritySerializer],["recent_owner_authority",AuthoritySerializer],["extensions",ArraySerializer(VoidSerializer)]]);var OperationSerializer=(buffer,operation)=>{var serializer=OperationSerializers[operation[0]];if(!serializer)throw new Error("No serializer for operation: "+operation[0]);try{serializer(buffer,operation[1])}catch(error){throw error.message=operation[0]+": "+error.message,error}},TransactionSerializer=ObjectSerializer([["ref_block_num",UInt16Serializer],["ref_block_prefix",UInt32Serializer],["expiration",DateSerializer],["operations",ArraySerializer(OperationSerializer)],["extensions",ArraySerializer(StringSerializer)]]);exports.Types={Array:ArraySerializer,Asset:AssetSerializer,Authority:AuthoritySerializer,Binary:BinarySerializer,Boolean:BooleanSerializer,Date:DateSerializer,FlatMap:FlatMapSerializer,Int16:Int16Serializer,Int32:(buffer,data)=>{buffer.writeInt32(data)},Int64:Int64Serializer,Int8:(buffer,data)=>{buffer.writeInt8(data)},Memo:EncryptedMemoSerializer,Object:ObjectSerializer,Operation:OperationSerializer,Optional:OptionalSerializer,PublicKey:PublicKeySerializer,StaticVariant:StaticVariantSerializer,String:StringSerializer,Transaction:TransactionSerializer,UInt16:UInt16Serializer,UInt32:UInt32Serializer,UInt64:UInt64Serializer,UInt8:(buffer,data)=>{buffer.writeUint8(data)},Void:VoidSerializer}}.call(this)}.call(this,_dereq_("buffer").Buffer)},{"../crypto":18,"./asset":4,"./misc":9,buffer:55,"bytebuffer/dist/bytebuffer":56}],14:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0})},{}],15:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0})},{}],16:[function(_dereq_,module,exports){!function(Buffer){!function(){var __createBinding=this&&this.__createBinding||(Object.create?function(o,m,k,k2){void 0===k2&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);desc&&("get"in desc?m.__esModule:!desc.writable&&!desc.configurable)||(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){o[k2=void 0===k2?k:k2]=m[k]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=this&&this.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(null!=mod)for(var k in mod)"default"!==k&&Object.prototype.hasOwnProperty.call(mod,k)&&__createBinding(result,mod,k);return __setModuleDefault(result,mod),result},__importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Client=exports.DEFAULT_ADDRESS_PREFIX=exports.DEFAULT_CHAIN_ID=exports.VERSION=void 0;let assert=__importStar(_dereq_("assert")),version_1=__importDefault(_dereq_("./version")),account_history_1=_dereq_("./helpers/account_history"),blockchain_1=_dereq_("./helpers/blockchain"),broadcast_1=_dereq_("./helpers/broadcast"),index_browser_1=_dereq_("./index-browser"),database_1=_dereq_("./helpers/database"),nexus_1=_dereq_("./helpers/nexus"),read_models_1=_dereq_("./helpers/read_models"),tools_1=_dereq_("./helpers/tools"),transaction_status_1=_dereq_("./helpers/transaction_status"),core_rpc_transport_1=_dereq_("./transports/core_rpc_transport"),legacy_rpc_transport_1=_dereq_("./transports/legacy_rpc_transport"),defaultBackoff=(exports.VERSION=version_1.default,exports.DEFAULT_CHAIN_ID=Buffer.from("cd8d90f29ae273abec3eaa7731e25934c63eb654d55080caff2ebb7f5df6381f","hex"),exports.DEFAULT_ADDRESS_PREFIX="BLT",tries=>Math.min(Math.pow(10*tries,2),1e4));exports.Client=class{constructor(address,options={}){this.currentAddress=Array.isArray(address)?address[0]||"https://rpc.blurt.blog":address,this.address=address,this.options=options,this.chainId=options.chainId?Buffer.from(options.chainId,"hex"):exports.DEFAULT_CHAIN_ID,assert.strictEqual(this.chainId.length,32,"invalid chain id"),this.addressPrefix=options.addressPrefix||exports.DEFAULT_ADDRESS_PREFIX,this.timeout=void 0!==options.timeout?options.timeout:6e4,this.backoff=options.backoff||defaultBackoff,this.failoverThreshold=void 0!==options.failoverThreshold?options.failoverThreshold:3,this.consoleOnFailover=options.consoleOnFailover||!1,this.accountHistory=new account_history_1.AccountHistoryAPI(this),this.blockchain=new blockchain_1.Blockchain(this),this.broadcast=new broadcast_1.BroadcastAPI(this),this.condenser=new index_browser_1.CondenserAPI(this),this.database=new database_1.DatabaseAPI(this),this.nexus=new nexus_1.Nexus(this),this.read=new read_models_1.ReadModels(this),this.tools=new tools_1.Tools(this),this.transactionStatus=new transaction_status_1.TransactionStatusAPI(this),this.transport=this.createTransport()}async call(api,method,params=[]){api=await this.transport.call(api,method,params),method=this.transport.getCurrentAddress();return method!==this.currentAddress&&(this.currentAddress=method),api}createTransport(){var base={address:this.address,backoff:this.backoff,currentAddress:this.currentAddress,failoverThreshold:this.failoverThreshold,options:this.options,timeout:this.timeout};return"core"===this.options.rpcTransport?new core_rpc_transport_1.CoreRpcTransport({...base,coreClient:this.options.coreClient,coreModule:this.options.coreModule,nodeSelectionStrategy:this.options.nodeSelectionStrategy}):new legacy_rpc_transport_1.LegacyRpcTransport({...base,consoleOnFailover:this.consoleOnFailover})}}}.call(this)}.call(this,_dereq_("buffer").Buffer)},{"./helpers/account_history":21,"./helpers/blockchain":22,"./helpers/broadcast":23,"./helpers/database":25,"./helpers/nexus":26,"./helpers/read_models":27,"./helpers/tools":28,"./helpers/transaction_status":29,"./index-browser":30,"./transports/core_rpc_transport":33,"./transports/legacy_rpc_transport":34,"./version":37,assert:47,buffer:55}],17:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.DEFAULT_CONTENT_TAG_LIMIT=void 0,exports.normalizePermlink=normalizePermlink,exports.normalizeContentTags=normalizeContentTags,exports.buildPostPermlink=buildPostPermlink,exports.buildReplyPermlink=buildReplyPermlink,exports.buildCommentMetadata=buildCommentMetadata,exports.parseCommentMetadata=function(jsonMetadata){if(jsonMetadata)try{var parsed=JSON.parse(jsonMetadata);if(parsed&&"object"==typeof parsed&&!Array.isArray(parsed))return parsed}catch{}return{}},exports.buildPostOperation=function(options){var tags=normalizeContentTags(options.tags,options);if(0!==tags.length)return["comment",{parent_author:"",parent_permlink:tags[0],author:options.author,permlink:buildPostPermlink({title:options.title,permlink:options.permlink,suffix:options.permlinkSuffix}),title:options.title,body:options.body,json_metadata:buildCommentMetadata({app:options.app,format:options.format,tags:tags,extra:options.extra,maxTags:options.maxTags})}];throw new errors_1.ValidationError("A top-level post requires at least one valid tag/category.",{field:"tags",path:["comment","json_metadata","tags"]})},exports.buildReplyOperation=function(options){return["comment",{parent_author:options.parentAuthor,parent_permlink:options.parentPermlink,author:options.author,permlink:buildReplyPermlink({parentPermlink:options.parentPermlink,permlink:options.permlink,suffix:options.permlinkSuffix}),title:"",body:options.body,json_metadata:buildCommentMetadata({app:options.app,format:options.format,tags:options.tags,extra:options.extra,maxTags:options.maxTags})}]},exports.buildUpdateOperation=function(options){return["comment",{parent_author:options.parentAuthor,parent_permlink:options.parentPermlink,author:options.author,permlink:options.permlink,title:options.title,body:options.body,json_metadata:"string"==typeof options.metadata?options.metadata:JSON.stringify(options.metadata||{})}]},exports.buildDeleteCommentOperation=function(options){return["delete_comment",{author:options.author,permlink:options.permlink}]};let errors_1=_dereq_("./errors"),DEFAULT_METADATA_FORMAT=(exports.DEFAULT_CONTENT_TAG_LIMIT=8,"markdown"),MAX_PERMLINK_LENGTH=255;function normalizePermlink(input,options={}){var fallback=options.fallback??"post",options=options.maxLength??MAX_PERMLINK_LENGTH;return((input,fallback)=>input.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^a-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||fallback)(input,fallback).slice(0,options).replace(/-$/g,"")||fallback.slice(0,options)}function normalizeContentTags(tags,options={}){var tag,maxTags=options.maxTags??exports.DEFAULT_CONTENT_TAG_LIMIT,seen=new Set,result=[];for(tag of tags){var normalized=normalizePermlink(tag,{fallback:"",maxLength:MAX_PERMLINK_LENGTH});if(normalized&&!seen.has(normalized)&&(seen.add(normalized),result.push(normalized),maxTags<=result.length))break}return result}function appendSuffix(base,suffix){var maxBaseLength;return suffix&&(suffix=normalizePermlink(suffix,{fallback:"",maxLength:MAX_PERMLINK_LENGTH}))?(maxBaseLength=Math.max(1,MAX_PERMLINK_LENGTH-suffix.length-1),(base.slice(0,maxBaseLength).replace(/-$/g,"")||"post")+"-"+suffix):base}function buildPostPermlink(options){var suffix=options.suffix??(options.permlink?void 0:Date.now().toString(36));return appendSuffix(normalizePermlink(options.permlink||options.title,{fallback:"post"}),suffix)}function buildReplyPermlink(options){var base=options.permlink||"re-"+normalizePermlink(options.parentPermlink,{fallback:"post"}),options=options.suffix??(options.permlink?void 0:Date.now().toString(36));return appendSuffix(normalizePermlink(base,{fallback:"reply"}),options)}function buildCommentMetadata(options={}){var metadata={},tags=(options.app&&(metadata.app=options.app),metadata.format=options.format||DEFAULT_METADATA_FORMAT,normalizeContentTags(options.tags||[],options));return 0<tags.length&&(metadata.tags=tags),Object.assign(metadata,options.extra||{}),options.app&&(metadata.app=options.app),metadata.format=options.format||DEFAULT_METADATA_FORMAT,0<tags.length&&(metadata.tags=tags),JSON.stringify(metadata)}},{"./errors":19}],18:[function(_dereq_,module,exports){!function(Buffer){!function(){var __createBinding=this&&this.__createBinding||(Object.create?function(o,m,k,k2){void 0===k2&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);desc&&("get"in desc?m.__esModule:!desc.writable&&!desc.configurable)||(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){o[k2=void 0===k2?k:k2]=m[k]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=this&&this.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(null!=mod)for(var k in mod)"default"!==k&&Object.prototype.hasOwnProperty.call(mod,k)&&__createBinding(result,mod,k);return __setModuleDefault(result,mod),result},__importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.cryptoUtils=exports.encodeMemo=exports.decodeMemo=exports.Signature=exports.PrivateKey=exports.PublicKey=void 0;let assert_1=__importDefault(_dereq_("assert")),bs58_1=__importDefault(_dereq_("bs58")),aesjs=_dereq_("aes-js"),nobleSha2=_dereq_("@noble/hashes/sha2"),nobleLegacy=_dereq_("@noble/hashes/legacy"),ByteBuffer=_dereq_("bytebuffer/dist/bytebuffer"),Long=ByteBuffer.Long,secp256k1=__importStar(_dereq_("@noble/secp256k1")),nobleHmac=_dereq_("@noble/hashes/hmac"),errors_1=(secp256k1.utils.hmacSha256Sync=(key,...messages)=>nobleHmac.hmac(nobleSha2.sha256,key,secp256k1.utils.concatBytes(...messages)),_dereq_("./errors")),serializer_1=_dereq_("./chain/serializer"),deserializer_1=_dereq_("./chain/deserializer"),client_1=_dereq_("./client"),utils_1=_dereq_("./utils"),NETWORK_ID=Buffer.from([128]),toUint8Array=buf=>{var ab=new ArrayBuffer(buf.length),view=new Uint8Array(ab);for(let i=0;i<buf.length;++i)view[i]=buf[i];return view},toBuffer=ab=>{var buf=Buffer.alloc(ab.byteLength),view=new Uint8Array(ab);for(let i=0;i<buf.length;++i)buf[i]=view[i];return buf},toByteBuffer=o=>{if("string"==typeof o)return Long.fromString(o);if("number"==typeof o)return Long.fromNumber(o);if(o instanceof ByteBuffer.Long)return o;throw new Error("Input is not a string, number or Long")},unique_nonce_entropy=Math.floor(65535*Math.random()),uniqueNonce=()=>{let long=BigInt(Date.now()),last,entropy=++unique_nonce_entropy%65535;return 0==entropy&&(last=Number(long>>BigInt(16)),Date.now()<=last&&(long+=BigInt(1)),unique_nonce_entropy=0),(long=long<<BigInt(16)|BigInt(entropy)).toString(16).padStart(16,"0")},ripemd160=input=>Buffer.from(nobleLegacy.ripemd160(hashInput(input))),sha256=input=>Buffer.from(nobleSha2.sha256(hashInput(input))),sha512=input=>Buffer.from(nobleSha2.sha512(hashInput(input))),hashInput=input=>"string"==typeof input?Buffer.from(input):input,pkcs7Pad=(input,blockSize=16)=>{var remainder=input.length%blockSize,blockSize=0==remainder?blockSize:blockSize-remainder;return Buffer.concat([Buffer.from(input),Buffer.alloc(blockSize,blockSize)])},pkcs7Unpad=(input,blockSize=16)=>{(0,assert_1.default)(0<input.length&&input.length%blockSize==0,"invalid pkcs7 payload length");var padding=input[input.length-1];(0,assert_1.default)(0<padding&&padding<=blockSize,"invalid pkcs7 padding");for(let i=input.length-padding;i<input.length;i++)(0,assert_1.default)(input[i]===padding,"invalid pkcs7 padding");return Buffer.from(input).slice(0,input.length-padding)},doubleSha256=input=>sha256(sha256(input)),encodePublic=(key,prefix)=>{var checksum=ripemd160(key);return prefix+bs58_1.default.encode(Buffer.concat([key,toUint8Array(checksum).slice(0,4)]))},encodePrivate=key=>{assert_1.default.strictEqual(key.readUInt8(0),128,"private key network id mismatch");var checksum=doubleSha256(key);return bs58_1.default.encode(Buffer.concat([key,toUint8Array(checksum).slice(0,4)]))},decodePrivate=encodedKey=>{var encodedKey=bs58_1.default.decode(encodedKey),toCompare=toBuffer(encodedKey.slice(0,1));if(0!==Buffer.compare(NETWORK_ID,toCompare))throw new Error("private key network id mismatch");var toCompare=encodedKey.slice(-4),encodedKey=encodedKey.slice(0,-4),encodedKey=Buffer.from(encodedKey),dSha256=sha256(sha256(encodedKey)),dSha256=toUint8Array(dSha256).slice(0,4);if(0!==Buffer.compare(toBuffer(dSha256),toBuffer(toCompare)))throw new Error("private key checksum mismatch");return encodedKey},isCanonicalSignature=signature=>!(128&signature[0]||0===signature[0]&&!(128&signature[1])||128&signature[32]||0===signature[32]&&!(128&signature[33]));class PublicKey{constructor(key,prefix=client_1.DEFAULT_ADDRESS_PREFIX){this.key=key,this.prefix=prefix,(0,assert_1.default)(secp256k1.Point.fromHex(key),"invalid public key"),this.uncompressed=Buffer.from(secp256k1.Point.fromHex(key).toRawBytes(!1))}static fromString(wif){var{key:wif,prefix}=(encodedKey=>{var prefix=encodedKey.slice(0,3),encodedKey=(encodedKey=encodedKey.slice(3),bs58_1.default.decode(encodedKey)),checksum=encodedKey.slice(-4),encodedKey=encodedKey.slice(0,-4),encodedKey=Buffer.from(encodedKey),checksumVerify=toUint8Array(ripemd160(encodedKey)).slice(0,4);if(0!==Buffer.compare(toBuffer(checksumVerify),toBuffer(checksum)))throw new Error("public key checksum mismatch");return{key:encodedKey,prefix:prefix}})(wif);return new PublicKey(wif,prefix)}static fromBuffer(key){return(0,assert_1.default)(secp256k1.Point.fromHex(key),"invalid buffer as public key"),{key:key}}static from(value){return value instanceof PublicKey?value:PublicKey.fromString(value)}verify(message,signature){return secp256k1.verify(signature.data,message,this.key,{strict:!1})}toString(){return encodePublic(this.key,this.prefix)}toJSON(){return this.toString()}inspect(){return"PublicKey: "+this.toString()}}exports.PublicKey=PublicKey;class PrivateKey{constructor(key){this.key=key,(0,assert_1.default)(secp256k1.utils.isValidPrivateKey(key),"invalid private key")}static from(value){return"string"==typeof value?PrivateKey.fromString(value):new PrivateKey(value)}static fromString(wif){wif=toUint8Array(decodePrivate(wif)).slice(1);return new PrivateKey(toBuffer(wif))}static fromSeed(seed){return new PrivateKey(sha256(seed))}static fromLogin(username,password,role="active"){username=username+role+password;return PrivateKey.fromSeed(username)}sign(message){let rv,attempts=0;do{var options={data:sha256(Buffer.concat([message,Buffer.alloc(1,++attempts)]))},[options,recid]=secp256k1.signSync(message,this.key,{der:!1,extraEntropy:options.data,recovered:!0})}while(rv={signature:options,recid:recid},!isCanonicalSignature(toBuffer(rv.signature)));return new Signature(toBuffer(rv.signature),rv.recid)}createPublic(prefix){return new PublicKey(Buffer.from(secp256k1.getPublicKey(this.key,!0)),prefix)}toString(){return encodePrivate(Buffer.concat([NETWORK_ID,this.key]))}getSharedSecret(publicKey){publicKey=Buffer.from(secp256k1.getSharedSecret(this.key,publicKey.key,!1));return sha512(publicKey.slice(1,33))}inspect(){var key=this.toString();return`PrivateKey: ${key.slice(0,6)}...`+key.slice(-6)}}exports.PrivateKey=PrivateKey;class Signature{constructor(data,recovery){this.data=data,this.recovery=recovery,assert_1.default.strictEqual(data.length,64,"invalid signature")}static fromBuffer(buffer){assert_1.default.strictEqual(buffer.length,65,"invalid signature");var recovery=buffer.readUInt8(0)-31,buffer=toUint8Array(buffer).slice(1);return new Signature(toBuffer(buffer),recovery)}static fromString(string){return Signature.fromBuffer(Buffer.from(string,"hex"))}recover(message,prefix){return new PublicKey(Buffer.from(secp256k1.recoverPublicKey(message,this.data,this.recovery,!0)),prefix)}toBuffer(){var buffer=Buffer.alloc(65);return buffer.writeUInt8(this.recovery+31,0),this.data.copy(buffer,1),buffer}toString(){return this.toBuffer().toString("hex")}}exports.Signature=Signature;let transactionDigest=(transaction,chainId=client_1.DEFAULT_CHAIN_ID)=>{var buffer=new ByteBuffer(ByteBuffer.DEFAULT_CAPACITY,ByteBuffer.LITTLE_ENDIAN);try{serializer_1.Types.Transaction(buffer,transaction)}catch(cause){throw new errors_1.SerializationError(cause)}buffer.flip();transaction=Buffer.from(buffer.toBuffer());return sha256(Buffer.concat([chainId,transaction]))};exports.decodeMemo=(memo,receiverPrivateMemoKey)=>{try{if((0,assert_1.default)("string"==typeof receiverPrivateMemoKey||receiverPrivateMemoKey.toString(),"Invalid Receiver private MEMO key!"),!memo.startsWith("#"))return memo;let privateKey="string"==typeof receiverPrivateMemoKey?PrivateKey.from(receiverPrivateMemoKey):receiverPrivateMemoKey,memoBuff=(memo=memo.substring(1),bs58_1.default.decode(memo)),{from,nonce,check,encrypted}=(0,deserializer_1.EncryptedMemoDeserializer)(Buffer.from(memoBuff)),publicKey=new PublicKey(from.key),nonceLong=toByteBuffer(nonce),S=privateKey.getSharedSecret(publicKey),ebuf=new ByteBuffer(ByteBuffer.DEFAULT_CAPACITY,ByteBuffer.LITTLE_ENDIAN),encryption_key=(ebuf.writeUint64(nonceLong),ebuf.append(S.toString("binary"),"binary"),ebuf=Buffer.from(ebuf.copy(0,ebuf.offset).toBinary(),"binary"),sha512(ebuf)),iv=encryption_key.slice(32,48),tag=encryption_key.slice(0,32),checksum=sha256(encryption_key);checksum=checksum.slice(0,4);var cbuf=ByteBuffer.fromBinary(checksum.toString("binary"),ByteBuffer.LITTLE_ENDIAN),binaryMessage=(checksum=cbuf.readUint32(),(0,assert_1.default)(check===checksum,"Invalid nonce!"),toUint8Array(encrypted));return(decryptedMessage=>{decryptedMessage=ByteBuffer.fromBinary(decryptedMessage.toString("binary"),ByteBuffer.LITTLE_ENDIAN);try{return decryptedMessage.mark(),"#"+decryptedMessage.readVString()}catch(e){return decryptedMessage.reset(),"#"+Buffer.from(decryptedMessage.toString("binary"),"binary").toString("utf-8")}})(((key,iv,input)=>{key=new aesjs.ModeOfOperation.cbc(Array.from(key),Array.from(iv));return Buffer.from(pkcs7Unpad(key.decrypt(Array.from(input))))})(tag,iv,binaryMessage))}catch(e){throw e}},exports.encodeMemo=(memo,senderPrivateMemoKey,receiverPublicMemoKey)=>{try{if((0,assert_1.default)("string"==typeof senderPrivateMemoKey||senderPrivateMemoKey.toString(),"Invalid Sender private MEMO key!"),(0,assert_1.default)("string"==typeof receiverPublicMemoKey||receiverPublicMemoKey.toString(),"Invalid Receiver public MEMO key!"),!memo.startsWith("#"))return memo;let privateKey="string"==typeof senderPrivateMemoKey?PrivateKey.from(senderPrivateMemoKey):senderPrivateMemoKey,publicKey="string"==typeof receiverPublicMemoKey?PublicKey.from(receiverPublicMemoKey):receiverPublicMemoKey,mbuf=(memo=memo.substring(1),new ByteBuffer(ByteBuffer.DEFAULT_CAPACITY,ByteBuffer.LITTLE_ENDIAN)),memoBuff=(mbuf.writeVString(memo),Buffer.from(mbuf.flip().toBinary(),"binary")),nonceLong=toByteBuffer(uniqueNonce()),S=privateKey.getSharedSecret(publicKey),ebuf=new ByteBuffer(ByteBuffer.DEFAULT_CAPACITY,ByteBuffer.LITTLE_ENDIAN),encryption_key=(ebuf.writeUint64(nonceLong),ebuf.append(S.toString("binary"),"binary"),ebuf=Buffer.from(ebuf.copy(0,ebuf.offset).toBinary(),"binary"),sha512(ebuf)),iv=encryption_key.slice(32,48),tag=encryption_key.slice(0,32),check=sha256(encryption_key);check=check.slice(0,4);var cbuf=ByteBuffer.fromBinary(check.toString("binary"),ByteBuffer.LITTLE_ENDIAN),message=(check=cbuf.readUint32(),toUint8Array(memoBuff)),message=((key,iv,input)=>{key=new aesjs.ModeOfOperation.cbc(Array.from(key),Array.from(iv));return Buffer.from(key.encrypt(Array.from(pkcs7Pad(input))))})(tag,iv,message),lbuf=new ByteBuffer(ByteBuffer.DEFAULT_CAPACITY,ByteBuffer.LITTLE_ENDIAN),data=(serializer_1.Types.Memo(lbuf,{check:check,encrypted:message,from:privateKey.createPublic(),nonce:nonceLong,to:publicKey}),lbuf.flip(),Buffer.from(lbuf.toBuffer()));return"#"+bs58_1.default.encode(data)}catch(e){throw e}},exports.cryptoUtils={decodePrivate:decodePrivate,doubleSha256:doubleSha256,encodePrivate:encodePrivate,encodePublic:encodePublic,generateTrxId:transaction=>{var buffer=new ByteBuffer(ByteBuffer.DEFAULT_CAPACITY,ByteBuffer.LITTLE_ENDIAN);try{serializer_1.Types.Transaction(buffer,transaction)}catch(cause){throw new errors_1.SerializationError(cause)}buffer.flip();transaction=Buffer.from(buffer.toBuffer());return exports.cryptoUtils.sha256(transaction).toString("hex").slice(0,40)},isCanonicalSignature:isCanonicalSignature,isWif:privWif=>{try{var privKey,checksum,newChecksum,bufWif=Buffer.from(bs58_1.default.decode(privWif));return 37===bufWif.length&&0===Buffer.compare(bufWif.slice(0,1),NETWORK_ID)&&(privKey=bufWif.slice(0,-4),checksum=bufWif.slice(-4),newChecksum=doubleSha256(privKey).slice(0,4),0===Buffer.compare(checksum,newChecksum))}catch(e){return!1}},regExpAccount:/^(?=.{3,16}$)[a-z][0-9a-z\-]{1,}[0-9a-z]([\.][a-z][0-9a-z\-]{1,}[0-9a-z]){0,}$/,regExpAtAccount:/^@(?=.{3,16}$)[a-z][0-9a-z\-]{1,}[0-9a-z]([\.][a-z][0-9a-z\-]{1,}[0-9a-z]){0,}$/,ripemd160:ripemd160,sha256:sha256,signTransaction:(transaction,keys,chainId=client_1.DEFAULT_CHAIN_ID)=>{var key,digest=transactionDigest(transaction,chainId),signedTransaction=(0,utils_1.copy)(transaction);signedTransaction.signatures||(signedTransaction.signatures=[]);for(key of keys=Array.isArray(keys)?keys:[keys]){var signature=key.sign(digest);signedTransaction.signatures.push(signature.toString())}return signedTransaction},toBuffer:toBuffer,toByteBuffer:toByteBuffer,toUint8Array:toUint8Array,transactionDigest:transactionDigest,uniqueNonce:uniqueNonce}}.call(this)}.call(this,_dereq_("buffer").Buffer)},{"./chain/deserializer":8,"./chain/serializer":13,"./client":16,"./errors":19,"./utils":36,"@noble/hashes/hmac":41,"@noble/hashes/legacy":42,"@noble/hashes/sha2":43,"@noble/secp256k1":45,"aes-js":46,assert:47,bs58:54,buffer:55,"bytebuffer/dist/bytebuffer":56}],19:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.rpcErrorFromResponse=exports.classifyError=exports.isDBlurtError=exports.RpcApplicationError=exports.ValidationError=exports.SerializationError=exports.DBlurtError=void 0;let utils_1=_dereq_("./utils"),defaultMetadata={category:"unknown",code:"DBLURT_UNKNOWN",retryable:!1};class DBlurtError extends Error{constructor(name,message,options={}){var fullMessage=options.cause?message+": "+options.cause.message:message,name=(super(fullMessage),this.dblurt_error=!0,delete this.message,this.name=name,options.metadata||defaultMetadata);Object.defineProperties(this,{category:{configurable:!0,enumerable:!1,value:name.category},code:{configurable:!0,enumerable:!1,value:name.code},dblurt_error:{configurable:!0,enumerable:!1,value:!0},metadata:{configurable:!0,enumerable:!1,value:name},retryable:{configurable:!0,enumerable:!1,value:name.retryable}}),this.jse_shortmsg=message,options.cause&&(this.jse_cause=options.cause),this.jse_info=options.info||{},Object.defineProperty(this,"message",{configurable:!0,enumerable:!0,value:fullMessage,writable:!0}),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}cause(){return this.jse_cause}}exports.DBlurtError=DBlurtError;class SerializationError extends DBlurtError{constructor(cause){super("SerializationError","Unable to serialize transaction",{cause:cause,metadata:{category:"serialization",code:"DBLURT_SERIALIZATION",retryable:!1}})}}exports.SerializationError=SerializationError;class ValidationError extends DBlurtError{constructor(message,context={}){super("ValidationError",message,{metadata:{category:"validation",code:"DBLURT_VALIDATION",retryable:!1,...context.field?{field:context.field}:{},...context.path?{path:context.path}:{}}})}}exports.ValidationError=ValidationError;class RpcApplicationError extends DBlurtError{constructor(message,info,rpcCode){super("RPCError",message,{info:info,metadata:{category:"rpc_application",code:"DBLURT_RPC_APPLICATION",retryable:!1,..."number"==typeof rpcCode?{rpc_code:rpcCode}:{},...void 0!==info?{rpc_data:info}:{}}})}}exports.RpcApplicationError=RpcApplicationError;let formatValue=value=>"object"!=typeof value?String(value):JSON.stringify(value),getErrorCode=error=>error&&"string"==typeof error.code?error.code:void 0,getErrorName=error=>error&&"string"==typeof error.name?error.name:void 0,transportRetryableCodes=["ENOTFOUND","ECONNREFUSED","CERT_HAS_EXPIRED","EHOSTUNREACH"];exports.isDBlurtError=error=>Boolean(error&&!0===error.dblurt_error&&error.metadata),exports.classifyError=error=>{if((0,exports.isDBlurtError)(error))return error.metadata;let causeCode=getErrorCode(error),httpStatus,causeName=getErrorName(error),causeMessage=(error=>error&&"string"==typeof error.message?error.message:void 0)(error);return(error=>"AbortError"===getErrorName(error)||"ABORT_ERR"===getErrorCode(error))(error)?{category:"timeout",code:"DBLURT_TIMEOUT",retryable:!0,...causeName?{cause_name:causeName}:{},...causeMessage?{cause_message:causeMessage}:{}}:causeCode||causeMessage&&/^HTTP \d+:/i.test(causeMessage)?(httpStatus=causeMessage&&/^HTTP (\d+):/i.exec(causeMessage),{category:"transport",code:"DBLURT_TRANSPORT",retryable:causeCode?transportRetryableCodes.some(code=>causeCode.includes(code)):Boolean(httpStatus&&500<=Number(httpStatus[1])),...causeCode?{cause_code:causeCode}:{},...causeMessage?{cause_message:causeMessage}:{}}):{category:"unknown",code:"DBLURT_UNKNOWN",retryable:!1,...causeName?{cause_name:causeName}:{},...causeMessage?{cause_message:causeMessage}:{}}},exports.rpcErrorFromResponse=error=>{let data=error.data,message=error.message;if(data&&data.stack&&0<data.stack.length){let top=data.stack[0],topData=(0,utils_1.copy)(top.data);message=top.format.replace(/\$\{([a-z_]+)\}/gi,(match,key)=>{let rv=match;return topData[key]&&(rv=formatValue(topData[key]),delete topData[key]),rv});var unformattedData=Object.keys(topData).map(key=>({key:key,value:formatValue(topData[key])})).map(item=>item.key+"="+item.value);0<unformattedData.length&&(message+=" "+unformattedData.join(" "))}return new RpcApplicationError(message,data,error.code)}},{"./utils":36}],20:[function(_dereq_,module,exports){!function(Buffer){!function(){var __createBinding=this&&this.__createBinding||(Object.create?function(o,m,k,k2){void 0===k2&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);desc&&("get"in desc?m.__esModule:!desc.writable&&!desc.configurable)||(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){o[k2=void 0===k2?k:k2]=m[k]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=this&&this.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(null!=mod)for(var k in mod)"default"!==k&&Object.prototype.hasOwnProperty.call(mod,k)&&__createBinding(result,mod,k);return __setModuleDefault(result,mod),result},__importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ExperimentalClient=void 0;let assert=__importStar(_dereq_("assert")),version_1=__importDefault(_dereq_("./version")),account_history_1=_dereq_("./helpers/account_history"),blockchain_1=_dereq_("./helpers/blockchain"),broadcast_1=_dereq_("./helpers/broadcast"),index_browser_1=_dereq_("./index-browser"),database_1=_dereq_("./helpers/database"),nexus_1=_dereq_("./helpers/nexus"),tools_1=_dereq_("./helpers/tools"),errors_1=_dereq_("./errors"),client_1=_dereq_("./client"),rpc_transport_1=_dereq_("./transports/rpc_transport");exports.ExperimentalClient=class{constructor(address,options={}){this.currentAddress=Array.isArray(address)?address[0]||"https://rpc.blurt.blog":address,this.address=address,this.options=options,this.chainId=options.chainId?Buffer.from(options.chainId,"hex"):client_1.DEFAULT_CHAIN_ID,assert.strictEqual(this.chainId.length,32,"invalid chain id"),this.addressPrefix=options.addressPrefix||client_1.DEFAULT_ADDRESS_PREFIX,this.timeout=void 0!==options.timeout?options.timeout:6e4,this.backoff=options.backoff||(tries=>Math.min(Math.pow(10*tries,2),1e4)),this.failoverThreshold=void 0!==options.failoverThreshold?options.failoverThreshold:3,this.coreClient=options.coreClient,this.coreModule=options.coreModule,this.accountHistory=new account_history_1.AccountHistoryAPI(this),this.blockchain=new blockchain_1.Blockchain(this),this.broadcast=new broadcast_1.BroadcastAPI(this),this.condenser=new index_browser_1.CondenserAPI(this),this.database=new database_1.DatabaseAPI(this),this.nexus=new nexus_1.Nexus(this),this.tools=new tools_1.Tools(this)}async call(api,method,params=[]){var core=await this.getCoreClient(),api={id:0,jsonrpc:"2.0",method:api+"."+method,params:this.legacySerializeParams(params)},method=core.callRaw?await core.callRaw(api,this.callOptions()):await this.callViaResultMode(core,api),params=(0,rpc_transport_1.validateRpcResponse)(method);if(this.syncCurrentAddress(core),params.error)throw(0,errors_1.rpcErrorFromResponse)(params.error);return assert.strictEqual(params.id,api.id,"got invalid response id"),params.result}async close(){await(this.coreClient||this.loadedCoreClient)?.close?.()}async callViaResultMode(core,request){if(!core.call)throw new Error("blurt-rpc-core client must expose callRaw or call");try{var result=await core.call(request.method,request.params,{...this.callOptions(),id:request.id});return{id:request.id,result:result}}catch(error){throw error}}callOptions(){var options={retry:{backoff:{delayMs:attempt=>this.backoff(attempt)},maxAttempts:0===this.failoverThreshold?Number.MAX_SAFE_INTEGER:this.failoverThreshold}};return 0<this.timeout&&(options.timeoutMs=this.timeout),options}async getCoreClient(){if(this.coreClient)return this.coreClient;if(!this.loadedCoreClient){var core=this.coreModule||await this.loadCoreModule(),options=this.coreOptions();if(core.createRpcClient)this.loadedCoreClient=core.createRpcClient(this.address,options);else{if(!core.RpcClient)throw new Error("blurt-rpc-core module must expose createRpcClient or RpcClient");this.loadedCoreClient=new core.RpcClient(this.address,options)}}return this.loadedCoreClient}coreOptions(){var headers={Accept:"application/json, text/plain, */*","Content-Type":"application/json"};return"undefined"==typeof self&&(headers["User-Agent"]=this.options.userAgent||"dblurt/"+version_1.default),{backoff:{delayMs:attempt=>this.backoff(attempt)},headers:headers,maxRetries:0===this.failoverThreshold?Number.MAX_SAFE_INTEGER:Math.max(0,this.failoverThreshold-1),strategy:this.options.nodeSelectionStrategy||this.legacyStickyStrategy(),...0<this.timeout?{timeoutMs:this.timeout}:{}}}legacyStickyStrategy(){let currentKey,endpointKey=state=>state.endpoint.id||String(state.endpoint.url);return{name:"dblurt-legacy-sticky",onFailure:state=>{currentKey&&endpointKey(state)===currentKey&&(currentKey=void 0)},select:states=>{states=states.filter(state=>!1!==state.endpoint.enabled&&"disabled"!==state.status);if(currentKey){var current=states.find(state=>endpointKey(state)===currentKey);if(current&&0===current.consecutiveFailures)return current}current=states.find(state=>0===state.consecutiveFailures)||states[0];return currentKey=current?endpointKey(current):void 0,current}}}legacySerializeParams(params){return JSON.parse(JSON.stringify(params,(_key,value)=>value&&"object"==typeof value&&"Buffer"===value.type&&Array.isArray(value.data)?Buffer.from(value.data).toString("hex"):value))}async loadCoreModule(){return import("@beblurt/blurt-rpc-core")}syncCurrentAddress(core){core=core.getCurrentEndpoint?.(),core=core&&core.endpoint&&core.endpoint.url;"string"==typeof core?this.currentAddress=core:core&&"function"==typeof core.toString&&(this.currentAddress=core.toString())}}}.call(this)}.call(this,_dereq_("buffer").Buffer)},{"./client":16,"./errors":19,"./helpers/account_history":21,"./helpers/blockchain":22,"./helpers/broadcast":23,"./helpers/database":25,"./helpers/nexus":26,"./helpers/tools":28,"./index-browser":30,"./transports/rpc_transport":35,"./version":37,assert:47,buffer:55}],21:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.AccountHistoryAPI=void 0,exports.AccountHistoryAPI=class{constructor(client){this.client=client}call(method,params){return this.client.call("account_history_api",method,params)}enumVirtualOps(params){return this.call("enum_virtual_ops",params)}getOpsInBlock(block_num,only_virtual=!1){return this.call("get_ops_in_block",{block_num:block_num,only_virtual:only_virtual})}}},{}],22:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.Blockchain=exports.BlockchainMode=void 0;let utils_1=_dereq_("./../utils");var BlockchainMode;(BlockchainMode=>{BlockchainMode[BlockchainMode.Irreversible=0]="Irreversible",BlockchainMode[BlockchainMode.Latest=1]="Latest"})(BlockchainMode||(exports.BlockchainMode=BlockchainMode={})),exports.Blockchain=class{constructor(client){this.client=client}async getCurrentBlockNum(mode=BlockchainMode.Irreversible){var props=await this.client.condenser.getDynamicGlobalProperties();switch(mode){case BlockchainMode.Irreversible:return props.last_irreversible_block_num;case BlockchainMode.Latest:return props.head_block_number}}async getCurrentBlockHeader(mode){return this.client.condenser.getBlockHeader(await this.getCurrentBlockNum(mode))}async getCurrentBlock(mode){return this.client.condenser.getBlock(await this.getCurrentBlockNum(mode))}async*getBlockNumbers(options){options?"number"==typeof options&&(options={from:options}):options={};let current=await this.getCurrentBlockNum(options.mode);if(void 0!==options.from&&options.from>current)throw new Error(`From can't be larger than current block num (${current})`);let seen=void 0!==options.from?options.from:current;for(;;){for(;current>seen;)if(yield seen++,void 0!==options.to&&seen>options.to)return;await(0,utils_1.sleep)(3e3),current=await this.getCurrentBlockNum(options.mode)}}getBlockNumberStream(options){return(0,utils_1.iteratorStream)(this.getBlockNumbers(options))}async*getBlocks(options){for await(var num of this.getBlockNumbers(options))yield await this.client.condenser.getBlock(num)}getBlockStream(options){return(0,utils_1.iteratorStream)(this.getBlocks(options))}async*getOperations(options){for await(var num of this.getBlockNumbers(options)){var operation;for(operation of await this.client.condenser.getOperations(num))yield operation}}getOperationsStream(options){return(0,utils_1.iteratorStream)(this.getOperations(options))}}},{"./../utils":36}],23:[function(_dereq_,module,exports){!function(Buffer){!function(){Object.defineProperty(exports,"__esModule",{value:!0}),exports.BroadcastAPI=void 0;let social_1=_dereq_("../social"),crypto_1=_dereq_("../crypto");exports.BroadcastAPI=class{constructor(client){this.client=client,this.expireTime=12e4}call(method,params){return this.client.call("condenser_api",method,params)}async accountCreate(data,key){return this.sendOperations([["account_create",data]],key)}async accountUpdate(data,key){return this.sendOperations([["account_update",data]],key)}async accountWitnessProxy(data,key){return this.sendOperations([["account_witness_proxy",data]],key)}async accountWitnessVote(data,key){return this.sendOperations([["account_witness_vote",data]],key)}async cancelTransferFromSavings(data,key){return this.sendOperations([["cancel_transfer_from_savings",data]],key)}async changeRecoveryAccount(data,key){return this.sendOperations([["change_recovery_account",data]],key)}async claimAccount(data,key){return this.sendOperations([["claim_account",data]],key)}async claimRewardBalance(data,key){return this.sendOperations([["claim_reward_balance",data]],key)}async comment(data,key,options){var ops=[];return ops.push(["comment",data]),options&&ops.push(["comment_options",options]),this.sendOperations(ops,key)}async commentOptions(data,key){return this.sendOperations([["comment_options",data]],key)}async deleteComment(data,key){return this.sendOperations([["delete_comment",data]],key)}async transferToVesting(data,key){return this.sendOperations([["transfer_to_vesting",data]],key)}async withdrawVesting(data,key){return this.sendOperations([["withdraw_vesting",data]],key)}async setWithdrawVestingRoute(data,key){return this.sendOperations([["set_withdraw_vesting_route",data]],key)}async transferToSavings(data,key){return this.sendOperations([["transfer_to_savings",data]],key)}async transferFromSavings(data,key){return this.sendOperations([["transfer_from_savings",data]],key)}async createClaimedAccount(data,key){return this.sendOperations([["create_claimed_account",data]],key)}async requestAccountRecovery(data,key){return this.sendOperations([["request_account_recovery",data]],key)}async recoverAccount(data,key){return this.sendOperations([["recover_account",data]],key)}async escrowTransfer(data,key){return this.sendOperations([["escrow_transfer",data]],key)}async escrowApprove(data,key){return this.sendOperations([["escrow_approve",data]],key)}async escrowDispute(data,key){return this.sendOperations([["escrow_dispute",data]],key)}async escrowRelease(data,key){return this.sendOperations([["escrow_release",data]],key)}async witnessUpdate(data,key){return this.sendOperations([["witness_update",data]],key)}async witnessSetProperties(data,key){return this.sendOperations([["witness_set_properties",data]],key)}async createProposal(data,key){return this.sendOperations([["create_proposal",data]],key)}async updateProposalVotes(data,key){return this.sendOperations([["update_proposal_votes",data]],key)}async removeProposal(data,key){return this.sendOperations([["remove_proposal",data]],key)}async customJson(data,key){return this.sendOperations([["custom_json",data]],key)}async delegateVestingShares(options,key){return this.sendOperations([["delegate_vesting_shares",options]],key)}async prepareTransaction(operations){var props=await this.client.condenser.getDynamicGlobalProperties(),ref_block_num=65535&props.head_block_number,ref_block_prefix=Buffer.from(props.head_block_id,"hex").readUInt32LE(4);return{expiration:new Date(new Date(props.time+"Z").getTime()+this.expireTime).toISOString().slice(0,-5),extensions:[],operations:operations,ref_block_num:ref_block_num,ref_block_prefix:ref_block_prefix}}async reblurt(account,author,permlink,undo=!1,key){undo=(undo?social_1.buildUndoReblogOperation:social_1.buildReblogOperation)({account:account,author:author,permlink:permlink});return this.sendOperations([undo],key)}async reblog(account,author,permlink,key){return this.sendOperations([(0,social_1.buildReblogOperation)({account:account,author:author,permlink:permlink})],key)}async undoReblog(account,author,permlink,key){return this.sendOperations([(0,social_1.buildUndoReblogOperation)({account:account,author:author,permlink:permlink})],key)}async follow(follower,following,key){return this.sendOperations([(0,social_1.buildFollowOperation)({follower:follower,following:following})],key)}async unfollow(follower,following,key){return this.sendOperations([(0,social_1.buildUnfollowOperation)({follower:follower,following:following})],key)}async mute(follower,following,key){return this.sendOperations([(0,social_1.buildMuteOperation)({follower:follower,following:following})],key)}async unmute(follower,following,key){return this.sendOperations([(0,social_1.buildUnmuteOperation)({follower:follower,following:following})],key)}async readNotification(account,date,key){return this.sendOperations([(0,social_1.buildReadNotificationOperation)({account:account,date:date})],key)}async send(transaction){var trxId=crypto_1.cryptoUtils.generateTrxId(transaction),transaction=await this.call("broadcast_transaction",[transaction]);return Object.assign({id:trxId},transaction)}async sendOperations(operations,key){operations=await this.prepareTransaction(operations);return this.send(this.sign(operations,key))}sign(transaction,key){return crypto_1.cryptoUtils.signTransaction(transaction,key,this.client.chainId)}async transfer(data,key){return this.sendOperations([["transfer",data]],key)}async vote(vote,key){return this.sendOperations([["vote",vote]],key)}async nexusMutePost(community,authority,account,permlink,notes,key){authority=["custom_json",{required_auths:[],required_posting_auths:[authority],id:"community",json:JSON.stringify(["mutePost",{community:community,account:account,permlink:permlink,notes:notes}])}];return this.sendOperations([authority],key)}async nexusPinPost(community,authority,account,permlink,key){authority=["custom_json",{required_auths:[],required_posting_auths:[authority],id:"community",json:JSON.stringify(["pinPost",{community:community,account:account,permlink:permlink}])}];return this.sendOperations([authority],key)}async nexusSetRole(community,authority,account,role,key){authority=["custom_json",{required_auths:[],required_posting_auths:[authority],id:"community",json:JSON.stringify(["setRole",{community:community,account:account,role:role}])}];return this.sendOperations([authority],key)}async nexusSetUserTitle(community,authority,account,title,key){authority=["custom_json",{required_auths:[],required_posting_auths:[authority],id:"community",json:JSON.stringify(["setUserTitle",{community:community,account:account,title:title}])}];return this.sendOperations([authority],key)}async nexusUnmutePost(community,authority,account,permlink,notes,key){authority=["custom_json",{required_auths:[],required_posting_auths:[authority],id:"community",json:JSON.stringify(["unmutePost",{community:community,account:account,permlink:permlink,notes:notes}])}];return this.sendOperations([authority],key)}async nexusUnpinPost(community,authority,account,permlink,key){authority=["custom_json",{required_auths:[],required_posting_auths:[authority],id:"community",json:JSON.stringify(["unpinPost",{community:community,account:account,permlink:permlink}])}];return this.sendOperations([authority],key)}async nexusUpdateProps(data,authority,key){authority=["custom_json",{required_auths:[],required_posting_auths:[authority],id:"community",json:JSON.stringify(["updateProps",data])}];return this.sendOperations([authority],key)}async nexusFlagPost(community,authority,account,permlink,notes,key){authority=["custom_json",{required_auths:[],required_posting_auths:[authority],id:"community",json:JSON.stringify(["flagPost",{community:community,account:account,permlink:permlink,notes:notes}])}];return this.sendOperations([authority],key)}async nexusSubscription(community,action,account,key){action=("subscribe"===action?social_1.buildCommunitySubscribeOperation:social_1.buildCommunityUnsubscribeOperation)({account:account,community:community});return this.sendOperations([action],key)}async communitySubscribe(account,community,key){return this.sendOperations([(0,social_1.buildCommunitySubscribeOperation)({account:account,community:community})],key)}async communityUnsubscribe(account,community,key){return this.sendOperations([(0,social_1.buildCommunityUnsubscribeOperation)({account:account,community:community})],key)}async nexusAddReferrer(authority,referrer,campaign,key){authority=["custom_json",{required_auths:[],required_posting_auths:[authority],id:"referral",json:JSON.stringify({referrer:referrer,campaign:campaign})}];return this.sendOperations([authority],key)}}}.call(this)}.call(this,_dereq_("buffer").Buffer)},{"../crypto":18,"../social":32,buffer:55}],24:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.CondenserAPI=void 0;let authority_1=_dereq_("../authority");exports.CondenserAPI=class{constructor(client){this.client=client}call(method,params){return this.client.call("condenser_api",method,params)}getAccountHistory(account,from,limit,operation_bitmask){let params=[account,from,limit];if(operation_bitmask&&Array.isArray(operation_bitmask)){if(2!==operation_bitmask.length)throw Error("operation_bitmask should be generated by the helper function");params=operation_bitmask[1]?[...params,operation_bitmask[0],operation_bitmask[1]]:[...params,operation_bitmask[0]]}return this.call("get_account_history",params)}getAccounts(usernames){return this.call("get_accounts",[usernames])}async validatePostingAuthority(accountName,key){let accounts=new Map,fetched=new Set,fetchAccount=async name=>{var existing=accounts.get(name);if(existing)return existing;if(!fetched.has(name)){fetched.add(name);var[existing]=await this.getAccounts([name]);if(existing&&existing.name===name)return accounts.set(name,existing),existing}throw new Error("account not found: "+name)},root=await fetchAccount(accountName),queue=[accountName],index=0;for(;index<queue.length;){var auth,current=await fetchAccount(queue[index]);index++;for(auth of[current.owner,current.active,current.posting])for(var[delegated]of auth.account_auths||[])accounts.has(delegated)||queue.includes(delegated)||queue.push(delegated)}return(0,authority_1.validatePostingAuthority)(root,key,{getAccount:name=>accounts.get(name)})}async getActiveVotes(author,permlink){return this.call("get_active_votes",[author,permlink])}async getActiveWitnesses(){return this.call("get_active_witnesses",[])}getBlock(blockNum){return this.call("get_block",[blockNum])}getBlockHeader(blockNum){return this.call("get_block_header",[blockNum])}getBlogEntries(account,start_entry_id,limit){return this.call("get_blog_entries",[account,start_entry_id,limit])}async getChainProperties(){return this.call("get_chain_properties")}getConfig(){return this.call("get_config",[])}getContent(author,permlink){return this.call("get_content",[author,permlink])}getContentReplies(author,permlink){return this.call("get_content_replies",[author,permlink])}getDynamicGlobalProperties(){return this.call("get_dynamic_global_properties")}getDiscussions(by,query){return this.call("get_discussions_by_"+by,[query])}async getFollowCount(accounts){return this.call("get_follow_count",accounts)}async getFollowers(account,start,type,limit){return this.call("get_followers",[account,start,type,limit])}async getFollowing(account,start,type,limit){return this.call("get_following",[account,start,type,limit])}getRebloggedBy(author,permlink){return this.call("get_reblogged_by",[author,permlink])}getOperations(blockNum,onlyVirtual=!1){return this.call("get_ops_in_block",[blockNum,onlyVirtual])}getProposals(start,limit,order,order_direction,status){return this.call("list_proposals",[start,limit,order,order_direction,status])}getProposalVotes(start,limit,order,order_direction,status){return this.call("list_proposal_votes",[start,limit,order,order_direction,status])}async getRewardFund(fund){return this.call("get_reward_fund",[fund])}async getState(path){return this.call("get_state",[path])}async getTransaction(txId){return this.call("get_transaction",[txId])}async getVersion(){return this.call("get_version",[])}async getVestingDelegations(account,from="",limit=1e3){return this.call("get_vesting_delegations",[account,from,limit])}async getWitnessSchedule(){return this.call("get_witness_schedule",[])}async getWitnessByAccount(account){return this.call("get_witness_by_account",[account])}async getWitnessesByVote(account,limit){return this.call("get_witnesses_by_vote",[account,limit])}async getWitnessesCount(){return this.call("get_witness_count",[])}async lookupAccounts(account,limit){return this.call("lookup_accounts",[account,limit])}async lookupWitnessAccounts(account,limit){return this.call("lookup_witness_accounts",[account,limit])}async verifyAuthority(stx){return this.call("verify_authority",[stx])}}},{"../authority":1}],25:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.DatabaseAPI=void 0,exports.DatabaseAPI=class{constructor(client){this.client=client}call(method,params){return this.client.call("database_api",method,params)}getConfig(){return this.call("get_config",{})}getListAccounts(start,limit,order,delayed_votes_active=!0){return this.call("list_accounts",{start:start,limit:limit,order:order,delayed_votes_active:delayed_votes_active})}getListWitnessVotes(start,limit,order){return this.call("list_witness_votes",{start:start,limit:limit,order:order})}async getVersion(){return this.call("get_version",[])}}},{}],26:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.Nexus=void 0,exports.Nexus=class{constructor(client){this.client=client}call(method,params){return this.client.call("bridge",method,params)}accountNotifications(accountOrOptions,min_score=25,last_id=null,limit=100){min_score="string"==typeof accountOrOptions?{account:accountOrOptions,min_score:min_score,last_id:last_id,limit:limit}:{account:accountOrOptions.account,min_score:accountOrOptions.min_score??25,last_id:accountOrOptions.last_id??null,limit:accountOrOptions.limit??100};return this.call("account_notifications",min_score)}getAccountPosts(sortOrOptions,account,start_author="",start_permlink="",limit=20,observer=null){account="string"==typeof sortOrOptions?{sort:sortOrOptions,account:account,start_author:start_author,start_permlink:start_permlink,limit:limit,observer:observer}:{sort:sortOrOptions.sort,account:sortOrOptions.account,start_author:sortOrOptions.start_author??"",start_permlink:sortOrOptions.start_permlink??"",limit:sortOrOptions.limit??20,observer:sortOrOptions.observer??null};return this.call("get_account_posts",account)}getPostHeader(author,permlink){return this.call("get_post_header",{author:author,permlink:permlink})}normalizePost(post){return this.call("normalize_post",{post:post})}getCommunity(nameOrOptions,observer=null){observer="string"==typeof nameOrOptions?{name:nameOrOptions,observer:observer}:{name:nameOrOptions.name,observer:nameOrOptions.observer??null};return this.call("get_community",observer)}getCommunityContext(name,account){return this.call("get_community_context",{name:name,account:account})}getDiscussion(author,permlink){return this.call("get_discussion",{author:author,permlink:permlink})}getPayoutStats(limit=250){return this.call("get_payout_stats",{limit:limit})}getPost(authorOrOptions,permlink,observer=null){permlink="string"==typeof authorOrOptions?{author:authorOrOptions,permlink:permlink,observer:observer}:{author:authorOrOptions.author,permlink:authorOrOptions.permlink,observer:authorOrOptions.observer??null};return this.call("get_post",permlink)}getProfile(accountOrOptions,observer=null){observer="string"==typeof accountOrOptions?{account:accountOrOptions,observer:observer}:{account:accountOrOptions.account,observer:accountOrOptions.observer??null};return this.call("get_profile",observer)}getRankedPosts(sortOrOptions,start_author="",start_permlink="",limit=20,tag=null,observer=null){start_author="string"==typeof sortOrOptions?{sort:sortOrOptions,start_author:start_author,start_permlink:start_permlink,limit:limit,tag:tag,observer:observer}:{sort:sortOrOptions.sort,start_author:sortOrOptions.start_author??"",start_permlink:sortOrOptions.start_permlink??"",limit:sortOrOptions.limit??20,tag:sortOrOptions.tag??null,observer:sortOrOptions.observer??null};return this.call("get_ranked_posts",start_author)}listAllSubscriptions(account){return this.call("list_all_subscriptions",{account:account})}listCommunities(lastOrOptions="",limit=100,query=null,sort="rank",observer=null){lastOrOptions="object"==typeof lastOrOptions&&null!==lastOrOptions?{last:lastOrOptions.last??"",limit:lastOrOptions.limit??100,query:lastOrOptions.query??null,sort:lastOrOptions.sort??"rank",observer:lastOrOptions.observer??null}:{last:lastOrOptions,limit:limit,query:query,sort:sort,observer:observer};return this.call("list_communities",lastOrOptions)}listCommunityRoles(community,last="",limit=50){return this.call("list_community_roles",{community:community,last:last,limit:limit})}listCommunityTitles(community,last="",limit=50){return this.call("list_community_titles",{community:community,last:last,limit:limit})}listTopCommunities(limit=25){return this.call("list_top_communities",{limit:limit})}listPopComunities(limit=25){return this.call("list_pop_communities",{limit:limit})}listPopCommunities(limit=25){return this.listPopComunities(limit)}listSubscribers(community,last="",limit=100){return this.call("list_subscribers",{community:community,last:last,limit:limit})}getTrendingTopics(limit=10,observer=null){return this.call("get_trending_topics",{limit:limit,observer:observer})}postNotifications(authorOrOptions,permlink,min_score=25,last_id=null,limit=100){permlink="string"==typeof authorOrOptions?{author:authorOrOptions,permlink:permlink,min_score:min_score,last_id:last_id,limit:limit}:{author:authorOrOptions.author,permlink:authorOrOptions.permlink,min_score:authorOrOptions.min_score??25,last_id:authorOrOptions.last_id??null,limit:authorOrOptions.limit??100};return this.call("post_notifications",permlink)}unreadNotifications(accountOrOptions,min_score=25){min_score="string"==typeof accountOrOptions?{account:accountOrOptions,min_score:min_score}:{account:accountOrOptions.account,min_score:accountOrOptions.min_score??25};return this.call("unread_notifications",min_score)}referralAccounts(referrerOrOptions=null,campaign_id=null,limit=100,last_created_at=null){referrerOrOptions="object"==typeof referrerOrOptions&&null!==referrerOrOptions?{referrer:referrerOrOptions.referrer??null,campaign_id:referrerOrOptions.campaign_id??null,limit:referrerOrOptions.limit??100,last_created_at:referrerOrOptions.last_created_at??null}:{referrer:referrerOrOptions,campaign_id:campaign_id,limit:limit,last_created_at:last_created_at};return this.call("referral_accounts",referrerOrOptions)}referralAccountsCount(referrerOrOptions=null,campaign_id=null,start_date=null,end_date=null){referrerOrOptions="object"==typeof referrerOrOptions&&null!==referrerOrOptions?{referrer:referrerOrOptions.referrer??null,campaign_id:referrerOrOptions.campaign_id??null,start_date:referrerOrOptions.start_date??null,end_date:referrerOrOptions.end_date??null}:{referrer:referrerOrOptions,campaign_id:campaign_id,start_date:start_date,end_date:end_date};return this.call("referral_accounts_count",referrerOrOptions)}}},{}],27:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.ReadModels=exports.BLURT_NULL_SIGNING_KEY=void 0;let asset_1=_dereq_("../chain/asset"),roundBlurt=(exports.BLURT_NULL_SIGNING_KEY="BLT1111111111111111111111111111111114T1Anm",value=>Number(value.toFixed(3))),rewardNaiToAsset=value=>asset_1.Asset.fromNai({amount:value.toString(),precision:3,nai:"@@000000021"}).toString();exports.ReadModels=class{constructor(client){this.client=client}async getAccountSummary(username){var account=await this.requireAccount(username),[username,profile,mana]=await Promise.all([this.client.condenser.getDynamicGlobalProperties(),this.client.nexus.getProfile(username),this.client.tools.getAccountMana(username)]),stats=profile.stats||{},poweringDown="1969-12-31T23:59:59"!==account.next_vesting_withdrawal;return{account:{name:profile.name||account.name,about:profile.metadata?.profile?.about,created:profile.created,last_active:profile.active,last_post:account.last_post,last_vote_time:account.last_vote_time,post_count:profile.post_count??account.post_count,following:stats.following,followers:stats.followers,referrer:stats.referrer,mana_percent:Number((mana.current_mana/mana.max_mana*100).toFixed(2))},wallet:{balance:account.balance,savings_balance:account.savings_balance,vesting_shares:account.vesting_shares,vesting_to_blurt:this.convertVestsToBlurt(account.vesting_shares,username),delegation_in_blurt:this.convertVestsToBlurt(account.received_vesting_shares,username),delegation_out_blurt:this.convertVestsToBlurt(account.delegated_vesting_shares,username),currently_power_down:poweringDown,power_down_blurt:poweringDown?this.convertVestsToBlurt(account.vesting_withdraw_rate,username):0},witness:{witness_votes:account.witnesses_voted_for},rewards:{cumulative_posting_rewards:rewardNaiToAsset(account.posting_rewards),cumulative_curation_rewards:rewardNaiToAsset(account.curation_rewards)}}}async getOutgoingDelegationSummary(username,limit=50){let[delegations,dgp]=await Promise.all([this.client.condenser.getVestingDelegations(username,"",limit),this.client.condenser.getDynamicGlobalProperties()]),total=0,list=delegations.map(delegation=>{var blurt=this.convertVestsToBlurt(delegation.vesting_shares,dgp);return total+=blurt,{delegatee:delegation.delegatee,blurt_power:blurt,vesting_shares:delegation.vesting_shares,min_delegation_time:delegation.min_delegation_time}});return{delegator:username,count:list.length,total_delegated_blurt:roundBlurt(total),delegations:list}}async getSocialGraphSummary(username,sample=10){let followerRows,followingRows,counts=await this.client.condenser.getFollowCount([username]),followers=[],following=[];return 0<sample&&([followerRows,followingRows]=await Promise.all([this.client.condenser.getFollowers(username,null,"blog",sample),this.client.condenser.getFollowing(username,null,"blog",sample)]),followers=followerRows.map(row=>row.follower),following=followingRows.map(row=>row.following)),{account:username,follower_count:counts.follower_count,following_count:counts.following_count,followers_sample:followers,following_sample:following}}async getWitnessSummary(username){var[witness,dgp]=await Promise.all([this.client.condenser.getWitnessByAccount(username),this.client.condenser.getDynamicGlobalProperties()]);if(witness)return this.witnessToModel(witness,dgp);throw new Error("witness not found: "+username)}async listWitnessSummaries(limit=20){let[witnesses,dgp]=await Promise.all([this.client.condenser.getWitnessesByVote(null,limit),this.client.condenser.getDynamicGlobalProperties()]);return witnesses.map((witness,index)=>({rank:index+1,...this.witnessToModel(witness,dgp)}))}async estimateVoteValue(username,weight=100){var[mana,dgp,rewardFund]=await Promise.all([this.client.tools.getAccountMana(username),this.client.condenser.getDynamicGlobalProperties(),this.client.condenser.getRewardFund("post")]),cashoutMs=Date.now()+6048e5;return{account:username,weight_percent:weight,current_mana_percent:Number((mana.current_mana/mana.max_mana*100).toFixed(2)),vote_value_blurt:this.client.tools.getAccountVoteValue(weight,mana,0,cashoutMs,dgp,rewardFund)}}async requireAccount(username){var[account]=await this.client.condenser.getAccounts([username]);if(account)return account;throw new Error("account not found: "+username)}convertVestsToBlurt(value,dgp){return roundBlurt(this.client.tools.convertVESTS((value=>asset_1.Asset.from(value.toString()).amount)(value),dgp))}witnessToModel(witness,dgp){var voteVests=Number(witness.votes)/1e6;return{owner:witness.owner,enabled:witness.signing_key!==exports.BLURT_NULL_SIGNING_KEY,vote_weight_blurt:roundBlurt(this.client.tools.convertVESTS(voteVests,dgp)),missed_blocks_lifetime:witness.total_missed,running_version:witness.running_version,last_confirmed_block_num:witness.last_confirmed_block_num,blocks_behind_head:dgp.head_block_number-witness.last_confirmed_block_num,url:witness.url,chain_props:witness.props}}}},{"../chain/asset":4}],28:[function(_dereq_,module,exports){!function(Buffer){!function(){Object.defineProperty(exports,"__esModule",{value:!0}),exports.Tools=void 0;let asset_1=_dereq_("../chain/asset"),serializer_1=_dereq_("../chain/serializer"),ByteBuffer=_dereq_("bytebuffer/dist/bytebuffer");exports.Tools=class{constructor(client){this.client=client}call(method,params){return this.client.call("condenser_api",method,params)}async getAccountMana(name){try{var accounts=await this.call("get_accounts",[[name]]);if(0<accounts.length){let account=accounts[0],net_vesting_shares=asset_1.Asset.from(account.vesting_shares);net_vesting_shares=(net_vesting_shares=net_vesting_shares.subtract(account.delegated_vesting_shares)).add(account.received_vesting_shares);var vesting_withdraw_rate=asset_1.Asset.from(account.vesting_withdraw_rate),current_mana=parseInt(account.voting_manabar.current_mana,10),elapsed=Math.round(Date.now()/1e3)-account.voting_manabar.last_update_time,max_mana=1e6*(net_vesting_shares.amount-vesting_withdraw_rate.amount);return{current_mana:(current_mana+=elapsed*max_mana/432e3)>=max_mana?max_mana:current_mana,max_mana:max_mana}}throw new Error("invalid account name")}catch(e){throw e}}getAccountVoteValue(voteWeight,mana,net_rshares,cashout_time,DGP,REWARD_FUND){try{var vote_power_reserve_rate,vestedBlurt,currentSupply,ratio,maxVoteDenom,rshares,totalRshares,S,totPost,postRshares="string"==typeof net_rshares?parseInt(net_rshares,10):net_rshares,cashoutDelta=(cashout_time-Date.now())/1e3;return cashoutDelta<=0?0:(vote_power_reserve_rate=DGP.vote_power_reserve_rate,vestedBlurt=asset_1.Asset.from(DGP.total_vesting_fund_blurt),currentSupply=asset_1.Asset.from(DGP.current_supply),ratio=vestedBlurt.amount/currentSupply.amount,rshares=(mana.current_mana*(100*voteWeight)*60*60*24/1e4+(maxVoteDenom=432e3*vote_power_reserve_rate)-1)/maxVoteDenom,totPost=(totalRshares=(rshares=cashoutDelta<43200?rshares*cashoutDelta/43200:rshares)+postRshares)*(totalRshares+2*(S=parseInt(REWARD_FUND.content_constant,10)))/(totalRshares+4*S)*(asset_1.Asset.from(REWARD_FUND.reward_balance).amount/parseInt(REWARD_FUND.recent_claims,10))*ratio*(rshares/totalRshares),parseFloat(totPost.toFixed(3)))}catch(e){throw e}}convertVESTS(VESTS,DGP){try{var total_vesting_fund_blurt=asset_1.Asset.from(DGP.total_vesting_fund_blurt).amount,total_vesting_shares=asset_1.Asset.from(DGP.total_vesting_shares).amount;return Math.round(total_vesting_fund_blurt*VESTS/total_vesting_shares*1e3)/1e3}catch(e){throw e}}serialize(serializer,data){var buffer=new ByteBuffer(ByteBuffer.DEFAULT_CAPACITY,ByteBuffer.LITTLE_ENDIAN);return serializer(buffer,data),buffer.flip(),Buffer.from(buffer.toBuffer())}buildWitnessSetPropertiesOp(owner,props){var key,data={extensions:[],owner:owner,props:[]};for(key of Object.keys(props)){let type;switch(key){case"key":case"new_signing_key":type=serializer_1.Types.PublicKey;break;case"account_subsidy_budget":case"account_subsidy_decay":case"maximum_block_size":type=serializer_1.Types.UInt32;break;case"url":type=serializer_1.Types.String;break;case"account_creation_fee":case"operation_flat_fee":case"bandwidth_kbytes_fee":case"proposal_fee":type=serializer_1.Types.Asset;break;default:throw new Error("Unknown witness prop: "+key)}data.props.push([key,this.serialize(type,props[key])])}return data.props.sort((a,b)=>a[0].localeCompare(b[0])),["witness_set_properties",data]}}}.call(this)}.call(this,_dereq_("buffer").Buffer)},{"../chain/asset":4,"../chain/serializer":13,buffer:55,"bytebuffer/dist/bytebuffer":56}],29:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.TransactionStatusAPI=void 0,exports.TransactionStatusAPI=class{constructor(client){this.client=client}call(method,params){return this.client.call("transaction_status_api",method,params)}findTransaction(transaction_id){return this.call("find_transaction",{transaction_id:transaction_id})}}},{}],30:[function(_dereq_,module,exports){var __createBinding=this&&this.__createBinding||(Object.create?function(o,m,k,k2){void 0===k2&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);desc&&("get"in desc?m.__esModule:!desc.writable&&!desc.configurable)||(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){o[k2=void 0===k2?k:k2]=m[k]}),__exportStar=this&&this.__exportStar||function(m,exports){for(var p in m)"default"===p||Object.prototype.hasOwnProperty.call(exports,p)||__createBinding(exports,m,p)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(_dereq_("./index"),exports)},{"./index":31}],31:[function(_dereq_,module,exports){var __createBinding=this&&this.__createBinding||(Object.create?function(o,m,k,k2){void 0===k2&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);desc&&("get"in desc?m.__esModule:!desc.writable&&!desc.configurable)||(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){o[k2=void 0===k2?k:k2]=m[k]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=this&&this.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(null!=mod)for(var k in mod)"default"!==k&&Object.prototype.hasOwnProperty.call(mod,k)&&__createBinding(result,mod,k);return __setModuleDefault(result,mod),result},__exportStar=this&&this.__exportStar||function(m,exports){for(var p in m)"default"===p||Object.prototype.hasOwnProperty.call(exports,p)||__createBinding(exports,m,p)},__importStar=(Object.defineProperty(exports,"__esModule",{value:!0}),exports.isDBlurtError=exports.classifyError=exports.ValidationError=exports.SerializationError=exports.RpcApplicationError=exports.DBlurtError=exports.utils=void 0,__importStar(_dereq_("./utils"))),errors_1=(exports.utils=__importStar,__exportStar(_dereq_("./helpers/account_history"),exports),__exportStar(_dereq_("./helpers/blockchain"),exports),__exportStar(_dereq_("./helpers/condenser"),exports),__exportStar(_dereq_("./helpers/database"),exports),__exportStar(_dereq_("./helpers/nexus"),exports),__exportStar(_dereq_("./helpers/read_models"),exports),__exportStar(_dereq_("./helpers/tools"),exports),__exportStar(_dereq_("./helpers/transaction_status"),exports),__exportStar(_dereq_("./chain/account"),exports),__exportStar(_dereq_("./chain/account_history"),exports),__exportStar(_dereq_("./chain/asset"),exports),__exportStar(_dereq_("./chain/block"),exports),__exportStar(_dereq_("./chain/blog"),exports),__exportStar(_dereq_("./chain/comment"),exports),__exportStar(_dereq_("./chain/deserializer"),exports),__exportStar(_dereq_("./chain/nexus"),exports),__exportStar(_dereq_("./chain/misc"),exports),__exportStar(_dereq_("./chain/proposal"),exports),__exportStar(_dereq_("./chain/operation"),exports),__exportStar(_dereq_("./chain/serializer"),exports),__exportStar(_dereq_("./chain/transaction"),exports),__exportStar(_dereq_("./chain/witness"),exports),__exportStar(_dereq_("./client"),exports),_dereq_("./errors"));Object.defineProperty(exports,"DBlurtError",{enumerable:!0,get:function(){return errors_1.DBlurtError}}),Object.defineProperty(exports,"RpcApplicationError",{enumerable:!0,get:function(){return errors_1.RpcApplicationError}}),Object.defineProperty(exports,"SerializationError",{enumerable:!0,get:function(){return errors_1.SerializationError}}),Object.defineProperty(exports,"ValidationError",{enumerable:!0,get:function(){return errors_1.ValidationError}}),Object.defineProperty(exports,"classifyError",{enumerable:!0,get:function(){return errors_1.classifyError}}),Object.defineProperty(exports,"isDBlurtError",{enumerable:!0,get:function(){return errors_1.isDBlurtError}}),__exportStar(_dereq_("./experimental_client"),exports),__exportStar(_dereq_("./transports/core_rpc_transport"),exports),__exportStar(_dereq_("./transports/legacy_rpc_transport"),exports),__exportStar(_dereq_("./transports/rpc_transport"),exports),__exportStar(_dereq_("./crypto"),exports),__exportStar(_dereq_("./authority"),exports),__exportStar(_dereq_("./social"),exports),__exportStar(_dereq_("./content"),exports)},{"./authority":1,"./chain/account":2,"./chain/account_history":3,"./chain/asset":4,"./chain/block":5,"./chain/blog":6,"./chain/comment":7,"./chain/deserializer":8,"./chain/misc":9,"./chain/nexus":10,"./chain/operation":11,"./chain/proposal":12,"./chain/serializer":13,"./chain/transaction":14,"./chain/witness":15,"./client":16,"./content":17,"./crypto":18,"./errors":19,"./experimental_client":20,"./helpers/account_history":21,"./helpers/blockchain":22,"./helpers/condenser":24,"./helpers/database":25,"./helpers/nexus":26,"./helpers/read_models":27,"./helpers/tools":28,"./helpers/transaction_status":29,"./social":32,"./transports/core_rpc_transport":33,"./transports/legacy_rpc_transport":34,"./transports/rpc_transport":35,"./utils":36}],32:[function(_dereq_,module,exports){function buildCustomJsonOperation(options){return["custom_json",{id:options.id,json:JSON.stringify(options.payload),required_auths:options.required_auths||[],required_posting_auths:options.required_posting_auths||[options.account]}]}function buildFollowLikeOperation(options,what){return buildCustomJsonOperation({account:options.follower,id:"follow",payload:["follow",{follower:options.follower,following:options.following,what:what}]})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildCustomJsonOperation=buildCustomJsonOperation,exports.buildFollowOperation=function(options){return buildFollowLikeOperation(options,["blog"])},exports.buildUnfollowOperation=function(options){return buildFollowLikeOperation(options,[])},exports.buildMuteOperation=function(options){return buildFollowLikeOperation(options,["ignore"])},exports.buildUnmuteOperation=function(options){return buildFollowLikeOperation(options,[])},exports.buildReblogOperation=function(options){return buildCustomJsonOperation({account:options.account,id:"reblog",payload:["reblog",{account:options.account,author:options.author,permlink:options.permlink}]})},exports.buildUndoReblogOperation=function(options){return buildCustomJsonOperation({account:options.account,id:"reblog",payload:["reblog",{account:options.account,author:options.author,permlink:options.permlink,delete:"delete"}]})},exports.buildCommunitySubscribeOperation=function(options){return buildCustomJsonOperation({account:options.account,id:"community",payload:["subscribe",{community:options.community}]})},exports.buildCommunityUnsubscribeOperation=function(options){return buildCustomJsonOperation({account:options.account,id:"community",payload:["unsubscribe",{community:options.community}]})},exports.buildReadNotificationOperation=function(options){return buildCustomJsonOperation({account:options.account,id:"notify",payload:["setLastRead",{date:options.date}]})}},{}],33:[function(_dereq_,module,exports){!function(Buffer){!function(){var __createBinding=this&&this.__createBinding||(Object.create?function(o,m,k,k2){void 0===k2&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);desc&&("get"in desc?m.__esModule:!desc.writable&&!desc.configurable)||(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){o[k2=void 0===k2?k:k2]=m[k]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=this&&this.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(null!=mod)for(var k in mod)"default"!==k&&Object.prototype.hasOwnProperty.call(mod,k)&&__createBinding(result,mod,k);return __setModuleDefault(result,mod),result},__importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CoreRpcTransport=void 0;let assert=__importStar(_dereq_("assert")),version_1=__importDefault(_dereq_("../version")),errors_1=_dereq_("../errors"),rpc_transport_1=_dereq_("./rpc_transport");exports.CoreRpcTransport=class{constructor(config){this.config=config,this.currentAddress=config.currentAddress}getCurrentAddress(){return this.currentAddress}async close(){await(this.config.coreClient||this.loadedCoreClient)?.close?.()}async call(api,method,params=[]){var core=await this.getCoreClient(),api={id:0,jsonrpc:"2.0",method:api+"."+method,params:this.legacySerializeParams(params)},method=core.callRaw?await core.callRaw(api,this.callOptions()):await this.callViaResultMode(core,api),params=(0,rpc_transport_1.validateRpcResponse)(method);if(this.syncCurrentAddress(core),params.error)throw(0,errors_1.rpcErrorFromResponse)(params.error);return assert.strictEqual(params.id,api.id,"got invalid response id"),params.result}async callViaResultMode(core,request){if(core.call)return core=await core.call(request.method,request.params,{...this.callOptions(),id:request.id}),{id:request.id,result:core};throw new Error("blurt-rpc-core client must expose callRaw or call")}callOptions(){var options={retry:{backoff:{delayMs:attempt=>this.config.backoff(attempt)},maxAttempts:0===this.config.failoverThreshold?Number.MAX_SAFE_INTEGER:this.config.failoverThreshold}};return 0<this.config.timeout&&(options.timeoutMs=this.config.timeout),options}async getCoreClient(){if(this.config.coreClient)return this.config.coreClient;if(!this.loadedCoreClient){var core=this.config.coreModule||await this.loadCoreModule(),options=this.coreOptions();if(core.createRpcClient)this.loadedCoreClient=core.createRpcClient(this.config.address,options);else{if(!core.RpcClient)throw new Error("blurt-rpc-core module must expose createRpcClient or RpcClient");this.loadedCoreClient=new core.RpcClient(this.config.address,options)}}return this.loadedCoreClient}coreOptions(){var headers={Accept:"application/json, text/plain, */*","Content-Type":"application/json"};return"undefined"==typeof self&&(headers["User-Agent"]=this.config.options.userAgent||"dblurt/"+version_1.default),{backoff:{delayMs:attempt=>this.config.backoff(attempt)},headers:headers,maxRetries:0===this.config.failoverThreshold?Number.MAX_SAFE_INTEGER:Math.max(0,this.config.failoverThreshold-1),strategy:this.config.nodeSelectionStrategy||this.legacyStickyStrategy(),...0<this.config.timeout?{timeoutMs:this.config.timeout}:{}}}legacyStickyStrategy(){let currentKey,endpointKey=state=>state.endpoint.id||String(state.endpoint.url);return{name:"dblurt-legacy-sticky",onFailure:state=>{currentKey&&endpointKey(state)===currentKey&&(currentKey=void 0)},select:states=>{states=states.filter(state=>!1!==state.endpoint.enabled&&"disabled"!==state.status);if(currentKey){var current=states.find(state=>endpointKey(state)===currentKey);if(current&&0===current.consecutiveFailures)return current}current=states.find(state=>0===state.consecutiveFailures)||states[0];return currentKey=current?endpointKey(current):void 0,current}}}legacySerializeParams(params){return JSON.parse(JSON.stringify(params,(_key,value)=>value&&"object"==typeof value&&"Buffer"===value.type&&Array.isArray(value.data)?Buffer.from(value.data).toString("hex"):value))}async loadCoreModule(){return import("@beblurt/blurt-rpc-core")}syncCurrentAddress(core){core=core.getCurrentEndpoint?.(),core=core&&core.endpoint&&core.endpoint.url;"string"==typeof core?this.currentAddress=core:core&&"function"==typeof core.toString&&(this.currentAddress=core.toString())}}}.call(this)}.call(this,_dereq_("buffer").Buffer)},{"../errors":19,"../version":37,"./rpc_transport":35,assert:47,buffer:55}],34:[function(_dereq_,module,exports){!function(Buffer){!function(){var __createBinding=this&&this.__createBinding||(Object.create?function(o,m,k,k2){void 0===k2&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);desc&&("get"in desc?m.__esModule:!desc.writable&&!desc.configurable)||(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){o[k2=void 0===k2?k:k2]=m[k]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=this&&this.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(null!=mod)for(var k in mod)"default"!==k&&Object.prototype.hasOwnProperty.call(mod,k)&&__createBinding(result,mod,k);return __setModuleDefault(result,mod),result},__importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.LegacyRpcTransport=void 0;let assert=__importStar(_dereq_("assert")),version_1=__importDefault(_dereq_("../version")),errors_1=_dereq_("../errors"),utils_1=_dereq_("../utils"),rpc_transport_1=_dereq_("./rpc_transport");exports.LegacyRpcTransport=class{constructor(config){this.config=config,this.currentAddress=config.currentAddress}getCurrentAddress(){return this.currentAddress}async call(api,method,params=[]){var params={id:0,jsonrpc:"2.0",method:api+"."+method,params:params},opts={body:JSON.stringify(params,(key,value)=>key&&value&&"object"==typeof value&&"Buffer"===value.type?Buffer.from(value.data).toString("hex"):value),cache:"no-cache",headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json"},method:"POST",mode:"cors"};"undefined"==typeof self&&(opts.headers["User-Agent"]=this.config.options.userAgent||"dblurt/"+version_1.default);let fetchTimeout;"network_broadcast_api"===api||method.startsWith("broadcast_transaction")||(fetchTimeout=tries=>500*(tries+1));var{response:api,currentAddress:method}=await(0,utils_1.retryingFetch)(this.currentAddress,this.config.address,opts,this.config.timeout,this.config.failoverThreshold,this.config.consoleOnFailover,this.config.backoff,fetchTimeout),opts=(0,rpc_transport_1.validateRpcResponse)(api);if(method!==this.currentAddress&&(this.currentAddress=method),opts.error)throw(0,errors_1.rpcErrorFromResponse)(opts.error);return assert.strictEqual(opts.id,params.id,"got invalid response id"),opts.result}}}.call(this)}.call(this,_dereq_("buffer").Buffer)},{"../errors":19,"../utils":36,"../version":37,"./rpc_transport":35,assert:47,buffer:55}],35:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.validateRpcResponse=void 0;let errors_1=_dereq_("../errors");exports.validateRpcResponse=response=>{if(!response||"object"!=typeof response||Array.isArray(response))throw new errors_1.ValidationError("Malformed JSON-RPC response: expected object");if("error"in response&&void 0!==response.error&&(null===response.error||"object"!=typeof response.error||Array.isArray(response.error)))throw new errors_1.ValidationError("Malformed JSON-RPC response: error must be an object");if("result"in response||"error"in response)return response;throw new errors_1.ValidationError("Malformed JSON-RPC response: missing result or error")}},{"../errors":19}],36:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.retryingFetch=exports.copy=exports.iteratorStream=exports.sleep=exports.waitForEvent=exports.makeBitwiseFilter=exports.makeBitMaskFilter=exports.virtualOps=exports.operationOrders=void 0;let stream_1=_dereq_("stream"),JSBI=_dereq_("jsbi"),redFunction=(exports.operationOrders={vote:0,comment:1,transfer:2,transfer_to_vesting:3,withdraw_vesting:4,account_create:5,account_update:6,witness_update:7,account_witness_vote:8,account_witness_proxy:9,custom:10,delete_comment:11,custom_json:12,comment_options:13,set_withdraw_vesting_route:14,claim_account:15,create_claimed_account:16,request_account_recovery:17,recover_account:18,change_recovery_account:19,escrow_transfer:20,escrow_dispute:21,escrow_release:22,escrow_approve:23,transfer_to_savings:24,transfer_from_savings:25,cancel_transfer_from_savings:26,custom_binary:27,decline_voting_rights:28,reset_account:29,set_reset_account:30,claim_reward_balance:31,delegate_vesting_shares:32,witness_set_properties:33,create_proposal:34,update_proposal_votes:35,remove_proposal:36,author_reward:37,curation_reward:38,comment_reward:39,fill_vesting_withdraw:40,shutdown_witness:41,fill_transfer_from_savings:42,hardfork:43,comment_payout_update:44,return_vesting_delegation:45,comment_benefactor_reward:46,producer_reward:47,clear_null_account_balance:48,proposal_pay:49,sps_fund:50,fee_pay:51},exports.virtualOps={author_reward:0,curation_reward:1,comment_reward:2,fill_vesting_withdraw:3,shutdown_witness:4,fill_transfer_from_savings:5,hardfork:6,comment_payout_update:7,return_vesting_delegation:8,comment_benefactor_reward:9,producer_reward:10,clear_null_account_balance:11,proposal_pay:12,sps_fund:13,fee_pay:14},([low,high],allowedOperation)=>allowedOperation<64?[JSBI.bitwiseOr(low,JSBI.leftShift(JSBI.BigInt(1),JSBI.BigInt(allowedOperation))),high]:[low,JSBI.bitwiseOr(high,JSBI.leftShift(JSBI.BigInt(1),JSBI.BigInt(allowedOperation-64)))]),timeoutErrors=(exports.makeBitMaskFilter=allowedOperations=>allowedOperations.reduce(redFunction,[JSBI.BigInt(0),JSBI.BigInt(0)]).map(value=>JSBI.notEqual(value,JSBI.BigInt(0))?parseInt(value.toString(),10):null),exports.makeBitwiseFilter=allowedOperations=>{var[allowedOperations,high]=allowedOperations.reduce(redFunction,[JSBI.BigInt(0),JSBI.BigInt(0)]),allowedOperations=JSBI.bitwiseOr(allowedOperations,high);return JSBI.notEqual(allowedOperations,JSBI.BigInt(0))?parseInt(allowedOperations.toString(),10):0},["timeout","ENOTFOUND","ECONNREFUSED","database lock","CERT_HAS_EXPIRED","EHOSTUNREACH"]),getErrorCode=error=>error&&"string"==typeof error.code?error.code:void 0,getErrorName=error=>error&&"string"==typeof error.name?error.name:void 0;exports.waitForEvent=(emitter,eventName)=>new Promise(resolve=>{emitter.once(eventName,resolve)}),exports.sleep=ms=>new Promise(resolve=>{setTimeout(resolve,ms)}),exports.iteratorStream=iterator=>{let stream=new stream_1.PassThrough({objectMode:!0});return(async()=>{for await(var item of iterator)stream.write(item)||await(0,exports.waitForEvent)(stream,"drain")})().then(()=>{stream.end()}).catch(error=>{stream.emit("error",error),stream.end()}),stream},exports.copy=object=>JSON.parse(JSON.stringify(object));exports.retryingFetch=async(currentAddress,allAddresses,opts,timeout,failoverThreshold,consoleOnFailover,backoff,fetchTimeout)=>{let start=Date.now(),tries=0,round=0;for(;;)try{let abort=(timeout=>{if(!timeout||timeout<=0||"undefined"==typeof AbortController)return{cancel:()=>{}};let controller=new AbortController,timer=setTimeout(()=>{controller.abort()},timeout);return{cancel:()=>{clearTimeout(timer)},signal:controller.signal}})(fetchTimeout?fetchTimeout(tries):void 0),fetchOptions=abort.signal?{...opts,signal:abort.signal}:opts,response;try{response=await(()=>{if("function"!=typeof fetch)throw new Error("dblurt requires a runtime with native fetch support (Node.js >=18 or a modern browser)");return fetch})()(currentAddress,fetchOptions)}finally{abort.cancel()}if(response.ok)return{response:await response.json(),currentAddress:currentAddress};throw new Error(`HTTP ${response.status}: `+response.statusText)}catch(error){if(0!==timeout&&Date.now()-start>timeout){if(error&&error.code||!Array.isArray(allAddresses)){if(!((error=>{let code=getErrorCode(error);return(error=>"AbortError"===getErrorName(error)||"ABORT_ERR"===getErrorCode(error))(error)||timeoutErrors.some(fe=>!!code&&code.includes(fe))})(error)&&Array.isArray(allAddresses)&&1<allAddresses.length))throw(error=>{getErrorCode(error)||error&&error.message})(error),error;if(!(round<failoverThreshold))throw((error,message)=>{try{error.message=message}catch(_error){}})(error,`[${getErrorCode(error)||getErrorName(error)||error&&error.message}] tried ${failoverThreshold} times with `+allAddresses.join(",")),error;start=Date.now(),tries=-1,0<failoverThreshold&&round++}url=currentAddress,index=void 0,index=(urls=allAddresses).indexOf(url),currentAddress=(urls.length===index+1?urls[0]:urls[index+1])||url}await(0,exports.sleep)(backoff(tries++))}var url,urls,index}},{jsbi:61,stream:65}],37:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default="0.17.0"},{}],38:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.SHA512_IV=exports.SHA384_IV=exports.SHA224_IV=exports.SHA256_IV=exports.HashMD=void 0,exports.setBigUint64=setBigUint64,exports.Chi=function(a,b,c){return a&b^~a&c},exports.Maj=function(a,b,c){return a&b^a&c^b&c};let utils_ts_1=_dereq_("./utils.js");function setBigUint64(view,byteOffset,value,isLE){if("function"==typeof view.setBigUint64)return view.setBigUint64(byteOffset,value,isLE);var _32n=BigInt(32),_u32_max=BigInt(4294967295),_32n=Number(value>>_32n&_u32_max),value=Number(value&_u32_max),_u32_max=isLE?0:4;view.setUint32(byteOffset+(isLE?4:0),_32n,isLE),view.setUint32(byteOffset+_u32_max,value,isLE)}class HashMD extends utils_ts_1.Hash{constructor(blockLen,outputLen,padOffset,isLE){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=blockLen,this.outputLen=outputLen,this.padOffset=padOffset,this.isLE=isLE,this.buffer=new Uint8Array(blockLen),this.view=(0,utils_ts_1.createView)(this.buffer)}update(data){(0,utils_ts_1.aexists)(this),data=(0,utils_ts_1.toBytes)(data),(0,utils_ts_1.abytes)(data);var{view,buffer,blockLen}=this,len=data.length;for(let pos=0;pos<len;){var take=Math.min(blockLen-this.pos,len-pos);if(take===blockLen)for(var dataView=(0,utils_ts_1.createView)(data);blockLen<=len-pos;pos+=blockLen)this.process(dataView,pos);else buffer.set(data.subarray(pos,pos+take),this.pos),this.pos+=take,pos+=take,this.pos===blockLen&&(this.process(view,0),this.pos=0)}return this.length+=data.length,this.roundClean(),this}digestInto(out){(0,utils_ts_1.aexists)(this),(0,utils_ts_1.aoutput)(out,this),this.finished=!0;let{buffer,view,blockLen,isLE}=this,pos=this.pos;buffer[pos++]=128,(0,utils_ts_1.clean)(this.buffer.subarray(pos)),this.padOffset>blockLen-pos&&(this.process(view,0),pos=0);for(let i=pos;i<blockLen;i++)buffer[i]=0;setBigUint64(view,blockLen-8,BigInt(8*this.length),isLE),this.process(view,0);var oview=(0,utils_ts_1.createView)(out),out=this.outputLen;if(out%4)throw new Error("_sha2: outputLen should be aligned to 32bit");var outLen=out/4,state=this.get();if(outLen>state.length)throw new Error("_sha2: outputLen bigger than state");for(let i=0;i<outLen;i++)oview.setUint32(4*i,state[i],isLE)}digest(){var{buffer,outputLen}=this,buffer=(this.digestInto(buffer),buffer.slice(0,outputLen));return this.destroy(),buffer}_cloneInto(to){(to=to||new this.constructor).set(...this.get());var{blockLen,buffer,length,finished,destroyed,pos}=this;return to.destroyed=destroyed,to.finished=finished,to.length=length,to.pos=pos,length%blockLen&&to.buffer.set(buffer),to}clone(){return this._cloneInto()}}exports.HashMD=HashMD,exports.SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),exports.SHA224_IV=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),exports.SHA384_IV=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),exports.SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209])},{"./utils.js":44}],39:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.toBig=exports.shrSL=exports.shrSH=exports.rotrSL=exports.rotrSH=exports.rotrBL=exports.rotrBH=exports.rotr32L=exports.rotr32H=exports.rotlSL=exports.rotlSH=exports.rotlBL=exports.rotlBH=exports.add5L=exports.add5H=exports.add4L=exports.add4H=exports.add3L=exports.add3H=void 0,exports.add=add,exports.fromBig=fromBig,exports.split=split;let U32_MASK64=BigInt(2**32-1),_32n=BigInt(32);function fromBig(n,le=!1){return le?{h:Number(n&U32_MASK64),l:Number(n>>_32n&U32_MASK64)}:{h:0|Number(n>>_32n&U32_MASK64),l:0|Number(n&U32_MASK64)}}function split(lst,le=!1){var len=lst.length,Ah=new Uint32Array(len),Al=new Uint32Array(len);for(let i=0;i<len;i++){var{h,l}=fromBig(lst[i],le);[Ah[i],Al[i]]=[h,l]}return[Ah,Al]}var toBig=(h,l)=>BigInt(h>>>0)<<_32n|BigInt(l>>>0),shrSH=(exports.toBig=toBig,(h,_l,s)=>h>>>s),shrSL=(exports.shrSH=shrSH,(h,l,s)=>h<<32-s|l>>>s),rotrSH=(exports.shrSL=shrSL,(h,l,s)=>h>>>s|l<<32-s),rotrSL=(exports.rotrSH=rotrSH,(h,l,s)=>h<<32-s|l>>>s),rotrBH=(exports.rotrSL=rotrSL,(h,l,s)=>h<<64-s|l>>>s-32),rotrBL=(exports.rotrBH=rotrBH,(h,l,s)=>h>>>s-32|l<<64-s),rotr32H=(exports.rotrBL=rotrBL,(_h,l)=>l),rotr32L=(exports.rotr32H=rotr32H,(h,_l)=>h),rotlSH=(exports.rotr32L=rotr32L,(h,l,s)=>h<<s|l>>>32-s),rotlSL=(exports.rotlSH=rotlSH,(h,l,s)=>l<<s|h>>>32-s),rotlBH=(exports.rotlSL=rotlSL,(h,l,s)=>l<<s-32|h>>>64-s),rotlBL=(exports.rotlBH=rotlBH,(h,l,s)=>h<<s-32|l>>>64-s);function add(Ah,Al,Bh,Bl){Al=(Al>>>0)+(Bl>>>0);return{h:Ah+Bh+(Al/2**32|0)|0,l:0|Al}}exports.rotlBL=rotlBL;var add3L=(Al,Bl,Cl)=>(Al>>>0)+(Bl>>>0)+(Cl>>>0),add3H=(exports.add3L=add3L,(low,Ah,Bh,Ch)=>Ah+Bh+Ch+(low/2**32|0)|0),add4L=(exports.add3H=add3H,(Al,Bl,Cl,Dl)=>(Al>>>0)+(Bl>>>0)+(Cl>>>0)+(Dl>>>0)),add4H=(exports.add4L=add4L,(low,Ah,Bh,Ch,Dh)=>Ah+Bh+Ch+Dh+(low/2**32|0)|0),add5L=(exports.add4H=add4H,(Al,Bl,Cl,Dl,El)=>(Al>>>0)+(Bl>>>0)+(Cl>>>0)+(Dl>>>0)+(El>>>0)),toBig=(exports.add5L=add5L,{fromBig:fromBig,split:split,toBig:toBig,shrSH:shrSH,shrSL:shrSL,rotrSH:rotrSH,rotrSL:rotrSL,rotrBH:rotrBH,rotrBL:rotrBL,rotr32H:rotr32H,rotr32L:rotr32L,rotlSH:rotlSH,rotlSL:rotlSL,rotlBH:rotlBH,rotlBL:rotlBL,add:add,add3L:add3L,add3H:add3H,add4L:add4L,add4H:add4H,add5H:exports.add5H=(low,Ah,Bh,Ch,Dh,Eh)=>Ah+Bh+Ch+Dh+Eh+(low/2**32|0)|0,add5L:add5L});exports.default=toBig},{}],40:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.crypto=void 0,exports.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},{}],41:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.hmac=exports.HMAC=void 0;let utils_ts_1=_dereq_("./utils.js");class HMAC extends utils_ts_1.Hash{constructor(hash,_key){super(),this.finished=!1,(this.destroyed=!1,utils_ts_1.ahash)(hash);_key=(0,utils_ts_1.toBytes)(_key);if(this.iHash=hash.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;var blockLen=this.blockLen,pad=new Uint8Array(blockLen);pad.set(_key.length>blockLen?hash.create().update(_key).digest():_key);for(let i=0;i<pad.length;i++)pad[i]^=54;this.iHash.update(pad),this.oHash=hash.create();for(let i=0;i<pad.length;i++)pad[i]^=106;this.oHash.update(pad),(0,utils_ts_1.clean)(pad)}update(buf){return(0,utils_ts_1.aexists)(this),this.iHash.update(buf),this}digestInto(out){(0,utils_ts_1.aexists)(this),(0,utils_ts_1.abytes)(out,this.outputLen),this.finished=!0,this.iHash.digestInto(out),this.oHash.update(out),this.oHash.digestInto(out),this.destroy()}digest(){var out=new Uint8Array(this.oHash.outputLen);return this.digestInto(out),out}_cloneInto(to){var{oHash,iHash,finished,destroyed,blockLen,outputLen}=this;return(to=to||Object.create(Object.getPrototypeOf(this),{})).finished=finished,to.destroyed=destroyed,to.blockLen=blockLen,to.outputLen=outputLen,to.oHash=oHash._cloneInto(to.oHash),to.iHash=iHash._cloneInto(to.iHash),to}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}exports.HMAC=HMAC,exports.hmac=(hash,key,message)=>new HMAC(hash,key).update(message).digest(),exports.hmac.create=(hash,key)=>new HMAC(hash,key)},{"./utils.js":44}],42:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.ripemd160=exports.RIPEMD160=exports.md5=exports.MD5=exports.sha1=exports.SHA1=void 0;let _md_ts_1=_dereq_("./_md.js"),utils_ts_1=_dereq_("./utils.js"),SHA1_IV=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),SHA1_W=new Uint32Array(80);class SHA1 extends _md_ts_1.HashMD{constructor(){super(64,20,8,!1),this.A=0|SHA1_IV[0],this.B=0|SHA1_IV[1],this.C=0|SHA1_IV[2],this.D=0|SHA1_IV[3],this.E=0|SHA1_IV[4]}get(){var{A,B,C,D,E}=this;return[A,B,C,D,E]}set(A,B,C,D,E){this.A=0|A,this.B=0|B,this.C=0|C,this.D=0|D,this.E=0|E}process(view,offset){for(let i=0;i<16;i++,offset+=4)SHA1_W[i]=view.getUint32(offset,!1);for(let i=16;i<80;i++)SHA1_W[i]=(0,utils_ts_1.rotl)(SHA1_W[i-3]^SHA1_W[i-8]^SHA1_W[i-14]^SHA1_W[i-16],1);let{A,B,C,D,E}=this;for(let i=0;i<80;i++){let F,K;K=i<20?(F=(0,_md_ts_1.Chi)(B,C,D),1518500249):i<40?(F=B^C^D,1859775393):i<60?(F=(0,_md_ts_1.Maj)(B,C,D),2400959708):(F=B^C^D,3395469782);var T=(0,utils_ts_1.rotl)(A,5)+F+E+K+SHA1_W[i]|0;E=D,D=C,C=(0,utils_ts_1.rotl)(B,30),B=A,A=T}A=A+this.A|0,B=B+this.B|0,C=C+this.C|0,D=D+this.D|0,E=E+this.E|0,this.set(A,B,C,D,E)}roundClean(){(0,utils_ts_1.clean)(SHA1_W)}destroy(){this.set(0,0,0,0,0),(0,utils_ts_1.clean)(this.buffer)}}exports.SHA1=SHA1,exports.sha1=(0,utils_ts_1.createHasher)(()=>new SHA1);let p32=Math.pow(2,32),K=Array.from({length:64},(_,i)=>Math.floor(p32*Math.abs(Math.sin(i+1)))),MD5_IV=SHA1_IV.slice(0,4),MD5_W=new Uint32Array(16);class MD5 extends _md_ts_1.HashMD{constructor(){super(64,16,8,!0),this.A=0|MD5_IV[0],this.B=0|MD5_IV[1],this.C=0|MD5_IV[2],this.D=0|MD5_IV[3]}get(){var{A,B,C,D}=this;return[A,B,C,D]}set(A,B,C,D){this.A=0|A,this.B=0|B,this.C=0|C,this.D=0|D}process(view,offset){for(let i=0;i<16;i++,offset+=4)MD5_W[i]=view.getUint32(offset,!0);let{A,B,C,D}=this;for(let i=0;i<64;i++){let F,g,s;s=i<16?(F=(0,_md_ts_1.Chi)(B,C,D),g=i,[7,12,17,22]):i<32?(F=(0,_md_ts_1.Chi)(D,B,C),g=(5*i+1)%16,[5,9,14,20]):i<48?(F=B^C^D,g=(3*i+5)%16,[4,11,16,23]):(F=C^(B|~D),g=7*i%16,[6,10,15,21]),F=F+A+K[i]+MD5_W[g],A=D,D=C,C=B,B+=(0,utils_ts_1.rotl)(F,s[i%4])}A=A+this.A|0,B=B+this.B|0,C=C+this.C|0,D=D+this.D|0,this.set(A,B,C,D)}roundClean(){(0,utils_ts_1.clean)(MD5_W)}destroy(){this.set(0,0,0,0),(0,utils_ts_1.clean)(this.buffer)}}exports.MD5=MD5,exports.md5=(0,utils_ts_1.createHasher)(()=>new MD5);let Rho160=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Id160=(()=>Uint8Array.from(new Array(16).fill(0).map((_,i)=>i)))(),Pi160=(()=>Id160.map(i=>(9*i+5)%16))(),idxLR=(()=>{var res=[[Id160],[Pi160]];for(let i=0;i<4;i++)for(var j of res)j.push(j[i].map(k=>Rho160[k]));return res})(),idxL=(()=>idxLR[0])(),idxR=(()=>idxLR[1])(),shifts160=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(i=>Uint8Array.from(i)),shiftsL160=idxL.map((idx,i)=>idx.map(j=>shifts160[i][j])),shiftsR160=idxR.map((idx,i)=>idx.map(j=>shifts160[i][j])),Kl160=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),Kr160=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function ripemd_f(group,x,y,z){return 0===group?x^y^z:1===group?x&y|~x&z:2===group?(x|~y)^z:3===group?x&z|y&~z:x^(y|~z)}let BUF_160=new Uint32Array(16);class RIPEMD160 extends _md_ts_1.HashMD{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){var{h0,h1,h2,h3,h4}=this;return[h0,h1,h2,h3,h4]}set(h0,h1,h2,h3,h4){this.h0=0|h0,this.h1=0|h1,this.h2=0|h2,this.h3=0|h3,this.h4=0|h4}process(view,offset){for(let i=0;i<16;i++,offset+=4)BUF_160[i]=view.getUint32(offset,!0);let al=0|this.h0,ar=al,bl=0|this.h1,br=bl,cl=0|this.h2,cr=cl,dl=0|this.h3,dr=dl,el=0|this.h4,er=el;for(let group=0;group<5;group++){var rGroup=4-group,hbl=Kl160[group],hbr=Kr160[group],rl=idxL[group],rr=idxR[group],sl=shiftsL160[group],sr=shiftsR160[group];for(let i=0;i<16;i++){var tl=(0,utils_ts_1.rotl)(al+ripemd_f(group,bl,cl,dl)+BUF_160[rl[i]]+hbl,sl[i])+el|0;al=el,el=dl,dl=0|(0,utils_ts_1.rotl)(cl,10),cl=bl,bl=tl}for(let i=0;i<16;i++){var tr=(0,utils_ts_1.rotl)(ar+ripemd_f(rGroup,br,cr,dr)+BUF_160[rr[i]]+hbr,sr[i])+er|0;ar=er,er=dr,dr=0|(0,utils_ts_1.rotl)(cr,10),cr=br,br=tr}}this.set(this.h1+cl+dr|0,this.h2+dl+er|0,this.h3+el+ar|0,this.h4+al+br|0,this.h0+bl+cr|0)}roundClean(){(0,utils_ts_1.clean)(BUF_160)}destroy(){this.destroyed=!0,(0,utils_ts_1.clean)(this.buffer),this.set(0,0,0,0,0)}}exports.RIPEMD160=RIPEMD160,exports.ripemd160=(0,utils_ts_1.createHasher)(()=>new RIPEMD160)},{"./_md.js":38,"./utils.js":44}],43:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.sha512_224=exports.sha512_256=exports.sha384=exports.sha512=exports.sha224=exports.sha256=exports.SHA512_256=exports.SHA512_224=exports.SHA384=exports.SHA512=exports.SHA224=exports.SHA256=void 0;let _md_ts_1=_dereq_("./_md.js"),u64=_dereq_("./_u64.js"),utils_ts_1=_dereq_("./utils.js"),SHA256_K=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),SHA256_W=new Uint32Array(64);class SHA256 extends _md_ts_1.HashMD{constructor(outputLen=32){super(64,outputLen,8,!1),this.A=0|_md_ts_1.SHA256_IV[0],this.B=0|_md_ts_1.SHA256_IV[1],this.C=0|_md_ts_1.SHA256_IV[2],this.D=0|_md_ts_1.SHA256_IV[3],this.E=0|_md_ts_1.SHA256_IV[4],this.F=0|_md_ts_1.SHA256_IV[5],this.G=0|_md_ts_1.SHA256_IV[6],this.H=0|_md_ts_1.SHA256_IV[7]}get(){var{A,B,C,D,E,F,G,H}=this;return[A,B,C,D,E,F,G,H]}set(A,B,C,D,E,F,G,H){this.A=0|A,this.B=0|B,this.C=0|C,this.D=0|D,this.E=0|E,this.F=0|F,this.G=0|G,this.H=0|H}process(view,offset){for(let i=0;i<16;i++,offset+=4)SHA256_W[i]=view.getUint32(offset,!1);for(let i=16;i<64;i++){var W15=SHA256_W[i-15],W2=SHA256_W[i-2],W15=(0,utils_ts_1.rotr)(W15,7)^(0,utils_ts_1.rotr)(W15,18)^W15>>>3,W2=(0,utils_ts_1.rotr)(W2,17)^(0,utils_ts_1.rotr)(W2,19)^W2>>>10;SHA256_W[i]=W2+SHA256_W[i-7]+W15+SHA256_W[i-16]|0}let{A,B,C,D,E,F,G,H}=this;for(let i=0;i<64;i++){var sigma1=(0,utils_ts_1.rotr)(E,6)^(0,utils_ts_1.rotr)(E,11)^(0,utils_ts_1.rotr)(E,25),sigma1=H+sigma1+(0,_md_ts_1.Chi)(E,F,G)+SHA256_K[i]+SHA256_W[i]|0,T2=((0,utils_ts_1.rotr)(A,2)^(0,utils_ts_1.rotr)(A,13)^(0,utils_ts_1.rotr)(A,22))+(0,_md_ts_1.Maj)(A,B,C)|0;H=G,G=F,F=E,E=D+sigma1|0,D=C,C=B,B=A,A=sigma1+T2|0}A=A+this.A|0,B=B+this.B|0,C=C+this.C|0,D=D+this.D|0,E=E+this.E|0,F=F+this.F|0,G=G+this.G|0,H=H+this.H|0,this.set(A,B,C,D,E,F,G,H)}roundClean(){(0,utils_ts_1.clean)(SHA256_W)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,utils_ts_1.clean)(this.buffer)}}exports.SHA256=SHA256;class SHA224 extends SHA256{constructor(){super(28),this.A=0|_md_ts_1.SHA224_IV[0],this.B=0|_md_ts_1.SHA224_IV[1],this.C=0|_md_ts_1.SHA224_IV[2],this.D=0|_md_ts_1.SHA224_IV[3],this.E=0|_md_ts_1.SHA224_IV[4],this.F=0|_md_ts_1.SHA224_IV[5],this.G=0|_md_ts_1.SHA224_IV[6],this.H=0|_md_ts_1.SHA224_IV[7]}}exports.SHA224=SHA224;let K512=(()=>u64.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))))(),SHA512_Kh=(()=>K512[0])(),SHA512_Kl=(()=>K512[1])(),SHA512_W_H=new Uint32Array(80),SHA512_W_L=new Uint32Array(80);class SHA512 extends _md_ts_1.HashMD{constructor(outputLen=64){super(128,outputLen,16,!1),this.Ah=0|_md_ts_1.SHA512_IV[0],this.Al=0|_md_ts_1.SHA512_IV[1],this.Bh=0|_md_ts_1.SHA512_IV[2],this.Bl=0|_md_ts_1.SHA512_IV[3],this.Ch=0|_md_ts_1.SHA512_IV[4],this.Cl=0|_md_ts_1.SHA512_IV[5],this.Dh=0|_md_ts_1.SHA512_IV[6],this.Dl=0|_md_ts_1.SHA512_IV[7],this.Eh=0|_md_ts_1.SHA512_IV[8],this.El=0|_md_ts_1.SHA512_IV[9],this.Fh=0|_md_ts_1.SHA512_IV[10],this.Fl=0|_md_ts_1.SHA512_IV[11],this.Gh=0|_md_ts_1.SHA512_IV[12],this.Gl=0|_md_ts_1.SHA512_IV[13],this.Hh=0|_md_ts_1.SHA512_IV[14],this.Hl=0|_md_ts_1.SHA512_IV[15]}get(){var{Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl}=this;return[Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl]}set(Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl){this.Ah=0|Ah,this.Al=0|Al,this.Bh=0|Bh,this.Bl=0|Bl,this.Ch=0|Ch,this.Cl=0|Cl,this.Dh=0|Dh,this.Dl=0|Dl,this.Eh=0|Eh,this.El=0|El,this.Fh=0|Fh,this.Fl=0|Fl,this.Gh=0|Gh,this.Gl=0|Gl,this.Hh=0|Hh,this.Hl=0|Hl}process(view,offset){for(let i=0;i<16;i++,offset+=4)SHA512_W_H[i]=view.getUint32(offset),SHA512_W_L[i]=view.getUint32(offset+=4);for(let i=16;i<80;i++){var W15h=0|SHA512_W_H[i-15],W15l=0|SHA512_W_L[i-15],s0h=u64.rotrSH(W15h,W15l,1)^u64.rotrSH(W15h,W15l,8)^u64.shrSH(W15h,W15l,7),W15h=u64.rotrSL(W15h,W15l,1)^u64.rotrSL(W15h,W15l,8)^u64.shrSL(W15h,W15l,7),W15l=0|SHA512_W_H[i-2],W2l=0|SHA512_W_L[i-2],s1h=u64.rotrSH(W15l,W2l,19)^u64.rotrBH(W15l,W2l,61)^u64.shrSH(W15l,W2l,6),W15l=u64.rotrSL(W15l,W2l,19)^u64.rotrBL(W15l,W2l,61)^u64.shrSL(W15l,W2l,6),W2l=u64.add4L(W15h,W15l,SHA512_W_L[i-7],SHA512_W_L[i-16]),W15h=u64.add4H(W2l,s0h,s1h,SHA512_W_H[i-7],SHA512_W_H[i-16]);SHA512_W_H[i]=0|W15h,SHA512_W_L[i]=0|W2l}let{Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl}=this;for(let i=0;i<80;i++){var sigma1h=u64.rotrSH(Eh,El,14)^u64.rotrSH(Eh,El,18)^u64.rotrBH(Eh,El,41),sigma1l=u64.rotrSL(Eh,El,14)^u64.rotrSL(Eh,El,18)^u64.rotrBL(Eh,El,41),CHIh=Eh&Fh^~Eh&Gh,CHIl=El&Fl^~El&Gl,sigma1l=u64.add5L(Hl,sigma1l,CHIl,SHA512_Kl[i],SHA512_W_L[i]),CHIl=u64.add5H(sigma1l,Hh,sigma1h,CHIh,SHA512_Kh[i],SHA512_W_H[i]),sigma1h=0|sigma1l,CHIh=u64.rotrSH(Ah,Al,28)^u64.rotrBH(Ah,Al,34)^u64.rotrBH(Ah,Al,39),sigma1l=u64.rotrSL(Ah,Al,28)^u64.rotrBL(Ah,Al,34)^u64.rotrBL(Ah,Al,39),MAJh=Ah&Bh^Ah&Ch^Bh&Ch,MAJl=Al&Bl^Al&Cl^Bl&Cl,sigma1h=(Hh=0|Gh,Hl=0|Gl,Gh=0|Fh,Gl=0|Fl,Fh=0|Eh,Fl=0|El,{h:Eh,l:El}=u64.add(0|Dh,0|Dl,0|CHIl,0|sigma1h),Dh=0|Ch,Dl=0|Cl,Ch=0|Bh,Cl=0|Bl,Bh=0|Ah,Bl=0|Al,u64.add3L(sigma1h,sigma1l,MAJl));Ah=u64.add3H(sigma1h,CHIl,CHIh,MAJh),Al=0|sigma1h}({h:Ah,l:Al}=u64.add(0|this.Ah,0|this.Al,0|Ah,0|Al)),{h:Bh,l:Bl}=u64.add(0|this.Bh,0|this.Bl,0|Bh,0|Bl),{h:Ch,l:Cl}=u64.add(0|this.Ch,0|this.Cl,0|Ch,0|Cl),{h:Dh,l:Dl}=u64.add(0|this.Dh,0|this.Dl,0|Dh,0|Dl),{h:Eh,l:El}=u64.add(0|this.Eh,0|this.El,0|Eh,0|El),{h:Fh,l:Fl}=u64.add(0|this.Fh,0|this.Fl,0|Fh,0|Fl),{h:Gh,l:Gl}=u64.add(0|this.Gh,0|this.Gl,0|Gh,0|Gl),{h:Hh,l:Hl}=u64.add(0|this.Hh,0|this.Hl,0|Hh,0|Hl),this.set(Ah,Al,Bh,Bl,Ch,Cl,Dh,Dl,Eh,El,Fh,Fl,Gh,Gl,Hh,Hl)}roundClean(){(0,utils_ts_1.clean)(SHA512_W_H,SHA512_W_L)}destroy(){(0,utils_ts_1.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}exports.SHA512=SHA512;class SHA384 extends SHA512{constructor(){super(48),this.Ah=0|_md_ts_1.SHA384_IV[0],this.Al=0|_md_ts_1.SHA384_IV[1],this.Bh=0|_md_ts_1.SHA384_IV[2],this.Bl=0|_md_ts_1.SHA384_IV[3],this.Ch=0|_md_ts_1.SHA384_IV[4],this.Cl=0|_md_ts_1.SHA384_IV[5],this.Dh=0|_md_ts_1.SHA384_IV[6],this.Dl=0|_md_ts_1.SHA384_IV[7],this.Eh=0|_md_ts_1.SHA384_IV[8],this.El=0|_md_ts_1.SHA384_IV[9],this.Fh=0|_md_ts_1.SHA384_IV[10],this.Fl=0|_md_ts_1.SHA384_IV[11],this.Gh=0|_md_ts_1.SHA384_IV[12],this.Gl=0|_md_ts_1.SHA384_IV[13],this.Hh=0|_md_ts_1.SHA384_IV[14],this.Hl=0|_md_ts_1.SHA384_IV[15]}}exports.SHA384=SHA384;let T224_IV=Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),T256_IV=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class SHA512_224 extends SHA512{constructor(){super(28),this.Ah=0|T224_IV[0],this.Al=0|T224_IV[1],this.Bh=0|T224_IV[2],this.Bl=0|T224_IV[3],this.Ch=0|T224_IV[4],this.Cl=0|T224_IV[5],this.Dh=0|T224_IV[6],this.Dl=0|T224_IV[7],this.Eh=0|T224_IV[8],this.El=0|T224_IV[9],this.Fh=0|T224_IV[10],this.Fl=0|T224_IV[11],this.Gh=0|T224_IV[12],this.Gl=0|T224_IV[13],this.Hh=0|T224_IV[14],this.Hl=0|T224_IV[15]}}exports.SHA512_224=SHA512_224;class SHA512_256 extends SHA512{constructor(){super(32),this.Ah=0|T256_IV[0],this.Al=0|T256_IV[1],this.Bh=0|T256_IV[2],this.Bl=0|T256_IV[3],this.Ch=0|T256_IV[4],this.Cl=0|T256_IV[5],this.Dh=0|T256_IV[6],this.Dl=0|T256_IV[7],this.Eh=0|T256_IV[8],this.El=0|T256_IV[9],this.Fh=0|T256_IV[10],this.Fl=0|T256_IV[11],this.Gh=0|T256_IV[12],this.Gl=0|T256_IV[13],this.Hh=0|T256_IV[14],this.Hl=0|T256_IV[15]}}exports.SHA512_256=SHA512_256,exports.sha256=(0,utils_ts_1.createHasher)(()=>new SHA256),exports.sha224=(0,utils_ts_1.createHasher)(()=>new SHA224),exports.sha512=(0,utils_ts_1.createHasher)(()=>new SHA512),exports.sha384=(0,utils_ts_1.createHasher)(()=>new SHA384),exports.sha512_256=(0,utils_ts_1.createHasher)(()=>new SHA512_256),exports.sha512_224=(0,utils_ts_1.createHasher)(()=>new SHA512_224)},{"./_md.js":38,"./_u64.js":39,"./utils.js":44}],44:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.wrapXOFConstructorWithOpts=exports.wrapConstructorWithOpts=exports.wrapConstructor=exports.Hash=exports.nextTick=exports.swap32IfBE=exports.byteSwapIfBE=exports.swap8IfBE=exports.isLE=void 0,exports.isBytes=isBytes,exports.anumber=anumber,exports.abytes=abytes,exports.ahash=function(h){if("function"!=typeof h||"function"!=typeof h.create)throw new Error("Hash should be wrapped by utils.createHasher");anumber(h.outputLen),anumber(h.blockLen)},exports.aexists=function(instance,checkFinished=!0){if(instance.destroyed)throw new Error("Hash instance has been destroyed");if(checkFinished&&instance.finished)throw new Error("Hash#digest() has already been called")},exports.aoutput=function(out,instance){abytes(out);instance=instance.outputLen;if(out.length<instance)throw new Error("digestInto() expects output buffer of length at least "+instance)},exports.u8=function(arr){return new Uint8Array(arr.buffer,arr.byteOffset,arr.byteLength)},exports.u32=function(arr){return new Uint32Array(arr.buffer,arr.byteOffset,Math.floor(arr.byteLength/4))},exports.clean=function(...arrays){for(let i=0;i<arrays.length;i++)arrays[i].fill(0)},exports.createView=function(arr){return new DataView(arr.buffer,arr.byteOffset,arr.byteLength)},exports.rotr=function(word,shift){return word<<32-shift|word>>>shift},exports.rotl=function(word,shift){return word<<shift|word>>>32-shift>>>0},exports.byteSwap=byteSwap,exports.byteSwap32=byteSwap32,exports.bytesToHex=function(bytes){if(abytes(bytes),hasHexBuiltin)return bytes.toHex();let hex="";for(let i=0;i<bytes.length;i++)hex+=hexes[bytes[i]];return hex},exports.hexToBytes=function(hex){if("string"!=typeof hex)throw new Error("hex string expected, got "+typeof hex);if(hasHexBuiltin)return Uint8Array.fromHex(hex);var hl=hex.length,al=hl/2;if(hl%2)throw new Error("hex string expected, got unpadded hex of length "+hl);var array=new Uint8Array(al);for(let ai=0,hi=0;ai<al;ai++,hi+=2){var char,n1=asciiToBase16(hex.charCodeAt(hi)),n2=asciiToBase16(hex.charCodeAt(hi+1));if(void 0===n1||void 0===n2)throw char=hex[hi]+hex[hi+1],new Error('hex string expected, got non-hex character "'+char+'" at index '+hi);array[ai]=16*n1+n2}return array},exports.asyncLoop=async function(iters,tick,cb){let ts=Date.now();for(let i=0;i<iters;i++){cb(i);var diff=Date.now()-ts;0<=diff&&diff<tick||(await(0,exports.nextTick)(),ts+=diff)}},exports.utf8ToBytes=utf8ToBytes,exports.bytesToUtf8=function(bytes){return(new TextDecoder).decode(bytes)},exports.toBytes=toBytes,exports.kdfInputToBytes=function(data){return abytes(data="string"==typeof data?utf8ToBytes(data):data),data},exports.concatBytes=function(...arrays){let sum=0;for(let i=0;i<arrays.length;i++)abytes(a=arrays[i]),sum+=a.length;var res=new Uint8Array(sum);for(let i=0,pad=0;i<arrays.length;i++){var a=arrays[i];res.set(a,pad),pad+=a.length}return res},exports.checkOpts=function(defaults,opts){if(void 0!==opts&&"[object Object]"!=={}.toString.call(opts))throw new Error("options should be object or undefined");return Object.assign(defaults,opts)},exports.createHasher=createHasher,exports.createOptHasher=createOptHasher,exports.createXOFer=createXOFer,exports.randomBytes=function(bytesLength=32){if(crypto_1.crypto&&"function"==typeof crypto_1.crypto.getRandomValues)return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));if(crypto_1.crypto&&"function"==typeof crypto_1.crypto.randomBytes)return Uint8Array.from(crypto_1.crypto.randomBytes(bytesLength));throw new Error("crypto.getRandomValues must be defined")};let crypto_1=_dereq_("@noble/hashes/crypto");function isBytes(a){return a instanceof Uint8Array||ArrayBuffer.isView(a)&&"Uint8Array"===a.constructor.name}function anumber(n){if(!Number.isSafeInteger(n)||n<0)throw new Error("positive integer expected, got "+n)}function abytes(b,...lengths){if(!isBytes(b))throw new Error("Uint8Array expected");if(0<lengths.length&&!lengths.includes(b.length))throw new Error("Uint8Array expected of length "+lengths+", got length="+b.length)}function byteSwap(word){return word<<24&4278190080|word<<8&16711680|word>>>8&65280|word>>>24&255}function byteSwap32(arr){for(let i=0;i<arr.length;i++)arr[i]=byteSwap(arr[i]);return arr}exports.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],exports.swap8IfBE=exports.isLE?n=>n:n=>byteSwap(n),exports.byteSwapIfBE=exports.swap8IfBE,exports.swap32IfBE=exports.isLE?u=>u:byteSwap32;let hasHexBuiltin=(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),hexes=Array.from({length:256},(_,i)=>i.toString(16).padStart(2,"0")),asciis={_0:48,_9:57,A:65,F:70,a:97,f:102};function asciiToBase16(ch){return ch>=asciis._0&&ch<=asciis._9?ch-asciis._0:ch>=asciis.A&&ch<=asciis.F?ch-(asciis.A-10):ch>=asciis.a&&ch<=asciis.f?ch-(asciis.a-10):void 0}function utf8ToBytes(str){if("string"!=typeof str)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(str))}function toBytes(data){return abytes(data="string"==typeof data?utf8ToBytes(data):data),data}function createHasher(hashCons){var hashC=msg=>hashCons().update(toBytes(msg)).digest(),tmp=hashCons();return hashC.outputLen=tmp.outputLen,hashC.blockLen=tmp.blockLen,hashC.create=()=>hashCons(),hashC}function createOptHasher(hashCons){var hashC=(msg,opts)=>hashCons(opts).update(toBytes(msg)).digest(),tmp=hashCons({});return hashC.outputLen=tmp.outputLen,hashC.blockLen=tmp.blockLen,hashC.create=opts=>hashCons(opts),hashC}function createXOFer(hashCons){var hashC=(msg,opts)=>hashCons(opts).update(toBytes(msg)).digest(),tmp=hashCons({});return hashC.outputLen=tmp.outputLen,hashC.blockLen=tmp.blockLen,hashC.create=opts=>hashCons(opts),hashC}exports.nextTick=async()=>{},exports.Hash=class{},exports.wrapConstructor=createHasher,exports.wrapConstructorWithOpts=createOptHasher,exports.wrapXOFConstructorWithOpts=createXOFer},{"@noble/hashes/crypto":40}],45:[function(_dereq_,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.utils=exports.schnorr=exports.verify=exports.signSync=exports.sign=exports.getSharedSecret=exports.recoverPublicKey=exports.getPublicKey=exports.Signature=exports.Point=exports.CURVE=void 0;let nodeCrypto=_dereq_("crypto"),_0n=BigInt(0),_1n=BigInt(1),_2n=BigInt(2),_3n=BigInt(3),_8n=BigInt(8),CURVE=Object.freeze({a:_0n,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:_1n,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")}),divNearest=(exports.CURVE=CURVE,(a,b)=>(a+b/_2n)/b),endo={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(k){let n=CURVE.n,a1=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),b1=-_1n*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),a2=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),b2=a1,POW_2_128=BigInt("0x100000000000000000000000000000000"),c1=divNearest(b2*k,n),c2=divNearest(-b1*k,n),k1=mod(k-c1*a1-c2*a2,n),k2=mod(-c1*b1-c2*b2,n),k1neg=k1>POW_2_128,k2neg=k2>POW_2_128;if(k1neg&&(k1=n-k1),k2neg&&(k2=n-k2),k1>POW_2_128||k2>POW_2_128)throw new Error("splitScalarEndo: Endomorphism failed, k="+k);return{k1neg:k1neg,k1:k1,k2neg:k2neg,k2:k2}}},fieldLen=32,groupLen=32,compressedLen=fieldLen+1,uncompressedLen=2*fieldLen+1;function weierstrass(x){var{a,b}=CURVE,x2=mod(x*x),x2=mod(x2*x);return mod(x2+a*x+b)}let USE_ENDOMORPHISM=CURVE.a===_0n;class ShaError extends Error{constructor(message){super(message)}}function assertJacPoint(other){if(!(other instanceof JacobianPoint))throw new TypeError("JacobianPoint expected")}class JacobianPoint{constructor(x,y,z){this.x=x,this.y=y,this.z=z}static fromAffine(p){if(p instanceof Point)return p.equals(Point.ZERO)?JacobianPoint.ZERO:new JacobianPoint(p.x,p.y,_1n);throw new TypeError("JacobianPoint#fromAffine: expected Point")}static toAffineBatch(points){let toInv=((nums,p=CURVE.P)=>{let scratch=new Array(nums.length),lastMultiplied=nums.reduce((acc,num,i)=>num===_0n?acc:mod((scratch[i]=acc)*num,p),_1n),inverted=invert(lastMultiplied,p);return nums.reduceRight((acc,num,i)=>num===_0n?acc:(scratch[i]=mod(acc*scratch[i],p),mod(acc*num,p)),inverted),scratch})(points.map(p=>p.z));return points.map((p,i)=>p.toAffine(toInv[i]))}static normalizeZ(points){return JacobianPoint.toAffineBatch(points).map(JacobianPoint.fromAffine)}equals(other){assertJacPoint(other);var{x:X1,y:Y1,z:Z1}=this,{x:other,y:Y2,z:Z2}=other,Z1Z1=mod(Z1*Z1),Z2Z2=mod(Z2*Z2),X1=mod(X1*Z2Z2),other=mod(other*Z1Z1),Y1=mod(mod(Y1*Z2)*Z2Z2),Z2=mod(mod(Y2*Z1)*Z1Z1);return X1===other&&Y1===Z2}negate(){return new JacobianPoint(this.x,mod(-this.y),this.z)}double(){var{x:X1,y:Y1,z:Z1}=this,A=mod(X1*X1),B=mod(Y1*Y1),C=mod(B*B),X1=X1+B,B=mod(_2n*(mod(X1*X1)-A-C)),X1=mod(_3n*A),A=mod(X1*X1),A=mod(A-_2n*B),X1=mod(X1*(B-A)-_8n*C),B=mod(_2n*Y1*Z1);return new JacobianPoint(A,X1,B)}add(other){assertJacPoint(other);var Z2Z2,{x:X1,y:Y1,z:Z1}=this,{x:X2,y:Y2,z:Z2}=other;return X2===_0n||Y2===_0n?this:X1===_0n||Y1===_0n?other:(other=mod(Z1*Z1),Z2Z2=mod(Z2*Z2),X1=mod(X1*Z2Z2),X2=mod(X2*other),Y1=mod(mod(Y1*Z2)*Z2Z2),Z2Z2=mod(mod(Y2*Z1)*other),Y2=mod(X2-X1),other=mod(Z2Z2-Y1),Y2===_0n?other===_0n?this.double():JacobianPoint.ZERO:(X2=mod(Y2*Y2),Z2Z2=mod(Y2*X2),X1=mod(X1*X2),X2=mod(other*other-Z2Z2-_2n*X1),other=mod(other*(X1-X2)-Y1*Z2Z2),X1=mod(Z1*Z2*Y2),new JacobianPoint(X2,other,X1)))}subtract(other){return this.add(other.negate())}multiplyUnsafe(scalar){var P0=JacobianPoint.ZERO;if("bigint"==typeof scalar&&scalar===_0n)return P0;let n=normalizeScalar(scalar);if(n===_1n)return this;if(!USE_ENDOMORPHISM){let p=P0,d=this;for(;n>_0n;)n&_1n&&(p=p.add(d)),d=d.double(),n>>=_1n;return p}let{k1neg,k1,k2neg,k2}=endo.splitScalar(n),k1p=P0,k2p=P0,d=this;for(;k1>_0n||k2>_0n;)k1&_1n&&(k1p=k1p.add(d)),k2&_1n&&(k2p=k2p.add(d)),d=d.double(),k1>>=_1n,k2>>=_1n;return k1neg&&(k1p=k1p.negate()),k2neg&&(k2p=k2p.negate()),k2p=new JacobianPoint(mod(k2p.x*endo.beta),k2p.y,k2p.z),k1p.add(k2p)}precomputeWindow(W){let windows=USE_ENDOMORPHISM?128/W+1:256/W+1,points=[],p=this,base=p;for(let window=0;window<windows;window++){base=p,points.push(base);for(let i=1;i<2**(W-1);i++)base=base.add(p),points.push(base);p=base.double()}return points}wNAF(n,affinePoint){var W=(affinePoint=!affinePoint&&this.equals(JacobianPoint.BASE)?Point.BASE:affinePoint)&&affinePoint._WINDOW_SIZE||1;if(256%W)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let precomputes=affinePoint&&pointPrecomputes.get(affinePoint),p=(precomputes||(precomputes=this.precomputeWindow(W),affinePoint&&1!==W&&(precomputes=JacobianPoint.normalizeZ(precomputes),pointPrecomputes.set(affinePoint,precomputes))),JacobianPoint.ZERO),f=JacobianPoint.BASE,windows=1+(USE_ENDOMORPHISM?128/W:256/W),windowSize=2**(W-1),mask=BigInt(2**W-1),maxNumber=2**W,shiftBy=BigInt(W);for(let window=0;window<windows;window++){let offset=window*windowSize,wbits=Number(n&mask);n>>=shiftBy,wbits>windowSize&&(wbits-=maxNumber,n+=_1n);var offset1=offset,offset2=offset+Math.abs(wbits)-1,cond1=window%2!=0,cond2=wbits<0;0===wbits?f=f.add(constTimeNegate(cond1,precomputes[offset1])):p=p.add(constTimeNegate(cond2,precomputes[offset2]))}return{p:p,f:f}}multiply(scalar,affinePoint){let k1neg,k1,k2neg,k2,f1p,f2p,k1p,k2p,p,f,n=normalizeScalar(scalar),point,fake;return fake=USE_ENDOMORPHISM?({k1neg,k1,k2neg,k2}=endo.splitScalar(n),{p:k1p,f:f1p}=this.wNAF(k1,affinePoint),{p:k2p,f:f2p}=this.wNAF(k2,affinePoint),k1p=constTimeNegate(k1neg,k1p),k2p=constTimeNegate(k2neg,k2p),k2p=new JacobianPoint(mod(k2p.x*endo.beta),k2p.y,k2p.z),point=k1p.add(k2p),f1p.add(f2p)):({p,f}=this.wNAF(n,affinePoint),point=p,f),JacobianPoint.normalizeZ([point,fake])[0]}toAffine(invZ){var{x,y,z}=this,is0=this.equals(JacobianPoint.ZERO),invZ=invZ=null==invZ?is0?_8n:invert(z):invZ,iz2=mod(invZ*invZ),iz3=mod(iz2*invZ),x=mod(x*iz2),iz2=mod(y*iz3),y=mod(z*invZ);if(is0)return Point.ZERO;if(y!==_1n)throw new Error("invZ was invalid");return new Point(x,iz2)}}function constTimeNegate(condition,item){var neg=item.negate();return condition?neg:item}JacobianPoint.BASE=new JacobianPoint(CURVE.Gx,CURVE.Gy,_1n),JacobianPoint.ZERO=new JacobianPoint(_0n,_1n,_0n);let pointPrecomputes=new WeakMap;class Point{constructor(x,y){this.x=x,this.y=y}_setWindowSize(windowSize){this._WINDOW_SIZE=windowSize,pointPrecomputes.delete(this)}hasEvenY(){return this.y%_2n===_0n}static fromCompressedHex(bytes){var isShort=32===bytes.length,x=bytesToNumber(isShort?bytes:bytes.subarray(1));if(!isValidFieldElement(x))throw new Error("Point is not on curve");let y=(x=>{var P=CURVE.P,_6n=BigInt(6),_11n=BigInt(11),_22n=BigInt(22),_23n=BigInt(23),_44n=BigInt(44),_88n=BigInt(88),b2=x*x*x%P,b3=b2*b2*x%P,b6=pow2(b3,_3n)*b3%P,b6=pow2(b6,_3n)*b3%P,b6=pow2(b6,_2n)*b2%P,_11n=pow2(b6,_11n)*b6%P,b6=pow2(_11n,_22n)*_11n%P,_22n=pow2(b6,_44n)*b6%P,_88n=pow2(_22n,_88n)*_22n%P,_22n=pow2(_88n,_44n)*b6%P,_88n=pow2(_22n,_3n)*b3%P,_44n=pow2(_88n,_23n)*_11n%P,b6=pow2(_44n,_6n)*b2%P,_22n=pow2(b6,_2n);if(_22n*_22n%P!==x)throw new Error("Cannot find square root");return _22n})(weierstrass(x)),isYOdd=(y&_1n)===_1n,point=(isShort?isYOdd&&(y=mod(-y)):1==(1&bytes[0])!=isYOdd&&(y=mod(-y)),new Point(x,y));return point.assertValidity(),point}static fromUncompressedHex(bytes){var x=bytesToNumber(bytes.subarray(1,fieldLen+1)),bytes=bytesToNumber(bytes.subarray(fieldLen+1,2*fieldLen+1)),x=new Point(x,bytes);return x.assertValidity(),x}static fromHex(hex){var hex=ensureBytes(hex),len=hex.length,header=hex[0];if(len===fieldLen)return this.fromCompressedHex(hex);if(len===compressedLen&&(2===header||3===header))return this.fromCompressedHex(hex);if(len===uncompressedLen&&4===header)return this.fromUncompressedHex(hex);throw new Error(`Point.fromHex: received invalid point. Expected 32-${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes, not `+len)}static fromPrivateKey(privateKey){return Point.BASE.multiply(normalizePrivateKey(privateKey))}static fromSignature(msgHash,signature,recovery){var{r:signature,s}=normalizeSignature(signature);if(![0,1,2,3].includes(recovery))throw new Error("Cannot recover: invalid recovery bit");var msgHash=truncateHash(ensureBytes(msgHash)),n=CURVE.n,signature=2===recovery||3===recovery?signature+n:signature,rinv=invert(signature,n),msgHash=mod(-msgHash*rinv,n),s=mod(s*rinv,n),rinv=1&recovery?"03":"02",n=Point.fromHex(rinv+numTo32bStr(signature)),recovery=Point.BASE.multiplyAndAddUnsafe(n,msgHash,s);if(recovery)return recovery.assertValidity(),recovery;throw new Error("Cannot recover signature: point at infinify")}toRawBytes(isCompressed=!1){return hexToBytes(this.toHex(isCompressed))}toHex(isCompressed=!1){var x=numTo32bStr(this.x);return isCompressed?(this.hasEvenY()?"02":"03")+x:"04"+x+numTo32bStr(this.y)}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){var msg="Point is not on elliptic curve",{x,y}=this;if(!isValidFieldElement(x)||!isValidFieldElement(y))throw new Error(msg);y=mod(y*y);if(mod(y-weierstrass(x))!==_0n)throw new Error(msg)}equals(other){return this.x===other.x&&this.y===other.y}negate(){return new Point(this.x,mod(-this.y))}double(){return JacobianPoint.fromAffine(this).double().toAffine()}add(other){return JacobianPoint.fromAffine(this).add(JacobianPoint.fromAffine(other)).toAffine()}subtract(other){return this.add(other.negate())}multiply(scalar){return JacobianPoint.fromAffine(this).multiply(scalar,this).toAffine()}multiplyAndAddUnsafe(Q,a,b){var P=JacobianPoint.fromAffine(this),P=a===_0n||a===_1n||this!==Point.BASE?P.multiplyUnsafe(a):P.multiply(a),a=JacobianPoint.fromAffine(Q).multiplyUnsafe(b),Q=P.add(a);return Q.equals(JacobianPoint.ZERO)?void 0:Q.toAffine()}}function sliceDER(s){return 8<=Number.parseInt(s[0],16)?"00"+s:s}function parseDERInt(data){if(data.length<2||2!==data[0])throw new Error("Invalid signature integer tag: "+bytesToHex(data));var len=data[1],res=data.subarray(2,len+2);if(!len||res.length!==len)throw new Error("Invalid signature integer: wrong length");if(0===res[0]&&res[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:bytesToNumber(res),left:data.subarray(len+2)}}(exports.Point=Point).BASE=new Point(CURVE.Gx,CURVE.Gy),Point.ZERO=new Point(_0n,_0n);class Signature{constructor(r,s){this.r=r,this.s=s,this.assertValidity()}static fromCompact(hex){var arr=hex instanceof Uint8Array,name="Signature.fromCompact";if("string"!=typeof hex&&!arr)throw new TypeError(name+": Expected string or Uint8Array");arr=arr?bytesToHex(hex):hex;if(128!==arr.length)throw new Error(name+": Expected 64-byte hex");return new Signature(hexToNumber(arr.slice(0,64)),hexToNumber(arr.slice(64,128)))}static fromDER(hex){var arr=hex instanceof Uint8Array;if("string"==typeof hex||arr)return{r:arr,s:hex}=(data=>{if(data.length<2||48!=data[0])throw new Error("Invalid signature tag: "+bytesToHex(data));if(data[1]!==data.length-2)throw new Error("Invalid signature: incorrect length");var{data,left:sBytes}=parseDERInt(data.subarray(2)),{data:sBytes,left:rBytesLeft}=parseDERInt(sBytes);if(rBytesLeft.length)throw new Error("Invalid signature: left bytes after parsing: "+bytesToHex(rBytesLeft));return{r:data,s:sBytes}})(arr?hex:hexToBytes(hex)),new Signature(arr,hex);throw new TypeError("Signature.fromDER: Expected string or Uint8Array")}static fromHex(hex){return this.fromDER(hex)}assertValidity(){var{r,s}=this;if(!isWithinCurveOrder(r))throw new Error("Invalid Signature: r must be 0 < r < n");if(!isWithinCurveOrder(s))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){var HALF=CURVE.n>>_1n;return this.s>HALF}normalizeS(){return this.hasHighS()?new Signature(this.r,mod(-this.s,CURVE.n)):this}toDERRawBytes(){return hexToBytes(this.toDERHex())}toDERHex(){var sHex=sliceDER(numberToHexUnpadded(this.s)),rHex=sliceDER(numberToHexUnpadded(this.r)),sHexL=sHex.length/2,rHexL=rHex.length/2,sLen=numberToHexUnpadded(sHexL),rLen=numberToHexUnpadded(rHexL);return`30${numberToHexUnpadded(rHexL+sHexL+4)}02${rLen}${rHex}02`+sLen+sHex}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return hexToBytes(this.toCompactHex())}toCompactHex(){return numTo32bStr(this.r)+numTo32bStr(this.s)}}function concatBytes(...arrays){if(!arrays.every(b=>b instanceof Uint8Array))throw new Error("Uint8Array list expected");if(1===arrays.length)return arrays[0];var length=arrays.reduce((a,arr)=>a+arr.length,0),result=new Uint8Array(length);for(let i=0,pad=0;i<arrays.length;i++){var arr=arrays[i];result.set(arr,pad),pad+=arr.length}return result}exports.Signature=Signature;let hexes=Array.from({length:256},(v,i)=>i.toString(16).padStart(2,"0"));function bytesToHex(uint8a){if(!(uint8a instanceof Uint8Array))throw new Error("Expected Uint8Array");let hex="";for(let i=0;i<uint8a.length;i++)hex+=hexes[uint8a[i]];return hex}let POW_2_256=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function numTo32bStr(num){if("bigint"!=typeof num)throw new Error("Expected bigint");if(_0n<=num&&num<POW_2_256)return num.toString(16).padStart(64,"0");throw new Error("Expected number 0 <= n < 2^256")}function numTo32b(num){num=hexToBytes(numTo32bStr(num));if(32!==num.length)throw new Error("Error: expected 32 bytes");return num}function numberToHexUnpadded(num){num=num.toString(16);return 1&num.length?"0"+num:num}function hexToNumber(hex){if("string"!=typeof hex)throw new TypeError("hexToNumber: expected string, got "+typeof hex);return BigInt("0x"+hex)}function hexToBytes(hex){if("string"!=typeof hex)throw new TypeError("hexToBytes: expected string, got "+typeof hex);if(hex.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+hex.length);var array=new Uint8Array(hex.length/2);for(let i=0;i<array.length;i++){var j=2*i,j=hex.slice(j,2+j),j=Number.parseInt(j,16);if(Number.isNaN(j)||j<0)throw new Error("Invalid byte sequence");array[i]=j}return array}function bytesToNumber(bytes){return hexToNumber(bytesToHex(bytes))}function ensureBytes(hex){return hex instanceof Uint8Array?Uint8Array.from(hex):hexToBytes(hex)}function normalizeScalar(num){if("number"==typeof num&&Number.isSafeInteger(num)&&0<num)return BigInt(num);if("bigint"==typeof num&&isWithinCurveOrder(num))return num;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function mod(a,b=CURVE.P){a%=b;return a>=_0n?a:b+a}function pow2(x,power){let P=CURVE.P,res=x;for(;power-- >_0n;)res=res*res%P;return res}function invert(number,modulo=CURVE.P){if(number===_0n||modulo<=_0n)throw new Error(`invert: expected positive integers, got n=${number} mod=`+modulo);let a=mod(number,modulo),b=modulo,x=_0n,y=_1n,u=_1n,v=_0n;for(;a!==_0n;){var q=b/a,r=b%a,m=x-u*q,q=y-v*q;b=a,a=r,x=u,y=v,u=m,v=q}if(b!==_1n)throw new Error("invert: does not exist");return mod(x,modulo)}function truncateHash(hash,truncateOnly=!1){var delta=8*(hash=hash).length-8*groupLen,hash=bytesToNumber(hash),delta=0<delta?hash>>BigInt(delta):hash;return!truncateOnly&&(hash=CURVE.n)<=delta?delta-hash:delta}let _sha256Sync,_hmacSha256Sync;class HmacDrbg{constructor(hashLen,qByteLen){if(this.hashLen=hashLen,this.qByteLen=qByteLen,"number"!=typeof hashLen||hashLen<2)throw new Error("hashLen must be a number");if("number"!=typeof qByteLen||qByteLen<2)throw new Error("qByteLen must be a number");this.v=new Uint8Array(hashLen).fill(1),this.k=new Uint8Array(hashLen).fill(0),this.counter=0}hmac(...values){return exports.utils.hmacSha256(this.k,...values)}hmacSync(...values){return _hmacSha256Sync(this.k,...values)}checkSync(){if("function"!=typeof _hmacSha256Sync)throw new ShaError("hmacSha256Sync needs to be set")}incr(){if(1e3<=this.counter)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(seed=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),seed),this.v=await this.hmac(this.v),0!==seed.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),seed),this.v=await this.hmac(this.v))}reseedSync(seed=new Uint8Array){this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),seed),this.v=this.hmacSync(this.v),0!==seed.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),seed),this.v=this.hmacSync(this.v))}async generate(){this.incr();let len=0;for(var out=[];len<this.qByteLen;){this.v=await this.hmac(this.v);var sl=this.v.slice();out.push(sl),len+=this.v.length}return concatBytes(...out)}generateSync(){this.checkSync(),this.incr();let len=0;for(var out=[];len<this.qByteLen;){this.v=this.hmacSync(this.v);var sl=this.v.slice();out.push(sl),len+=this.v.length}return concatBytes(...out)}}function isWithinCurveOrder(num){return _0n<num&&num<CURVE.n}function isValidFieldElement(num){return _0n<num&&num<CURVE.P}function kmdToSig(kBytes,m,d,lowS=!0){var n=CURVE.n,kBytes=truncateHash(kBytes,!0);if(isWithinCurveOrder(kBytes)){var kinv=invert(kBytes,n),kBytes=Point.BASE.multiply(kBytes),r=mod(kBytes.x,n);if(r!==_0n){kinv=mod(kinv*mod(m+d*r,n),n);if(kinv!==_0n){let sig=new Signature(r,kinv),recovery=(kBytes.x===sig.r?0:2)|Number(kBytes.y&_1n);return lowS&&sig.hasHighS()&&(sig=sig.normalizeS(),recovery^=1),{sig:sig,recovery:recovery}}}}}function normalizePrivateKey(key){let num;if("bigint"==typeof key)num=key;else if("number"==typeof key&&Number.isSafeInteger(key)&&0<key)num=BigInt(key);else if("string"==typeof key){if(key.length!==2*groupLen)throw new Error("Expected 32 bytes of private key");num=hexToNumber(key)}else{if(!(key instanceof Uint8Array))throw new TypeError("Expected valid private key");if(key.length!==groupLen)throw new Error("Expected 32 bytes of private key");num=bytesToNumber(key)}if(isWithinCurveOrder(num))return num;throw new Error("Expected private key: 0 < key < n")}function normalizePublicKey(publicKey){return publicKey instanceof Point?(publicKey.assertValidity(),publicKey):Point.fromHex(publicKey)}function normalizeSignature(signature){if(signature instanceof Signature)return signature.assertValidity(),signature;try{return Signature.fromDER(signature)}catch(error){return Signature.fromCompact(signature)}}function isProbPub(item){var arr=item instanceof Uint8Array,str="string"==typeof item,len=(arr||str)&&item.length;return arr?len===compressedLen||len===uncompressedLen:str?len===2*compressedLen||len===2*uncompressedLen:item instanceof Point}function bits2int(bytes){return bytesToNumber(bytes.length>fieldLen?bytes.slice(0,fieldLen):bytes)}function int2octets(num){return numTo32b(num)}function initSigArgs(msgHash,privateKey,extraEntropy){if(null==msgHash)throw new Error(`sign: expected valid message hash, not "${msgHash}"`);var msgHash=ensureBytes(msgHash),privateKey=normalizePrivateKey(privateKey),z1=[int2octets(privateKey),int2octets((z2=mod(z1=bits2int(msgHash),CURVE.n))<_0n?z1:z2)];if(null!=extraEntropy){var z2=ensureBytes(extraEntropy=!0===extraEntropy?exports.utils.randomBytes(fieldLen):extraEntropy);if(z2.length!==fieldLen)throw new Error(`sign: Expected ${fieldLen} bytes of extra data`);z1.push(z2)}return{seed:concatBytes(...z1),m:bits2int(msgHash),d:privateKey}}function finalizeSig(recSig,opts){var{sig:recSig,recovery}=recSig,{der:opts,recovered}=Object.assign({canonical:!0,der:!0},opts),opts=opts?recSig.toDERRawBytes():recSig.toCompactRawBytes();return recovered?[opts,recovery]:opts}exports.getPublicKey=function(privateKey,isCompressed=!1){return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed)},exports.recoverPublicKey=function(msgHash,signature,recovery,isCompressed=!1){return Point.fromSignature(msgHash,signature,recovery).toRawBytes(isCompressed)},exports.getSharedSecret=function(privateA,publicB,isCompressed=!1){if(isProbPub(privateA))throw new TypeError("getSharedSecret: first arg must be private key");if(isProbPub(publicB))return(publicB=normalizePublicKey(publicB)).assertValidity(),publicB.multiply(normalizePrivateKey(privateA)).toRawBytes(isCompressed);throw new TypeError("getSharedSecret: second arg must be public key")},exports.sign=async function(msgHash,privKey,opts={}){var{seed:msgHash,m,d}=initSigArgs(msgHash,privKey,opts.extraEntropy),drbg=new HmacDrbg(32,groupLen);await drbg.reseed(msgHash);let sig;for(;!(sig=kmdToSig(await drbg.generate(),m,d,opts.canonical));)await drbg.reseed();return finalizeSig(sig,opts)},exports.signSync=function(msgHash,privKey,opts={}){var{seed:msgHash,m,d}=initSigArgs(msgHash,privKey,opts.extraEntropy),drbg=new HmacDrbg(32,groupLen);drbg.reseedSync(msgHash);let sig;for(;!(sig=kmdToSig(drbg.generateSync(),m,d,opts.canonical));)drbg.reseedSync();return finalizeSig(sig,opts)};let vopts={strict:!0};function schnorrChallengeFinalize(ch){return mod(bytesToNumber(ch),CURVE.n)}exports.verify=function(signature,msgHash,publicKey,opts=vopts){let sig;try{sig=normalizeSignature(signature),msgHash=ensureBytes(msgHash)}catch(error){return!1}var{r:signature,s}=sig;if(opts.strict&&sig.hasHighS())return!1;let h=truncateHash(msgHash),P;try{P=normalizePublicKey(publicKey)}catch(error){return!1}opts=CURVE.n,msgHash=invert(s,opts),publicKey=mod(h*msgHash,opts),s=mod(signature*msgHash,opts),msgHash=Point.BASE.multiplyAndAddUnsafe(P,publicKey,s);return!!msgHash&&mod(msgHash.x,opts)===signature};class SchnorrSignature{constructor(r,s){this.r=r,this.s=s,this.assertValidity()}static fromHex(hex){hex=ensureBytes(hex);if(64!==hex.length)throw new TypeError("SchnorrSignature.fromHex: expected 64 bytes, not "+hex.length);var r=bytesToNumber(hex.subarray(0,32)),hex=bytesToNumber(hex.subarray(32,64));return new SchnorrSignature(r,hex)}assertValidity(){var{r,s}=this;if(!isValidFieldElement(r)||!isWithinCurveOrder(s))throw new Error("Invalid signature")}toHex(){return numTo32bStr(this.r)+numTo32bStr(this.s)}toRawBytes(){return hexToBytes(this.toHex())}}class InternalSchnorrSignature{constructor(message,privateKey,auxRand=exports.utils.randomBytes()){if(null==message)throw new TypeError(`sign: Expected valid message, not "${message}"`);this.m=ensureBytes(message);var{x:message,scalar:privateKey}=this.getScalar(normalizePrivateKey(privateKey));if(this.px=message,this.d=privateKey,this.rand=ensureBytes(auxRand),32!==this.rand.length)throw new TypeError("sign: Expected 32 bytes of aux randomness")}getScalar(priv){var point=Point.fromPrivateKey(priv),priv=point.hasEvenY()?priv:CURVE.n-priv;return{point:point,scalar:priv,x:point.toRawX()}}initNonce(d,t0h){return numTo32b(d^bytesToNumber(t0h))}finalizeNonce(k0h){k0h=mod(bytesToNumber(k0h),CURVE.n);if(k0h===_0n)throw new Error("sign: Creation of signature failed. k is zero");var{point:k0h,x:rx,scalar:k}=this.getScalar(k0h);return{R:k0h,rx:rx,k:k}}finalizeSig(R,k,e,d){return new SchnorrSignature(R.x,mod(k+e*d,CURVE.n)).toRawBytes()}error(){throw new Error("sign: Invalid signature produced")}async calc(){var{m,d,px,rand}=this,tag=exports.utils.taggedHash,rand=this.initNonce(d,await tag(TAGS.aux,rand)),{R:rand,rx,k}=this.finalizeNonce(await tag(TAGS.nonce,rand,px,m)),tag=schnorrChallengeFinalize(await tag(TAGS.challenge,rx,px,m)),rx=this.finalizeSig(rand,k,tag,d);return await schnorrVerify(rx,m,px)||this.error(),rx}calcSync(){var{m,d,px,rand}=this,tag=exports.utils.taggedHashSync,rand=this.initNonce(d,tag(TAGS.aux,rand)),{R:rand,rx,k}=this.finalizeNonce(tag(TAGS.nonce,rand,px,m)),tag=schnorrChallengeFinalize(tag(TAGS.challenge,rx,px,m)),rx=this.finalizeSig(rand,k,tag,d);return schnorrVerifySync(rx,m,px)||this.error(),rx}}function initSchnorrVerify(signature,message,publicKey){var raw=signature instanceof SchnorrSignature,signature=raw?signature:SchnorrSignature.fromHex(signature);return raw&&signature.assertValidity(),{...signature,m:ensureBytes(message),P:normalizePublicKey(publicKey)}}function finalizeSchnorrVerify(r,P,s,e){P=Point.BASE.multiplyAndAddUnsafe(P,normalizePrivateKey(s),mod(-e,CURVE.n));return!(!P||!P.hasEvenY()||P.x!==r)}async function schnorrVerify(signature,message,publicKey){try{var{r,s,m,P}=initSchnorrVerify(signature,message,publicKey),e=schnorrChallengeFinalize(await exports.utils.taggedHash(TAGS.challenge,numTo32b(r),P.toRawX(),m));return finalizeSchnorrVerify(r,P,s,e)}catch(error){return!1}}function schnorrVerifySync(signature,message,publicKey){try{var{r,s,m,P}=initSchnorrVerify(signature,message,publicKey),e=schnorrChallengeFinalize(exports.utils.taggedHashSync(TAGS.challenge,numTo32b(r),P.toRawX(),m));return finalizeSchnorrVerify(r,P,s,e)}catch(error){if(error instanceof ShaError)throw error;return!1}}exports.schnorr={Signature:SchnorrSignature,getPublicKey:function(privateKey){return Point.fromPrivateKey(privateKey).toRawX()},sign:async function(msg,privKey,auxRand){return new InternalSchnorrSignature(msg,privKey,auxRand).calc()},verify:schnorrVerify,signSync:function(msg,privKey,auxRand){return new InternalSchnorrSignature(msg,privKey,auxRand).calcSync()},verifySync:schnorrVerifySync},Point.BASE._setWindowSize(8);let crypto={node:nodeCrypto,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},TAGS={challenge:"BIP0340/challenge",aux:"BIP0340/aux",nonce:"BIP0340/nonce"},TAGGED_HASH_PREFIXES={};exports.utils={bytesToHex:bytesToHex,hexToBytes:hexToBytes,concatBytes:concatBytes,mod:mod,invert:invert,isValidPrivateKey(privateKey){try{return normalizePrivateKey(privateKey),!0}catch(error){return!1}},_bigintTo32Bytes:numTo32b,_normalizePrivateKey:normalizePrivateKey,hashToPrivateKey:hash=>{hash=ensureBytes(hash);var minLen=groupLen+8;if(hash.length<minLen||1024<hash.length)throw new Error("Expected valid bytes of private key as per FIPS 186");return numTo32b(mod(bytesToNumber(hash),CURVE.n-_1n)+_1n)},randomBytes:(bytesLength=32)=>{if(crypto.web)return crypto.web.getRandomValues(new Uint8Array(bytesLength));var randomBytes;if(crypto.node)return randomBytes=crypto.node.randomBytes,Uint8Array.from(randomBytes(bytesLength));throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>exports.utils.hashToPrivateKey(exports.utils.randomBytes(groupLen+8)),precompute(windowSize=8,point=Point.BASE){point=point===Point.BASE?point:new Point(point.x,point.y);return point._setWindowSize(windowSize),point.multiply(_3n),point},sha256:async(...messages)=>{var buffer;if(crypto.web)return buffer=await crypto.web.subtle.digest("SHA-256",concatBytes(...messages)),new Uint8Array(buffer);if(crypto.node){let createHash=crypto.node.createHash,hash=createHash("sha256");return messages.forEach(m=>hash.update(m)),Uint8Array.from(hash.digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(key,...messages)=>{var message,ckey;if(crypto.web)return ckey=await crypto.web.subtle.importKey("raw",key,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),message=concatBytes(...messages),ckey=await crypto.web.subtle.sign("HMAC",ckey,message),new Uint8Array(ckey);if(crypto.node){let createHmac=crypto.node.createHmac,hash=createHmac("sha256",key);return messages.forEach(m=>hash.update(m)),Uint8Array.from(hash.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async(tag,...messages)=>{let tagP=TAGGED_HASH_PREFIXES[tag],tagH;return void 0===tagP&&(tagH=await exports.utils.sha256(Uint8Array.from(tag,c=>c.charCodeAt(0))),tagP=concatBytes(tagH,tagH),TAGGED_HASH_PREFIXES[tag]=tagP),exports.utils.sha256(tagP,...messages)},taggedHashSync:(tag,...messages)=>{if("function"!=typeof _sha256Sync)throw new ShaError("sha256Sync is undefined, you need to set it");let tagP=TAGGED_HASH_PREFIXES[tag],tagH;return void 0===tagP&&(tagH=_sha256Sync(Uint8Array.from(tag,c=>c.charCodeAt(0))),tagP=concatBytes(tagH,tagH),TAGGED_HASH_PREFIXES[tag]=tagP),_sha256Sync(tagP,...messages)},_JacobianPoint:JacobianPoint},Object.defineProperties(exports.utils,{sha256Sync:{configurable:!1,get(){return _sha256Sync},set(val){_sha256Sync=_sha256Sync||val}},hmacSha256Sync:{configurable:!1,get(){return _hmacSha256Sync},set(val){_hmacSha256Sync=_hmacSha256Sync||val}}})},{crypto:53}],46:[function(_dereq_,module,exports){function checkInt(value){return parseInt(value)===value}function checkInts(arrayish){if(checkInt(arrayish.length)){for(var i=0;i<arrayish.length;i++)if(!checkInt(arrayish[i])||arrayish[i]<0||255<arrayish[i])return;return 1}}function coerceArray(arg,copy){if(arg.buffer&&"Uint8Array"===arg.name)return copy?arg.slice?arg.slice():Array.prototype.slice.call(arg):arg;if(Array.isArray(arg)){if(checkInts(arg))return new Uint8Array(arg);throw new Error("Array contains invalid value: "+arg)}if(checkInt(arg.length)&&checkInts(arg))return new Uint8Array(arg);throw new Error("unsupported array-like object")}function createArray(length){return new Uint8Array(length)}function copyArray(sourceArray,targetArray,targetStart,sourceStart,sourceEnd){null==sourceStart&&null==sourceEnd||(sourceArray=sourceArray.slice?sourceArray.slice(sourceStart,sourceEnd):Array.prototype.slice.call(sourceArray,sourceStart,sourceEnd)),targetArray.set(sourceArray,targetStart)}var Hex,convertUtf8={toBytes:function(text){var result=[],i=0;for(text=encodeURI(text);i<text.length;){var c=text.charCodeAt(i++);37===c?(result.push(parseInt(text.substr(i,2),16)),i+=2):result.push(c)}return coerceArray(result)},fromBytes:function(bytes){for(var result=[],i=0;i<bytes.length;){var c=bytes[i];c<128?(result.push(String.fromCharCode(c)),i++):191<c&&c<224?(result.push(String.fromCharCode((31&c)<<6|63&bytes[i+1])),i+=2):(result.push(String.fromCharCode((15&c)<<12|(63&bytes[i+1])<<6|63&bytes[i+2])),i+=3)}return result.join("")}},convertHex=(Hex="0123456789abcdef",{toBytes:function(text){for(var result=[],i=0;i<text.length;i+=2)result.push(parseInt(text.substr(i,2),16));return result},fromBytes:function(bytes){for(var result=[],i=0;i<bytes.length;i++){var v=bytes[i];result.push(Hex[(240&v)>>4]+Hex[15&v])}return result.join("")}}),numberOfRounds={16:10,24:12,32:14},rcon=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],S=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],Si=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],T1=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],T2=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],T3=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],T4=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],T5=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],T6=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],T7=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],T8=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],U1=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],U2=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],U3=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],U4=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function convertToInt32(bytes){for(var result=[],i=0;i<bytes.length;i+=4)result.push(bytes[i]<<24|bytes[i+1]<<16|bytes[i+2]<<8|bytes[i+3]);return result}function AES(key){if(!(this instanceof AES))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:coerceArray(key,!0)}),this._prepare()}function ModeOfOperationECB(key){if(!(this instanceof ModeOfOperationECB))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new AES(key)}function ModeOfOperationCBC(key,iv){if(!(this instanceof ModeOfOperationCBC))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",iv){if(16!=iv.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else iv=createArray(16);this._lastCipherblock=coerceArray(iv,!0),this._aes=new AES(key)}function ModeOfOperationCFB(key,iv,segmentSize){if(!(this instanceof ModeOfOperationCFB))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",iv){if(16!=iv.length)throw new Error("invalid initialation vector size (must be 16 size)")}else iv=createArray(16);this.segmentSize=segmentSize=segmentSize||1,this._shiftRegister=coerceArray(iv,!0),this._aes=new AES(key)}function ModeOfOperationOFB(key,iv){if(!(this instanceof ModeOfOperationOFB))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",iv){if(16!=iv.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else iv=createArray(16);this._lastPrecipher=coerceArray(iv,!0),this._lastPrecipherIndex=16,this._aes=new AES(key)}function Counter(initialValue){if(!(this instanceof Counter))throw Error("Counter must be instanitated with `new`");"number"==typeof(initialValue=0!==initialValue?initialValue||1:initialValue)?(this._counter=createArray(16),this.setValue(initialValue)):this.setBytes(initialValue)}function ModeOfOperationCTR(key,counter){if(!(this instanceof ModeOfOperationCTR))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",counter instanceof Counter||(counter=new Counter(counter)),this._counter=counter,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new AES(key)}AES.prototype._prepare=function(){var rounds=numberOfRounds[this.key.length];if(null==rounds)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var i=0;i<=rounds;i++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);for(var index,roundKeyCount=4*(rounds+1),KC=this.key.length/4,tk=convertToInt32(this.key),i=0;i<KC;i++)this._Ke[index=i>>2][i%4]=tk[i],this._Kd[rounds-index][i%4]=tk[i];for(var tt,rconpointer=0,t=KC;t<roundKeyCount;){if(tt=tk[KC-1],tk[0]^=S[tt>>16&255]<<24^S[tt>>8&255]<<16^S[255&tt]<<8^S[tt>>24&255]^rcon[rconpointer]<<24,rconpointer+=1,8!=KC)for(i=1;i<KC;i++)tk[i]^=tk[i-1];else{for(i=1;i<KC/2;i++)tk[i]^=tk[i-1];for(tt=tk[KC/2-1],tk[KC/2]^=S[255&tt]^S[tt>>8&255]<<8^S[tt>>16&255]<<16^S[tt>>24&255]<<24,i=KC/2+1;i<KC;i++)tk[i]^=tk[i-1]}for(i=0;i<KC&&t<roundKeyCount;)this._Ke[r=t>>2][c=t%4]=tk[i],this._Kd[rounds-r][c]=tk[i++],t++}for(var r=1;r<rounds;r++)for(var c=0;c<4;c++)tt=this._Kd[r][c],this._Kd[r][c]=U1[tt>>24&255]^U2[tt>>16&255]^U3[tt>>8&255]^U4[255&tt]},AES.prototype.encrypt=function(plaintext){if(16!=plaintext.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var rounds=this._Ke.length-1,a=[0,0,0,0],t=convertToInt32(plaintext),i=0;i<4;i++)t[i]^=this._Ke[0][i];for(var r=1;r<rounds;r++){for(i=0;i<4;i++)a[i]=T1[t[i]>>24&255]^T2[t[(i+1)%4]>>16&255]^T3[t[(i+2)%4]>>8&255]^T4[255&t[(i+3)%4]]^this._Ke[r][i];t=a.slice()}for(var tt,result=createArray(16),i=0;i<4;i++)tt=this._Ke[rounds][i],result[4*i]=255&(S[t[i]>>24&255]^tt>>24),result[4*i+1]=255&(S[t[(i+1)%4]>>16&255]^tt>>16),result[4*i+2]=255&(S[t[(i+2)%4]>>8&255]^tt>>8),result[4*i+3]=255&(S[255&t[(i+3)%4]]^tt);return result},AES.prototype.decrypt=function(ciphertext){if(16!=ciphertext.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var rounds=this._Kd.length-1,a=[0,0,0,0],t=convertToInt32(ciphertext),i=0;i<4;i++)t[i]^=this._Kd[0][i];for(var r=1;r<rounds;r++){for(i=0;i<4;i++)a[i]=T5[t[i]>>24&255]^T6[t[(i+3)%4]>>16&255]^T7[t[(i+2)%4]>>8&255]^T8[255&t[(i+1)%4]]^this._Kd[r][i];t=a.slice()}for(var tt,result=createArray(16),i=0;i<4;i++)tt=this._Kd[rounds][i],result[4*i]=255&(Si[t[i]>>24&255]^tt>>24),result[4*i+1]=255&(Si[t[(i+3)%4]>>16&255]^tt>>16),result[4*i+2]=255&(Si[t[(i+2)%4]>>8&255]^tt>>8),result[4*i+3]=255&(Si[255&t[(i+1)%4]]^tt);return result},ModeOfOperationECB.prototype.encrypt=function(plaintext){if((plaintext=coerceArray(plaintext)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var ciphertext=createArray(plaintext.length),block=createArray(16),i=0;i<plaintext.length;i+=16)copyArray(plaintext,block,0,i,i+16),copyArray(block=this._aes.encrypt(block),ciphertext,i);return ciphertext},ModeOfOperationECB.prototype.decrypt=function(ciphertext){if((ciphertext=coerceArray(ciphertext)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var plaintext=createArray(ciphertext.length),block=createArray(16),i=0;i<ciphertext.length;i+=16)copyArray(ciphertext,block,0,i,i+16),copyArray(block=this._aes.decrypt(block),plaintext,i);return plaintext},ModeOfOperationCBC.prototype.encrypt=function(plaintext){if((plaintext=coerceArray(plaintext)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var ciphertext=createArray(plaintext.length),block=createArray(16),i=0;i<plaintext.length;i+=16){copyArray(plaintext,block,0,i,i+16);for(var j=0;j<16;j++)block[j]^=this._lastCipherblock[j];this._lastCipherblock=this._aes.encrypt(block),copyArray(this._lastCipherblock,ciphertext,i)}return ciphertext},ModeOfOperationCBC.prototype.decrypt=function(ciphertext){if((ciphertext=coerceArray(ciphertext)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var plaintext=createArray(ciphertext.length),block=createArray(16),i=0;i<ciphertext.length;i+=16){copyArray(ciphertext,block,0,i,i+16);for(var block=this._aes.decrypt(block),j=0;j<16;j++)plaintext[i+j]=block[j]^this._lastCipherblock[j];copyArray(ciphertext,this._lastCipherblock,0,i,i+16)}return plaintext},ModeOfOperationCFB.prototype.encrypt=function(plaintext){if(plaintext.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var encrypted=coerceArray(plaintext,!0),i=0;i<encrypted.length;i+=this.segmentSize){for(var xorSegment=this._aes.encrypt(this._shiftRegister),j=0;j<this.segmentSize;j++)encrypted[i+j]^=xorSegment[j];copyArray(this._shiftRegister,this._shiftRegister,0,this.segmentSize),copyArray(encrypted,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return encrypted},ModeOfOperationCFB.prototype.decrypt=function(ciphertext){if(ciphertext.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var plaintext=coerceArray(ciphertext,!0),i=0;i<plaintext.length;i+=this.segmentSize){for(var xorSegment=this._aes.encrypt(this._shiftRegister),j=0;j<this.segmentSize;j++)plaintext[i+j]^=xorSegment[j];copyArray(this._shiftRegister,this._shiftRegister,0,this.segmentSize),copyArray(ciphertext,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return plaintext},ModeOfOperationOFB.prototype.decrypt=ModeOfOperationOFB.prototype.encrypt=function(plaintext){for(var encrypted=coerceArray(plaintext,!0),i=0;i<encrypted.length;i++)16===this._lastPrecipherIndex&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),encrypted[i]^=this._lastPrecipher[this._lastPrecipherIndex++];return encrypted},Counter.prototype.setValue=function(value){if("number"!=typeof value||parseInt(value)!=value)throw new Error("invalid counter value (must be an integer)");if(value>Number.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var index=15;0<=index;--index)this._counter[index]=value%256,value=parseInt(value/256)},Counter.prototype.setBytes=function(bytes){if(16!=(bytes=coerceArray(bytes,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=bytes},Counter.prototype.increment=function(){for(var i=15;0<=i;i--){if(255!==this._counter[i]){this._counter[i]++;break}this._counter[i]=0}},ModeOfOperationCTR.prototype.decrypt=ModeOfOperationCTR.prototype.encrypt=function(plaintext){for(var encrypted=coerceArray(plaintext,!0),i=0;i<encrypted.length;i++)16===this._remainingCounterIndex&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),encrypted[i]^=this._remainingCounter[this._remainingCounterIndex++];return encrypted};convertHex={AES:AES,Counter:Counter,ModeOfOperation:{ecb:ModeOfOperationECB,cbc:ModeOfOperationCBC,cfb:ModeOfOperationCFB,ofb:ModeOfOperationOFB,ctr:ModeOfOperationCTR},utils:{hex:convertHex,utf8:convertUtf8},padding:{pkcs7:{pad:function(data){var padder=16-(data=coerceArray(data,!0)).length%16,result=createArray(data.length+padder);copyArray(data,result);for(var i=data.length;i<result.length;i++)result[i]=padder;return result},strip:function(data){if((data=coerceArray(data,!0)).length<16)throw new Error("PKCS#7 invalid length");var padder=data[data.length-1];if(16<padder)throw new Error("PKCS#7 padding byte out of range");for(var length=data.length-padder,i=0;i<padder;i++)if(data[length+i]!==padder)throw new Error("PKCS#7 invalid padding byte");var result=createArray(length);return copyArray(data,result,0,0,length),result}}},_arrayTest:{coerceArray:coerceArray,createArray:createArray,copyArray:copyArray}};void 0!==exports?module.exports=convertHex:(this.aesjs&&(convertHex._aesjs=this.aesjs),this.aesjs=convertHex)},{}],47:[function(_dereq_,module,exports){!function(global){!function(){var objectAssign=_dereq_("object-assign");function compare(a,b){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}function isBuffer(b){return global.Buffer&&"function"==typeof global.Buffer.isBuffer?global.Buffer.isBuffer(b):!(null==b||!b._isBuffer)}var util=_dereq_("util/"),hasOwn=Object.prototype.hasOwnProperty,pSlice=Array.prototype.slice,functionsHaveNames="foo"===function(){}.name;function pToString(obj){return Object.prototype.toString.call(obj)}function isView(arrbuf){return!isBuffer(arrbuf)&&"function"==typeof global.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(arrbuf):arrbuf&&(arrbuf instanceof DataView||arrbuf.buffer&&arrbuf.buffer instanceof ArrayBuffer))}var assert=module.exports=ok,regex=/\s*function\s+([^\(\s]*)\s*/;function getName(func){if(util.isFunction(func))return functionsHaveNames?func.name:(func=func.toString().match(regex))&&func[1]}function truncate(s,n){return"string"!=typeof s||s.length<n?s:s.slice(0,n)}function inspect(something){return functionsHaveNames||!util.isFunction(something)?util.inspect(something):"[Function"+((something=getName(something))?": "+something:"")+"]"}function fail(actual,expected,message,operator,stackStartFunction){throw new assert.AssertionError({message:message,actual:actual,expected:expected,operator:operator,stackStartFunction:stackStartFunction})}function ok(value,message){value||fail(value,!0,message,"==",assert.ok)}function _deepEqual(actual,expected,strict,memos){var actualIndex;return actual===expected||(isBuffer(actual)&&isBuffer(expected)?0===compare(actual,expected):util.isDate(actual)&&util.isDate(expected)?actual.getTime()===expected.getTime():util.isRegExp(actual)&&util.isRegExp(expected)?actual.source===expected.source&&actual.global===expected.global&&actual.multiline===expected.multiline&&actual.lastIndex===expected.lastIndex&&actual.ignoreCase===expected.ignoreCase:null!==actual&&"object"==typeof actual||null!==expected&&"object"==typeof expected?isView(actual)&&isView(expected)&&pToString(actual)===pToString(expected)&&!(actual instanceof Float32Array||actual instanceof Float64Array)?0===compare(new Uint8Array(actual.buffer),new Uint8Array(expected.buffer)):isBuffer(actual)===isBuffer(expected)&&(-1!==(actualIndex=(memos=memos||{actual:[],expected:[]}).actual.indexOf(actual))&&actualIndex===memos.expected.indexOf(expected)||(memos.actual.push(actual),memos.expected.push(expected),((a,b,strict,actualVisitedObjects)=>{if(null==a||null==b)return!1;if(util.isPrimitive(a)||util.isPrimitive(b))return a===b;if(strict&&Object.getPrototypeOf(a)!==Object.getPrototypeOf(b))return!1;var aIsArgs=isArguments(a),bIsArgs=isArguments(b);if(aIsArgs&&!bIsArgs||!aIsArgs&&bIsArgs)return!1;if(aIsArgs)return _deepEqual(a=pSlice.call(a),b=pSlice.call(b),strict);var key,i,ka=objectKeys(a),kb=objectKeys(b);if(ka.length!==kb.length)return!1;for(ka.sort(),kb.sort(),i=ka.length-1;0<=i;i--)if(ka[i]!==kb[i])return!1;for(i=ka.length-1;0<=i;i--)if(!_deepEqual(a[key=ka[i]],b[key],strict,actualVisitedObjects))return!1;return!0})(actual,expected,strict,memos))):strict?actual===expected:actual==expected)}function isArguments(object){return"[object Arguments]"==Object.prototype.toString.call(object)}function expectedException(actual,expected){if(actual&&expected){if("[object RegExp]"==Object.prototype.toString.call(expected))return expected.test(actual);try{if(actual instanceof expected)return 1}catch(e){}return!Error.isPrototypeOf(expected)&&!0===expected.call({},actual)}}function _throws(shouldThrow,block,expected,message){if("function"!=typeof block)throw new TypeError('"block" argument must be a function');"string"==typeof expected&&(message=expected,expected=null),block=(block=>{var error;try{block()}catch(e){error=e}return error})(block),message=(expected&&expected.name?" ("+expected.name+").":".")+(message?" "+message:"."),shouldThrow&&!block&&fail(block,expected,"Missing expected exception"+message);var userProvidedMessage="string"==typeof message,isUnexpectedException=!shouldThrow&&block&&!expected;if((!shouldThrow&&util.isError(block)&&userProvidedMessage&&expectedException(block,expected)||isUnexpectedException)&&fail(block,expected,"Got unwanted exception"+message),shouldThrow&&block&&expected&&!expectedException(block,expected)||!shouldThrow&&block)throw block}assert.AssertionError=function(options){this.name="AssertionError",this.actual=options.actual,this.expected=options.expected,this.operator=options.operator,options.message?(this.message=options.message,this.generatedMessage=!1):(this.message=truncate(inspect(this.actual),128)+" "+this.operator+" "+truncate(inspect(this.expected),128),this.generatedMessage=!0);var err,options=options.stackStartFunction||fail;Error.captureStackTrace?Error.captureStackTrace(this,options):(err=new Error).stack&&(err=err.stack,options=getName(options),0<=(options=err.indexOf("\n"+options))&&(options=err.indexOf("\n",options+1),err=err.substring(options+1)),this.stack=err)},util.inherits(assert.AssertionError,Error),assert.fail=fail,assert.ok=ok,assert.equal=function(actual,expected,message){actual!=expected&&fail(actual,expected,message,"==",assert.equal)},assert.notEqual=function(actual,expected,message){actual==expected&&fail(actual,expected,message,"!=",assert.notEqual)},assert.deepEqual=function(actual,expected,message){_deepEqual(actual,expected,!1)||fail(actual,expected,message,"deepEqual",assert.deepEqual)},assert.deepStrictEqual=function(actual,expected,message){_deepEqual(actual,expected,!0)||fail(actual,expected,message,"deepStrictEqual",assert.deepStrictEqual)},assert.notDeepEqual=function(actual,expected,message){_deepEqual(actual,expected,!1)&&fail(actual,expected,message,"notDeepEqual",assert.notDeepEqual)},assert.notDeepStrictEqual=function notDeepStrictEqual(actual,expected,message){_deepEqual(actual,expected,!0)&&fail(actual,expected,message,"notDeepStrictEqual",notDeepStrictEqual)},assert.strictEqual=function(actual,expected,message){actual!==expected&&fail(actual,expected,message,"===",assert.strictEqual)},assert.notStrictEqual=function(actual,expected,message){actual===expected&&fail(actual,expected,message,"!==",assert.notStrictEqual)},assert.throws=function(block,error,message){_throws(!0,block,error,message)},assert.doesNotThrow=function(block,error,message){_throws(!1,block,error,message)},assert.ifError=function(err){if(err)throw err},assert.strict=objectAssign(function strict(value,message){value||fail(value,!0,message,"==",strict)},assert,{equal:assert.strictEqual,deepEqual:assert.deepStrictEqual,notEqual:assert.notStrictEqual,notDeepEqual:assert.notDeepStrictEqual}),assert.strict.strict=assert.strict;var objectKeys=Object.keys||function(obj){var key,keys=[];for(key in obj)hasOwn.call(obj,key)&&keys.push(key);return keys}}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"object-assign":62,"util/":50}],48:[function(_dereq_,module,exports){"function"==typeof Object.create?module.exports=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(ctor,superCtor){function TempCtor(){}ctor.super_=superCtor,TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}},{}],49:[function(_dereq_,module,exports){module.exports=function(arg){return arg&&"object"==typeof arg&&"function"==typeof arg.copy&&"function"==typeof arg.fill&&"function"==typeof arg.readUInt8}},{}],50:[function(_dereq_,module,exports){!function(process,global){!function(){var debugEnviron,formatRegExp=/%[sdj%]/g,debugs=(exports.format=function(f){if(!isString(f)){for(var objects=[],i=0;i<arguments.length;i++)objects.push(inspect(arguments[i]));return objects.join(" ")}for(var i=1,args=arguments,len=args.length,str=String(f).replace(formatRegExp,function(x){if("%%"===x)return"%";if(len<=i)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}}),x=args[i];i<len;x=args[++i])null!==x&&isObject(x)?str+=" "+inspect(x):str+=" "+x;return str},exports.deprecate=function(fn,msg){var warned;return void 0===global.process?function(){return exports.deprecate(fn,msg).apply(this,arguments)}:!0===process.noDeprecation?fn:(warned=!1,function(){if(!warned){if(process.throwDeprecation)throw new Error(msg);warned=!0}return fn.apply(this,arguments)})},{});function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};return 3<=arguments.length&&(ctx.depth=arguments[2]),4<=arguments.length&&(ctx.colors=arguments[3]),isBoolean(opts)?ctx.showHidden=opts:opts&&exports._extend(ctx,opts),void 0===ctx.showHidden&&(ctx.showHidden=!1),void 0===ctx.depth&&(ctx.depth=2),void 0===ctx.colors&&(ctx.colors=!1),void 0===ctx.customInspect&&(ctx.customInspect=!0),ctx.colors&&(ctx.stylize=stylizeWithColor),formatValue(ctx,obj,ctx.depth)}function stylizeWithColor(str,styleType){styleType=inspect.styles[styleType];return styleType?"["+inspect.colors[styleType][0]+"m"+str+"["+inspect.colors[styleType][1]+"m":str}function stylizeNoColor(str,styleType){return str}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&(!value.constructor||value.constructor.prototype!==value))return isString(ret=value.inspect(recurseTimes,ctx))?ret:formatValue(ctx,ret,recurseTimes);var ret=((ctx,value)=>{var simple;return void 0===value?ctx.stylize("undefined","undefined"):isString(value)?(simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'",ctx.stylize(simple,"string")):isNumber(value)?ctx.stylize(""+value,"number"):isBoolean(value)?ctx.stylize(""+value,"boolean"):null===value?ctx.stylize("null","null"):void 0})(ctx,value);if(ret)return ret;var hash,ret=Object.keys(value),visibleKeys=(hash={},ret.forEach(function(val,idx){hash[val]=!0}),hash);if(ctx.showHidden&&(ret=Object.getOwnPropertyNames(value)),isError(value)&&(0<=ret.indexOf("message")||0<=ret.indexOf("description")))return formatError(value);if(0===ret.length){if(isFunction(value))return name=value.name?": "+value.name:"",ctx.stylize("[Function"+name+"]","special");if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),"regexp");if(isDate(value))return ctx.stylize(Date.prototype.toString.call(value),"date");if(isError(value))return formatError(value)}var output,name="",array=!1,braces=["{","}"];return isArray(value)&&(array=!0,braces=["[","]"]),isFunction(value)&&(name=" [Function"+(value.name?": "+value.name:"")+"]"),isRegExp(value)&&(name=" "+RegExp.prototype.toString.call(value)),isDate(value)&&(name=" "+Date.prototype.toUTCString.call(value)),isError(value)&&(name=" "+formatError(value)),0!==ret.length||array&&0!=value.length?recurseTimes<0?isRegExp(value)?ctx.stylize(RegExp.prototype.toString.call(value),"regexp"):ctx.stylize("[Object]","special"):(ctx.seen.push(value),output=array?((ctx,value,recurseTimes,visibleKeys,keys)=>{for(var output=[],i=0,l=value.length;i<l;++i)hasOwnProperty(value,String(i))?output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),!0)):output.push("");return keys.forEach(function(key){key.match(/^\d+$/)||output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,!0))}),output})(ctx,value,recurseTimes,visibleKeys,ret):ret.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)}),ctx.seen.pop(),((output,base,braces)=>60<output.reduce(function(prev,cur){return cur.indexOf("\n"),prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0)?braces[0]+(""===base?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]:braces[0]+base+" "+output.join(", ")+" "+braces[1])(output,name,braces)):braces[0]+name+braces[1]}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,value=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]};if(value.get?str=value.set?ctx.stylize("[Getter/Setter]","special"):ctx.stylize("[Getter]","special"):value.set&&(str=ctx.stylize("[Setter]","special")),hasOwnProperty(visibleKeys,key)||(name="["+key+"]"),str||(ctx.seen.indexOf(value.value)<0?-1<(str=formatValue(ctx,value.value,null===recurseTimes?null:recurseTimes-1)).indexOf("\n")&&(str=array?str.split("\n").map(function(line){return" "+line}).join("\n").substr(2):"\n"+str.split("\n").map(function(line){return" "+line}).join("\n")):str=ctx.stylize("[Circular]","special")),void 0===name){if(array&&key.match(/^\d+$/))return str;name=(name=JSON.stringify(""+key)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(name=name.substr(1,name.length-2),ctx.stylize(name,"name")):(name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),ctx.stylize(name,"string"))}return name+": "+str}function isArray(ar){return Array.isArray(ar)}function isBoolean(arg){return"boolean"==typeof arg}function isNumber(arg){return"number"==typeof arg}function isString(arg){return"string"==typeof arg}function isRegExp(re){return isObject(re)&&"[object RegExp]"===objectToString(re)}function isObject(arg){return"object"==typeof arg&&null!==arg}function isDate(d){return isObject(d)&&"[object Date]"===objectToString(d)}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function isFunction(arg){return"function"==typeof arg}function objectToString(o){return Object.prototype.toString.call(o)}function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}exports.debuglog=function(set){return void 0===debugEnviron&&(debugEnviron=process.env.NODE_DEBUG||""),set=set.toUpperCase(),debugs[set]||(new RegExp("\\b"+set+"\\b","i").test(debugEnviron)?(process.pid,debugs[set]=function(){exports.format.apply(exports,arguments)}):debugs[set]=function(){}),debugs[set]},(exports.inspect=inspect).colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},exports.isArray=isArray,exports.isBoolean=isBoolean,exports.isNull=function(arg){return null===arg},exports.isNullOrUndefined=function(arg){return null==arg},exports.isNumber=isNumber,exports.isString=isString,exports.isSymbol=function(arg){return"symbol"==typeof arg},exports.isUndefined=function(arg){return void 0===arg},exports.isRegExp=isRegExp,exports.isObject=isObject,exports.isDate=isDate,exports.isError=isError,exports.isFunction=isFunction,exports.isPrimitive=function(arg){return null===arg||"boolean"==typeof arg||"number"==typeof arg||"string"==typeof arg||"symbol"==typeof arg||void 0===arg},exports.isBuffer=_dereq_("./support/isBuffer"),exports.log=function(){},exports.inherits=_dereq_("inherits"),exports._extend=function(origin,add){if(add&&isObject(add))for(var keys=Object.keys(add),i=keys.length;i--;)origin[keys[i]]=add[keys[i]];return origin}}.call(this)}.call(this,_dereq_("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":49,_process:63,inherits:48}],51:[function(_dereq_,module,exports){var _Buffer=_dereq_("safe-buffer").Buffer;module.exports=function(ALPHABET){if(255<=ALPHABET.length)throw new TypeError("Alphabet too long");for(var BASE_MAP=new Uint8Array(256),j=0;j<BASE_MAP.length;j++)BASE_MAP[j]=255;for(var i=0;i<ALPHABET.length;i++){var x=ALPHABET.charAt(i),xc=x.charCodeAt(0);if(255!==BASE_MAP[xc])throw new TypeError(x+" is ambiguous");BASE_MAP[xc]=i}var BASE=ALPHABET.length,LEADER=ALPHABET.charAt(0),FACTOR=Math.log(BASE)/Math.log(256),iFACTOR=Math.log(256)/Math.log(BASE);function decodeUnsafe(source){if("string"!=typeof source)throw new TypeError("Expected String");if(0===source.length)return _Buffer.alloc(0);for(var psz=0,zeroes=0,length=0;source[psz]===LEADER;)zeroes++,psz++;for(var size=(source.length-psz)*FACTOR+1>>>0,b256=new Uint8Array(size);psz<source.length;){var charCode=source.charCodeAt(psz);if(255<charCode)return;var carry=BASE_MAP[charCode];if(255===carry)return;for(var i=0,it3=size-1;(0!==carry||i<length)&&-1!==it3;it3--,i++)carry+=BASE*b256[it3]>>>0,b256[it3]=carry%256>>>0,carry=carry/256>>>0;if(0!==carry)throw new Error("Non-zero carry");length=i,psz++}for(var it4=size-length;it4!==size&&0===b256[it4];)it4++;for(var vch=_Buffer.allocUnsafe(zeroes+(size-it4)),j=(vch.fill(0,0,zeroes),zeroes);it4!==size;)vch[j++]=b256[it4++];return vch}return{encode:function(source){if((Array.isArray(source)||source instanceof Uint8Array)&&(source=_Buffer.from(source)),!_Buffer.isBuffer(source))throw new TypeError("Expected Buffer");if(0===source.length)return"";for(var zeroes=0,length=0,pbegin=0,pend=source.length;pbegin!==pend&&0===source[pbegin];)pbegin++,zeroes++;for(var size=(pend-pbegin)*iFACTOR+1>>>0,b58=new Uint8Array(size);pbegin!==pend;){for(var carry=source[pbegin],i=0,it1=size-1;(0!==carry||i<length)&&-1!==it1;it1--,i++)carry+=256*b58[it1]>>>0,b58[it1]=carry%BASE>>>0,carry=carry/BASE>>>0;if(0!==carry)throw new Error("Non-zero carry");length=i,pbegin++}for(var it2=size-length;it2!==size&&0===b58[it2];)it2++;for(var str=LEADER.repeat(zeroes);it2<size;++it2)str+=ALPHABET.charAt(b58[it2]);return str},decodeUnsafe:decodeUnsafe,decode:function(string){string=decodeUnsafe(string);if(string)return string;throw new Error("Non-base"+BASE+" character")}}}},{"safe-buffer":64}],52:[function(_dereq_,module,exports){exports.byteLength=function(b64){var b64=getLens(b64),validLen=b64[0],b64=b64[1];return 3*(validLen+b64)/4-b64},exports.toByteArray=function(b64){for(var tmp,lens=getLens(b64),validLen=lens[0],lens=lens[1],arr=new Arr(((validLen,placeHoldersLen)=>3*(validLen+placeHoldersLen)/4-placeHoldersLen)(validLen,lens)),curByte=0,len=0<lens?validLen-4:validLen,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;return 2===lens&&(tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4,arr[curByte++]=255&tmp),1===lens&&(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),arr},exports.fromByteArray=function(uint8){for(var tmp,len=uint8.length,extraBytes=len%3,parts=[],i=0,len2=len-extraBytes;i<len2;i+=16383)parts.push(((uint8,start,end)=>{for(var tmp,output=[],i=start;i<end;i+=3)tmp=(uint8[i]<<16&16711680)+(uint8[i+1]<<8&65280)+(255&uint8[i+2]),output.push(lookup[tmp>>18&63]+lookup[tmp>>12&63]+lookup[tmp>>6&63]+lookup[63&tmp]);return output.join("")})(uint8,i,len2<i+16383?len2:i+16383));return 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]+"=")),parts.join("")};for(var lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i<len;++i)lookup[i]=code[i],revLookup[code.charCodeAt(i)]=i;function getLens(b64){var len=b64.length;if(0<len%4)throw new Error("Invalid string. Length must be a multiple of 4");b64=b64.indexOf("="),len=(b64=-1===b64?len:b64)===len?0:4-b64%4;return[b64,len]}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63},{}],53:[function(_dereq_,module,exports){},{}],54:[function(_dereq_,module,exports){_dereq_=_dereq_("base-x");module.exports=_dereq_("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},{"base-x":51}],55:[function(_dereq_,module,exports){!function(Buffer){!function(){var base64=_dereq_("base64-js"),ieee754=_dereq_("ieee754"),K_MAX_LENGTH=(exports.Buffer=Buffer,exports.SlowBuffer=function(length){return Buffer.alloc(+(length=+length!=length?0:length))},exports.INSPECT_MAX_BYTES=50,2147483647);function createBuffer(length){if(K_MAX_LENGTH<length)throw new RangeError('The value "'+length+'" is invalid for option "size"');length=new Uint8Array(length);return length.__proto__=Buffer.prototype,length}function Buffer(arg,encodingOrOffset,length){if("number"!=typeof arg)return from(arg,encodingOrOffset,length);if("string"==typeof encodingOrOffset)throw new TypeError('The "string" argument must be of type string. Received type number');return allocUnsafe(arg)}function from(value,encodingOrOffset,length){if("string"==typeof value)return((string,encoding)=>{var length,buf;if(Buffer.isEncoding(encoding="string"==typeof encodingOrOffset&&""!==encodingOrOffset?encodingOrOffset:"utf8"))return(string=(buf=createBuffer(length=0|byteLength(string,encoding))).write(string,encoding))!==length?buf.slice(0,string):buf;throw new TypeError("Unknown encoding: "+encoding)})(value);if(ArrayBuffer.isView(value))return fromArrayLike(value);if(null==value)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof value);if(isInstance(value,ArrayBuffer)||value&&isInstance(value.buffer,ArrayBuffer))return((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');return(array=void 0===byteOffset&&void 0===length?new Uint8Array(array):void 0===length?new Uint8Array(array,byteOffset):new Uint8Array(array,byteOffset,length)).__proto__=Buffer.prototype,array})(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 buf,len=Buffer.isBuffer(valueOf=value)?(0!==(buf=createBuffer(len=0|checked(valueOf.length))).length&&valueOf.copy(buf,0,0,len),buf):void 0!==valueOf.length?"number"!=typeof valueOf.length||numberIsNaN(valueOf.length)?createBuffer(0):fromArrayLike(valueOf):"Buffer"===valueOf.type&&Array.isArray(valueOf.data)?fromArrayLike(valueOf.data):void 0;if(len)return len;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 "+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 checked(length){if(K_MAX_LENGTH<=length)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K_MAX_LENGTH.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 '+typeof string);var len=string.length,mustMatch=2<arguments.length&&!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((start=void 0===start||start<0?0:start)>this.length)return"";if((end=void 0===end||end>this.length?this.length:end)<=0)return"";if((end>>>=0)<=(start>>>=0))return"";for(encoding=encoding||"utf8";;)switch(encoding){case"hex":return((buf,start,end)=>{var len=buf.length;(!end||end<0||len<end)&&(end=len);for(var n,out="",i=!start||start<0?0:start;i<end;++i)out+=(n=buf[i])<16?"0"+n.toString(16):n.toString(16);return out})(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return((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})(this,start,end);case"latin1":case"binary":return((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})(this,start,end);case"base64":return((buf,start,end)=>0===start&&end===buf.length?base64.fromByteArray(buf):base64.fromByteArray(buf.slice(start,end)))(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return((buf,start,end)=>{for(var bytes=buf.slice(start,end),res="",i=0;i<bytes.length;i+=2)res+=String.fromCharCode(bytes[i]+256*bytes[i+1]);return res})(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):2147483647<byteOffset?byteOffset=2147483647:byteOffset<-2147483648&&(byteOffset=-2147483648),(byteOffset=numberIsNaN(byteOffset=+byteOffset)?dir?0:buffer.length-1:byteOffset)<0&&(byteOffset=buffer.length+byteOffset),buffer.length<=byteOffset){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: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 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;arrLength/=indexSize=2,valLength/=2,byteOffset/=2}function read(buf,i){return 1===indexSize?buf[i]:buf.readUInt16BE(i*indexSize)}if(dir)for(var foundIndex=-1,i=byteOffset;i<arrLength;i++)if(read(arr,i)===read(val,-1===foundIndex?0:i-foundIndex)){if(i-(foundIndex=-1===foundIndex?i:foundIndex)+1===valLength)return foundIndex*indexSize}else-1!==foundIndex&&(i-=i-foundIndex),foundIndex=-1;else for(i=byteOffset=arrLength<byteOffset+valLength?arrLength-valLength:byteOffset;0<=i;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 asciiWrite(buf,string,offset,length){return blitBuffer((str=>{for(var byteArray=[],i=0;i<str.length;++i)byteArray.push(255&str.charCodeAt(i));return byteArray})(string),buf,offset,length)}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=239<firstByte?4:223<firstByte?3:191<firstByte?2:1;if(i+bytesPerSequence<=end)switch(bytesPerSequence){case 1:firstByte<128&&(codePoint=firstByte);break;case 2:128==(192&(secondByte=buf[i+1]))&&127<(tempCodePoint=(31&firstByte)<<6|63&secondByte)&&(codePoint=tempCodePoint);break;case 3:secondByte=buf[i+1],thirdByte=buf[i+2],128==(192&secondByte)&&128==(192&thirdByte)&&2047<(tempCodePoint=(15&firstByte)<<12|(63&secondByte)<<6|63&thirdByte)&&(tempCodePoint<55296||57343<tempCodePoint)&&(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)&&65535<(tempCodePoint=(15&firstByte)<<18|(63&secondByte)<<12|(63&thirdByte)<<6|63&fourthByte)&&tempCodePoint<1114112&&(codePoint=tempCodePoint)}null===codePoint?(codePoint=65533,bytesPerSequence=1):65535<codePoint&&(res.push((codePoint-=65536)>>>10&1023|55296),codePoint=56320|1023&codePoint),res.push(codePoint),i+=bytesPerSequence}return(codePoints=>{var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,codePoints);for(var res="",i=0;i<len;)res+=String.fromCharCode.apply(String,codePoints.slice(i,i+=MAX_ARGUMENTS_LENGTH));return res})(res)}exports.kMaxLength=K_MAX_LENGTH,Buffer.TYPED_ARRAY_SUPPORT=(()=>{try{var arr=new Uint8Array(1);return arr.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===arr.foo()}catch(e){return!1}})(),Object.defineProperty(Buffer.prototype,"parent",{enumerable:!0,get:function(){if(Buffer.isBuffer(this))return this.buffer}}),Object.defineProperty(Buffer.prototype,"offset",{enumerable:!0,get:function(){if(Buffer.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&Buffer[Symbol.species]===Buffer&&Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),Buffer.poolSize=8192,Buffer.from=from,Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,Buffer.alloc=function(size,fill,encoding){return((size,fill,encoding)=>(assertSize(size),size<=0||void 0===fill?createBuffer(size):"string"==typeof encoding?createBuffer(size).fill(fill,encoding):createBuffer(size).fill(fill)))(size,fill,encoding)},Buffer.allocUnsafe=allocUnsafe,Buffer.allocUnsafeSlow=allocUnsafe,Buffer.isBuffer=function(b){return null!=b&&!0===b._isBuffer&&b!==Buffer.prototype},Buffer.compare=function(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(encoding){switch(String(encoding).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer.concat=function(list,length){if(!Array.isArray(list))throw new TypeError('"list" argument must be an Array of Buffers');if(0===list.length)return Buffer.alloc(0);if(void 0===length)for(i=length=0;i<list.length;++i)length+=list[i].length;for(var buffer=Buffer.allocUnsafe(length),pos=0,i=0;i<list.length;++i){var buf=list[i];if(isInstance(buf,Uint8Array)&&(buf=Buffer.from(buf)),!Buffer.isBuffer(buf))throw new TypeError('"list" argument must be an Array of Buffers');buf.copy(buffer,pos),pos+=buf.length}return buffer},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function(){var len=this.length;if(len%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var i=0;i<len;i+=2)swap(this,i,i+1);return this},Buffer.prototype.swap32=function(){var len=this.length;if(len%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var i=0;i<len;i+=4)swap(this,i,i+3),swap(this,i+1,i+2);return this},Buffer.prototype.swap64=function(){var len=this.length;if(len%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var i=0;i<len;i+=8)swap(this,i,i+7),swap(this,i+1,i+6),swap(this,i+2,i+5),swap(this,i+3,i+4);return this},Buffer.prototype.toLocaleString=Buffer.prototype.toString=function(){var length=this.length;return 0===length?"":0===arguments.length?utf8Slice(this,0,length):slowToString.apply(this,arguments)},Buffer.prototype.equals=function(b){if(Buffer.isBuffer(b))return this===b||0===Buffer.compare(this,b);throw new TypeError("Argument must be a Buffer")},Buffer.prototype.inspect=function(){var str="",max=exports.INSPECT_MAX_BYTES,str=this.toString("hex",0,max).replace(/(.{2})/g,"$1 ").trim();return this.length>max&&(str+=" ... "),"<Buffer "+str+">"},Buffer.prototype.compare=function(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 '+typeof target);if(void 0===end&&(end=target?target.length:0),void 0===thisStart&&(thisStart=0),void 0===thisEnd&&(thisEnd=this.length),(start=void 0===start?0:start)<0||end>target.length||thisStart<0||thisEnd>this.length)throw new RangeError("out of range index");if(thisEnd<=thisStart&&end<=start)return 0;if(thisEnd<=thisStart)return-1;if(end<=start)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(val,byteOffset,encoding){return-1!==this.indexOf(val,byteOffset,encoding)},Buffer.prototype.indexOf=function(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,!0)},Buffer.prototype.lastIndexOf=function(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,!1)},Buffer.prototype.write=function(string,offset,length,encoding){if(void 0===offset)encoding="utf8",length=this.length,offset=0;else if(void 0===length&&"string"==typeof offset)encoding=offset,length=this.length,offset=0;else{if(!isFinite(offset))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");offset>>>=0,isFinite(length)?(length>>>=0,void 0===encoding&&(encoding="utf8")):(encoding=length,length=void 0)}var remaining=this.length-offset;if((void 0===length||remaining<length)&&(length=remaining),0<string.length&&(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((buf,string,offset,length)=>{offset=Number(offset)||0;var remaining=buf.length-offset,remaining=((!length||remaining<(length=Number(length)))&&(length=remaining),string.length);remaining/2<length&&(length=remaining/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})(this,string,offset,length);case"utf8":case"utf-8":return((buf,string,offset,length)=>blitBuffer(utf8ToBytes(string,buf.length-offset),buf,offset,length))(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return asciiWrite(this,string,offset,length);case"base64":return((buf,string,offset,length)=>blitBuffer(base64ToBytes(string),buf,offset,length))(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return((buf,string,offset,length)=>blitBuffer(((str,units)=>{for(var c,hi,byteArray=[],i=0;i<str.length&&!((units-=2)<0);++i)hi=(c=str.charCodeAt(i))>>8,byteArray.push(c%256),byteArray.push(hi);return byteArray})(string,buf.length-offset),buf,offset,length))(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase(),loweredCase=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;function checkOffset(offset,ext,length){if(offset%1!=0||offset<0)throw new RangeError("offset is not uint");if(length<offset+ext)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(max<value||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){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(start,end){var len=this.length,len=((start=~~start)<0?(start+=len)<0&&(start=0):len<start&&(start=len),(end=void 0===end?len:~~end)<0?(end+=len)<0&&(end=0):len<end&&(end=len),end<start&&(end=start),this.subarray(start,end));return len.__proto__=Buffer.prototype,len},Buffer.prototype.readUIntLE=function(offset,byteLength,noAssert){offset>>>=0,byteLength>>>=0,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset],mul=1,i=0;++i<byteLength&&(mul*=256);)val+=this[offset+i]*mul;return val},Buffer.prototype.readUIntBE=function(offset,byteLength,noAssert){offset>>>=0,byteLength>>>=0,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset+--byteLength],mul=1;0<byteLength&&(mul*=256);)val+=this[offset+--byteLength]*mul;return val},Buffer.prototype.readUInt8=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,1,this.length),this[offset]},Buffer.prototype.readUInt16LE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,2,this.length),this[offset]|this[offset+1]<<8},Buffer.prototype.readUInt16BE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,2,this.length),this[offset]<<8|this[offset+1]},Buffer.prototype.readUInt32LE=function(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=function(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(offset,byteLength,noAssert){offset>>>=0,byteLength>>>=0,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset],mul=1,i=0;++i<byteLength&&(mul*=256);)val+=this[offset+i]*mul;return(mul*=128)<=val&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readIntBE=function(offset,byteLength,noAssert){offset>>>=0,byteLength>>>=0,noAssert||checkOffset(offset,byteLength,this.length);for(var i=byteLength,mul=1,val=this[offset+--i];0<i&&(mul*=256);)val+=this[offset+--i]*mul;return(mul*=128)<=val&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readInt8=function(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(offset,noAssert){offset>>>=0,noAssert||checkOffset(offset,2,this.length);noAssert=this[offset]|this[offset+1]<<8;return 32768&noAssert?4294901760|noAssert:noAssert},Buffer.prototype.readInt16BE=function(offset,noAssert){offset>>>=0,noAssert||checkOffset(offset,2,this.length);noAssert=this[offset+1]|this[offset]<<8;return 32768&noAssert?4294901760|noAssert:noAssert},Buffer.prototype.readInt32LE=function(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(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(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!0,23,4)},Buffer.prototype.readFloatBE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!1,23,4)},Buffer.prototype.readDoubleLE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!0,52,8)},Buffer.prototype.readDoubleBE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!1,52,8)},Buffer.prototype.writeUIntLE=function(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=function(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;0<=--i&&(mul*=256);)this[offset+i]=value/mul&255;return offset+byteLength},Buffer.prototype.writeUInt8=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,1,255,0),this[offset]=255&value,offset+1},Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,2,65535,0),this[offset]=255&value,this[offset+1]=value>>>8,offset+2},Buffer.prototype.writeUInt16BE=function(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=function(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=function(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(value,offset,byteLength,noAssert){value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,byteLength,(noAssert=Math.pow(2,8*byteLength-1))-1,-noAssert);var i=0,mul=1,sub=0;for(this[offset]=255&value;++i<byteLength&&(mul*=256);)value<0&&0===sub&&0!==this[offset+i-1]&&(sub=1),this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength},Buffer.prototype.writeIntBE=function(value,offset,byteLength,noAssert){value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,byteLength,(noAssert=Math.pow(2,8*byteLength-1))-1,-noAssert);var i=byteLength-1,mul=1,sub=0;for(this[offset+i]=255&value;0<=--i&&(mul*=256);)value<0&&0===sub&&0!==this[offset+i+1]&&(sub=1),this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength},Buffer.prototype.writeInt8=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,1,127,-128),this[offset]=255&(value=value<0?255+value+1:value),offset+1},Buffer.prototype.writeInt16LE=function(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(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(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(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),this[offset]=(value=value<0?4294967295+value+1:value)>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value,offset+4},Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,!0,noAssert)},Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,!1,noAssert)},Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,!0,noAssert)},Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,!1,noAssert)},Buffer.prototype.copy=function(target,targetStart,start,end){if(!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),(end=0<end&&end<start?start:end)===start)return 0;if(0===target.length||0===this.length)return 0;if((targetStart=targetStart||0)<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);var len=(end=target.length-targetStart<end-start?target.length-targetStart+start:end)-start;if(this===target&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(targetStart,start,end);else if(this===target&&start<targetStart&&targetStart<end)for(var i=len-1;0<=i;--i)target[i+targetStart]=this[i+start];else Uint8Array.prototype.set.call(target,this.subarray(start,end),targetStart);return len},Buffer.prototype.fill=function(val,start,end,encoding){if("string"==typeof val){if("string"==typeof start?(encoding=start,start=0,end=this.length):"string"==typeof end&&(encoding=end,end=this.length),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);var code;1===val.length&&(code=val.charCodeAt(0),"utf8"===encoding&&code<128||"latin1"===encoding)&&(val=code)}else"number"==typeof val&&(val&=255);if(start<0||this.length<start||this.length<end)throw new RangeError("Out of range index");var i;if(!(end<=start))if(start>>>=0,end=void 0===end?this.length:end>>>0,"number"==typeof(val=val||0))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){units=units||Infinity;for(var codePoint,length=string.length,leadSurrogate=null,bytes=[],i=0;i<length;++i){if(55295<(codePoint=string.charCodeAt(i))&&codePoint<57344){if(!leadSurrogate){if(56319<codePoint){-1<(units-=3)&&bytes.push(239,191,189);continue}if(i+1===length){-1<(units-=3)&&bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){-1<(units-=3)&&bytes.push(239,191,189),leadSurrogate=codePoint;continue}codePoint=65536+(leadSurrogate-55296<<10|codePoint-56320)}else leadSurrogate&&-1<(units-=3)&&bytes.push(239,191,189);if(leadSurrogate=null,codePoint<128){if(--units<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 base64.toByteArray((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}}.call(this)}.call(this,_dereq_("buffer").Buffer)},{"base64-js":52,buffer:55,ieee754:59}],56:[function(_dereq_,module,exports){var factory=function(Long){function ByteBuffer(capacity,littleEndian,noAssert){if(void 0===capacity&&(capacity=ByteBuffer.DEFAULT_CAPACITY),void 0===littleEndian&&(littleEndian=ByteBuffer.DEFAULT_ENDIAN),!(noAssert=void 0===noAssert?ByteBuffer.DEFAULT_NOASSERT:noAssert)){if((capacity|=0)<0)throw RangeError("Illegal capacity");littleEndian=!!littleEndian,noAssert=!!noAssert}this.buffer=0===capacity?EMPTY_BUFFER:new ArrayBuffer(capacity),this.view=0===capacity?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=capacity,this.littleEndian=littleEndian,this.noAssert=noAssert}ByteBuffer.VERSION="5.0.1",ByteBuffer.LITTLE_ENDIAN=!0,ByteBuffer.BIG_ENDIAN=!1,ByteBuffer.DEFAULT_CAPACITY=16,ByteBuffer.DEFAULT_ENDIAN=ByteBuffer.BIG_ENDIAN,ByteBuffer.DEFAULT_NOASSERT=!1,ByteBuffer.Long=Long||null;var ByteBufferPrototype=ByteBuffer.prototype,EMPTY_BUFFER=(ByteBufferPrototype.__isByteBuffer__,Object.defineProperty(ByteBufferPrototype,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),new ArrayBuffer(0)),stringFromCharCode=String.fromCharCode;function stringSource(s){var i=0;return function(){return i<s.length?s.charCodeAt(i++):null}}function stringDestination(){var cs=[],ps=[];return function(){if(0===arguments.length)return ps.join("")+stringFromCharCode.apply(String,cs);1024<cs.length+arguments.length&&(ps.push(stringFromCharCode.apply(String,cs)),cs.length=0),Array.prototype.push.apply(cs,arguments)}}function ieee754_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,nBytes=buffer[offset+i];for(i+=d,e=nBytes&(1<<-nBits)-1,nBytes>>=-nBits,nBits+=eLen;0<nBits;e=256*e+buffer[offset+i],i+=d,nBits-=8);for(m=e&(1<<-nBits)-1,e>>=-nBits,nBits+=mLen;0<nBits;m=256*m+buffer[offset+i],i+=d,nBits-=8);if(0===e)e=1-eBias;else{if(e===eMax)return m?NaN:Infinity*(nBytes?-1:1);m+=Math.pow(2,mLen),e-=eBias}return(nBytes?-1:1)*m*Math.pow(2,e-mLen)}function ieee754_write(buffer,value,offset,isLE,mLen,nBytes){var e,m,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,nBytes=value<0||0===value&&1/value<0?1:0;for(value=Math.abs(value),isNaN(value)||Infinity===value?(m=isNaN(value)?1:0,e=eMax):(e=Math.floor(Math.log(value)/Math.LN2),value*(isLE=Math.pow(2,-e))<1&&(e--,isLE*=2),2<=(value+=1<=e+eBias?rt/isLE:rt*Math.pow(2,1-eBias))*isLE&&(e++,isLE/=2),eMax<=e+eBias?(m=0,e=eMax):1<=e+eBias?(m=(value*isLE-1)*Math.pow(2,mLen),e+=eBias):(m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen),e=0));8<=mLen;buffer[offset+i]=255&m,i+=d,m/=256,mLen-=8);for(e=e<<mLen|m,eLen+=mLen;0<eLen;buffer[offset+i]=255&e,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=128*nBytes}ByteBuffer.accessor=function(){return Uint8Array},ByteBuffer.allocate=function(capacity,littleEndian,noAssert){return new ByteBuffer(capacity,littleEndian,noAssert)},ByteBuffer.concat=function(buffers,encoding,littleEndian,noAssert){"boolean"!=typeof encoding&&"string"==typeof encoding||(noAssert=littleEndian,littleEndian=encoding,encoding=void 0);for(var length,capacity=0,i=0,k=buffers.length;i<k;++i)ByteBuffer.isByteBuffer(buffers[i])||(buffers[i]=ByteBuffer.wrap(buffers[i],encoding)),0<(length=buffers[i].limit-buffers[i].offset)&&(capacity+=length);if(0===capacity)return new ByteBuffer(0,littleEndian,noAssert);for(var bi,bb=new ByteBuffer(capacity,littleEndian,noAssert),i=0;i<k;)(length=(bi=buffers[i++]).limit-bi.offset)<=0||(bb.view.set(bi.view.subarray(bi.offset,bi.limit),bb.offset),bb.offset+=length);return bb.limit=bb.offset,bb.offset=0,bb},ByteBuffer.isByteBuffer=function(bb){return!0===(bb&&bb.__isByteBuffer__)},ByteBuffer.type=function(){return ArrayBuffer},ByteBuffer.wrap=function(buffer,encoding,littleEndian,noAssert){if("string"!=typeof encoding&&(noAssert=littleEndian,littleEndian=encoding,encoding=void 0),"string"==typeof buffer)switch(encoding=void 0===encoding?"utf8":encoding){case"base64":return ByteBuffer.fromBase64(buffer,littleEndian);case"hex":return ByteBuffer.fromHex(buffer,littleEndian);case"binary":return ByteBuffer.fromBinary(buffer,littleEndian);case"utf8":return ByteBuffer.fromUTF8(buffer,littleEndian);case"debug":return ByteBuffer.fromDebug(buffer,littleEndian);default:throw Error("Unsupported encoding: "+encoding)}if(null===buffer||"object"!=typeof buffer)throw TypeError("Illegal buffer");var bb;if(ByteBuffer.isByteBuffer(buffer))(bb=ByteBufferPrototype.clone.call(buffer)).markedOffset=-1;else if(buffer instanceof Uint8Array)bb=new ByteBuffer(0,littleEndian,noAssert),0<buffer.length&&(bb.buffer=buffer.buffer,bb.offset=buffer.byteOffset,bb.limit=buffer.byteOffset+buffer.byteLength,bb.view=new Uint8Array(buffer.buffer));else if(buffer instanceof ArrayBuffer)bb=new ByteBuffer(0,littleEndian,noAssert),0<buffer.byteLength&&(bb.buffer=buffer,bb.offset=0,bb.limit=buffer.byteLength,bb.view=0<buffer.byteLength?new Uint8Array(buffer):null);else{if("[object Array]"!==Object.prototype.toString.call(buffer))throw TypeError("Illegal buffer");(bb=new ByteBuffer(buffer.length,littleEndian,noAssert)).limit=buffer.length;for(var i=0;i<buffer.length;++i)bb.view[i]=buffer[i]}return bb},ByteBufferPrototype.writeBitSet=function(value,offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if(!(value instanceof Array))throw TypeError("Illegal BitSet: Not an array");if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+0) <= "+this.buffer.byteLength)}var start=offset,bits=value.length,bytes=bits>>3,bit=0;for(offset+=this.writeVarint32(bits,offset);bytes--;)k=1&!!value[bit++]|(1&!!value[bit++])<<1|(1&!!value[bit++])<<2|(1&!!value[bit++])<<3|(1&!!value[bit++])<<4|(1&!!value[bit++])<<5|(1&!!value[bit++])<<6|(1&!!value[bit++])<<7,this.writeByte(k,offset++);if(bit<bits){for(var m=0,k=0;bit<bits;)k|=(1&!!value[bit++])<<m++;this.writeByte(k,offset++)}return relative?(this.offset=offset,this):offset-start},ByteBufferPrototype.readBitSet=function(offset){var relative=void 0===offset,ret=(relative&&(offset=this.offset),this.readVarint32(offset)),bits=ret.value,bytes=bits>>3,bit=0,value=[];for(offset+=ret.length;bytes--;)k=this.readByte(offset++),value[bit++]=!!(1&k),value[bit++]=!!(2&k),value[bit++]=!!(4&k),value[bit++]=!!(8&k),value[bit++]=!!(16&k),value[bit++]=!!(32&k),value[bit++]=!!(64&k),value[bit++]=!!(128&k);if(bit<bits)for(var m=0,k=this.readByte(offset++);bit<bits;)value[bit++]=!!(k>>m++&1);return relative&&(this.offset=offset),value},ByteBufferPrototype.readBytes=function(length,offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+length>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength)}offset=this.slice(offset,offset+length);return relative&&(this.offset+=length),offset},ByteBufferPrototype.writeBytes=ByteBufferPrototype.append,ByteBufferPrototype.writeInt8=function(value,offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof value||value%1!=0)throw TypeError("Illegal value: "+value+" (not an integer)");if(value|=0,"number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+0) <= "+this.buffer.byteLength)}var capacity0=this.buffer.byteLength;return capacity0<(offset+=1)&&this.resize((capacity0*=2)>offset?capacity0:offset),this.view[--offset]=value,relative&&(this.offset+=1),this},ByteBufferPrototype.writeByte=ByteBufferPrototype.writeInt8,ByteBufferPrototype.readInt8=function(offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+1) <= "+this.buffer.byteLength)}offset=this.view[offset];return 128==(128&offset)&&(offset=-(255-offset+1)),relative&&(this.offset+=1),offset},ByteBufferPrototype.readByte=ByteBufferPrototype.readInt8,ByteBufferPrototype.writeUint8=function(value,offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof value||value%1!=0)throw TypeError("Illegal value: "+value+" (not an integer)");if(value>>>=0,"number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+0) <= "+this.buffer.byteLength)}var capacity1=this.buffer.byteLength;return capacity1<(offset+=1)&&this.resize((capacity1*=2)>offset?capacity1:offset),this.view[--offset]=value,relative&&(this.offset+=1),this},ByteBufferPrototype.writeUInt8=ByteBufferPrototype.writeUint8,ByteBufferPrototype.readUint8=function(offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+1) <= "+this.buffer.byteLength)}offset=this.view[offset];return relative&&(this.offset+=1),offset},ByteBufferPrototype.readUInt8=ByteBufferPrototype.readUint8,ByteBufferPrototype.writeInt16=function(value,offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof value||value%1!=0)throw TypeError("Illegal value: "+value+" (not an integer)");if(value|=0,"number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+0) <= "+this.buffer.byteLength)}var capacity2=this.buffer.byteLength;return capacity2<(offset+=2)&&this.resize((capacity2*=2)>offset?capacity2:offset),offset-=2,this.littleEndian?(this.view[offset+1]=(65280&value)>>>8,this.view[offset]=255&value):(this.view[offset]=(65280&value)>>>8,this.view[offset+1]=255&value),relative&&(this.offset+=2),this},ByteBufferPrototype.writeShort=ByteBufferPrototype.writeInt16,ByteBufferPrototype.readInt16=function(offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+2) <= "+this.buffer.byteLength)}var value=0;return this.littleEndian?(value=this.view[offset],value|=this.view[offset+1]<<8):(value=this.view[offset]<<8,value|=this.view[offset+1]),32768==(32768&value)&&(value=-(65535-value+1)),relative&&(this.offset+=2),value},ByteBufferPrototype.readShort=ByteBufferPrototype.readInt16,ByteBufferPrototype.writeUint16=function(value,offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof value||value%1!=0)throw TypeError("Illegal value: "+value+" (not an integer)");if(value>>>=0,"number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+0) <= "+this.buffer.byteLength)}var capacity3=this.buffer.byteLength;return capacity3<(offset+=2)&&this.resize((capacity3*=2)>offset?capacity3:offset),offset-=2,this.littleEndian?(this.view[offset+1]=(65280&value)>>>8,this.view[offset]=255&value):(this.view[offset]=(65280&value)>>>8,this.view[offset+1]=255&value),relative&&(this.offset+=2),this},ByteBufferPrototype.writeUInt16=ByteBufferPrototype.writeUint16,ByteBufferPrototype.readUint16=function(offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+2) <= "+this.buffer.byteLength)}var value=0;return this.littleEndian?(value=this.view[offset],value|=this.view[offset+1]<<8):(value=this.view[offset]<<8,value|=this.view[offset+1]),relative&&(this.offset+=2),value},ByteBufferPrototype.readUInt16=ByteBufferPrototype.readUint16,ByteBufferPrototype.writeInt32=function(value,offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof value||value%1!=0)throw TypeError("Illegal value: "+value+" (not an integer)");if(value|=0,"number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+0) <= "+this.buffer.byteLength)}var capacity4=this.buffer.byteLength;return capacity4<(offset+=4)&&this.resize((capacity4*=2)>offset?capacity4:offset),offset-=4,this.littleEndian?(this.view[offset+3]=value>>>24&255,this.view[offset+2]=value>>>16&255,this.view[offset+1]=value>>>8&255,this.view[offset]=255&value):(this.view[offset]=value>>>24&255,this.view[offset+1]=value>>>16&255,this.view[offset+2]=value>>>8&255,this.view[offset+3]=255&value),relative&&(this.offset+=4),this},ByteBufferPrototype.writeInt=ByteBufferPrototype.writeInt32,ByteBufferPrototype.readInt32=function(offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+4) <= "+this.buffer.byteLength)}var value=0,value=this.littleEndian?(value=this.view[offset+2]<<16,(value=(value|=this.view[offset+1]<<8)|this.view[offset])+(this.view[offset+3]<<24>>>0)):(value=this.view[offset+1]<<16,(value=(value|=this.view[offset+2]<<8)|this.view[offset+3])+(this.view[offset]<<24>>>0));return value|=0,relative&&(this.offset+=4),value},ByteBufferPrototype.readInt=ByteBufferPrototype.readInt32,ByteBufferPrototype.writeUint32=function(value,offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof value||value%1!=0)throw TypeError("Illegal value: "+value+" (not an integer)");if(value>>>=0,"number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+0) <= "+this.buffer.byteLength)}var capacity5=this.buffer.byteLength;return capacity5<(offset+=4)&&this.resize((capacity5*=2)>offset?capacity5:offset),offset-=4,this.littleEndian?(this.view[offset+3]=value>>>24&255,this.view[offset+2]=value>>>16&255,this.view[offset+1]=value>>>8&255,this.view[offset]=255&value):(this.view[offset]=value>>>24&255,this.view[offset+1]=value>>>16&255,this.view[offset+2]=value>>>8&255,this.view[offset+3]=255&value),relative&&(this.offset+=4),this},ByteBufferPrototype.writeUInt32=ByteBufferPrototype.writeUint32,ByteBufferPrototype.readUint32=function(offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+4) <= "+this.buffer.byteLength)}var value=0,value=this.littleEndian?(value=this.view[offset+2]<<16,(value=(value|=this.view[offset+1]<<8)|this.view[offset])+(this.view[offset+3]<<24>>>0)):(value=this.view[offset+1]<<16,(value=(value|=this.view[offset+2]<<8)|this.view[offset+3])+(this.view[offset]<<24>>>0));return relative&&(this.offset+=4),value},ByteBufferPrototype.readUInt32=ByteBufferPrototype.readUint32,Long&&(ByteBufferPrototype.writeInt64=function(value,offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"==typeof value)value=Long.fromNumber(value);else if("string"==typeof value)value=Long.fromString(value);else if(!(value&&value instanceof Long))throw TypeError("Illegal value: "+value+" (not an integer or Long)");if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+0) <= "+this.buffer.byteLength)}"number"==typeof value?value=Long.fromNumber(value):"string"==typeof value&&(value=Long.fromString(value));var capacity6=this.buffer.byteLength,capacity6=(capacity6<(offset+=8)&&this.resize((capacity6*=2)>offset?capacity6:offset),offset-=8,value.low),value=value.high;return this.littleEndian?(this.view[offset+3]=capacity6>>>24&255,this.view[offset+2]=capacity6>>>16&255,this.view[offset+1]=capacity6>>>8&255,this.view[offset]=255&capacity6,this.view[(offset+=4)+3]=value>>>24&255,this.view[offset+2]=value>>>16&255,this.view[offset+1]=value>>>8&255,this.view[offset]=255&value):(this.view[offset]=value>>>24&255,this.view[offset+1]=value>>>16&255,this.view[offset+2]=value>>>8&255,this.view[offset+3]=255&value,this.view[offset+=4]=capacity6>>>24&255,this.view[offset+1]=capacity6>>>16&255,this.view[offset+2]=capacity6>>>8&255,this.view[offset+3]=255&capacity6),relative&&(this.offset+=8),this},ByteBufferPrototype.writeLong=ByteBufferPrototype.writeInt64,ByteBufferPrototype.readInt64=function(offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+8) <= "+this.buffer.byteLength)}var lo=0,hi=0,offset=(this.littleEndian?(lo=this.view[offset+2]<<16,lo=(lo=(lo|=this.view[offset+1]<<8)|this.view[offset])+(this.view[offset+3]<<24>>>0),hi=this.view[(offset+=4)+2]<<16,hi=(hi=(hi|=this.view[offset+1]<<8)|this.view[offset])+(this.view[offset+3]<<24>>>0)):(hi=this.view[offset+1]<<16,hi=(hi=(hi|=this.view[offset+2]<<8)|this.view[offset+3])+(this.view[offset]<<24>>>0),lo=this.view[(offset+=4)+1]<<16,lo=(lo=(lo|=this.view[offset+2]<<8)|this.view[offset+3])+(this.view[offset]<<24>>>0)),new Long(lo,hi,!1));return relative&&(this.offset+=8),offset},ByteBufferPrototype.readLong=ByteBufferPrototype.readInt64,ByteBufferPrototype.writeUint64=function(value,offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"==typeof value)value=Long.fromNumber(value);else if("string"==typeof value)value=Long.fromString(value);else if(!(value&&value instanceof Long))throw TypeError("Illegal value: "+value+" (not an integer or Long)");if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+0) <= "+this.buffer.byteLength)}"number"==typeof value?value=Long.fromNumber(value):"string"==typeof value&&(value=Long.fromString(value));var capacity7=this.buffer.byteLength,capacity7=(capacity7<(offset+=8)&&this.resize((capacity7*=2)>offset?capacity7:offset),offset-=8,value.low),value=value.high;return this.littleEndian?(this.view[offset+3]=capacity7>>>24&255,this.view[offset+2]=capacity7>>>16&255,this.view[offset+1]=capacity7>>>8&255,this.view[offset]=255&capacity7,this.view[(offset+=4)+3]=value>>>24&255,this.view[offset+2]=value>>>16&255,this.view[offset+1]=value>>>8&255,this.view[offset]=255&value):(this.view[offset]=value>>>24&255,this.view[offset+1]=value>>>16&255,this.view[offset+2]=value>>>8&255,this.view[offset+3]=255&value,this.view[offset+=4]=capacity7>>>24&255,this.view[offset+1]=capacity7>>>16&255,this.view[offset+2]=capacity7>>>8&255,this.view[offset+3]=255&capacity7),relative&&(this.offset+=8),this},ByteBufferPrototype.writeUInt64=ByteBufferPrototype.writeUint64,ByteBufferPrototype.readUint64=function(offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+8) <= "+this.buffer.byteLength)}var lo=0,hi=0,offset=(this.littleEndian?(lo=this.view[offset+2]<<16,lo=(lo=(lo|=this.view[offset+1]<<8)|this.view[offset])+(this.view[offset+3]<<24>>>0),hi=this.view[(offset+=4)+2]<<16,hi=(hi=(hi|=this.view[offset+1]<<8)|this.view[offset])+(this.view[offset+3]<<24>>>0)):(hi=this.view[offset+1]<<16,hi=(hi=(hi|=this.view[offset+2]<<8)|this.view[offset+3])+(this.view[offset]<<24>>>0),lo=this.view[(offset+=4)+1]<<16,lo=(lo=(lo|=this.view[offset+2]<<8)|this.view[offset+3])+(this.view[offset]<<24>>>0)),new Long(lo,hi,!0));return relative&&(this.offset+=8),offset},ByteBufferPrototype.readUInt64=ByteBufferPrototype.readUint64),ByteBufferPrototype.writeFloat32=function(value,offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof value)throw TypeError("Illegal value: "+value+" (not a number)");if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+0) <= "+this.buffer.byteLength)}var capacity8=this.buffer.byteLength;return capacity8<(offset+=4)&&this.resize((capacity8*=2)>offset?capacity8:offset),ieee754_write(this.view,value,offset-=4,this.littleEndian,23,4),relative&&(this.offset+=4),this},ByteBufferPrototype.writeFloat=ByteBufferPrototype.writeFloat32,ByteBufferPrototype.readFloat32=function(offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+4) <= "+this.buffer.byteLength)}offset=ieee754_read(this.view,offset,this.littleEndian,23,4);return relative&&(this.offset+=4),offset},ByteBufferPrototype.readFloat=ByteBufferPrototype.readFloat32,ByteBufferPrototype.writeFloat64=function(value,offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof value)throw TypeError("Illegal value: "+value+" (not a number)");if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+0) <= "+this.buffer.byteLength)}var capacity9=this.buffer.byteLength;return capacity9<(offset+=8)&&this.resize((capacity9*=2)>offset?capacity9:offset),ieee754_write(this.view,value,offset-=8,this.littleEndian,52,8),relative&&(this.offset+=8),this},ByteBufferPrototype.writeDouble=ByteBufferPrototype.writeFloat64,ByteBufferPrototype.readFloat64=function(offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+8) <= "+this.buffer.byteLength)}offset=ieee754_read(this.view,offset,this.littleEndian,52,8);return relative&&(this.offset+=8),offset},ByteBufferPrototype.readDouble=ByteBufferPrototype.readFloat64,ByteBuffer.MAX_VARINT32_BYTES=5,ByteBuffer.calculateVarint32=function(value){return(value>>>=0)<128?1:value<16384?2:value<1<<21?3:value<1<<28?4:5},ByteBuffer.zigZagEncode32=function(n){return((n|=0)<<1^n>>31)>>>0},ByteBuffer.zigZagDecode32=function(n){return n>>>1^-(1&n)|0},ByteBufferPrototype.writeVarint32=function(value,offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof value||value%1!=0)throw TypeError("Illegal value: "+value+" (not an integer)");if(value|=0,"number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+0) <= "+this.buffer.byteLength)}var size=ByteBuffer.calculateVarint32(value),capacity10=this.buffer.byteLength;for(capacity10<(offset+=size)&&this.resize((capacity10*=2)>offset?capacity10:offset),offset-=size,value>>>=0;128<=value;)this.view[offset++]=127&value|128,value>>>=7;return this.view[offset++]=value,relative?(this.offset=offset,this):size},ByteBufferPrototype.writeVarint32ZigZag=function(value,offset){return this.writeVarint32(ByteBuffer.zigZagEncode32(value),offset)},ByteBufferPrototype.readVarint32=function(offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+1) <= "+this.buffer.byteLength)}var err,c=0,value=0;do{if(!this.noAssert&&offset>this.limit)throw(err=Error("Truncated")).truncated=!0,err}while(err=this.view[offset++],c<5&&(value|=(127&err)<<7*c),++c,0!=(128&err));return value|=0,relative?(this.offset=offset,value):{value:value,length:c}},ByteBufferPrototype.readVarint32ZigZag=function(offset){offset=this.readVarint32(offset);return"object"==typeof offset?offset.value=ByteBuffer.zigZagDecode32(offset.value):offset=ByteBuffer.zigZagDecode32(offset),offset},Long&&(ByteBuffer.MAX_VARINT64_BYTES=10,ByteBuffer.calculateVarint64=function(value){"number"==typeof value?value=Long.fromNumber(value):"string"==typeof value&&(value=Long.fromString(value));var part0=value.toInt()>>>0,part1=value.shiftRightUnsigned(28).toInt()>>>0,value=value.shiftRightUnsigned(56).toInt()>>>0;return 0==value?0==part1?part0<16384?part0<128?1:2:part0<1<<21?3:4:part1<16384?part1<128?5:6:part1<1<<21?7:8:value<128?9:10},ByteBuffer.zigZagEncode64=function(value){return"number"==typeof value?value=Long.fromNumber(value,!1):"string"==typeof value?value=Long.fromString(value,!1):!1!==value.unsigned&&(value=value.toSigned()),value.shiftLeft(1).xor(value.shiftRight(63)).toUnsigned()},ByteBuffer.zigZagDecode64=function(value){return"number"==typeof value?value=Long.fromNumber(value,!1):"string"==typeof value?value=Long.fromString(value,!1):!1!==value.unsigned&&(value=value.toSigned()),value.shiftRightUnsigned(1).xor(value.and(Long.ONE).toSigned().negate()).toSigned()},ByteBufferPrototype.writeVarint64=function(value,offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"==typeof value)value=Long.fromNumber(value);else if("string"==typeof value)value=Long.fromString(value);else if(!(value&&value instanceof Long))throw TypeError("Illegal value: "+value+" (not an integer or Long)");if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+0) <= "+this.buffer.byteLength)}"number"==typeof value?value=Long.fromNumber(value,!1):"string"==typeof value?value=Long.fromString(value,!1):!1!==value.unsigned&&(value=value.toSigned());var size=ByteBuffer.calculateVarint64(value),part0=value.toInt()>>>0,part1=value.shiftRightUnsigned(28).toInt()>>>0,part2=value.shiftRightUnsigned(56).toInt()>>>0,value=this.buffer.byteLength;switch(value<(offset+=size)&&this.resize((value*=2)>offset?value:offset),offset-=size,size){case 10:this.view[offset+9]=part2>>>7&1;case 9:this.view[offset+8]=9!==size?128|part2:127&part2;case 8:this.view[offset+7]=8!==size?part1>>>21|128:part1>>>21&127;case 7:this.view[offset+6]=7!==size?part1>>>14|128:part1>>>14&127;case 6:this.view[offset+5]=6!==size?part1>>>7|128:part1>>>7&127;case 5:this.view[offset+4]=5!==size?128|part1:127&part1;case 4:this.view[offset+3]=4!==size?part0>>>21|128:part0>>>21&127;case 3:this.view[offset+2]=3!==size?part0>>>14|128:part0>>>14&127;case 2:this.view[offset+1]=2!==size?part0>>>7|128:part0>>>7&127;case 1:this.view[offset]=1!==size?128|part0:127&part0}return relative?(this.offset+=size,this):size},ByteBufferPrototype.writeVarint64ZigZag=function(value,offset){return this.writeVarint64(ByteBuffer.zigZagEncode64(value),offset)},ByteBufferPrototype.readVarint64=function(offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+1) <= "+this.buffer.byteLength)}var start=offset,part0=0,part1=0,part2=0,part0=127&(b=this.view[offset++]);if(128&b&&(part0|=(127&(b=this.view[offset++]))<<7,128&b||this.noAssert&&void 0===b)&&(part0|=(127&(b=this.view[offset++]))<<14,128&b||this.noAssert&&void 0===b)&&(part0|=(127&(b=this.view[offset++]))<<21,128&b||this.noAssert&&void 0===b)&&(part1=127&(b=this.view[offset++]),128&b||this.noAssert&&void 0===b)&&(part1|=(127&(b=this.view[offset++]))<<7,128&b||this.noAssert&&void 0===b)&&(part1|=(127&(b=this.view[offset++]))<<14,128&b||this.noAssert&&void 0===b)&&(part1|=(127&(b=this.view[offset++]))<<21,128&b||this.noAssert&&void 0===b)&&(part2=127&(b=this.view[offset++]),128&b||this.noAssert&&void 0===b)&&(part2|=(127&(b=this.view[offset++]))<<7,128&b||this.noAssert&&void 0===b))throw Error("Buffer overrun");var b=Long.fromBits(part0|part1<<28,part1>>>4|part2<<24,!1);return relative?(this.offset=offset,b):{value:b,length:offset-start}},ByteBufferPrototype.readVarint64ZigZag=function(offset){offset=this.readVarint64(offset);return offset&&offset.value instanceof Long?offset.value=ByteBuffer.zigZagDecode64(offset.value):offset=ByteBuffer.zigZagDecode64(offset),offset}),ByteBufferPrototype.writeCString=function(str,offset){var relative=void 0===offset;relative&&(offset=this.offset);var i,k=str.length;if(!this.noAssert){if("string"!=typeof str)throw TypeError("Illegal str: Not a string");for(i=0;i<k;++i)if(0===str.charCodeAt(i))throw RangeError("Illegal str: Contains NULL-characters");if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+0) <= "+this.buffer.byteLength)}k=utfx.calculateUTF16asUTF8(stringSource(str))[1],offset+=k+1;var capacity12=this.buffer.byteLength;return capacity12<offset&&this.resize((capacity12*=2)>offset?capacity12:offset),offset-=k+1,utfx.encodeUTF16toUTF8(stringSource(str),function(b){this.view[offset++]=b}.bind(this)),this.view[offset++]=0,relative?(this.offset=offset,this):k},ByteBufferPrototype.readCString=function(offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+1) <= "+this.buffer.byteLength)}var sd,start=offset,b=-1;return utfx.decodeUTF8toUTF16(function(){if(0===b)return null;if(offset>=this.limit)throw RangeError("Illegal range: Truncated data, "+offset+" < "+this.limit);return 0===(b=this.view[offset++])?null:b}.bind(this),sd=stringDestination(),!0),relative?(this.offset=offset,sd()):{string:sd(),length:offset-start}},ByteBufferPrototype.writeIString=function(str,offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("string"!=typeof str)throw TypeError("Illegal str: Not a string");if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+0) <= "+this.buffer.byteLength)}var start=offset,k=utfx.calculateUTF16asUTF8(stringSource(str),this.noAssert)[1],capacity13=(offset+=4+k,this.buffer.byteLength);if(capacity13<offset&&this.resize((capacity13*=2)>offset?capacity13:offset),offset-=4+k,this.littleEndian?(this.view[offset+3]=k>>>24&255,this.view[offset+2]=k>>>16&255,this.view[offset+1]=k>>>8&255,this.view[offset]=255&k):(this.view[offset]=k>>>24&255,this.view[offset+1]=k>>>16&255,this.view[offset+2]=k>>>8&255,this.view[offset+3]=255&k),offset+=4,utfx.encodeUTF16toUTF8(stringSource(str),function(b){this.view[offset++]=b}.bind(this)),offset!==start+4+k)throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+4+k));return relative?(this.offset=offset,this):offset-start},ByteBufferPrototype.readIString=function(offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+4) <= "+this.buffer.byteLength)}var start=offset,len=this.readUint32(offset),len=this.readUTF8String(len,ByteBuffer.METRICS_BYTES,offset+=4);return offset+=len.length,relative?(this.offset=offset,len.string):{string:len.string,length:offset-start}},ByteBuffer.METRICS_CHARS="c",ByteBuffer.METRICS_BYTES="b",ByteBufferPrototype.writeUTF8String=function(str,offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+0) <= "+this.buffer.byteLength)}var start=offset,k=utfx.calculateUTF16asUTF8(stringSource(str))[1],capacity14=(offset+=k,this.buffer.byteLength);return capacity14<offset&&this.resize((capacity14*=2)>offset?capacity14:offset),offset-=k,utfx.encodeUTF16toUTF8(stringSource(str),function(b){this.view[offset++]=b}.bind(this)),relative?(this.offset=offset,this):offset-start},ByteBufferPrototype.writeString=ByteBufferPrototype.writeUTF8String,ByteBuffer.calculateUTF8Chars=function(str){return utfx.calculateUTF16asUTF8(stringSource(str))[0]},ByteBuffer.calculateString=ByteBuffer.calculateUTF8Bytes=function(str){return utfx.calculateUTF16asUTF8(stringSource(str))[1]},ByteBufferPrototype.readUTF8String=function(length,metrics,offset){"number"==typeof metrics&&(offset=metrics,metrics=void 0);var relative=void 0===offset;if(relative&&(offset=this.offset),void 0===metrics&&(metrics=ByteBuffer.METRICS_CHARS),!this.noAssert){if("number"!=typeof length||length%1!=0)throw TypeError("Illegal length: "+length+" (not an integer)");if(length|=0,"number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+0) <= "+this.buffer.byteLength)}var sd,i=0,start=offset;if(metrics===ByteBuffer.METRICS_CHARS){if(sd=stringDestination(),utfx.decodeUTF8(function(){return i<length&&offset<this.limit?this.view[offset++]:null}.bind(this),function(cp){++i,utfx.UTF8toUTF16(cp,sd)}),i!==length)throw RangeError("Illegal range: Truncated data, "+i+" == "+length)}else{if(metrics!==ByteBuffer.METRICS_BYTES)throw TypeError("Unsupported metrics: "+metrics);if(!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+length>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength)}var k=offset+length;if(utfx.decodeUTF8toUTF16(function(){return offset<k?this.view[offset++]:null}.bind(this),sd=stringDestination(),this.noAssert),offset!==k)throw RangeError("Illegal range: Truncated data, "+offset+" == "+k)}return relative?(this.offset=offset,sd()):{string:sd(),length:offset-start}},ByteBufferPrototype.readString=ByteBufferPrototype.readUTF8String,ByteBufferPrototype.writeVString=function(str,offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("string"!=typeof str)throw TypeError("Illegal str: Not a string");if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+0) <= "+this.buffer.byteLength)}var start=offset,k=utfx.calculateUTF16asUTF8(stringSource(str),this.noAssert)[1],l=ByteBuffer.calculateVarint32(k),capacity15=(offset+=l+k,this.buffer.byteLength);if(capacity15<offset&&this.resize((capacity15*=2)>offset?capacity15:offset),offset=(offset-=l+k)+this.writeVarint32(k,offset),utfx.encodeUTF16toUTF8(stringSource(str),function(b){this.view[offset++]=b}.bind(this)),offset!==start+k+l)throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+k+l));return relative?(this.offset=offset,this):offset-start},ByteBufferPrototype.readVString=function(offset){var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+1) <= "+this.buffer.byteLength)}var start=offset,len=this.readVarint32(offset),len=this.readUTF8String(len.value,ByteBuffer.METRICS_BYTES,offset+=len.length);return offset+=len.length,relative?(this.offset=offset,len.string):{string:len.string,length:offset-start}},ByteBufferPrototype.append=function(source,encoding,offset){"number"!=typeof encoding&&"string"==typeof encoding||(offset=encoding,encoding=void 0);var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+0) <= "+this.buffer.byteLength)}var capacity16,encoding=(source=source instanceof ByteBuffer?source:ByteBuffer.wrap(source,encoding)).limit-source.offset;return encoding<=0||((capacity16=this.buffer.byteLength)<(offset+=encoding)&&this.resize((capacity16*=2)>offset?capacity16:offset),offset-=encoding,this.view.set(source.view.subarray(source.offset,source.limit),offset),source.offset+=encoding,relative&&(this.offset+=encoding)),this},ByteBufferPrototype.appendTo=function(target,offset){return target.append(this,offset),this},ByteBufferPrototype.assert=function(assert){return this.noAssert=!assert,this},ByteBufferPrototype.capacity=function(){return this.buffer.byteLength},ByteBufferPrototype.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},ByteBufferPrototype.clone=function(copy){var bb=new ByteBuffer(0,this.littleEndian,this.noAssert);return copy?(bb.buffer=new ArrayBuffer(this.buffer.byteLength),bb.view=new Uint8Array(bb.buffer)):(bb.buffer=this.buffer,bb.view=this.view),bb.offset=this.offset,bb.markedOffset=this.markedOffset,bb.limit=this.limit,bb},ByteBufferPrototype.compact=function(begin,end){if(void 0===begin&&(begin=this.offset),void 0===end&&(end=this.limit),!this.noAssert){if("number"!=typeof begin||begin%1!=0)throw TypeError("Illegal begin: Not an integer");if(begin>>>=0,"number"!=typeof end||end%1!=0)throw TypeError("Illegal end: Not an integer");if(end>>>=0,begin<0||end<begin||end>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength)}var len,buffer,view;return 0===begin&&end===this.buffer.byteLength||(0==(len=end-begin)?(this.buffer=EMPTY_BUFFER,this.view=null,0<=this.markedOffset&&(this.markedOffset-=begin),this.offset=0,this.limit=0):(buffer=new ArrayBuffer(len),(view=new Uint8Array(buffer)).set(this.view.subarray(begin,end)),this.buffer=buffer,this.view=view,0<=this.markedOffset&&(this.markedOffset-=begin),this.offset=0,this.limit=len)),this},ByteBufferPrototype.copy=function(begin,end){if(void 0===begin&&(begin=this.offset),void 0===end&&(end=this.limit),!this.noAssert){if("number"!=typeof begin||begin%1!=0)throw TypeError("Illegal begin: Not an integer");if(begin>>>=0,"number"!=typeof end||end%1!=0)throw TypeError("Illegal end: Not an integer");if(end>>>=0,begin<0||end<begin||end>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength)}var capacity,bb;return begin===end?new ByteBuffer(0,this.littleEndian,this.noAssert):((bb=new ByteBuffer(capacity=end-begin,this.littleEndian,this.noAssert)).offset=0,bb.limit=capacity,0<=bb.markedOffset&&(bb.markedOffset-=begin),this.copyTo(bb,0,begin,end),bb)},ByteBufferPrototype.copyTo=function(target,targetOffset,sourceOffset,sourceLimit){var relative,targetRelative;if(!this.noAssert&&!ByteBuffer.isByteBuffer(target))throw TypeError("Illegal target: Not a ByteBuffer");if(targetOffset=(targetRelative=void 0===targetOffset)?target.offset:0|targetOffset,sourceOffset=(relative=void 0===sourceOffset)?this.offset:0|sourceOffset,sourceLimit=void 0===sourceLimit?this.limit:0|sourceLimit,targetOffset<0||targetOffset>target.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+targetOffset+" <= "+target.buffer.byteLength);if(sourceOffset<0||sourceLimit>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+sourceOffset+" <= "+this.buffer.byteLength);var len=sourceLimit-sourceOffset;return 0==len?target:(target.ensureCapacity(targetOffset+len),target.view.set(this.view.subarray(sourceOffset,sourceLimit),targetOffset),relative&&(this.offset+=len),targetRelative&&(target.offset+=len),this)},ByteBufferPrototype.ensureCapacity=function(capacity){var current=this.buffer.byteLength;return current<capacity?this.resize((current*=2)>capacity?current:capacity):this},ByteBufferPrototype.fill=function(value,begin,end){var relative=void 0===begin;if(relative&&(begin=this.offset),"string"==typeof value&&0<value.length&&(value=value.charCodeAt(0)),void 0===begin&&(begin=this.offset),void 0===end&&(end=this.limit),!this.noAssert){if("number"!=typeof value||value%1!=0)throw TypeError("Illegal value: "+value+" (not an integer)");if(value|=0,"number"!=typeof begin||begin%1!=0)throw TypeError("Illegal begin: Not an integer");if(begin>>>=0,"number"!=typeof end||end%1!=0)throw TypeError("Illegal end: Not an integer");if(end>>>=0,begin<0||end<begin||end>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength)}if(!(end<=begin)){for(;begin<end;)this.view[begin++]=value;relative&&(this.offset=begin)}return this},ByteBufferPrototype.flip=function(){return this.limit=this.offset,this.offset=0,this},ByteBufferPrototype.mark=function(offset){if(offset=void 0===offset?this.offset:offset,!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=offset,this},ByteBufferPrototype.order=function(littleEndian){if(this.noAssert||"boolean"==typeof littleEndian)return this.littleEndian=!!littleEndian,this;throw TypeError("Illegal littleEndian: Not a boolean")},ByteBufferPrototype.LE=function(littleEndian){return this.littleEndian=void 0===littleEndian||!!littleEndian,this},ByteBufferPrototype.BE=function(bigEndian){return this.littleEndian=void 0!==bigEndian&&!bigEndian,this},ByteBufferPrototype.prepend=function(source,encoding,offset){"number"!=typeof encoding&&"string"==typeof encoding||(offset=encoding,encoding=void 0);var relative=void 0===offset;if(relative&&(offset=this.offset),!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: "+offset+" (not an integer)");if((offset>>>=0)<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+0) <= "+this.buffer.byteLength)}var diff,buffer,view,encoding=(source=source instanceof ByteBuffer?source:ByteBuffer.wrap(source,encoding)).limit-source.offset;return encoding<=0||(0<(diff=encoding-offset)?(buffer=new ArrayBuffer(this.buffer.byteLength+diff),(view=new Uint8Array(buffer)).set(this.view.subarray(offset,this.buffer.byteLength),encoding),this.buffer=buffer,this.view=view,this.offset+=diff,0<=this.markedOffset&&(this.markedOffset+=diff),this.limit+=diff,offset+=diff):new Uint8Array(this.buffer),this.view.set(source.view.subarray(source.offset,source.limit),offset-encoding),source.offset=source.limit,relative&&(this.offset-=encoding)),this},ByteBufferPrototype.prependTo=function(target,offset){return target.prepend(this,offset),this},ByteBufferPrototype.printDebug=function(out){(out="function"!=typeof out?void 0:out)(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},ByteBufferPrototype.remaining=function(){return this.limit-this.offset},ByteBufferPrototype.reset=function(){return 0<=this.markedOffset?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},ByteBufferPrototype.resize=function(capacity){if(!this.noAssert){if("number"!=typeof capacity||capacity%1!=0)throw TypeError("Illegal capacity: "+capacity+" (not an integer)");if((capacity|=0)<0)throw RangeError("Illegal capacity: 0 <= "+capacity)}var view;return this.buffer.byteLength<capacity&&(capacity=new ArrayBuffer(capacity),(view=new Uint8Array(capacity)).set(this.view),this.buffer=capacity,this.view=view),this},ByteBufferPrototype.reverse=function(begin,end){if(void 0===begin&&(begin=this.offset),void 0===end&&(end=this.limit),!this.noAssert){if("number"!=typeof begin||begin%1!=0)throw TypeError("Illegal begin: Not an integer");if(begin>>>=0,"number"!=typeof end||end%1!=0)throw TypeError("Illegal end: Not an integer");if(end>>>=0,begin<0||end<begin||end>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength)}return begin!==end&&Array.prototype.reverse.call(this.view.subarray(begin,end)),this},ByteBufferPrototype.skip=function(length){if(!this.noAssert){if("number"!=typeof length||length%1!=0)throw TypeError("Illegal length: "+length+" (not an integer)");length|=0}var offset=this.offset+length;if(!this.noAssert&&(offset<0||offset>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+length+" <= "+this.buffer.byteLength);return this.offset=offset,this},ByteBufferPrototype.slice=function(begin,end){if(void 0===begin&&(begin=this.offset),void 0===end&&(end=this.limit),!this.noAssert){if("number"!=typeof begin||begin%1!=0)throw TypeError("Illegal begin: Not an integer");if(begin>>>=0,"number"!=typeof end||end%1!=0)throw TypeError("Illegal end: Not an integer");if(end>>>=0,begin<0||end<begin||end>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength)}var bb=this.clone();return bb.offset=begin,bb.limit=end,bb},ByteBufferPrototype.toBuffer=function(forceCopy){var offset=this.offset,limit=this.limit;if(!this.noAssert){if("number"!=typeof offset||offset%1!=0)throw TypeError("Illegal offset: Not an integer");if(offset>>>=0,"number"!=typeof limit||limit%1!=0)throw TypeError("Illegal limit: Not an integer");if(limit>>>=0,offset<0||limit<offset||limit>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+offset+" <= "+limit+" <= "+this.buffer.byteLength)}return forceCopy||0!==offset||limit!==this.buffer.byteLength?offset===limit?EMPTY_BUFFER:(forceCopy=new ArrayBuffer(limit-offset),new Uint8Array(forceCopy).set(new Uint8Array(this.buffer).subarray(offset,limit),0),forceCopy):this.buffer},ByteBufferPrototype.toArrayBuffer=ByteBufferPrototype.toBuffer,ByteBufferPrototype.toString=function(encoding,begin,end){if(void 0===encoding)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof encoding&&(end=begin=encoding="utf8"),encoding){case"utf8":return this.toUTF8(begin,end);case"base64":return this.toBase64(begin,end);case"hex":return this.toHex(begin,end);case"binary":return this.toBinary(begin,end);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+encoding)}};var lxiv=(()=>{for(var lxiv={},aout=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],ain=[],i=0,k=aout.length;i<k;++i)ain[aout[i]]=i;return lxiv.encode=function(src,dst){for(var b,t;null!==(b=src());)dst(aout[b>>2&63]),t=(3&b)<<4,null!==(b=src())?(dst(aout[63&((t|=b>>4&15)|b>>4&15)]),t=(15&b)<<2,null!==(b=src())?(dst(aout[63&(t|b>>6&3)]),dst(aout[63&b])):(dst(aout[63&t]),dst(61))):(dst(aout[63&t]),dst(61),dst(61))},lxiv.decode=function(src,dst){var c,t1,t2;function fail(c){throw Error("Illegal character code: "+c)}for(;null!==(c=src());)if(void 0===(t1=ain[c])&&fail(c),null!==(c=src())&&(void 0===(t2=ain[c])&&fail(c),dst(t1<<2>>>0|(48&t2)>>4),null!==(c=src()))){if(void 0===(t1=ain[c])){if(61===c)break;fail(c)}if(dst((15&t2)<<4>>>0|(60&t1)>>2),null!==(c=src())){if(void 0===(t2=ain[c])){if(61===c)break;fail(c)}dst((3&t1)<<6>>>0|t2)}}},lxiv.test=function(str){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(str)},lxiv})(),utfx=(ByteBufferPrototype.toBase64=function(begin,end){if(void 0===begin&&(begin=this.offset),void 0===end&&(end=this.limit),end|=0,(begin|=0)<0||end>this.capacity||end<begin)throw RangeError("begin, end");var sd;return lxiv.encode(function(){return begin<end?this.view[begin++]:null}.bind(this),sd=stringDestination()),sd()},ByteBuffer.fromBase64=function(str,littleEndian){if("string"!=typeof str)throw TypeError("str");var bb=new ByteBuffer(str.length/4*3,littleEndian),i=0;return lxiv.decode(stringSource(str),function(b){bb.view[i++]=b}),bb.limit=i,bb},ByteBuffer.btoa=function(str){return ByteBuffer.fromBinary(str).toBase64()},ByteBuffer.atob=function(b64){return ByteBuffer.fromBase64(b64).toBinary()},ByteBufferPrototype.toBinary=function(begin,end){if(void 0===begin&&(begin=this.offset),void 0===end&&(end=this.limit),end|=0,(begin|=0)<0||end>this.capacity()||end<begin)throw RangeError("begin, end");if(begin===end)return"";for(var chars=[],parts=[];begin<end;)chars.push(this.view[begin++]),1024<=chars.length&&(parts.push(String.fromCharCode.apply(String,chars)),chars=[]);return parts.join("")+String.fromCharCode.apply(String,chars)},ByteBuffer.fromBinary=function(str,littleEndian){if("string"!=typeof str)throw TypeError("str");for(var charCode,i=0,k=str.length,bb=new ByteBuffer(k,littleEndian);i<k;){if(255<(charCode=str.charCodeAt(i)))throw RangeError("illegal char code: "+charCode);bb.view[i++]=charCode}return bb.limit=k,bb},ByteBufferPrototype.toDebug=function(columns){for(var b,i=-1,k=this.buffer.byteLength,hex="",asc="",out="";i<k;){if(-1!==i&&(hex+=(b=this.view[i])<16?"0"+b.toString(16).toUpperCase():b.toString(16).toUpperCase(),columns)&&(asc+=32<b&&b<127?String.fromCharCode(b):"."),++i,columns&&0<i&&i%16==0&&i!==k){for(;hex.length<51;)hex+=" ";out+=hex+asc+"\n",hex=asc=""}i===this.offset&&i===this.limit?hex+=i===this.markedOffset?"!":"|":i===this.offset?hex+=i===this.markedOffset?"[":"<":i===this.limit?hex+=i===this.markedOffset?"]":">":hex+=i===this.markedOffset?"'":columns||0!==i&&i!==k?" ":""}if(columns&&" "!==hex){for(;hex.length<51;)hex+=" ";out+=hex+asc+"\n"}return columns?out:hex},ByteBuffer.fromDebug=function(str,littleEndian,noAssert){for(var ch,b,k=str.length,bb=new ByteBuffer((k+1)/3|0,littleEndian,noAssert),i=0,j=0,rs=!1,ho=!1,hm=!1,hl=!1,fail=!1;i<k;){switch(ch=str.charAt(i++)){case"!":if(!noAssert){if(ho||hm||hl){fail=!0;break}ho=hm=hl=!0}bb.offset=bb.markedOffset=bb.limit=j,rs=!1;break;case"|":if(!noAssert){if(ho||hl){fail=!0;break}ho=hl=!0}bb.offset=bb.limit=j,rs=!1;break;case"[":if(!noAssert){if(ho||hm){fail=!0;break}ho=hm=!0}bb.offset=bb.markedOffset=j,rs=!1;break;case"<":if(!noAssert){if(ho){fail=!0;break}ho=!0}bb.offset=j,rs=!1;break;case"]":if(!noAssert){if(hl||hm){fail=!0;break}hl=hm=!0}bb.limit=bb.markedOffset=j,rs=!1;break;case">":if(!noAssert){if(hl){fail=!0;break}hl=!0}bb.limit=j,rs=!1;break;case"'":if(!noAssert){if(hm){fail=!0;break}hm=!0}bb.markedOffset=j,rs=!1;break;case" ":rs=!1;break;default:if(!noAssert&&rs)fail=!0;else{if(b=parseInt(ch+str.charAt(i++),16),!noAssert&&(isNaN(b)||b<0||255<b))throw TypeError("Illegal str: Not a debug encoded string");bb.view[j++]=b,rs=!0}}if(fail)throw TypeError("Illegal str: Invalid symbol at "+i)}if(!noAssert){if(!ho||!hl)throw TypeError("Illegal str: Missing offset or limit");if(j<bb.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+j+" < "+k)}return bb},ByteBufferPrototype.toHex=function(begin,end){if(begin=void 0===begin?this.offset:begin,end=void 0===end?this.limit:end,!this.noAssert){if("number"!=typeof begin||begin%1!=0)throw TypeError("Illegal begin: Not an integer");if(begin>>>=0,"number"!=typeof end||end%1!=0)throw TypeError("Illegal end: Not an integer");if(end>>>=0,begin<0||end<begin||end>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength)}for(var b,out=new Array(end-begin);begin<end;)(b=this.view[begin++])<16?out.push("0",b.toString(16)):out.push(b.toString(16));return out.join("")},ByteBuffer.fromHex=function(str,littleEndian,noAssert){if(!noAssert){if("string"!=typeof str)throw TypeError("Illegal str: Not a string");if(str.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(var b,k=str.length,bb=new ByteBuffer(k/2|0,littleEndian),i=0,j=0;i<k;i+=2){if(b=parseInt(str.substring(i,i+2),16),!noAssert&&(!isFinite(b)||b<0||255<b))throw TypeError("Illegal str: Contains non-hex characters");bb.view[j++]=b}return bb.limit=j,bb},(()=>{var utfx={MAX_CODEPOINT:1114111,encodeUTF8:function(src,dst){var cp=null;for("number"==typeof src&&(cp=src,src=function(){return null});null!==cp||null!==(cp=src());)cp<128?dst(127&cp):(cp<2048?dst(cp>>6&31|192):(cp<65536?dst(cp>>12&15|224):(dst(cp>>18&7|240),dst(cp>>12&63|128)),dst(cp>>6&63|128)),dst(63&cp|128)),cp=null},decodeUTF8:function(src,dst){for(var a,b,c,d,fail=function(b){b=b.slice(0,b.indexOf(null));var err=Error(b.toString());throw err.name="TruncatedError",err.bytes=b,err};null!==(a=src());)if(0==(128&a))dst(a);else if(192==(224&a))null===(b=src())&&fail([a,b]),dst((31&a)<<6|63&b);else if(224==(240&a))null!==(b=src())&&null!==(c=src())||fail([a,b,c]),dst((15&a)<<12|(63&b)<<6|63&c);else{if(240!=(248&a))throw RangeError("Illegal starting byte: "+a);null!==(b=src())&&null!==(c=src())&&null!==(d=src())||fail([a,b,c,d]),dst((7&a)<<18|(63&b)<<12|(63&c)<<6|63&d)}},UTF16toUTF8:function(src,dst){for(var c1,c2=null;null!==(c1=null!==c2?c2:src());)55296<=c1&&c1<=57343&&null!==(c2=src())&&56320<=c2&&c2<=57343?(dst(1024*(c1-55296)+c2-56320+65536),c2=null):dst(c1);null!==c2&&dst(c2)},UTF8toUTF16:function(src,dst){var cp=null;for("number"==typeof src&&(cp=src,src=function(){return null});null!==cp||null!==(cp=src());)cp<=65535?dst(cp):(dst(55296+((cp-=65536)>>10)),dst(cp%1024+56320)),cp=null},encodeUTF16toUTF8:function(src,dst){utfx.UTF16toUTF8(src,function(cp){utfx.encodeUTF8(cp,dst)})},decodeUTF8toUTF16:function(src,dst){utfx.decodeUTF8(src,function(cp){utfx.UTF8toUTF16(cp,dst)})},calculateCodePoint:function(cp){return cp<128?1:cp<2048?2:cp<65536?3:4},calculateUTF8:function(src){for(var cp,l=0;null!==(cp=src());)l+=cp<128?1:cp<2048?2:cp<65536?3:4;return l},calculateUTF16asUTF8:function(src){var n=0,l=0;return utfx.UTF16toUTF8(src,function(cp){++n,l+=cp<128?1:cp<2048?2:cp<65536?3:4}),[n,l]}};return utfx})());return ByteBufferPrototype.toUTF8=function(begin,end){if(void 0===begin&&(begin=this.offset),void 0===end&&(end=this.limit),!this.noAssert){if("number"!=typeof begin||begin%1!=0)throw TypeError("Illegal begin: Not an integer");if(begin>>>=0,"number"!=typeof end||end%1!=0)throw TypeError("Illegal end: Not an integer");if(end>>>=0,begin<0||end<begin||end>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength)}var sd;try{utfx.decodeUTF8toUTF16(function(){return begin<end?this.view[begin++]:null}.bind(this),sd=stringDestination())}catch(e){if(begin!==end)throw RangeError("Illegal range: Truncated data, "+begin+" != "+end)}return sd()},ByteBuffer.fromUTF8=function(str,littleEndian,noAssert){var bb,i;if(noAssert||"string"==typeof str)return bb=new ByteBuffer(utfx.calculateUTF16asUTF8(stringSource(str),!0)[1],littleEndian,noAssert),i=0,utfx.encodeUTF16toUTF8(stringSource(str),function(b){bb.view[i++]=b}),bb.limit=i,bb;throw TypeError("Illegal str: Not a string")},ByteBuffer};"function"==typeof _dereq_&&"object"==typeof module&&module&&module.exports?module.exports=(()=>{var Long;try{Long=_dereq_("long")}catch(e){}return factory(Long)})():(this.dcodeIO=this.dcodeIO||{}).ByteBuffer=factory(this.dcodeIO.Long)},{long:57}],57:[function(_dereq_,module,exports){var factory=function(){function Long(low,high,unsigned){this.low=0|low,this.high=0|high,this.unsigned=!!unsigned}function isLong(obj){return!0===(obj&&obj.__isLong__)}Object.defineProperty(Long.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),Long.isLong=isLong;var INT_CACHE={},UINT_CACHE={};function fromInt(value,unsigned){var obj,cachedObj,cache;return unsigned?(cache=0<=(value>>>=0)&&value<256)&&(cachedObj=UINT_CACHE[value])?cachedObj:(obj=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=fromBits(value,value<0?-1:0,!1),cache&&(INT_CACHE[value]=obj),obj)}function fromNumber(value,unsigned){if(isNaN(value)||!isFinite(value))return unsigned?UZERO:ZERO;if(unsigned){if(value<0)return UZERO;if(TWO_PWR_64_DBL<=value)return MAX_UNSIGNED_VALUE}else{if(value<=-TWO_PWR_63_DBL)return MIN_VALUE;if(TWO_PWR_63_DBL<=value+1)return MAX_VALUE}return value<0?fromNumber(-value,unsigned).neg():fromBits(value%TWO_PWR_32_DBL|0,value/TWO_PWR_32_DBL|0,unsigned)}function fromBits(lowBits,highBits,unsigned){return new Long(lowBits,highBits,unsigned)}Long.fromInt=fromInt,Long.fromNumber=fromNumber,Long.fromBits=fromBits;var pow_dbl=Math.pow;function fromString(str,unsigned,radix){if(0===str.length)throw Error("empty string");if("NaN"===str||"Infinity"===str||"+Infinity"===str||"-Infinity"===str)return ZERO;if(unsigned="number"==typeof unsigned?(radix=unsigned,!1):!!unsigned,(radix=radix||10)<2||36<radix)throw RangeError("radix");var p;if(0<(p=str.indexOf("-")))throw Error("interior hyphen");if(0===p)return fromString(str.substring(1),unsigned,radix).neg();for(var radixToPower=fromNumber(pow_dbl(radix,8)),result=ZERO,i=0;i<str.length;i+=8)var size=Math.min(8,str.length-i),value=parseInt(str.substring(i,i+size),radix),result=(size<8?(size=fromNumber(pow_dbl(radix,size)),result.mul(size)):result=result.mul(radixToPower)).add(fromNumber(value));return result.unsigned=unsigned,result}function fromValue(val){return val instanceof Long?val:"number"==typeof val?fromNumber(val):"string"==typeof val?fromString(val):fromBits(val.low,val.high,val.unsigned)}Long.fromString=fromString,Long.fromValue=fromValue;var TWO_PWR_32_DBL=4294967296,TWO_PWR_64_DBL=TWO_PWR_32_DBL*TWO_PWR_32_DBL,TWO_PWR_63_DBL=TWO_PWR_64_DBL/2,TWO_PWR_24=fromInt(1<<24),ZERO=fromInt(0),UZERO=(Long.ZERO=ZERO,fromInt(0,!0)),ONE=(Long.UZERO=UZERO,fromInt(1)),UONE=(Long.ONE=ONE,fromInt(1,!0)),NEG_ONE=(Long.UONE=UONE,fromInt(-1)),MAX_VALUE=(Long.NEG_ONE=NEG_ONE,new Long(-1,2147483647,!1)),MAX_UNSIGNED_VALUE=(Long.MAX_VALUE=MAX_VALUE,new Long(-1,-1,!0)),MIN_VALUE=(Long.MAX_UNSIGNED_VALUE=MAX_UNSIGNED_VALUE,new Long(0,-2147483648,!1)),LongPrototype=(Long.MIN_VALUE=MIN_VALUE,Long.prototype);return LongPrototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},LongPrototype.toNumber=function(){return this.unsigned?(this.high>>>0)*TWO_PWR_32_DBL+(this.low>>>0):this.high*TWO_PWR_32_DBL+(this.low>>>0)},LongPrototype.toString=function(radix){if((radix=radix||10)<2||36<radix)throw RangeError("radix");if(this.isZero())return"0";var div,radixLong;if(this.isNegative())return this.eq(MIN_VALUE)?(radixLong=fromNumber(radix),radixLong=(div=this.div(radixLong)).mul(radixLong).sub(this),div.toString(radix)+radixLong.toInt().toString(radix)):"-"+this.neg().toString(radix);for(var radixToPower=fromNumber(pow_dbl(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}},LongPrototype.getHighBits=function(){return this.high},LongPrototype.getHighBitsUnsigned=function(){return this.high>>>0},LongPrototype.getLowBits=function(){return this.low},LongPrototype.getLowBitsUnsigned=function(){return this.low>>>0},LongPrototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(MIN_VALUE)?64:this.neg().getNumBitsAbs();for(var val=0!=this.high?this.high:this.low,bit=31;0<bit&&0==(val&1<<bit);bit--);return 0!=this.high?bit+33:bit+1},LongPrototype.isZero=function(){return 0===this.high&&0===this.low},LongPrototype.isNegative=function(){return!this.unsigned&&this.high<0},LongPrototype.isPositive=function(){return this.unsigned||0<=this.high},LongPrototype.isOdd=function(){return 1==(1&this.low)},LongPrototype.isEven=function(){return 0==(1&this.low)},LongPrototype.equals=function(other){return isLong(other)||(other=fromValue(other)),(this.unsigned===other.unsigned||this.high>>>31!=1||other.high>>>31!=1)&&this.high===other.high&&this.low===other.low},LongPrototype.eq=LongPrototype.equals,LongPrototype.notEquals=function(other){return!this.eq(other)},LongPrototype.neq=LongPrototype.notEquals,LongPrototype.lessThan=function(other){return this.comp(other)<0},LongPrototype.lt=LongPrototype.lessThan,LongPrototype.lessThanOrEqual=function(other){return this.comp(other)<=0},LongPrototype.lte=LongPrototype.lessThanOrEqual,LongPrototype.greaterThan=function(other){return 0<this.comp(other)},LongPrototype.gt=LongPrototype.greaterThan,LongPrototype.greaterThanOrEqual=function(other){return 0<=this.comp(other)},LongPrototype.gte=LongPrototype.greaterThanOrEqual,LongPrototype.compare=function(other){var thisNeg,otherNeg;return isLong(other)||(other=fromValue(other)),this.eq(other)?0:(thisNeg=this.isNegative(),otherNeg=other.isNegative(),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)},LongPrototype.comp=LongPrototype.compare,LongPrototype.negate=function(){return!this.unsigned&&this.eq(MIN_VALUE)?MIN_VALUE:this.not().add(ONE)},LongPrototype.neg=LongPrototype.negate,LongPrototype.add=function(addend){isLong(addend)||(addend=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,c00=0;return c32+=(a00=((c00+=a00+(65535&addend.low))>>>16)+(a16+b16))>>>16,fromBits((a00&=65535)<<16|(c00&=65535),((c48+=(c32+=a32+b32)>>>16)+(a48+b48)&65535)<<16|(c32&=65535),this.unsigned)},LongPrototype.subtract=function(subtrahend){return isLong(subtrahend)||(subtrahend=fromValue(subtrahend)),this.add(subtrahend.neg())},LongPrototype.sub=LongPrototype.subtract,LongPrototype.multiply=function(multiplier){var a48,a32,a16,a00,b48,b32,b16,c48,c16,c00,c32;return this.isZero()||(multiplier=isLong(multiplier)?multiplier:fromValue(multiplier)).isZero()?ZERO:this.eq(MIN_VALUE)?multiplier.isOdd()?MIN_VALUE:ZERO:multiplier.eq(MIN_VALUE)?this.isOdd()?MIN_VALUE:ZERO:this.isNegative()?multiplier.isNegative()?this.neg().mul(multiplier.neg()):this.neg().mul(multiplier).neg():multiplier.isNegative()?this.mul(multiplier.neg()).neg():this.lt(TWO_PWR_24)&&multiplier.lt(TWO_PWR_24)?fromNumber(this.toNumber()*multiplier.toNumber(),this.unsigned):(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,c32=(c00=c48=0)+((c16=((c00+=a00*(multiplier=65535&multiplier.low))>>>16)+a16*multiplier)>>>16)+((c16=(65535&c16)+a00*b16)>>>16),fromBits((c16&=65535)<<16|(c00&=65535),((c48+=(c32+=a32*multiplier)>>>16)+((c32=(65535&c32)+a16*b16)>>>16)+((c32=(65535&c32)+a00*b32)>>>16)+(a48*multiplier+a32*b16+a16*b32+a00*b48)&65535)<<16|(c32&=65535),this.unsigned))},LongPrototype.mul=LongPrototype.multiply,LongPrototype.divide=function(divisor){if((divisor=isLong(divisor)?divisor:fromValue(divisor)).isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?UZERO:ZERO;var rem,res;if(this.unsigned){if((divisor=divisor.unsigned?divisor:divisor.toUnsigned()).gt(this))return UZERO;if(divisor.gt(this.shru(1)))return UONE;res=UZERO}else{if(this.eq(MIN_VALUE))return divisor.eq(ONE)||divisor.eq(NEG_ONE)?MIN_VALUE:divisor.eq(MIN_VALUE)?ONE:(approx=this.shr(1).div(divisor).shl(1)).eq(ZERO)?divisor.isNegative()?ONE:NEG_ONE:(rem=this.sub(divisor.mul(approx)),approx.add(rem.div(divisor)));if(divisor.eq(MIN_VALUE))return this.unsigned?UZERO: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=ZERO}for(rem=this;rem.gte(divisor);){for(var approx=Math.max(1,Math.floor(rem.toNumber()/divisor.toNumber())),log2=Math.ceil(Math.log(approx)/Math.LN2),delta=log2<=48?1:pow_dbl(2,log2-48),approxRes=fromNumber(approx),approxRem=approxRes.mul(divisor);approxRem.isNegative()||approxRem.gt(rem);)approxRem=(approxRes=fromNumber(approx-=delta,this.unsigned)).mul(divisor);approxRes.isZero()&&(approxRes=ONE),res=res.add(approxRes),rem=rem.sub(approxRem)}return res},LongPrototype.div=LongPrototype.divide,LongPrototype.modulo=function(divisor){return isLong(divisor)||(divisor=fromValue(divisor)),this.sub(this.div(divisor).mul(divisor))},LongPrototype.mod=LongPrototype.modulo,LongPrototype.not=function(){return fromBits(~this.low,~this.high,this.unsigned)},LongPrototype.and=function(other){return isLong(other)||(other=fromValue(other)),fromBits(this.low&other.low,this.high&other.high,this.unsigned)},LongPrototype.or=function(other){return isLong(other)||(other=fromValue(other)),fromBits(this.low|other.low,this.high|other.high,this.unsigned)},LongPrototype.xor=function(other){return isLong(other)||(other=fromValue(other)),fromBits(this.low^other.low,this.high^other.high,this.unsigned)},LongPrototype.shiftLeft=function(numBits){return isLong(numBits)&&(numBits=numBits.toInt()),0==(numBits&=63)?this:numBits<32?fromBits(this.low<<numBits,this.high<<numBits|this.low>>>32-numBits,this.unsigned):fromBits(0,this.low<<numBits-32,this.unsigned)},LongPrototype.shl=LongPrototype.shiftLeft,LongPrototype.shiftRight=function(numBits){return isLong(numBits)&&(numBits=numBits.toInt()),0==(numBits&=63)?this:numBits<32?fromBits(this.low>>>numBits|this.high<<32-numBits,this.high>>numBits,this.unsigned):fromBits(this.high>>numBits-32,0<=this.high?0:-1,this.unsigned)},LongPrototype.shr=LongPrototype.shiftRight,LongPrototype.shiftRightUnsigned=function(numBits){var high;return isLong(numBits)&&(numBits=numBits.toInt()),0==(numBits&=63)?this:(high=this.high,numBits<32?fromBits(this.low>>>numBits|high<<32-numBits,high>>>numBits,this.unsigned):fromBits(32===numBits?high:high>>>numBits-32,0,this.unsigned))},LongPrototype.shru=LongPrototype.shiftRightUnsigned,LongPrototype.toSigned=function(){return this.unsigned?fromBits(this.low,this.high,!1):this},LongPrototype.toUnsigned=function(){return this.unsigned?this:fromBits(this.low,this.high,!0)},LongPrototype.toBytes=function(le){return le?this.toBytesLE():this.toBytesBE()},LongPrototype.toBytesLE=function(){var hi=this.high,lo=this.low;return[255&lo,lo>>>8&255,lo>>>16&255,lo>>>24&255,255&hi,hi>>>8&255,hi>>>16&255,hi>>>24&255]},LongPrototype.toBytesBE=function(){var hi=this.high,lo=this.low;return[hi>>>24&255,hi>>>16&255,hi>>>8&255,255&hi,lo>>>24&255,lo>>>16&255,lo>>>8&255,255&lo]},Long};"function"==typeof _dereq_&&"object"==typeof module&&module&&module.exports?module.exports=factory():(this.dcodeIO=this.dcodeIO||{}).Long=factory()},{}],58:[function(_dereq_,module,exports){var R="object"==typeof Reflect?Reflect:null,ReflectApply=R&&"function"==typeof R.apply?R.apply:function(target,receiver,args){return Function.prototype.apply.call(target,receiver,args)},ReflectOwnKeys=R&&"function"==typeof R.ownKeys?R.ownKeys:Object.getOwnPropertySymbols?function(target){return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target))}:function(target){return Object.getOwnPropertyNames(target)},NumberIsNaN=Number.isNaN||function(value){return value!=value};function EventEmitter(){EventEmitter.init.call(this)}module.exports=EventEmitter,module.exports.once=function(emitter,name){return new Promise(function(resolve,reject){function errorListener(err){emitter.removeListener(name,resolver),reject(err)}function resolver(){"function"==typeof emitter.removeListener&&emitter.removeListener("error",errorListener),resolve([].slice.call(arguments))}eventTargetAgnosticAddListener(emitter,name,resolver,{once:!0}),"error"!==name&&(emitter=>{"function"==typeof emitter.on&&eventTargetAgnosticAddListener(emitter,"error",errorListener,{once:!0})})(emitter)})},(EventEmitter.EventEmitter=EventEmitter).prototype._events=void 0,EventEmitter.prototype._eventsCount=0,EventEmitter.prototype._maxListeners=void 0;var defaultMaxListeners=10;function checkListener(listener){if("function"!=typeof listener)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof listener)}function _getMaxListeners(that){return void 0===that._maxListeners?EventEmitter.defaultMaxListeners:that._maxListeners}function _addListener(target,type,listener,prepend){var events,existing;return checkListener(listener),void 0===(events=target._events)?(events=target._events=Object.create(null),target._eventsCount=0):(void 0!==events.newListener&&(target.emit("newListener",type,listener.listener||listener),events=target._events),existing=events[type]),void 0===existing?(existing=events[type]=listener,++target._eventsCount):("function"==typeof existing?existing=events[type]=prepend?[listener,existing]:[existing,listener]:prepend?existing.unshift(listener):existing.push(listener),0<(events=_getMaxListeners(target))&&existing.length>events&&!existing.warned&&(existing.warned=!0,(prepend=new Error("Possible EventEmitter memory leak detected. "+existing.length+" "+String(type)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",prepend.emitter=target,prepend.type=type,prepend.count=existing.length,console)&&console.warn),target}function _onceWrap(target,type,listener){target={fired:!1,wrapFn:void 0,target:target,type:type,listener:listener},type=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(target);return type.listener=listener,target.wrapFn=type}function _listeners(target,type,unwrap){target=target._events;if(void 0===target)return[];target=target[type];if(void 0===target)return[];if("function"==typeof target)return unwrap?[target.listener||target]:[target];if(unwrap){for(var arr=target,ret=new Array(arr.length),i=0;i<ret.length;++i)ret[i]=arr[i].listener||arr[i];return ret}return arrayClone(target,target.length)}function listenerCount(type){var events=this._events;if(void 0!==events){events=events[type];if("function"==typeof events)return 1;if(void 0!==events)return events.length}return 0}function arrayClone(arr,n){for(var copy=new Array(n),i=0;i<n;++i)copy[i]=arr[i];return copy}function eventTargetAgnosticAddListener(emitter,name,listener,flags){if("function"==typeof emitter.on)flags.once?emitter.once(name,listener):emitter.on(name,listener);else{if("function"!=typeof emitter.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof emitter);emitter.addEventListener(name,function wrapListener(arg){flags.once&&emitter.removeEventListener(name,wrapListener),listener(arg)})}}Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:!0,get:function(){return defaultMaxListeners},set:function(arg){if("number"!=typeof arg||arg<0||NumberIsNaN(arg))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+arg+".");defaultMaxListeners=arg}}),EventEmitter.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},EventEmitter.prototype.setMaxListeners=function(n){if("number"!=typeof n||n<0||NumberIsNaN(n))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+n+".");return this._maxListeners=n,this},EventEmitter.prototype.getMaxListeners=function(){return _getMaxListeners(this)},EventEmitter.prototype.emit=function(type){for(var args=[],i=1;i<arguments.length;i++)args.push(arguments[i]);var doError="error"===type,events=this._events;if(void 0!==events)doError=doError&&void 0===events.error;else if(!doError)return!1;if(doError){if((er=0<args.length?args[0]:er)instanceof Error)throw er;doError=new Error("Unhandled error."+(er?" ("+er.message+")":""));throw doError.context=er,doError}var er=events[type];if(void 0===er)return!1;if("function"==typeof er)ReflectApply(er,this,args);else for(var len=er.length,listeners=arrayClone(er,len),i=0;i<len;++i)ReflectApply(listeners[i],this,args);return!0},EventEmitter.prototype.on=EventEmitter.prototype.addListener=function(type,listener){return _addListener(this,type,listener,!1)},EventEmitter.prototype.prependListener=function(type,listener){return _addListener(this,type,listener,!0)},EventEmitter.prototype.once=function(type,listener){return checkListener(listener),this.on(type,_onceWrap(this,type,listener)),this},EventEmitter.prototype.prependOnceListener=function(type,listener){return checkListener(listener),this.prependListener(type,_onceWrap(this,type,listener)),this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener=function(type,listener){var list,events,position,i,originalListener;if(checkListener(listener),void 0!==(events=this._events)&&void 0!==(list=events[type]))if(list===listener||list.listener===listener)0==--this._eventsCount?this._events=Object.create(null):(delete events[type],events.removeListener&&this.emit("removeListener",type,list.listener||listener));else if("function"!=typeof list){for(position=-1,i=list.length-1;0<=i;i--)if(list[i]===listener||list[i].listener===listener){originalListener=list[i].listener,position=i;break}if(position<0)return this;0===position?list.shift():((list,index)=>{for(;index+1<list.length;index++)list[index]=list[index+1];list.pop()})(list,position),1===list.length&&(events[type]=list[0]),void 0!==events.removeListener&&this.emit("removeListener",type,originalListener||listener)}return this},EventEmitter.prototype.removeAllListeners=function(type){var listeners,events=this._events;if(void 0!==events)if(void 0===events.removeListener)0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==events[type]&&(0==--this._eventsCount?this._events=Object.create(null):delete events[type]);else if(0===arguments.length){for(var key,keys=Object.keys(events),i=0;i<keys.length;++i)"removeListener"!==(key=keys[i])&&this.removeAllListeners(key);this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0}else if("function"==typeof(listeners=events[type]))this.removeListener(type,listeners);else if(void 0!==listeners)for(i=listeners.length-1;0<=i;i--)this.removeListener(type,listeners[i]);return this},EventEmitter.prototype.listeners=function(type){return _listeners(this,type,!0)},EventEmitter.prototype.rawListeners=function(type){return _listeners(this,type,!1)},EventEmitter.listenerCount=function(emitter,type){return"function"==typeof emitter.listenerCount?emitter.listenerCount(type):listenerCount.call(emitter,type)},EventEmitter.prototype.listenerCount=listenerCount,EventEmitter.prototype.eventNames=function(){return 0<this._eventsCount?ReflectOwnKeys(this._events):[]}},{}],59:[function(_dereq_,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=8*nBytes-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,nBytes=buffer[offset+i];for(i+=d,e=nBytes&(1<<-nBits)-1,nBytes>>=-nBits,nBits+=eLen;0<nBits;e=256*e+buffer[offset+i],i+=d,nBits-=8);for(m=e&(1<<-nBits)-1,e>>=-nBits,nBits+=mLen;0<nBits;m=256*m+buffer[offset+i],i+=d,nBits-=8);if(0===e)e=1-eBias;else{if(e===eMax)return m?NaN:Infinity*(nBytes?-1:1);m+=Math.pow(2,mLen),e-=eBias}return(nBytes?-1:1)*m*Math.pow(2,e-mLen)},exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,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,nBytes=value<0||0===value&&1/value<0?1:0;for(value=Math.abs(value),isNaN(value)||Infinity===value?(m=isNaN(value)?1:0,e=eMax):(e=Math.floor(Math.log(value)/Math.LN2),value*(isLE=Math.pow(2,-e))<1&&(e--,isLE*=2),2<=(value+=1<=e+eBias?rt/isLE:rt*Math.pow(2,1-eBias))*isLE&&(e++,isLE/=2),eMax<=e+eBias?(m=0,e=eMax):1<=e+eBias?(m=(value*isLE-1)*Math.pow(2,mLen),e+=eBias):(m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen),e=0));8<=mLen;buffer[offset+i]=255&m,i+=d,m/=256,mLen-=8);for(e=e<<mLen|m,eLen+=mLen;0<eLen;buffer[offset+i]=255&e,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=128*nBytes}},{}],60:[function(_dereq_,module,exports){"function"==typeof Object.create?module.exports=function(ctor,superCtor){superCtor&&(ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}}))}:module.exports=function(ctor,superCtor){var TempCtor;superCtor&&(ctor.super_=superCtor,(TempCtor=function(){}).prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor)}},{}],61:[function(_dereq_,module,exports){var i=this,_=function(){var i=Math.imul,_=Math.clz32,t=Math.abs,e=Math.max,g=Math.floor;class o extends Array{constructor(i,_){if(super(i),this.sign=_,i>o.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded")}static BigInt(i){var _=Number.isFinite;if("number"==typeof i){if(0===i)return o.__zero();if(o.__isOneDigitInt(i))return i<0?o.__oneDigit(-i,!0):o.__oneDigit(i,!1);if(_(i)&&g(i)===i)return o.__fromDouble(i);throw new RangeError("The number "+i+" cannot be converted to BigInt because it is not an integer")}if("string"==typeof i){let _=o.__fromString(i);if(null===_)throw new SyntaxError("Cannot convert "+i+" to a BigInt");return _}if("boolean"==typeof i)return!0===i?o.__oneDigit(1,!1):o.__zero();if("object"!=typeof i)throw new TypeError("Cannot convert "+i+" to a BigInt");{if(i.constructor===o)return i;let _=o.__toPrimitive(i);return o.BigInt(_)}}toDebugString(){var _,i=["BigInt["];for(_ of this)i.push((_&&(_>>>0).toString(16))+", ");return i.push("]"),i.join("")}toString(i=10){if(i<2||36<i)throw new RangeError("toString() radix argument must be between 2 and 36");return 0===this.length?"0":0==(i&i-1)?o.__toStringBasePowerOfTwo(this,i):o.__toStringGeneric(this,i,!1)}static toNumber(i){var _=i.length;if(0===_)return 0;if(1===_){let _=i.__unsignedDigit(0);return i.sign?-_:_}var t=i.__digit(_-1),e=o.__clz30(t),n=30*_-e;if(1024<n)return i.sign?-Infinity:1/0;let g=n-1,s=t,l=_-1,r=e+3,a=32===r?0:s<<r,u=(a>>>=12,r-12),d=12<=r?0:s<<20+r,h=20+r;for(0<u&&0<l&&(l--,s=i.__digit(l),a|=s>>>30-u,d=s<<2+u,h=2+u);0<h&&0<l;)l--,s=i.__digit(l),d|=30<=h?s<<h-30:s>>>30-h,h-=30;n=o.__decideRounding(i,h,l,s);return(1===n||0===n&&1==(1&d))&&0==(d=d+1>>>0)&&0!=++a>>>20&&(a=0,1023<++g)?i.sign?-Infinity:1/0:(t=i.sign?-2147483648:0,g=g+1023<<20,o.__kBitConversionInts[1]=t|g|a,o.__kBitConversionInts[0]=d,o.__kBitConversionDouble[0])}static unaryMinus(i){var _;return 0===i.length?i:((_=i.__copy()).sign=!i.sign,_)}static bitwiseNot(i){return i.sign?o.__absoluteSubOne(i).__trim():o.__absoluteAddOne(i,!0)}static exponentiate(i,_){if(_.sign)throw new RangeError("Exponent must be positive");if(0===_.length)return o.__oneDigit(1,!1);if(0===i.length)return i;if(1===i.length&&1===i.__digit(0))return i.sign&&0==(1&_.__digit(0))?o.unaryMinus(i):i;if(1<_.length)throw new RangeError("BigInt too big");let t=_.__unsignedDigit(0);if(1===t)return i;if(t>=o.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===i.length&&2===i.__digit(0)){let _=1+(0|t/30),e=i.sign&&0!=(1&t),n=new o(_,e);n.__initializeDigits();var g=1<<t%30;return n.__setDigit(_-1,g),n}let e=null,n=i;for(0!=(1&t)&&(e=i),t>>=1;0!==t;t>>=1)n=o.multiply(n,n),0!=(1&t)&&(e=null===e?n:o.multiply(e,n));return e}static multiply(_,t){if(0===_.length)return _;if(0===t.length)return t;let i=_.length+t.length;30<=_.__clzmsd()+t.__clzmsd()&&i--;var e=new o(i,_.sign!==t.sign);e.__initializeDigits();for(let n=0;n<_.length;n++)o.__multiplyAccumulate(t,_.__digit(n),e,n);return e.__trim()}static divide(i,_){if(0===_.length)throw new RangeError("Division by zero");if(o.__absoluteCompare(i,_)<0)return o.__zero();let t=i.sign!==_.sign,e=_.__unsignedDigit(0),n;if(1===_.length&&e<=32767){if(1===e)return t===i.sign?i:o.unaryMinus(i);n=o.__absoluteDivSmall(i,e,null)}else n=o.__absoluteDivLarge(i,_,!0,!1);return n.sign=t,n.__trim()}static remainder(i,_){if(0===_.length)throw new RangeError("Division by zero");if(o.__absoluteCompare(i,_)<0)return i;var t=_.__unsignedDigit(0);if(1===_.length&&t<=32767){if(1===t)return o.__zero();let _=o.__absoluteModSmall(i,t);return 0===_?o.__zero():o.__oneDigit(_,i.sign)}t=o.__absoluteDivLarge(i,_,!1,!0);return t.sign=i.sign,t.__trim()}static add(i,_){var t=i.sign;return t===_.sign?o.__absoluteAdd(i,_,t):0<=o.__absoluteCompare(i,_)?o.__absoluteSub(i,_,t):o.__absoluteSub(_,i,!t)}static subtract(i,_){var t=i.sign;return t===_.sign?0<=o.__absoluteCompare(i,_)?o.__absoluteSub(i,_,t):o.__absoluteSub(_,i,!t):o.__absoluteAdd(i,_,t)}static leftShift(i,_){return 0===_.length||0===i.length?i:_.sign?o.__rightShiftByAbsolute(i,_):o.__leftShiftByAbsolute(i,_)}static signedRightShift(i,_){return 0===_.length||0===i.length?i:_.sign?o.__leftShiftByAbsolute(i,_):o.__rightShiftByAbsolute(i,_)}static unsignedRightShift(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}static lessThan(i,_){return o.__compareToBigInt(i,_)<0}static lessThanOrEqual(i,_){return o.__compareToBigInt(i,_)<=0}static greaterThan(i,_){return 0<o.__compareToBigInt(i,_)}static greaterThanOrEqual(i,_){return 0<=o.__compareToBigInt(i,_)}static equal(_,t){if(_.sign!==t.sign)return!1;if(_.length!==t.length)return!1;for(let e=0;e<_.length;e++)if(_.__digit(e)!==t.__digit(e))return!1;return!0}static notEqual(i,_){return!o.equal(i,_)}static bitwiseAnd(i,_){var g,t;return(i.sign||_.sign?i.sign&&_.sign?(t=e(i.length,_.length)+1,t=o.__absoluteSubOne(i,t),g=o.__absoluteSubOne(_),t=o.__absoluteOr(t,g,t),o.__absoluteAddOne(t,!0,t)):(i.sign&&([i,_]=[_,i]),o.__absoluteAndNot(i,o.__absoluteSubOne(_))):o.__absoluteAnd(i,_)).__trim()}static bitwiseXor(i,_){if(!i.sign&&!_.sign)return o.__absoluteXor(i,_).__trim();if(i.sign&&_.sign){let t=e(i.length,_.length),n=o.__absoluteSubOne(i,t),g=o.__absoluteSubOne(_);return o.__absoluteXor(n,g,n).__trim()}var t=e(i.length,_.length)+1,_=(i.sign&&([i,_]=[_,i]),o.__absoluteSubOne(_,t)),_=o.__absoluteXor(_,i,_);return o.__absoluteAddOne(_,!0,_).__trim()}static bitwiseOr(i,_){var t=e(i.length,_.length);if(!i.sign&&!_.sign)return o.__absoluteOr(i,_).__trim();if(i.sign&&_.sign){let e=o.__absoluteSubOne(i,t),n=o.__absoluteSubOne(_);return e=o.__absoluteAnd(e,n,e),o.__absoluteAddOne(e,!0,e).__trim()}i.sign&&([i,_]=[_,i]);_=o.__absoluteSubOne(_,t),_=o.__absoluteAndNot(_,i,_);return o.__absoluteAddOne(_,!0,_).__trim()}static asIntN(_,t){if(0===t.length)return t;if((_=g(_))<0)throw new RangeError("Invalid value: not (convertible to) a safe integer");if(0===_)return o.__zero();if(_>=o.__kMaxLengthBits)return t;var e=0|(_+29)/30;if(t.length<e)return t;var s=t.__unsignedDigit(e-1),l=1<<(_-1)%30;if(t.length===e&&s<l)return t;if((s&l)!=l)return o.__truncateToNBits(_,t);if(!t.sign)return o.__truncateAndSubFromPowerOfTwo(_,t,!0);if(0!=(s&l-1))return o.__truncateAndSubFromPowerOfTwo(_,t,!1);for(let n=e-2;0<=n;n--)if(0!==t.__digit(n))return o.__truncateAndSubFromPowerOfTwo(_,t,!1);return t.length===e&&s===l?t:o.__truncateToNBits(_,t)}static asUintN(i,_){if(0===_.length)return _;if((i=g(i))<0)throw new RangeError("Invalid value: not (convertible to) a safe integer");if(0===i)return o.__zero();if(_.sign){if(i>o.__kMaxLengthBits)throw new RangeError("BigInt too big");return o.__truncateAndSubFromPowerOfTwo(i,_,!1)}if(i>=o.__kMaxLengthBits)return _;var t=0|(i+29)/30;if(_.length<t)return _;var e=i%30;if(_.length==t){if(0==e)return _;let i=_.__digit(t-1);if(0==i>>>e)return _}return o.__truncateToNBits(i,_)}static ADD(i,_){if(i=o.__toPrimitive(i),_=o.__toPrimitive(_),"string"==typeof i)return i+("string"!=typeof _?_.toString():_);if("string"==typeof _)return i.toString()+_;if(i=o.__toNumeric(i),_=o.__toNumeric(_),o.__isBigInt(i)&&o.__isBigInt(_))return o.add(i,_);if("number"==typeof i&&"number"==typeof _)return i+_;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}static LT(i,_){return o.__compare(i,_,0)}static LE(i,_){return o.__compare(i,_,1)}static GT(i,_){return o.__compare(i,_,2)}static GE(i,_){return o.__compare(i,_,3)}static EQ(i,_){for(;;){if(o.__isBigInt(i))return o.__isBigInt(_)?o.equal(i,_):o.EQ(_,i);if("number"==typeof i){if(o.__isBigInt(_))return o.__equalToNumber(_,i);if("object"!=typeof _)return i==_;_=o.__toPrimitive(_)}else if("string"==typeof i){if(o.__isBigInt(_))return null!==(i=o.__fromString(i))&&o.equal(i,_);if("object"!=typeof _)return i==_;_=o.__toPrimitive(_)}else if("boolean"==typeof i){if(o.__isBigInt(_))return o.__equalToNumber(_,+i);if("object"!=typeof _)return i==_;_=o.__toPrimitive(_)}else if("symbol"==typeof i){if(o.__isBigInt(_))return!1;if("object"!=typeof _)return i==_;_=o.__toPrimitive(_)}else{if("object"!=typeof i)return i==_;if("object"==typeof _&&_.constructor!==o)return i==_;i=o.__toPrimitive(i)}}}static NE(i,_){return!o.EQ(i,_)}static __zero(){return new o(0,!1)}static __oneDigit(i,_){_=new o(1,_);return _.__setDigit(0,i),_}__copy(){var _=new o(this.length,this.sign);for(let t=0;t<this.length;t++)_[t]=this[t];return _}__trim(){let i=this.length,_=this[i-1];for(;0===_;)i--,_=this[i-1],this.pop();return 0===i&&(this.sign=!1),this}__initializeDigits(){for(let _=0;_<this.length;_++)this[_]=0}static __decideRounding(i,_,t,e){if(0<_)return-1;let n;if(_<0)n=-_-1;else{if(0===t)return-1;e=i.__digit(--t),n=29}_=1<<n;if(0==(e&_))return-1;if(0!=(e&--_))return 1;for(;0<t;)if(0!==i.__digit(--t))return 1;return 0}static __fromDouble(i){o.__kBitConversionDouble[0]=i;let t=(2047&o.__kBitConversionInts[1]>>>20)-1023,e=1+(0|t/30),n=new o(e,i<0),g=1048575&o.__kBitConversionInts[1]|1048576,s=o.__kBitConversionInts[0],r=t%30,a,u=0;if(r<20){let i=20-r;u=32+i,a=g>>>i,g=g<<32-i|s>>>i,s<<=32-i}else{if(20==r)u=32,a=g,g=s;else{let i=r-20;u=32-i,a=g<<i|s>>>32-i,g=s<<i}s=0}n.__setDigit(e-1,a);for(let _=e-2;0<=_;_--)0<u?(u-=30,a=g>>>2,g=g<<30|s>>>2,s<<=30):a=0,n.__setDigit(_,a);return n.__trim()}static __isWhitespace(i){return!!(i<=13&&9<=i)||(i<=159?32==i:i<=131071?160==i||5760==i:i<=196607?(i&=131071)<=10||40==i||41==i||47==i||95==i||4096==i:65279==i)}static __fromString(i,_=0){let t=0,e=i.length,n=0;if(n===e)return o.__zero();let g=i.charCodeAt(n);for(;o.__isWhitespace(g);){if(++n===e)return o.__zero();g=i.charCodeAt(n)}if(43===g){if(++n===e)return null;g=i.charCodeAt(n),t=1}else if(45===g){if(++n===e)return null;g=i.charCodeAt(n),t=-1}if(0===_){if(_=10,48===g){if(++n===e)return o.__zero();if(88===(g=i.charCodeAt(n))||120===g){if(_=16,++n===e)return null;g=i.charCodeAt(n)}else if(79===g||111===g){if(_=8,++n===e)return null;g=i.charCodeAt(n)}else if(66===g||98===g){if(_=2,++n===e)return null;g=i.charCodeAt(n)}}}else if(16===_&&48===g){if(++n===e)return o.__zero();if(88===(g=i.charCodeAt(n))||120===g){if(++n===e)return null;g=i.charCodeAt(n)}}if(0!=t&&10!==_)return null;for(;48===g;){if(++n===e)return o.__zero();g=i.charCodeAt(n)}let s=e-n,l=o.__kMaxBitsPerChar[_],r=o.__kBitsPerCharTableMultiplier-1;if(s>1073741824/l)return null;var a=l*s+r>>>o.__kBitsPerCharTableShift,u=new o(0|(29+a)/30,!1),h=_<10?_:10,b=10<_?_-10:0;if(0==(_&_-1)){l>>=o.__kBitsPerCharTableShift;let _=[],t=[],s=!1;do{let o=0,r=0;for(;;){let _;if(g-48>>>0<h)_=g-48;else{if(!((32|g)-97>>>0<b)){s=!0;break}_=(32|g)-87}if(r+=l,o=o<<l|_,++n===e){s=!0;break}if(g=i.charCodeAt(n),30<r+l)break}_.push(o),t.push(r)}while(!s);o.__fillFromParts(u,_,t)}else{u.__initializeDigits();let t=!1,s=0;do{let a=0,D=1;for(;;){let o;if(g-48>>>0<h)o=g-48;else{if(!((32|g)-97>>>0<b)){t=!0;break}o=(32|g)-87}let l=D*_;if(1073741823<l)break;if(D=l,a=a*_+o,s++,++n===e){t=!0;break}g=i.charCodeAt(n)}r=30*o.__kBitsPerCharTableMultiplier-1;var c=0|(l*s+r>>>o.__kBitsPerCharTableShift)/30;u.__inplaceMultiplyAdd(D,a,c)}while(!t)}if(n!==e){if(!o.__isWhitespace(g))return null;for(n++;n<e;n++)if(g=i.charCodeAt(n),!o.__isWhitespace(g))return null}return u.sign=-1==t,u.__trim()}static __fillFromParts(_,t,e){let n=0,g=0,o=0;for(let s=t.length-1;0<=s;s--){var i=t[s],l=e[s];g|=i<<o,30===(o+=l)?(_.__setDigit(n++,g),o=0,g=0):30<o&&(_.__setDigit(n++,1073741823&g),o-=30,g=i>>>l-o)}if(0!==g){if(n>=_.length)throw new Error("implementation bug");_.__setDigit(n++,g)}for(;n<_.length;n++)_.__setDigit(n,0)}static __toStringBasePowerOfTwo(_,i){var t=_.length,e=i-1;let n=(15&(e=(51&(e=(85&e>>>1)+(85&e))>>>2)+(51&e))>>>4)+(15&e),g=i-1,s=_.__digit(t-1),l=o.__clz30(s),r=0|(30*t-l+n-1)/n;if(_.sign&&r++,268435456<r)throw new Error("string too long");let a=Array(r),u=r-1,d=0,h=0;for(let e=0;e<t-1;e++){let i=_.__digit(e),t=(d|i<<h)&g,s=(a[u--]=o.__kConversionChars[t],n-h);for(d=i>>>s,h=30-s;h>=n;)a[u--]=o.__kConversionChars[d&g],d>>>=n,h-=n}e=(d|s<<h)&g;for(a[u--]=o.__kConversionChars[e],d=s>>>n-h;0!==d;)a[u--]=o.__kConversionChars[d&g],d>>>=n;if(_.sign&&(a[u--]="-"),-1!=u)throw new Error("implementation bug");return a.join("")}static __toStringGeneric(_,i,t){var e=_.length;if(0===e)return"";if(1===e){let e=_.__unsignedDigit(0).toString(i);return e=!1===t&&_.sign?"-"+e:e}let n=30*e-o.__clz30(_.__digit(e-1)),s=o.__kMaxBitsPerChar[i]-1,l=n*o.__kBitsPerCharTableMultiplier,r=1+(0|(l+=s-1)/s)>>1,a=o.exponentiate(o.__oneDigit(i,!1),o.__oneDigit(r,!1)),u,d,h=a.__unsignedDigit(0);if(1===a.length&&h<=32767){(u=new o(_.length,!1)).__initializeDigits();let t=0;for(let e=2*_.length-1;0<=e;e--){let i=t<<15|_.__halfDigit(e);u.__setHalfDigit(e,0|i/h),t=0|i%h}d=t.toString(i)}else{let t=o.__absoluteDivLarge(_,a,!0,!0),e=(u=t.quotient,t.remainder.__trim());d=o.__toStringGeneric(e,i,!0)}u.__trim();for(e=o.__toStringGeneric(u,i,!0);d.length<r;)d="0"+d;return(!1===t&&_.sign?"-"+e:e)+d}static __unequalSign(i){return i?-1:1}static __absoluteGreater(i){return i?-1:1}static __absoluteLess(i){return i?1:-1}static __compareToBigInt(i,_){var t=i.sign;return t!==_.sign?o.__unequalSign(t):0<(i=o.__absoluteCompare(i,_))?o.__absoluteGreater(t):i<0?o.__absoluteLess(t):0}static __compareToNumber(i,_){if(o.__isOneDigitInt(_)){var g,s,e=i.sign,n=_<0;if(e!==n)return o.__unequalSign(e);if(0!==i.length)return 1<i.length||(g=t(_))<(s=i.__unsignedDigit(0))?o.__absoluteGreater(e):s<g?o.__absoluteLess(e):0;if(n)throw new Error("implementation bug");return 0===_?0:-1}return o.__compareToDouble(i,_)}static __compareToDouble(i,_){if(_!=_)return _;if(_===1/0)return-1;if(-Infinity===_)return 1;var t=i.sign;if(t!==_<0)return o.__unequalSign(t);if(0===_)throw new Error("implementation bug: should be handled elsewhere");if(0===i.length)return-1;o.__kBitConversionDouble[0]=_;_=2047&o.__kBitConversionInts[1]>>>20;if(2047==_)throw new Error("implementation bug: handled elsewhere");_-=1023;if(_<0)return o.__absoluteGreater(t);var g=i.length,s=i.__digit(g-1),l=o.__clz30(s),r=30*g-l,_=1+_;if(!(r<_)){if(_<r)return o.__absoluteGreater(t);let u=1048576|1048575&o.__kBitConversionInts[1],d=o.__kBitConversionInts[0],m=29-l;if(m!=(0|(r-1)%30))throw new Error("implementation bug");let b,D=0;if(m<20){let i=20-m;D=32+i,b=u>>>i,u=u<<32-i|d>>>i,d<<=32-i}else{if(20==m)D=32,b=u,u=d;else{let i=m-20;D=32-i,b=u<<i|d>>>32-i,u=d<<i}d=0}if((s>>>=0)>(b>>>=0))return o.__absoluteGreater(t);if(!(s<b)){for(let e=g-2;0<=e;e--){0<D?(D-=30,b=u>>>2,u=u<<30|d>>>2,d<<=30):b=0;let _=i.__unsignedDigit(e);if(_>b)return o.__absoluteGreater(t);if(_<b)return o.__absoluteLess(t)}if(0===u&&0===d)return 0;if(0===D)throw new Error("implementation bug")}}return o.__absoluteLess(t)}static __equalToNumber(i,_){return o.__isOneDigitInt(_)?0===_?0===i.length:1===i.length&&i.sign===_<0&&i.__unsignedDigit(0)===t(_):0===o.__compareToDouble(i,_)}static __comparisonResultToBool(i,_){return 0===_?i<0:1===_?i<=0:2===_?0<i:3===_?0<=i:void 0}static __compare(i,_,t){if(i=o.__toPrimitive(i),_=o.__toPrimitive(_),"string"==typeof i&&"string"==typeof _)switch(t){case 0:return i<_;case 1:return i<=_;case 2:return _<i;case 3:return _<=i}if(o.__isBigInt(i)&&"string"==typeof _)return null!==(_=o.__fromString(_))&&o.__comparisonResultToBool(o.__compareToBigInt(i,_),t);if("string"==typeof i&&o.__isBigInt(_))return null!==(i=o.__fromString(i))&&o.__comparisonResultToBool(o.__compareToBigInt(i,_),t);if(i=o.__toNumeric(i),_=o.__toNumeric(_),o.__isBigInt(i)){if(o.__isBigInt(_))return o.__comparisonResultToBool(o.__compareToBigInt(i,_),t);if("number"!=typeof _)throw new Error("implementation bug");return o.__comparisonResultToBool(o.__compareToNumber(i,_),t)}if("number"!=typeof i)throw new Error("implementation bug");if(o.__isBigInt(_))return o.__comparisonResultToBool(o.__compareToNumber(_,i),2^t);if("number"!=typeof _)throw new Error("implementation bug");return 0===t?i<_:1===t?i<=_:2===t?_<i:3===t?_<=i:void 0}__clzmsd(){return o.__clz30(this.__digit(this.length-1))}static __absoluteAdd(_,t,e){if(_.length<t.length)return o.__absoluteAdd(t,_,e);if(0===_.length)return _;if(0===t.length)return _.sign===e?_:o.unaryMinus(_);let n=_.length,g=((0===_.__clzmsd()||t.length===_.length&&0===t.__clzmsd())&&n++,new o(n,e)),s=0,l=0;for(;l<t.length;l++){var i=_.__digit(l)+t.__digit(l)+s;s=i>>>30,g.__setDigit(l,1073741823&i)}for(;l<_.length;l++){let i=_.__digit(l)+s;s=i>>>30,g.__setDigit(l,1073741823&i)}return l<g.length&&g.__setDigit(l,s),g.__trim()}static __absoluteSub(_,t,e){if(0===_.length)return _;if(0===t.length)return _.sign===e?_:o.unaryMinus(_);let n=new o(_.length,e),g=0,s=0;for(;s<t.length;s++){var i=_.__digit(s)-t.__digit(s)-g;g=1&i>>>30,n.__setDigit(s,1073741823&i)}for(;s<_.length;s++){let i=_.__digit(s)-g;g=1&i>>>30,n.__setDigit(s,1073741823&i)}return n.__trim()}static __absoluteAddOne(_,i,t=null){var e=_.length;null===t?t=new o(e,i):t.sign=i;let n=1;for(let g=0;g<e;g++){let i=_.__digit(g)+n;n=i>>>30,t.__setDigit(g,1073741823&i)}return 0!=n&&t.__setDigitGrow(e,1),t}static __absoluteSubOne(_,t){let e=_.length,n=(t=t||e,new o(t,!1)),g=1;for(let o=0;o<e;o++){var i=_.__digit(o)-g;g=1&i>>>30,n.__setDigit(o,1073741823&i)}if(0!=g)throw new Error("implementation bug");for(let g=e;g<t;g++)n.__setDigit(g,0);return n}static __absoluteAnd(_,t,e=null){let n=_.length,g=t.length,s=g;if(n<g){let i=_,e=s=n;_=t,t=i,e}let l=s,r=(null===e?e=new o(l,!1):l=e.length,0);for(;r<s;r++)e.__setDigit(r,_.__digit(r)&t.__digit(r));for(;r<l;r++)e.__setDigit(r,0);return e}static __absoluteAndNot(_,t,e=null){let n=_.length,g=t.length,s=g,l=(n<g&&(s=n),n),r=(null===e?e=new o(l,!1):l=e.length,0);for(;r<s;r++)e.__setDigit(r,_.__digit(r)&~t.__digit(r));for(;r<n;r++)e.__setDigit(r,_.__digit(r));for(;r<l;r++)e.__setDigit(r,0);return e}static __absoluteOr(_,t,e=null){let n=_.length,g=t.length,s=g;if(n<g){let i=_,e=s=n;_=t,n=g,t=i,e}let l=n,r=(null===e?e=new o(l,!1):l=e.length,0);for(;r<s;r++)e.__setDigit(r,_.__digit(r)|t.__digit(r));for(;r<n;r++)e.__setDigit(r,_.__digit(r));for(;r<l;r++)e.__setDigit(r,0);return e}static __absoluteXor(_,t,e=null){let n=_.length,g=t.length,s=g;if(n<g){let i=_,e=s=n;_=t,n=g,t=i,e}let l=n,r=(null===e?e=new o(l,!1):l=e.length,0);for(;r<s;r++)e.__setDigit(r,_.__digit(r)^t.__digit(r));for(;r<n;r++)e.__setDigit(r,_.__digit(r));for(;r<l;r++)e.__setDigit(r,0);return e}static __absoluteCompare(_,t){var e=_.length-t.length;if(0!=e)return e;let n=_.length-1;for(;0<=n&&_.__digit(n)===t.__digit(n);)n--;return n<0?0:_.__unsignedDigit(n)>t.__unsignedDigit(n)?1:-1}static __multiplyAccumulate(_,t,e,n){if(0!==t){let g=32767&t,s=t>>>15,l=0,r=0;for(let a,u=0;u<_.length;u++,n++){a=e.__digit(n);let i=_.__digit(u),t=32767&i,d=i>>>15,h=o.__imul(t,g),m=o.__imul(t,s),b=o.__imul(d,g),D=o.__imul(d,s);a+=r+h+l,l=a>>>30,a=((32767&m)<<15)+((32767&b)<<15)+(1073741823&a),l+=a>>>30,r=D+(m>>>15)+(b>>>15),e.__setDigit(n,1073741823&a)}for(;0!=l||0!==r;n++){var i=e.__digit(n);i+=l+r,r=0,l=i>>>30,e.__setDigit(n,1073741823&i)}}}static __internalMultiplyAdd(_,t,e,g,s){let l=e,a=0;for(let n=0;n<g;n++){let i=_.__digit(n),e=o.__imul(32767&i,t),g=o.__imul(i>>>15,t),u=e+((32767&g)<<15)+a+l;l=u>>>30,a=g>>>15,s.__setDigit(n,1073741823&u)}if(s.length>g)for(s.__setDigit(g++,l+a);g<s.length;)s.__setDigit(g++,0);else if(0!==l+a)throw new Error("implementation bug")}__inplaceMultiplyAdd(i,_,t){t>this.length&&(t=this.length);let e=32767&i,n=i>>>15,g=0,s=_;for(let l=0;l<t;l++){let i=this.__digit(l),_=32767&i,t=i>>>15,r=o.__imul(_,e),a=o.__imul(_,n),u=o.__imul(t,e),d=o.__imul(t,n),h=s+r+g;g=h>>>30,h=((32767&a)<<15)+((32767&u)<<15)+(1073741823&h),g+=h>>>30,s=d+(a>>>15)+(u>>>15),this.__setDigit(l,1073741823&h)}if(0!=g||0!==s)throw new Error("implementation bug")}static __absoluteDivSmall(_,t,e=null){null===e&&(e=new o(_.length,!1));let n=0;for(let g,o=2*_.length-1;0<=o;o-=2){var i=0|(g=(n<<15|_.__halfDigit(o))>>>0)/t,s=0|(g=((n=0|g%t)<<15|_.__halfDigit(o-1))>>>0)/t;n=0|g%t,e.__setDigit(o>>>1,i<<15|s)}return e}static __absoluteModSmall(_,t){let e=0;for(let n=2*_.length-1;0<=n;n--){var i=(e<<15|_.__halfDigit(n))>>>0;e=0|i%t}return e}static __absoluteDivLarge(i,_,t,e){let g=_.__halfDigitLength(),n=_.length,s=i.__halfDigitLength()-g,l=null,r=(t&&(l=new o(2+s>>>1,!1)).__initializeDigits(),new o(g+2>>>1,!1)),a=(r.__initializeDigits(),o.__clz15(_.__halfDigit(g-1))),d=(0<a&&(_=o.__specialLeftShift(_,a,0)),o.__specialLeftShift(i,a,1)),u=_.__halfDigit(g-1),h=0;for(let a,m=s;0<=m;m--){a=32767;let i=d.__halfDigit(m+g);if(i!==u){let t=(i<<15|d.__halfDigit(m+g-1))>>>0,e=(a=0|t/u,0|t%u),n=_.__halfDigit(g-2),s=d.__halfDigit(m+g-2);for(;o.__imul(a,n)>>>0>(e<<16|s)>>>0&&(a--,!(32767<(e+=u))););}o.__internalMultiplyAdd(_,a,0,n,r);let e=d.__inplaceSub(r,m,g+1);0!==e&&(e=d.__inplaceAdd(_,m,g),d.__setHalfDigit(m+g,32767&d.__halfDigit(m+g)+e),a--),t&&(1&m?h=a<<15:l.__setDigit(m>>>1,h|a))}if(e)return d.__inplaceRightShift(a),t?{quotient:l,remainder:d}:d;if(t)return l;throw new Error("unreachable")}static __clz15(i){return o.__clz30(i)-15}__inplaceAdd(_,t,e){let n=0;for(let g=0;g<e;g++){var i=this.__halfDigit(t+g)+_.__halfDigit(g)+n;n=i>>>15,this.__setHalfDigit(t+g,32767&i)}return n}__inplaceSub(_,t,e){let n=0;if(1&t){let g=this.__digit(t>>=1),o=32767&g,s=0;for(;s<e-1>>>1;s++){let i=_.__digit(s),e=(g>>>15)-(32767&i)-n;n=1&e>>>15,this.__setDigit(t+s,(32767&e)<<15|32767&o),g=this.__digit(t+s+1),o=(32767&g)-(i>>>15)-n,n=1&o>>>15}var i=_.__digit(s),l=(g>>>15)-(32767&i)-n;if(n=1&l>>>15,this.__setDigit(t+s,(32767&l)<<15|32767&o),t+s+1>=this.length)throw new RangeError("out of bounds");0==(1&e)&&(g=this.__digit(t+s+1),o=(32767&g)-(i>>>15)-n,n=1&o>>>15,this.__setDigit(t+_.length,1073709056&g|32767&o))}else{t>>=1;let g=0;for(;g<_.length-1;g++){let i=this.__digit(t+g),e=_.__digit(g),o=(32767&i)-(32767&e)-n,s=(i>>>15)-(e>>>15)-(n=1&o>>>15);n=1&s>>>15,this.__setDigit(t+g,(32767&s)<<15|32767&o)}let i=this.__digit(t+g),o=_.__digit(g),s=(32767&i)-(32767&o)-n,l=(n=1&s>>>15,0);0==(1&e)&&(l=(i>>>15)-(o>>>15)-n,n=1&l>>>15),this.__setDigit(t+g,(32767&l)<<15|32767&s)}return n}__inplaceRightShift(_){if(0!==_){let t=this.__digit(0)>>>_,e=this.length-1;for(let n=0;n<e;n++){var i=this.__digit(n+1);this.__setDigit(n,1073741823&i<<30-_|t),t=i>>>_}this.__setDigit(e,t)}}static __specialLeftShift(_,t,e){var g=_.length,n=new o(g+e,!1);if(0===t){for(let t=0;t<g;t++)n.__setDigit(t,_.__digit(t));0<e&&n.__setDigit(g,0)}else{let s=0;for(let o=0;o<g;o++){var i=_.__digit(o);n.__setDigit(o,1073741823&i<<t|s),s=i>>>30-t}0<e&&n.__setDigit(g,s)}return n}static __leftShiftByAbsolute(_,i){i=o.__toShiftAmount(i);if(i<0)throw new RangeError("BigInt too big");var e=0|i/30,n=i%30,g=_.length,i=0!=n&&0!=_.__digit(g-1)>>>30-n,l=g+e+(i?1:0),r=new o(l,_.sign);if(0==n){let t=0;for(;t<e;t++)r.__setDigit(t,0);for(;t<l;t++)r.__setDigit(t,_.__digit(t-e))}else{let t=0;for(let _=0;_<e;_++)r.__setDigit(_,0);for(let o=0;o<g;o++){let i=_.__digit(o);r.__setDigit(o+e,1073741823&i<<n|t),t=i>>>30-n}if(i)r.__setDigit(g+e,t);else if(0!==t)throw new Error("implementation bug")}return r.__trim()}static __rightShiftByAbsolute(_,i){var t=_.length,e=_.sign,i=o.__toShiftAmount(i);if(i<0)return o.__rightShiftByMaximum(e);let g=0|i/30,s=i%30,l=t-g;if(l<=0)return o.__rightShiftByMaximum(e);let r=!1;if(e)if(0!=(_.__digit(g)&(1<<s)-1))r=!0;else for(let t=0;t<g;t++)if(0!==_.__digit(t)){r=!0;break}if(r&&0==s){let i=_.__digit(t-1);0==~i&&l++}let a=new o(l,e);if(0==s){a.__setDigit(l-1,0);for(let e=g;e<t;e++)a.__setDigit(e-g,_.__digit(e))}else{let e=_.__digit(g)>>>s,n=t-g-1;for(let t=0;t<n;t++){let i=_.__digit(t+g+1);a.__setDigit(t,1073741823&i<<30-s|e),e=i>>>s}a.__setDigit(n,e)}return(a=r?o.__absoluteAddOne(a,!0,a):a).__trim()}static __rightShiftByMaximum(i){return i?o.__oneDigit(1,!0):o.__zero()}static __toShiftAmount(i){return 1<i.length||(i=i.__unsignedDigit(0))>o.__kMaxLengthBits?-1:i}static __toPrimitive(i,_="default"){if("object"!=typeof i)return i;if(i.constructor===o)return i;if("undefined"!=typeof Symbol&&"symbol"==typeof Symbol.toPrimitive){let t=i[Symbol.toPrimitive];if(t){let i=t(_);if("object"!=typeof i)return i;throw new TypeError("Cannot convert object to primitive value")}}var t=i.valueOf;if(t){let _=t.call(i);if("object"!=typeof _)return _}t=i.toString;if(t){let _=t.call(i);if("object"!=typeof _)return _}throw new TypeError("Cannot convert object to primitive value")}static __toNumeric(i){return o.__isBigInt(i)?i:+i}static __isBigInt(i){return"object"==typeof i&&null!==i&&i.constructor===o}static __truncateToNBits(i,_){var t=0|(i+29)/30,e=new o(t,_.sign),n=t-1;for(let t=0;t<n;t++)e.__setDigit(t,_.__digit(t));let g=_.__digit(n);if(0!=i%30){let _=32-i%30;g=g<<_>>>_}return e.__setDigit(n,g),e.__trim()}static __truncateAndSubFromPowerOfTwo(_,t,e){let n=Math.min,g=0|(_+29)/30,s=new o(g,e),l=0,r=g-1,a=0;for(var i=n(r,t.length);l<i;l++){let i=0-t.__digit(l)-a;a=1&i>>>30,s.__setDigit(l,1073741823&i)}for(;l<r;l++)s.__setDigit(l,0|1073741823&-a);let u=r<t.length?t.__digit(r):0,d=_%30,h;if(0==d)h=0-u-a,h&=1073741823;else{let i=32-d,_=(u=u<<i>>>i,1<<32-i);h=_-u-a,h&=_-1}return s.__setDigit(r,h),s.__trim()}__digit(_){return this[_]}__unsignedDigit(_){return this[_]>>>0}__setDigit(_,i){this[_]=0|i}__setDigitGrow(_,i){this[_]=0|i}__halfDigitLength(){var i=this.length;return this.__unsignedDigit(i-1)<=32767?2*i-1:2*i}__halfDigit(_){return 32767&this[_>>>1]>>>15*(1&_)}__setHalfDigit(_,i){var t=_>>>1,e=this.__digit(t);this.__setDigit(t,1&_?32767&e|i<<15:1073709056&e|32767&i)}static __digitPow(i,_){let t=1;for(;0<_;)1&_&&(t*=i),_>>>=1,i*=i;return t}static __isOneDigitInt(i){return(1073741823&i)===i}}return o.__kMaxLength=33554432,o.__kMaxLengthBits=o.__kMaxLength<<5,o.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],o.__kBitsPerCharTableShift=5,o.__kBitsPerCharTableMultiplier=1<<o.__kBitsPerCharTableShift,o.__kConversionChars=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],o.__kBitConversionBuffer=new ArrayBuffer(8),o.__kBitConversionDouble=new Float64Array(o.__kBitConversionBuffer),o.__kBitConversionInts=new Int32Array(o.__kBitConversionBuffer),o.__clz30=_?function(i){return _(i)-2}:function(i){var _=Math.LN2;return 0===i?30:0|29-(0|(0,Math.log)(i>>>0)/_)},o.__imul=i||function(i,_){return 0|i*_},o};"object"==typeof exports&&void 0!==module?module.exports=_():(i=i||self).JSBI=_()},{}],62:[function(_dereq_,module,exports){var getOwnPropertySymbols=Object.getOwnPropertySymbols,hasOwnProperty=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable;module.exports=(()=>{try{if(Object.assign){var test1=new String("abc");if(test1[5]="de","5"!==Object.getOwnPropertyNames(test1)[0]){for(var test3,test2={},i=0;i<10;i++)test2["_"+String.fromCharCode(i)]=i;return"0123456789"===Object.getOwnPropertyNames(test2).map(function(n){return test2[n]}).join("")?(test3={},"abcdefghijklmnopqrst".split("").forEach(function(letter){test3[letter]=letter}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},test3)).join("")):void 0}}}catch(err){}})()?Object.assign:function(target,source){for(var from,to=(val=>{if(null==val)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(val)})(target),s=1;s<arguments.length;s++){for(var key in from=Object(arguments[s]))hasOwnProperty.call(from,key)&&(to[key]=from[key]);if(getOwnPropertySymbols)for(var symbols=getOwnPropertySymbols(from),i=0;i<symbols.length;i++)propIsEnumerable.call(from,symbols[i])&&(to[symbols[i]]=from[symbols[i]])}return to}},{}],63:[function(_dereq_,module,exports){var cachedSetTimeout,cachedClearTimeout,module=module.exports={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}function runTimeout(fun){if(cachedSetTimeout===setTimeout)return setTimeout(fun,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return(cachedSetTimeout=setTimeout)(fun,0);try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}var currentQueue,queue=[],draining=!1,queueIndex=-1;function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length)&&drainQueue()}function drainQueue(){if(!draining){for(var timeout=runTimeout(cleanUpNextTick),len=(draining=!0,queue.length);len;){for(currentQueue=queue,queue=[];++queueIndex<len;)currentQueue&¤tQueue[queueIndex].run();queueIndex=-1,len=queue.length}currentQueue=null,draining=!1,function(marker){if(cachedClearTimeout===clearTimeout)return clearTimeout(marker);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return(cachedClearTimeout=clearTimeout)(marker);try{cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}(timeout)}}function Item(fun,array){this.fun=fun,this.array=array}function noop(){}module.nextTick=function(fun){var args=new Array(arguments.length-1);if(1<arguments.length)for(var i=1;i<arguments.length;i++)args[i-1]=arguments[i];queue.push(new Item(fun,args)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},module.title="browser",module.browser=!0,module.env={},module.argv=[],module.version="",module.versions={},module.on=noop,module.addListener=noop,module.once=noop,module.off=noop,module.removeListener=noop,module.removeAllListeners=noop,module.emit=noop,module.prependListener=noop,module.prependOnceListener=noop,module.listeners=function(name){return[]},module.binding=function(name){throw new Error("process.binding is not supported")},module.cwd=function(){return"/"},module.chdir=function(dir){throw new Error("process.chdir is not supported")},module.umask=function(){return 0}},{}],64:[function(_dereq_,module,exports){var buffer=_dereq_("buffer"),Buffer=buffer.Buffer;function copyProps(src,dst){for(var key in src)dst[key]=src[key]}function SafeBuffer(arg,encodingOrOffset,length){return Buffer(arg,encodingOrOffset,length)}Buffer.from&&Buffer.alloc&&Buffer.allocUnsafe&&Buffer.allocUnsafeSlow?module.exports=buffer:(copyProps(buffer,exports),exports.Buffer=SafeBuffer),SafeBuffer.prototype=Object.create(Buffer.prototype),copyProps(Buffer,SafeBuffer),SafeBuffer.from=function(arg,encodingOrOffset,length){if("number"==typeof arg)throw new TypeError("Argument must not be a number");return Buffer(arg,encodingOrOffset,length)},SafeBuffer.alloc=function(size,fill,encoding){if("number"!=typeof size)throw new TypeError("Argument must be a number");size=Buffer(size);return void 0!==fill?"string"==typeof encoding?size.fill(fill,encoding):size.fill(fill):size.fill(0),size},SafeBuffer.allocUnsafe=function(size){if("number"!=typeof size)throw new TypeError("Argument must be a number");return Buffer(size)},SafeBuffer.allocUnsafeSlow=function(size){if("number"!=typeof size)throw new TypeError("Argument must be a number");return buffer.SlowBuffer(size)}},{buffer:55}],65:[function(_dereq_,module,exports){module.exports=Stream;var EE=_dereq_("events").EventEmitter;function Stream(){EE.call(this)}_dereq_("inherits")(Stream,EE),Stream.Readable=_dereq_("readable-stream/lib/_stream_readable.js"),Stream.Writable=_dereq_("readable-stream/lib/_stream_writable.js"),Stream.Duplex=_dereq_("readable-stream/lib/_stream_duplex.js"),Stream.Transform=_dereq_("readable-stream/lib/_stream_transform.js"),Stream.PassThrough=_dereq_("readable-stream/lib/_stream_passthrough.js"),Stream.finished=_dereq_("readable-stream/lib/internal/streams/end-of-stream.js"),Stream.pipeline=_dereq_("readable-stream/lib/internal/streams/pipeline.js"),(Stream.Stream=Stream).prototype.pipe=function(dest,options){var source=this;function ondata(chunk){dest.writable&&!1===dest.write(chunk)&&source.pause&&source.pause()}function ondrain(){source.readable&&source.resume&&source.resume()}source.on("data",ondata),dest.on("drain",ondrain),dest._isStdio||options&&!1===options.end||(source.on("end",onend),source.on("close",onclose));var didOnEnd=!1;function onend(){didOnEnd||(didOnEnd=!0,dest.end())}function onclose(){didOnEnd||(didOnEnd=!0,"function"==typeof dest.destroy&&dest.destroy())}function onerror(er){if(cleanup(),0===EE.listenerCount(this,"error"))throw er}function cleanup(){source.removeListener("data",ondata),dest.removeListener("drain",ondrain),source.removeListener("end",onend),source.removeListener("close",onclose),source.removeListener("error",onerror),dest.removeListener("error",onerror),source.removeListener("end",cleanup),source.removeListener("close",cleanup),dest.removeListener("close",cleanup)}return source.on("error",onerror),dest.on("error",onerror),source.on("end",cleanup),source.on("close",cleanup),dest.on("close",cleanup),dest.emit("pipe",source),dest}},{events:58,inherits:60,"readable-stream/lib/_stream_duplex.js":67,"readable-stream/lib/_stream_passthrough.js":68,"readable-stream/lib/_stream_readable.js":69,"readable-stream/lib/_stream_transform.js":70,"readable-stream/lib/_stream_writable.js":71,"readable-stream/lib/internal/streams/end-of-stream.js":75,"readable-stream/lib/internal/streams/pipeline.js":77}],66:[function(_dereq_,module,exports){var codes={};function createErrorType(code,message,Base){var NodeError=(_Base=>{var subClass,superClass;function NodeError(arg1,arg2,arg3){return _Base.call(this,((arg1,arg2,arg3)=>"string"==typeof message?message:message(arg1,arg2,arg3))(arg1,arg2,arg3))||this}return superClass=_Base,(subClass=NodeError).prototype=Object.create(superClass.prototype),(subClass.prototype.constructor=subClass).__proto__=superClass,NodeError})(Base=Base||Error);NodeError.prototype.name=Base.name,NodeError.prototype.code=code,codes[code]=NodeError}createErrorType("ERR_INVALID_OPT_VALUE",function(name,value){return'The value "'+value+'" is invalid for option "'+name+'"'},TypeError),createErrorType("ERR_INVALID_ARG_TYPE",function(name,expected,actual){var determiner,str,this_len;return"string"==typeof expected&&"not "===expected.substr(0,"not ".length)?(determiner="must not be",expected=expected.replace(/^not /,"")):determiner="must be",str=name,(void 0===this_len||this_len>str.length)&&(this_len=str.length),(" argument"===str.substring(this_len-" argument".length,this_len)?"The ".concat(name," "):(str=(str=>!(0+".".length>str.length)&&-1!==str.indexOf(".",0))(name)?"property":"argument",'The "'.concat(name,'" ').concat(str," "))).concat(determiner," ").concat(((expected,thing)=>{var len;return Array.isArray(expected)?(len=expected.length,expected=expected.map(function(i){return String(i)}),2<len?"one of ".concat(thing," ").concat(expected.slice(0,len-1).join(", "),", or ")+expected[len-1]:2===len?"one of ".concat(thing," ").concat(expected[0]," or ").concat(expected[1]):"of ".concat(thing," ").concat(expected[0])):"of ".concat(thing," ").concat(String(expected))})(expected,"type"))+". Received type ".concat(typeof actual)},TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",function(name){return"The "+name+" method is not implemented"}),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",function(name){return"Cannot call "+name+" after a stream was destroyed"}),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",function(arg){return"Unknown encoding: "+arg},TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),module.exports.codes=codes},{}],67:[function(_dereq_,module,exports){!function(process){!function(){var objectKeys=Object.keys||function(obj){var key,keys=[];for(key in obj)keys.push(key);return keys},Readable=(module.exports=Duplex,_dereq_("./_stream_readable")),Writable=_dereq_("./_stream_writable");_dereq_("inherits")(Duplex,Readable);for(var keys=objectKeys(Writable.prototype),v=0;v<keys.length;v++){var method=keys[v];Duplex.prototype[method]||(Duplex.prototype[method]=Writable.prototype[method])}function Duplex(options){if(!(this instanceof Duplex))return new Duplex(options);Readable.call(this,options),Writable.call(this,options),this.allowHalfOpen=!0,options&&(!1===options.readable&&(this.readable=!1),!1===options.writable&&(this.writable=!1),!1===options.allowHalfOpen)&&(this.allowHalfOpen=!1,this.once("end",onend))}function onend(){this._writableState.ended||process.nextTick(onEndNT,this)}function onEndNT(self){self.end()}Object.defineProperty(Duplex.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(Duplex.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Duplex.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(Duplex.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(value){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=value,this._writableState.destroyed=value)}})}.call(this)}.call(this,_dereq_("_process"))},{"./_stream_readable":69,"./_stream_writable":71,_process:63,inherits:60}],68:[function(_dereq_,module,exports){module.exports=PassThrough;var Transform=_dereq_("./_stream_transform");function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options)}_dereq_("inherits")(PassThrough,Transform),PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk)}},{"./_stream_transform":70,inherits:60}],69:[function(_dereq_,module,exports){!function(process,global){!function(){function EElistenerCount(emitter,type){return emitter.listeners(type).length}(module.exports=Readable).ReadableState=ReadableState,_dereq_("events").EventEmitter;var Duplex,StringDecoder,createReadableStreamAsyncIterator,from,Stream=_dereq_("./internal/streams/stream"),Buffer=_dereq_("buffer").Buffer,OurUint8Array=(void 0!==global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},debugUtil=_dereq_("util"),debug=debugUtil&&debugUtil.debuglog?debugUtil.debuglog("stream"):function(){},BufferList=_dereq_("./internal/streams/buffer_list"),debugUtil=_dereq_("./internal/streams/destroy"),getHighWaterMark=_dereq_("./internal/streams/state").getHighWaterMark,_require$codes=_dereq_("../errors").codes,ERR_INVALID_ARG_TYPE=_require$codes.ERR_INVALID_ARG_TYPE,ERR_STREAM_PUSH_AFTER_EOF=_require$codes.ERR_STREAM_PUSH_AFTER_EOF,ERR_METHOD_NOT_IMPLEMENTED=_require$codes.ERR_METHOD_NOT_IMPLEMENTED,ERR_STREAM_UNSHIFT_AFTER_END_EVENT=_require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,errorOrDestroy=(_dereq_("inherits")(Readable,Stream),debugUtil.errorOrDestroy),kProxyEvents=["error","close","destroy","pause","resume"];function ReadableState(options,stream,isDuplex){Duplex=Duplex||_dereq_("./_stream_duplex"),options=options||{},"boolean"!=typeof isDuplex&&(isDuplex=stream instanceof Duplex),this.objectMode=!!options.objectMode,isDuplex&&(this.objectMode=this.objectMode||!!options.readableObjectMode),this.highWaterMark=getHighWaterMark(this,options,"readableHighWaterMark",isDuplex),this.buffer=new BufferList,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==options.emitClose,this.autoDestroy=!!options.autoDestroy,this.destroyed=!1,this.defaultEncoding=options.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,options.encoding&&(StringDecoder=StringDecoder||_dereq_("string_decoder/").StringDecoder,this.decoder=new StringDecoder(options.encoding),this.encoding=options.encoding)}function Readable(options){if(Duplex=Duplex||_dereq_("./_stream_duplex"),!(this instanceof Readable))return new Readable(options);var isDuplex=this instanceof Duplex;this._readableState=new ReadableState(options,this,isDuplex),this.readable=!0,options&&("function"==typeof options.read&&(this._read=options.read),"function"==typeof options.destroy)&&(this._destroy=options.destroy),Stream.call(this)}function readableAddChunk(stream,chunk,encoding,addToFront,skipChunkCheck){debug("readableAddChunk",chunk);var er,state=stream._readableState;if(null===chunk)state.reading=!1,((stream,state)=>{var chunk;debug("onEofChunk"),state.ended||(state.decoder&&(chunk=state.decoder.end())&&chunk.length&&(state.buffer.push(chunk),state.length+=state.objectMode?1:chunk.length),state.ended=!0,state.sync?emitReadable(stream):(state.needReadable=!1,state.emittedReadable||(state.emittedReadable=!0,emitReadable_(stream))))})(stream,state);else if(er=skipChunkCheck?er:((state,chunk)=>{var er,obj;return obj=chunk,Buffer.isBuffer(obj)||obj instanceof OurUint8Array||"string"==typeof chunk||void 0===chunk||state.objectMode?er:new ERR_INVALID_ARG_TYPE("chunk",["string","Buffer","Uint8Array"],chunk)})(state,chunk))errorOrDestroy(stream,er);else if(state.objectMode||chunk&&0<chunk.length)if("string"==typeof chunk||state.objectMode||Object.getPrototypeOf(chunk)===Buffer.prototype||(chunk=(chunk=>Buffer.from(chunk))(chunk)),addToFront)state.endEmitted?errorOrDestroy(stream,new ERR_STREAM_UNSHIFT_AFTER_END_EVENT):addChunk(stream,state,chunk,!0);else if(state.ended)errorOrDestroy(stream,new ERR_STREAM_PUSH_AFTER_EOF);else{if(state.destroyed)return!1;state.reading=!1,!state.decoder||encoding||(chunk=state.decoder.write(chunk),state.objectMode)||0!==chunk.length?addChunk(stream,state,chunk,!1):maybeReadMore(stream,state)}else addToFront||(state.reading=!1,maybeReadMore(stream,state));return!state.ended&&(state.length<state.highWaterMark||0===state.length)}function addChunk(stream,state,chunk,addToFront){state.flowing&&0===state.length&&!state.sync?(state.awaitDrain=0,stream.emit("data",chunk)):(state.length+=state.objectMode?1:chunk.length,addToFront?state.buffer.unshift(chunk):state.buffer.push(chunk),state.needReadable&&emitReadable(stream)),maybeReadMore(stream,state)}Object.defineProperty(Readable.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(value){this._readableState&&(this._readableState.destroyed=value)}}),Readable.prototype.destroy=debugUtil.destroy,Readable.prototype._undestroy=debugUtil.undestroy,Readable.prototype._destroy=function(err,cb){cb(err)},Readable.prototype.push=function(chunk,encoding){var skipChunkCheck,state=this._readableState;return state.objectMode?skipChunkCheck=!0:"string"==typeof chunk&&((encoding=encoding||state.defaultEncoding)!==state.encoding&&(chunk=Buffer.from(chunk,encoding),encoding=""),skipChunkCheck=!0),readableAddChunk(this,chunk,encoding,!1,skipChunkCheck)},Readable.prototype.unshift=function(chunk){return readableAddChunk(this,chunk,null,!0,!1)},Readable.prototype.isPaused=function(){return!1===this._readableState.flowing},Readable.prototype.setEncoding=function(enc){for(var decoder=new(StringDecoder=StringDecoder||_dereq_("string_decoder/").StringDecoder)(enc),p=(this._readableState.decoder=decoder,this._readableState.encoding=this._readableState.decoder.encoding,this._readableState.buffer.head),content="";null!==p;)content+=decoder.write(p.data),p=p.next;return this._readableState.buffer.clear(),""!==content&&this._readableState.buffer.push(content),this._readableState.length=content.length,this};function howMuchToRead(n,state){return n<=0||0===state.length&&state.ended?0:state.objectMode?1:n!=n?(state.flowing&&state.length?state.buffer.head.data:state).length:(state.highWaterMark<n&&(state.highWaterMark=(n=>(1073741824<=n?n=1073741824:(n--,n=(n=(n=(n=(n|=n>>>1)|n>>>2)|n>>>4)|n>>>8)|n>>>16,n++),n))(n)),n<=state.length?n:state.ended?state.length:(state.needReadable=!0,0))}function emitReadable(stream){var state=stream._readableState;debug("emitReadable",state.needReadable,state.emittedReadable),state.needReadable=!1,state.emittedReadable||(debug("emitReadable",state.flowing),state.emittedReadable=!0,process.nextTick(emitReadable_,stream))}function emitReadable_(stream){var state=stream._readableState;debug("emitReadable_",state.destroyed,state.length,state.ended),state.destroyed||!state.length&&!state.ended||(stream.emit("readable"),state.emittedReadable=!1),state.needReadable=!state.flowing&&!state.ended&&state.length<=state.highWaterMark,flow(stream)}function maybeReadMore(stream,state){state.readingMore||(state.readingMore=!0,process.nextTick(maybeReadMore_,stream,state))}function maybeReadMore_(stream,state){for(;!state.reading&&!state.ended&&(state.length<state.highWaterMark||state.flowing&&0===state.length);){var len=state.length;if(debug("maybeReadMore read 0"),stream.read(0),len===state.length)break}state.readingMore=!1}function updateReadableListening(self){var state=self._readableState;state.readableListening=0<self.listenerCount("readable"),state.resumeScheduled&&!state.paused?state.flowing=!0:0<self.listenerCount("data")&&self.resume()}function nReadingNextTick(self){debug("readable nexttick read 0"),self.read(0)}function resume_(stream,state){debug("resume",state.reading),state.reading||stream.read(0),state.resumeScheduled=!1,stream.emit("resume"),flow(stream),state.flowing&&!state.reading&&stream.read(0)}function flow(stream){var state=stream._readableState;for(debug("flow",state.flowing);state.flowing&&null!==stream.read(););}function fromList(n,state){var ret;return 0===state.length?null:(state.objectMode?ret=state.buffer.shift():!n||n>=state.length?(ret=state.decoder?state.buffer.join(""):1===state.buffer.length?state.buffer.first():state.buffer.concat(state.length),state.buffer.clear()):ret=state.buffer.consume(n,state.decoder),ret)}function endReadable(stream){var state=stream._readableState;debug("endReadable",state.endEmitted),state.endEmitted||(state.ended=!0,process.nextTick(endReadableNT,state,stream))}function endReadableNT(state,stream){debug("endReadableNT",state.endEmitted,state.length),state.endEmitted||0!==state.length||(state.endEmitted=!0,stream.readable=!1,stream.emit("end"),state.autoDestroy&&(!(state=stream._writableState)||state.autoDestroy&&state.finished)&&stream.destroy())}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++)if(xs[i]===x)return i;return-1}Readable.prototype.read=function(n){debug("read",n),n=parseInt(n,10);var doRead,state=this._readableState,nOrig=n;return 0!==n&&(state.emittedReadable=!1),0===n&&state.needReadable&&((0!==state.highWaterMark?state.length>=state.highWaterMark:0<state.length)||state.ended)?(debug("read: emitReadable",state.length,state.ended),(0===state.length&&state.ended?endReadable:emitReadable)(this),null):0===(n=howMuchToRead(n,state))&&state.ended?(0===state.length&&endReadable(this),null):(doRead=state.needReadable,debug("need readable",doRead),(0===state.length||state.length-n<state.highWaterMark)&&debug("length less than watermark",doRead=!0),state.ended||state.reading?debug("reading or ended",doRead=!1):doRead&&(debug("do read"),state.reading=!0,state.sync=!0,0===state.length&&(state.needReadable=!0),this._read(state.highWaterMark),state.sync=!1,state.reading||(n=howMuchToRead(nOrig,state))),null===(doRead=0<n?fromList(n,state):null)?(state.needReadable=state.length<=state.highWaterMark,n=0):(state.length-=n,state.awaitDrain=0),0===state.length&&(state.ended||(state.needReadable=!0),nOrig!==n)&&state.ended&&endReadable(this),null!==doRead&&this.emit("data",doRead),doRead)},Readable.prototype._read=function(n){errorOrDestroy(this,new ERR_METHOD_NOT_IMPLEMENTED("_read()"))},Readable.prototype.pipe=function(dest,pipeOpts){var src=this,state=this._readableState;switch(state.pipesCount){case 0:state.pipes=dest;break;case 1:state.pipes=[state.pipes,dest];break;default:state.pipes.push(dest)}state.pipesCount+=1,debug("pipe count=%d opts=%j",state.pipesCount,pipeOpts);pipeOpts=pipeOpts&&!1===pipeOpts.end||dest===process.stdout||dest===process.stderr?unpipe:onend;function onend(){debug("onend"),dest.end()}state.endEmitted?process.nextTick(pipeOpts):src.once("end",pipeOpts),dest.on("unpipe",function onunpipe(readable,unpipeInfo){debug("onunpipe"),readable===src&&unpipeInfo&&!1===unpipeInfo.hasUnpiped&&(unpipeInfo.hasUnpiped=!0,debug("cleanup"),dest.removeListener("close",onclose),dest.removeListener("finish",onfinish),dest.removeListener("drain",ondrain),dest.removeListener("error",onerror),dest.removeListener("unpipe",onunpipe),src.removeListener("end",onend),src.removeListener("end",unpipe),src.removeListener("data",ondata),cleanedUp=!0,!state.awaitDrain||dest._writableState&&!dest._writableState.needDrain||ondrain())});var emitter,ondrain=(src=>function(){var state=src._readableState;debug("pipeOnDrain",state.awaitDrain),state.awaitDrain&&state.awaitDrain--,0===state.awaitDrain&&EElistenerCount(src,"data")&&(state.flowing=!0,flow(src))})(src),cleanedUp=(dest.on("drain",ondrain),!1);function ondata(chunk){debug("ondata");chunk=dest.write(chunk);debug("dest.write",chunk),!1===chunk&&((1===state.pipesCount&&state.pipes===dest||1<state.pipesCount&&-1!==indexOf(state.pipes,dest))&&!cleanedUp&&(debug("false write response, pause",state.awaitDrain),state.awaitDrain++),src.pause())}function onerror(er){debug("onerror",er),unpipe(),dest.removeListener("error",onerror),0===EElistenerCount(dest,"error")&&errorOrDestroy(dest,er)}function onclose(){dest.removeListener("finish",onfinish),unpipe()}function onfinish(){debug("onfinish"),dest.removeListener("close",onclose),unpipe()}function unpipe(){debug("unpipe"),src.unpipe(dest)}return src.on("data",ondata),pipeOpts=onerror,"function"==typeof(emitter=dest).prependListener?emitter.prependListener("error",pipeOpts):emitter._events&&emitter._events.error?Array.isArray(emitter._events.error)?emitter._events.error.unshift(pipeOpts):emitter._events.error=[pipeOpts,emitter._events.error]:emitter.on("error",pipeOpts),dest.once("close",onclose),dest.once("finish",onfinish),dest.emit("pipe",src),state.flowing||(debug("pipe resume"),src.resume()),dest},Readable.prototype.unpipe=function(dest){var state=this._readableState,unpipeInfo={hasUnpiped:!1};if(0!==state.pipesCount)if(1===state.pipesCount)dest&&dest!==state.pipes||(dest=dest||state.pipes,state.pipes=null,state.pipesCount=0,state.flowing=!1,dest&&dest.emit("unpipe",this,unpipeInfo));else if(dest){var index=indexOf(state.pipes,dest);-1!==index&&(state.pipes.splice(index,1),--state.pipesCount,1===state.pipesCount&&(state.pipes=state.pipes[0]),dest.emit("unpipe",this,unpipeInfo))}else{var dests=state.pipes,len=state.pipesCount;state.pipes=null,state.pipesCount=0,state.flowing=!1;for(var i=0;i<len;i++)dests[i].emit("unpipe",this,{hasUnpiped:!1})}return this},Readable.prototype.addListener=Readable.prototype.on=function(ev,fn){var fn=Stream.prototype.on.call(this,ev,fn),state=this._readableState;return"data"===ev?(state.readableListening=0<this.listenerCount("readable"),!1!==state.flowing&&this.resume()):"readable"!==ev||state.endEmitted||state.readableListening||(state.readableListening=state.needReadable=!0,state.flowing=!1,state.emittedReadable=!1,debug("on readable",state.length,state.reading),state.length?emitReadable(this):state.reading||process.nextTick(nReadingNextTick,this)),fn},Readable.prototype.removeListener=function(ev,fn){fn=Stream.prototype.removeListener.call(this,ev,fn);return"readable"===ev&&process.nextTick(updateReadableListening,this),fn},Readable.prototype.removeAllListeners=function(ev){var res=Stream.prototype.removeAllListeners.apply(this,arguments);return"readable"!==ev&&void 0!==ev||process.nextTick(updateReadableListening,this),res},Readable.prototype.resume=function(){var state=this._readableState;return state.flowing||(debug("resume"),state.flowing=!state.readableListening,((stream,state)=>{state.resumeScheduled||(state.resumeScheduled=!0,process.nextTick(resume_,stream,state))})(this,state)),state.paused=!1,this},Readable.prototype.pause=function(){return debug("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(debug("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Readable.prototype.wrap=function(stream){var i,_this=this,state=this._readableState,paused=!1;for(i in stream.on("end",function(){var chunk;debug("wrapped end"),state.decoder&&!state.ended&&(chunk=state.decoder.end())&&chunk.length&&_this.push(chunk),_this.push(null)}),stream.on("data",function(chunk){debug("wrapped data"),state.decoder&&(chunk=state.decoder.write(chunk)),state.objectMode&&null==chunk||(state.objectMode||chunk&&chunk.length)&&!_this.push(chunk)&&(paused=!0,stream.pause())}),stream)void 0===this[i]&&"function"==typeof stream[i]&&(this[i]=(method=>function(){return stream[method].apply(stream,arguments)})(i));for(var n=0;n<kProxyEvents.length;n++)stream.on(kProxyEvents[n],this.emit.bind(this,kProxyEvents[n]));return this._read=function(n){debug("wrapped _read",n),paused&&(paused=!1,stream.resume())},this},"function"==typeof Symbol&&(Readable.prototype[Symbol.asyncIterator]=function(){return(createReadableStreamAsyncIterator=void 0===createReadableStreamAsyncIterator?_dereq_("./internal/streams/async_iterator"):createReadableStreamAsyncIterator)(this)}),Object.defineProperty(Readable.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(Readable.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(Readable.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(state){this._readableState&&(this._readableState.flowing=state)}}),Readable._fromList=fromList,Object.defineProperty(Readable.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(Readable.from=function(iterable,opts){return(from=void 0===from?_dereq_("./internal/streams/from"):from)(Readable,iterable,opts)})}.call(this)}.call(this,_dereq_("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":66,"./_stream_duplex":67,"./internal/streams/async_iterator":72,"./internal/streams/buffer_list":73,"./internal/streams/destroy":74,"./internal/streams/from":76,"./internal/streams/state":78,"./internal/streams/stream":79,_process:63,buffer:55,events:58,inherits:60,"string_decoder/":80,util:53}],70:[function(_dereq_,module,exports){module.exports=Transform;var module=_dereq_("../errors").codes,ERR_METHOD_NOT_IMPLEMENTED=module.ERR_METHOD_NOT_IMPLEMENTED,ERR_MULTIPLE_CALLBACK=module.ERR_MULTIPLE_CALLBACK,ERR_TRANSFORM_ALREADY_TRANSFORMING=module.ERR_TRANSFORM_ALREADY_TRANSFORMING,ERR_TRANSFORM_WITH_LENGTH_0=module.ERR_TRANSFORM_WITH_LENGTH_0,Duplex=_dereq_("./_stream_duplex");function Transform(options){if(!(this instanceof Transform))return new Transform(options);Duplex.call(this,options),this._transformState={afterTransform:function(er,data){var ts=this._transformState,cb=(ts.transforming=!1,ts.writecb);if(null===cb)return this.emit("error",new ERR_MULTIPLE_CALLBACK);ts.writechunk=null,(ts.writecb=null)!=data&&this.push(data),cb(er);ts=this._readableState;ts.reading=!1,(ts.needReadable||ts.length<ts.highWaterMark)&&this._read(ts.highWaterMark)}.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,options&&("function"==typeof options.transform&&(this._transform=options.transform),"function"==typeof options.flush)&&(this._flush=options.flush),this.on("prefinish",prefinish)}function prefinish(){var _this=this;"function"!=typeof this._flush||this._readableState.destroyed?done(this,null,null):this._flush(function(er,data){done(_this,er,data)})}function done(stream,er,data){if(er)return stream.emit("error",er);if(null!=data&&stream.push(data),stream._writableState.length)throw new ERR_TRANSFORM_WITH_LENGTH_0;if(stream._transformState.transforming)throw new ERR_TRANSFORM_ALREADY_TRANSFORMING;stream.push(null)}_dereq_("inherits")(Transform,Duplex),Transform.prototype.push=function(chunk,encoding){return this._transformState.needTransform=!1,Duplex.prototype.push.call(this,chunk,encoding)},Transform.prototype._transform=function(chunk,encoding,cb){cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"))},Transform.prototype._write=function(chunk,encoding,cb){var ts=this._transformState;ts.writecb=cb,ts.writechunk=chunk,ts.writeencoding=encoding,!ts.transforming&&(cb=this._readableState,ts.needTransform||cb.needReadable||cb.length<cb.highWaterMark)&&this._read(cb.highWaterMark)},Transform.prototype._read=function(n){var ts=this._transformState;null===ts.writechunk||ts.transforming?ts.needTransform=!0:(ts.transforming=!0,this._transform(ts.writechunk,ts.writeencoding,ts.afterTransform))},Transform.prototype._destroy=function(err,cb){Duplex.prototype._destroy.call(this,err,function(err2){cb(err2)})}},{"../errors":66,"./_stream_duplex":67,inherits:60}],71:[function(_dereq_,module,exports){!function(process,global){!function(){function CorkedRequest(state){var _this=this;this.next=null,this.entry=null,this.finish=function(){((corkReq,state)=>{var entry=corkReq.entry;for(corkReq.entry=null;entry;){var cb=entry.callback;state.pendingcb--,cb(void 0),entry=entry.next}state.corkedRequestsFree.next=corkReq})(_this,state)}}(module.exports=Writable).WritableState=WritableState;var Duplex,realHasInstance,internalUtil={deprecate:_dereq_("util-deprecate")},Stream=_dereq_("./internal/streams/stream"),Buffer=_dereq_("buffer").Buffer,OurUint8Array=(void 0!==global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},destroyImpl=_dereq_("./internal/streams/destroy"),getHighWaterMark=_dereq_("./internal/streams/state").getHighWaterMark,_require$codes=_dereq_("../errors").codes,ERR_INVALID_ARG_TYPE=_require$codes.ERR_INVALID_ARG_TYPE,ERR_METHOD_NOT_IMPLEMENTED=_require$codes.ERR_METHOD_NOT_IMPLEMENTED,ERR_MULTIPLE_CALLBACK=_require$codes.ERR_MULTIPLE_CALLBACK,ERR_STREAM_CANNOT_PIPE=_require$codes.ERR_STREAM_CANNOT_PIPE,ERR_STREAM_DESTROYED=_require$codes.ERR_STREAM_DESTROYED,ERR_STREAM_NULL_VALUES=_require$codes.ERR_STREAM_NULL_VALUES,ERR_STREAM_WRITE_AFTER_END=_require$codes.ERR_STREAM_WRITE_AFTER_END,ERR_UNKNOWN_ENCODING=_require$codes.ERR_UNKNOWN_ENCODING,errorOrDestroy=destroyImpl.errorOrDestroy;function nop(){}function WritableState(options,stream,isDuplex){Duplex=Duplex||_dereq_("./_stream_duplex"),options=options||{},"boolean"!=typeof isDuplex&&(isDuplex=stream instanceof Duplex),this.objectMode=!!options.objectMode,isDuplex&&(this.objectMode=this.objectMode||!!options.writableObjectMode),this.highWaterMark=getHighWaterMark(this,options,"writableHighWaterMark",isDuplex),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;isDuplex=(this.destroyed=!1)===options.decodeStrings;this.decodeStrings=!isDuplex,this.defaultEncoding=options.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(er){((stream,er)=>{var state=stream._writableState,sync=state.sync,cb=state.writecb;if("function"!=typeof cb)throw new ERR_MULTIPLE_CALLBACK;(state=>{state.writing=!1,state.writecb=null,state.length-=state.writelen,state.writelen=0})(state),er?((stream,state,sync,er,cb)=>{--state.pendingcb,sync?(process.nextTick(cb,er),process.nextTick(finishMaybe,stream,state),stream._writableState.errorEmitted=!0,errorOrDestroy(stream,er)):(cb(er),stream._writableState.errorEmitted=!0,errorOrDestroy(stream,er),finishMaybe(stream,state))})(stream,state,sync,er,cb):((er=needFinish(state)||stream.destroyed)||state.corked||state.bufferProcessing||!state.bufferedRequest||clearBuffer(stream,state),sync?process.nextTick(afterWrite,stream,state,er,cb):afterWrite(stream,state,er,cb))})(stream,er)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==options.emitClose,this.autoDestroy=!!options.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new CorkedRequest(this)}_dereq_("inherits")(Writable,Stream),WritableState.prototype.getBuffer=function(){for(var current=this.bufferedRequest,out=[];current;)out.push(current),current=current.next;return out};try{Object.defineProperty(WritableState.prototype,"buffer",{get:internalUtil.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(_){}function Writable(options){var isDuplex=this instanceof(Duplex=Duplex||_dereq_("./_stream_duplex"));if(!isDuplex&&!realHasInstance.call(Writable,this))return new Writable(options);this._writableState=new WritableState(options,this,isDuplex),this.writable=!0,options&&("function"==typeof options.write&&(this._write=options.write),"function"==typeof options.writev&&(this._writev=options.writev),"function"==typeof options.destroy&&(this._destroy=options.destroy),"function"==typeof options.final)&&(this._final=options.final),Stream.call(this)}function doWrite(stream,state,writev,len,chunk,encoding,cb){state.writelen=len,state.writecb=cb,state.writing=!0,state.sync=!0,state.destroyed?state.onwrite(new ERR_STREAM_DESTROYED("write")):writev?stream._writev(chunk,state.onwrite):stream._write(chunk,encoding,state.onwrite),state.sync=!1}function afterWrite(stream,state,finished,cb){finished||((stream,state)=>{0===state.length&&state.needDrain&&(state.needDrain=!1,stream.emit("drain"))})(stream,state),state.pendingcb--,cb(),finishMaybe(stream,state)}function clearBuffer(stream,state){state.bufferProcessing=!0;var entry=state.bufferedRequest;if(stream._writev&&entry&&entry.next){for(var l=state.bufferedRequestCount,buffer=new Array(l),l=state.corkedRequestsFree,count=(l.entry=entry,0),allBuffers=!0;entry;)(buffer[count]=entry).isBuf||(allBuffers=!1),entry=entry.next,count+=1;buffer.allBuffers=allBuffers,doWrite(stream,state,!0,state.length,buffer,"",l.finish),state.pendingcb++,state.lastBufferedRequest=null,l.next?(state.corkedRequestsFree=l.next,l.next=null):state.corkedRequestsFree=new CorkedRequest(state),state.bufferedRequestCount=0}else{for(;entry;){var chunk=entry.chunk,encoding=entry.encoding,cb=entry.callback;if(doWrite(stream,state,!1,state.objectMode?1:chunk.length,chunk,encoding,cb),entry=entry.next,state.bufferedRequestCount--,state.writing)break}null===entry&&(state.lastBufferedRequest=null)}state.bufferedRequest=entry,state.bufferProcessing=!1}function needFinish(state){return state.ending&&0===state.length&&null===state.bufferedRequest&&!state.finished&&!state.writing}function callFinal(stream,state){stream._final(function(err){state.pendingcb--,err&&errorOrDestroy(stream,err),state.prefinished=!0,stream.emit("prefinish"),finishMaybe(stream,state)})}function finishMaybe(stream,state){var need=needFinish(state);return need&&(((stream,state)=>{state.prefinished||state.finalCalled||("function"!=typeof stream._final||state.destroyed?(state.prefinished=!0,stream.emit("prefinish")):(state.pendingcb++,state.finalCalled=!0,process.nextTick(callFinal,stream,state)))})(stream,state),0===state.pendingcb)&&(state.finished=!0,stream.emit("finish"),state.autoDestroy)&&(!(state=stream._readableState)||state.autoDestroy&&state.endEmitted)&&stream.destroy(),need}"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(realHasInstance=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function(object){return!!realHasInstance.call(this,object)||this===Writable&&object&&object._writableState instanceof WritableState}})):realHasInstance=function(object){return object instanceof this},Writable.prototype.pipe=function(){errorOrDestroy(this,new ERR_STREAM_CANNOT_PIPE)},Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState,ret=!1,obj=!state.objectMode&&(obj=chunk,Buffer.isBuffer(obj)||obj instanceof OurUint8Array);return obj&&!Buffer.isBuffer(chunk)&&(chunk=(chunk=>Buffer.from(chunk))(chunk)),"function"==typeof encoding&&(cb=encoding,encoding=null),encoding=obj?"buffer":encoding||state.defaultEncoding,"function"!=typeof cb&&(cb=nop),state.ending?((stream,cb)=>{var er=new ERR_STREAM_WRITE_AFTER_END;errorOrDestroy(stream,er),process.nextTick(cb,er)})(this,cb):(obj||((stream,state,chunk,cb)=>{var er;return null===chunk?er=new ERR_STREAM_NULL_VALUES:"string"==typeof chunk||state.objectMode||(er=new ERR_INVALID_ARG_TYPE("chunk",["string","Buffer"],chunk)),!er||(errorOrDestroy(stream,er),void process.nextTick(cb,er))})(this,state,chunk,cb))&&(state.pendingcb++,ret=((stream,state,isBuf,chunk,encoding,cb)=>{isBuf||chunk!==(newChunk=((state,chunk,encoding)=>state.objectMode||!1===state.decodeStrings||"string"!=typeof chunk?chunk:Buffer.from(chunk,encoding))(state,chunk,encoding))&&(isBuf=!0,encoding="buffer",chunk=newChunk);var last,newChunk=state.objectMode?1:chunk.length,ret=(state.length+=newChunk,state.length<state.highWaterMark);return ret||(state.needDrain=!0),state.writing||state.corked?(last=state.lastBufferedRequest,state.lastBufferedRequest={chunk:chunk,encoding:encoding,isBuf:isBuf,callback:cb,next:null},last?last.next=state.lastBufferedRequest:state.bufferedRequest=state.lastBufferedRequest,state.bufferedRequestCount+=1):doWrite(stream,state,!1,newChunk,chunk,encoding,cb),ret})(this,state,obj,chunk,encoding,cb)),ret},Writable.prototype.cork=function(){this._writableState.corked++},Writable.prototype.uncork=function(){var state=this._writableState;state.corked&&(state.corked--,state.writing||state.corked||state.bufferProcessing||!state.bufferedRequest||clearBuffer(this,state))},Writable.prototype.setDefaultEncoding=function(encoding){if("string"==typeof encoding&&(encoding=encoding.toLowerCase()),-1<["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((encoding+"").toLowerCase()))return this._writableState.defaultEncoding=encoding,this;throw new ERR_UNKNOWN_ENCODING(encoding)},Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(chunk,encoding,cb){cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()"))},Writable.prototype._writev=null,Writable.prototype.end=function(chunk,encoding,cb){var state=this._writableState;return"function"==typeof chunk?(cb=chunk,encoding=chunk=null):"function"==typeof encoding&&(cb=encoding,encoding=null),null!=chunk&&this.write(chunk,encoding),state.corked&&(state.corked=1,this.uncork()),state.ending||((stream,state,cb)=>{state.ending=!0,finishMaybe(stream,state),cb&&(state.finished?process.nextTick(cb):stream.once("finish",cb)),stream.writable=!(state.ended=!0)})(this,state,cb),this},Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(value){this._writableState&&(this._writableState.destroyed=value)}}),Writable.prototype.destroy=destroyImpl.destroy,Writable.prototype._undestroy=destroyImpl.undestroy,Writable.prototype._destroy=function(err,cb){cb(err)}}.call(this)}.call(this,_dereq_("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":66,"./_stream_duplex":67,"./internal/streams/destroy":74,"./internal/streams/state":78,"./internal/streams/stream":79,_process:63,buffer:55,inherits:60,"util-deprecate":81}],72:[function(_dereq_,module,exports){!function(process){!function(){var _Object$setPrototypeO;function _defineProperty(obj,key,value){(key=(arg=>{arg=(input=>{if("object"!=typeof input||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0===prim)return String(input);prim=prim.call(input,"string");if("object"!=typeof prim)return prim;throw new TypeError("@@toPrimitive must return a primitive value.")})(arg);return"symbol"==typeof arg?arg:String(arg)})(key))in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value}var finished=_dereq_("./end-of-stream"),kLastResolve=Symbol("lastResolve"),kLastReject=Symbol("lastReject"),kError=Symbol("error"),kEnded=Symbol("ended"),kLastPromise=Symbol("lastPromise"),kHandlePromise=Symbol("handlePromise"),kStream=Symbol("stream");function readAndResolve(iter){var data,resolve=iter[kLastResolve];null!==resolve&&null!==(data=iter[kStream].read())&&(iter[kLastPromise]=null,iter[kLastResolve]=null,iter[kLastReject]=null,resolve({value:data,done:!1}))}var AsyncIteratorPrototype=Object.getPrototypeOf(function(){}),ReadableStreamAsyncIteratorPrototype=Object.setPrototypeOf((_defineProperty(_Object$setPrototypeO={get stream(){return this[kStream]},next:function(){var _this=this,error=this[kError];if(null!==error)return Promise.reject(error);if(this[kEnded])return Promise.resolve({value:void 0,done:!0});if(this[kStream].destroyed)return new Promise(function(resolve,reject){process.nextTick(function(){_this[kError]?reject(_this[kError]):resolve({value:void 0,done:!0})})});var promise,error=this[kLastPromise];if(error)promise=new Promise(((lastPromise,iter)=>function(resolve,reject){lastPromise.then(function(){iter[kEnded]?resolve({value:void 0,done:!0}):iter[kHandlePromise](resolve,reject)},reject)})(error,this));else{error=this[kStream].read();if(null!==error)return Promise.resolve({value:error,done:!1});promise=new Promise(this[kHandlePromise])}return this[kLastPromise]=promise}},Symbol.asyncIterator,function(){return this}),_defineProperty(_Object$setPrototypeO,"return",function(){var _this2=this;return new Promise(function(resolve,reject){_this2[kStream].destroy(null,function(err){err?reject(err):resolve({value:void 0,done:!0})})})}),_Object$setPrototypeO),AsyncIteratorPrototype);module.exports=function(stream){var _Object$create,iterator=Object.create(ReadableStreamAsyncIteratorPrototype,(_defineProperty(_Object$create={},kStream,{value:stream,writable:!0}),_defineProperty(_Object$create,kLastResolve,{value:null,writable:!0}),_defineProperty(_Object$create,kLastReject,{value:null,writable:!0}),_defineProperty(_Object$create,kError,{value:null,writable:!0}),_defineProperty(_Object$create,kEnded,{value:stream._readableState.endEmitted,writable:!0}),_defineProperty(_Object$create,kHandlePromise,{value:function(resolve,reject){var data=iterator[kStream].read();data?(iterator[kLastPromise]=null,iterator[kLastResolve]=null,iterator[kLastReject]=null,resolve({value:data,done:!1})):(iterator[kLastResolve]=resolve,iterator[kLastReject]=reject)},writable:!0}),_Object$create));return iterator[kLastPromise]=null,finished(stream,function(err){var reject;err&&"ERR_STREAM_PREMATURE_CLOSE"!==err.code?(null!==(reject=iterator[kLastReject])&&(iterator[kLastPromise]=null,iterator[kLastResolve]=null,iterator[kLastReject]=null,reject(err)),iterator[kError]=err):(null!==(reject=iterator[kLastResolve])&&(iterator[kLastPromise]=null,iterator[kLastResolve]=null,reject({value:void 0,done:!(iterator[kLastReject]=null)})),iterator[kEnded]=!0)}),stream.on("readable",function(iter){process.nextTick(readAndResolve,iter)}.bind(null,iterator)),iterator}}.call(this)}.call(this,_dereq_("_process"))},{"./end-of-stream":75,_process:63}],73:[function(_dereq_,module,exports){function ownKeys(object,enumerableOnly){var symbols,keys=Object.keys(object);return Object.getOwnPropertySymbols&&(symbols=Object.getOwnPropertySymbols(object),enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)),keys}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){((obj,key,value)=>(key=_toPropertyKey(key))in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value)(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor)}}function _toPropertyKey(arg){arg=(input=>{if("object"!=typeof input||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0===prim)return String(input);prim=prim.call(input,"string");if("object"!=typeof prim)return prim;throw new TypeError("@@toPrimitive must return a primitive value.")})(arg);return"symbol"==typeof arg?arg:String(arg)}var Buffer=_dereq_("buffer").Buffer,inspect=_dereq_("util").inspect,custom=inspect&&inspect.custom||"inspect";module.exports=(()=>{function BufferList(){if(!(this instanceof BufferList))throw new TypeError("Cannot call a class as a function");this.head=null,this.tail=null,this.length=0}var Constructor=BufferList;return _defineProperties(Constructor.prototype,[{key:"push",value:function(v){v={data:v,next:null};0<this.length?this.tail.next=v:this.head=v,this.tail=v,++this.length}},{key:"unshift",value:function(v){v={data:v,next:this.head};0===this.length&&(this.tail=v),this.head=v,++this.length}},{key:"shift",value:function(){var ret;if(0!==this.length)return ret=this.head.data,1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,ret}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(s){if(0===this.length)return"";for(var p=this.head,ret=""+p.data;p=p.next;)ret+=s+p.data;return ret}},{key:"concat",value:function(n){if(0===this.length)return Buffer.alloc(0);for(var src,offset,ret=Buffer.allocUnsafe(n>>>0),p=this.head,i=0;p;)src=p.data,offset=i,Buffer.prototype.copy.call(src,ret,offset),i+=p.data.length,p=p.next;return ret}},{key:"consume",value:function(n,hasStrings){var ret;return n<this.head.data.length?(ret=this.head.data.slice(0,n),this.head.data=this.head.data.slice(n)):ret=n===this.head.data.length?this.shift():hasStrings?this._getString(n):this._getBuffer(n),ret}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(n){var p=this.head,c=1,ret=p.data;for(n-=ret.length;p=p.next;){var str=p.data,nb=n>str.length?str.length:n;if(ret+=nb===str.length?str:str.slice(0,n),0==(n-=nb)){nb===str.length?(++c,p.next?this.head=p.next:this.head=this.tail=null):(this.head=p).data=str.slice(nb);break}++c}return this.length-=c,ret}},{key:"_getBuffer",value:function(n){var ret=Buffer.allocUnsafe(n),p=this.head,c=1;for(p.data.copy(ret),n-=p.data.length;p=p.next;){var buf=p.data,nb=n>buf.length?buf.length:n;if(buf.copy(ret,ret.length-n,0,nb),0==(n-=nb)){nb===buf.length?(++c,p.next?this.head=p.next:this.head=this.tail=null):(this.head=p).data=buf.slice(nb);break}++c}return this.length-=c,ret}},{key:custom,value:function(_,options){return inspect(this,_objectSpread(_objectSpread({},options),{},{depth:0,customInspect:!1}))}}]),Object.defineProperty(Constructor,"prototype",{writable:!1}),BufferList})()},{buffer:55,util:53}],74:[function(_dereq_,module,exports){!function(process){!function(){function emitErrorAndCloseNT(self,err){emitErrorNT(self,err),emitCloseNT(self)}function emitCloseNT(self){self._writableState&&!self._writableState.emitClose||self._readableState&&!self._readableState.emitClose||self.emit("close")}function emitErrorNT(self,err){self.emit("error",err)}module.exports={destroy:function(err,cb){var _this=this,readableDestroyed=this._readableState&&this._readableState.destroyed,writableDestroyed=this._writableState&&this._writableState.destroyed;return readableDestroyed||writableDestroyed?cb?cb(err):err&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(emitErrorNT,this,err)):process.nextTick(emitErrorNT,this,err)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(err||null,function(err){!cb&&err?_this._writableState?_this._writableState.errorEmitted?process.nextTick(emitCloseNT,_this):(_this._writableState.errorEmitted=!0,process.nextTick(emitErrorAndCloseNT,_this,err)):process.nextTick(emitErrorAndCloseNT,_this,err):cb?(process.nextTick(emitCloseNT,_this),cb(err)):process.nextTick(emitCloseNT,_this)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(stream,err){var rState=stream._readableState,wState=stream._writableState;rState&&rState.autoDestroy||wState&&wState.autoDestroy?stream.destroy(err):stream.emit("error",err)}}}.call(this)}.call(this,_dereq_("_process"))},{_process:63}],75:[function(_dereq_,module,exports){var ERR_STREAM_PREMATURE_CLOSE=_dereq_("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function noop(){}module.exports=function eos(stream,opts,callback){if("function"==typeof opts)return eos(stream,null,opts);function onlegacyfinish(){stream.writable||onfinish()}function onfinish(){writableEnded=!(writable=!1),readable||callback.call(stream)}function onend(){readableEnded=!(readable=!1),writable||callback.call(stream)}function onerror(err){callback.call(stream,err)}function onclose(){var err;return readable&&!readableEnded?(stream._readableState&&stream._readableState.ended||(err=new ERR_STREAM_PREMATURE_CLOSE),callback.call(stream,err)):writable&&!writableEnded?(stream._writableState&&stream._writableState.ended||(err=new ERR_STREAM_PREMATURE_CLOSE),callback.call(stream,err)):void 0}function onrequest(){stream.req.on("finish",onfinish)}callback=(callback=>{var called=!1;return function(){if(!called){called=!0;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];callback.apply(this,args)}}})(callback||noop);var readable=(opts=opts||{}).readable||!1!==opts.readable&&stream.readable,writable=opts.writable||!1!==opts.writable&&stream.writable,writableEnded=stream._writableState&&stream._writableState.finished,readableEnded=stream._readableState&&stream._readableState.endEmitted;return(stream=>stream.setHeader&&"function"==typeof stream.abort)(stream)?(stream.on("complete",onfinish),stream.on("abort",onclose),stream.req?onrequest():stream.on("request",onrequest)):writable&&!stream._writableState&&(stream.on("end",onlegacyfinish),stream.on("close",onlegacyfinish)),stream.on("end",onend),stream.on("finish",onfinish),!1!==opts.error&&stream.on("error",onerror),stream.on("close",onclose),function(){stream.removeListener("complete",onfinish),stream.removeListener("abort",onclose),stream.removeListener("request",onrequest),stream.req&&stream.req.removeListener("finish",onfinish),stream.removeListener("end",onlegacyfinish),stream.removeListener("close",onlegacyfinish),stream.removeListener("finish",onfinish),stream.removeListener("end",onend),stream.removeListener("error",onerror),stream.removeListener("close",onclose)}}},{"../../../errors":66}],76:[function(_dereq_,module,exports){module.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],77:[function(_dereq_,module,exports){var eos,_require$codes=_dereq_("../../../errors").codes,ERR_MISSING_ARGS=_require$codes.ERR_MISSING_ARGS,ERR_STREAM_DESTROYED=_require$codes.ERR_STREAM_DESTROYED;function call(fn){fn()}function pipe(from,to){return from.pipe(to)}module.exports=function(){for(var _len=arguments.length,streams=new Array(_len),_key=0;_key<_len;_key++)streams[_key]=arguments[_key];var error,callback=(streams=>streams.length&&"function"==typeof streams[streams.length-1]?streams.pop():function(err){if(err)throw err})(streams);if((streams=Array.isArray(streams[0])?streams[0]:streams).length<2)throw new ERR_MISSING_ARGS("streams");var destroys=streams.map(function(stream,i){var reading=i<streams.length-1;return((stream,reading,writing,callback)=>{callback=(callback=>{var called=!1;return function(){called||(called=!0,callback.apply(void 0,arguments))}})(callback);var closed=!1,destroyed=(stream.on("close",function(){closed=!0}),(eos=void 0===eos?_dereq_("./end-of-stream"):eos)(stream,{readable:reading,writable:writing},function(err){if(err)return callback(err);closed=!0,callback()}),!1);return function(err){if(!closed&&!destroyed)return destroyed=!0,(stream=>stream.setHeader&&"function"==typeof stream.abort)(stream)?stream.abort():"function"==typeof stream.destroy?stream.destroy():void callback(err||new ERR_STREAM_DESTROYED("pipe"))}})(stream,reading,0<i,function(err){error=error||err,err&&destroys.forEach(call),reading||(destroys.forEach(call),callback(error))})});return streams.reduce(pipe)}},{"../../../errors":66,"./end-of-stream":75}],78:[function(_dereq_,module,exports){var ERR_INVALID_OPT_VALUE=_dereq_("../../../errors").codes.ERR_INVALID_OPT_VALUE;module.exports={getHighWaterMark:function(state,options,duplexKey,isDuplex){options=((options,isDuplex,duplexKey)=>null!=options.highWaterMark?options.highWaterMark:isDuplex?options[duplexKey]:null)(options,isDuplex,duplexKey);if(null==options)return state.objectMode?16:16384;if(!isFinite(options)||Math.floor(options)!==options||options<0)throw new ERR_INVALID_OPT_VALUE(isDuplex?duplexKey:"highWaterMark",options);return Math.floor(options)}}},{"../../../errors":66}],79:[function(_dereq_,module,exports){module.exports=_dereq_("events").EventEmitter},{events:58}],80:[function(_dereq_,module,exports){var Buffer=_dereq_("safe-buffer").Buffer,isEncoding=Buffer.isEncoding||function(encoding){switch((encoding=""+encoding)&&encoding.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function StringDecoder(encoding){var nb;switch(this.encoding=(enc=>{var nenc=(enc=>{if(!enc)return"utf8";for(var retried;;)switch(enc){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return enc;default:if(retried)return;enc=(""+enc).toLowerCase(),retried=!0}})(enc);if("string"==typeof nenc||Buffer.isEncoding!==isEncoding&&isEncoding(enc))return nenc||enc;throw new Error("Unknown encoding: "+enc)})(encoding),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,nb=4;break;case"utf8":this.fillLast=utf8FillLast,nb=4;break;case"base64":this.text=base64Text,this.end=base64End,nb=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=Buffer.allocUnsafe(nb)}function utf8CheckByte(byte){return byte<=127?0:byte>>5==6?2:byte>>4==14?3:byte>>3==30?4:byte>>6==2?-1:-2}function utf8FillLast(buf){var p=this.lastTotal-this.lastNeed,r=((self,buf)=>128!=(192&buf[0])?(self.lastNeed=0,"<22>"):1<self.lastNeed&&1<buf.length?128!=(192&buf[1])?(self.lastNeed=1,"<22>"):2<self.lastNeed&&2<buf.length&&128!=(192&buf[2])?(self.lastNeed=2,"<22>"):void 0:void 0)(this,buf);return void 0!==r?r:this.lastNeed<=buf.length?(buf.copy(this.lastChar,p,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(buf.copy(this.lastChar,p,0,buf.length),void(this.lastNeed-=buf.length))}function utf16Text(buf,i){if((buf.length-i)%2!=0)return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=buf[buf.length-1],buf.toString("utf16le",i,buf.length-1);i=buf.toString("utf16le",i);if(i){var c=i.charCodeAt(i.length-1);if(55296<=c&&c<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=buf[buf.length-2],this.lastChar[1]=buf[buf.length-1],i.slice(0,-1)}return i}function utf16End(buf){var end,buf=buf&&buf.length?this.write(buf):"";return this.lastNeed?(end=this.lastTotal-this.lastNeed,buf+this.lastChar.toString("utf16le",0,end)):buf}function base64Text(buf,i){var n=(buf.length-i)%3;return 0==n?buf.toString("base64",i):(this.lastNeed=3-n,this.lastTotal=3,1==n?this.lastChar[0]=buf[buf.length-1]:(this.lastChar[0]=buf[buf.length-2],this.lastChar[1]=buf[buf.length-1]),buf.toString("base64",i,buf.length-n))}function base64End(buf){buf=buf&&buf.length?this.write(buf):"";return this.lastNeed?buf+this.lastChar.toString("base64",0,3-this.lastNeed):buf}function simpleWrite(buf){return buf.toString(this.encoding)}function simpleEnd(buf){return buf&&buf.length?this.write(buf):""}(exports.StringDecoder=StringDecoder).prototype.write=function(buf){if(0===buf.length)return"";var r,i;if(this.lastNeed){if(void 0===(r=this.fillLast(buf)))return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i<buf.length?r?r+this.text(buf,i):this.text(buf,i):r||""},StringDecoder.prototype.end=function(buf){buf=buf&&buf.length?this.write(buf):"";return this.lastNeed?buf+"<22>":buf},StringDecoder.prototype.text=function(buf,i){var total=((self,buf,i)=>{var j=buf.length-1;if(!(j<i)){var nb=utf8CheckByte(buf[j]);if(0<=nb)return 0<nb&&(self.lastNeed=nb-1),nb;if(!(--j<i||-2===nb)){if(0<=(nb=utf8CheckByte(buf[j])))return 0<nb&&(self.lastNeed=nb-2),nb;if(!(--j<i||-2===nb)&&0<=(nb=utf8CheckByte(buf[j])))return 0<nb&&(2===nb?nb=0:self.lastNeed=nb-3),nb}}return 0})(this,buf,i);if(!this.lastNeed)return buf.toString("utf8",i);this.lastTotal=total;total=buf.length-(total-this.lastNeed);return buf.copy(this.lastChar,0,total),buf.toString("utf8",i,total)},StringDecoder.prototype.fillLast=function(buf){if(this.lastNeed<=buf.length)return buf.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);buf.copy(this.lastChar,this.lastTotal-this.lastNeed,0,buf.length),this.lastNeed-=buf.length}},{"safe-buffer":64}],81:[function(_dereq_,module,exports){!function(global){!function(){function config(name){try{if(!global.localStorage)return}catch(_){return}name=global.localStorage[name];return null!=name&&"true"===String(name).toLowerCase()}module.exports=function(fn,msg){var warned;return config("noDeprecation")?fn:(warned=!1,function(){if(!warned){if(config("throwDeprecation"))throw new Error(msg);config("traceDeprecation"),warned=!0}return fn.apply(this,arguments)})}}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[30])(30)});
|
||
//# sourceMappingURL=dblurt.js.map
|