@gardenfi/core 0.2.0-beta.0 → 0.2.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,809 +1,29 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const utils$v=require("@catalogfi/utils"),orderbook=require("@gardenfi/orderbook"),viem=require("viem"),wallets=require("@catalogfi/wallets"),bitcoin=require("bitcoinjs-lib"),ecc=require("tiny-secp256k1"),varuint=require("varuint-bitcoin");function _interopNamespaceDefault(b){const v=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(b){for(const w in b)if(w!=="default"){const _=Object.getOwnPropertyDescriptor(b,w);Object.defineProperty(v,w,_.get?_:{enumerable:!0,get:()=>b[w]})}}return v.default=b,Object.freeze(v)}const bitcoin__namespace=_interopNamespaceDefault(bitcoin),ecc__namespace=_interopNamespaceDefault(ecc),varuint__namespace=_interopNamespaceDefault(varuint);var TimeLocks=(b=>(b[b.evm=14400]="evm",b[b.btc=288]="btc",b))(TimeLocks||{});const o$2=b=>b.startsWith("0x")?b:`0x${b}`,r$6=b=>`Bearer ${b}`,o$1="2.21.18";let u$3={getDocsUrl:({docsBaseUrl:b,docsPath:v="",docsSlug:w})=>v?`${b??"https://viem.sh"}${v}${w?`#${w}`:""}`:void 0,version:o$1},r$5=class tr extends Error{constructor(v,w={}){var _;const A=(()=>{var N;return w.cause instanceof tr?w.cause.details:(N=w.cause)!=null&&N.message?w.cause.message:w.details})(),E=w.cause instanceof tr&&w.cause.docsPath||w.docsPath,k=(_=u$3.getDocsUrl)==null?void 0:_.call(u$3,{...w,docsPath:E}),P=[v||"An error occurred.","",...w.metaMessages?[...w.metaMessages,""]:[],...k?[`Docs: ${k}`]:[],...A?[`Details: ${A}`]:[],`Version: ${u$3.version}`].join(`
2
- `);super(P,w.cause?{cause:w.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=A,this.docsPath=E,this.metaMessages=w.metaMessages,this.name=w.name??this.name,this.shortMessage=v,this.version=o$1}walk(v){return d$2(this,v)}};function d$2(b,v){return v!=null&&v(b)?b:b&&typeof b=="object"&&"cause"in b?d$2(b.cause,v):v?null:b}let d$1=class extends r$5{constructor({blockHash:v,blockNumber:w}){let _="Block";v&&(_=`Block at hash "${v}"`),w&&(_=`Block at number "${w}"`),super(`${_} could not be found.`,{name:"BlockNotFoundError"})}},u$2=class extends r$5{constructor({blockHash:v,blockNumber:w,blockTag:_,hash:A,index:E}){let k="Transaction";_&&E!==void 0&&(k=`Transaction at block time "${_}" at index "${E}"`),v&&E!==void 0&&(k=`Transaction at block hash "${v}" at index "${E}"`),w&&E!==void 0&&(k=`Transaction at block number "${w}" at index "${E}"`),A&&(k=`Transaction with hash "${A}"`),super(`${k} could not be found.`,{name:"TransactionNotFoundError"})}};class d extends r$5{constructor({hash:v}){super(`Transaction receipt with hash "${v}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}let T$2=class extends r$5{constructor({hash:v}){super(`Timed out while waiting for transaction with hash "${v}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}};function f$5(b,v,w){const _=b[v.name];if(typeof _=="function")return _;const A=b[w];return typeof A=="function"?A:E=>v(b,E)}const o=new Map,h$2=new Map;let y$2=0;function M$1(b,v,w){const _=++y$2,A=()=>o.get(b)||[],E=()=>{const B=A();o.set(b,B.filter(O=>O.id!==_))},k=()=>{const B=h$2.get(b);A().length===1&&B&&B(),E()},P=A();if(o.set(b,[...P,{id:_,fns:v}]),P&&P.length>0)return k;const N={};for(const B in v)N[B]=(...O)=>{var I,D;const V=A();if(V.length!==0)for(const ee of V)(D=(I=ee.fns)[B])==null||D.call(I,...O)};const q=w(N);return typeof q=="function"&&h$2.set(b,q),k}async function n(b){return new Promise(v=>setTimeout(v,b))}function p$2(b,{delay:v=100,retryCount:w=2,shouldRetry:_=()=>!0}={}){return new Promise((A,E)=>{const k=async({count:P=0}={})=>{const N=async({error:q})=>{const B=typeof v=="function"?v({count:P,error:q}):v;B&&await n(B),k({count:P+1})};try{const q=await b();A(q)}catch(q){if(P<w&&await _({count:P,error:q}))return N({error:q});E(q)}};k()})}const g$3=(b,v,w)=>JSON.stringify(b,(_,A)=>typeof A=="bigint"?A.toString():A,w);class $ extends r$5{constructor({max:v,min:w,signed:_,size:A,value:E}){super(`Number "${E}" is not in safe ${A?`${A*8}-bit ${_?"signed":"unsigned"} `:""}integer range ${v?`(${w} to ${v})`:`(above ${w})`}`,{name:"IntegerOutOfRangeError"})}}let c$1=class extends r$5{constructor({givenSize:v,maxSize:w}){super(`Size cannot exceed ${w} bytes. Given size: ${v} bytes.`,{name:"SizeOverflowError"})}};class a extends r$5{constructor({size:v,targetSize:w,type:_}){super(`${_.charAt(0).toUpperCase()}${_.slice(1).toLowerCase()} size (${v}) exceeds padding size (${w}).`,{name:"SizeExceedsPaddingSizeError"})}}function f$4(b,{dir:v,size:w=32}={}){return typeof b=="string"?p$1(b,{dir:v,size:w}):i$4(b,{dir:v,size:w})}function p$1(b,{dir:v,size:w=32}={}){if(w===null)return b;const _=b.replace("0x","");if(_.length>w*2)throw new a({size:Math.ceil(_.length/2),targetSize:w,type:"hex"});return`0x${_[v==="right"?"padEnd":"padStart"](w*2,"0")}`}function i$4(b,{dir:v,size:w=32}={}){if(w===null)return b;if(b.length>w)throw new a({size:b.length,targetSize:w,type:"bytes"});const _=new Uint8Array(w);for(let A=0;A<w;A++){const E=v==="right";_[E?A:w-A-1]=b[E?A:b.length-A-1]}return _}function x(b,v={}){const{signed:w,size:_}=v,A=BigInt(b);let E;_?w?E=(1n<<BigInt(_)*8n-1n)-1n:E=2n**(BigInt(_)*8n)-1n:typeof b=="number"&&(E=BigInt(Number.MAX_SAFE_INTEGER));const k=typeof E=="bigint"&&w?-E-1n:0;if(E&&A>E||A<k){const N=typeof b=="bigint"?"n":"";throw new $({max:E?`${E}${N}`:void 0,min:`${k}${N}`,signed:w,size:_,value:`${b}${N}`})}const P=`0x${(w&&A<0?(1n<<BigInt(_*8))+BigInt(A):A).toString(16)}`;return _?f$4(P,{size:_}):P}function e(b,{strict:v=!0}={}){return!b||typeof b!="string"?!1:v?/^0x[0-9a-fA-F]*$/.test(b):b.startsWith("0x")}function i$3(b){return e(b,{strict:!1})?Math.ceil((b.length-2)/2):b.length}function s$1(b,{size:v}){if(i$3(b)>v)throw new c$1({givenSize:i$3(b),maxSize:v})}function z(b,v={}){const{signed:w}=v;v.size&&s$1(b,{size:v.size});const _=BigInt(b);if(!w)return _;const A=(b.length-2)/2,E=(1n<<BigInt(A)*8n-1n)-1n;return _<=E?_:_-BigInt(`0x${"f".padStart(A*2,"f")}`)-1n}function g$2(b,v={}){return Number(z(b,v))}const y$1={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function l$1(b){const v={...b,blockHash:b.blockHash?b.blockHash:null,blockNumber:b.blockNumber?BigInt(b.blockNumber):null,chainId:b.chainId?g$2(b.chainId):void 0,gas:b.gas?BigInt(b.gas):void 0,gasPrice:b.gasPrice?BigInt(b.gasPrice):void 0,maxFeePerBlobGas:b.maxFeePerBlobGas?BigInt(b.maxFeePerBlobGas):void 0,maxFeePerGas:b.maxFeePerGas?BigInt(b.maxFeePerGas):void 0,maxPriorityFeePerGas:b.maxPriorityFeePerGas?BigInt(b.maxPriorityFeePerGas):void 0,nonce:b.nonce?g$2(b.nonce):void 0,to:b.to?b.to:null,transactionIndex:b.transactionIndex?Number(b.transactionIndex):null,type:b.type?y$1[b.type]:void 0,typeHex:b.type?b.type:void 0,value:b.value?BigInt(b.value):void 0,v:b.v?BigInt(b.v):void 0};return b.authorizationList&&(v.authorizationList=i$2(b.authorizationList)),v.yParity=(()=>{if(b.yParity)return Number(b.yParity);if(typeof v.v=="bigint"){if(v.v===0n||v.v===27n)return 0;if(v.v===1n||v.v===28n)return 1;if(v.v>=35n)return v.v%2n===0n?1:0}})(),v.type==="legacy"&&(delete v.accessList,delete v.maxFeePerBlobGas,delete v.maxFeePerGas,delete v.maxPriorityFeePerGas,delete v.yParity),v.type==="eip2930"&&(delete v.maxFeePerBlobGas,delete v.maxFeePerGas,delete v.maxPriorityFeePerGas),v.type==="eip1559"&&delete v.maxFeePerBlobGas,v}function i$2(b){return b.map(v=>({contractAddress:v.address,r:v.r,s:v.s,chainId:Number(v.chainId),nonce:Number(v.nonce),...typeof v.yParity<"u"?{yParity:Number(v.yParity)}:{},...typeof v.v<"u"&&typeof v.yParity>"u"?{v:Number(v.v)}:{}}))}function u$1(b){var v;const w=(v=b.transactions)==null?void 0:v.map(_=>typeof _=="string"?_:l$1(_));return{...b,baseFeePerGas:b.baseFeePerGas?BigInt(b.baseFeePerGas):null,blobGasUsed:b.blobGasUsed?BigInt(b.blobGasUsed):void 0,difficulty:b.difficulty?BigInt(b.difficulty):void 0,excessBlobGas:b.excessBlobGas?BigInt(b.excessBlobGas):void 0,gasLimit:b.gasLimit?BigInt(b.gasLimit):void 0,gasUsed:b.gasUsed?BigInt(b.gasUsed):void 0,hash:b.hash?b.hash:null,logsBloom:b.logsBloom?b.logsBloom:null,nonce:b.nonce?b.nonce:null,number:b.number?BigInt(b.number):null,size:b.size?BigInt(b.size):void 0,timestamp:b.timestamp?BigInt(b.timestamp):void 0,transactions:w,totalDifficulty:b.totalDifficulty?BigInt(b.totalDifficulty):null}}async function T$1(b,{blockHash:v,blockNumber:w,blockTag:_,includeTransactions:A}={}){var E,k,P;const N=_??"latest",q=A??!1,B=w!==void 0?x(w):void 0;let O=null;if(v?O=await b.request({method:"eth_getBlockByHash",params:[v,q]},{dedupe:!0}):O=await b.request({method:"eth_getBlockByNumber",params:[B||N,q]},{dedupe:!!B}),!O)throw new d$1({blockHash:v,blockNumber:w});return(((P=(k=(E=b.chain)==null?void 0:E.formatters)==null?void 0:k.block)==null?void 0:P.format)||u$1)(O)}async function h$1(b,{blockHash:v,blockNumber:w,blockTag:_,hash:A,index:E}){var k,P,N;const q=_||"latest",B=w!==void 0?x(w):void 0;let O=null;if(A?O=await b.request({method:"eth_getTransactionByHash",params:[A]},{dedupe:!0}):v?O=await b.request({method:"eth_getTransactionByBlockHashAndIndex",params:[v,x(E)]},{dedupe:!0}):(B||q)&&(O=await b.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[B||q,x(E)]},{dedupe:!!B})),!O)throw new u$2({blockHash:v,blockNumber:w,blockTag:q,hash:A,index:E});return(((N=(P=(k=b.chain)==null?void 0:k.formatters)==null?void 0:P.transaction)==null?void 0:N.format)||l$1)(O)}function r$4(b,{args:v,eventName:w}={}){return{...b,blockHash:b.blockHash?b.blockHash:null,blockNumber:b.blockNumber?BigInt(b.blockNumber):null,logIndex:b.logIndex?Number(b.logIndex):null,transactionHash:b.transactionHash?b.transactionHash:null,transactionIndex:b.transactionIndex?Number(b.transactionIndex):null,...w?{args:v,eventName:w}:{}}}const f$3={"0x0":"reverted","0x1":"success"};function r$3(b){const v={...b,blockNumber:b.blockNumber?BigInt(b.blockNumber):null,contractAddress:b.contractAddress?b.contractAddress:null,cumulativeGasUsed:b.cumulativeGasUsed?BigInt(b.cumulativeGasUsed):null,effectiveGasPrice:b.effectiveGasPrice?BigInt(b.effectiveGasPrice):null,gasUsed:b.gasUsed?BigInt(b.gasUsed):null,logs:b.logs?b.logs.map(w=>r$4(w)):null,to:b.to?b.to:null,transactionIndex:b.transactionIndex?g$2(b.transactionIndex):null,status:b.status?f$3[b.status]:null,type:b.type?y$1[b.type]||b.type:null};return b.blobGasPrice&&(v.blobGasPrice=BigInt(b.blobGasPrice)),b.blobGasUsed&&(v.blobGasUsed=BigInt(b.blobGasUsed)),v}async function f$2(b,{hash:v}){var w,_,A;const E=await b.request({method:"eth_getTransactionReceipt",params:[v]},{dedupe:!0});if(!E)throw new d({hash:v});return(((A=(_=(w=b.chain)==null?void 0:w.formatters)==null?void 0:_.transactionReceipt)==null?void 0:A.format)||r$3)(E)}function f$1(b,{emitOnBegin:v,initialWaitTime:w,interval:_}){let A=!0;const E=()=>A=!1;return(async()=>{let k;v&&(k=await b({unpoll:E}));const P=await w?.(k)??_;await n(P);const N=async()=>{A&&(await b({unpoll:E}),await n(_),N())};N()})(),E}const i$1=new Map,c=new Map;function p(b){const v=(A,E)=>({clear:()=>E.delete(A),get:()=>E.get(A),set:k=>E.set(A,k)}),w=v(b,i$1),_=v(b,c);return{clear:()=>{w.clear(),_.clear()},promise:w,response:_}}async function l(b,{cacheKey:v,cacheTime:w=Number.POSITIVE_INFINITY}){const _=p(v),A=_.response.get();if(A&&w>0&&new Date().getTime()-A.created.getTime()<w)return A.data;let E=_.promise.get();E||(E=b(),_.promise.set(E));try{const k=await E;return _.response.set({created:new Date,data:k}),k}finally{_.promise.clear()}}const r$2=b=>`blockNumber.${b}`;async function u(b,{cacheTime:v=b.cacheTime}={}){const w=await l(()=>b.request({method:"eth_blockNumber"}),{cacheKey:r$2(b.uid),cacheTime:v});return BigInt(w)}function j(b,{emitOnBegin:v=!1,emitMissed:w=!1,onBlockNumber:_,onError:A,poll:E,pollingInterval:k=b.pollingInterval}){const P=typeof E<"u"?E:!(b.transport.type==="webSocket"||b.transport.type==="fallback"&&b.transport.transports[0].config.type==="webSocket");let N;return P?(()=>{const q=g$3(["watchBlockNumber",b.uid,v,w,k]);return M$1(q,{onBlockNumber:_,onError:A},B=>f$1(async()=>{var O;try{const I=await f$5(b,u,"getBlockNumber")({cacheTime:0});if(N){if(I===N)return;if(I-N>1&&w)for(let D=N+1n;D<I;D++)B.onBlockNumber(D,N),N=D}(!N||I>N)&&(B.onBlockNumber(I,N),N=I)}catch(I){(O=B.onError)==null||O.call(B,I)}},{emitOnBegin:v,interval:k}))})():(()=>{const q=g$3(["watchBlockNumber",b.uid,v,w]);return M$1(q,{onBlockNumber:_,onError:A},B=>{let O=!0,I=()=>O=!1;return(async()=>{try{const D=(()=>{if(b.transport.type==="fallback"){const ee=b.transport.transports.find(J=>J.config.type==="webSocket");return ee?ee.value:b.transport}return b.transport})(),{unsubscribe:V}=await D.subscribe({params:["newHeads"],onData(ee){var J;if(!O)return;const te=z((J=ee.result)==null?void 0:J.number);B.onBlockNumber(te,N),N=te},onError(ee){var J;(J=B.onError)==null||J.call(B,ee)}});I=V,O||I()}catch(D){A?.(D)}})(),()=>I()})})()}async function Y(b,{confirmations:v=1,hash:w,onReplaced:_,pollingInterval:A=b.pollingInterval,retryCount:E=6,retryDelay:k=({count:N})=>~~(1<<N)*200,timeout:P=18e4}){const N=g$3(["waitForTransactionReceipt",b.uid,w]);let q,B,O,I=!1;return new Promise((D,V)=>{P&&setTimeout(()=>V(new T$2({hash:w})),P);const ee=M$1(N,{onReplaced:_,resolve:D,reject:V},J=>{const te=f$5(b,j,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:A,async onBlockNumber(se){const ce=he=>{te(),he(),ee()};let ae=se;if(!I)try{if(O){if(v>1&&(!O.blockNumber||ae-O.blockNumber+1n<v))return;ce(()=>J.resolve(O));return}if(q||(I=!0,await p$2(async()=>{q=await f$5(b,h$1,"getTransaction")({hash:w}),q.blockNumber&&(ae=q.blockNumber)},{delay:k,retryCount:E}),I=!1),O=await f$5(b,f$2,"getTransactionReceipt")({hash:w}),v>1&&(!O.blockNumber||ae-O.blockNumber+1n<v))return;ce(()=>J.resolve(O))}catch(he){if(he instanceof u$2||he instanceof d){if(!q){I=!1;return}try{B=q,I=!0;const oe=await p$2(()=>f$5(b,T$1,"getBlock")({blockNumber:ae,includeTransactions:!0}),{delay:k,retryCount:E,shouldRetry:({error:be})=>be instanceof d$1});I=!1;const de=oe.transactions.find(({from:be,nonce:pe})=>be===B.from&&pe===B.nonce);if(!de||(O=await f$5(b,f$2,"getTransactionReceipt")({hash:de.hash}),v>1&&(!O.blockNumber||ae-O.blockNumber+1n<v)))return;let le="replaced";de.to===B.to&&de.value===B.value?le="repriced":de.from===de.to&&de.value===0n&&(le="cancelled"),ce(()=>{var be;(be=J.onReplaced)==null||be.call(J,{reason:le,replacedTransaction:B,transaction:de,transactionReceipt:O}),J.resolve(O)})}catch(oe){ce(()=>J.reject(oe))}}else ce(()=>J.reject(he))}}})})})}const y=async(b,v,w,_)=>{if(!_.account)return utils$v.Err("No account found");const A=viem.getContract({address:o$2(v),abi:viem.erc20Abi,client:_}),E=await _.getAddresses();if(!E[0])return utils$v.Err("No account found");try{const k=await A.read.allowance([o$2(E[0]),o$2(w)]);if(BigInt(k)<BigInt(b)){const P=await A.write.approve([o$2(w),viem.maxUint256],{account:_.account,chain:_.chain});return(await Y(_,{hash:P})).status!=="success"?utils$v.Err("Failed to approve"):utils$v.Ok(P)}return utils$v.Ok("Already approved")}catch(k){return utils$v.Err("Failed to approve: "+k)}};let r$1=class rr extends URL{constructor(v,w){super(v,w)}endpoint(v){v.startsWith("/")||(v=`/${v}`);const w=`${this.pathname!=="/"?this.pathname:""}${v}`;return new rr(w,this)}socket(){if(this.protocol==="https:")return this.origin.replace("https","wss");if(this.protocol==="http:")return this.origin.replace("http","ws");throw new Error("Invalid protocol")}};var buffer$1={},base64Js={};base64Js.byteLength=byteLength;base64Js.toByteArray=toByteArray;base64Js.fromByteArray=fromByteArray;var lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,len=code.length;i<len;++i)lookup[i]=code[i],revLookup[code.charCodeAt(i)]=i;revLookup[45]=62;revLookup[95]=63;function getLens(b){var v=b.length;if(v%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var w=b.indexOf("=");w===-1&&(w=v);var _=w===v?0:4-w%4;return[w,_]}function byteLength(b){var v=getLens(b),w=v[0],_=v[1];return(w+_)*3/4-_}function _byteLength(b,v,w){return(v+w)*3/4-w}function toByteArray(b){var v,w=getLens(b),_=w[0],A=w[1],E=new Arr(_byteLength(b,_,A)),k=0,P=A>0?_-4:_,N;for(N=0;N<P;N+=4)v=revLookup[b.charCodeAt(N)]<<18|revLookup[b.charCodeAt(N+1)]<<12|revLookup[b.charCodeAt(N+2)]<<6|revLookup[b.charCodeAt(N+3)],E[k++]=v>>16&255,E[k++]=v>>8&255,E[k++]=v&255;return A===2&&(v=revLookup[b.charCodeAt(N)]<<2|revLookup[b.charCodeAt(N+1)]>>4,E[k++]=v&255),A===1&&(v=revLookup[b.charCodeAt(N)]<<10|revLookup[b.charCodeAt(N+1)]<<4|revLookup[b.charCodeAt(N+2)]>>2,E[k++]=v>>8&255,E[k++]=v&255),E}function tripletToBase64(b){return lookup[b>>18&63]+lookup[b>>12&63]+lookup[b>>6&63]+lookup[b&63]}function encodeChunk(b,v,w){for(var _,A=[],E=v;E<w;E+=3)_=(b[E]<<16&16711680)+(b[E+1]<<8&65280)+(b[E+2]&255),A.push(tripletToBase64(_));return A.join("")}function fromByteArray(b){for(var v,w=b.length,_=w%3,A=[],E=16383,k=0,P=w-_;k<P;k+=E)A.push(encodeChunk(b,k,k+E>P?P:k+E));return _===1?(v=b[w-1],A.push(lookup[v>>2]+lookup[v<<4&63]+"==")):_===2&&(v=(b[w-2]<<8)+b[w-1],A.push(lookup[v>>10]+lookup[v>>4&63]+lookup[v<<2&63]+"=")),A.join("")}var ieee754={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ieee754.read=function(b,v,w,_,A){var E,k,P=A*8-_-1,N=(1<<P)-1,q=N>>1,B=-7,O=w?A-1:0,I=w?-1:1,D=b[v+O];for(O+=I,E=D&(1<<-B)-1,D>>=-B,B+=P;B>0;E=E*256+b[v+O],O+=I,B-=8);for(k=E&(1<<-B)-1,E>>=-B,B+=_;B>0;k=k*256+b[v+O],O+=I,B-=8);if(E===0)E=1-q;else{if(E===N)return k?NaN:(D?-1:1)*(1/0);k=k+Math.pow(2,_),E=E-q}return(D?-1:1)*k*Math.pow(2,E-_)};ieee754.write=function(b,v,w,_,A,E){var k,P,N,q=E*8-A-1,B=(1<<q)-1,O=B>>1,I=A===23?Math.pow(2,-24)-Math.pow(2,-77):0,D=_?0:E-1,V=_?1:-1,ee=v<0||v===0&&1/v<0?1:0;for(v=Math.abs(v),isNaN(v)||v===1/0?(P=isNaN(v)?1:0,k=B):(k=Math.floor(Math.log(v)/Math.LN2),v*(N=Math.pow(2,-k))<1&&(k--,N*=2),k+O>=1?v+=I/N:v+=I*Math.pow(2,1-O),v*N>=2&&(k++,N/=2),k+O>=B?(P=0,k=B):k+O>=1?(P=(v*N-1)*Math.pow(2,A),k=k+O):(P=v*Math.pow(2,O-1)*Math.pow(2,A),k=0));A>=8;b[w+D]=P&255,D+=V,P/=256,A-=8);for(k=k<<A|P,q+=A;q>0;b[w+D]=k&255,D+=V,k/=256,q-=8);b[w+D-V]|=ee*128};/*!
3
- * The buffer module from node.js, for the browser.
4
- *
5
- * @author Feross Aboukhadijeh <https://feross.org>
6
- * @license MIT
7
- */(function(b){const v=base64Js,w=ieee754,_=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;b.Buffer=B,b.SlowBuffer=he,b.INSPECT_MAX_BYTES=50;const A=2147483647;b.kMaxLength=A;const{Uint8Array:E,ArrayBuffer:k,SharedArrayBuffer:P}=globalThis;B.TYPED_ARRAY_SUPPORT=N(),!B.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function N(){try{const we=new E(1),me={foo:function(){return 42}};return Object.setPrototypeOf(me,E.prototype),Object.setPrototypeOf(we,me),we.foo()===42}catch{return!1}}Object.defineProperty(B.prototype,"parent",{enumerable:!0,get:function(){if(B.isBuffer(this))return this.buffer}}),Object.defineProperty(B.prototype,"offset",{enumerable:!0,get:function(){if(B.isBuffer(this))return this.byteOffset}});function q(we){if(we>A)throw new RangeError('The value "'+we+'" is invalid for option "size"');const me=new E(we);return Object.setPrototypeOf(me,B.prototype),me}function B(we,me,ye){if(typeof we=="number"){if(typeof me=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return V(we)}return O(we,me,ye)}B.poolSize=8192;function O(we,me,ye){if(typeof we=="string")return ee(we,me);if(k.isView(we))return te(we);if(we==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof we);if(at(we,k)||we&&at(we.buffer,k)||typeof P<"u"&&(at(we,P)||we&&at(we.buffer,P)))return se(we,me,ye);if(typeof we=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const Me=we.valueOf&&we.valueOf();if(Me!=null&&Me!==we)return B.from(Me,me,ye);const je=ce(we);if(je)return je;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof we[Symbol.toPrimitive]=="function")return B.from(we[Symbol.toPrimitive]("string"),me,ye);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof we)}B.from=function(we,me,ye){return O(we,me,ye)},Object.setPrototypeOf(B.prototype,E.prototype),Object.setPrototypeOf(B,E);function I(we){if(typeof we!="number")throw new TypeError('"size" argument must be of type number');if(we<0)throw new RangeError('The value "'+we+'" is invalid for option "size"')}function D(we,me,ye){return I(we),we<=0?q(we):me!==void 0?typeof ye=="string"?q(we).fill(me,ye):q(we).fill(me):q(we)}B.alloc=function(we,me,ye){return D(we,me,ye)};function V(we){return I(we),q(we<0?0:ae(we)|0)}B.allocUnsafe=function(we){return V(we)},B.allocUnsafeSlow=function(we){return V(we)};function ee(we,me){if((typeof me!="string"||me==="")&&(me="utf8"),!B.isEncoding(me))throw new TypeError("Unknown encoding: "+me);const ye=oe(we,me)|0;let Me=q(ye);const je=Me.write(we,me);return je!==ye&&(Me=Me.slice(0,je)),Me}function J(we){const me=we.length<0?0:ae(we.length)|0,ye=q(me);for(let Me=0;Me<me;Me+=1)ye[Me]=we[Me]&255;return ye}function te(we){if(at(we,E)){const me=new E(we);return se(me.buffer,me.byteOffset,me.byteLength)}return J(we)}function se(we,me,ye){if(me<0||we.byteLength<me)throw new RangeError('"offset" is outside of buffer bounds');if(we.byteLength<me+(ye||0))throw new RangeError('"length" is outside of buffer bounds');let Me;return me===void 0&&ye===void 0?Me=new E(we):ye===void 0?Me=new E(we,me):Me=new E(we,me,ye),Object.setPrototypeOf(Me,B.prototype),Me}function ce(we){if(B.isBuffer(we)){const me=ae(we.length)|0,ye=q(me);return ye.length===0||we.copy(ye,0,0,me),ye}if(we.length!==void 0)return typeof we.length!="number"||Fe(we.length)?q(0):J(we);if(we.type==="Buffer"&&Array.isArray(we.data))return J(we.data)}function ae(we){if(we>=A)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+A.toString(16)+" bytes");return we|0}function he(we){return+we!=we&&(we=0),B.alloc(+we)}B.isBuffer=function(me){return me!=null&&me._isBuffer===!0&&me!==B.prototype},B.compare=function(me,ye){if(at(me,E)&&(me=B.from(me,me.offset,me.byteLength)),at(ye,E)&&(ye=B.from(ye,ye.offset,ye.byteLength)),!B.isBuffer(me)||!B.isBuffer(ye))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(me===ye)return 0;let Me=me.length,je=ye.length;for(let He=0,Ue=Math.min(Me,je);He<Ue;++He)if(me[He]!==ye[He]){Me=me[He],je=ye[He];break}return Me<je?-1:je<Me?1:0},B.isEncoding=function(me){switch(String(me).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}},B.concat=function(me,ye){if(!Array.isArray(me))throw new TypeError('"list" argument must be an Array of Buffers');if(me.length===0)return B.alloc(0);let Me;if(ye===void 0)for(ye=0,Me=0;Me<me.length;++Me)ye+=me[Me].length;const je=B.allocUnsafe(ye);let He=0;for(Me=0;Me<me.length;++Me){let Ue=me[Me];if(at(Ue,E))He+Ue.length>je.length?(B.isBuffer(Ue)||(Ue=B.from(Ue)),Ue.copy(je,He)):E.prototype.set.call(je,Ue,He);else if(B.isBuffer(Ue))Ue.copy(je,He);else throw new TypeError('"list" argument must be an Array of Buffers');He+=Ue.length}return je};function oe(we,me){if(B.isBuffer(we))return we.length;if(k.isView(we)||at(we,k))return we.byteLength;if(typeof we!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof we);const ye=we.length,Me=arguments.length>2&&arguments[2]===!0;if(!Me&&ye===0)return 0;let je=!1;for(;;)switch(me){case"ascii":case"latin1":case"binary":return ye;case"utf8":case"utf-8":return De(we).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ye*2;case"hex":return ye>>>1;case"base64":return Qe(we).length;default:if(je)return Me?-1:De(we).length;me=(""+me).toLowerCase(),je=!0}}B.byteLength=oe;function de(we,me,ye){let Me=!1;if((me===void 0||me<0)&&(me=0),me>this.length||((ye===void 0||ye>this.length)&&(ye=this.length),ye<=0)||(ye>>>=0,me>>>=0,ye<=me))return"";for(we||(we="utf8");;)switch(we){case"hex":return L(this,me,ye);case"utf8":case"utf-8":return X(this,me,ye);case"ascii":return Q(this,me,ye);case"latin1":case"binary":return ne(this,me,ye);case"base64":return F(this,me,ye);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ue(this,me,ye);default:if(Me)throw new TypeError("Unknown encoding: "+we);we=(we+"").toLowerCase(),Me=!0}}B.prototype._isBuffer=!0;function le(we,me,ye){const Me=we[me];we[me]=we[ye],we[ye]=Me}B.prototype.swap16=function(){const me=this.length;if(me%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let ye=0;ye<me;ye+=2)le(this,ye,ye+1);return this},B.prototype.swap32=function(){const me=this.length;if(me%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let ye=0;ye<me;ye+=4)le(this,ye,ye+3),le(this,ye+1,ye+2);return this},B.prototype.swap64=function(){const me=this.length;if(me%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let ye=0;ye<me;ye+=8)le(this,ye,ye+7),le(this,ye+1,ye+6),le(this,ye+2,ye+5),le(this,ye+3,ye+4);return this},B.prototype.toString=function(){const me=this.length;return me===0?"":arguments.length===0?X(this,0,me):de.apply(this,arguments)},B.prototype.toLocaleString=B.prototype.toString,B.prototype.equals=function(me){if(!B.isBuffer(me))throw new TypeError("Argument must be a Buffer");return this===me?!0:B.compare(this,me)===0},B.prototype.inspect=function(){let me="";const ye=b.INSPECT_MAX_BYTES;return me=this.toString("hex",0,ye).replace(/(.{2})/g,"$1 ").trim(),this.length>ye&&(me+=" ... "),"<Buffer "+me+">"},_&&(B.prototype[_]=B.prototype.inspect),B.prototype.compare=function(me,ye,Me,je,He){if(at(me,E)&&(me=B.from(me,me.offset,me.byteLength)),!B.isBuffer(me))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof me);if(ye===void 0&&(ye=0),Me===void 0&&(Me=me?me.length:0),je===void 0&&(je=0),He===void 0&&(He=this.length),ye<0||Me>me.length||je<0||He>this.length)throw new RangeError("out of range index");if(je>=He&&ye>=Me)return 0;if(je>=He)return-1;if(ye>=Me)return 1;if(ye>>>=0,Me>>>=0,je>>>=0,He>>>=0,this===me)return 0;let Ue=He-je,rt=Me-ye;const it=Math.min(Ue,rt),tt=this.slice(je,He),mt=me.slice(ye,Me);for(let st=0;st<it;++st)if(tt[st]!==mt[st]){Ue=tt[st],rt=mt[st];break}return Ue<rt?-1:rt<Ue?1:0};function be(we,me,ye,Me,je){if(we.length===0)return-1;if(typeof ye=="string"?(Me=ye,ye=0):ye>2147483647?ye=2147483647:ye<-2147483648&&(ye=-2147483648),ye=+ye,Fe(ye)&&(ye=je?0:we.length-1),ye<0&&(ye=we.length+ye),ye>=we.length){if(je)return-1;ye=we.length-1}else if(ye<0)if(je)ye=0;else return-1;if(typeof me=="string"&&(me=B.from(me,Me)),B.isBuffer(me))return me.length===0?-1:pe(we,me,ye,Me,je);if(typeof me=="number")return me=me&255,typeof E.prototype.indexOf=="function"?je?E.prototype.indexOf.call(we,me,ye):E.prototype.lastIndexOf.call(we,me,ye):pe(we,[me],ye,Me,je);throw new TypeError("val must be string, number or Buffer")}function pe(we,me,ye,Me,je){let He=1,Ue=we.length,rt=me.length;if(Me!==void 0&&(Me=String(Me).toLowerCase(),Me==="ucs2"||Me==="ucs-2"||Me==="utf16le"||Me==="utf-16le")){if(we.length<2||me.length<2)return-1;He=2,Ue/=2,rt/=2,ye/=2}function it(mt,st){return He===1?mt[st]:mt.readUInt16BE(st*He)}let tt;if(je){let mt=-1;for(tt=ye;tt<Ue;tt++)if(it(we,tt)===it(me,mt===-1?0:tt-mt)){if(mt===-1&&(mt=tt),tt-mt+1===rt)return mt*He}else mt!==-1&&(tt-=tt-mt),mt=-1}else for(ye+rt>Ue&&(ye=Ue-rt),tt=ye;tt>=0;tt--){let mt=!0;for(let st=0;st<rt;st++)if(it(we,tt+st)!==it(me,st)){mt=!1;break}if(mt)return tt}return-1}B.prototype.includes=function(me,ye,Me){return this.indexOf(me,ye,Me)!==-1},B.prototype.indexOf=function(me,ye,Me){return be(this,me,ye,Me,!0)},B.prototype.lastIndexOf=function(me,ye,Me){return be(this,me,ye,Me,!1)};function fe(we,me,ye,Me){ye=Number(ye)||0;const je=we.length-ye;Me?(Me=Number(Me),Me>je&&(Me=je)):Me=je;const He=me.length;Me>He/2&&(Me=He/2);let Ue;for(Ue=0;Ue<Me;++Ue){const rt=parseInt(me.substr(Ue*2,2),16);if(Fe(rt))return Ue;we[ye+Ue]=rt}return Ue}function Z(we,me,ye,Me){return Xe(De(me,we.length-ye),we,ye,Me)}function U(we,me,ye,Me){return Xe(Ke(me),we,ye,Me)}function S(we,me,ye,Me){return Xe(Qe(me),we,ye,Me)}function C(we,me,ye,Me){return Xe(We(me,we.length-ye),we,ye,Me)}B.prototype.write=function(me,ye,Me,je){if(ye===void 0)je="utf8",Me=this.length,ye=0;else if(Me===void 0&&typeof ye=="string")je=ye,Me=this.length,ye=0;else if(isFinite(ye))ye=ye>>>0,isFinite(Me)?(Me=Me>>>0,je===void 0&&(je="utf8")):(je=Me,Me=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const He=this.length-ye;if((Me===void 0||Me>He)&&(Me=He),me.length>0&&(Me<0||ye<0)||ye>this.length)throw new RangeError("Attempt to write outside buffer bounds");je||(je="utf8");let Ue=!1;for(;;)switch(je){case"hex":return fe(this,me,ye,Me);case"utf8":case"utf-8":return Z(this,me,ye,Me);case"ascii":case"latin1":case"binary":return U(this,me,ye,Me);case"base64":return S(this,me,ye,Me);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,me,ye,Me);default:if(Ue)throw new TypeError("Unknown encoding: "+je);je=(""+je).toLowerCase(),Ue=!0}},B.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function F(we,me,ye){return me===0&&ye===we.length?v.fromByteArray(we):v.fromByteArray(we.slice(me,ye))}function X(we,me,ye){ye=Math.min(we.length,ye);const Me=[];let je=me;for(;je<ye;){const He=we[je];let Ue=null,rt=He>239?4:He>223?3:He>191?2:1;if(je+rt<=ye){let it,tt,mt,st;switch(rt){case 1:He<128&&(Ue=He);break;case 2:it=we[je+1],(it&192)===128&&(st=(He&31)<<6|it&63,st>127&&(Ue=st));break;case 3:it=we[je+1],tt=we[je+2],(it&192)===128&&(tt&192)===128&&(st=(He&15)<<12|(it&63)<<6|tt&63,st>2047&&(st<55296||st>57343)&&(Ue=st));break;case 4:it=we[je+1],tt=we[je+2],mt=we[je+3],(it&192)===128&&(tt&192)===128&&(mt&192)===128&&(st=(He&15)<<18|(it&63)<<12|(tt&63)<<6|mt&63,st>65535&&st<1114112&&(Ue=st))}}Ue===null?(Ue=65533,rt=1):Ue>65535&&(Ue-=65536,Me.push(Ue>>>10&1023|55296),Ue=56320|Ue&1023),Me.push(Ue),je+=rt}return ie(Me)}const re=4096;function ie(we){const me=we.length;if(me<=re)return String.fromCharCode.apply(String,we);let ye="",Me=0;for(;Me<me;)ye+=String.fromCharCode.apply(String,we.slice(Me,Me+=re));return ye}function Q(we,me,ye){let Me="";ye=Math.min(we.length,ye);for(let je=me;je<ye;++je)Me+=String.fromCharCode(we[je]&127);return Me}function ne(we,me,ye){let Me="";ye=Math.min(we.length,ye);for(let je=me;je<ye;++je)Me+=String.fromCharCode(we[je]);return Me}function L(we,me,ye){const Me=we.length;(!me||me<0)&&(me=0),(!ye||ye<0||ye>Me)&&(ye=Me);let je="";for(let He=me;He<ye;++He)je+=qe[we[He]];return je}function ue(we,me,ye){const Me=we.slice(me,ye);let je="";for(let He=0;He<Me.length-1;He+=2)je+=String.fromCharCode(Me[He]+Me[He+1]*256);return je}B.prototype.slice=function(me,ye){const Me=this.length;me=~~me,ye=ye===void 0?Me:~~ye,me<0?(me+=Me,me<0&&(me=0)):me>Me&&(me=Me),ye<0?(ye+=Me,ye<0&&(ye=0)):ye>Me&&(ye=Me),ye<me&&(ye=me);const je=this.subarray(me,ye);return Object.setPrototypeOf(je,B.prototype),je};function Ae(we,me,ye){if(we%1!==0||we<0)throw new RangeError("offset is not uint");if(we+me>ye)throw new RangeError("Trying to access beyond buffer length")}B.prototype.readUintLE=B.prototype.readUIntLE=function(me,ye,Me){me=me>>>0,ye=ye>>>0,Me||Ae(me,ye,this.length);let je=this[me],He=1,Ue=0;for(;++Ue<ye&&(He*=256);)je+=this[me+Ue]*He;return je},B.prototype.readUintBE=B.prototype.readUIntBE=function(me,ye,Me){me=me>>>0,ye=ye>>>0,Me||Ae(me,ye,this.length);let je=this[me+--ye],He=1;for(;ye>0&&(He*=256);)je+=this[me+--ye]*He;return je},B.prototype.readUint8=B.prototype.readUInt8=function(me,ye){return me=me>>>0,ye||Ae(me,1,this.length),this[me]},B.prototype.readUint16LE=B.prototype.readUInt16LE=function(me,ye){return me=me>>>0,ye||Ae(me,2,this.length),this[me]|this[me+1]<<8},B.prototype.readUint16BE=B.prototype.readUInt16BE=function(me,ye){return me=me>>>0,ye||Ae(me,2,this.length),this[me]<<8|this[me+1]},B.prototype.readUint32LE=B.prototype.readUInt32LE=function(me,ye){return me=me>>>0,ye||Ae(me,4,this.length),(this[me]|this[me+1]<<8|this[me+2]<<16)+this[me+3]*16777216},B.prototype.readUint32BE=B.prototype.readUInt32BE=function(me,ye){return me=me>>>0,ye||Ae(me,4,this.length),this[me]*16777216+(this[me+1]<<16|this[me+2]<<8|this[me+3])},B.prototype.readBigUInt64LE=$e(function(me){me=me>>>0,Ce(me,"offset");const ye=this[me],Me=this[me+7];(ye===void 0||Me===void 0)&&Te(me,this.length-8);const je=ye+this[++me]*2**8+this[++me]*2**16+this[++me]*2**24,He=this[++me]+this[++me]*2**8+this[++me]*2**16+Me*2**24;return BigInt(je)+(BigInt(He)<<BigInt(32))}),B.prototype.readBigUInt64BE=$e(function(me){me=me>>>0,Ce(me,"offset");const ye=this[me],Me=this[me+7];(ye===void 0||Me===void 0)&&Te(me,this.length-8);const je=ye*2**24+this[++me]*2**16+this[++me]*2**8+this[++me],He=this[++me]*2**24+this[++me]*2**16+this[++me]*2**8+Me;return(BigInt(je)<<BigInt(32))+BigInt(He)}),B.prototype.readIntLE=function(me,ye,Me){me=me>>>0,ye=ye>>>0,Me||Ae(me,ye,this.length);let je=this[me],He=1,Ue=0;for(;++Ue<ye&&(He*=256);)je+=this[me+Ue]*He;return He*=128,je>=He&&(je-=Math.pow(2,8*ye)),je},B.prototype.readIntBE=function(me,ye,Me){me=me>>>0,ye=ye>>>0,Me||Ae(me,ye,this.length);let je=ye,He=1,Ue=this[me+--je];for(;je>0&&(He*=256);)Ue+=this[me+--je]*He;return He*=128,Ue>=He&&(Ue-=Math.pow(2,8*ye)),Ue},B.prototype.readInt8=function(me,ye){return me=me>>>0,ye||Ae(me,1,this.length),this[me]&128?(255-this[me]+1)*-1:this[me]},B.prototype.readInt16LE=function(me,ye){me=me>>>0,ye||Ae(me,2,this.length);const Me=this[me]|this[me+1]<<8;return Me&32768?Me|4294901760:Me},B.prototype.readInt16BE=function(me,ye){me=me>>>0,ye||Ae(me,2,this.length);const Me=this[me+1]|this[me]<<8;return Me&32768?Me|4294901760:Me},B.prototype.readInt32LE=function(me,ye){return me=me>>>0,ye||Ae(me,4,this.length),this[me]|this[me+1]<<8|this[me+2]<<16|this[me+3]<<24},B.prototype.readInt32BE=function(me,ye){return me=me>>>0,ye||Ae(me,4,this.length),this[me]<<24|this[me+1]<<16|this[me+2]<<8|this[me+3]},B.prototype.readBigInt64LE=$e(function(me){me=me>>>0,Ce(me,"offset");const ye=this[me],Me=this[me+7];(ye===void 0||Me===void 0)&&Te(me,this.length-8);const je=this[me+4]+this[me+5]*2**8+this[me+6]*2**16+(Me<<24);return(BigInt(je)<<BigInt(32))+BigInt(ye+this[++me]*2**8+this[++me]*2**16+this[++me]*2**24)}),B.prototype.readBigInt64BE=$e(function(me){me=me>>>0,Ce(me,"offset");const ye=this[me],Me=this[me+7];(ye===void 0||Me===void 0)&&Te(me,this.length-8);const je=(ye<<24)+this[++me]*2**16+this[++me]*2**8+this[++me];return(BigInt(je)<<BigInt(32))+BigInt(this[++me]*2**24+this[++me]*2**16+this[++me]*2**8+Me)}),B.prototype.readFloatLE=function(me,ye){return me=me>>>0,ye||Ae(me,4,this.length),w.read(this,me,!0,23,4)},B.prototype.readFloatBE=function(me,ye){return me=me>>>0,ye||Ae(me,4,this.length),w.read(this,me,!1,23,4)},B.prototype.readDoubleLE=function(me,ye){return me=me>>>0,ye||Ae(me,8,this.length),w.read(this,me,!0,52,8)},B.prototype.readDoubleBE=function(me,ye){return me=me>>>0,ye||Ae(me,8,this.length),w.read(this,me,!1,52,8)};function Re(we,me,ye,Me,je,He){if(!B.isBuffer(we))throw new TypeError('"buffer" argument must be a Buffer instance');if(me>je||me<He)throw new RangeError('"value" argument is out of bounds');if(ye+Me>we.length)throw new RangeError("Index out of range")}B.prototype.writeUintLE=B.prototype.writeUIntLE=function(me,ye,Me,je){if(me=+me,ye=ye>>>0,Me=Me>>>0,!je){const rt=Math.pow(2,8*Me)-1;Re(this,me,ye,Me,rt,0)}let He=1,Ue=0;for(this[ye]=me&255;++Ue<Me&&(He*=256);)this[ye+Ue]=me/He&255;return ye+Me},B.prototype.writeUintBE=B.prototype.writeUIntBE=function(me,ye,Me,je){if(me=+me,ye=ye>>>0,Me=Me>>>0,!je){const rt=Math.pow(2,8*Me)-1;Re(this,me,ye,Me,rt,0)}let He=Me-1,Ue=1;for(this[ye+He]=me&255;--He>=0&&(Ue*=256);)this[ye+He]=me/Ue&255;return ye+Me},B.prototype.writeUint8=B.prototype.writeUInt8=function(me,ye,Me){return me=+me,ye=ye>>>0,Me||Re(this,me,ye,1,255,0),this[ye]=me&255,ye+1},B.prototype.writeUint16LE=B.prototype.writeUInt16LE=function(me,ye,Me){return me=+me,ye=ye>>>0,Me||Re(this,me,ye,2,65535,0),this[ye]=me&255,this[ye+1]=me>>>8,ye+2},B.prototype.writeUint16BE=B.prototype.writeUInt16BE=function(me,ye,Me){return me=+me,ye=ye>>>0,Me||Re(this,me,ye,2,65535,0),this[ye]=me>>>8,this[ye+1]=me&255,ye+2},B.prototype.writeUint32LE=B.prototype.writeUInt32LE=function(me,ye,Me){return me=+me,ye=ye>>>0,Me||Re(this,me,ye,4,4294967295,0),this[ye+3]=me>>>24,this[ye+2]=me>>>16,this[ye+1]=me>>>8,this[ye]=me&255,ye+4},B.prototype.writeUint32BE=B.prototype.writeUInt32BE=function(me,ye,Me){return me=+me,ye=ye>>>0,Me||Re(this,me,ye,4,4294967295,0),this[ye]=me>>>24,this[ye+1]=me>>>16,this[ye+2]=me>>>8,this[ye+3]=me&255,ye+4};function Pe(we,me,ye,Me,je){ve(me,Me,je,we,ye,7);let He=Number(me&BigInt(4294967295));we[ye++]=He,He=He>>8,we[ye++]=He,He=He>>8,we[ye++]=He,He=He>>8,we[ye++]=He;let Ue=Number(me>>BigInt(32)&BigInt(4294967295));return we[ye++]=Ue,Ue=Ue>>8,we[ye++]=Ue,Ue=Ue>>8,we[ye++]=Ue,Ue=Ue>>8,we[ye++]=Ue,ye}function xe(we,me,ye,Me,je){ve(me,Me,je,we,ye,7);let He=Number(me&BigInt(4294967295));we[ye+7]=He,He=He>>8,we[ye+6]=He,He=He>>8,we[ye+5]=He,He=He>>8,we[ye+4]=He;let Ue=Number(me>>BigInt(32)&BigInt(4294967295));return we[ye+3]=Ue,Ue=Ue>>8,we[ye+2]=Ue,Ue=Ue>>8,we[ye+1]=Ue,Ue=Ue>>8,we[ye]=Ue,ye+8}B.prototype.writeBigUInt64LE=$e(function(me,ye=0){return Pe(this,me,ye,BigInt(0),BigInt("0xffffffffffffffff"))}),B.prototype.writeBigUInt64BE=$e(function(me,ye=0){return xe(this,me,ye,BigInt(0),BigInt("0xffffffffffffffff"))}),B.prototype.writeIntLE=function(me,ye,Me,je){if(me=+me,ye=ye>>>0,!je){const it=Math.pow(2,8*Me-1);Re(this,me,ye,Me,it-1,-it)}let He=0,Ue=1,rt=0;for(this[ye]=me&255;++He<Me&&(Ue*=256);)me<0&&rt===0&&this[ye+He-1]!==0&&(rt=1),this[ye+He]=(me/Ue>>0)-rt&255;return ye+Me},B.prototype.writeIntBE=function(me,ye,Me,je){if(me=+me,ye=ye>>>0,!je){const it=Math.pow(2,8*Me-1);Re(this,me,ye,Me,it-1,-it)}let He=Me-1,Ue=1,rt=0;for(this[ye+He]=me&255;--He>=0&&(Ue*=256);)me<0&&rt===0&&this[ye+He+1]!==0&&(rt=1),this[ye+He]=(me/Ue>>0)-rt&255;return ye+Me},B.prototype.writeInt8=function(me,ye,Me){return me=+me,ye=ye>>>0,Me||Re(this,me,ye,1,127,-128),me<0&&(me=255+me+1),this[ye]=me&255,ye+1},B.prototype.writeInt16LE=function(me,ye,Me){return me=+me,ye=ye>>>0,Me||Re(this,me,ye,2,32767,-32768),this[ye]=me&255,this[ye+1]=me>>>8,ye+2},B.prototype.writeInt16BE=function(me,ye,Me){return me=+me,ye=ye>>>0,Me||Re(this,me,ye,2,32767,-32768),this[ye]=me>>>8,this[ye+1]=me&255,ye+2},B.prototype.writeInt32LE=function(me,ye,Me){return me=+me,ye=ye>>>0,Me||Re(this,me,ye,4,2147483647,-2147483648),this[ye]=me&255,this[ye+1]=me>>>8,this[ye+2]=me>>>16,this[ye+3]=me>>>24,ye+4},B.prototype.writeInt32BE=function(me,ye,Me){return me=+me,ye=ye>>>0,Me||Re(this,me,ye,4,2147483647,-2147483648),me<0&&(me=4294967295+me+1),this[ye]=me>>>24,this[ye+1]=me>>>16,this[ye+2]=me>>>8,this[ye+3]=me&255,ye+4},B.prototype.writeBigInt64LE=$e(function(me,ye=0){return Pe(this,me,ye,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),B.prototype.writeBigInt64BE=$e(function(me,ye=0){return xe(this,me,ye,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ge(we,me,ye,Me,je,He){if(ye+Me>we.length)throw new RangeError("Index out of range");if(ye<0)throw new RangeError("Index out of range")}function _e(we,me,ye,Me,je){return me=+me,ye=ye>>>0,je||ge(we,me,ye,4),w.write(we,me,ye,Me,23,4),ye+4}B.prototype.writeFloatLE=function(me,ye,Me){return _e(this,me,ye,!0,Me)},B.prototype.writeFloatBE=function(me,ye,Me){return _e(this,me,ye,!1,Me)};function ke(we,me,ye,Me,je){return me=+me,ye=ye>>>0,je||ge(we,me,ye,8),w.write(we,me,ye,Me,52,8),ye+8}B.prototype.writeDoubleLE=function(me,ye,Me){return ke(this,me,ye,!0,Me)},B.prototype.writeDoubleBE=function(me,ye,Me){return ke(this,me,ye,!1,Me)},B.prototype.copy=function(me,ye,Me,je){if(!B.isBuffer(me))throw new TypeError("argument should be a Buffer");if(Me||(Me=0),!je&&je!==0&&(je=this.length),ye>=me.length&&(ye=me.length),ye||(ye=0),je>0&&je<Me&&(je=Me),je===Me||me.length===0||this.length===0)return 0;if(ye<0)throw new RangeError("targetStart out of bounds");if(Me<0||Me>=this.length)throw new RangeError("Index out of range");if(je<0)throw new RangeError("sourceEnd out of bounds");je>this.length&&(je=this.length),me.length-ye<je-Me&&(je=me.length-ye+Me);const He=je-Me;return this===me&&typeof E.prototype.copyWithin=="function"?this.copyWithin(ye,Me,je):E.prototype.set.call(me,this.subarray(Me,je),ye),He},B.prototype.fill=function(me,ye,Me,je){if(typeof me=="string"){if(typeof ye=="string"?(je=ye,ye=0,Me=this.length):typeof Me=="string"&&(je=Me,Me=this.length),je!==void 0&&typeof je!="string")throw new TypeError("encoding must be a string");if(typeof je=="string"&&!B.isEncoding(je))throw new TypeError("Unknown encoding: "+je);if(me.length===1){const Ue=me.charCodeAt(0);(je==="utf8"&&Ue<128||je==="latin1")&&(me=Ue)}}else typeof me=="number"?me=me&255:typeof me=="boolean"&&(me=Number(me));if(ye<0||this.length<ye||this.length<Me)throw new RangeError("Out of range index");if(Me<=ye)return this;ye=ye>>>0,Me=Me===void 0?this.length:Me>>>0,me||(me=0);let He;if(typeof me=="number")for(He=ye;He<Me;++He)this[He]=me;else{const Ue=B.isBuffer(me)?me:B.from(me,je),rt=Ue.length;if(rt===0)throw new TypeError('The value "'+me+'" is invalid for argument "value"');for(He=0;He<Me-ye;++He)this[He+ye]=Ue[He%rt]}return this};const Ee={};function Se(we,me,ye){Ee[we]=class extends ye{constructor(){super(),Object.defineProperty(this,"message",{value:me.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${we}]`,this.stack,delete this.name}get code(){return we}set code(je){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:je,writable:!0})}toString(){return`${this.name} [${we}]: ${this.message}`}}}Se("ERR_BUFFER_OUT_OF_BOUNDS",function(we){return we?`${we} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Se("ERR_INVALID_ARG_TYPE",function(we,me){return`The "${we}" argument must be of type number. Received type ${typeof me}`},TypeError),Se("ERR_OUT_OF_RANGE",function(we,me,ye){let Me=`The value of "${we}" is out of range.`,je=ye;return Number.isInteger(ye)&&Math.abs(ye)>2**32?je=Oe(String(ye)):typeof ye=="bigint"&&(je=String(ye),(ye>BigInt(2)**BigInt(32)||ye<-(BigInt(2)**BigInt(32)))&&(je=Oe(je)),je+="n"),Me+=` It must be ${me}. Received ${je}`,Me},RangeError);function Oe(we){let me="",ye=we.length;const Me=we[0]==="-"?1:0;for(;ye>=Me+4;ye-=3)me=`_${we.slice(ye-3,ye)}${me}`;return`${we.slice(0,ye)}${me}`}function Ne(we,me,ye){Ce(me,"offset"),(we[me]===void 0||we[me+ye]===void 0)&&Te(me,we.length-(ye+1))}function ve(we,me,ye,Me,je,He){if(we>ye||we<me){const Ue=typeof me=="bigint"?"n":"";let rt;throw me===0||me===BigInt(0)?rt=`>= 0${Ue} and < 2${Ue} ** ${(He+1)*8}${Ue}`:rt=`>= -(2${Ue} ** ${(He+1)*8-1}${Ue}) and < 2 ** ${(He+1)*8-1}${Ue}`,new Ee.ERR_OUT_OF_RANGE("value",rt,we)}Ne(Me,je,He)}function Ce(we,me){if(typeof we!="number")throw new Ee.ERR_INVALID_ARG_TYPE(me,"number",we)}function Te(we,me,ye){throw Math.floor(we)!==we?(Ce(we,ye),new Ee.ERR_OUT_OF_RANGE("offset","an integer",we)):me<0?new Ee.ERR_BUFFER_OUT_OF_BOUNDS:new Ee.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${me}`,we)}const Le=/[^+/0-9A-Za-z-_]/g;function Be(we){if(we=we.split("=")[0],we=we.trim().replace(Le,""),we.length<2)return"";for(;we.length%4!==0;)we=we+"=";return we}function De(we,me){me=me||1/0;let ye;const Me=we.length;let je=null;const He=[];for(let Ue=0;Ue<Me;++Ue){if(ye=we.charCodeAt(Ue),ye>55295&&ye<57344){if(!je){if(ye>56319){(me-=3)>-1&&He.push(239,191,189);continue}else if(Ue+1===Me){(me-=3)>-1&&He.push(239,191,189);continue}je=ye;continue}if(ye<56320){(me-=3)>-1&&He.push(239,191,189),je=ye;continue}ye=(je-55296<<10|ye-56320)+65536}else je&&(me-=3)>-1&&He.push(239,191,189);if(je=null,ye<128){if((me-=1)<0)break;He.push(ye)}else if(ye<2048){if((me-=2)<0)break;He.push(ye>>6|192,ye&63|128)}else if(ye<65536){if((me-=3)<0)break;He.push(ye>>12|224,ye>>6&63|128,ye&63|128)}else if(ye<1114112){if((me-=4)<0)break;He.push(ye>>18|240,ye>>12&63|128,ye>>6&63|128,ye&63|128)}else throw new Error("Invalid code point")}return He}function Ke(we){const me=[];for(let ye=0;ye<we.length;++ye)me.push(we.charCodeAt(ye)&255);return me}function We(we,me){let ye,Me,je;const He=[];for(let Ue=0;Ue<we.length&&!((me-=2)<0);++Ue)ye=we.charCodeAt(Ue),Me=ye>>8,je=ye%256,He.push(je),He.push(Me);return He}function Qe(we){return v.toByteArray(Be(we))}function Xe(we,me,ye,Me){let je;for(je=0;je<Me&&!(je+ye>=me.length||je>=we.length);++je)me[je+ye]=we[je];return je}function at(we,me){return we instanceof me||we!=null&&we.constructor!=null&&we.constructor.name!=null&&we.constructor.name===me.name}function Fe(we){return we!==we}const qe=function(){const we="0123456789abcdef",me=new Array(256);for(let ye=0;ye<16;++ye){const Me=ye*16;for(let je=0;je<16;++je)me[Me+je]=we[ye]+we[je]}return me}();function $e(we){return typeof BigInt>"u"?Ie:we}function Ie(){throw new Error("BigInt not supported")}})(buffer$1);const Buffer$D=buffer$1.Buffer,Blob=buffer$1.Blob,BlobOptions=buffer$1.BlobOptions,Buffer$1$1=buffer$1.Buffer,File=buffer$1.File,FileOptions=buffer$1.FileOptions,INSPECT_MAX_BYTES=buffer$1.INSPECT_MAX_BYTES,SlowBuffer=buffer$1.SlowBuffer,TranscodeEncoding=buffer$1.TranscodeEncoding,atob$1=buffer$1.atob,btoa$1=buffer$1.btoa,constants$2=buffer$1.constants,isAscii=buffer$1.isAscii,isUtf8=buffer$1.isUtf8,kMaxLength=buffer$1.kMaxLength,kStringMaxLength=buffer$1.kStringMaxLength,resolveObjectURL=buffer$1.resolveObjectURL,transcode=buffer$1.transcode,dist$1=Object.freeze(Object.defineProperty({__proto__:null,Blob,BlobOptions,Buffer:Buffer$1$1,File,FileOptions,INSPECT_MAX_BYTES,SlowBuffer,TranscodeEncoding,atob:atob$1,btoa:btoa$1,constants:constants$2,default:Buffer$D,isAscii,isUtf8,kMaxLength,kStringMaxLength,resolveObjectURL,transcode},Symbol.toStringTag,{value:"Module"}));var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getAugmentedNamespace(b){if(b.__esModule)return b;var v=b.default;if(typeof v=="function"){var w=function _(){return this instanceof _?Reflect.construct(v,arguments,this.constructor):v.apply(this,arguments)};w.prototype=v.prototype}else w={};return Object.defineProperty(w,"__esModule",{value:!0}),Object.keys(b).forEach(function(_){var A=Object.getOwnPropertyDescriptor(b,_);Object.defineProperty(w,_,A.get?A:{enumerable:!0,get:function(){return b[_]}})}),w}var siwe={},client={},parsers={},abnf={};const require$$1$2=getAugmentedNamespace(dist$1);var identifiers={ALT:1,CAT:2,REP:3,RNM:4,TRG:5,TBS:6,TLS:7,UDT:11,AND:12,NOT:13,BKR:14,BKA:15,BKN:16,ABG:17,AEN:18,ACTIVE:100,MATCH:101,EMPTY:102,NOMATCH:103,SEM_PRE:200,SEM_POST:201,SEM_OK:300,SEM_SKIP:301,ATTR_N:400,ATTR_R:401,ATTR_MR:402,LOOKAROUND_NONE:500,LOOKAROUND_AHEAD:501,LOOKAROUND_BEHIND:502,BKR_MODE_UM:601,BKR_MODE_PM:602,BKR_MODE_CS:603,BKR_MODE_CI:604},utilities={},style={CLASS_MONOSPACE:"apg-mono",CLASS_ACTIVE:"apg-active",CLASS_EMPTY:"apg-empty",CLASS_MATCH:"apg-match",CLASS_NOMATCH:"apg-nomatch",CLASS_LOOKAHEAD:"apg-lh-match",CLASS_LOOKBEHIND:"apg-lb-match",CLASS_REMAINDER:"apg-remainder",CLASS_CTRLCHAR:"apg-ctrl-char",CLASS_LINEEND:"apg-line-end",CLASS_ERROR:"apg-error",CLASS_PHRASE:"apg-phrase",CLASS_EMPTYPHRASE:"apg-empty-phrase",CLASS_STATE:"apg-state",CLASS_STATS:"apg-stats",CLASS_TRACE:"apg-trace",CLASS_GRAMMAR:"apg-grammar",CLASS_RULES:"apg-rules",CLASS_RULESLINK:"apg-rules-link",CLASS_ATTRIBUTES:"apg-attrs"},converter={},transformers={},hasRequiredTransformers;function requireTransformers(){return hasRequiredTransformers||(hasRequiredTransformers=1,function(b){"use strict;";const{Buffer:v}=require$$1$2,w=4294967292,_=4294967293,A=4294967294,E=4294967295,k=[0,1,3,7,15,31,63,127,255,511,1023],P=["00","01","02","03","04","05","06","07","08","09","0A","0B","0C","0D","0E","0F","10","11","12","13","14","15","16","17","18","19","1A","1B","1C","1D","1E","1F","20","21","22","23","24","25","26","27","28","29","2A","2B","2C","2D","2E","2F","30","31","32","33","34","35","36","37","38","39","3A","3B","3C","3D","3E","3F","40","41","42","43","44","45","46","47","48","49","4A","4B","4C","4D","4E","4F","50","51","52","53","54","55","56","57","58","59","5A","5B","5C","5D","5E","5F","60","61","62","63","64","65","66","67","68","69","6A","6B","6C","6D","6E","6F","70","71","72","73","74","75","76","77","78","79","7A","7B","7C","7D","7E","7F","80","81","82","83","84","85","86","87","88","89","8A","8B","8C","8D","8E","8F","90","91","92","93","94","95","96","97","98","99","9A","9B","9C","9D","9E","9F","A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","AA","AB","AC","AD","AE","AF","B0","B1","B2","B3","B4","B5","B6","B7","B8","B9","BA","BB","BC","BD","BE","BF","C0","C1","C2","C3","C4","C5","C6","C7","C8","C9","CA","CB","CC","CD","CE","CF","D0","D1","D2","D3","D4","D5","D6","D7","D8","D9","DA","DB","DC","DD","DE","DF","E0","E1","E2","E3","E4","E5","E6","E7","E8","E9","EA","EB","EC","ED","EE","EF","F0","F1","F2","F3","F4","F5","F6","F7","F8","F9","FA","FB","FC","FD","FE","FF"],N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split(""),q=[];N.forEach(I=>{q.push(I.charCodeAt(0))}),b.utf8={encode(I){const D=[];return I.forEach(V=>{if(V>=0&&V<=127)D.push(V);else if(V<=2047)D.push(192+(V>>6&k[5])),D.push(128+(V&k[6]));else if(V<55296||V>57343&&V<=65535)D.push(224+(V>>12&k[4])),D.push(128+(V>>6&k[6])),D.push(128+(V&k[6]));else if(V>=65536&&V<=1114111){const ee=V>>16&k[5];D.push(240+(ee>>2)),D.push(128+((ee&k[2])<<4)+(V>>12&k[4])),D.push(128+(V>>6&k[6])),D.push(128+(V&k[6]))}else throw new RangeError(`utf8.encode: character out of range: char: ${V}`)}),v.from(D)},decode(I,D){function V(pe,fe){if((fe&192)!==128)return _;const Z=((pe&k[5])<<6)+(fe&k[6]);return Z<128?w:Z}function ee(pe,fe,Z){if((Z&192)!==128||(fe&192)!==128)return _;const U=((pe&k[4])<<12)+((fe&k[6])<<6)+(Z&k[6]);return U<2048?w:U>=55296&&U<=57343?A:U}function J(pe,fe,Z,U){if((U&192)!==128||(Z&192)!==128||(fe&192)!==128)return _;const S=(((pe&k[3])<<2)+(fe>>4&k[2])<<16)+((fe&k[4])<<12)+((Z&k[6])<<6)+(U&k[6]);return S<65536?w:S>1114111?A:S}let te,se,ce,ae,he,oe;const de=I.length;let le=D?3:0;const be=[];for(;le<de;){se=I[le],te=E;const pe=!0;for(;pe;){if(se>=0&&se<=127){te=se,oe=1;break}if(ce=le+1,ce<de&&se>=194&&se<=223){te=V(se,I[ce]),oe=2;break}if(ae=le+2,ae<de&&se>=224&&se<=239){te=ee(se,I[ce],I[ae]),oe=3;break}if(he=le+3,he<de&&se>=240&&se<=244){te=J(se,I[ce],I[ae],I[he]),oe=4;break}break}if(te>1114111){const fe=`byte[${le}]`;throw te===E?new RangeError(`utf8.decode: ill-formed UTF8 byte sequence found at: ${fe}`):te===_?new RangeError(`utf8.decode: illegal trailing byte found at: ${fe}`):te===A?new RangeError(`utf8.decode: code point out of range found at: ${fe}`):te===w?new RangeError(`utf8.decode: non-shortest form found at: ${fe}`):new RangeError(`utf8.decode: unrecognized error found at: ${fe}`)}be.push(te),le+=oe}return be}},b.utf16be={encode(I){const D=[];let V,ee,J;for(let te=0;te<I.length;te+=1)if(V=I[te],V>=0&&V<=55295||V>=57344&&V<=65535)D.push(V>>8&k[8]),D.push(V&k[8]);else if(V>=65536&&V<=1114111)J=V-65536,ee=55296+(J>>10),J=56320+(J&k[10]),D.push(ee>>8&k[8]),D.push(ee&k[8]),D.push(J>>8&k[8]),D.push(J&k[8]);else throw new RangeError(`utf16be.encode: UTF16BE value out of range: char[${te}]: ${V}`);return v.from(D)},decode(I,D){if(I.length%2>0)throw new RangeError(`utf16be.decode: data length must be even multiple of 2: length: ${I.length}`);const V=[],ee=I.length;let J=D?2:0,te=0,se,ce,ae,he,oe,de;for(;J<ee;){for(;;){if(ae=J+1,ae<ee){if(oe=(I[J]<<8)+I[ae],oe<55296||oe>57343){se=oe,ce=2;break}if(he=J+3,he<ee&&(de=(I[J+2]<<8)+I[he],oe<=56319&&de>=56320&&de<=57343)){se=65536+(oe-55296<<10)+(de-56320),ce=4;break}}throw new RangeError(`utf16be.decode: ill-formed UTF16BE byte sequence found: byte[${J}]`)}V[te++]=se,J+=ce}return V}},b.utf16le={encode(I){const D=[];let V,ee,J;for(let te=0;te<I.length;te+=1)if(V=I[te],V>=0&&V<=55295||V>=57344&&V<=65535)D.push(V&k[8]),D.push(V>>8&k[8]);else if(V>=65536&&V<=1114111)J=V-65536,ee=55296+(J>>10),J=56320+(J&k[10]),D.push(ee&k[8]),D.push(ee>>8&k[8]),D.push(J&k[8]),D.push(J>>8&k[8]);else throw new RangeError(`utf16le.encode: UTF16LE value out of range: char[${te}]: ${V}`);return v.from(D)},decode(I,D){if(I.length%2>0)throw new RangeError(`utf16le.decode: data length must be even multiple of 2: length: ${I.length}`);const V=[],ee=I.length;let J=D?2:0,te=0,se,ce,ae,he,oe,de;for(;J<ee;){for(;;){if(ae=J+1,ae<ee){if(oe=(I[ae]<<8)+I[J],oe<55296||oe>57343){se=oe,ce=2;break}if(he=J+3,he<ee&&(de=(I[he]<<8)+I[J+2],oe<=56319&&de>=56320&&de<=57343)){se=65536+(oe-55296<<10)+(de-56320),ce=4;break}}throw new RangeError(`utf16le.decode: ill-formed UTF16LE byte sequence found: byte[${J}]`)}V[te++]=se,J+=ce}return V}},b.utf32be={encode(I){const D=v.alloc(I.length*4);let V=0;return I.forEach(ee=>{if(ee>=55296&&ee<=57343||ee>1114111)throw new RangeError(`utf32be.encode: UTF32BE character code out of range: char[${V/4}]: ${ee}`);D[V++]=ee>>24&k[8],D[V++]=ee>>16&k[8],D[V++]=ee>>8&k[8],D[V++]=ee&k[8]}),D},decode(I,D){if(I.length%4>0)throw new RangeError(`utf32be.decode: UTF32BE byte length must be even multiple of 4: length: ${I.length}`);const V=[];let ee=D?4:0;for(;ee<I.length;ee+=4){const J=(I[ee]<<24)+(I[ee+1]<<16)+(I[ee+2]<<8)+I[ee+3];if(J>=55296&&J<=57343||J>1114111)throw new RangeError(`utf32be.decode: UTF32BE character code out of range: char[${ee/4}]: ${J}`);V.push(J)}return V}},b.utf32le={encode(I){const D=v.alloc(I.length*4);let V=0;return I.forEach(ee=>{if(ee>=55296&&ee<=57343||ee>1114111)throw new RangeError(`utf32le.encode: UTF32LE character code out of range: char[${V/4}]: ${ee}`);D[V++]=ee&k[8],D[V++]=ee>>8&k[8],D[V++]=ee>>16&k[8],D[V++]=ee>>24&k[8]}),D},decode(I,D){if(I.length%4>0)throw new RangeError(`utf32be.decode: UTF32LE byte length must be even multiple of 4: length: ${I.length}`);const V=[];let ee=D?4:0;for(;ee<I.length;ee+=4){const J=(I[ee+3]<<24)+(I[ee+2]<<16)+(I[ee+1]<<8)+I[ee];if(J>=55296&&J<=57343||J>1114111)throw new RangeError(`utf32le.encode: UTF32LE character code out of range: char[${ee/4}]: ${J}`);V.push(J)}return V}},b.uint7={encode(I){const D=v.alloc(I.length);for(let V=0;V<I.length;V+=1){if(I[V]>127)throw new RangeError(`uint7.encode: UINT7 character code out of range: char[${V}]: ${I[V]}`);D[V]=I[V]}return D},decode(I){const D=[];for(let V=0;V<I.length;V+=1){if(I[V]>127)throw new RangeError(`uint7.decode: UINT7 character code out of range: byte[${V}]: ${I[V]}`);D[V]=I[V]}return D}},b.uint8={encode(I){const D=v.alloc(I.length);for(let V=0;V<I.length;V+=1){if(I[V]>255)throw new RangeError(`uint8.encode: UINT8 character code out of range: char[${V}]: ${I[V]}`);D[V]=I[V]}return D},decode(I){const D=[];for(let V=0;V<I.length;V+=1)D[V]=I[V];return D}},b.uint16be={encode(I){const D=v.alloc(I.length*2);let V=0;return I.forEach(ee=>{if(ee>65535)throw new RangeError(`uint16be.encode: UINT16BE character code out of range: char[${V/2}]: ${ee}`);D[V++]=ee>>8&k[8],D[V++]=ee&k[8]}),D},decode(I){if(I.length%2>0)throw new RangeError(`uint16be.decode: UINT16BE byte length must be even multiple of 2: length: ${I.length}`);const D=[];for(let V=0;V<I.length;V+=2)D.push((I[V]<<8)+I[V+1]);return D}},b.uint16le={encode(I){const D=v.alloc(I.length*2);let V=0;return I.forEach(ee=>{if(ee>65535)throw new RangeError(`uint16le.encode: UINT16LE character code out of range: char[${V/2}]: ${ee}`);D[V++]=ee&k[8],D[V++]=ee>>8&k[8]}),D},decode(I){if(I.length%2>0)throw new RangeError(`uint16le.decode: UINT16LE byte length must be even multiple of 2: length: ${I.length}`);const D=[];for(let V=0;V<I.length;V+=2)D.push((I[V+1]<<8)+I[V]);return D}},b.uint32be={encode(I){const D=v.alloc(I.length*4);let V=0;return I.forEach(ee=>{D[V++]=ee>>24&k[8],D[V++]=ee>>16&k[8],D[V++]=ee>>8&k[8],D[V++]=ee&k[8]}),D},decode(I){if(I.length%4>0)throw new RangeError(`uint32be.decode: UINT32BE byte length must be even multiple of 4: length: ${I.length}`);const D=[];for(let V=0;V<I.length;V+=4)D.push((I[V]<<24)+(I[V+1]<<16)+(I[V+2]<<8)+I[V+3]);return D}},b.uint32le={encode(I){const D=v.alloc(I.length*4);let V=0;return I.forEach(ee=>{D[V++]=ee&k[8],D[V++]=ee>>8&k[8],D[V++]=ee>>16&k[8],D[V++]=ee>>24&k[8]}),D},decode(I){if(I.length%4>0)throw new RangeError(`uint32le.decode: UINT32LE byte length must be even multiple of 4: length: ${I.length}`);const D=[];for(let V=0;V<I.length;V+=4)D.push((I[V+3]<<24)+(I[V+2]<<16)+(I[V+1]<<8)+I[V]);return D}},b.string={encode(I){return b.utf16le.encode(I).toString("utf16le")},decode(I){return b.utf16le.decode(v.from(I,"utf16le"),0)}},b.escaped={encode(I){const D=[];for(let V=0;V<I.length;V+=1){const ee=I[V];if(ee===96)D.push(ee),D.push(ee);else if(ee===10)D.push(ee);else if(ee>=32&&ee<=126)D.push(ee);else{let J="";if(ee>=0&&ee<=31)J+=`\`x${P[ee]}`;else if(ee>=127&&ee<=255)J+=`\`x${P[ee]}`;else if(ee>=256&&ee<=65535)J+=`\`u${P[ee>>8&k[8]]}${P[ee&k[8]]}`;else if(ee>=65536&&ee<=4294967295){J+="`u{";const se=ee>>24&k[8];se>0&&(J+=P[se]),J+=`${P[ee>>16&k[8]]+P[ee>>8&k[8]]+P[ee&k[8]]}}`}else throw new Error("escape.encode(char): char > 0xffffffff not allowed");v.from(J).forEach(se=>{D.push(se)})}}return v.from(D)},decode(I){function D(de){return de>=48&&de<=57||de>=65&&de<=70||de>=97&&de<=102}function V(de,le,be){const pe={char:null,nexti:de+2,error:!0};if(de+1<le&&D(be[de])&&D(be[de+1])){const fe=String.fromCodePoint(be[de],be[de+1]);pe.char=parseInt(fe,16),Number.isNaN(pe.char)||(pe.error=!1)}return pe}function ee(de,le,be){const pe={char:null,nexti:de+4,error:!0};if(de+3<le&&D(be[de])&&D(be[de+1])&&D(be[de+2])&&D(be[de+3])){const fe=String.fromCodePoint(be[de],be[de+1],be[de+2],be[de+3]);pe.char=parseInt(fe,16),Number.isNaN(pe.char)||(pe.error=!1)}return pe}function J(de,le,be){const pe={char:null,nexti:de+4,error:!0};let fe="";for(;de<le&&D(be[de]);)fe+=String.fromCodePoint(be[de]),de+=1;return pe.char=parseInt(fe,16),be[de]===125&&!Number.isNaN(pe.char)&&(pe.error=!1),pe.nexti=de+1,pe}const te=[],se=I.length;let ce,ae,he,oe=0;for(;oe<se;){for(;;){if(he=!0,I[oe]!==96){te.push(I[oe]),oe+=1,he=!1;break}if(ce=oe+1,ce>=se)break;if(I[ce]===96){te.push(96),oe+=2,he=!1;break}if(I[ce]===120){if(ae=V(ce+1,se,I),ae.error)break;te.push(ae.char),oe=ae.nexti,he=!1;break}if(I[ce]===117){if(I[ce+1]===123){if(ae=J(ce+2,se,I),ae.error)break;te.push(ae.char),oe=ae.nexti,he=!1;break}if(ae=ee(ce+1,se,I),ae.error)break;te.push(ae.char),oe=ae.nexti,he=!1;break}break}if(he)throw new Error(`escaped.decode: ill-formed escape sequence at buf[${oe}]`)}return te}};const B=13,O=10;b.lineEnds={crlf(I){const D=[];let V=0;for(;V<I.length;)switch(I[V]){case B:V+1<I.length&&I[V+1]===O?V+=2:V+=1,D.push(B),D.push(O);break;case O:D.push(B),D.push(O),V+=1;break;default:D.push(I[V]),V+=1;break}return D.length>0&&D[D.length-1]!==O&&(D.push(B),D.push(O)),D},lf(I){const D=[];let V=0;for(;V<I.length;)switch(I[V]){case B:V+1<I.length&&I[V+1]===O?V+=2:V+=1,D.push(O);break;case O:D.push(O),V+=1;break;default:D.push(I[V]),V+=1;break}return D.length>0&&D[D.length-1]!==O&&D.push(O),D}},b.base64={encode(I){if(I.length===0)return v.alloc(0);let D,V,ee,J=I.length%3;J=J>0?3-J:0;let te=(I.length+J)/3;const se=v.alloc(te*4);J>0&&(te-=1),D=0,V=0;for(let ce=0;ce<te;ce+=1)ee=I[D++]<<16,ee+=I[D++]<<8,ee+=I[D++],se[V++]=q[ee>>18&k[6]],se[V++]=q[ee>>12&k[6]],se[V++]=q[ee>>6&k[6]],se[V++]=q[ee&k[6]];if(J===0)return se;if(J===1)return ee=I[D++]<<16,ee+=I[D]<<8,se[V++]=q[ee>>18&k[6]],se[V++]=q[ee>>12&k[6]],se[V++]=q[ee>>6&k[6]],se[V]=q[64],se;if(J===2)return ee=I[D]<<16,se[V++]=q[ee>>18&k[6]],se[V++]=q[ee>>12&k[6]],se[V++]=q[64],se[V]=q[64],se},decode(I){function D(oe){const de=[];let le=0;for(let be=0;be<oe.length;be+=1){const pe=oe[be],fe=!0;for(;fe&&!(pe===32||pe===9||pe===10||pe===13);){if(pe>=65&&pe<=90){de.push(pe-65);break}if(pe>=97&&pe<=122){de.push(pe-71);break}if(pe>=48&&pe<=57){de.push(pe+4);break}if(pe===43){de.push(62);break}if(pe===47){de.push(63);break}if(pe===61){de.push(64),le+=1;break}throw new RangeError(`base64.decode: invalid character buf[${be}]: ${pe}`)}}if(de.length%4>0)throw new RangeError(`base64.decode: string length not integral multiple of 4: ${de.length}`);switch(le){case 0:break;case 1:if(de[de.length-1]!==64)throw new RangeError("base64.decode: one tail character found: not last character");break;case 2:if(de[de.length-1]!==64||de[de.length-2]!==64)throw new RangeError("base64.decode: two tail characters found: not last characters");break;default:throw new RangeError(`base64.decode: more than two tail characters found: ${le}`)}return{tail:le,buf:v.from(de)}}if(I.length===0)return v.alloc(0);const V=D(I),{tail:ee}=V,J=V.buf;let te,se,ce,ae=J.length/4;const he=v.alloc(ae*3-ee);ee>0&&(ae-=1),se=0,te=0;for(let oe=0;oe<ae;oe+=1)ce=J[te++]<<18,ce+=J[te++]<<12,ce+=J[te++]<<6,ce+=J[te++],he[se++]=ce>>16&k[8],he[se++]=ce>>8&k[8],he[se++]=ce&k[8];return ee===1&&(ce=J[te++]<<18,ce+=J[te++]<<12,ce+=J[te]<<6,he[se++]=ce>>16&k[8],he[se]=ce>>8&k[8]),ee===2&&(ce=J[te++]<<18,ce+=J[te++]<<12,he[se]=ce>>16&k[8]),he},toString(I){if(I.length%4>0)throw new RangeError(`base64.toString: input buffer length not multiple of 4: ${I.length}`);let D="",V=0;function ee(te,se,ce,ae){switch(V){case 76:D+=`\r
8
- ${te}${se}${ce}${ae}`,V=4;break;case 75:D+=`${te}\r
9
- ${se}${ce}${ae}`,V=3;break;case 74:D+=`${te+se}\r
10
- ${ce}${ae}`,V=2;break;case 73:D+=`${te+se+ce}\r
11
- ${ae}`,V=1;break;default:D+=te+se+ce+ae,V+=4;break}}function J(te){return te>=65&&te<=90||te>=97&&te<=122||te>=48&&te<=57||te===43||te===47||te===61}for(let te=0;te<I.length;te+=4){for(let se=te;se<te+4;se+=1)if(!J(I[se]))throw new RangeError(`base64.toString: buf[${se}]: ${I[se]} : not valid base64 character code`);ee(String.fromCharCode(I[te]),String.fromCharCode(I[te+1]),String.fromCharCode(I[te+2]),String.fromCharCode(I[te+3]))}return D}}}(transformers)),transformers}var hasRequiredConverter;function requireConverter(){return hasRequiredConverter||(hasRequiredConverter=1,function(b){"use strict;";const{Buffer:v}=require$$1$2,w=requireTransformers(),_="UTF8",A="UTF16",E="UTF16BE",k="UTF16LE",P="UTF32",N="UTF32BE",q="UTF32LE",B="UINT7",O="ASCII",I="BINARY",D="UINT8",V="UINT16",ee="UINT16LE",J="UINT16BE",te="UINT32",se="UINT32LE",ce="UINT32BE",ae="ESCAPED",he="STRING",oe=function(C){C.type=_;const F=C.data;C.bom=0,F.length>=3&&F[0]===239&&F[1]===187&&F[2]===191&&(C.bom=3)},de=function(C){const F=C.data;switch(C.bom=0,C.type){case A:C.type=E,F.length>=2&&(F[0]===254&&F[1]===255?C.bom=2:F[0]===255&&F[1]===254&&(C.type=k,C.bom=2));break;case E:if(C.type=E,F.length>=2){if(F[0]===254&&F[1]===255)C.bom=2;else if(F[0]===255&&F[1]===254)throw new TypeError(`src type: "${E}" specified but BOM is for "${k}"`)}break;case k:if(C.type=k,F.length>=0){if(F[0]===254&&F[1]===255)throw new TypeError(`src type: "${k}" specified but BOM is for "${E}"`);F[0]===255&&F[1]===254&&(C.bom=2)}break;default:throw new TypeError(`UTF16 BOM: src type "${C.type}" unrecognized`)}},le=function(C){const F=C.data;switch(C.bom=0,C.type){case P:C.type=N,F.length>=4&&(F[0]===0&&F[1]===0&&F[2]===254&&F[3]===255&&(C.bom=4),F[0]===255&&F[1]===254&&F[2]===0&&F[3]===0&&(C.type=q,C.bom=4));break;case N:if(C.type=N,F.length>=4&&(F[0]===0&&F[1]===0&&F[2]===254&&F[3]===255&&(C.bom=4),F[0]===255&&F[1]===254&&F[2]===0&&F[3]===0))throw new TypeError(`src type: ${N} specified but BOM is for ${q}"`);break;case q:if(C.type=q,F.length>=4){if(F[0]===0&&F[1]===0&&F[2]===254&&F[3]===255)throw new TypeError(`src type: "${q}" specified but BOM is for "${N}"`);F[0]===255&&F[1]===254&&F[2]===0&&F[3]===0&&(C.bom=4)}break;default:throw new TypeError(`UTF32 BOM: src type "${C.type}" unrecognized`)}},be=function(C,F){function X(ie){const Q={type:"",base64:!1},L=/^(base64:)?([a-zA-Z0-9]+)$/i.exec(ie);return L&&(L[2]&&(Q.type=L[2].toUpperCase()),L[1]&&(Q.base64=!0)),Q}const re=X(C.toUpperCase());if(re.base64){if(re.type===he)throw new TypeError(`type: "${C} "BASE64:" prefix not allowed with type ${he}`);if(v.isBuffer(F))re.data=w.base64.decode(F);else if(typeof F=="string"){const ie=v.from(F,"ascii");re.data=w.base64.decode(ie)}else throw new TypeError(`type: "${C} unrecognized data type: typeof(data): ${typeof F}`)}else re.data=F;switch(re.type){case _:oe(re);break;case A:case E:case k:de(re);break;case P:case N:case q:le(re);break;case V:re.type=J;break;case te:re.type=ce;break;case O:re.type=B;break;case I:re.type=D;break;case B:case D:case ee:case J:case se:case ce:case he:case ae:break;default:throw new TypeError(`type: "${C}" not recognized`)}if(re.type===he){if(typeof re.data!="string")throw new TypeError(`type: "${C}" but data is not a string`)}else if(!v.isBuffer(re.data))throw new TypeError(`type: "${C}" but data is not a Buffer`);return re},pe=function(C,F){function X(ie){let Q,ne;const L={crlf:!1,lf:!1,base64:!1,type:""},ue=!0;for(;ue;){if(ne=ie,Q=ie.slice(0,5),Q==="CRLF:"){L.crlf=!0,ne=ie.slice(5);break}if(Q=ie.slice(0,3),Q==="LF:"){L.lf=!0,ne=ie.slice(3);break}break}return Q=ne.split(":"),Q.length===1?L.type=Q[0]:Q.length===2&&Q[1]==="BASE64"&&(L.base64=!0,L.type=Q[0]),L}if(!Array.isArray(F))throw new TypeError(`dst chars: not array: "${typeof F}`);if(typeof C!="string")throw new TypeError(`dst type: not string: "${typeof C}`);const re=X(C.toUpperCase());switch(re.type){case _:case E:case k:case N:case q:case B:case D:case ee:case J:case se:case ce:case ae:break;case he:if(re.base64)throw new TypeError(`":BASE64" suffix not allowed with type ${he}`);break;case O:re.type=B;break;case I:re.type=D;break;case A:re.type=E;break;case P:re.type=N;break;case V:re.type=J;break;case te:re.type=ce;break;default:throw new TypeError(`dst type unrecognized: "${C}" : must have form [crlf:|lf:]type[:base64]`)}return re},fe=function(C,F){switch(C){case _:return w.utf8.encode(F);case E:return w.utf16be.encode(F);case k:return w.utf16le.encode(F);case N:return w.utf32be.encode(F);case q:return w.utf32le.encode(F);case B:return w.uint7.encode(F);case D:return w.uint8.encode(F);case J:return w.uint16be.encode(F);case ee:return w.uint16le.encode(F);case ce:return w.uint32be.encode(F);case se:return w.uint32le.encode(F);case he:return w.string.encode(F);case ae:return w.escaped.encode(F);default:throw new TypeError(`encode type "${C}" not recognized`)}},Z=function(C){switch(C.type){case _:return w.utf8.decode(C.data,C.bom);case k:return w.utf16le.decode(C.data,C.bom);case E:return w.utf16be.decode(C.data,C.bom);case N:return w.utf32be.decode(C.data,C.bom);case q:return w.utf32le.decode(C.data,C.bom);case B:return w.uint7.decode(C.data);case D:return w.uint8.decode(C.data);case J:return w.uint16be.decode(C.data);case ee:return w.uint16le.decode(C.data);case ce:return w.uint32be.decode(C.data);case se:return w.uint32le.decode(C.data);case he:return w.string.decode(C.data);case ae:return w.escaped.decode(C.data);default:throw new TypeError(`decode type "${C.type}" not recognized`)}};b.decode=function(C,F){const X=be(C,F);return Z(X)},b.encode=function(C,F){let X,re;const ie=pe(C,F);return ie.crlf?(X=w.lineEnds.crlf(F),re=fe(ie.type,X)):ie.lf?(X=w.lineEnds.lf(F),re=fe(ie.type,X)):re=fe(ie.type,F),ie.base64&&(re=w.base64.encode(re)),re};const U=function(C,F,X){return b.encode(X,b.decode(C,F))};b.convert=U}(converter)),converter}var emitcss=function(){return`/* This file automatically generated by jsonToless() and LESS. */
12
- .apg-mono {
13
- font-family: monospace;
14
- }
15
- .apg-active {
16
- font-weight: bold;
17
- color: #000000;
18
- }
19
- .apg-match {
20
- font-weight: bold;
21
- color: #264BFF;
22
- }
23
- .apg-empty {
24
- font-weight: bold;
25
- color: #0fbd0f;
26
- }
27
- .apg-nomatch {
28
- font-weight: bold;
29
- color: #FF4000;
30
- }
31
- .apg-lh-match {
32
- font-weight: bold;
33
- color: #1A97BA;
34
- }
35
- .apg-lb-match {
36
- font-weight: bold;
37
- color: #5F1687;
38
- }
39
- .apg-remainder {
40
- font-weight: bold;
41
- color: #999999;
42
- }
43
- .apg-ctrl-char {
44
- font-weight: bolder;
45
- font-style: italic;
46
- font-size: 0.6em;
47
- }
48
- .apg-line-end {
49
- font-weight: bold;
50
- color: #000000;
51
- }
52
- .apg-error {
53
- font-weight: bold;
54
- color: #FF4000;
55
- }
56
- .apg-phrase {
57
- color: #000000;
58
- background-color: #8caae6;
59
- }
60
- .apg-empty-phrase {
61
- color: #0fbd0f;
62
- }
63
- table.apg-state {
64
- font-family: monospace;
65
- margin-top: 5px;
66
- font-size: 11px;
67
- line-height: 130%;
68
- text-align: left;
69
- border: 1px solid black;
70
- border-collapse: collapse;
71
- }
72
- table.apg-state th,
73
- table.apg-state td {
74
- text-align: left;
75
- border: 1px solid black;
76
- border-collapse: collapse;
77
- }
78
- table.apg-state th:nth-last-child(2),
79
- table.apg-state td:nth-last-child(2) {
80
- text-align: right;
81
- }
82
- table.apg-state caption {
83
- font-size: 125%;
84
- line-height: 130%;
85
- font-weight: bold;
86
- text-align: left;
87
- }
88
- table.apg-stats {
89
- font-family: monospace;
90
- margin-top: 5px;
91
- font-size: 11px;
92
- line-height: 130%;
93
- text-align: right;
94
- border: 1px solid black;
95
- border-collapse: collapse;
96
- }
97
- table.apg-stats th,
98
- table.apg-stats td {
99
- text-align: right;
100
- border: 1px solid black;
101
- border-collapse: collapse;
102
- }
103
- table.apg-stats caption {
104
- font-size: 125%;
105
- line-height: 130%;
106
- font-weight: bold;
107
- text-align: left;
108
- }
109
- table.apg-trace {
110
- font-family: monospace;
111
- margin-top: 5px;
112
- font-size: 11px;
113
- line-height: 130%;
114
- text-align: right;
115
- border: 1px solid black;
116
- border-collapse: collapse;
117
- }
118
- table.apg-trace caption {
119
- font-size: 125%;
120
- line-height: 130%;
121
- font-weight: bold;
122
- text-align: left;
123
- }
124
- table.apg-trace th,
125
- table.apg-trace td {
126
- text-align: right;
127
- border: 1px solid black;
128
- border-collapse: collapse;
129
- }
130
- table.apg-trace th:last-child,
131
- table.apg-trace th:nth-last-child(2),
132
- table.apg-trace td:last-child,
133
- table.apg-trace td:nth-last-child(2) {
134
- text-align: left;
135
- }
136
- table.apg-grammar {
137
- font-family: monospace;
138
- margin-top: 5px;
139
- font-size: 11px;
140
- line-height: 130%;
141
- text-align: right;
142
- border: 1px solid black;
143
- border-collapse: collapse;
144
- }
145
- table.apg-grammar caption {
146
- font-size: 125%;
147
- line-height: 130%;
148
- font-weight: bold;
149
- text-align: left;
150
- }
151
- table.apg-grammar th,
152
- table.apg-grammar td {
153
- text-align: right;
154
- border: 1px solid black;
155
- border-collapse: collapse;
156
- }
157
- table.apg-grammar th:last-child,
158
- table.apg-grammar td:last-child {
159
- text-align: left;
160
- }
161
- table.apg-rules {
162
- font-family: monospace;
163
- margin-top: 5px;
164
- font-size: 11px;
165
- line-height: 130%;
166
- text-align: right;
167
- border: 1px solid black;
168
- border-collapse: collapse;
169
- }
170
- table.apg-rules caption {
171
- font-size: 125%;
172
- line-height: 130%;
173
- font-weight: bold;
174
- text-align: left;
175
- }
176
- table.apg-rules th,
177
- table.apg-rules td {
178
- text-align: right;
179
- border: 1px solid black;
180
- border-collapse: collapse;
181
- }
182
- table.apg-rules a {
183
- color: #003399 !important;
184
- }
185
- table.apg-rules a:hover {
186
- color: #8caae6 !important;
187
- }
188
- table.apg-attrs {
189
- font-family: monospace;
190
- margin-top: 5px;
191
- font-size: 11px;
192
- line-height: 130%;
193
- text-align: center;
194
- border: 1px solid black;
195
- border-collapse: collapse;
196
- }
197
- table.apg-attrs caption {
198
- font-size: 125%;
199
- line-height: 130%;
200
- font-weight: bold;
201
- text-align: left;
202
- }
203
- table.apg-attrs th,
204
- table.apg-attrs td {
205
- text-align: center;
206
- border: 1px solid black;
207
- border-collapse: collapse;
208
- }
209
- table.apg-attrs th:nth-child(1),
210
- table.apg-attrs th:nth-child(2),
211
- table.apg-attrs th:nth-child(3) {
212
- text-align: right;
213
- }
214
- table.apg-attrs td:nth-child(1),
215
- table.apg-attrs td:nth-child(2),
216
- table.apg-attrs td:nth-child(3) {
217
- text-align: right;
218
- }
219
- table.apg-attrs a {
220
- color: #003399 !important;
221
- }
222
- table.apg-attrs a:hover {
223
- color: #8caae6 !important;
224
- }
225
- `};(function(b){const v=style,w=requireConverter(),_=emitcss,A=identifiers,E="utilities.js: ",k=function(N,q,B){let O,I=q;const D=!0;for(;D;){if(N<=0){I=0,O=0;break}if(typeof I!="number"){I=0,O=N;break}if(I>=N){I=N,O=N;break}if(typeof B!="number"){O=N;break}if(O=I+B,O>N){O=N;break}break}return{beg:I,end:O}};b.htmlToPage=function(N,q){let B;if(typeof N!="string")throw new Error(`${E}htmlToPage: input HTML is not a string`);typeof q!="string"?B="htmlToPage":B=q;let O="";return O+=`<!DOCTYPE html>
226
- `,O+=`<html lang="en">
227
- `,O+=`<head>
228
- `,O+=`<meta charset="utf-8">
229
- `,O+=`<title>${B}</title>
230
- `,O+=`<style>
231
- `,O+=_(),O+=`</style>
232
- `,O+=`</head>
233
- <body>
234
- `,O+=`<p>${new Date}</p>
235
- `,O+=N,O+=`</body>
236
- </html>
237
- `,O},b.parserResultToHtml=function(N,q){let B=null;typeof q=="string"&&q!==""&&(B=q);let O,I;N.success===!0?O=`<span class="${v.CLASS_MATCH}">true</span>`:O=`<span class="${v.CLASS_NOMATCH}">false</span>`,N.state===A.EMPTY?I=`<span class="${v.CLASS_EMPTY}">EMPTY</span>`:N.state===A.MATCH?I=`<span class="${v.CLASS_MATCH}">MATCH</span>`:N.state===A.NOMATCH?I=`<span class="${v.CLASS_NOMATCH}">NOMATCH</span>`:I=`<span class="${v.CLASS_NOMATCH}">unrecognized</span>`;let D="";return D+=`<table class="${v.CLASS_STATE}">
238
- `,B&&(D+=`<caption>${B}</caption>
239
- `),D+=`<tr><th>state item</th><th>value</th><th>description</th></tr>
240
- `,D+=`<tr><td>parser success</td><td>${O}</td>
241
- `,D+=`<td><span class="${v.CLASS_MATCH}">true</span> if the parse succeeded,
242
- `,D+=` <span class="${v.CLASS_NOMATCH}">false</span> otherwise`,D+=`<br><i>NOTE: for success, entire string must be matched</i></td></tr>
243
- `,D+=`<tr><td>parser state</td><td>${I}</td>
244
- `,D+=`<td><span class="${v.CLASS_EMPTY}">EMPTY</span>, `,D+=`<span class="${v.CLASS_MATCH}">MATCH</span> or
245
- `,D+=`<span class="${v.CLASS_NOMATCH}">NOMATCH</span></td></tr>
246
- `,D+=`<tr><td>string length</td><td>${N.length}</td><td>length of the input (sub)string</td></tr>
247
- `,D+=`<tr><td>matched length</td><td>${N.matched}</td><td>number of input string characters matched</td></tr>
248
- `,D+=`<tr><td>max matched</td><td>${N.maxMatched}</td><td>maximum number of input string characters matched</td></tr>
249
- `,D+=`<tr><td>max tree depth</td><td>${N.maxTreeDepth}</td><td>maximum depth of the parse tree reached</td></tr>
250
- `,D+=`<tr><td>node hits</td><td>${N.nodeHits}</td><td>number of parse tree node hits (opcode function calls)</td></tr>
251
- `,D+=`<tr><td>input length</td><td>${N.inputLength}</td><td>length of full input string</td></tr>
252
- `,D+=`<tr><td>sub-string begin</td><td>${N.subBegin}</td><td>sub-string first character index</td></tr>
253
- `,D+=`<tr><td>sub-string end</td><td>${N.subEnd}</td><td>sub-string end-of-string index</td></tr>
254
- `,D+=`<tr><td>sub-string length</td><td>${N.subLength}</td><td>sub-string length</td></tr>
255
- `,D+=`</table>
256
- `,D},b.charsToString=function(N,q,B){let O,I;if(typeof q=="number"){if(q>=N.length)return"";O=q<0?0:q}else O=0;if(typeof B=="number"){if(B<=0)return"";I=B>N.length-O?N.length:O+B}else I=N.length;return O<I?w.encode("UTF16LE",N.slice(O,I)).toString("utf16le"):""},b.stringToChars=function(N){return w.decode("STRING",N)},b.opcodeToString=function(N){let q="unknown";switch(N){case A.ALT:q="ALT";break;case A.CAT:q="CAT";break;case A.RNM:q="RNM";break;case A.UDT:q="UDT";break;case A.AND:q="AND";break;case A.NOT:q="NOT";break;case A.REP:q="REP";break;case A.TRG:q="TRG";break;case A.TBS:q="TBS";break;case A.TLS:q="TLS";break;case A.BKR:q="BKR";break;case A.BKA:q="BKA";break;case A.BKN:q="BKN";break;case A.ABG:q="ABG";break;case A.AEN:q="AEN";break;default:throw new Error("unrecognized opcode")}return q},b.stateToString=function(N){let q="unknown";switch(N){case A.ACTIVE:q="ACTIVE";break;case A.MATCH:q="MATCH";break;case A.EMPTY:q="EMPTY";break;case A.NOMATCH:q="NOMATCH";break;default:throw new Error("unrecognized state")}return q},b.asciiChars=["NUL","SOH","STX","ETX","EOT","ENQ","ACK","BEL","BS","TAB","LF","VT","FF","CR","SO","SI","DLE","DC1","DC2","DC3","DC4","NAK","SYN","ETB","CAN","EM","SUB","ESC","FS","GS","RS","US","&nbsp;","!","&#34;","#","$","%","&#38;","&#39;","(",")","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","&#60;","=","&#62;","?","@","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","[","&#92;","]","^","_","`","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","{","|","}","~","DEL"],b.charToHex=function(N){let q=N.toString(16).toUpperCase();switch(q.length){case 1:case 3:case 7:q=`0${q}`;break;case 2:case 6:q=`00${q}`;break;case 4:break;case 5:q=`000${q}`;break;default:throw new Error("unrecognized option")}return q},b.charsToDec=function(N,q,B){let O="";if(!Array.isArray(N))throw new Error(`${E}charsToDec: input must be an array of integers`);const I=k(N.length,q,B);if(I.end>I.beg){O+=N[I.beg];for(let D=I.beg+1;D<I.end;D+=1)O+=`,${N[D]}`}return O},b.charsToHex=function(N,q,B){let O="";if(!Array.isArray(N))throw new Error(`${E}charsToHex: input must be an array of integers`);const I=k(N.length,q,B);if(I.end>I.beg){O+=`\\x${b.charToHex(N[I.beg])}`;for(let D=I.beg+1;D<I.end;D+=1)O+=`,\\x${b.charToHex(N[D])}`}return O},b.charsToHtmlEntities=function(N,q,B){let O="";if(!Array.isArray(N))throw new Error(`${E}charsToHex: input must be an array of integers`);const I=k(N.length,q,B);if(I.end>I.beg)for(let D=I.beg;D<I.end;D+=1)O+=`&#x${N[D].toString(16)};`;return O};function P(N){return!(N>=55296&&N<=57343||N>1114111)}b.charsToUnicode=function(N,q,B){let O="";if(!Array.isArray(N))throw new Error(`${E}charsToUnicode: input must be an array of integers`);const I=k(N.length,q,B);if(I.end>I.beg)for(let D=I.beg;D<I.end;D+=1)P(N[D])?O+=`&#${N[D]};`:O+=` U+${b.charToHex(N[D])}`;return O},b.charsToJsUnicode=function(N,q,B){let O="";if(!Array.isArray(N))throw new Error(`${E}charsToJsUnicode: input must be an array of integers`);const I=k(N.length,q,B);if(I.end>I.beg){O+=`\\u${b.charToHex(N[I.beg])}`;for(let D=I.beg+1;D<I.end;D+=1)O+=`,\\u${b.charToHex(N[D])}`}return O},b.charsToAscii=function(N,q,B){let O="";if(!Array.isArray(N))throw new Error(`${E}charsToAscii: input must be an array of integers`);const I=k(N.length,q,B);for(let D=I.beg;D<I.end;D+=1){const V=N[D];V>=32&&V<=126?O+=String.fromCharCode(V):O+=`\\x${b.charToHex(V)}`}return O},b.charsToAsciiHtml=function(N,q,B){if(!Array.isArray(N))throw new Error(`${E}charsToAsciiHtml: input must be an array of integers`);let O="",I;const D=k(N.length,q,B);for(let V=D.beg;V<D.end;V+=1)I=N[V],I<32||I===127?O+=`<span class="${v.CLASS_CTRLCHAR}">${b.asciiChars[I]}</span>`:I>127?O+=`<span class="${v.CLASS_CTRLCHAR}">U+${b.charToHex(I)}</span>`:O+=b.asciiChars[I];return O},b.stringToAsciiHtml=function(N){const q=w.decode("STRING",N);return this.charsToAsciiHtml(q)}})(utilities);var ast=function(){const v=identifiers,w=utilities,_="ast.js: ",A=this;let E=null,k=null,P=null,N=0;const q=[],B=[],O=[],I=[];this.callbacks=[],this.astObject="astObject",this.init=function(ee,J,te){O.length=0,I.length=0,q.length=0,N=0,E=ee,k=J,P=te;let se;const ce=[];for(se=0;se<E.length;se+=1)ce.push(E[se].lower);for(se=0;se<k.length;se+=1)ce.push(k[se].lower);for(N=E.length+k.length,se=0;se<N;se+=1)q[se]=!1,B[se]=null;for(const ae in A.callbacks){const he=ae.toLowerCase();if(se=ce.indexOf(he),se<0)throw new Error(`${_}init: node '${ae}' not a rule or udt name`);typeof A.callbacks[ae]=="function"&&(q[se]=!0,B[se]=A.callbacks[ae]),A.callbacks[ae]===!0&&(q[se]=!0)}},this.ruleDefined=function(ee){return q[ee]!==!1},this.udtDefined=function(ee){return q[E.length+ee]!==!1},this.down=function(ee,J){const te=I.length;return O.push(te),I.push({name:J,thisIndex:te,thatIndex:null,state:v.SEM_PRE,callbackIndex:ee,phraseIndex:null,phraseLength:null,stack:O.length}),te},this.up=function(ee,J,te,se){const ce=I.length,ae=O.pop();return I.push({name:J,thisIndex:ce,thatIndex:ae,state:v.SEM_POST,callbackIndex:ee,phraseIndex:te,phraseLength:se,stack:O.length}),I[ae].thatIndex=ce,I[ae].phraseIndex=te,I[ae].phraseLength=se,ce},this.translate=function(ee){let J,te,se;for(let ce=0;ce<I.length;ce+=1)se=I[ce],te=B[se.callbackIndex],se.state===v.SEM_PRE?te!==null&&(J=te(v.SEM_PRE,P,se.phraseIndex,se.phraseLength,ee),J===v.SEM_SKIP&&(ce=se.thatIndex)):te!==null&&te(v.SEM_POST,P,se.phraseIndex,se.phraseLength,ee)},this.setLength=function(ee){I.length=ee,ee>0?O.length=I[ee-1].stack:O.length=0},this.getLength=function(){return I.length};function D(V){let ee="";for(let J=0;J<V;J+=1)ee+=" ";return ee}this.toXml=function(ee){let J=w.charsToDec,te="decimal integer character codes";if(typeof ee=="string"&&ee.length>=3){const ae=ee.slice(0,3).toLowerCase();ae==="asc"?(J=w.charsToAscii,te="ASCII for printing characters, hex for non-printing"):ae==="hex"?(J=w.charsToHex,te="hexadecimal integer character codes"):ae==="uni"&&(J=w.charsToUnicode,te="Unicode UTF-32 integer character codes")}let se="",ce=0;return se+=`<?xml version="1.0" encoding="utf-8"?>
257
- `,se+=`<root nodes="${I.length/2}" characters="${P.length}">
258
- `,se+=`<!-- input string, ${te} -->
259
- `,se+=D(ce+2),se+=J(P),se+=`
260
- `,I.forEach(ae=>{ae.state===v.SEM_PRE?(ce+=1,se+=D(ce),se+=`<node name="${ae.name}" index="${ae.phraseIndex}" length="${ae.phraseLength}">
261
- `,se+=D(ce+2),se+=J(P,ae.phraseIndex,ae.phraseLength),se+=`
262
- `):(se+=D(ce),se+=`</node><!-- name="${ae.name}" -->
263
- `,ce-=1)}),se+=`</root>
264
- `,se},this.phrases=function(){const ee={};let J,te;for(J=0;J<I.length;J+=1)te=I[J],te.state===v.SEM_PRE&&(Array.isArray(ee[te.name])||(ee[te.name]=[]),ee[te.name].push({index:te.phraseIndex,length:te.phraseLength}));return ee}},circularBuffer=function(){"use strict;";const v="circular-buffer.js: ";let w=-1,_=0;this.init=function(E){if(typeof E!="number"||E<=0)throw new Error(`${v}init: circular buffer size must an integer > 0`);_=Math.ceil(E),w=-1},this.increment=function(){return w+=1,(w+_)%_},this.maxSize=function(){return _},this.items=function(){return w+1},this.getListIndex=function(E){return w===-1||E<0||E>w||w-E>=_?-1:(E+_)%_},this.forEach=function(E){if(w!==-1){if(w<_){for(let k=0;k<=w;k+=1)E(k,k);return}for(let k=w-_+1;k<=w;k+=1){const P=(k+_)%_;E(P,k)}}}},parser$1=function(){const v=identifiers,w=utilities,_="parser.js: ",A=this;let E;this.ast=null,this.stats=null,this.trace=null,this.callbacks=[];let k=null,P=null,N,q,B,O,I=0,D=0,V=0,ee=null,J=null,te=null,se=null,ce=null,ae=0,he=1/0,oe=1/0;const de=function(qe,$e,Ie){const we=`${_}evaluateRule(): `;if(qe>=te.length)throw new Error(`${we}rule index: ${qe} out of range`);if($e>=B)throw new Error(`${we}phrase index: ${$e} out of range`);const{length:me}=k;k.push({type:v.RNM,index:qe}),E(me,$e,Ie),k.pop()},le=function(Fe,qe,$e){const Ie=`${_}evaluateUdt(): `;if(Fe>=se.length)throw new Error(`${Ie}udt index: ${Fe} out of range`);if(qe>=B)throw new Error(`${Ie}phrase index: ${qe} out of range`);const{length:we}=k;k.push({type:v.UDT,empty:se[Fe].empty,index:Fe}),E(we,qe,$e),k.pop()},be=function(){I=0,D=0,V=0,ae=0,O=[{lookAround:v.LOOKAROUND_NONE,anchor:0,charsEnd:0,charsLength:0}],te=null,se=null,P=null,N=0,q=0,B=0,ee=null,J=null,ce=null,k=null},pe=function(){const Fe=[],qe=function(){const Ie={};te.forEach(we=>{we.isBkr&&(Ie[we.lower]=null)}),se.length>0&&se.forEach(we=>{we.isBkr&&(Ie[we.lower]=null)}),Fe.push(Ie)},$e=function(){const Ie=Fe[Fe.length-1],we={};for(const me in Ie)we[me]=Ie[me];return we};this.push=function(){Fe.push($e())},this.pop=function(we){let me=we;if(me||(me=Fe.length-1),me<1||me>Fe.length)throw new Error(`${_}backRef.pop(): bad length: ${me}`);return Fe.length=me,Fe[Fe.length-1]},this.length=function(){return Fe.length},this.savePhrase=function(we,me,ye){Fe[Fe.length-1][we]={phraseIndex:me,phraseLength:ye}},this.getPhrase=function(Ie){return Fe[Fe.length-1][Ie]},qe()},fe=function(){const qe=this;this.state=v.ACTIVE,this.phraseLength=0,this.ruleIndex=0,this.udtIndex=0,this.lookAround=O[O.length-1],this.uFrame=new pe,this.pFrame=new pe,this.evaluateRule=de,this.evaluateUdt=le,this.refresh=function(){qe.state=v.ACTIVE,qe.phraseLength=0,qe.lookAround=O[O.length-1]}},Z=function(){return O[O.length-1]},U=function(){return O.length>1},S=function(){return O[O.length-1].lookAround===v.LOOKAROUND_BEHIND},C=function(){const Fe=`${_}initializeAst(): `,qe=!0;for(;qe;){if(A.ast===void 0){A.ast=null;break}if(A.ast===null)break;if(A.ast.astObject!=="astObject")throw new Error(`${Fe}ast object not recognized`);break}A.ast!==null&&A.ast.init(te,se,P)},F=function(){const Fe=`${_}initializeTrace(): `,qe=!0;for(;qe;){if(A.trace===void 0){A.trace=null;break}if(A.trace===null)break;if(A.trace.traceObject!=="traceObject")throw new Error(`${Fe}trace object not recognized`);break}A.trace!==null&&A.trace.init(te,se,P)},X=function(){const Fe=`${_}initializeStats(): `,qe=!0;for(;qe;){if(A.stats===void 0){A.stats=null;break}if(A.stats===null)break;if(A.stats.statsObject!=="statsObject")throw new Error(`${Fe}stats object not recognized`);break}A.stats!==null&&A.stats.init(te,se)},re=function(Fe){const qe=`${_}initializeGrammar(): `;if(!Fe)throw new Error(`${qe}grammar object undefined`);if(Fe.grammarObject!=="grammarObject")throw new Error(`${qe}bad grammar object`);te=Fe.rules,se=Fe.udts},ie=function(Fe){const qe=`${_}initializeStartRule(): `;let $e=null;if(typeof Fe=="number"){if(Fe>=te.length)throw new Error(`${qe}start rule index too large: max: ${te.length}: index: ${Fe}`);$e=Fe}else if(typeof Fe=="string"){const Ie=Fe.toLowerCase();for(let we=0;we<te.length;we+=1)if(Ie===te[we].lower){$e=te[we].index;break}if($e===null)throw new Error(`${qe}start rule name '${Fe}' not recognized`)}else throw new Error(`${qe}type of start rule '${typeof Fe}' not recognized`);return $e},Q=function(qe,$e,Ie){const we=`${_}initializeInputChars(): `;let me=qe,ye=$e,Me=Ie;if(me===void 0)throw new Error(`${we}input string is undefined`);if(me===null)throw new Error(`${we}input string is null`);if(typeof me=="string")me=w.stringToChars(me);else if(!Array.isArray(me))throw new Error(`${we}input string is not a string or array`);if(me.length>0&&typeof me[0]!="number")throw new Error(`${we}input string not an array of integers`);if(typeof ye!="number")ye=0;else if(ye=Math.floor(ye),ye<0||ye>me.length)throw new Error(`${we}input beginning index out of range: ${ye}`);if(typeof Me!="number")Me=me.length-ye;else if(Me=Math.floor(Me),Me<0||Me>me.length-ye)throw new Error(`${we}input length out of range: ${Me}`);P=me,N=ye,q=Me,B=N+q},ne=function(){const Fe=`${_}initializeCallbacks(): `;let qe;for(ee=[],J=[],qe=0;qe<te.length;qe+=1)ee[qe]=null;for(qe=0;qe<se.length;qe+=1)J[qe]=null;let $e;const Ie=[];for(qe=0;qe<te.length;qe+=1)Ie.push(te[qe].lower);for(qe=0;qe<se.length;qe+=1)Ie.push(se[qe].lower);for(const we in A.callbacks){if(qe=Ie.indexOf(we.toLowerCase()),qe<0)throw new Error(`${Fe}syntax callback '${we}' not a rule or udt name`);if($e=A.callbacks[we],$e||($e=null),typeof $e=="function"||$e===null)qe<te.length?ee[qe]=$e:J[qe-te.length]=$e;else throw new Error(`${Fe}syntax callback[${we}] must be function reference or 'false' (false/null/undefined/etc.)`)}for(qe=0;qe<se.length;qe+=1)if(J[qe]===null)throw new Error(`${Fe}all UDT callbacks must be defined. UDT callback[${se[qe].lower}] not a function reference`)};this.setMaxTreeDepth=function(Fe){if(typeof Fe!="number")throw new Error(`parser: max tree depth must be integer > 0: ${Fe}`);if(he=Math.floor(Fe),he<=0)throw new Error(`parser: max tree depth must be integer > 0: ${Fe}`)},this.setMaxNodeHits=function(Fe){if(typeof Fe!="number")throw new Error(`parser: max node hits must be integer > 0: ${Fe}`);if(oe=Math.floor(Fe),oe<=0)throw new Error(`parser: max node hits must be integer > 0: ${Fe}`)};const L=function(Fe,qe,$e){let Ie;const we=`${_}parse(): `;re(Fe);const me=ie(qe);ne(),F(),X(),C();const ye=new fe;switch($e!=null&&(ce=$e),k=[{type:v.RNM,index:me}],E(0,N,ye),k=null,ye.state){case v.ACTIVE:throw new Error(`${we}final state should never be 'ACTIVE'`);case v.NOMATCH:Ie=!1;break;case v.EMPTY:case v.MATCH:ye.phraseLength===q?Ie=!0:Ie=!1;break;default:throw new Error("unrecognized state")}return{success:Ie,state:ye.state,length:q,matched:ye.phraseLength,maxMatched:ae,maxTreeDepth:D,nodeHits:V,inputLength:P.length,subBegin:N,subEnd:B,subLength:q}};this.parseSubstring=function(qe,$e,Ie,we,me,ye){return be(),Q(Ie,we,me),L(qe,$e,ye)},this.parse=function(qe,$e,Ie,we){return be(),Q(Ie,0,Ie.length),L(qe,$e,we)};const ue=function(Fe,qe,$e){const Ie=k[Fe];for(let we=0;we<Ie.children.length&&(E(Ie.children[we],qe,$e),$e.state===v.NOMATCH);we+=1);},Ae=function(Fe,qe,$e){let Ie,we,me,ye;const Me=k[Fe],je=$e.uFrame.length(),He=$e.pFrame.length();A.ast&&(we=A.ast.getLength()),Ie=!0,me=qe,ye=0;for(let Ue=0;Ue<Me.children.length;Ue+=1)if(E(Me.children[Ue],me,$e),$e.state===v.NOMATCH){Ie=!1;break}else me+=$e.phraseLength,ye+=$e.phraseLength;Ie?($e.state=ye===0?v.EMPTY:v.MATCH,$e.phraseLength=ye):($e.state=v.NOMATCH,$e.phraseLength=0,$e.uFrame.pop(je),$e.pFrame.pop(He),A.ast&&A.ast.setLength(we))},Re=function(Fe,qe,$e){let Ie,we,me,ye;const Me=k[Fe];if(Me.max===0){$e.state=v.EMPTY,$e.phraseLength=0;return}we=qe,me=0,ye=0;const je=$e.uFrame.length(),He=$e.pFrame.length();A.ast&&(Ie=A.ast.getLength());const Ue=!0;for(;Ue&&!(we>=B||(E(Fe+1,we,$e),$e.state===v.NOMATCH)||$e.state===v.EMPTY||(ye+=1,me+=$e.phraseLength,we+=$e.phraseLength,ye===Me.max)););$e.state===v.EMPTY||ye>=Me.min?($e.state=me===0?v.EMPTY:v.MATCH,$e.phraseLength=me):($e.state=v.NOMATCH,$e.phraseLength=0,$e.uFrame.pop(je),$e.pFrame.pop(He),A.ast&&A.ast.setLength(Ie))},Pe=function(Fe,qe,$e,Ie){if(qe.phraseLength>$e){let we=`${_}opRNM(${Fe.name}): callback function error: `;throw we+=`sysData.phraseLength: ${qe.phraseLength}`,we+=` must be <= remaining chars: ${$e}`,new Error(we)}switch(qe.state){case v.ACTIVE:if(Ie!==!0)throw new Error(`${_}opRNM(${Fe.name}): callback function return error. ACTIVE state not allowed.`);break;case v.EMPTY:qe.phraseLength=0;break;case v.MATCH:qe.phraseLength===0&&(qe.state=v.EMPTY);break;case v.NOMATCH:qe.phraseLength=0;break;default:throw new Error(`${_}opRNM(${Fe.name}): callback function return error. Unrecognized return state: ${qe.state}`)}},xe=function(Fe,qe,$e){let Ie,we,me,ye,Me,je;const He=k[Fe],Ue=te[He.index],rt=ee[Ue.index],it=!U();if(it&&(we=A.ast&&A.ast.ruleDefined(He.index),we&&(Ie=A.ast.getLength(),A.ast.down(He.index,te[He.index].name)),ye=$e.uFrame.length(),Me=$e.pFrame.length(),$e.uFrame.push(),$e.pFrame.push(),je=$e.pFrame,$e.pFrame=new pe),rt===null)me=k,k=Ue.opcodes,E(0,qe,$e),k=me;else{const tt=B-qe;$e.ruleIndex=Ue.index,rt($e,P,qe,ce),Pe(Ue,$e,tt,!0),$e.state===v.ACTIVE&&(me=k,k=Ue.opcodes,E(0,qe,$e),k=me,$e.ruleIndex=Ue.index,rt($e,P,qe,ce),Pe(Ue,$e,tt,!1))}it&&(we&&($e.state===v.NOMATCH?A.ast.setLength(Ie):A.ast.up(He.index,Ue.name,qe,$e.phraseLength)),$e.pFrame=je,$e.state===v.NOMATCH?($e.uFrame.pop(ye),$e.pFrame.pop(Me)):Ue.isBkr&&($e.pFrame.savePhrase(Ue.lower,qe,$e.phraseLength),$e.uFrame.savePhrase(Ue.lower,qe,$e.phraseLength)))},ge=function(Fe,qe,$e){if(qe.phraseLength>$e){let Ie=`${_}opUDT(${Fe.name}): callback function error: `;throw Ie+=`sysData.phraseLength: ${qe.phraseLength}`,Ie+=` must be <= remaining chars: ${$e}`,new Error(Ie)}switch(qe.state){case v.ACTIVE:throw new Error(`${_}opUDT(${Fe.name}): callback function return error. ACTIVE state not allowed.`);case v.EMPTY:if(Fe.empty===!1)throw new Error(`${_}opUDT(${Fe.name}): callback function return error. May not return EMPTY.`);qe.phraseLength=0;break;case v.MATCH:if(qe.phraseLength===0){if(Fe.empty===!1)throw new Error(`${_}opUDT(${Fe.name}): callback function return error. May not return EMPTY.`);qe.state=v.EMPTY}break;case v.NOMATCH:qe.phraseLength=0;break;default:throw new Error(`${_}opUDT(${Fe.name}): callback function return error. Unrecognized return state: ${qe.state}`)}},_e=function(Fe,qe,$e){let Ie,we,me,ye,Me,je;const He=k[Fe],Ue=se[He.index];$e.UdtIndex=Ue.index;const rt=!U();rt&&(me=A.ast&&A.ast.udtDefined(He.index),me&&(we=te.length+He.index,Ie=A.ast.getLength(),A.ast.down(we,Ue.name)),ye=$e.uFrame.length(),Me=$e.pFrame.length(),$e.uFrame.push(),$e.pFrame.push(),je=$e.pFrame,$e.pFrame=new pe);const it=B-qe;J[He.index]($e,P,qe,ce),ge(Ue,$e,it),rt&&(me&&($e.state===v.NOMATCH?A.ast.setLength(Ie):A.ast.up(we,Ue.name,qe,$e.phraseLength)),$e.pFrame=je,$e.state===v.NOMATCH?($e.uFrame.pop(ye),$e.pFrame.pop(Me)):Ue.isBkr&&($e.pFrame.savePhrase(Ue.lower,qe,$e.phraseLength),$e.uFrame.savePhrase(Ue.lower,qe,$e.phraseLength)))},ke=function(Fe,qe,$e){O.push({lookAround:v.LOOKAROUND_AHEAD,anchor:qe,charsEnd:B,charsLength:q}),B=P.length,q=P.length-N,E(Fe+1,qe,$e);const Ie=O.pop();switch(B=Ie.charsEnd,q=Ie.charsLength,$e.phraseLength=0,$e.state){case v.EMPTY:$e.state=v.EMPTY;break;case v.MATCH:$e.state=v.EMPTY;break;case v.NOMATCH:$e.state=v.NOMATCH;break;default:throw new Error(`opAND: invalid state ${$e.state}`)}},Ee=function(Fe,qe,$e){O.push({lookAround:v.LOOKAROUND_AHEAD,anchor:qe,charsEnd:B,charsLength:q}),B=P.length,q=P.length-N,E(Fe+1,qe,$e);const Ie=O.pop();switch(B=Ie.charsEnd,q=Ie.charsLength,$e.phraseLength=0,$e.state){case v.EMPTY:case v.MATCH:$e.state=v.NOMATCH;break;case v.NOMATCH:$e.state=v.EMPTY;break;default:throw new Error(`opNOT: invalid state ${$e.state}`)}},Se=function(Fe,qe,$e){const Ie=k[Fe];$e.state=v.NOMATCH,qe<B&&Ie.min<=P[qe]&&P[qe]<=Ie.max&&($e.state=v.MATCH,$e.phraseLength=1)},Oe=function(Fe,qe,$e){let Ie;const we=k[Fe],me=we.string.length;if($e.state=v.NOMATCH,qe+me<=B){for(Ie=0;Ie<me;Ie+=1)if(P[qe+Ie]!==we.string[Ie])return;$e.state=v.MATCH,$e.phraseLength=me}},Ne=function(Fe,qe,$e){let Ie,we;const me=k[Fe];$e.state=v.NOMATCH;const ye=me.string.length;if(ye===0){$e.state=v.EMPTY;return}if(qe+ye<=B){for(Ie=0;Ie<ye;Ie+=1)if(we=P[qe+Ie],we>=65&&we<=90&&(we+=32),we!==me.string[Ie])return;$e.state=v.MATCH,$e.phraseLength=ye}},ve=function(Fe,qe,$e){$e.state=v.NOMATCH,$e.phraseLength=0,$e.state=qe===0?v.EMPTY:v.NOMATCH},Ce=function(Fe,qe,$e){$e.state=v.NOMATCH,$e.phraseLength=0,$e.state=qe===P.length?v.EMPTY:v.NOMATCH},Te=function(Fe,qe,$e){let Ie,we,me,ye;const Me=k[Fe];$e.state=v.NOMATCH,Me.index<te.length?ye=te[Me.index].lower:ye=se[Me.index-te.length].lower;const je=Me.bkrMode===v.BKR_MODE_PM?$e.pFrame.getPhrase(ye):$e.uFrame.getPhrase(ye),He=Me.bkrCase===v.BKR_MODE_CI;if(je===null)return;const Ue=je.phraseIndex,rt=je.phraseLength;if(rt===0){$e.state=v.EMPTY;return}if(qe+rt<=B){if(He){for(Ie=0;Ie<rt;Ie+=1)if(we=P[qe+Ie],me=P[Ue+Ie],we>=65&&we<=90&&(we+=32),me>=65&&me<=90&&(me+=32),we!==me)return;$e.state=v.MATCH,$e.phraseLength=rt}else for(Ie=0;Ie<rt;Ie+=1)if(we=P[qe+Ie],me=P[Ue+Ie],we!==me)return;$e.state=v.MATCH,$e.phraseLength=rt}},Le=function(Fe,qe,$e){switch(O.push({lookAround:v.LOOKAROUND_BEHIND,anchor:qe}),E(Fe+1,qe,$e),O.pop(),$e.phraseLength=0,$e.state){case v.EMPTY:$e.state=v.EMPTY;break;case v.MATCH:$e.state=v.EMPTY;break;case v.NOMATCH:$e.state=v.NOMATCH;break;default:throw new Error(`opBKA: invalid state ${$e.state}`)}},Be=function(Fe,qe,$e){switch(O.push({lookAround:v.LOOKAROUND_BEHIND,anchor:qe}),E(Fe+1,qe,$e),O.pop(),$e.phraseLength=0,$e.state){case v.EMPTY:case v.MATCH:$e.state=v.NOMATCH;break;case v.NOMATCH:$e.state=v.EMPTY;break;default:throw new Error(`opBKN: invalid state ${$e.state}`)}},De=function(Fe,qe,$e){let Ie,we,me,ye;const Me=k[Fe],je=$e.uFrame.length(),He=$e.pFrame.length();A.ast&&(we=A.ast.getLength()),Ie=!0,me=qe,ye=0;for(let Ue=Me.children.length-1;Ue>=0;Ue-=1)if(E(Me.children[Ue],me,$e),me-=$e.phraseLength,ye+=$e.phraseLength,$e.state===v.NOMATCH){Ie=!1;break}Ie?($e.state=ye===0?v.EMPTY:v.MATCH,$e.phraseLength=ye):($e.state=v.NOMATCH,$e.phraseLength=0,$e.uFrame.pop(je),$e.pFrame.pop(He),A.ast&&A.ast.setLength(we))},Ke=function(Fe,qe,$e){let Ie,we,me,ye;const Me=k[Fe];we=qe,me=0,ye=0;const je=$e.uFrame.length(),He=$e.pFrame.length();A.ast&&(Ie=A.ast.getLength());const Ue=!0;for(;Ue&&!(we<=0||(E(Fe+1,we,$e),$e.state===v.NOMATCH)||$e.state===v.EMPTY||(ye+=1,me+=$e.phraseLength,we-=$e.phraseLength,ye===Me.max)););$e.state===v.EMPTY||ye>=Me.min?($e.state=me===0?v.EMPTY:v.MATCH,$e.phraseLength=me):($e.state=v.NOMATCH,$e.phraseLength=0,$e.uFrame.pop(je),$e.pFrame.pop(He),A.ast&&A.ast.setLength(Ie))},We=function(Fe,qe,$e){const Ie=k[Fe];if($e.state=v.NOMATCH,$e.phraseLength=0,qe>0){const we=P[qe-1];Ie.min<=we&&we<=Ie.max&&($e.state=v.MATCH,$e.phraseLength=1)}},Qe=function(Fe,qe,$e){let Ie;const we=k[Fe];$e.state=v.NOMATCH;const me=we.string.length,ye=qe-me;if(ye>=0){for(Ie=0;Ie<me;Ie+=1)if(P[ye+Ie]!==we.string[Ie])return;$e.state=v.MATCH,$e.phraseLength=me}},Xe=function(Fe,qe,$e){let Ie;const we=k[Fe];$e.state=v.NOMATCH;const me=we.string.length;if(me===0){$e.state=v.EMPTY;return}const ye=qe-me;if(ye>=0){for(let Me=0;Me<me;Me+=1)if(Ie=P[ye+Me],Ie>=65&&Ie<=90&&(Ie+=32),Ie!==we.string[Me])return;$e.state=v.MATCH,$e.phraseLength=me}},at=function(Fe,qe,$e){let Ie,we,me,ye;const Me=k[Fe];$e.state=v.NOMATCH,$e.phraseLength=0,Me.index<te.length?ye=te[Me.index].lower:ye=se[Me.index-te.length].lower;const je=Me.bkrMode===v.BKR_MODE_PM?$e.pFrame.getPhrase(ye):$e.uFrame.getPhrase(ye),He=Me.bkrCase===v.BKR_MODE_CI;if(je===null)return;const Ue=je.phraseIndex,rt=je.phraseLength;if(rt===0){$e.state=v.EMPTY,$e.phraseLength=0;return}const it=qe-rt;if(it>=0){if(He){for(Ie=0;Ie<rt;Ie+=1)if(we=P[it+Ie],me=P[Ue+Ie],we>=65&&we<=90&&(we+=32),me>=65&&me<=90&&(me+=32),we!==me)return;$e.state=v.MATCH,$e.phraseLength=rt}else for(Ie=0;Ie<rt;Ie+=1)if(we=P[it+Ie],me=P[Ue+Ie],we!==me)return;$e.state=v.MATCH,$e.phraseLength=rt}};E=function(qe,$e,Ie){let we=!0;const me=k[qe];if(V+=1,V>oe)throw new Error(`parser: maximum number of node hits exceeded: ${oe}`);if(I+=1,I>D&&(D=I,D>he))throw new Error(`parser: maximum parse tree depth exceeded: ${he}`);if(Ie.refresh(),A.trace!==null){const ye=Z();A.trace.down(me,Ie.state,$e,Ie.phraseLength,ye.anchor,ye.lookAround)}if(S())switch(me.type){case v.ALT:ue(qe,$e,Ie);break;case v.CAT:De(qe,$e,Ie);break;case v.REP:Ke(qe,$e,Ie);break;case v.RNM:xe(qe,$e,Ie);break;case v.UDT:_e(qe,$e,Ie);break;case v.AND:ke(qe,$e,Ie);break;case v.NOT:Ee(qe,$e,Ie);break;case v.TRG:We(qe,$e,Ie);break;case v.TBS:Qe(qe,$e,Ie);break;case v.TLS:Xe(qe,$e,Ie);break;case v.BKR:at(qe,$e,Ie);break;case v.BKA:Le(qe,$e,Ie);break;case v.BKN:Be(qe,$e,Ie);break;case v.ABG:ve(qe,$e,Ie);break;case v.AEN:Ce(qe,$e,Ie);break;default:we=!1;break}else switch(me.type){case v.ALT:ue(qe,$e,Ie);break;case v.CAT:Ae(qe,$e,Ie);break;case v.REP:Re(qe,$e,Ie);break;case v.RNM:xe(qe,$e,Ie);break;case v.UDT:_e(qe,$e,Ie);break;case v.AND:ke(qe,$e,Ie);break;case v.NOT:Ee(qe,$e,Ie);break;case v.TRG:Se(qe,$e,Ie);break;case v.TBS:Oe(qe,$e,Ie);break;case v.TLS:Ne(qe,$e,Ie);break;case v.BKR:Te(qe,$e,Ie);break;case v.BKA:Le(qe,$e,Ie);break;case v.BKN:Be(qe,$e,Ie);break;case v.ABG:ve(qe,$e,Ie);break;case v.AEN:Ce(qe,$e,Ie);break;default:we=!1;break}if(!U()&&$e+Ie.phraseLength>ae&&(ae=$e+Ie.phraseLength),A.stats!==null&&A.stats.collect(me,Ie),A.trace!==null){const ye=Z();A.trace.up(me,Ie.state,$e,Ie.phraseLength,ye.anchor,ye.lookAround)}return I-=1,we}},stats=function(){const v=identifiers,w=utilities,_=style,A="stats.js: ";let E=[],k=[];const P=[];let N;const q=[],B=[];this.statsObject="statsObject";const O="stats",I=function(oe,de){return oe.lower<de.lower?-1:oe.lower>de.lower?1:0},D=function(oe,de){return oe.total<de.total?1:oe.total>de.total?-1:I(oe,de)},V=function(oe,de){return oe.index<de.index?-1:oe.index>de.index?1:0},ee=function(){this.empty=0,this.match=0,this.nomatch=0,this.total=0},J=function(){P.length=0,N=new ee,P[v.ALT]=new ee,P[v.CAT]=new ee,P[v.REP]=new ee,P[v.RNM]=new ee,P[v.TRG]=new ee,P[v.TBS]=new ee,P[v.TLS]=new ee,P[v.UDT]=new ee,P[v.AND]=new ee,P[v.NOT]=new ee,P[v.BKR]=new ee,P[v.BKA]=new ee,P[v.BKN]=new ee,P[v.ABG]=new ee,P[v.AEN]=new ee,q.length=0;for(let oe=0;oe<E.length;oe+=1)q.push({empty:0,match:0,nomatch:0,total:0,name:E[oe].name,lower:E[oe].lower,index:E[oe].index});if(k.length>0){B.length=0;for(let oe=0;oe<k.length;oe+=1)B.push({empty:0,match:0,nomatch:0,total:0,name:k[oe].name,lower:k[oe].lower,index:k[oe].index})}},te=function(oe,de){switch(oe.total+=1,de){case v.EMPTY:oe.empty+=1;break;case v.MATCH:oe.match+=1;break;case v.NOMATCH:oe.nomatch+=1;break;default:throw new Error(`${A}collect(): incStat(): unrecognized state: ${de}`)}},se=function(oe,de){let le="";return le+="<tr>",le+=`<td class="${_.CLASS_ACTIVE}">${oe}</td>`,le+=`<td class="${_.CLASS_EMPTY}">${de.empty}</td>`,le+=`<td class="${_.CLASS_MATCH}">${de.match}</td>`,le+=`<td class="${_.CLASS_NOMATCH}">${de.nomatch}</td>`,le+=`<td class="${_.CLASS_ACTIVE}">${de.total}</td>`,le+=`</tr>
265
- `,le},ce=function(){let oe="";return oe+=se("ALT",P[v.ALT]),oe+=se("CAT",P[v.CAT]),oe+=se("REP",P[v.REP]),oe+=se("RNM",P[v.RNM]),oe+=se("TRG",P[v.TRG]),oe+=se("TBS",P[v.TBS]),oe+=se("TLS",P[v.TLS]),oe+=se("UDT",P[v.UDT]),oe+=se("AND",P[v.AND]),oe+=se("NOT",P[v.NOT]),oe+=se("BKR",P[v.BKR]),oe+=se("BKA",P[v.BKA]),oe+=se("BKN",P[v.BKN]),oe+=se("ABG",P[v.ABG]),oe+=se("AEN",P[v.AEN]),oe+=se("totals",N),oe},ae=function(){let oe="";oe+=`<tr><th></th><th></th><th></th><th></th><th></th></tr>
266
- `,oe+=`<tr><th>rules</th><th></th><th></th><th></th><th></th></tr>
267
- `;for(let de=0;de<E.length;de+=1)q[de].total>0&&(oe+="<tr>",oe+=`<td class="${_.CLASS_ACTIVE}">${q[de].name}</td>`,oe+=`<td class="${_.CLASS_EMPTY}">${q[de].empty}</td>`,oe+=`<td class="${_.CLASS_MATCH}">${q[de].match}</td>`,oe+=`<td class="${_.CLASS_NOMATCH}">${q[de].nomatch}</td>`,oe+=`<td class="${_.CLASS_ACTIVE}">${q[de].total}</td>`,oe+=`</tr>
268
- `);if(k.length>0){oe+=`<tr><th></th><th></th><th></th><th></th><th></th></tr>
269
- `,oe+=`<tr><th>udts</th><th></th><th></th><th></th><th></th></tr>
270
- `;for(let de=0;de<k.length;de+=1)B[de].total>0&&(oe+="<tr>",oe+=`<td class="${_.CLASS_ACTIVE}">${B[de].name}</td>`,oe+=`<td class="${_.CLASS_EMPTY}">${B[de].empty}</td>`,oe+=`<td class="${_.CLASS_MATCH}">${B[de].match}</td>`,oe+=`<td class="${_.CLASS_NOMATCH}">${B[de].nomatch}</td>`,oe+=`<td class="${_.CLASS_ACTIVE}">${B[de].total}</td>`,oe+=`</tr>
271
- `)}return oe};this.validate=function(oe){let de=!1;return typeof oe=="string"&&O===oe&&(de=!0),de},this.init=function(oe,de){E=oe,k=de,J()},this.collect=function(oe,de){te(N,de.state,de.phraseLength),te(P[oe.type],de.state,de.phraseLength),oe.type===v.RNM&&te(q[oe.index],de.state,de.phraseLength),oe.type===v.UDT&&te(B[oe.index],de.state,de.phraseLength)},this.toHtml=function(oe,de){let le="";le+=`<table class="${_.CLASS_STATS}">
272
- `,typeof de=="string"&&(le+=`<caption>${de}</caption>
273
- `),le+=`<tr><th class="${_.CLASS_ACTIVE}">ops</th>
274
- `,le+=`<th class="${_.CLASS_EMPTY}">EMPTY</th>
275
- `,le+=`<th class="${_.CLASS_MATCH}">MATCH</th>
276
- `,le+=`<th class="${_.CLASS_NOMATCH}">NOMATCH</th>
277
- `,le+=`<th class="${_.CLASS_ACTIVE}">totals</th></tr>
278
- `;const be=!0;for(;be;){if(oe===void 0){le+=ce();break}if(oe===null){le+=ce();break}if(oe==="ops"){le+=ce();break}if(oe==="index"){q.sort(V),B.length>0&&B.sort(V),le+=ce(),le+=ae();break}if(oe==="hits"){q.sort(D),B.length>0&&B.sort(V),le+=ce(),le+=ae();break}if(oe==="alpha"){q.sort(I),B.length>0&&B.sort(I),le+=ce(),le+=ae();break}break}return le+=`</table>
279
- `,le},this.toHtmlPage=function(oe,de,le){return w.htmlToPage(this.toHtml(oe,de),le)}},trace=function(){const v=utilities,w=style,_=new circularBuffer,A=identifiers,E="trace.js: ",k=this,P=16,N=10,q=8,B=32,O=80,I=5,D=[];let V=5e3,ee=-1,J=0,te=0;const se=[];let ce=null,ae=null,he=null;const oe=[],de=[],le=`<span class="${w.CLASS_LINEEND}">&bull;</span>`,be=`<span class="${w.CLASS_LINEEND}">&hellip;</span>`,pe=`<span class="${w.CLASS_EMPTY}">&#120634;</span>`,fe=function(){const ge=function(ke){oe[A.ALT]=ke,oe[A.CAT]=ke,oe[A.REP]=ke,oe[A.TLS]=ke,oe[A.TBS]=ke,oe[A.TRG]=ke,oe[A.AND]=ke,oe[A.NOT]=ke,oe[A.BKR]=ke,oe[A.BKA]=ke,oe[A.BKN]=ke,oe[A.ABG]=ke,oe[A.AEN]=ke};let _e=0;for(const ke in k.filter.operators)_e+=1;if(_e===0){ge(!1);return}for(const ke in k.filter.operators){const Ee=ke.toUpperCase();if(Ee==="<ALL>"){ge(!0);return}if(Ee==="<NONE>"){ge(!1);return}}ge(!1);for(const ke in k.filter.operators){const Ee=ke.toUpperCase();if(Ee==="ALT")oe[A.ALT]=k.filter.operators[ke]===!0;else if(Ee==="CAT")oe[A.CAT]=k.filter.operators[ke]===!0;else if(Ee==="REP")oe[A.REP]=k.filter.operators[ke]===!0;else if(Ee==="AND")oe[A.AND]=k.filter.operators[ke]===!0;else if(Ee==="NOT")oe[A.NOT]=k.filter.operators[ke]===!0;else if(Ee==="TLS")oe[A.TLS]=k.filter.operators[ke]===!0;else if(Ee==="TBS")oe[A.TBS]=k.filter.operators[ke]===!0;else if(Ee==="TRG")oe[A.TRG]=k.filter.operators[ke]===!0;else if(Ee==="BKR")oe[A.BKR]=k.filter.operators[ke]===!0;else if(Ee==="BKA")oe[A.BKA]=k.filter.operators[ke]===!0;else if(Ee==="BKN")oe[A.BKN]=k.filter.operators[ke]===!0;else if(Ee==="ABG")oe[A.ABG]=k.filter.operators[ke]===!0;else if(Ee==="AEN")oe[A.AEN]=k.filter.operators[ke]===!0;else throw new Error(`${E}initOpratorFilter: '${ke}' not a valid operator name. Must be <all>, <none>, alt, cat, rep, tls, tbs, trg, and, not, bkr, bka or bkn`)}},Z=function(){const ge=function(Se){oe[A.RNM]=Se,oe[A.UDT]=Se;const Oe=ae.length+he.length;de.length=0;for(let Ne=0;Ne<Oe;Ne+=1)de.push(Se)};let _e,ke;const Ee=[];for(ke=0;ke<ae.length;ke+=1)Ee.push(ae[ke].lower);for(ke=0;ke<he.length;ke+=1)Ee.push(he[ke].lower);de.length=0,_e=0;for(const Se in k.filter.rules)_e+=1;if(_e===0){ge(!0);return}for(const Se in k.filter.rules){const Oe=Se.toLowerCase();if(Oe==="<all>"){ge(!0);return}if(Oe==="<none>"){ge(!1);return}}ge(!1),oe[A.RNM]=!0,oe[A.UDT]=!0;for(const Se in k.filter.rules){const Oe=Se.toLowerCase();if(ke=Ee.indexOf(Oe),ke<0)throw new Error(`${E}initRuleFilter: '${Se}' not a valid rule or udt name`);de[ke]=k.filter.rules[Se]===!0}};this.traceObject="traceObject",this.filter={operators:[],rules:[]},this.setMaxRecords=function(ge,_e){if(ee=-1,typeof ge=="number"&&ge>0)V=Math.ceil(ge);else{V=0;return}typeof _e=="number"&&(ee=Math.floor(_e),ee<0&&(ee=-1))},this.getMaxRecords=function(){return V},this.getLastRecord=function(){return ee},this.init=function(ge,_e,ke){D.length=0,se.length=0,J=0,te=0,ce=ke,ae=ge,he=_e,fe(),Z(),_.init(V)};const U=function(ge){let _e=!1;return ge.type===A.RNM?oe[ge.type]&&de[ge.index]?_e=!0:_e=!1:ge.type===A.UDT?oe[ge.type]&&de[ae.length+ge.index]?_e=!0:_e=!1:_e=oe[ge.type],_e},S=function(ge){return ee===-1||ge<=ee};this.down=function(ge,_e,ke,Ee,Se,Oe){S(J)&&U(ge)&&(se.push(J),D[_.increment()]={dirUp:!1,depth:te,thisLine:J,thatLine:void 0,opcode:ge,state:_e,phraseIndex:ke,phraseLength:Ee,lookAnchor:Se,lookAround:Oe},J+=1,te+=1)},this.up=function(ge,_e,ke,Ee,Se,Oe){if(S(J)&&U(ge)){const Ne=J,ve=se.pop(),Ce=_.getListIndex(ve);Ce!==-1&&(D[Ce].thatLine=Ne),te-=1,D[_.increment()]={dirUp:!0,depth:te,thisLine:Ne,thatLine:ve,opcode:ge,state:_e,phraseIndex:ke,phraseLength:Ee,lookAnchor:Se,lookAround:Oe},J+=1}};const C=function(){function ge($e,Ie){let we,me,ye;if(Ie)switch($e.op={id:Ie.type,name:v.opcodeToString(Ie.type)},$e.opData=void 0,Ie.type){case A.RNM:$e.opData=ae[Ie.index].name;break;case A.UDT:$e.opData=he[Ie.index].name;break;case A.BKR:Ie.index<ae.length?we=ae[Ie.index].name:we=he[Ie.index-ae.length].name,me=Ie.bkrCase===A.BKR_MODE_CI?"%i":"%s",ye=Ie.bkrMode===A.BKR_MODE_UM?"%u":"%p",$e.opData=`\\\\${me}${ye}${we}`;break;case A.TLS:$e.opData=[];for(let Me=0;Me<Ie.string.length;Me+=1)$e.opData.push(Ie.string[Me]);break;case A.TBS:$e.opData=[];for(let Me=0;Me<Ie.string.length;Me+=1)$e.opData.push(Ie.string[Me]);break;case A.TRG:$e.opData=[Ie.min,Ie.max];break;case A.REP:$e.opData=[Ie.min,Ie.max];break;default:throw new Error("unrecognized opcode")}else $e.op={id:void 0,name:void 0},$e.opData=void 0}function _e($e,Ie,we){return $e===A.MATCH?{index:Ie,length:we}:$e===A.NOMATCH?{index:Ie,length:0}:$e===A.EMPTY?{index:Ie,length:0}:null}let ke=-1;function Ee($e,Ie,we){const me={id:ke++,branch:-1,parent:$e,up:!1,down:!1,depth:we,children:[]};return Ie?(me.down=!0,me.state={id:Ie.state,name:v.stateToString(Ie.state)},me.phrase=null,ge(me,Ie.opcode)):(me.state={id:void 0,name:void 0},me.phrase=_e(),ge(me,void 0)),me}function Se($e,Ie){Ie&&($e.up=!0,$e.state={id:Ie.state,name:v.stateToString(Ie.state)},$e.phrase=_e(Ie.state,Ie.phraseIndex,Ie.phraseLength),$e.down||ge($e,Ie.opcode))}let Oe=0,Ne=-1,ve=1;function Ce($e){if(Ne+=1,$e.branch=ve,Ne>te&&(te=Ne),$e.children.length===0)Oe+=1;else for(let Ie=0;Ie<$e.children.length;Ie+=1)Ie>0&&(ve+=1),$e.children[Ie].leftMost=!1,$e.children[Ie].rightMost=!1,$e.leftMost&&($e.children[Ie].leftMost=Ie===0),$e.rightMost&&($e.children[Ie].rightMost=Ie===$e.children.length-1),Ce($e.children[Ie]);Ne-=1}function Te($e,Ie){let we;const me={};if(me.id=$e.id,me.branch=$e.branch,me.leftMost=$e.leftMost,me.rightMost=$e.rightMost,we=$e.state.name?$e.state.name:"ACTIVE",me.state={id:$e.state.id,name:we},we=$e.op.name?$e.op.name:"?",me.op={id:$e.op.id,name:we},typeof $e.opData=="string")me.opData=$e.opData;else if(Array.isArray($e.opData)){me.opData=[];for(let ye=0;ye<$e.opData.length;ye+=1)me.opData[ye]=$e.opData[ye]}else me.opData=void 0;$e.phrase?me.phrase={index:$e.phrase.index,length:$e.phrase.length}:me.phrase=null,me.depth=$e.depth,me.children=[];for(let ye=0;ye<$e.children.length;ye+=1)$e.children.length-1,me.children[ye]=Te($e.children[ye]);return me}const Le=[];let Be,De,Ke,We,Qe=!0;const Xe=Ee(null,null,-1);for(Le.push(Xe),De=Xe,_.forEach($e=>{if(We=D[$e],Qe&&(Qe=!1,We.depth>0)){const Ie=We.dirUp?We.depth+1:We.depth;for(let we=0;we<Ie;we+=1)Ke=De,De=Ee(De,null,we),Le.push(De),Ke.children.push(De)}We.dirUp?(De=Le.pop(),Se(De,We),De=Le[Le.length-1]):(Ke=De,De=Ee(De,We,We.depth),Le.push(De),Ke.children.push(De))});Le.length>1;)De=Le.pop(),Se(De,null);if(Xe.children.length===0)throw new Error("trace.toTree(): parse tree has no nodes");if(Le.length===0)throw new Error("trace.toTree(): integrity check: dummy root node disappeared?");Be=Xe.children[0];let at=Be;for(;Be&&!Be.down&&!Be.up;)at=Be,Be=Be.children[0];Be=at,Be.leftMost=!0,Be.rightMost=!0,Ce(Be),Be.branch=0;const Fe={};Fe.string=[];for(let $e=0;$e<ce.length;$e+=1)Fe.string[$e]=ce[$e];Fe.rules=[];for(let $e=0;$e<ae.length;$e+=1)Fe.rules[$e]=ae[$e].name;Fe.udts=[];for(let $e=0;$e<he.length;$e+=1)Fe.udts[$e]=he[$e].name;Fe.id={},Fe.id.ALT={id:A.ALT,name:"ALT"},Fe.id.CAT={id:A.CAT,name:"CAT"},Fe.id.REP={id:A.REP,name:"REP"},Fe.id.RNM={id:A.RNM,name:"RNM"},Fe.id.TLS={id:A.TLS,name:"TLS"},Fe.id.TBS={id:A.TBS,name:"TBS"},Fe.id.TRG={id:A.TRG,name:"TRG"},Fe.id.UDT={id:A.UDT,name:"UDT"},Fe.id.AND={id:A.AND,name:"AND"},Fe.id.NOT={id:A.NOT,name:"NOT"},Fe.id.BKR={id:A.BKR,name:"BKR"},Fe.id.BKA={id:A.BKA,name:"BKA"},Fe.id.BKN={id:A.BKN,name:"BKN"},Fe.id.ABG={id:A.ABG,name:"ABG"},Fe.id.AEN={id:A.AEN,name:"AEN"},Fe.id.ACTIVE={id:A.ACTIVE,name:"ACTIVE"},Fe.id.MATCH={id:A.MATCH,name:"MATCH"},Fe.id.EMPTY={id:A.EMPTY,name:"EMPTY"},Fe.id.NOMATCH={id:A.NOMATCH,name:"NOMATCH"},Fe.treeDepth=te,Fe.leafNodes=Oe;let qe;return Be.down?Be.up?qe="none":qe="right":Be.up?qe="left":qe="both",Fe.branchesIncomplete=qe,Fe.tree=Te(Be,Be.depth),Fe};this.toTree=function(ge){const _e=C();return ge?JSON.stringify(_e):_e},this.toHtmlPage=function(ge,_e,ke){return v.htmlToPage(this.toHtml(ge,_e),ke)};const F=function(ge,_e){let ke;switch(ge){case P:ke="hexadecimal";break;case N:ke="decimal";break;case q:ke="ASCII";break;case B:ke="UNICODE";break;default:throw new Error(`${E}htmlHeader: unrecognized mode: ${ge}`)}let Ee="";return Ee+=`<p>display mode: ${ke}</p>
280
- `,Ee+=`<table class="${w.CLASS_TRACE}">
281
- `,typeof _e=="string"&&(Ee+=`<caption>${_e}</caption>`),Ee},X=function(){let ge="";return ge+=`</table>
282
- `,ge+=`<p class="${w.CLASS_MONOSPACE}">legend:<br>
283
- `,ge+=`(a)&nbsp;-&nbsp;line number<br>
284
- `,ge+=`(b)&nbsp;-&nbsp;matching line number<br>
285
- `,ge+=`(c)&nbsp;-&nbsp;phrase offset<br>
286
- `,ge+=`(d)&nbsp;-&nbsp;phrase length<br>
287
- `,ge+=`(e)&nbsp;-&nbsp;tree depth<br>
288
- `,ge+=`(f)&nbsp;-&nbsp;operator state<br>
289
- `,ge+=`&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;<span class="${w.CLASS_ACTIVE}">&darr;</span>&nbsp;&nbsp;phrase opened<br>
290
- `,ge+=`&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;<span class="${w.CLASS_MATCH}">&uarr;M</span> phrase matched<br>
291
- `,ge+=`&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;<span class="${w.CLASS_EMPTY}">&uarr;E</span> empty phrase matched<br>
292
- `,ge+=`&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;<span class="${w.CLASS_NOMATCH}">&uarr;N</span> phrase not matched<br>
293
- `,ge+=`operator&nbsp;-&nbsp;ALT, CAT, REP, RNM, TRG, TLS, TBS<sup>&dagger;</sup>, UDT, AND, NOT, BKA, BKN, BKR, ABG, AEN<sup>&Dagger;</sup><br>
294
- `,ge+=`phrase&nbsp;&nbsp;&nbsp;-&nbsp;up to ${O} characters of the phrase being matched<br>
295
- `,ge+=`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;<span class="${w.CLASS_MATCH}">matched characters</span><br>
296
- `,ge+=`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;<span class="${w.CLASS_LOOKAHEAD}">matched characters in look ahead mode</span><br>
297
- `,ge+=`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;<span class="${w.CLASS_LOOKBEHIND}">matched characters in look behind mode</span><br>
298
- `,ge+=`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;<span class="${w.CLASS_REMAINDER}">remainder characters(not yet examined by parser)</span><br>
299
- `,ge+=`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;<span class="${w.CLASS_CTRLCHAR}">control characters, TAB, LF, CR, etc. (ASCII mode only)</span><br>
300
- `,ge+=`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;${pe} empty string<br>
301
- `,ge+=`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;${le} end of input string<br>
302
- `,ge+=`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;${be} input string display truncated<br>
303
- `,ge+=`</p>
304
- `,ge+=`<p class="${w.CLASS_MONOSPACE}">
305
- `,ge+=`<sup>&dagger;</sup>original ABNF operators:<br>
306
- `,ge+=`ALT - alternation<br>
307
- `,ge+=`CAT - concatenation<br>
308
- `,ge+=`REP - repetition<br>
309
- `,ge+=`RNM - rule name<br>
310
- `,ge+=`TRG - terminal range<br>
311
- `,ge+=`TLS - terminal literal string (case insensitive)<br>
312
- `,ge+=`TBS - terminal binary string (case sensitive)<br>
313
- `,ge+=`<br>
314
- `,ge+=`<sup>&Dagger;</sup>super set SABNF operators:<br>
315
- `,ge+=`UDT - user-defined terminal<br>
316
- `,ge+=`AND - positive look ahead<br>
317
- `,ge+=`NOT - negative look ahead<br>
318
- `,ge+=`BKA - positive look behind<br>
319
- `,ge+=`BKN - negative look behind<br>
320
- `,ge+=`BKR - back reference<br>
321
- `,ge+=`ABG - anchor - begin of input string<br>
322
- `,ge+=`AEN - anchor - end of input string<br>
323
- `,ge+=`</p>
324
- `,ge};this.indent=function(ge){let _e="";for(let ke=0;ke<ge;ke+=1)_e+=".";return _e};const re=function(ge,_e){let ke="";if(_e.type===A.TRG)if(ge===P||ge===B){let Ee=_e.min.toString(16).toUpperCase();Ee.length%2!==0&&(Ee=`0${Ee}`),ke+=ge===P?"%x":"U+",ke+=Ee,Ee=_e.max.toString(16).toUpperCase(),Ee.length%2!==0&&(Ee=`0${Ee}`),ke+=`&ndash;${Ee}`}else ke=`%d${_e.min.toString(10)}&ndash;${_e.max.toString(10)}`;return ke},ie=function(ge,_e){let ke="";if(_e.type===A.REP)if(ge===P){let Ee=_e.min.toString(16).toUpperCase();Ee.length%2!==0&&(Ee=`0${Ee}`),ke=`x${Ee}`,_e.max<1/0?(Ee=_e.max.toString(16).toUpperCase(),Ee.length%2!==0&&(Ee=`0${Ee}`)):Ee="inf",ke+=`&ndash;${Ee}`}else _e.max<1/0?ke=`${_e.min.toString(10)}&ndash;${_e.max.toString(10)}`:ke=`${_e.min.toString(10)}&ndash;inf`;return ke},Q=function(ge,_e){let ke="";if(_e.type===A.TBS){const Ee=Math.min(_e.string.length,I*2);if(ge===P||ge===B){ke+=ge===P?"%x":"U+";for(let Se=0;Se<Ee;Se+=1){let Oe;Se>0&&(ke+="."),Oe=_e.string[Se].toString(16).toUpperCase(),Oe.length%2!==0&&(Oe=`0${Oe}`),ke+=Oe}}else{ke="%d";for(let Se=0;Se<Ee;Se+=1)Se>0&&(ke+="."),ke+=_e.string[Se].toString(10)}Ee<_e.string.length&&(ke+=be)}return ke},ne=function(ge,_e){let ke="";if(_e.type===A.TLS){const Ee=Math.min(_e.string.length,I);if(ge===P||ge===N){let Se,Oe,Ne;ge===P?(ke="%x",Ne=16):(ke="%d",Ne=10);for(let ve=0;ve<Ee;ve+=1)ve>0&&(ke+="."),Oe=_e.string[ve],Oe>=97&&Oe<=122?(Se=Oe-32,ke+=`${Se.toString(Ne)}/${Oe.toString(Ne)}`.toUpperCase()):Oe>=65&&Oe<=90?(Se=Oe,Oe+=32,ke+=`${Se.toString(Ne)}/${Oe.toString(Ne)}`.toUpperCase()):ke+=Oe.toString(Ne).toUpperCase();Ee<_e.string.length&&(ke+=be)}else{ke='"';for(let Se=0;Se<Ee;Se+=1)ke+=v.asciiChars[_e.string[Se]];Ee<_e.string.length&&(ke+=be),ke+='"'}}return ke},L=function(ge,_e,ke,Ee,Se){if(Ee===0)return"";let Oe="";const Ne=Se?",":"";switch(ge){case P:Oe=Ne+v.charsToHex(_e,ke,Ee);break;case N:if(Se)return`,${v.charsToDec(_e,ke,Ee)}`;Oe=Ne+v.charsToDec(_e,ke,Ee);break;case B:Oe=v.charsToUnicode(_e,ke,Ee);break;case q:default:Oe=v.charsToAsciiHtml(_e,ke,Ee);break}return Oe},ue=function(ge,_e,ke,Ee,Se,Oe){let Ne="",ve,Ce,Te,Le,Be=le;const De=`<span class="${w.CLASS_LOOKBEHIND}">`,Ke=`<span class="${w.CLASS_REMAINDER}">`,We="</span>";let Qe=!1;switch(ke){case A.EMPTY:Ne+=pe;case A.NOMATCH:case A.MATCH:case A.ACTIVE:ve=Ee-Se,Ce=Oe-ve,Te=Oe,Le=_e.length-Te;break;default:throw new Error("unrecognized state")}return Be=le,Ce>O?(Ce=O,Be=be,Le=0):Ce+Le>O&&(Be=be,Le=O-Ce),Ce>0&&(Ne+=De,Ne+=L(ge,_e,ve,Ce,Qe),Ne+=We,Qe=!0),Le>0&&(Ne+=Ke,Ne+=L(ge,_e,Te,Le,Qe),Ne+=We),Ne+Be},Ae=function(ge,_e,ke,Ee,Se,Oe){let Ne="",ve,Ce,Te,Le,Be=le;const De=`<span class="${w.CLASS_REMAINDER}">`,Ke="</span>";let We=!1;switch(ke){case A.EMPTY:Ne+=pe;case A.NOMATCH:case A.ACTIVE:ve=Ee,Ce=0,Te=Ee,Le=_e.length-Te;break;case A.MATCH:ve=Ee,Ce=Se,Te=Ee+Ce,Le=_e.length-Te;break;default:throw new Error("unrecognized state")}return Be=le,Ce>O?(Ce=O,Be=be,Le=0):Ce+Le>O&&(Be=be,Le=O-Ce),Ce>0&&(Ne+=Oe,Ne+=L(ge,_e,ve,Ce,We),Ne+=Ke,We=!0),Le>0&&(Ne+=De,Ne+=L(ge,_e,Te,Le,We),Ne+=Ke),Ne+Be},Re=function(ge,_e,ke,Ee,Se){const Oe=`<span class="${w.CLASS_LOOKAHEAD}">`;return Ae(ge,_e,ke,Ee,Se,Oe)},Pe=function(ge,_e,ke,Ee,Se){const Oe=`<span class="${w.CLASS_MATCH}">`;return Ae(ge,_e,ke,Ee,Se,Oe)},xe=function(ge){if(ae===null)return"";let _e="",ke,Ee,Se,Oe,Ne,ve;return _e+="<tr><th>(a)</th><th>(b)</th><th>(c)</th><th>(d)</th><th>(e)</th><th>(f)</th>",_e+=`<th>operator</th><th>phrase</th></tr>
325
- `,_.forEach(Ce=>{const Te=D[Ce];switch(ke=Te.thisLine,Ee=Te.thatLine!==void 0?Te.thatLine:"--",Se=!1,Oe=!1,Ne=!1,Te.lookAround===A.LOOKAROUND_AHEAD&&(Se=!0,Ne=!0,ve=Te.lookAnchor),(Te.opcode.type===A.AND||Te.opcode.type===A.NOT)&&(Se=!0,Ne=!0,ve=Te.phraseIndex),Te.lookAround===A.LOOKAROUND_BEHIND&&(Oe=!0,Ne=!0,ve=Te.lookAnchor),(Te.opcode.type===A.BKA||Te.opcode.type===A.BKN)&&(Oe=!0,Ne=!0,ve=Te.phraseIndex),_e+="<tr>",_e+=`<td>${ke}</td><td>${Ee}</td>`,_e+=`<td>${Te.phraseIndex}</td>`,_e+=`<td>${Te.phraseLength}</td>`,_e+=`<td>${Te.depth}</td>`,_e+="<td>",Te.state){case A.ACTIVE:_e+=`<span class="${w.CLASS_ACTIVE}">&darr;&nbsp;</span>`;break;case A.MATCH:_e+=`<span class="${w.CLASS_MATCH}">&uarr;M</span>`;break;case A.NOMATCH:_e+=`<span class="${w.CLASS_NOMATCH}">&uarr;N</span>`;break;case A.EMPTY:_e+=`<span class="${w.CLASS_EMPTY}">&uarr;E</span>`;break;default:_e+=`<span class="${w.CLASS_ACTIVE}">--</span>`;break}if(_e+="</td>",_e+="<td>",_e+=k.indent(Te.depth),Se?_e+=`<span class="${w.CLASS_LOOKAHEAD}">`:Oe&&(_e+=`<span class="${w.CLASS_LOOKBEHIND}">`),_e+=v.opcodeToString(Te.opcode.type),Te.opcode.type===A.RNM&&(_e+=`(${ae[Te.opcode.index].name}) `),Te.opcode.type===A.BKR){const Le=Te.opcode.bkrCase===A.BKR_MODE_CI?"%i":"%s",Be=Te.opcode.bkrMode===A.BKR_MODE_UM?"%u":"%p";_e+=`(\\${Le}${Be}${ae[Te.opcode.index].name}) `}Te.opcode.type===A.UDT&&(_e+=`(${he[Te.opcode.index].name}) `),Te.opcode.type===A.TRG&&(_e+=`(${re(ge,Te.opcode)}) `),Te.opcode.type===A.TBS&&(_e+=`(${Q(ge,Te.opcode)}) `),Te.opcode.type===A.TLS&&(_e+=`(${ne(ge,Te.opcode)}) `),Te.opcode.type===A.REP&&(_e+=`(${ie(ge,Te.opcode)}) `),Ne&&(_e+="</span>"),_e+="</td>",_e+="<td>",Oe?_e+=ue(ge,ce,Te.state,Te.phraseIndex,Te.phraseLength,ve):Se?_e+=Re(ge,ce,Te.state,Te.phraseIndex,Te.phraseLength):_e+=Pe(ge,ce,Te.state,Te.phraseIndex,Te.phraseLength),_e+=`</td></tr>
326
- `}),_e+="<tr><th>(a)</th><th>(b)</th><th>(c)</th><th>(d)</th><th>(e)</th><th>(f)</th>",_e+=`<th>operator</th><th>phrase</th></tr>
327
- `,_e+=`</table>
328
- `,_e};this.toHtml=function(ge,_e){let ke=q;if(typeof ge=="string"&&ge.length>=3){const Se=ge.toLowerCase().slice(0,3);Se==="hex"?ke=P:Se==="dec"?ke=N:Se==="uni"&&(ke=B)}let Ee="";return Ee+=F(ke,_e),Ee+=xe(ke),Ee+=X(),Ee}},nodeExports={ast,circular:circularBuffer,ids:identifiers,parser:parser$1,stats,trace,utils:utilities,emitcss,style},scannerGrammar,hasRequiredScannerGrammar;function requireScannerGrammar(){return hasRequiredScannerGrammar||(hasRequiredScannerGrammar=1,scannerGrammar=function(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"file",lower:"file",index:0,isBkr:!1},this.rules[1]={name:"line",lower:"line",index:1,isBkr:!1},this.rules[2]={name:"line-text",lower:"line-text",index:2,isBkr:!1},this.rules[3]={name:"last-line",lower:"last-line",index:3,isBkr:!1},this.rules[4]={name:"valid",lower:"valid",index:4,isBkr:!1},this.rules[5]={name:"invalid",lower:"invalid",index:5,isBkr:!1},this.rules[6]={name:"end",lower:"end",index:6,isBkr:!1},this.rules[7]={name:"CRLF",lower:"crlf",index:7,isBkr:!1},this.rules[8]={name:"LF",lower:"lf",index:8,isBkr:!1},this.rules[9]={name:"CR",lower:"cr",index:9,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:2,children:[1,3]},this.rules[0].opcodes[1]={type:3,min:0,max:1/0},this.rules[0].opcodes[2]={type:4,index:1},this.rules[0].opcodes[3]={type:3,min:0,max:1},this.rules[0].opcodes[4]={type:4,index:3},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:2,children:[1,2]},this.rules[1].opcodes[1]={type:4,index:2},this.rules[1].opcodes[2]={type:4,index:6},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:3,min:0,max:1/0},this.rules[2].opcodes[1]={type:1,children:[2,3]},this.rules[2].opcodes[2]={type:4,index:4},this.rules[2].opcodes[3]={type:4,index:5},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:3,min:1,max:1/0},this.rules[3].opcodes[1]={type:1,children:[2,3]},this.rules[3].opcodes[2]={type:4,index:4},this.rules[3].opcodes[3]={type:4,index:5},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:1,children:[1,2]},this.rules[4].opcodes[1]={type:5,min:32,max:126},this.rules[4].opcodes[2]={type:6,string:[9]},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[5].opcodes[1]={type:5,min:0,max:8},this.rules[5].opcodes[2]={type:5,min:11,max:12},this.rules[5].opcodes[3]={type:5,min:14,max:31},this.rules[5].opcodes[4]={type:5,min:127,max:4294967295},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:1,children:[1,2,3]},this.rules[6].opcodes[1]={type:4,index:7},this.rules[6].opcodes[2]={type:4,index:8},this.rules[6].opcodes[3]={type:4,index:9},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:6,string:[13,10]},this.rules[8].opcodes=[],this.rules[8].opcodes[0]={type:6,string:[10]},this.rules[9].opcodes=[],this.rules[9].opcodes[0]={type:6,string:[13]},this.toString=function(){let w="";return w+=`file = *line [last-line]
329
- `,w+=`line = line-text end
330
- `,w+=`line-text = *(valid/invalid)
331
- `,w+=`last-line = 1*(valid/invalid)
332
- `,w+=`valid = %d32-126 / %d9
333
- `,w+=`invalid = %d0-8 / %d11-12 /%d14-31 / %x7f-ffffffff
334
- `,w+=`end = CRLF / LF / CR
335
- `,w+=`CRLF = %d13.10
336
- `,w+=`LF = %d10
337
- `,w+=`CR = %d13
338
- `,w}}),scannerGrammar}var scannerCallbacks={},hasRequiredScannerCallbacks;function requireScannerCallbacks(){if(hasRequiredScannerCallbacks)return scannerCallbacks;hasRequiredScannerCallbacks=1;const b=identifiers,v=utilities;function w(O,I,D,V,ee){return O===b.SEM_PRE?(ee.endLength=0,ee.textLength=0,ee.invalidCount=0):ee.lines.push({lineNo:ee.lines.length,beginChar:D,length:V,textLength:ee.textLength,endType:ee.endType,invalidChars:ee.invalidCount}),b.SEM_OK}function _(O,I,D,V,ee){return O===b.SEM_PRE&&(ee.textLength=V),b.SEM_OK}function A(O,I,D,V,ee){return O===b.SEM_PRE?(ee.endLength=0,ee.textLength=0,ee.invalidCount=0):ee.strict?(ee.lines.push({lineNo:ee.lines.length,beginChar:D,length:V,textLength:V,endType:"none",invalidChars:ee.invalidCount}),ee.errors.push({line:ee.lineNo,char:D+V,msg:"no line end on last line - strict ABNF specifies CRLF(\\r\\n, \\x0D\\x0A)"})):(I.push(10),ee.lines.push({lineNo:ee.lines.length,beginChar:D,length:V+1,textLength:V,endType:"LF",invalidChars:ee.invalidCount})),b.SEM_OK}function E(O,I,D,V,ee){return O===b.SEM_PRE&&ee.errors.push({line:ee.lineNo,char:D,msg:`invalid character found '\\x${v.charToHex(I[D])}'`}),b.SEM_OK}function k(O,I,D,V,ee){return O===b.SEM_POST&&(ee.lineNo+=1),b.SEM_OK}function P(O,I,D,V,ee){return O===b.SEM_PRE&&(ee.endType="LF",ee.strict&&ee.errors.push({line:ee.lineNo,char:D,msg:"line end character LF(\\n, \\x0A) - strict ABNF specifies CRLF(\\r\\n, \\x0D\\x0A)"})),b.SEM_OK}function N(O,I,D,V,ee){return O===b.SEM_PRE&&(ee.endType="CR",ee.strict&&ee.errors.push({line:ee.lineNo,char:D,msg:"line end character CR(\\r, \\x0D) - strict ABNF specifies CRLF(\\r\\n, \\x0D\\x0A)"})),b.SEM_OK}function q(O,I,D,V,ee){return O===b.SEM_PRE&&(ee.endType="CRLF"),b.SEM_OK}const B=[];return B.line=w,B["line-text"]=_,B["last-line"]=A,B.invalid=E,B.end=k,B.lf=P,B.cr=N,B.crlf=q,scannerCallbacks.callbacks=B,scannerCallbacks}var scanner,hasRequiredScanner;function requireScanner(){return hasRequiredScanner||(hasRequiredScanner=1,scanner=function(v,w,_,A){const E="scanner.js: ",k=nodeExports,P=new(requireScannerGrammar()),{callbacks:N}=requireScannerCallbacks(),q=[],B=new k.parser;if(B.ast=new k.ast,B.ast.callbacks=N,A){if(A.traceObject!=="traceObject")throw new TypeError(`${E}trace argument is not a trace object`);B.trace=A}if(B.parse(P,"file",v).success!==!0){w.push({line:0,char:0,msg:"syntax analysis error analyzing input SABNF grammar"});return}const I={lines:q,lineNo:0,errors:w,strict:!!_};return B.ast.translate(I),q}),scanner}var syntaxCallbacks,hasRequiredSyntaxCallbacks;function requireSyntaxCallbacks(){return hasRequiredSyntaxCallbacks||(hasRequiredSyntaxCallbacks=1,syntaxCallbacks=function(){const v="syntax-callbacks.js: ",w=nodeExports,_=w.ids;let A;const E=function(ne,L,ue,Ae){switch(ne.state){case _.ACTIVE:Ae.altStack=[],Ae.repCount=0;break;case _.EMPTY:Ae.errors.push({line:0,char:0,msg:"grammar file is empty"});break;case _.MATCH:Ae.ruleCount===0&&Ae.errors.push({line:0,char:0,msg:"no rules defined"});break;case _.NOMATCH:throw new Error(`${v}synFile: grammar file NOMATCH: design error: should never happen.`);default:throw new Error(`${v}synFile: unrecognized case.`)}},k=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:ue.altStack.length=0,A={groupOpen:null,groupError:!1,optionOpen:null,optionError:!1,tlsOpen:null,clsOpen:null,prosValOpen:null,basicError:!1},ue.altStack.push(A);break;case _.EMPTY:throw new Error(`${v}synRule: EMPTY: rule cannot be empty`);case _.NOMATCH:break;case _.MATCH:ue.ruleCount+=1;break;default:throw new Error(`${v}synFile: unrecognized case.`)}},P=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:ue.errors.push({line:ue.findLine(ue.lines,L,ue.charsLength),char:L,msg:"Unrecognized SABNF line. Invalid rule, comment or blank line."});break;default:throw new Error(`${v}synFile: unrecognized case.`)}},N=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:ue.errors.push({line:ue.findLine(ue.lines,L,ue.charsLength),char:L,msg:"Rule names must be alphanum and begin with alphabetic character."});break;default:throw new Error(`${v}synFile: unrecognized case.`)}},q=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:ue.errors.push({line:ue.findLine(ue.lines,L,ue.charsLength),char:L,msg:"Expected '=' or '=/'. Not found."});break;default:throw new Error(`${v}synFile: unrecognized case.`)}},B=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:ue.strict&&ue.errors.push({line:ue.findLine(ue.lines,L,ue.charsLength),char:L,msg:"AND operator(&) found - strict ABNF specified."});break;default:throw new Error(`${v}synFile: unrecognized case.`)}},O=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:ue.strict&&ue.errors.push({line:ue.findLine(ue.lines,L,ue.charsLength),char:L,msg:"NOT operator(!) found - strict ABNF specified."});break;default:throw new Error(`${v}synFile: unrecognized case.`)}},I=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:ue.strict?ue.errors.push({line:ue.findLine(ue.lines,L,ue.charsLength),char:L,msg:"Positive look-behind operator(&&) found - strict ABNF specified."}):ue.lite&&ue.errors.push({line:ue.findLine(ue.lines,L,ue.charsLength),char:L,msg:"Positive look-behind operator(&&) found - apg-lite specified."});break;default:throw new Error(`${v}synFile: unrecognized case.`)}},D=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:ue.strict?ue.errors.push({line:ue.findLine(ue.lines,L,ue.charsLength),char:L,msg:"Negative look-behind operator(!!) found - strict ABNF specified."}):ue.lite&&ue.errors.push({line:ue.findLine(ue.lines,L,ue.charsLength),char:L,msg:"Negative look-behind operator(!!) found - apg-lite specified."});break;default:throw new Error(`${v}synFile: unrecognized case.`)}},V=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:ue.strict?ue.errors.push({line:ue.findLine(ue.lines,L,ue.charsLength),char:L,msg:"Beginning of string anchor(%^) found - strict ABNF specified."}):ue.lite&&ue.errors.push({line:ue.findLine(ue.lines,L,ue.charsLength),char:L,msg:"Beginning of string anchor(%^) found - apg-lite specified."});break;default:throw new Error(`${v}synFile: unrecognized case.`)}},ee=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:ue.strict?ue.errors.push({line:ue.findLine(ue.lines,L,ue.charsLength),char:L,msg:"End of string anchor(%$) found - strict ABNF specified."}):ue.lite&&ue.errors.push({line:ue.findLine(ue.lines,L,ue.charsLength),char:L,msg:"End of string anchor(%$) found - apg-lite specified."});break;default:throw new Error(`${v}synFile: unrecognized case.`)}},J=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:if(ue.strict){const Ae=w.utils.charsToString(ne,L,Q.phraseLength);ue.errors.push({line:ue.findLine(ue.lines,L,ue.charsLength),char:L,msg:`Back reference operator(${Ae}) found - strict ABNF specified.`})}else if(ue.lite){const Ae=w.utils.charsToString(ne,L,Q.phraseLength);ue.errors.push({line:ue.findLine(ue.lines,L,ue.charsLength),char:L,msg:`Back reference operator(${Ae}) found - apg-lite specified.`})}break;default:throw new Error(`${v}synFile: unrecognized case.`)}},te=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:if(ue.strict){const Ae=w.utils.charsToString(ne,L,Q.phraseLength);ue.errors.push({line:ue.findLine(ue.lines,L,ue.charsLength),char:L,msg:`UDT operator found(${Ae}) - strict ABNF specified.`})}break;default:throw new Error(`${v}synFile: unrecognized case.`)}},se=function(Q,ne,L){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:A.tlsOpen=L;break;default:throw new Error(`${v}synFile: unrecognized case.`)}},ce=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:ue.stringTabChar=!1;break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:ue.stringTabChar!==!1&&ue.errors.push({line:ue.findLine(ue.lines,ue.stringTabChar),char:ue.stringTabChar,msg:"Tab character (\\t, x09) not allowed in literal string (see 'quoted-string' definition, RFC 7405.)"});break;default:throw new Error(`${v}synFile: unrecognized case.`)}},ae=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:ue.stringTabChar=L;break;default:throw new Error(`${v}synFile: unrecognized case.`)}},he=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:ue.errors.push({line:ue.findLine(ue.lines,A.tlsOpen),char:A.tlsOpen,msg:'Case-insensitive literal string("...") opened but not closed.'}),A.basicError=!0,A.tlsOpen=null;break;case _.MATCH:A.tlsOpen=null;break;default:throw new Error(`${v}synFile: unrecognized case.`)}},oe=function(Q,ne,L){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:A.clsOpen=L;break;default:throw new Error(`${v}synFile: unrecognized case.`)}},de=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:ue.stringTabChar=!1;break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:ue.stringTabChar!==!1&&ue.errors.push({line:ue.findLine(ue.lines,ue.stringTabChar),char:ue.stringTabChar,msg:"Tab character (\\t, x09) not allowed in literal string."});break;default:throw new Error(`${v}synFile: unrecognized case.`)}},le=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:ue.errors.push({line:ue.findLine(ue.lines,A.clsOpen),char:A.clsOpen,msg:"Case-sensitive literal string('...') opened but not closed."}),A.clsOpen=null,A.basicError=!0;break;case _.MATCH:ue.strict&&ue.errors.push({line:ue.findLine(ue.lines,A.clsOpen),char:A.clsOpen,msg:"Case-sensitive string operator('...') found - strict ABNF specified."}),A.clsOpen=null;break;default:throw new Error(`${v}synFile: unrecognized case.`)}},be=function(Q,ne,L){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:A.prosValOpen=L;break;default:throw new Error(`${v}synFile: unrecognized case.`)}},pe=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:ue.stringTabChar=!1;break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:ue.stringTabChar!==!1&&ue.errors.push({line:ue.findLine(ue.lines,ue.stringTabChar),char:ue.stringTabChar,msg:"Tab character (\\t, x09) not allowed in prose value string."});break;default:throw new Error(`${v}synFile: unrecognized case.`)}},fe=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:ue.errors.push({line:ue.findLine(ue.lines,A.prosValOpen),char:A.prosValOpen,msg:"Prose value operator(<...>) opened but not closed."}),A.basicError=!0,A.prosValOpen=null;break;case _.MATCH:ue.errors.push({line:ue.findLine(ue.lines,A.prosValOpen),char:A.prosValOpen,msg:"Prose value operator(<...>) found. The ABNF syntax is valid, but a parser cannot be generated from this grammar."}),A.prosValOpen=null;break;default:throw new Error(`${v}synFile: unrecognized case.`)}},Z=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:A={groupOpen:L,groupError:!1,optionOpen:null,optionError:!1,tlsOpen:null,clsOpen:null,prosValOpen:null,basicError:!1},ue.altStack.push(A);break;default:throw new Error(`${v}synFile: unrecognized case.`)}},U=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:ue.errors.push({line:ue.findLine(ue.lines,A.groupOpen),char:A.groupOpen,msg:'Group "(...)" opened but not closed.'}),A=ue.altStack.pop(),A.groupError=!0;break;case _.MATCH:A=ue.altStack.pop();break;default:throw new Error(`${v}synFile: unrecognized case.`)}},S=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:A={groupOpen:null,groupError:!1,optionOpen:L,optionError:!1,tlsOpen:null,clsOpen:null,prosValOpen:null,basicError:!1},ue.altStack.push(A);break;default:throw new Error(`${v}synFile: unrecognized case.`)}},C=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:ue.errors.push({line:ue.findLine(ue.lines,A.optionOpen),char:A.optionOpen,msg:'Option "[...]" opened but not closed.'}),A=ue.altStack.pop(),A.optionError=!0;break;case _.MATCH:A=ue.altStack.pop();break;default:throw new Error(`${v}synFile: unrecognized case.`)}},F=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:A.basicError===!1&&ue.errors.push({line:ue.findLine(ue.lines,L,ue.charsLength),char:L,msg:"Unrecognized SABNF element."});break;default:throw new Error(`${v}synFile: unrecognized case.`)}},X=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:if(Q.phraseLength===1&&ue.strict){const Ae=ne[L]===13?"CR":"LF";ue.errors.push({line:ue.findLine(ue.lines,L,ue.charsLength),char:L,msg:`Line end '${Ae}' found - strict ABNF specified, only CRLF allowed.`})}break;default:throw new Error(`${v}synFile: unrecognized case.`)}},re=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:break;case _.MATCH:ue.errors.push({line:ue.findLine(ue.lines,L,ue.charsLength),char:L,msg:"Unrecognized grammar element or characters."});break;default:throw new Error(`${v}synFile: unrecognized case.`)}},ie=function(Q,ne,L,ue){switch(Q.state){case _.ACTIVE:break;case _.EMPTY:break;case _.NOMATCH:ue.repCount+=1;break;case _.MATCH:ue.repCount+=1;break;default:throw new Error(`${v}synFile: unrecognized case.`)}};this.callbacks=[],this.callbacks.andop=B,this.callbacks.basicelementerr=F,this.callbacks.clsclose=le,this.callbacks.clsopen=oe,this.callbacks.clsstring=de,this.callbacks.definedaserror=q,this.callbacks.file=E,this.callbacks.groupclose=U,this.callbacks.groupopen=Z,this.callbacks.lineenderror=re,this.callbacks.lineend=X,this.callbacks.notop=O,this.callbacks.optionclose=C,this.callbacks.optionopen=S,this.callbacks.prosvalclose=fe,this.callbacks.prosvalopen=be,this.callbacks.prosvalstring=pe,this.callbacks.repetition=ie,this.callbacks.rule=k,this.callbacks.ruleerror=P,this.callbacks.rulenameerror=N,this.callbacks.stringtab=ae,this.callbacks.tlsclose=he,this.callbacks.tlsopen=se,this.callbacks.tlsstring=ce,this.callbacks.udtop=te,this.callbacks.bkaop=I,this.callbacks.bknop=D,this.callbacks.bkrop=J,this.callbacks.abgop=V,this.callbacks.aenop=ee}),syntaxCallbacks}var semanticCallbacks,hasRequiredSemanticCallbacks;function requireSemanticCallbacks(){return hasRequiredSemanticCallbacks||(hasRequiredSemanticCallbacks=1,semanticCallbacks=function(){const v=nodeExports,w=v.ids,_=function(){this.names=[],this.add=function(Te){let Le=-1;return this.get(Te)===-1&&(Le={name:Te,lower:Te.toLowerCase(),index:this.names.length},this.names.push(Le)),Le},this.get=function(Te){let Le=-1;const Be=Te.toLowerCase();for(let De=0;De<this.names.length;De+=1)if(this.names[De].lower===Be){Le=this.names[De];break}return Le}},A=function(Ce,Te,Le){let Be=0;for(let De=Te;De<Te+Le;De+=1)Be=10*Be+Ce[De]-48;return Be},E=function(Ce,Te,Le){let Be=0;for(let De=Te;De<Te+Le;De+=1)Be=2*Be+Ce[De]-48;return Be},k=function(Ce,Te,Le){let Be=0;for(let De=Te;De<Te+Le;De+=1){let Ke=Ce[De];if(Ke>=48&&Ke<=57)Ke-=48;else if(Ke>=65&&Ke<=70)Ke-=55;else if(Ke>=97&&Ke<=102)Ke-=87;else throw new Error("hexnum out of range");Be=16*Be+Ke}return Be};function P(ve,Ce,Te,Le,Be){const De=w.SEM_OK;if(ve===w.SEM_PRE)Be.ruleNames=new _,Be.udtNames=new _,Be.rules=[],Be.udts=[],Be.rulesLineMap=[],Be.opcodes=[],Be.altStack=[],Be.topStack=null,Be.topRule=null;else if(ve===w.SEM_POST){let Ke;Be.rules.forEach(We=>{We.isBkr=!1,We.opcodes.forEach(Qe=>{Qe.type===w.RNM&&(Ke=Be.ruleNames.get(Qe.index.name),Ke===-1?(Be.errors.push({line:Be.findLine(Be.lines,Qe.index.phraseIndex,Be.charsLength),char:Qe.index.phraseIndex,msg:`Rule name '${Qe.index.name}' used but not defined.`}),Qe.index=-1):Qe.index=Ke.index)})}),Be.udts.forEach(We=>{We.isBkr=!1}),Be.rules.forEach(We=>{We.opcodes.forEach(Qe=>{Qe.type===w.BKR&&(We.hasBkr=!0,Ke=Be.ruleNames.get(Qe.index.name),Ke!==-1?(Be.rules[Ke.index].isBkr=!0,Qe.index=Ke.index):(Ke=Be.udtNames.get(Qe.index.name),Ke!==-1?(Be.udts[Ke.index].isBkr=!0,Qe.index=Be.rules.length+Ke.index):(Be.errors.push({line:Be.findLine(Be.lines,Qe.index.phraseIndex,Be.charsLength),char:Qe.index.phraseIndex,msg:`Back reference name '${Qe.index.name}' refers to undefined rule or unamed UDT.`}),Qe.index=-1)))})})}return De}function N(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_PRE&&(Be.altStack.length=0,Be.topStack=null,Be.rulesLineMap.push({line:Be.findLine(Be.lines,Te,Be.charsLength),char:Te})),De}function q(ve,Ce,Te,Le,Be){const De=w.SEM_OK;if(ve===w.SEM_PRE)Be.ruleName="",Be.definedas="";else if(ve===w.SEM_POST){let Ke;Be.definedas==="="?(Ke=Be.ruleNames.add(Be.ruleName),Ke===-1?(Be.definedas=null,Be.errors.push({line:Be.findLine(Be.lines,Te,Be.charsLength),char:Te,msg:`Rule name '${Be.ruleName}' previously defined.`})):(Be.topRule={name:Ke.name,lower:Ke.lower,opcodes:[],index:Ke.index},Be.rules.push(Be.topRule),Be.opcodes=Be.topRule.opcodes)):(Ke=Be.ruleNames.get(Be.ruleName),Ke===-1?(Be.definedas=null,Be.errors.push({line:Be.findLine(Be.lines,Te,Be.charsLength),char:Te,msg:`Rule name '${Be.ruleName}' for incremental alternate not previously defined.`})):(Be.topRule=Be.rules[Ke.index],Be.opcodes=Be.topRule.opcodes))}return De}function B(ve,Ce,Te,Le,Be){let De=w.SEM_OK;if(ve===w.SEM_PRE)for(;;){if(Be.definedas===null){De=w.SEM_SKIP;break}if(Be.topStack===null){if(Be.definedas==="="){Be.topStack={alt:{type:w.ALT,children:[]},cat:null},Be.altStack.push(Be.topStack),Be.opcodes.push(Be.topStack.alt);break}Be.topStack={alt:Be.opcodes[0],cat:null},Be.altStack.push(Be.topStack);break}Be.topStack={alt:{type:w.ALT,children:[]},cat:null},Be.altStack.push(Be.topStack),Be.opcodes.push(Be.topStack.alt);break}else ve===w.SEM_POST&&(Be.altStack.pop(),Be.altStack.length>0?Be.topStack=Be.altStack[Be.altStack.length-1]:Be.topStack=null);return De}function O(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_PRE?(Be.topStack.alt.children.push(Be.opcodes.length),Be.topStack.cat={type:w.CAT,children:[]},Be.opcodes.push(Be.topStack.cat)):ve===w.SEM_POST&&(Be.topStack.cat=null),De}function I(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_PRE&&Be.topStack.cat.children.push(Be.opcodes.length),De}function D(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&Be.opcodes.push({type:w.REP,min:0,max:1,char:Te}),De}function V(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_PRE&&(Be.ruleName=v.utils.charsToString(Ce,Te,Le)),De}function ee(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&(Be.definedas="="),De}function J(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&(Be.definedas="=/"),De}function te(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_PRE?(Be.min=0,Be.max=1/0,Be.topRep={type:w.REP,min:0,max:1/0},Be.opcodes.push(Be.topRep)):ve===w.SEM_POST&&(Be.min>Be.max&&Be.errors.push({line:Be.findLine(Be.lines,Te,Be.charsLength),char:Te,msg:`repetition min cannot be greater than max: min: ${Be.min}: max: ${Be.max}`}),Be.topRep.min=Be.min,Be.topRep.max=Be.max),De}function se(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&(Be.min=A(Ce,Te,Le)),De}function ce(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&(Be.max=A(Ce,Te,Le)),De}function ae(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&(Be.max=A(Ce,Te,Le),Be.min=Be.max),De}function he(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&Be.opcodes.push({type:w.AND}),De}function oe(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&Be.opcodes.push({type:w.NOT}),De}function de(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&Be.opcodes.push({type:w.RNM,index:{phraseIndex:Te,name:v.utils.charsToString(Ce,Te,Le)}}),De}function le(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&Be.opcodes.push({type:w.ABG}),De}function be(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&Be.opcodes.push({type:w.AEN}),De}function pe(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&Be.opcodes.push({type:w.BKA}),De}function fe(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&Be.opcodes.push({type:w.BKN}),De}function Z(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_PRE?(Be.ci=!0,Be.cs=!1,Be.um=!0,Be.pm=!1):ve===w.SEM_POST&&Be.opcodes.push({type:w.BKR,bkrCase:Be.cs===!0?w.BKR_MODE_CS:w.BKR_MODE_CI,bkrMode:Be.pm===!0?w.BKR_MODE_PM:w.BKR_MODE_UM,index:{phraseIndex:Be.bkrname.phraseIndex,name:v.utils.charsToString(Ce,Be.bkrname.phraseIndex,Be.bkrname.phraseLength)}}),De}function U(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&(Be.ci=!0),De}function S(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&(Be.cs=!0),De}function C(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&(Be.um=!0),De}function F(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&(Be.pm=!0),De}function X(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&(Be.bkrname={phraseIndex:Te,phraseLength:Le}),De}function re(ve,Ce,Te,Le,Be){const De=w.SEM_OK;if(ve===w.SEM_POST){const Ke=v.utils.charsToString(Ce,Te,Le);let We=Be.udtNames.add(Ke);if(We===-1){if(We=Be.udtNames.get(Ke),We===-1)throw new Error("semUdtEmpty: name look up error")}else Be.udts.push({name:We.name,lower:We.lower,index:We.index,empty:!0});Be.opcodes.push({type:w.UDT,empty:!0,index:We.index})}return De}function ie(ve,Ce,Te,Le,Be){const De=w.SEM_OK;if(ve===w.SEM_POST){const Ke=v.utils.charsToString(Ce,Te,Le);let We=Be.udtNames.add(Ke);if(We===-1){if(We=Be.udtNames.get(Ke),We===-1)throw new Error("semUdtNonEmpty: name look up error")}else Be.udts.push({name:We.name,lower:We.lower,index:We.index,empty:!1});Be.opcodes.push({type:w.UDT,empty:!1,index:We.index,syntax:null,semantic:null})}return De}function Q(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_PRE&&(Be.tlscase=!0),De}function ne(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&Le>0&&(Ce[Te+1]===83||Ce[Te+1]===115)&&(Be.tlscase=!1),De}function L(ve,Ce,Te,Le,Be){const De=w.SEM_OK;if(ve===w.SEM_POST)if(Be.tlscase){const Ke=Ce.slice(Te,Te+Le);for(let We=0;We<Ke.length;We+=1)Ke[We]>=65&&Ke[We]<=90&&(Ke[We]+=32);Be.opcodes.push({type:w.TLS,string:Ke})}else Be.opcodes.push({type:w.TBS,string:Ce.slice(Te,Te+Le)});return De}function ue(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&(Le<=2?Be.opcodes.push({type:w.TLS,string:[]}):Be.opcodes.push({type:w.TBS,string:Ce.slice(Te+1,Te+Le-1)})),De}function Ae(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_PRE?Be.tbsstr=[]:ve===w.SEM_POST&&Be.opcodes.push({type:w.TBS,string:Be.tbsstr}),De}function Re(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_PRE?(Be.min=0,Be.max=0):ve===w.SEM_POST&&(Be.min>Be.max&&Be.errors.push({line:Be.findLine(Be.lines,Te,Be.charsLength),char:Te,msg:`TRG, (%dmin-max), min cannot be greater than max: min: ${Be.min}: max: ${Be.max}`}),Be.opcodes.push({type:w.TRG,min:Be.min,max:Be.max})),De}function Pe(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&(Be.min=A(Ce,Te,Le)),De}function xe(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&(Be.max=A(Ce,Te,Le)),De}function ge(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&(Be.min=E(Ce,Te,Le)),De}function _e(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&(Be.max=E(Ce,Te,Le)),De}function ke(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&(Be.min=k(Ce,Te,Le)),De}function Ee(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&(Be.max=k(Ce,Te,Le)),De}function Se(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&Be.tbsstr.push(A(Ce,Te,Le)),De}function Oe(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&Be.tbsstr.push(E(Ce,Te,Le)),De}function Ne(ve,Ce,Te,Le,Be){const De=w.SEM_OK;return ve===w.SEM_POST&&Be.tbsstr.push(k(Ce,Te,Le)),De}this.callbacks=[],this.callbacks.abgop=le,this.callbacks.aenop=be,this.callbacks.alternation=B,this.callbacks.andop=he,this.callbacks.bmax=_e,this.callbacks.bmin=ge,this.callbacks.bkaop=pe,this.callbacks.bknop=fe,this.callbacks.bkrop=Z,this.callbacks["bkr-name"]=X,this.callbacks.bstring=Oe,this.callbacks.clsop=ue,this.callbacks.ci=U,this.callbacks.cs=S,this.callbacks.um=C,this.callbacks.pm=F,this.callbacks.concatenation=O,this.callbacks.defined=ee,this.callbacks.dmax=xe,this.callbacks.dmin=Pe,this.callbacks.dstring=Se,this.callbacks.file=P,this.callbacks.incalt=J,this.callbacks.notop=oe,this.callbacks.optionopen=D,this.callbacks["rep-max"]=ce,this.callbacks["rep-min"]=se,this.callbacks["rep-min-max"]=ae,this.callbacks.repetition=I,this.callbacks.repop=te,this.callbacks.rnmop=de,this.callbacks.rule=N,this.callbacks.rulelookup=q,this.callbacks.rulename=V,this.callbacks.tbsop=Ae,this.callbacks.tlscase=ne,this.callbacks.tlsstring=L,this.callbacks.tlsop=Q,this.callbacks.trgop=Re,this.callbacks["udt-empty"]=re,this.callbacks["udt-non-empty"]=ie,this.callbacks.xmax=Ee,this.callbacks.xmin=ke,this.callbacks.xstring=Ne}),semanticCallbacks}var sabnfGrammar,hasRequiredSabnfGrammar;function requireSabnfGrammar(){return hasRequiredSabnfGrammar||(hasRequiredSabnfGrammar=1,sabnfGrammar=function(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"File",lower:"file",index:0,isBkr:!1},this.rules[1]={name:"BlankLine",lower:"blankline",index:1,isBkr:!1},this.rules[2]={name:"Rule",lower:"rule",index:2,isBkr:!1},this.rules[3]={name:"RuleLookup",lower:"rulelookup",index:3,isBkr:!1},this.rules[4]={name:"RuleNameTest",lower:"rulenametest",index:4,isBkr:!1},this.rules[5]={name:"RuleName",lower:"rulename",index:5,isBkr:!1},this.rules[6]={name:"RuleNameError",lower:"rulenameerror",index:6,isBkr:!1},this.rules[7]={name:"DefinedAsTest",lower:"definedastest",index:7,isBkr:!1},this.rules[8]={name:"DefinedAsError",lower:"definedaserror",index:8,isBkr:!1},this.rules[9]={name:"DefinedAs",lower:"definedas",index:9,isBkr:!1},this.rules[10]={name:"Defined",lower:"defined",index:10,isBkr:!1},this.rules[11]={name:"IncAlt",lower:"incalt",index:11,isBkr:!1},this.rules[12]={name:"RuleError",lower:"ruleerror",index:12,isBkr:!1},this.rules[13]={name:"LineEndError",lower:"lineenderror",index:13,isBkr:!1},this.rules[14]={name:"Alternation",lower:"alternation",index:14,isBkr:!1},this.rules[15]={name:"Concatenation",lower:"concatenation",index:15,isBkr:!1},this.rules[16]={name:"Repetition",lower:"repetition",index:16,isBkr:!1},this.rules[17]={name:"Modifier",lower:"modifier",index:17,isBkr:!1},this.rules[18]={name:"Predicate",lower:"predicate",index:18,isBkr:!1},this.rules[19]={name:"BasicElement",lower:"basicelement",index:19,isBkr:!1},this.rules[20]={name:"BasicElementErr",lower:"basicelementerr",index:20,isBkr:!1},this.rules[21]={name:"Group",lower:"group",index:21,isBkr:!1},this.rules[22]={name:"GroupError",lower:"grouperror",index:22,isBkr:!1},this.rules[23]={name:"GroupOpen",lower:"groupopen",index:23,isBkr:!1},this.rules[24]={name:"GroupClose",lower:"groupclose",index:24,isBkr:!1},this.rules[25]={name:"Option",lower:"option",index:25,isBkr:!1},this.rules[26]={name:"OptionError",lower:"optionerror",index:26,isBkr:!1},this.rules[27]={name:"OptionOpen",lower:"optionopen",index:27,isBkr:!1},this.rules[28]={name:"OptionClose",lower:"optionclose",index:28,isBkr:!1},this.rules[29]={name:"RnmOp",lower:"rnmop",index:29,isBkr:!1},this.rules[30]={name:"BkrOp",lower:"bkrop",index:30,isBkr:!1},this.rules[31]={name:"bkrModifier",lower:"bkrmodifier",index:31,isBkr:!1},this.rules[32]={name:"cs",lower:"cs",index:32,isBkr:!1},this.rules[33]={name:"ci",lower:"ci",index:33,isBkr:!1},this.rules[34]={name:"um",lower:"um",index:34,isBkr:!1},this.rules[35]={name:"pm",lower:"pm",index:35,isBkr:!1},this.rules[36]={name:"bkr-name",lower:"bkr-name",index:36,isBkr:!1},this.rules[37]={name:"rname",lower:"rname",index:37,isBkr:!1},this.rules[38]={name:"uname",lower:"uname",index:38,isBkr:!1},this.rules[39]={name:"ename",lower:"ename",index:39,isBkr:!1},this.rules[40]={name:"UdtOp",lower:"udtop",index:40,isBkr:!1},this.rules[41]={name:"udt-non-empty",lower:"udt-non-empty",index:41,isBkr:!1},this.rules[42]={name:"udt-empty",lower:"udt-empty",index:42,isBkr:!1},this.rules[43]={name:"RepOp",lower:"repop",index:43,isBkr:!1},this.rules[44]={name:"AltOp",lower:"altop",index:44,isBkr:!1},this.rules[45]={name:"CatOp",lower:"catop",index:45,isBkr:!1},this.rules[46]={name:"StarOp",lower:"starop",index:46,isBkr:!1},this.rules[47]={name:"AndOp",lower:"andop",index:47,isBkr:!1},this.rules[48]={name:"NotOp",lower:"notop",index:48,isBkr:!1},this.rules[49]={name:"BkaOp",lower:"bkaop",index:49,isBkr:!1},this.rules[50]={name:"BknOp",lower:"bknop",index:50,isBkr:!1},this.rules[51]={name:"AbgOp",lower:"abgop",index:51,isBkr:!1},this.rules[52]={name:"AenOp",lower:"aenop",index:52,isBkr:!1},this.rules[53]={name:"TrgOp",lower:"trgop",index:53,isBkr:!1},this.rules[54]={name:"TbsOp",lower:"tbsop",index:54,isBkr:!1},this.rules[55]={name:"TlsOp",lower:"tlsop",index:55,isBkr:!1},this.rules[56]={name:"TlsCase",lower:"tlscase",index:56,isBkr:!1},this.rules[57]={name:"TlsOpen",lower:"tlsopen",index:57,isBkr:!1},this.rules[58]={name:"TlsClose",lower:"tlsclose",index:58,isBkr:!1},this.rules[59]={name:"TlsString",lower:"tlsstring",index:59,isBkr:!1},this.rules[60]={name:"StringTab",lower:"stringtab",index:60,isBkr:!1},this.rules[61]={name:"ClsOp",lower:"clsop",index:61,isBkr:!1},this.rules[62]={name:"ClsOpen",lower:"clsopen",index:62,isBkr:!1},this.rules[63]={name:"ClsClose",lower:"clsclose",index:63,isBkr:!1},this.rules[64]={name:"ClsString",lower:"clsstring",index:64,isBkr:!1},this.rules[65]={name:"ProsVal",lower:"prosval",index:65,isBkr:!1},this.rules[66]={name:"ProsValOpen",lower:"prosvalopen",index:66,isBkr:!1},this.rules[67]={name:"ProsValString",lower:"prosvalstring",index:67,isBkr:!1},this.rules[68]={name:"ProsValClose",lower:"prosvalclose",index:68,isBkr:!1},this.rules[69]={name:"rep-min",lower:"rep-min",index:69,isBkr:!1},this.rules[70]={name:"rep-min-max",lower:"rep-min-max",index:70,isBkr:!1},this.rules[71]={name:"rep-max",lower:"rep-max",index:71,isBkr:!1},this.rules[72]={name:"rep-num",lower:"rep-num",index:72,isBkr:!1},this.rules[73]={name:"dString",lower:"dstring",index:73,isBkr:!1},this.rules[74]={name:"xString",lower:"xstring",index:74,isBkr:!1},this.rules[75]={name:"bString",lower:"bstring",index:75,isBkr:!1},this.rules[76]={name:"Dec",lower:"dec",index:76,isBkr:!1},this.rules[77]={name:"Hex",lower:"hex",index:77,isBkr:!1},this.rules[78]={name:"Bin",lower:"bin",index:78,isBkr:!1},this.rules[79]={name:"dmin",lower:"dmin",index:79,isBkr:!1},this.rules[80]={name:"dmax",lower:"dmax",index:80,isBkr:!1},this.rules[81]={name:"bmin",lower:"bmin",index:81,isBkr:!1},this.rules[82]={name:"bmax",lower:"bmax",index:82,isBkr:!1},this.rules[83]={name:"xmin",lower:"xmin",index:83,isBkr:!1},this.rules[84]={name:"xmax",lower:"xmax",index:84,isBkr:!1},this.rules[85]={name:"dnum",lower:"dnum",index:85,isBkr:!1},this.rules[86]={name:"bnum",lower:"bnum",index:86,isBkr:!1},this.rules[87]={name:"xnum",lower:"xnum",index:87,isBkr:!1},this.rules[88]={name:"alphanum",lower:"alphanum",index:88,isBkr:!1},this.rules[89]={name:"owsp",lower:"owsp",index:89,isBkr:!1},this.rules[90]={name:"wsp",lower:"wsp",index:90,isBkr:!1},this.rules[91]={name:"space",lower:"space",index:91,isBkr:!1},this.rules[92]={name:"comment",lower:"comment",index:92,isBkr:!1},this.rules[93]={name:"LineEnd",lower:"lineend",index:93,isBkr:!1},this.rules[94]={name:"LineContinue",lower:"linecontinue",index:94,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:3,min:0,max:1/0},this.rules[0].opcodes[1]={type:1,children:[2,3,4]},this.rules[0].opcodes[2]={type:4,index:1},this.rules[0].opcodes[3]={type:4,index:2},this.rules[0].opcodes[4]={type:4,index:12},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:2,children:[1,5,7]},this.rules[1].opcodes[1]={type:3,min:0,max:1/0},this.rules[1].opcodes[2]={type:1,children:[3,4]},this.rules[1].opcodes[3]={type:6,string:[32]},this.rules[1].opcodes[4]={type:6,string:[9]},this.rules[1].opcodes[5]={type:3,min:0,max:1},this.rules[1].opcodes[6]={type:4,index:92},this.rules[1].opcodes[7]={type:4,index:93},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:2,children:[1,2,3,4]},this.rules[2].opcodes[1]={type:4,index:3},this.rules[2].opcodes[2]={type:4,index:89},this.rules[2].opcodes[3]={type:4,index:14},this.rules[2].opcodes[4]={type:1,children:[5,8]},this.rules[2].opcodes[5]={type:2,children:[6,7]},this.rules[2].opcodes[6]={type:4,index:89},this.rules[2].opcodes[7]={type:4,index:93},this.rules[2].opcodes[8]={type:2,children:[9,10]},this.rules[2].opcodes[9]={type:4,index:13},this.rules[2].opcodes[10]={type:4,index:93},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:2,children:[1,2,3]},this.rules[3].opcodes[1]={type:4,index:4},this.rules[3].opcodes[2]={type:4,index:89},this.rules[3].opcodes[3]={type:4,index:7},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:1,children:[1,2]},this.rules[4].opcodes[1]={type:4,index:5},this.rules[4].opcodes[2]={type:4,index:6},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:4,index:88},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:3,min:1,max:1/0},this.rules[6].opcodes[1]={type:1,children:[2,3]},this.rules[6].opcodes[2]={type:5,min:33,max:60},this.rules[6].opcodes[3]={type:5,min:62,max:126},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:1,children:[1,2]},this.rules[7].opcodes[1]={type:4,index:9},this.rules[7].opcodes[2]={type:4,index:8},this.rules[8].opcodes=[],this.rules[8].opcodes[0]={type:3,min:1,max:2},this.rules[8].opcodes[1]={type:5,min:33,max:126},this.rules[9].opcodes=[],this.rules[9].opcodes[0]={type:1,children:[1,2]},this.rules[9].opcodes[1]={type:4,index:11},this.rules[9].opcodes[2]={type:4,index:10},this.rules[10].opcodes=[],this.rules[10].opcodes[0]={type:6,string:[61]},this.rules[11].opcodes=[],this.rules[11].opcodes[0]={type:6,string:[61,47]},this.rules[12].opcodes=[],this.rules[12].opcodes[0]={type:2,children:[1,6]},this.rules[12].opcodes[1]={type:3,min:1,max:1/0},this.rules[12].opcodes[2]={type:1,children:[3,4,5]},this.rules[12].opcodes[3]={type:5,min:32,max:126},this.rules[12].opcodes[4]={type:6,string:[9]},this.rules[12].opcodes[5]={type:4,index:94},this.rules[12].opcodes[6]={type:4,index:93},this.rules[13].opcodes=[],this.rules[13].opcodes[0]={type:3,min:1,max:1/0},this.rules[13].opcodes[1]={type:1,children:[2,3,4]},this.rules[13].opcodes[2]={type:5,min:32,max:126},this.rules[13].opcodes[3]={type:6,string:[9]},this.rules[13].opcodes[4]={type:4,index:94},this.rules[14].opcodes=[],this.rules[14].opcodes[0]={type:2,children:[1,2]},this.rules[14].opcodes[1]={type:4,index:15},this.rules[14].opcodes[2]={type:3,min:0,max:1/0},this.rules[14].opcodes[3]={type:2,children:[4,5,6]},this.rules[14].opcodes[4]={type:4,index:89},this.rules[14].opcodes[5]={type:4,index:44},this.rules[14].opcodes[6]={type:4,index:15},this.rules[15].opcodes=[],this.rules[15].opcodes[0]={type:2,children:[1,2]},this.rules[15].opcodes[1]={type:4,index:16},this.rules[15].opcodes[2]={type:3,min:0,max:1/0},this.rules[15].opcodes[3]={type:2,children:[4,5]},this.rules[15].opcodes[4]={type:4,index:45},this.rules[15].opcodes[5]={type:4,index:16},this.rules[16].opcodes=[],this.rules[16].opcodes[0]={type:2,children:[1,3]},this.rules[16].opcodes[1]={type:3,min:0,max:1},this.rules[16].opcodes[2]={type:4,index:17},this.rules[16].opcodes[3]={type:1,children:[4,5,6,7]},this.rules[16].opcodes[4]={type:4,index:21},this.rules[16].opcodes[5]={type:4,index:25},this.rules[16].opcodes[6]={type:4,index:19},this.rules[16].opcodes[7]={type:4,index:20},this.rules[17].opcodes=[],this.rules[17].opcodes[0]={type:1,children:[1,5]},this.rules[17].opcodes[1]={type:2,children:[2,3]},this.rules[17].opcodes[2]={type:4,index:18},this.rules[17].opcodes[3]={type:3,min:0,max:1},this.rules[17].opcodes[4]={type:4,index:43},this.rules[17].opcodes[5]={type:4,index:43},this.rules[18].opcodes=[],this.rules[18].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[18].opcodes[1]={type:4,index:49},this.rules[18].opcodes[2]={type:4,index:50},this.rules[18].opcodes[3]={type:4,index:47},this.rules[18].opcodes[4]={type:4,index:48},this.rules[19].opcodes=[],this.rules[19].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8,9,10]},this.rules[19].opcodes[1]={type:4,index:40},this.rules[19].opcodes[2]={type:4,index:29},this.rules[19].opcodes[3]={type:4,index:53},this.rules[19].opcodes[4]={type:4,index:54},this.rules[19].opcodes[5]={type:4,index:55},this.rules[19].opcodes[6]={type:4,index:61},this.rules[19].opcodes[7]={type:4,index:30},this.rules[19].opcodes[8]={type:4,index:51},this.rules[19].opcodes[9]={type:4,index:52},this.rules[19].opcodes[10]={type:4,index:65},this.rules[20].opcodes=[],this.rules[20].opcodes[0]={type:3,min:1,max:1/0},this.rules[20].opcodes[1]={type:1,children:[2,3,4,5]},this.rules[20].opcodes[2]={type:5,min:33,max:40},this.rules[20].opcodes[3]={type:5,min:42,max:46},this.rules[20].opcodes[4]={type:5,min:48,max:92},this.rules[20].opcodes[5]={type:5,min:94,max:126},this.rules[21].opcodes=[],this.rules[21].opcodes[0]={type:2,children:[1,2,3]},this.rules[21].opcodes[1]={type:4,index:23},this.rules[21].opcodes[2]={type:4,index:14},this.rules[21].opcodes[3]={type:1,children:[4,5]},this.rules[21].opcodes[4]={type:4,index:24},this.rules[21].opcodes[5]={type:4,index:22},this.rules[22].opcodes=[],this.rules[22].opcodes[0]={type:3,min:1,max:1/0},this.rules[22].opcodes[1]={type:1,children:[2,3,4,5]},this.rules[22].opcodes[2]={type:5,min:33,max:40},this.rules[22].opcodes[3]={type:5,min:42,max:46},this.rules[22].opcodes[4]={type:5,min:48,max:92},this.rules[22].opcodes[5]={type:5,min:94,max:126},this.rules[23].opcodes=[],this.rules[23].opcodes[0]={type:2,children:[1,2]},this.rules[23].opcodes[1]={type:6,string:[40]},this.rules[23].opcodes[2]={type:4,index:89},this.rules[24].opcodes=[],this.rules[24].opcodes[0]={type:2,children:[1,2]},this.rules[24].opcodes[1]={type:4,index:89},this.rules[24].opcodes[2]={type:6,string:[41]},this.rules[25].opcodes=[],this.rules[25].opcodes[0]={type:2,children:[1,2,3]},this.rules[25].opcodes[1]={type:4,index:27},this.rules[25].opcodes[2]={type:4,index:14},this.rules[25].opcodes[3]={type:1,children:[4,5]},this.rules[25].opcodes[4]={type:4,index:28},this.rules[25].opcodes[5]={type:4,index:26},this.rules[26].opcodes=[],this.rules[26].opcodes[0]={type:3,min:1,max:1/0},this.rules[26].opcodes[1]={type:1,children:[2,3,4,5]},this.rules[26].opcodes[2]={type:5,min:33,max:40},this.rules[26].opcodes[3]={type:5,min:42,max:46},this.rules[26].opcodes[4]={type:5,min:48,max:92},this.rules[26].opcodes[5]={type:5,min:94,max:126},this.rules[27].opcodes=[],this.rules[27].opcodes[0]={type:2,children:[1,2]},this.rules[27].opcodes[1]={type:6,string:[91]},this.rules[27].opcodes[2]={type:4,index:89},this.rules[28].opcodes=[],this.rules[28].opcodes[0]={type:2,children:[1,2]},this.rules[28].opcodes[1]={type:4,index:89},this.rules[28].opcodes[2]={type:6,string:[93]},this.rules[29].opcodes=[],this.rules[29].opcodes[0]={type:4,index:88},this.rules[30].opcodes=[],this.rules[30].opcodes[0]={type:2,children:[1,2,4]},this.rules[30].opcodes[1]={type:6,string:[92]},this.rules[30].opcodes[2]={type:3,min:0,max:1},this.rules[30].opcodes[3]={type:4,index:31},this.rules[30].opcodes[4]={type:4,index:36},this.rules[31].opcodes=[],this.rules[31].opcodes[0]={type:1,children:[1,7,13,19]},this.rules[31].opcodes[1]={type:2,children:[2,3]},this.rules[31].opcodes[2]={type:4,index:32},this.rules[31].opcodes[3]={type:3,min:0,max:1},this.rules[31].opcodes[4]={type:1,children:[5,6]},this.rules[31].opcodes[5]={type:4,index:34},this.rules[31].opcodes[6]={type:4,index:35},this.rules[31].opcodes[7]={type:2,children:[8,9]},this.rules[31].opcodes[8]={type:4,index:33},this.rules[31].opcodes[9]={type:3,min:0,max:1},this.rules[31].opcodes[10]={type:1,children:[11,12]},this.rules[31].opcodes[11]={type:4,index:34},this.rules[31].opcodes[12]={type:4,index:35},this.rules[31].opcodes[13]={type:2,children:[14,15]},this.rules[31].opcodes[14]={type:4,index:34},this.rules[31].opcodes[15]={type:3,min:0,max:1},this.rules[31].opcodes[16]={type:1,children:[17,18]},this.rules[31].opcodes[17]={type:4,index:32},this.rules[31].opcodes[18]={type:4,index:33},this.rules[31].opcodes[19]={type:2,children:[20,21]},this.rules[31].opcodes[20]={type:4,index:35},this.rules[31].opcodes[21]={type:3,min:0,max:1},this.rules[31].opcodes[22]={type:1,children:[23,24]},this.rules[31].opcodes[23]={type:4,index:32},this.rules[31].opcodes[24]={type:4,index:33},this.rules[32].opcodes=[],this.rules[32].opcodes[0]={type:6,string:[37,115]},this.rules[33].opcodes=[],this.rules[33].opcodes[0]={type:6,string:[37,105]},this.rules[34].opcodes=[],this.rules[34].opcodes[0]={type:6,string:[37,117]},this.rules[35].opcodes=[],this.rules[35].opcodes[0]={type:6,string:[37,112]},this.rules[36].opcodes=[],this.rules[36].opcodes[0]={type:1,children:[1,2,3]},this.rules[36].opcodes[1]={type:4,index:38},this.rules[36].opcodes[2]={type:4,index:39},this.rules[36].opcodes[3]={type:4,index:37},this.rules[37].opcodes=[],this.rules[37].opcodes[0]={type:4,index:88},this.rules[38].opcodes=[],this.rules[38].opcodes[0]={type:2,children:[1,2]},this.rules[38].opcodes[1]={type:6,string:[117,95]},this.rules[38].opcodes[2]={type:4,index:88},this.rules[39].opcodes=[],this.rules[39].opcodes[0]={type:2,children:[1,2]},this.rules[39].opcodes[1]={type:6,string:[101,95]},this.rules[39].opcodes[2]={type:4,index:88},this.rules[40].opcodes=[],this.rules[40].opcodes[0]={type:1,children:[1,2]},this.rules[40].opcodes[1]={type:4,index:42},this.rules[40].opcodes[2]={type:4,index:41},this.rules[41].opcodes=[],this.rules[41].opcodes[0]={type:2,children:[1,2]},this.rules[41].opcodes[1]={type:6,string:[117,95]},this.rules[41].opcodes[2]={type:4,index:88},this.rules[42].opcodes=[],this.rules[42].opcodes[0]={type:2,children:[1,2]},this.rules[42].opcodes[1]={type:6,string:[101,95]},this.rules[42].opcodes[2]={type:4,index:88},this.rules[43].opcodes=[],this.rules[43].opcodes[0]={type:1,children:[1,5,8,11,12]},this.rules[43].opcodes[1]={type:2,children:[2,3,4]},this.rules[43].opcodes[2]={type:4,index:69},this.rules[43].opcodes[3]={type:4,index:46},this.rules[43].opcodes[4]={type:4,index:71},this.rules[43].opcodes[5]={type:2,children:[6,7]},this.rules[43].opcodes[6]={type:4,index:69},this.rules[43].opcodes[7]={type:4,index:46},this.rules[43].opcodes[8]={type:2,children:[9,10]},this.rules[43].opcodes[9]={type:4,index:46},this.rules[43].opcodes[10]={type:4,index:71},this.rules[43].opcodes[11]={type:4,index:46},this.rules[43].opcodes[12]={type:4,index:70},this.rules[44].opcodes=[],this.rules[44].opcodes[0]={type:2,children:[1,2]},this.rules[44].opcodes[1]={type:6,string:[47]},this.rules[44].opcodes[2]={type:4,index:89},this.rules[45].opcodes=[],this.rules[45].opcodes[0]={type:4,index:90},this.rules[46].opcodes=[],this.rules[46].opcodes[0]={type:6,string:[42]},this.rules[47].opcodes=[],this.rules[47].opcodes[0]={type:6,string:[38]},this.rules[48].opcodes=[],this.rules[48].opcodes[0]={type:6,string:[33]},this.rules[49].opcodes=[],this.rules[49].opcodes[0]={type:6,string:[38,38]},this.rules[50].opcodes=[],this.rules[50].opcodes[0]={type:6,string:[33,33]},this.rules[51].opcodes=[],this.rules[51].opcodes[0]={type:6,string:[37,94]},this.rules[52].opcodes=[],this.rules[52].opcodes[0]={type:6,string:[37,36]},this.rules[53].opcodes=[],this.rules[53].opcodes[0]={type:2,children:[1,2]},this.rules[53].opcodes[1]={type:6,string:[37]},this.rules[53].opcodes[2]={type:1,children:[3,8,13]},this.rules[53].opcodes[3]={type:2,children:[4,5,6,7]},this.rules[53].opcodes[4]={type:4,index:76},this.rules[53].opcodes[5]={type:4,index:79},this.rules[53].opcodes[6]={type:6,string:[45]},this.rules[53].opcodes[7]={type:4,index:80},this.rules[53].opcodes[8]={type:2,children:[9,10,11,12]},this.rules[53].opcodes[9]={type:4,index:77},this.rules[53].opcodes[10]={type:4,index:83},this.rules[53].opcodes[11]={type:6,string:[45]},this.rules[53].opcodes[12]={type:4,index:84},this.rules[53].opcodes[13]={type:2,children:[14,15,16,17]},this.rules[53].opcodes[14]={type:4,index:78},this.rules[53].opcodes[15]={type:4,index:81},this.rules[53].opcodes[16]={type:6,string:[45]},this.rules[53].opcodes[17]={type:4,index:82},this.rules[54].opcodes=[],this.rules[54].opcodes[0]={type:2,children:[1,2]},this.rules[54].opcodes[1]={type:6,string:[37]},this.rules[54].opcodes[2]={type:1,children:[3,10,17]},this.rules[54].opcodes[3]={type:2,children:[4,5,6]},this.rules[54].opcodes[4]={type:4,index:76},this.rules[54].opcodes[5]={type:4,index:73},this.rules[54].opcodes[6]={type:3,min:0,max:1/0},this.rules[54].opcodes[7]={type:2,children:[8,9]},this.rules[54].opcodes[8]={type:6,string:[46]},this.rules[54].opcodes[9]={type:4,index:73},this.rules[54].opcodes[10]={type:2,children:[11,12,13]},this.rules[54].opcodes[11]={type:4,index:77},this.rules[54].opcodes[12]={type:4,index:74},this.rules[54].opcodes[13]={type:3,min:0,max:1/0},this.rules[54].opcodes[14]={type:2,children:[15,16]},this.rules[54].opcodes[15]={type:6,string:[46]},this.rules[54].opcodes[16]={type:4,index:74},this.rules[54].opcodes[17]={type:2,children:[18,19,20]},this.rules[54].opcodes[18]={type:4,index:78},this.rules[54].opcodes[19]={type:4,index:75},this.rules[54].opcodes[20]={type:3,min:0,max:1/0},this.rules[54].opcodes[21]={type:2,children:[22,23]},this.rules[54].opcodes[22]={type:6,string:[46]},this.rules[54].opcodes[23]={type:4,index:75},this.rules[55].opcodes=[],this.rules[55].opcodes[0]={type:2,children:[1,2,3,4]},this.rules[55].opcodes[1]={type:4,index:56},this.rules[55].opcodes[2]={type:4,index:57},this.rules[55].opcodes[3]={type:4,index:59},this.rules[55].opcodes[4]={type:4,index:58},this.rules[56].opcodes=[],this.rules[56].opcodes[0]={type:3,min:0,max:1},this.rules[56].opcodes[1]={type:1,children:[2,3]},this.rules[56].opcodes[2]={type:7,string:[37,105]},this.rules[56].opcodes[3]={type:7,string:[37,115]},this.rules[57].opcodes=[],this.rules[57].opcodes[0]={type:6,string:[34]},this.rules[58].opcodes=[],this.rules[58].opcodes[0]={type:6,string:[34]},this.rules[59].opcodes=[],this.rules[59].opcodes[0]={type:3,min:0,max:1/0},this.rules[59].opcodes[1]={type:1,children:[2,3,4]},this.rules[59].opcodes[2]={type:5,min:32,max:33},this.rules[59].opcodes[3]={type:5,min:35,max:126},this.rules[59].opcodes[4]={type:4,index:60},this.rules[60].opcodes=[],this.rules[60].opcodes[0]={type:6,string:[9]},this.rules[61].opcodes=[],this.rules[61].opcodes[0]={type:2,children:[1,2,3]},this.rules[61].opcodes[1]={type:4,index:62},this.rules[61].opcodes[2]={type:4,index:64},this.rules[61].opcodes[3]={type:4,index:63},this.rules[62].opcodes=[],this.rules[62].opcodes[0]={type:6,string:[39]},this.rules[63].opcodes=[],this.rules[63].opcodes[0]={type:6,string:[39]},this.rules[64].opcodes=[],this.rules[64].opcodes[0]={type:3,min:0,max:1/0},this.rules[64].opcodes[1]={type:1,children:[2,3,4]},this.rules[64].opcodes[2]={type:5,min:32,max:38},this.rules[64].opcodes[3]={type:5,min:40,max:126},this.rules[64].opcodes[4]={type:4,index:60},this.rules[65].opcodes=[],this.rules[65].opcodes[0]={type:2,children:[1,2,3]},this.rules[65].opcodes[1]={type:4,index:66},this.rules[65].opcodes[2]={type:4,index:67},this.rules[65].opcodes[3]={type:4,index:68},this.rules[66].opcodes=[],this.rules[66].opcodes[0]={type:6,string:[60]},this.rules[67].opcodes=[],this.rules[67].opcodes[0]={type:3,min:0,max:1/0},this.rules[67].opcodes[1]={type:1,children:[2,3,4]},this.rules[67].opcodes[2]={type:5,min:32,max:61},this.rules[67].opcodes[3]={type:5,min:63,max:126},this.rules[67].opcodes[4]={type:4,index:60},this.rules[68].opcodes=[],this.rules[68].opcodes[0]={type:6,string:[62]},this.rules[69].opcodes=[],this.rules[69].opcodes[0]={type:4,index:72},this.rules[70].opcodes=[],this.rules[70].opcodes[0]={type:4,index:72},this.rules[71].opcodes=[],this.rules[71].opcodes[0]={type:4,index:72},this.rules[72].opcodes=[],this.rules[72].opcodes[0]={type:3,min:1,max:1/0},this.rules[72].opcodes[1]={type:5,min:48,max:57},this.rules[73].opcodes=[],this.rules[73].opcodes[0]={type:4,index:85},this.rules[74].opcodes=[],this.rules[74].opcodes[0]={type:4,index:87},this.rules[75].opcodes=[],this.rules[75].opcodes[0]={type:4,index:86},this.rules[76].opcodes=[],this.rules[76].opcodes[0]={type:1,children:[1,2]},this.rules[76].opcodes[1]={type:6,string:[68]},this.rules[76].opcodes[2]={type:6,string:[100]},this.rules[77].opcodes=[],this.rules[77].opcodes[0]={type:1,children:[1,2]},this.rules[77].opcodes[1]={type:6,string:[88]},this.rules[77].opcodes[2]={type:6,string:[120]},this.rules[78].opcodes=[],this.rules[78].opcodes[0]={type:1,children:[1,2]},this.rules[78].opcodes[1]={type:6,string:[66]},this.rules[78].opcodes[2]={type:6,string:[98]},this.rules[79].opcodes=[],this.rules[79].opcodes[0]={type:4,index:85},this.rules[80].opcodes=[],this.rules[80].opcodes[0]={type:4,index:85},this.rules[81].opcodes=[],this.rules[81].opcodes[0]={type:4,index:86},this.rules[82].opcodes=[],this.rules[82].opcodes[0]={type:4,index:86},this.rules[83].opcodes=[],this.rules[83].opcodes[0]={type:4,index:87},this.rules[84].opcodes=[],this.rules[84].opcodes[0]={type:4,index:87},this.rules[85].opcodes=[],this.rules[85].opcodes[0]={type:3,min:1,max:1/0},this.rules[85].opcodes[1]={type:5,min:48,max:57},this.rules[86].opcodes=[],this.rules[86].opcodes[0]={type:3,min:1,max:1/0},this.rules[86].opcodes[1]={type:5,min:48,max:49},this.rules[87].opcodes=[],this.rules[87].opcodes[0]={type:3,min:1,max:1/0},this.rules[87].opcodes[1]={type:1,children:[2,3,4]},this.rules[87].opcodes[2]={type:5,min:48,max:57},this.rules[87].opcodes[3]={type:5,min:65,max:70},this.rules[87].opcodes[4]={type:5,min:97,max:102},this.rules[88].opcodes=[],this.rules[88].opcodes[0]={type:2,children:[1,4]},this.rules[88].opcodes[1]={type:1,children:[2,3]},this.rules[88].opcodes[2]={type:5,min:97,max:122},this.rules[88].opcodes[3]={type:5,min:65,max:90},this.rules[88].opcodes[4]={type:3,min:0,max:1/0},this.rules[88].opcodes[5]={type:1,children:[6,7,8,9]},this.rules[88].opcodes[6]={type:5,min:97,max:122},this.rules[88].opcodes[7]={type:5,min:65,max:90},this.rules[88].opcodes[8]={type:5,min:48,max:57},this.rules[88].opcodes[9]={type:6,string:[45]},this.rules[89].opcodes=[],this.rules[89].opcodes[0]={type:3,min:0,max:1/0},this.rules[89].opcodes[1]={type:4,index:91},this.rules[90].opcodes=[],this.rules[90].opcodes[0]={type:3,min:1,max:1/0},this.rules[90].opcodes[1]={type:4,index:91},this.rules[91].opcodes=[],this.rules[91].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[91].opcodes[1]={type:6,string:[32]},this.rules[91].opcodes[2]={type:6,string:[9]},this.rules[91].opcodes[3]={type:4,index:92},this.rules[91].opcodes[4]={type:4,index:94},this.rules[92].opcodes=[],this.rules[92].opcodes[0]={type:2,children:[1,2]},this.rules[92].opcodes[1]={type:6,string:[59]},this.rules[92].opcodes[2]={type:3,min:0,max:1/0},this.rules[92].opcodes[3]={type:1,children:[4,5]},this.rules[92].opcodes[4]={type:5,min:32,max:126},this.rules[92].opcodes[5]={type:6,string:[9]},this.rules[93].opcodes=[],this.rules[93].opcodes[0]={type:1,children:[1,2,3]},this.rules[93].opcodes[1]={type:6,string:[13,10]},this.rules[93].opcodes[2]={type:6,string:[10]},this.rules[93].opcodes[3]={type:6,string:[13]},this.rules[94].opcodes=[],this.rules[94].opcodes[0]={type:2,children:[1,5]},this.rules[94].opcodes[1]={type:1,children:[2,3,4]},this.rules[94].opcodes[2]={type:6,string:[13,10]},this.rules[94].opcodes[3]={type:6,string:[10]},this.rules[94].opcodes[4]={type:6,string:[13]},this.rules[94].opcodes[5]={type:1,children:[6,7]},this.rules[94].opcodes[6]={type:6,string:[32]},this.rules[94].opcodes[7]={type:6,string:[9]},this.toString=function(){let w="";return w+=`;
339
- `,w+=`; ABNF for JavaScript APG 2.0 SABNF
340
- `,w+=`; RFC 5234 with some restrictions and additions.
341
- `,w+=`; Updated 11/24/2015 for RFC 7405 case-sensitive literal string notation
342
- `,w+=`; - accepts %s"string" as a case-sensitive string
343
- `,w+=`; - accepts %i"string" as a case-insensitive string
344
- `,w+=`; - accepts "string" as a case-insensitive string
345
- `,w+=`;
346
- `,w+=`; Some restrictions:
347
- `,w+=`; 1. Rules must begin at first character of each line.
348
- `,w+=`; Indentations on first rule and rules thereafter are not allowed.
349
- `,w+=`; 2. Relaxed line endings. CRLF, LF or CR are accepted as valid line ending.
350
- `,w+=`; 3. Prose values, i.e. <prose value>, are accepted as valid grammar syntax.
351
- `,w+=`; However, a working parser cannot be generated from them.
352
- `,w+=`;
353
- `,w+=`; Super set (SABNF) additions:
354
- `,w+=`; 1. Look-ahead (syntactic predicate) operators are accepted as element prefixes.
355
- `,w+=`; & is the positive look-ahead operator, succeeds and backtracks if the look-ahead phrase is found
356
- `,w+=`; ! is the negative look-ahead operator, succeeds and backtracks if the look-ahead phrase is NOT found
357
- `,w+=`; e.g. &%d13 or &rule or !(A / B)
358
- `,w+=`; 2. User-Defined Terminals (UDT) of the form, u_name and e_name are accepted.
359
- `,w+=`; 'name' is alpha followed by alpha/num/hyphen just like a rule name.
360
- `,w+=`; u_name may be used as an element but no rule definition is given.
361
- `,w+=`; e.g. rule = A / u_myUdt
362
- `,w+=`; A = "a"
363
- `,w+=`; would be a valid grammar.
364
- `,w+=`; 3. Case-sensitive, single-quoted strings are accepted.
365
- `,w+=`; e.g. 'abc' would be equivalent to %d97.98.99
366
- `,w+=`; (kept for backward compatibility, but superseded by %s"abc")
367
- `,w+=`; New 12/26/2015
368
- `,w+=`; 4. Look-behind operators are accepted as element prefixes.
369
- `,w+=`; && is the positive look-behind operator, succeeds and backtracks if the look-behind phrase is found
370
- `,w+=`; !! is the negative look-behind operator, succeeds and backtracks if the look-behind phrase is NOT found
371
- `,w+=`; e.g. &&%d13 or &&rule or !!(A / B)
372
- `,w+=`; 5. Back reference operators, i.e. \\rulename, are accepted.
373
- `,w+=`; A back reference operator acts like a TLS or TBS terminal except that the phrase it attempts
374
- `,w+=`; to match is a phrase previously matched by the rule 'rulename'.
375
- `,w+=`; There are two modes of previous phrase matching - the parent-frame mode and the universal mode.
376
- `,w+=`; In universal mode, \\rulename matches the last match to 'rulename' regardless of where it was found.
377
- `,w+=`; In parent-frame mode, \\rulename matches only the last match found on the parent's frame or parse tree level.
378
- `,w+=`; Back reference modifiers can be used to specify case and mode.
379
- `,w+=`; \\A defaults to case-insensitive and universal mode, e.g. \\A === \\%i%uA
380
- `,w+=`; Modifiers %i and %s determine case-insensitive and case-sensitive mode, respectively.
381
- `,w+=`; Modifiers %u and %p determine universal mode and parent frame mode, respectively.
382
- `,w+=`; Case and mode modifiers can appear in any order, e.g. \\%s%pA === \\%p%sA.
383
- `,w+=`; 7. String begin anchor, ABG(%^) matches the beginning of the input string location.
384
- `,w+=`; Returns EMPTY or NOMATCH. Never consumes any characters.
385
- `,w+=`; 8. String end anchor, AEN(%$) matches the end of the input string location.
386
- `,w+=`; Returns EMPTY or NOMATCH. Never consumes any characters.
387
- `,w+=`;
388
- `,w+=`File = *(BlankLine / Rule / RuleError)
389
- `,w+=`BlankLine = *(%d32/%d9) [comment] LineEnd
390
- `,w+=`Rule = RuleLookup owsp Alternation ((owsp LineEnd)
391
- `,w+=` / (LineEndError LineEnd))
392
- `,w+=`RuleLookup = RuleNameTest owsp DefinedAsTest
393
- `,w+=`RuleNameTest = RuleName/RuleNameError
394
- `,w+=`RuleName = alphanum
395
- `,w+=`RuleNameError = 1*(%d33-60/%d62-126)
396
- `,w+=`DefinedAsTest = DefinedAs / DefinedAsError
397
- `,w+=`DefinedAsError = 1*2%d33-126
398
- `,w+=`DefinedAs = IncAlt / Defined
399
- `,w+=`Defined = %d61
400
- `,w+=`IncAlt = %d61.47
401
- `,w+=`RuleError = 1*(%d32-126 / %d9 / LineContinue) LineEnd
402
- `,w+=`LineEndError = 1*(%d32-126 / %d9 / LineContinue)
403
- `,w+=`Alternation = Concatenation *(owsp AltOp Concatenation)
404
- `,w+=`Concatenation = Repetition *(CatOp Repetition)
405
- `,w+=`Repetition = [Modifier] (Group / Option / BasicElement / BasicElementErr)
406
- `,w+=`Modifier = (Predicate [RepOp])
407
- `,w+=` / RepOp
408
- `,w+=`Predicate = BkaOp
409
- `,w+=` / BknOp
410
- `,w+=` / AndOp
411
- `,w+=` / NotOp
412
- `,w+=`BasicElement = UdtOp
413
- `,w+=` / RnmOp
414
- `,w+=` / TrgOp
415
- `,w+=` / TbsOp
416
- `,w+=` / TlsOp
417
- `,w+=` / ClsOp
418
- `,w+=` / BkrOp
419
- `,w+=` / AbgOp
420
- `,w+=` / AenOp
421
- `,w+=` / ProsVal
422
- `,w+=`BasicElementErr = 1*(%d33-40/%d42-46/%d48-92/%d94-126)
423
- `,w+=`Group = GroupOpen Alternation (GroupClose / GroupError)
424
- `,w+=`GroupError = 1*(%d33-40/%d42-46/%d48-92/%d94-126) ; same as BasicElementErr
425
- `,w+=`GroupOpen = %d40 owsp
426
- `,w+=`GroupClose = owsp %d41
427
- `,w+=`Option = OptionOpen Alternation (OptionClose / OptionError)
428
- `,w+=`OptionError = 1*(%d33-40/%d42-46/%d48-92/%d94-126) ; same as BasicElementErr
429
- `,w+=`OptionOpen = %d91 owsp
430
- `,w+=`OptionClose = owsp %d93
431
- `,w+=`RnmOp = alphanum
432
- `,w+=`BkrOp = %d92 [bkrModifier] bkr-name
433
- `,w+=`bkrModifier = (cs [um / pm]) / (ci [um / pm]) / (um [cs /ci]) / (pm [cs / ci])
434
- `,w+=`cs = '%s'
435
- `,w+=`ci = '%i'
436
- `,w+=`um = '%u'
437
- `,w+=`pm = '%p'
438
- `,w+=`bkr-name = uname / ename / rname
439
- `,w+=`rname = alphanum
440
- `,w+=`uname = %d117.95 alphanum
441
- `,w+=`ename = %d101.95 alphanum
442
- `,w+=`UdtOp = udt-empty
443
- `,w+=` / udt-non-empty
444
- `,w+=`udt-non-empty = %d117.95 alphanum
445
- `,w+=`udt-empty = %d101.95 alphanum
446
- `,w+=`RepOp = (rep-min StarOp rep-max)
447
- `,w+=` / (rep-min StarOp)
448
- `,w+=` / (StarOp rep-max)
449
- `,w+=` / StarOp
450
- `,w+=` / rep-min-max
451
- `,w+=`AltOp = %d47 owsp
452
- `,w+=`CatOp = wsp
453
- `,w+=`StarOp = %d42
454
- `,w+=`AndOp = %d38
455
- `,w+=`NotOp = %d33
456
- `,w+=`BkaOp = %d38.38
457
- `,w+=`BknOp = %d33.33
458
- `,w+=`AbgOp = %d37.94
459
- `,w+=`AenOp = %d37.36
460
- `,w+=`TrgOp = %d37 ((Dec dmin %d45 dmax) / (Hex xmin %d45 xmax) / (Bin bmin %d45 bmax))
461
- `,w+=`TbsOp = %d37 ((Dec dString *(%d46 dString)) / (Hex xString *(%d46 xString)) / (Bin bString *(%d46 bString)))
462
- `,w+=`TlsOp = TlsCase TlsOpen TlsString TlsClose
463
- `,w+=`TlsCase = ["%i" / "%s"]
464
- `,w+=`TlsOpen = %d34
465
- `,w+=`TlsClose = %d34
466
- `,w+=`TlsString = *(%d32-33/%d35-126/StringTab)
467
- `,w+=`StringTab = %d9
468
- `,w+=`ClsOp = ClsOpen ClsString ClsClose
469
- `,w+=`ClsOpen = %d39
470
- `,w+=`ClsClose = %d39
471
- `,w+=`ClsString = *(%d32-38/%d40-126/StringTab)
472
- `,w+=`ProsVal = ProsValOpen ProsValString ProsValClose
473
- `,w+=`ProsValOpen = %d60
474
- `,w+=`ProsValString = *(%d32-61/%d63-126/StringTab)
475
- `,w+=`ProsValClose = %d62
476
- `,w+=`rep-min = rep-num
477
- `,w+=`rep-min-max = rep-num
478
- `,w+=`rep-max = rep-num
479
- `,w+=`rep-num = 1*(%d48-57)
480
- `,w+=`dString = dnum
481
- `,w+=`xString = xnum
482
- `,w+=`bString = bnum
483
- `,w+=`Dec = (%d68/%d100)
484
- `,w+=`Hex = (%d88/%d120)
485
- `,w+=`Bin = (%d66/%d98)
486
- `,w+=`dmin = dnum
487
- `,w+=`dmax = dnum
488
- `,w+=`bmin = bnum
489
- `,w+=`bmax = bnum
490
- `,w+=`xmin = xnum
491
- `,w+=`xmax = xnum
492
- `,w+=`dnum = 1*(%d48-57)
493
- `,w+=`bnum = 1*%d48-49
494
- `,w+=`xnum = 1*(%d48-57 / %d65-70 / %d97-102)
495
- `,w+=`;
496
- `,w+=`; Basics
497
- `,w+=`alphanum = (%d97-122/%d65-90) *(%d97-122/%d65-90/%d48-57/%d45)
498
- `,w+=`owsp = *space
499
- `,w+=`wsp = 1*space
500
- `,w+=`space = %d32
501
- `,w+=` / %d9
502
- `,w+=` / comment
503
- `,w+=` / LineContinue
504
- `,w+=`comment = %d59 *(%d32-126 / %d9)
505
- `,w+=`LineEnd = %d13.10
506
- `,w+=` / %d10
507
- `,w+=` / %d13
508
- `,w+=`LineContinue = (%d13.10 / %d10 / %d13) (%d32 / %d9)
509
- `,w}}),sabnfGrammar}var parser,hasRequiredParser;function requireParser(){return hasRequiredParser||(hasRequiredParser=1,parser=function(){const v="parser: ",w=nodeExports,_=w.ids,A=new(requireSyntaxCallbacks()),E=new(requireSemanticCallbacks()),k=new(requireSabnfGrammar()),P=new w.parser;P.ast=new w.ast,P.callbacks=A.callbacks,P.ast.callbacks=E.callbacks;const N=function(I,D,V){if(D<0||D>=V)return-1;for(let ee=0;ee<I.length;ee+=1)if(D>=I[ee].beginChar&&D<I[ee].beginChar+I[ee].length)return ee;return-1},q=function(I,D){let V=-1;if(D<I.length){for(let ee=D;ee<I.length;ee+=1)if(I[ee]!==null){V=I[ee];break}}return V},B=function(I){I.forEach(D=>{const V=[],ee=[];let J=0;D.opcodes.forEach(te=>{te.type===_.ALT&&te.children.length===1||te.type===_.CAT&&te.children.length===1||te.type===_.REP&&te.min===1&&te.max===1?ee.push(null):(ee.push(J),V.push(te),J+=1)}),ee.push(J),V.forEach(te=>{if(te.type===_.ALT||te.type===_.CAT)for(let se=0;se<te.children.length;se+=1)te.children[se]=q(ee,te.children[se])}),D.opcodes=V})};this.syntax=function(I,D,V,ee,J,te){if(te){if(te.traceObject!=="traceObject")throw new TypeError(`${v}trace argument is not a trace object`);P.trace=te}const se={};se.errors=V,se.strict=!!ee,se.lite=!!J,se.lines=D,se.findLine=N,se.charsLength=I.length,se.ruleCount=0,P.parse(k,"file",I,se).success||V.push({line:0,char:0,msg:"syntax analysis of input grammar failed"})},this.semantic=function(I,D,V){const ee={};return ee.errors=V,ee.lines=D,ee.findLine=N,ee.charsLength=I.length,P.ast.translate(ee),V.length?null:(B(ee.rules),{rules:ee.rules,udts:ee.udts,lineMap:ee.rulesLineMap})},this.generateSource=function(I,D,V,ee,J){let te="",se=!1,ce=!1;J&&(J.typescript?(se=!0,ce=!1):J.lite&&(se=!1,ce=!0));let ae,he,oe,de=0,le=1/0,be=0;const pe=[],fe=[];let Z=0,U=0,S=0,C=0,F=0,X=0,re=0,ie=0,Q=0,ne=0,L=0,ue=0,Ae=0,Re=0,Pe=0;V.forEach(ge=>{pe.push(ge.lower),de+=ge.opcodes.length,ge.opcodes.forEach(_e=>{switch(_e.type){case _.ALT:Z+=1;break;case _.CAT:U+=1;break;case _.RNM:S+=1;break;case _.UDT:C+=1;break;case _.REP:F+=1;break;case _.AND:X+=1;break;case _.NOT:re+=1;break;case _.BKA:ue+=1;break;case _.BKN:Ae+=1;break;case _.BKR:L+=1;break;case _.ABG:Re+=1;break;case _.AEN:Pe+=1;break;case _.TLS:for(ie+=1,ae=0;ae<_e.string.length;ae+=1)_e.string[ae]<le&&(le=_e.string[ae]),_e.string[ae]>be&&(be=_e.string[ae]);break;case _.TBS:for(Q+=1,ae=0;ae<_e.string.length;ae+=1)_e.string[ae]<le&&(le=_e.string[ae]),_e.string[ae]>be&&(be=_e.string[ae]);break;case _.TRG:ne+=1,_e.min<le&&(le=_e.min),_e.max>be&&(be=_e.max);break;default:throw new Error("generateSource: unrecognized opcode")}})}),pe.sort(),ee.length>0&&(ee.forEach(ge=>{fe.push(ge.lower)}),fe.sort()),te+=`// copyright: Copyright (c) 2024 Lowell D. Thomas, all rights reserved<br>
510
- `,te+=`// license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)<br>
511
- `,te+=`//
512
- `,te+=`// Generated by apg-js, Version 4.4.0 [apg-js](https://github.com/ldthomas/apg-js)
513
- `,J?J.funcName?te+=`const ${J.funcName} = function grammar(){
514
- `:se?te+=`export function grammar(){
515
- `:ce?te+=`export default function grammar(){
516
- `:te+=`module.exports = function grammar(){
517
- `:te+=`module.exports = function grammar(){
518
- `,te+=" // ```\n",te+=` // SUMMARY
519
- `,te+=` // rules = ${V.length}
520
- `,te+=` // udts = ${ee.length}
521
- `,te+=` // opcodes = ${de}
522
- `,te+=` // --- ABNF original opcodes
523
- `,te+=` // ALT = ${Z}
524
- `,te+=` // CAT = ${U}
525
- `,te+=` // REP = ${F}
526
- `,te+=` // RNM = ${S}
527
- `,te+=` // TLS = ${ie}
528
- `,te+=` // TBS = ${Q}
529
- `,te+=` // TRG = ${ne}
530
- `,te+=` // --- SABNF superset opcodes
531
- `,te+=` // UDT = ${C}
532
- `,te+=` // AND = ${X}
533
- `,te+=` // NOT = ${re}
534
- `,ce||(te+=` // BKA = ${ue}
535
- `,te+=` // BKN = ${Ae}
536
- `,te+=` // BKR = ${L}
537
- `,te+=` // ABG = ${Re}
538
- `,te+=` // AEN = ${Pe}
539
- `),te+=" // characters = [",ie+Q+ne===0?te+=" none defined ]":te+=`${le} - ${be}]`,C>0&&(te+=" + user defined"),te+=`
540
- `,te+=" // ```\n",te+=` /* OBJECT IDENTIFIER (for internal parser use) */
541
- `,te+=` this.grammarObject = 'grammarObject';
542
- `,te+=`
543
- `,te+=` /* RULES */
544
- `,te+=` this.rules = [];
545
- `,V.forEach((ge,_e)=>{let ke=" this.rules[";ke+=_e,ke+="] = { name: '",ke+=ge.name,ke+="', lower: '",ke+=ge.lower,ke+="', index: ",ke+=ge.index,ke+=", isBkr: ",ke+=ge.isBkr,ke+=` };
546
- `,te+=ke}),te+=`
547
- `,te+=` /* UDTS */
548
- `,te+=` this.udts = [];
549
- `,ee.length>0&&ee.forEach((ge,_e)=>{let ke=" this.udts[";ke+=_e,ke+="] = { name: '",ke+=ge.name,ke+="', lower: '",ke+=ge.lower,ke+="', index: ",ke+=ge.index,ke+=", empty: ",ke+=ge.empty,ke+=", isBkr: ",ke+=ge.isBkr,ke+=` };
550
- `,te+=ke}),te+=`
551
- `,te+=` /* OPCODES */
552
- `,V.forEach((ge,_e)=>{_e>0&&(te+=`
553
- `),te+=` /* ${ge.name} */
554
- `,te+=` this.rules[${_e}].opcodes = [];
555
- `,ge.opcodes.forEach((ke,Ee)=>{let Se;switch(ke.type){case _.ALT:te+=` this.rules[${_e}].opcodes[${Ee}] = { type: ${ke.type}, children: [${ke.children.toString()}] };// ALT
556
- `;break;case _.CAT:te+=` this.rules[${_e}].opcodes[${Ee}] = { type: ${ke.type}, children: [${ke.children.toString()}] };// CAT
557
- `;break;case _.RNM:te+=` this.rules[${_e}].opcodes[${Ee}] = { type: ${ke.type}, index: ${ke.index} };// RNM(${V[ke.index].name})
558
- `;break;case _.BKR:ke.index>=V.length?(he=ee[ke.index-V.length].name,oe=ee[ke.index-V.length].lower):(he=V[ke.index].name,oe=V[ke.index].lower),Se="%i",ke.bkrCase===_.BKR_MODE_CS&&(Se="%s"),ke.bkrMode===_.BKR_MODE_UM?Se+="%u":Se+="%p",he=Se+he,te+=` this.rules[${_e}].opcodes[${Ee}] = { type: ${ke.type}, index: ${ke.index}, lower: '${oe}', bkrCase: ${ke.bkrCase}, bkrMode: ${ke.bkrMode} };// BKR(\\${he})
559
- `;break;case _.UDT:te+=` this.rules[${_e}].opcodes[${Ee}] = { type: ${ke.type}, empty: ${ke.empty}, index: ${ke.index} };// UDT(${ee[ke.index].name})
560
- `;break;case _.REP:te+=` this.rules[${_e}].opcodes[${Ee}] = { type: ${ke.type}, min: ${ke.min}, max: ${ke.max} };// REP
561
- `;break;case _.AND:te+=` this.rules[${_e}].opcodes[${Ee}] = { type: ${ke.type} };// AND
562
- `;break;case _.NOT:te+=` this.rules[${_e}].opcodes[${Ee}] = { type: ${ke.type} };// NOT
563
- `;break;case _.ABG:te+=` this.rules[${_e}].opcodes[${Ee}] = { type: ${ke.type} };// ABG(%^)
564
- `;break;case _.AEN:te+=` this.rules[${_e}].opcodes[${Ee}] = { type: ${ke.type} };// AEN(%$)
565
- `;break;case _.BKA:te+=` this.rules[${_e}].opcodes[${Ee}] = { type: ${ke.type} };// BKA
566
- `;break;case _.BKN:te+=` this.rules[${_e}].opcodes[${Ee}] = { type: ${ke.type} };// BKN
567
- `;break;case _.TLS:te+=` this.rules[${_e}].opcodes[${Ee}] = { type: ${ke.type}, string: [${ke.string.toString()}] };// TLS
568
- `;break;case _.TBS:te+=` this.rules[${_e}].opcodes[${Ee}] = { type: ${ke.type}, string: [${ke.string.toString()}] };// TBS
569
- `;break;case _.TRG:te+=` this.rules[${_e}].opcodes[${Ee}] = { type: ${ke.type}, min: ${ke.min}, max: ${ke.max} };// TRG
570
- `;break;default:throw new Error("parser.js: ~143: unrecognized opcode")}})}),te+=`
571
- `,te+=" // The `toString()` function will display the original grammar file(s) that produced these opcodes.\n",te+=` this.toString = function toString(){
572
- `,te+=` let str = "";
573
- `;let xe;return D.forEach(ge=>{const _e=ge.beginChar+ge.length;xe="",te+=' str += "';for(let ke=ge.beginChar;ke<_e;ke+=1){switch(I[ke]){case 9:xe=" ";break;case 10:xe="\\n";break;case 13:xe="\\r";break;case 34:xe='\\"';break;case 92:xe="\\\\";break;default:xe=String.fromCharCode(I[ke]);break}te+=xe}te+=`";
574
- `}),te+=` return str;
575
- `,te+=` }
576
- `,te+=`}
577
- `,te},this.generateObject=function(I,D,V){const ee={},J=[],te=[],se=I.slice(0);return ee.grammarObject="grammarObject",D.forEach(ce=>{J.push(ce.lower)}),J.sort(),V.length>0&&(V.forEach(ce=>{te.push(ce.lower)}),te.sort()),ee.callbacks=[],J.forEach(ce=>{ee.callbacks[ce]=!1}),V.length>0&&te.forEach(ce=>{ee.callbacks[ce]=!1}),ee.rules=D,ee.udts=V,ee.toString=function(){return se},ee}}),parser}var ruleAttributes,hasRequiredRuleAttributes;function requireRuleAttributes(){return hasRequiredRuleAttributes||(hasRequiredRuleAttributes=1,ruleAttributes=function(){const v=identifiers,w="rule-attributes.js";let _=null;function A(pe){return pe.left||pe.nested||pe.right||pe.cyclic?!1:pe.empty}function E(pe){return!!(pe.left||pe.nested||pe.right||pe.cyclic)}function k(pe,fe){let Z=0,U=0,S=0;for(Z=0;Z<fe;Z+=1)if(pe[Z].nested)return!0;for(Z=0;Z<fe;Z+=1)if(pe[Z].right&&!pe[Z].leaf){for(U=Z+1;U<fe;U+=1)if(!A(pe[U]))return!0}for(Z=fe-1;Z>=0;Z-=1)if(pe[Z].left&&!pe[Z].leaf){for(U=Z-1;U>=0;U-=1)if(!A(pe[U]))return!0}for(Z=0;Z<fe;Z+=1)if(!pe[Z].empty&&!E(pe[Z])){for(U=Z+1;U<fe;U+=1)if(E(pe[U])){for(S=U+1;S<fe;S+=1)if(!pe[S].empty&&!E(pe[S]))return!0}}return!1}function P(pe,fe){for(let Z=0;Z<fe;Z+=1)if(!pe[Z].cyclic)return!1;return!0}function N(pe,fe){for(let Z=0;Z<fe;Z+=1){if(pe[Z].left)return!0;if(!pe[Z].empty)return!1}return!1}function q(pe,fe){for(let Z=fe-1;Z>=0;Z-=1){if(pe[Z].right)return!0;if(!pe[Z].empty)return!1}return!1}function B(pe,fe){for(let Z=0;Z<fe;Z+=1)if(!pe[Z].empty)return!1;return!0}function O(pe,fe){for(let Z=0;Z<fe;Z+=1)if(!pe[Z].finite)return!1;return!0}function I(pe,fe,Z,U){let S=0;const C=fe[Z],F=C.children.length,X=[];for(S=0;S<F;S+=1)X.push(pe.attrGen());for(S=0;S<F;S+=1)ee(pe,fe,C.children[S],X[S]);U.left=N(X,F),U.right=q(X,F),U.nested=k(X,F),U.empty=B(X,F),U.finite=O(X,F),U.cyclic=P(X,F)}function D(pe,fe,Z,U){let S=0;const C=fe[Z],F=C.children.length,X=[];for(S=0;S<F;S+=1)X.push(pe.attrGen());for(S=0;S<F;S+=1)ee(pe,fe,C.children[S],X[S]);for(U.left=!1,U.right=!1,U.nested=!1,U.empty=!1,U.finite=!1,U.cyclic=!1,S=0;S<F;S+=1)X[S].left&&(U.left=!0),X[S].nested&&(U.nested=!0),X[S].right&&(U.right=!0),X[S].empty&&(U.empty=!0),X[S].finite&&(U.finite=!0),X[S].cyclic&&(U.cyclic=!0)}function V(pe,fe,Z,U){const S=fe[Z];S.index>=pe.ruleCount?(U.empty=pe.udts[S.index-pe.ruleCount].empty,U.finite=!0):(J(pe,S.index,U),U.left=!1,U.nested=!1,U.right=!1,U.cyclic=!1)}function ee(pe,fe,Z,U){pe.attrInit(U);const S=fe[Z];switch(S.type){case v.ALT:D(pe,fe,Z,U);break;case v.CAT:I(pe,fe,Z,U);break;case v.REP:ee(pe,fe,Z+1,U),S.min===0&&(U.empty=!0,U.finite=!0);break;case v.RNM:J(pe,fe[Z].index,U);break;case v.BKR:V(pe,fe,Z,U);break;case v.AND:case v.NOT:case v.BKA:case v.BKN:ee(pe,fe,Z+1,U),U.empty=!0;break;case v.TLS:U.empty=!fe[Z].string.length,U.finite=!0,U.cyclic=!1;break;case v.TBS:case v.TRG:U.empty=!1,U.finite=!0,U.cyclic=!1;break;case v.UDT:U.empty=S.empty,U.finite=!0,U.cyclic=!1;break;case v.ABG:case v.AEN:U.empty=!0,U.finite=!0,U.cyclic=!1;break;default:throw new Error(`unknown opcode type: ${S}`)}}function J(pe,fe,Z){const U=pe.attrsWorking[fe];U.isComplete?pe.attrCopy(Z,U):U.isOpen?fe===pe.startRule?fe===pe.startRule&&(Z.left=!0,Z.right=!0,Z.cyclic=!0,Z.leaf=!0):Z.finite=!0:(U.isOpen=!0,ee(pe,U.rule.opcodes,0,Z),U.left=Z.left,U.right=Z.right,U.nested=Z.nested,U.empty=Z.empty,U.finite=Z.finite,U.cyclic=Z.cyclic,U.leaf=!1,U.isOpen=!1,U.isComplete=!0)}const te=pe=>{_=pe;let fe=0,Z=0;const U=_.attrGen();for(fe=0;fe<_.ruleCount;fe+=1){for(Z=0;Z<_.ruleCount;Z+=1)_.attrInit(_.attrsWorking[Z]);_.startRule=fe,J(_,fe,U),_.attrCopy(_.attrs[fe],_.attrsWorking[fe])}_.attributesComplete=!0;let S=null;for(fe=0;fe<_.ruleCount;fe+=1)if(S=_.attrs[fe],S.left||!S.finite||S.cyclic){const C=_.attrGen(S.rule);_.attrCopy(C,S),_.attrsErrors.push(C),_.attrsErrorCount+=1}},se=pe=>pe?"t":"f",ce=pe=>pe?"e":"f",ae=pe=>pe?"t":"e",he=(pe,fe,Z,U)=>{let S=`${pe}:${fe}:`;return S+=`${ce(Z.left)} `,S+=`${se(Z.nested)} `,S+=`${se(Z.right)} `,S+=`${ce(Z.cyclic)} `,S+=`${ae(Z.finite)} `,S+=`${se(Z.empty)}:`,S+=`${_.typeToString(U.recursiveType)}:`,S+=U.recursiveType===v.ATTR_MR?U.groupNumber:"-",S+=`:${Z.rule.name}
578
- `,S},oe=()=>{let pe=`LEGEND - t=true, f=false, e=error
579
- `;return pe+=`sequence:rule index:left nested right cyclic finite empty:type:group number:rule name
580
- `,pe},de=()=>{let pe=null,fe=null,Z="";if(Z+=`RULE ATTRIBUTES WITH ERRORS
581
- `,Z+=oe(),_.attrsErrorCount)for(let U=0;U<_.attrsErrorCount;U+=1)pe=_.attrsErrors[U],fe=_.ruleDeps[pe.rule.index],Z+=he(U,pe.rule.index,pe,fe);else Z+=`<none>
582
- `;return Z},le=pe=>{let fe=0,Z=0,U=null,S=null,C="",{ruleIndexes:F}=_;for(pe===97?F=_.ruleAlphaIndexes:pe===116&&(F=_.ruleTypeIndexes),fe=0;fe<_.ruleCount;fe+=1)Z=F[fe],U=_.attrs[Z],S=_.ruleDeps[Z],C+=he(fe,Z,U,S);return C};return{ruleAttributes:te,showAttributes:(pe="index")=>{if(!_.attributesComplete)throw new Error(`${w}:showAttributes: attributes not available`);let fe="";const Z=`RULE ATTRIBUTES
583
- `;return pe.charCodeAt(0)===97?(fe+=`alphabetical by rule name
584
- `,fe+=Z,fe+=oe(),fe+=le(97)):pe.charCodeAt(0)===116?(fe+=`ordered by rule type
585
- `,fe+=Z,fe+=oe(),fe+=le(116)):(fe+=`ordered by rule index
586
- `,fe+=Z,fe+=oe(),fe+=le()),fe},showAttributeErrors:de}}()),ruleAttributes}var ruleDependencies,hasRequiredRuleDependencies;function requireRuleDependencies(){return hasRequiredRuleDependencies||(hasRequiredRuleDependencies=1,ruleDependencies=(()=>{const b=identifiers;let v=null;const w=(k,P,N,q)=>{let B=0,O=0;const I=P[N];q[N]=!0;const D=I.rule.opcodes;for(B=0;B<D.length;B+=1){const V=D[B];if(V.type===b.RNM)for(I.refersTo[V.index]=!0,q[V.index]||w(k,P,V.index,q),O=0;O<k;O+=1)P[V.index].refersTo[O]&&(I.refersTo[O]=!0);else V.type===b.UDT?I.refersToUdt[V.index]=!0:V.type===b.BKR&&(V.index<k?(I.refersTo[V.index]=!0,q[V.index]||w(k,P,V.index,q)):I.refersToUdt[k-V.index]=!0)}},_=k=>{v=k;let P=0,N=0,q=0,B=null,O=null,I=!1;v.dependenciesComplete=!1;const D=v.falseArray(v.ruleCount);for(P=0;P<v.ruleCount;P+=1)v.falsifyArray(D),w(v.ruleCount,v.ruleDeps,P,D);for(P=0;P<v.ruleCount;P+=1)for(N=0;N<v.ruleCount;N+=1)P!==N&&v.ruleDeps[N].refersTo[P]&&(v.ruleDeps[P].referencedBy[N]=!0);for(P=0;P<v.ruleCount;P+=1)v.ruleDeps[P].recursiveType=b.ATTR_N,v.ruleDeps[P].refersTo[P]&&(v.ruleDeps[P].recursiveType=b.ATTR_R);for(q=-1,P=0;P<v.ruleCount;P+=1)if(B=v.ruleDeps[P],B.recursiveType===b.ATTR_R)for(I=!0,N=0;N<v.ruleCount;N+=1)P!==N&&(O=v.ruleDeps[N],O.recursiveType===b.ATTR_R&&B.refersTo[N]&&O.refersTo[P]&&(I&&(q+=1,B.recursiveType=b.ATTR_MR,B.groupNumber=q,I=!1),O.recursiveType=b.ATTR_MR,O.groupNumber=q));v.isMutuallyRecursive=q>-1,v.ruleAlphaIndexes.sort(v.compRulesAlpha),v.ruleTypeIndexes.sort(v.compRulesAlpha),v.ruleTypeIndexes.sort(v.compRulesType),v.isMutuallyRecursive&&v.ruleTypeIndexes.sort(v.compRulesGroup),v.udtCount&&v.udtAlphaIndexes.sort(v.compUdtsAlpha),v.dependenciesComplete=!0},A=(k=null)=>{let P=0,N=0,q=0,B=0;const O=v.ruleCount-1,I=v.udtCount-1,D=100;let V="",ee="";const J="=> ",te="<= ";let se=!1,ce=null,{ruleIndexes:ae}=v,{udtIndexes:he}=v;for(k===97?(ae=v.ruleAlphaIndexes,he=v.udtAlphaIndexes):k===116&&(ae=v.ruleTypeIndexes,he=v.udtAlphaIndexes),P=0;P<v.ruleCount;P+=1){for(ce=v.ruleDeps[ae[P]],ee=`${ae[P]}:${v.typeToString(ce.recursiveType)}:`,v.isMutuallyRecursive&&(ee+=ce.groupNumber>-1?ce.groupNumber:"-",ee+=":"),ee+=" ",V+=`${ee+v.rules[ae[P]].name}
587
- `,se=!0,q=0,B=V.length,V+=ee,N=0;N<v.ruleCount;N+=1)ce.refersTo[ae[N]]&&(se?(V+=J,se=!1,V+=v.ruleDeps[ae[N]].rule.name):V+=`, ${v.ruleDeps[ae[N]].rule.name}`,q+=1),V.length-B>D&&N!==O&&(V+=`
588
- ${ee}${J}`,B=V.length);if(v.udtCount)for(N=0;N<v.udtCount;N+=1)ce.refersToUdt[he[N]]&&(se?(V+=J,se=!1,V+=v.udts[he[N]].name):V+=`, ${v.udts[he[N]].name}`,q+=1),V.length-B>D&&N!==I&&(V+=`
589
- ${ee}${J}`,B=V.length);for(q===0&&(V+=`=> <none>
590
- `),se===!1&&(V+=`
591
- `),se=!0,q=0,B=V.length,V+=ee,N=0;N<v.ruleCount;N+=1)ce.referencedBy[ae[N]]&&(se?(V+=te,se=!1,V+=v.ruleDeps[ae[N]].rule.name):V+=`, ${v.ruleDeps[ae[N]].rule.name}`,q+=1),V.length-B>D&&N!==O&&(V+=`
592
- ${ee}${J}`,B=V.length);q===0&&(V+=`<= <none>
593
- `),se===!1&&(V+=`
594
- `),V+=`
595
- `}return V};return{ruleDependencies:_,showRuleDependencies:(k="index")=>{let P=`RULE DEPENDENCIES(index:type:[group number:])
596
- `;return P+=`=> refers to rule names
597
- `,P+=`<= referenced by rule names
598
- `,v.dependenciesComplete&&(k.charCodeAt(0)===97?(P+=`alphabetical by rule name
599
- `,P+=A(97)):k.charCodeAt(0)===116?(P+=`ordered by rule type
600
- `,P+=A(116)):(P+=`ordered by rule index
601
- `,P+=A(null))),P}}})()),ruleDependencies}var attributes,hasRequiredAttributes;function requireAttributes(){return hasRequiredAttributes||(hasRequiredAttributes=1,attributes=function(){const v=identifiers,{ruleAttributes:w,showAttributes:_,showAttributeErrors:A}=requireRuleAttributes(),{ruleDependencies:E,showRuleDependencies:k}=requireRuleDependencies();class P{constructor(B,O){this.rules=B,this.udts=O,this.ruleCount=B.length,this.udtCount=O.length,this.startRule=0,this.dependenciesComplete=!1,this.attributesComplete=!1,this.isMutuallyRecursive=!1,this.ruleIndexes=this.indexArray(this.ruleCount),this.ruleAlphaIndexes=this.indexArray(this.ruleCount),this.ruleTypeIndexes=this.indexArray(this.ruleCount),this.udtIndexes=this.indexArray(this.udtCount),this.udtAlphaIndexes=this.indexArray(this.udtCount),this.attrsErrorCount=0,this.attrs=[],this.attrsErrors=[],this.attrsWorking=[],this.ruleDeps=[];for(let I=0;I<this.ruleCount;I+=1)this.attrs.push(this.attrGen(this.rules[I])),this.attrsWorking.push(this.attrGen(this.rules[I])),this.ruleDeps.push(this.rdGen(B[I],this.ruleCount,this.udtCount));this.compRulesAlpha=this.compRulesAlpha.bind(this),this.compUdtsAlpha=this.compUdtsAlpha.bind(this),this.compRulesType=this.compRulesType.bind(this),this.compRulesGroup=this.compRulesGroup.bind(this)}attrGen(B){return{left:!1,nested:!1,right:!1,empty:!1,finite:!1,cyclic:!1,leaf:!1,isOpen:!1,isComplete:!1,rule:B}}attrInit(B){B.left=!1,B.nested=!1,B.right=!1,B.empty=!1,B.finite=!1,B.cyclic=!1,B.leaf=!1,B.isOpen=!1,B.isComplete=!1}attrCopy(B,O){B.left=O.left,B.nested=O.nested,B.right=O.right,B.empty=O.empty,B.finite=O.finite,B.cyclic=O.cyclic,B.leaf=O.leaf,B.isOpen=O.isOpen,B.isComplete=O.isComplete,B.rule=O.rule}rdGen(B,O,I){return{rule:B,recursiveType:v.ATTR_N,groupNumber:-1,refersTo:this.falseArray(O),refersToUdt:this.falseArray(I),referencedBy:this.falseArray(O)}}typeToString(B){switch(B){case v.ATTR_N:return" N";case v.ATTR_R:return" R";case v.ATTR_MR:return"MR";default:return"UNKNOWN"}}falseArray(B){const O=[];if(B>0)for(let I=0;I<B;I+=1)O.push(!1);return O}falsifyArray(B){for(let O=0;O<B.length;O+=1)B[O]=!1}indexArray(B){const O=[];if(B>0)for(let I=0;I<B;I+=1)O.push(I);return O}compRulesAlpha(B,O){return this.rules[B].lower<this.rules[O].lower?-1:this.rules[B].lower>this.rules[O].lower?1:0}compUdtsAlpha(B,O){return this.udts[B].lower<this.udts[O].lower?-1:this.udts[B].lower>this.udts[O].lower?1:0}compRulesType(B,O){return this.ruleDeps[B].recursiveType<this.ruleDeps[O].recursiveType?-1:this.ruleDeps[B].recursiveType>this.ruleDeps[O].recursiveType?1:0}compRulesGroup(B,O){if(this.ruleDeps[B].recursiveType===v.ATTR_MR&&this.ruleDeps[O].recursiveType===v.ATTR_MR){if(this.ruleDeps[B].groupNumber<this.ruleDeps[O].groupNumber)return-1;if(this.ruleDeps[B].groupNumber>this.ruleDeps[O].groupNumber)return 1}return 0}}return{attributes:function(B=[],O=[],I=[],D=[]){const V=new P(B,O);return E(V),w(V),V.attrsErrorCount&&D.push({line:0,char:0,msg:`${V.attrsErrorCount} attribute errors`}),V.attrsErrorCount},showAttributes:_,showAttributeErrors:A,showRuleDependencies:k}}()),attributes}var showRules,hasRequiredShowRules;function requireShowRules(){return hasRequiredShowRules||(hasRequiredShowRules=1,showRules=function(){const v="show-rules.js";return function(A=[],E=[],k="index"){const P="showRules";let N=[],q=[];const B=[],O=[],I=A,D=E,V=A.length,ee=E.length;let J="RULE/UDT NAMES",te;function se(ae,he){return I[ae].lower<I[he].lower?-1:I[ae].lower>I[he].lower?1:0}function ce(ae,he){return D[ae].lower<D[he].lower?-1:D[ae].lower>D[he].lower?1:0}if(!(Array.isArray(A)&&A.length))throw new Error(`${v}:${P}: rules arg must be array with length > 0`);if(!Array.isArray(E))throw new Error(`${v}:${P}: udts arg must be array`);for(te=0;te<V;te+=1)B.push(te);if(N=B.slice(0),N.sort(se),ee){for(te=0;te<ee;te+=1)O.push(te);q=O.slice(0),q.sort(ce)}if(k.charCodeAt(0)===97){for(J+=` - alphabetical by rule/UDT name
602
- `,te=0;te<V;te+=1)J+=`${te}: ${N[te]}: ${I[N[te]].name}
603
- `;if(ee)for(te=0;te<ee;te+=1)J+=`${te}: ${q[te]}: ${D[q[te]].name}
604
- `}else{for(J+=` - ordered by rule/UDT index
605
- `,te=0;te<V;te+=1)J+=`${te}: ${I[te].name}
606
- `;if(ee)for(te=0;te<ee;te+=1)J+=`${te}: ${D[te].name}
607
- `}return J}}()),showRules}var api$1=function(v){const{Buffer:w}=require$$1$2,_="api.js: ",A=this,E=nodeExports,k=requireConverter(),P=requireScanner(),N=new(requireParser()),{attributes:q,showAttributes:B,showAttributeErrors:O,showRuleDependencies:I}=requireAttributes(),D=requireShowRules(),V=function(fe,Z,U){const X=`<span class="${E.style.CLASS_CTRLCHAR}">`,re="</span>",ie=`<span class="${E.style.CLASS_NOMATCH}">`,Q="</span>";let ne,L="";const ue=!0;for(;ue&&!(!Array.isArray(fe)||fe.length===0);){if(typeof Z!="number")throw new Error("abnfToHtml: beg must be type number");if(Z>=fe.length)break;typeof U!="number"||Z+U>=fe.length?ne=fe.length:ne=Z+U;let Ae=0;for(let Re=Z;Re<ne;Re+=1){const Pe=fe[Re];if(Pe>=32&&Pe<=126)switch(Ae===1?(L+=re,Ae=0):Ae===2&&(L+=Q,Ae=0),Pe){case 32:L+="&nbsp;";break;case 60:L+="&lt;";break;case 62:L+="&gt;";break;case 38:L+="&amp;";break;case 34:L+="&quot;";break;case 39:L+="&#039;";break;case 92:L+="&#092;";break;default:L+=String.fromCharCode(Pe);break}else Pe===9||Pe===10||Pe===13?(Ae===0?(L+=X,Ae=1):Ae===2&&(L+=Q+X,Ae=1),Pe===9&&(L+="TAB"),Pe===10&&(L+="LF"),Pe===13&&(L+="CR")):(Ae===0?(L+=ie,Ae=2):Ae===1&&(L+=re+ie,Ae=2),L+=`\\x${E.utils.charToHex(Pe)}`)}Ae===2&&(L+=Q),Ae===1&&(L+=re);break}return L},ee=function(fe,Z,U){let S="";for(let C=Z;C<Z+U;C+=1){const F=fe[C];if(F>=32&&F<=126)S+=String.fromCharCode(F);else switch(F){case 9:S+="\\t";break;case 10:S+="\\n";break;case 13:S+="\\r";break;default:S+="\\unknown";break}}return S},J=function(fe){let Z="Annotated Input Grammar";return fe.forEach(U=>{Z+=`
608
- `,Z+=`line no: ${U.lineNo}`,Z+=` : char index: ${U.beginChar}`,Z+=` : length: ${U.length}`,Z+=` : abnf: ${ee(A.chars,U.beginChar,U.length)}`}),Z+=`
609
- `,Z},te=function(fe){let Z="";return Z+=`<table class="${E.style.CLASS_GRAMMAR}">
610
- `,Z+=`<caption>Annotated Input Grammar</caption>
611
- `,Z+="<tr>",Z+="<th>line<br>no.</th><th>first<br>char</th><th><br>length</th><th><br>text</th>",Z+=`</tr>
612
- `,fe.forEach(S=>{Z+="<tr>",Z+=`<td>${S.lineNo}`,Z+=`</td><td>${S.beginChar}`,Z+=`</td><td>${S.length}`,Z+=`</td><td>${V(A.chars,S.beginChar,S.length)}`,Z+="</td>",Z+=`</tr>
613
- `}),Z+=`</table>
614
- `,Z},se=function(fe,Z,U,S){const[C]=E;let F="";const X=`<span class="${C.CLASS_NOMATCH}">&raquo;</span>`;return F+=`<p><table class="${C.CLASS_GRAMMAR}">
615
- `,S&&typeof S=="string"&&(F+=`<caption>${S}</caption>
616
- `),F+=`<tr><th>line<br>no.</th><th>line<br>offset</th><th>error<br>offset</th><th><br>text</th></tr>
617
- `,fe.forEach(re=>{let ie,Q,ne,L,ue,Ae="",Re="";Z.length===0?(ue=X,Q=0):(ie=Z[re.line],ne=ie.beginChar,re.char>ne&&(Ae=V(U,ne,re.char-ne)),ne=re.char,L=ie.beginChar+ie.length,ne<L&&(Re=V(U,ne,L-ne)),ue=Ae+X+Re,Q=re.char-ie.beginChar,F+="<tr>",F+=`<td>${re.line}</td><td>${ie.beginChar}</td><td>${Q}</td><td>${ue}</td>`,F+=`</tr>
618
- `,F+="<tr>",F+=`<td colspan="3"></td><td>&uarr;:&nbsp;${E.utils.stringToAsciiHtml(re.msg)}</td>`,F+=`</tr>
619
- `)}),F+=`</table></p>
620
- `,F},ce=function(fe,Z,U){let S,C,F,X;return S="",fe.forEach(re=>{C=Z[re.line],S+=`${C.lineNo}: `,S+=`${C.beginChar}: `,S+=`${re.char-C.beginChar}: `,F=C.beginChar,X=re.char-C.beginChar,S+=ee(U,F,X),S+=" >> ",F=re.char,X=C.beginChar+C.length-re.char,S+=ee(U,F,X),S+=`
621
- `,S+=`${C.lineNo}: `,S+=`${C.beginChar}: `,S+=`${re.char-C.beginChar}: `,S+="error: ",S+=re.msg,S+=`
622
- `}),S};let ae=!1,he=!1,oe=!1,de=!1,le=0,be;if(this.errors=[],w.isBuffer(v))this.chars=k.decode("BINARY",v);else if(Array.isArray(v))this.chars=v.slice();else if(typeof v=="string")this.chars=k.decode("STRING",v);else throw new Error(`${_}input source is not a string, byte Buffer or character array`);this.sabnf=k.encode("STRING",this.chars),this.scan=function(fe,Z){this.lines=P(this.chars,this.errors,fe,Z),ae=!0},this.parse=function(fe,Z,U){if(!ae)throw new Error(`${_}grammar not scanned`);N.syntax(this.chars,this.lines,this.errors,fe,Z,U),he=!0},this.translate=function(){if(!he)throw new Error(`${_}grammar not scanned and parsed`);const fe=N.semantic(this.chars,this.lines,this.errors);this.errors.length===0&&(this.rules=fe.rules,this.udts=fe.udts,be=fe.lineMap,oe=!0)},this.attributes=function(){if(!oe)throw new Error(`${_}grammar not scanned, parsed and translated`);return le=q(this.rules,this.udts,be,this.errors),de=!0,le},this.generate=function(fe){if(this.lines=P(this.chars,this.errors,fe),this.errors.length||(N.syntax(this.chars,this.lines,this.errors,fe),this.errors.length))return;const Z=N.semantic(this.chars,this.lines,this.errors);this.errors.length||(this.rules=Z.rules,this.udts=Z.udts,be=Z.lineMap,le=q(this.rules,this.udts,be,this.errors),de=!0)},this.displayRules=function(fe="index"){if(!oe)throw new Error(`${_}grammar not scanned, parsed and translated`);return D(this.rules,this.udts,fe)},this.displayRuleDependencies=function(fe="index"){if(!de)throw new Error(`${_}no attributes - must be preceeded by call to attributes()`);return I(fe)},this.displayAttributes=function(fe="index"){if(!de)throw new Error(`${_}no attributes - must be preceeded by call to attributes()`);return le&&O(fe),B(fe)},this.displayAttributeErrors=function(){if(!de)throw new Error(`${_}no attributes - must be preceeded by call to attributes()`);return O()},this.toSource=function(fe=void 0){if(!de)throw new Error(`${_}can't generate parser source - must be preceeded by call to attributes()`);if(le)throw new Error(`${_}can't generate parser source - attributes have ${le} errors`);return N.generateSource(this.chars,this.lines,this.rules,this.udts,fe)},this.toObject=function(){if(!de)throw new Error(`${_}can't generate parser source - must be preceeded by call to attributes()`);if(le)throw new Error(`${_}can't generate parser source - attributes have ${le} errors`);return N.generateObject(this.sabnf,this.rules,this.udts)},this.errorsToAscii=function(){return ce(this.errors,this.lines,this.chars)},this.errorsToHtml=function(fe){return se(this.errors,this.lines,this.chars,fe)},this.linesToAscii=function(){return J(this.lines)},this.linesToHtml=function(){return te(this.lines)}},utils$u={},sha3$1={},_assert$1={};Object.defineProperty(_assert$1,"__esModule",{value:!0});_assert$1.isBytes=isBytes;_assert$1.number=number$1;_assert$1.bool=bool;_assert$1.bytes=bytes$1;_assert$1.hash=hash$5;_assert$1.exists=exists;_assert$1.output=output;function number$1(b){if(!Number.isSafeInteger(b)||b<0)throw new Error(`positive integer expected, not ${b}`)}function bool(b){if(typeof b!="boolean")throw new Error(`boolean expected, not ${b}`)}function isBytes(b){return b instanceof Uint8Array||b!=null&&typeof b=="object"&&b.constructor.name==="Uint8Array"}function bytes$1(b,...v){if(!isBytes(b))throw new Error("Uint8Array expected");if(v.length>0&&!v.includes(b.length))throw new Error(`Uint8Array expected of length ${v}, not of length=${b.length}`)}function hash$5(b){if(typeof b!="function"||typeof b.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$1(b.outputLen),number$1(b.blockLen)}function exists(b,v=!0){if(b.destroyed)throw new Error("Hash instance has been destroyed");if(v&&b.finished)throw new Error("Hash#digest() has already been called")}function output(b,v){bytes$1(b);const w=v.outputLen;if(b.length<w)throw new Error(`digestInto() expects output buffer of length at least ${w}`)}const assert$l={number:number$1,bool,bytes:bytes$1,hash:hash$5,exists,output};_assert$1.default=assert$l;var _u64$1={};Object.defineProperty(_u64$1,"__esModule",{value:!0});_u64$1.add5L=_u64$1.add5H=_u64$1.add4H=_u64$1.add4L=_u64$1.add3H=_u64$1.add3L=_u64$1.rotlBL=_u64$1.rotlBH=_u64$1.rotlSL=_u64$1.rotlSH=_u64$1.rotr32L=_u64$1.rotr32H=_u64$1.rotrBL=_u64$1.rotrBH=_u64$1.rotrSL=_u64$1.rotrSH=_u64$1.shrSL=_u64$1.shrSH=_u64$1.toBig=void 0;_u64$1.fromBig=fromBig;_u64$1.split=split;_u64$1.add=add;const U32_MASK64=BigInt(2**32-1),_32n=BigInt(32);function fromBig(b,v=!1){return v?{h:Number(b&U32_MASK64),l:Number(b>>_32n&U32_MASK64)}:{h:Number(b>>_32n&U32_MASK64)|0,l:Number(b&U32_MASK64)|0}}function split(b,v=!1){let w=new Uint32Array(b.length),_=new Uint32Array(b.length);for(let A=0;A<b.length;A++){const{h:E,l:k}=fromBig(b[A],v);[w[A],_[A]]=[E,k]}return[w,_]}const toBig=(b,v)=>BigInt(b>>>0)<<_32n|BigInt(v>>>0);_u64$1.toBig=toBig;const shrSH=(b,v,w)=>b>>>w;_u64$1.shrSH=shrSH;const shrSL=(b,v,w)=>b<<32-w|v>>>w;_u64$1.shrSL=shrSL;const rotrSH=(b,v,w)=>b>>>w|v<<32-w;_u64$1.rotrSH=rotrSH;const rotrSL=(b,v,w)=>b<<32-w|v>>>w;_u64$1.rotrSL=rotrSL;const rotrBH=(b,v,w)=>b<<64-w|v>>>w-32;_u64$1.rotrBH=rotrBH;const rotrBL=(b,v,w)=>b>>>w-32|v<<64-w;_u64$1.rotrBL=rotrBL;const rotr32H=(b,v)=>v;_u64$1.rotr32H=rotr32H;const rotr32L=(b,v)=>b;_u64$1.rotr32L=rotr32L;const rotlSH=(b,v,w)=>b<<w|v>>>32-w;_u64$1.rotlSH=rotlSH;const rotlSL=(b,v,w)=>v<<w|b>>>32-w;_u64$1.rotlSL=rotlSL;const rotlBH=(b,v,w)=>v<<w-32|b>>>64-w;_u64$1.rotlBH=rotlBH;const rotlBL=(b,v,w)=>b<<w-32|v>>>64-w;_u64$1.rotlBL=rotlBL;function add(b,v,w,_){const A=(v>>>0)+(_>>>0);return{h:b+w+(A/2**32|0)|0,l:A|0}}const add3L=(b,v,w)=>(b>>>0)+(v>>>0)+(w>>>0);_u64$1.add3L=add3L;const add3H=(b,v,w,_)=>v+w+_+(b/2**32|0)|0;_u64$1.add3H=add3H;const add4L=(b,v,w,_)=>(b>>>0)+(v>>>0)+(w>>>0)+(_>>>0);_u64$1.add4L=add4L;const add4H=(b,v,w,_,A)=>v+w+_+A+(b/2**32|0)|0;_u64$1.add4H=add4H;const add5L=(b,v,w,_,A)=>(b>>>0)+(v>>>0)+(w>>>0)+(_>>>0)+(A>>>0);_u64$1.add5L=add5L;const add5H=(b,v,w,_,A,E)=>v+w+_+A+E+(b/2**32|0)|0;_u64$1.add5H=add5H;const u64={fromBig,split,toBig,shrSH,shrSL,rotrSH,rotrSL,rotrBH,rotrBL,rotr32H,rotr32L,rotlSH,rotlSL,rotlBH,rotlBL,add,add3L,add3H,add4L,add4H,add5H,add5L};_u64$1.default=u64;var utils$t={},crypto$4={};Object.defineProperty(crypto$4,"__esModule",{value:!0});crypto$4.crypto=void 0;crypto$4.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;(function(b){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(b,"__esModule",{value:!0}),b.Hash=b.nextTick=b.byteSwapIfBE=b.byteSwap=b.isLE=b.rotl=b.rotr=b.createView=b.u32=b.u8=void 0,b.isBytes=_,b.byteSwap32=B,b.bytesToHex=I,b.hexToBytes=ee,b.asyncLoop=te,b.utf8ToBytes=se,b.toBytes=ce,b.concatBytes=ae,b.checkOpts=de,b.wrapConstructor=le,b.wrapConstructorWithOpts=be,b.wrapXOFConstructorWithOpts=pe,b.randomBytes=fe;const v=crypto$4,w=_assert$1;function _(Z){return Z instanceof Uint8Array||Z!=null&&typeof Z=="object"&&Z.constructor.name==="Uint8Array"}const A=Z=>new Uint8Array(Z.buffer,Z.byteOffset,Z.byteLength);b.u8=A;const E=Z=>new Uint32Array(Z.buffer,Z.byteOffset,Math.floor(Z.byteLength/4));b.u32=E;const k=Z=>new DataView(Z.buffer,Z.byteOffset,Z.byteLength);b.createView=k;const P=(Z,U)=>Z<<32-U|Z>>>U;b.rotr=P;const N=(Z,U)=>Z<<U|Z>>>32-U>>>0;b.rotl=N,b.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const q=Z=>Z<<24&4278190080|Z<<8&16711680|Z>>>8&65280|Z>>>24&255;b.byteSwap=q,b.byteSwapIfBE=b.isLE?Z=>Z:Z=>(0,b.byteSwap)(Z);function B(Z){for(let U=0;U<Z.length;U++)Z[U]=(0,b.byteSwap)(Z[U])}const O=Array.from({length:256},(Z,U)=>U.toString(16).padStart(2,"0"));function I(Z){(0,w.bytes)(Z);let U="";for(let S=0;S<Z.length;S++)U+=O[Z[S]];return U}const D={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function V(Z){if(Z>=D._0&&Z<=D._9)return Z-D._0;if(Z>=D._A&&Z<=D._F)return Z-(D._A-10);if(Z>=D._a&&Z<=D._f)return Z-(D._a-10)}function ee(Z){if(typeof Z!="string")throw new Error("hex string expected, got "+typeof Z);const U=Z.length,S=U/2;if(U%2)throw new Error("padded hex string expected, got unpadded hex of length "+U);const C=new Uint8Array(S);for(let F=0,X=0;F<S;F++,X+=2){const re=V(Z.charCodeAt(X)),ie=V(Z.charCodeAt(X+1));if(re===void 0||ie===void 0){const Q=Z[X]+Z[X+1];throw new Error('hex string expected, got non-hex character "'+Q+'" at index '+X)}C[F]=re*16+ie}return C}const J=async()=>{};b.nextTick=J;async function te(Z,U,S){let C=Date.now();for(let F=0;F<Z;F++){S(F);const X=Date.now()-C;X>=0&&X<U||(await(0,b.nextTick)(),C+=X)}}function se(Z){if(typeof Z!="string")throw new Error(`utf8ToBytes expected string, got ${typeof Z}`);return new Uint8Array(new TextEncoder().encode(Z))}function ce(Z){return typeof Z=="string"&&(Z=se(Z)),(0,w.bytes)(Z),Z}function ae(...Z){let U=0;for(let C=0;C<Z.length;C++){const F=Z[C];(0,w.bytes)(F),U+=F.length}const S=new Uint8Array(U);for(let C=0,F=0;C<Z.length;C++){const X=Z[C];S.set(X,F),F+=X.length}return S}class he{clone(){return this._cloneInto()}}b.Hash=he;const oe={}.toString;function de(Z,U){if(U!==void 0&&oe.call(U)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(Z,U)}function le(Z){const U=C=>Z().update(ce(C)).digest(),S=Z();return U.outputLen=S.outputLen,U.blockLen=S.blockLen,U.create=()=>Z(),U}function be(Z){const U=(C,F)=>Z(F).update(ce(C)).digest(),S=Z({});return U.outputLen=S.outputLen,U.blockLen=S.blockLen,U.create=C=>Z(C),U}function pe(Z){const U=(C,F)=>Z(F).update(ce(C)).digest(),S=Z({});return U.outputLen=S.outputLen,U.blockLen=S.blockLen,U.create=C=>Z(C),U}function fe(Z=32){if(v.crypto&&typeof v.crypto.getRandomValues=="function")return v.crypto.getRandomValues(new Uint8Array(Z));if(v.crypto&&typeof v.crypto.randomBytes=="function")return v.crypto.randomBytes(Z);throw new Error("crypto.getRandomValues must be defined")}})(utils$t);Object.defineProperty(sha3$1,"__esModule",{value:!0});sha3$1.shake256=sha3$1.shake128=sha3$1.keccak_512=sha3$1.keccak_384=sha3$1.keccak_256=sha3$1.keccak_224=sha3$1.sha3_512=sha3$1.sha3_384=sha3$1.sha3_256=sha3$1.sha3_224=sha3$1.Keccak=void 0;sha3$1.keccakP=keccakP;const _assert_js_1=_assert$1,_u64_js_1=_u64$1,utils_js_1=utils$t,SHA3_PI=[],SHA3_ROTL=[],_SHA3_IOTA=[],_0n=BigInt(0),_1n=BigInt(1),_2n=BigInt(2),_7n=BigInt(7),_256n=BigInt(256),_0x71n=BigInt(113);for(let b=0,v=_1n,w=1,_=0;b<24;b++){[w,_]=[_,(2*w+3*_)%5],SHA3_PI.push(2*(5*_+w)),SHA3_ROTL.push((b+1)*(b+2)/2%64);let A=_0n;for(let E=0;E<7;E++)v=(v<<_1n^(v>>_7n)*_0x71n)%_256n,v&_2n&&(A^=_1n<<(_1n<<BigInt(E))-_1n);_SHA3_IOTA.push(A)}const[SHA3_IOTA_H,SHA3_IOTA_L]=(0,_u64_js_1.split)(_SHA3_IOTA,!0),rotlH=(b,v,w)=>w>32?(0,_u64_js_1.rotlBH)(b,v,w):(0,_u64_js_1.rotlSH)(b,v,w),rotlL=(b,v,w)=>w>32?(0,_u64_js_1.rotlBL)(b,v,w):(0,_u64_js_1.rotlSL)(b,v,w);function keccakP(b,v=24){const w=new Uint32Array(10);for(let _=24-v;_<24;_++){for(let k=0;k<10;k++)w[k]=b[k]^b[k+10]^b[k+20]^b[k+30]^b[k+40];for(let k=0;k<10;k+=2){const P=(k+8)%10,N=(k+2)%10,q=w[N],B=w[N+1],O=rotlH(q,B,1)^w[P],I=rotlL(q,B,1)^w[P+1];for(let D=0;D<50;D+=10)b[k+D]^=O,b[k+D+1]^=I}let A=b[2],E=b[3];for(let k=0;k<24;k++){const P=SHA3_ROTL[k],N=rotlH(A,E,P),q=rotlL(A,E,P),B=SHA3_PI[k];A=b[B],E=b[B+1],b[B]=N,b[B+1]=q}for(let k=0;k<50;k+=10){for(let P=0;P<10;P++)w[P]=b[k+P];for(let P=0;P<10;P++)b[k+P]^=~w[(P+2)%10]&w[(P+4)%10]}b[0]^=SHA3_IOTA_H[_],b[1]^=SHA3_IOTA_L[_]}w.fill(0)}class Keccak extends utils_js_1.Hash{constructor(v,w,_,A=!1,E=24){if(super(),this.blockLen=v,this.suffix=w,this.outputLen=_,this.enableXOF=A,this.rounds=E,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,_assert_js_1.number)(_),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,utils_js_1.u32)(this.state)}keccak(){utils_js_1.isLE||(0,utils_js_1.byteSwap32)(this.state32),keccakP(this.state32,this.rounds),utils_js_1.isLE||(0,utils_js_1.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(v){(0,_assert_js_1.exists)(this);const{blockLen:w,state:_}=this;v=(0,utils_js_1.toBytes)(v);const A=v.length;for(let E=0;E<A;){const k=Math.min(w-this.pos,A-E);for(let P=0;P<k;P++)_[this.pos++]^=v[E++];this.pos===w&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:v,suffix:w,pos:_,blockLen:A}=this;v[_]^=w,w&128&&_===A-1&&this.keccak(),v[A-1]^=128,this.keccak()}writeInto(v){(0,_assert_js_1.exists)(this,!1),(0,_assert_js_1.bytes)(v),this.finish();const w=this.state,{blockLen:_}=this;for(let A=0,E=v.length;A<E;){this.posOut>=_&&this.keccak();const k=Math.min(_-this.posOut,E-A);v.set(w.subarray(this.posOut,this.posOut+k),A),this.posOut+=k,A+=k}return v}xofInto(v){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(v)}xof(v){return(0,_assert_js_1.number)(v),this.xofInto(new Uint8Array(v))}digestInto(v){if((0,_assert_js_1.output)(v,this),this.finished)throw new Error("digest() was already called");return this.writeInto(v),this.destroy(),v}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(v){const{blockLen:w,suffix:_,outputLen:A,rounds:E,enableXOF:k}=this;return v||(v=new Keccak(w,_,A,k,E)),v.state32.set(this.state32),v.pos=this.pos,v.posOut=this.posOut,v.finished=this.finished,v.rounds=E,v.suffix=_,v.outputLen=A,v.enableXOF=k,v.destroyed=this.destroyed,v}}sha3$1.Keccak=Keccak;const gen=(b,v,w)=>(0,utils_js_1.wrapConstructor)(()=>new Keccak(v,b,w));sha3$1.sha3_224=gen(6,144,224/8);sha3$1.sha3_256=gen(6,136,256/8);sha3$1.sha3_384=gen(6,104,384/8);sha3$1.sha3_512=gen(6,72,512/8);sha3$1.keccak_224=gen(1,144,224/8);sha3$1.keccak_256=gen(1,136,256/8);sha3$1.keccak_384=gen(1,104,384/8);sha3$1.keccak_512=gen(1,72,512/8);const genShake=(b,v,w)=>(0,utils_js_1.wrapXOFConstructorWithOpts)((_={})=>new Keccak(v,b,_.dkLen===void 0?w:_.dkLen,!0));sha3$1.shake128=genShake(31,168,128/8);sha3$1.shake256=genShake(31,136,256/8);Object.defineProperty(utils$u,"__esModule",{value:!0});utils$u.parseIntegerNumber=utils$u.isEIP55Address=void 0;const sha3_1=sha3$1,utils_1$2=utils$t,isEIP55Address=b=>{if(b.length!=42)return!1;const v=`${b}`.toLowerCase().replace("0x",""),w=(0,utils_1$2.bytesToHex)((0,sha3_1.keccak_256)(v));let _="0x";for(let A=0;A<v.length;A++)parseInt(w[A],16)>=8?_+=v[A].toUpperCase():_+=v[A];return b===_};utils$u.isEIP55Address=isEIP55Address;const parseIntegerNumber=b=>{const v=parseInt(b);if(isNaN(v))throw new Error("Invalid number.");if(v===1/0)throw new Error("Invalid number.");return v};utils$u.parseIntegerNumber=parseIntegerNumber;var __importDefault$1=commonjsGlobal&&commonjsGlobal.__importDefault||function(b){return b&&b.__esModule?b:{default:b}},_a;Object.defineProperty(abnf,"__esModule",{value:!0});abnf.ParsedMessage=void 0;const api_1=__importDefault$1(api$1),node_exports_1=__importDefault$1(nodeExports),utils_1$1=utils$u,GRAMMAR=`
623
- sign-in-with-ethereum =
624
- [ scheme "://" ] domain %s" wants you to sign in with your Ethereum account:" LF
625
- address LF
626
- LF
627
- [ statement LF ]
628
- LF
629
- %s"URI: " URI LF
630
- %s"Version: " version LF
631
- %s"Chain ID: " chain-id LF
632
- %s"Nonce: " nonce LF
633
- %s"Issued At: " issued-at
634
- [ LF %s"Expiration Time: " expiration-time ]
635
- [ LF %s"Not Before: " not-before ]
636
- [ LF %s"Request ID: " request-id ]
637
- [ LF %s"Resources:"
638
- resources ]
639
-
640
- domain = authority
641
-
642
- address = "0x" 40*40HEXDIG
643
- ; Must also conform to captilization
644
- ; checksum encoding specified in EIP-55
645
- ; where applicable (EOAs).
646
-
647
- statement = 1*( reserved / unreserved / " " )
648
- ; The purpose is to exclude LF (line breaks).
649
-
650
- version = "1"
651
-
652
- nonce = 8*( ALPHA / DIGIT )
653
-
654
- issued-at = date-time
655
- expiration-time = date-time
656
- not-before = date-time
657
-
658
- request-id = *pchar
659
-
660
- chain-id = 1*DIGIT
661
- ; See EIP-155 for valid CHAIN_IDs.
662
-
663
- resources = *( LF resource )
664
-
665
- resource = "- " URI
666
-
667
- ; ------------------------------------------------------------------------------
668
- ; RFC 3986
669
-
670
- URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
671
-
672
- hier-part = "//" authority path-abempty
673
- / path-absolute
674
- / path-rootless
675
- / path-empty
676
-
677
- scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
678
-
679
- authority = [ userinfo "@" ] host [ ":" port ]
680
- userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
681
- host = IP-literal / IPv4address / reg-name
682
- port = *DIGIT
683
-
684
- IP-literal = "[" ( IPv6address / IPvFuture ) "]"
685
-
686
- IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
687
-
688
- IPv6address = 6( h16 ":" ) ls32
689
- / "::" 5( h16 ":" ) ls32
690
- / [ h16 ] "::" 4( h16 ":" ) ls32
691
- / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
692
- / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
693
- / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
694
- / [ *4( h16 ":" ) h16 ] "::" ls32
695
- / [ *5( h16 ":" ) h16 ] "::" h16
696
- / [ *6( h16 ":" ) h16 ] "::"
697
-
698
- h16 = 1*4HEXDIG
699
- ls32 = ( h16 ":" h16 ) / IPv4address
700
- IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
701
- dec-octet = DIGIT ; 0-9
702
- / %x31-39 DIGIT ; 10-99
703
- / "1" 2DIGIT ; 100-199
704
- / "2" %x30-34 DIGIT ; 200-249
705
- / "25" %x30-35 ; 250-255
706
-
707
- reg-name = *( unreserved / pct-encoded / sub-delims )
708
-
709
- path-abempty = *( "/" segment )
710
- path-absolute = "/" [ segment-nz *( "/" segment ) ]
711
- path-rootless = segment-nz *( "/" segment )
712
- path-empty = 0pchar
713
-
714
- segment = *pchar
715
- segment-nz = 1*pchar
716
-
717
- pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
718
-
719
- query = *( pchar / "/" / "?" )
720
-
721
- fragment = *( pchar / "/" / "?" )
722
-
723
- pct-encoded = "%" HEXDIG HEXDIG
724
-
725
- unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
726
- reserved = gen-delims / sub-delims
727
- gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
728
- sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
729
- / "*" / "+" / "," / ";" / "="
730
-
731
- ; ------------------------------------------------------------------------------
732
- ; RFC 3339
733
-
734
- date-fullyear = 4DIGIT
735
- date-month = 2DIGIT ; 01-12
736
- date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on
737
- ; month/year
738
- time-hour = 2DIGIT ; 00-23
739
- time-minute = 2DIGIT ; 00-59
740
- time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second
741
- ; rules
742
- time-secfrac = "." 1*DIGIT
743
- time-numoffset = ("+" / "-") time-hour ":" time-minute
744
- time-offset = "Z" / time-numoffset
745
-
746
- partial-time = time-hour ":" time-minute ":" time-second
747
- [time-secfrac]
748
- full-date = date-fullyear "-" date-month "-" date-mday
749
- full-time = partial-time time-offset
750
-
751
- date-time = full-date "T" full-time
752
-
753
- ; ------------------------------------------------------------------------------
754
- ; RFC 5234
755
-
756
- ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
757
- LF = %x0A
758
- ; linefeed
759
- DIGIT = %x30-39
760
- ; 0-9
761
- HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
762
- `;class GrammarApi{static generateApi(){const v=new api_1.default(GRAMMAR);if(v.generate(),v.errors.length)throw console.error(v.errorsToAscii()),console.error(v.linesToAscii()),console.log(v.displayAttributeErrors()),new Error("ABNF grammar has errors");return v.toObject()}}_a=GrammarApi;GrammarApi.grammarObj=_a.generateApi();class ParsedMessage{constructor(v){const w=new node_exports_1.default.parser;w.ast=new node_exports_1.default.ast;const _=node_exports_1.default.ids,A=function(ce,ae,he,oe,de){const le=_.SEM_OK;return ce===_.SEM_PRE&&he===0&&(de.scheme=node_exports_1.default.utils.charsToString(ae,he,oe)),le};w.ast.callbacks.scheme=A;const E=function(ce,ae,he,oe,de){const le=_.SEM_OK;return ce===_.SEM_PRE&&(de.domain=node_exports_1.default.utils.charsToString(ae,he,oe)),le};w.ast.callbacks.domain=E;const k=function(ce,ae,he,oe,de){const le=_.SEM_OK;return ce===_.SEM_PRE&&(de.address=node_exports_1.default.utils.charsToString(ae,he,oe)),le};w.ast.callbacks.address=k;const P=function(ce,ae,he,oe,de){const le=_.SEM_OK;return ce===_.SEM_PRE&&(de.statement=node_exports_1.default.utils.charsToString(ae,he,oe)),le};w.ast.callbacks.statement=P;const N=function(ce,ae,he,oe,de){const le=_.SEM_OK;return ce===_.SEM_PRE&&(de.uri||(de.uri=node_exports_1.default.utils.charsToString(ae,he,oe))),le};w.ast.callbacks.uri=N;const q=function(ce,ae,he,oe,de){const le=_.SEM_OK;return ce===_.SEM_PRE&&(de.version=node_exports_1.default.utils.charsToString(ae,he,oe)),le};w.ast.callbacks.version=q;const B=function(ce,ae,he,oe,de){const le=_.SEM_OK;return ce===_.SEM_PRE&&(de.chainId=(0,utils_1$1.parseIntegerNumber)(node_exports_1.default.utils.charsToString(ae,he,oe))),le};w.ast.callbacks["chain-id"]=B;const O=function(ce,ae,he,oe,de){const le=_.SEM_OK;return ce===_.SEM_PRE&&(de.nonce=node_exports_1.default.utils.charsToString(ae,he,oe)),le};w.ast.callbacks.nonce=O;const I=function(ce,ae,he,oe,de){const le=_.SEM_OK;return ce===_.SEM_PRE&&(de.issuedAt=node_exports_1.default.utils.charsToString(ae,he,oe)),le};w.ast.callbacks["issued-at"]=I;const D=function(ce,ae,he,oe,de){const le=_.SEM_OK;return ce===_.SEM_PRE&&(de.expirationTime=node_exports_1.default.utils.charsToString(ae,he,oe)),le};w.ast.callbacks["expiration-time"]=D;const V=function(ce,ae,he,oe,de){const le=_.SEM_OK;return ce===_.SEM_PRE&&(de.notBefore=node_exports_1.default.utils.charsToString(ae,he,oe)),le};w.ast.callbacks["not-before"]=V;const ee=function(ce,ae,he,oe,de){const le=_.SEM_OK;return ce===_.SEM_PRE&&(de.requestId=node_exports_1.default.utils.charsToString(ae,he,oe)),le};w.ast.callbacks["request-id"]=ee;const J=function(ce,ae,he,oe,de){const le=_.SEM_OK;return ce===_.SEM_PRE&&(de.resources=node_exports_1.default.utils.charsToString(ae,he,oe).slice(3).split(`
763
- - `)),le};w.ast.callbacks.resources=J;const te=w.parse(GrammarApi.grammarObj,"sign-in-with-ethereum",v);if(!te.success)throw new Error(`Invalid message: ${JSON.stringify(te)}`);const se={};w.ast.translate(se);for(const[ce,ae]of Object.entries(se))this[ce]=ae;if(this.domain.length===0)throw new Error("Domain cannot be empty.");if(!(0,utils_1$1.isEIP55Address)(this.address))throw new Error("Address not conformant to EIP-55.")}}abnf.ParsedMessage=ParsedMessage;(function(b){var v=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(A,E,k,P){P===void 0&&(P=k);var N=Object.getOwnPropertyDescriptor(E,k);(!N||("get"in N?!E.__esModule:N.writable||N.configurable))&&(N={enumerable:!0,get:function(){return E[k]}}),Object.defineProperty(A,P,N)}:function(A,E,k,P){P===void 0&&(P=k),A[P]=E[k]}),w=commonjsGlobal&&commonjsGlobal.__exportStar||function(A,E){for(var k in A)k!=="default"&&!Object.prototype.hasOwnProperty.call(E,k)&&v(E,A,k)};Object.defineProperty(b,"__esModule",{value:!0}),b.ParsedMessage=void 0;const _=abnf;Object.defineProperty(b,"ParsedMessage",{enumerable:!0,get:function(){return _.ParsedMessage}}),w(utils$u,b)})(parsers);var validUrl={exports:{}};(function(b){(function(v){v.exports.is_uri=_,v.exports.is_http_uri=A,v.exports.is_https_uri=E,v.exports.is_web_uri=k,v.exports.isUri=_,v.exports.isHttpUri=A,v.exports.isHttpsUri=E,v.exports.isWebUri=k;var w=function(P){var N=P.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/);return N};function _(P){if(P&&!/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(P)&&!/%[^0-9a-f]/i.test(P)&&!/%[0-9a-f](:?[^0-9a-f]|$)/i.test(P)){var N=[],q="",B="",O="",I="",D="",V="";if(N=w(P),q=N[1],B=N[2],O=N[3],I=N[4],D=N[5],!!(q&&q.length&&O.length>=0)){if(B&&B.length){if(!(O.length===0||/^\//.test(O)))return}else if(/^\/\//.test(O))return;if(/^[a-z][a-z0-9\+\-\.]*$/.test(q.toLowerCase()))return V+=q+":",B&&B.length&&(V+="//"+B),V+=O,I&&I.length&&(V+="?"+I),D&&D.length&&(V+="#"+D),V}}}function A(P,N){if(_(P)){var q=[],B="",O="",I="",D="",V="",ee="",J="";if(q=w(P),B=q[1],O=q[2],I=q[3],V=q[4],ee=q[5],!!B){if(N){if(B.toLowerCase()!="https")return}else if(B.toLowerCase()!="http")return;if(O)return/:(\d+)$/.test(O)&&(D=O.match(/:(\d+)$/)[0],O=O.replace(/:\d+$/,"")),J+=B+":",J+="//"+O,D&&(J+=D),J+=I,V&&V.length&&(J+="?"+V),ee&&ee.length&&(J+="#"+ee),J}}}function E(P){return A(P,!0)}function k(P){return A(P)||E(P)}})(b)})(validUrl);var validUrlExports=validUrl.exports,ethersCompat={},lib_commonjs$1={},extendStatics=function(b,v){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(w,_){w.__proto__=_}||function(w,_){for(var A in _)Object.prototype.hasOwnProperty.call(_,A)&&(w[A]=_[A])},extendStatics(b,v)};function __extends(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Class extends value "+String(v)+" is not a constructor or null");extendStatics(b,v);function w(){this.constructor=b}b.prototype=v===null?Object.create(v):(w.prototype=v.prototype,new w)}var __assign=function(){return __assign=Object.assign||function(v){for(var w,_=1,A=arguments.length;_<A;_++){w=arguments[_];for(var E in w)Object.prototype.hasOwnProperty.call(w,E)&&(v[E]=w[E])}return v},__assign.apply(this,arguments)};function __rest(b,v){var w={};for(var _ in b)Object.prototype.hasOwnProperty.call(b,_)&&v.indexOf(_)<0&&(w[_]=b[_]);if(b!=null&&typeof Object.getOwnPropertySymbols=="function")for(var A=0,_=Object.getOwnPropertySymbols(b);A<_.length;A++)v.indexOf(_[A])<0&&Object.prototype.propertyIsEnumerable.call(b,_[A])&&(w[_[A]]=b[_[A]]);return w}function __decorate(b,v,w,_){var A=arguments.length,E=A<3?v:_===null?_=Object.getOwnPropertyDescriptor(v,w):_,k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(b,v,w,_);else for(var P=b.length-1;P>=0;P--)(k=b[P])&&(E=(A<3?k(E):A>3?k(v,w,E):k(v,w))||E);return A>3&&E&&Object.defineProperty(v,w,E),E}function __param(b,v){return function(w,_){v(w,_,b)}}function __metadata(b,v){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(b,v)}function __awaiter$2(b,v,w,_){function A(E){return E instanceof w?E:new w(function(k){k(E)})}return new(w||(w=Promise))(function(E,k){function P(B){try{q(_.next(B))}catch(O){k(O)}}function N(B){try{q(_.throw(B))}catch(O){k(O)}}function q(B){B.done?E(B.value):A(B.value).then(P,N)}q((_=_.apply(b,v||[])).next())})}function __generator(b,v){var w={label:0,sent:function(){if(E[0]&1)throw E[1];return E[1]},trys:[],ops:[]},_,A,E,k;return k={next:P(0),throw:P(1),return:P(2)},typeof Symbol=="function"&&(k[Symbol.iterator]=function(){return this}),k;function P(q){return function(B){return N([q,B])}}function N(q){if(_)throw new TypeError("Generator is already executing.");for(;w;)try{if(_=1,A&&(E=q[0]&2?A.return:q[0]?A.throw||((E=A.return)&&E.call(A),0):A.next)&&!(E=E.call(A,q[1])).done)return E;switch(A=0,E&&(q=[q[0]&2,E.value]),q[0]){case 0:case 1:E=q;break;case 4:return w.label++,{value:q[1],done:!1};case 5:w.label++,A=q[1],q=[0];continue;case 7:q=w.ops.pop(),w.trys.pop();continue;default:if(E=w.trys,!(E=E.length>0&&E[E.length-1])&&(q[0]===6||q[0]===2)){w=0;continue}if(q[0]===3&&(!E||q[1]>E[0]&&q[1]<E[3])){w.label=q[1];break}if(q[0]===6&&w.label<E[1]){w.label=E[1],E=q;break}if(E&&w.label<E[2]){w.label=E[2],w.ops.push(q);break}E[2]&&w.ops.pop(),w.trys.pop();continue}q=v.call(b,w)}catch(B){q=[6,B],A=0}finally{_=E=0}if(q[0]&5)throw q[1];return{value:q[0]?q[1]:void 0,done:!0}}}var __createBinding$1=Object.create?function(b,v,w,_){_===void 0&&(_=w);var A=Object.getOwnPropertyDescriptor(v,w);(!A||("get"in A?!v.__esModule:A.writable||A.configurable))&&(A={enumerable:!0,get:function(){return v[w]}}),Object.defineProperty(b,_,A)}:function(b,v,w,_){_===void 0&&(_=w),b[_]=v[w]};function __exportStar(b,v){for(var w in b)w!=="default"&&!Object.prototype.hasOwnProperty.call(v,w)&&__createBinding$1(v,b,w)}function __values(b){var v=typeof Symbol=="function"&&Symbol.iterator,w=v&&b[v],_=0;if(w)return w.call(b);if(b&&typeof b.length=="number")return{next:function(){return b&&_>=b.length&&(b=void 0),{value:b&&b[_++],done:!b}}};throw new TypeError(v?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(b,v){var w=typeof Symbol=="function"&&b[Symbol.iterator];if(!w)return b;var _=w.call(b),A,E=[],k;try{for(;(v===void 0||v-- >0)&&!(A=_.next()).done;)E.push(A.value)}catch(P){k={error:P}}finally{try{A&&!A.done&&(w=_.return)&&w.call(_)}finally{if(k)throw k.error}}return E}function __spread(){for(var b=[],v=0;v<arguments.length;v++)b=b.concat(__read(arguments[v]));return b}function __spreadArrays(){for(var b=0,v=0,w=arguments.length;v<w;v++)b+=arguments[v].length;for(var _=Array(b),A=0,v=0;v<w;v++)for(var E=arguments[v],k=0,P=E.length;k<P;k++,A++)_[A]=E[k];return _}function __spreadArray(b,v,w){if(w||arguments.length===2)for(var _=0,A=v.length,E;_<A;_++)(E||!(_ in v))&&(E||(E=Array.prototype.slice.call(v,0,_)),E[_]=v[_]);return b.concat(E||Array.prototype.slice.call(v))}function __await(b){return this instanceof __await?(this.v=b,this):new __await(b)}function __asyncGenerator(b,v,w){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var _=w.apply(b,v||[]),A,E=[];return A={},k("next"),k("throw"),k("return"),A[Symbol.asyncIterator]=function(){return this},A;function k(I){_[I]&&(A[I]=function(D){return new Promise(function(V,ee){E.push([I,D,V,ee])>1||P(I,D)})})}function P(I,D){try{N(_[I](D))}catch(V){O(E[0][3],V)}}function N(I){I.value instanceof __await?Promise.resolve(I.value.v).then(q,B):O(E[0][2],I)}function q(I){P("next",I)}function B(I){P("throw",I)}function O(I,D){I(D),E.shift(),E.length&&P(E[0][0],E[0][1])}}function __asyncDelegator(b){var v,w;return v={},_("next"),_("throw",function(A){throw A}),_("return"),v[Symbol.iterator]=function(){return this},v;function _(A,E){v[A]=b[A]?function(k){return(w=!w)?{value:__await(b[A](k)),done:A==="return"}:E?E(k):k}:E}}function __asyncValues(b){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var v=b[Symbol.asyncIterator],w;return v?v.call(b):(b=typeof __values=="function"?__values(b):b[Symbol.iterator](),w={},_("next"),_("throw"),_("return"),w[Symbol.asyncIterator]=function(){return this},w);function _(E){w[E]=b[E]&&function(k){return new Promise(function(P,N){k=b[E](k),A(P,N,k.done,k.value)})}}function A(E,k,P,N){Promise.resolve(N).then(function(q){E({value:q,done:P})},k)}}function __makeTemplateObject(b,v){return Object.defineProperty?Object.defineProperty(b,"raw",{value:v}):b.raw=v,b}var __setModuleDefault$1=Object.create?function(b,v){Object.defineProperty(b,"default",{enumerable:!0,value:v})}:function(b,v){b.default=v};function __importStar$1(b){if(b&&b.__esModule)return b;var v={};if(b!=null)for(var w in b)w!=="default"&&Object.prototype.hasOwnProperty.call(b,w)&&__createBinding$1(v,b,w);return __setModuleDefault$1(v,b),v}function __importDefault(b){return b&&b.__esModule?b:{default:b}}function __classPrivateFieldGet(b,v,w,_){if(w==="a"&&!_)throw new TypeError("Private accessor was defined without a getter");if(typeof v=="function"?b!==v||!_:!v.has(b))throw new TypeError("Cannot read private member from an object whose class did not declare it");return w==="m"?_:w==="a"?_.call(b):_?_.value:v.get(b)}function __classPrivateFieldSet(b,v,w,_,A){if(_==="m")throw new TypeError("Private method is not writable");if(_==="a"&&!A)throw new TypeError("Private accessor was defined without a setter");if(typeof v=="function"?b!==v||!A:!v.has(b))throw new TypeError("Cannot write private member to an object whose class did not declare it");return _==="a"?A.call(b,w):A?A.value=w:v.set(b,w),w}function __classPrivateFieldIn(b,v){if(v===null||typeof v!="object"&&typeof v!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof b=="function"?v===b:b.has(v)}const tslib_es6=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return __assign},__asyncDelegator,__asyncGenerator,__asyncValues,__await,__awaiter:__awaiter$2,__classPrivateFieldGet,__classPrivateFieldIn,__classPrivateFieldSet,__createBinding:__createBinding$1,__decorate,__exportStar,__extends,__generator,__importDefault,__importStar:__importStar$1,__makeTemplateObject,__metadata,__param,__read,__rest,__spread,__spreadArray,__spreadArrays,__values},Symbol.toStringTag,{value:"Module"})),require$$0$1=getAugmentedNamespace(tslib_es6);var ethers={},_version={},hasRequired_version;function require_version(){return hasRequired_version||(hasRequired_version=1,Object.defineProperty(_version,"__esModule",{value:!0}),_version.version=void 0,_version.version="6.8.0"),_version}var abi={},abiCoder={},utils$s={},base58$1={},data={},errors$2={},properties={},hasRequiredProperties;function requireProperties(){if(hasRequiredProperties)return properties;hasRequiredProperties=1,Object.defineProperty(properties,"__esModule",{value:!0}),properties.defineProperties=properties.resolveProperties=void 0;function b(_,A,E){const k=A.split("|").map(N=>N.trim());for(let N=0;N<k.length;N++)switch(A){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof _===A)return}const P=new Error(`invalid value for type ${A}`);throw P.code="INVALID_ARGUMENT",P.argument=`value.${E}`,P.value=_,P}async function v(_){const A=Object.keys(_);return(await Promise.all(A.map(k=>Promise.resolve(_[k])))).reduce((k,P,N)=>(k[A[N]]=P,k),{})}properties.resolveProperties=v;function w(_,A,E){for(let k in A){let P=A[k];const N=E?E[k]:null;N&&b(P,N,k),Object.defineProperty(_,k,{enumerable:!0,value:P,writable:!1})}}return properties.defineProperties=w,properties}var hasRequiredErrors;function requireErrors(){if(hasRequiredErrors)return errors$2;hasRequiredErrors=1,Object.defineProperty(errors$2,"__esModule",{value:!0}),errors$2.assertPrivate=errors$2.assertNormalize=errors$2.assertArgumentCount=errors$2.assertArgument=errors$2.assert=errors$2.makeError=errors$2.isCallException=errors$2.isError=void 0;const b=require_version(),v=requireProperties();function w(I){if(I==null)return"null";if(Array.isArray(I))return"[ "+I.map(w).join(", ")+" ]";if(I instanceof Uint8Array){const D="0123456789abcdef";let V="0x";for(let ee=0;ee<I.length;ee++)V+=D[I[ee]>>4],V+=D[I[ee]&15];return V}if(typeof I=="object"&&typeof I.toJSON=="function")return w(I.toJSON());switch(typeof I){case"boolean":case"symbol":return I.toString();case"bigint":return BigInt(I).toString();case"number":return I.toString();case"string":return JSON.stringify(I);case"object":{const D=Object.keys(I);return D.sort(),"{ "+D.map(V=>`${w(V)}: ${w(I[V])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function _(I,D){return I&&I.code===D}errors$2.isError=_;function A(I){return _(I,"CALL_EXCEPTION")}errors$2.isCallException=A;function E(I,D,V){let ee=I;{const te=[];if(V){if("message"in V||"code"in V||"name"in V)throw new Error(`value will overwrite populated values: ${w(V)}`);for(const se in V){if(se==="shortMessage")continue;const ce=V[se];te.push(se+"="+w(ce))}}te.push(`code=${D}`),te.push(`version=${b.version}`),te.length&&(I+=" ("+te.join(", ")+")")}let J;switch(D){case"INVALID_ARGUMENT":J=new TypeError(I);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":J=new RangeError(I);break;default:J=new Error(I)}return(0,v.defineProperties)(J,{code:D}),V&&Object.assign(J,V),J.shortMessage==null&&(0,v.defineProperties)(J,{shortMessage:ee}),J}errors$2.makeError=E;function k(I,D,V,ee){if(!I)throw E(D,V,ee)}errors$2.assert=k;function P(I,D,V,ee){k(I,D,"INVALID_ARGUMENT",{argument:V,value:ee})}errors$2.assertArgument=P;function N(I,D,V){V==null&&(V=""),V&&(V=": "+V),k(I>=D,"missing arguemnt"+V,"MISSING_ARGUMENT",{count:I,expectedCount:D}),k(I<=D,"too many arguemnts"+V,"UNEXPECTED_ARGUMENT",{count:I,expectedCount:D})}errors$2.assertArgumentCount=N;const q=["NFD","NFC","NFKD","NFKC"].reduce((I,D)=>{try{if("test".normalize(D)!=="test")throw new Error("bad");if(D==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");I.push(D)}catch{}return I},[]);function B(I){k(q.indexOf(I)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:I}})}errors$2.assertNormalize=B;function O(I,D,V){if(V==null&&(V=""),I!==D){let ee=V,J="new";V&&(ee+=".",J+=" "+V),k(!1,`private constructor; use ${ee}from* methods`,"UNSUPPORTED_OPERATION",{operation:J})}}return errors$2.assertPrivate=O,errors$2}var hasRequiredData;function requireData(){if(hasRequiredData)return data;hasRequiredData=1,Object.defineProperty(data,"__esModule",{value:!0}),data.zeroPadBytes=data.zeroPadValue=data.stripZerosLeft=data.dataSlice=data.dataLength=data.concat=data.hexlify=data.isBytesLike=data.isHexString=data.getBytesCopy=data.getBytes=void 0;const b=requireErrors();function v(ee,J,te){if(ee instanceof Uint8Array)return te?new Uint8Array(ee):ee;if(typeof ee=="string"&&ee.match(/^0x([0-9a-f][0-9a-f])*$/i)){const se=new Uint8Array((ee.length-2)/2);let ce=2;for(let ae=0;ae<se.length;ae++)se[ae]=parseInt(ee.substring(ce,ce+2),16),ce+=2;return se}(0,b.assertArgument)(!1,"invalid BytesLike value",J||"value",ee)}function w(ee,J){return v(ee,J,!1)}data.getBytes=w;function _(ee,J){return v(ee,J,!0)}data.getBytesCopy=_;function A(ee,J){return!(typeof ee!="string"||!ee.match(/^0x[0-9A-Fa-f]*$/)||typeof J=="number"&&ee.length!==2+2*J||J===!0&&ee.length%2!==0)}data.isHexString=A;function E(ee){return A(ee,!0)||ee instanceof Uint8Array}data.isBytesLike=E;const k="0123456789abcdef";function P(ee){const J=w(ee);let te="0x";for(let se=0;se<J.length;se++){const ce=J[se];te+=k[(ce&240)>>4]+k[ce&15]}return te}data.hexlify=P;function N(ee){return"0x"+ee.map(J=>P(J).substring(2)).join("")}data.concat=N;function q(ee){return A(ee,!0)?(ee.length-2)/2:w(ee).length}data.dataLength=q;function B(ee,J,te){const se=w(ee);return te!=null&&te>se.length&&(0,b.assert)(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:se,length:se.length,offset:te}),P(se.slice(J??0,te??se.length))}data.dataSlice=B;function O(ee){let J=P(ee).substring(2);for(;J.startsWith("00");)J=J.substring(2);return"0x"+J}data.stripZerosLeft=O;function I(ee,J,te){const se=w(ee);(0,b.assert)(J>=se.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(se),length:J,offset:J+1});const ce=new Uint8Array(J);return ce.fill(0),te?ce.set(se,J-se.length):ce.set(se,0),P(ce)}function D(ee,J){return I(ee,J,!0)}data.zeroPadValue=D;function V(ee,J){return I(ee,J,!1)}return data.zeroPadBytes=V,data}var maths={},hasRequiredMaths;function requireMaths(){if(hasRequiredMaths)return maths;hasRequiredMaths=1,Object.defineProperty(maths,"__esModule",{value:!0}),maths.toQuantity=maths.toBeArray=maths.toBeHex=maths.toNumber=maths.getNumber=maths.toBigInt=maths.getUint=maths.getBigInt=maths.mask=maths.toTwos=maths.fromTwos=void 0;const b=requireData(),v=requireErrors(),w=BigInt(0),_=BigInt(1),A=9007199254740991;function E(te,se){const ce=q(te,"value"),ae=BigInt(I(se,"width"));if((0,v.assert)(ce>>ae===w,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:te}),ce>>ae-_){const he=(_<<ae)-_;return-((~ce&he)+_)}return ce}maths.fromTwos=E;function k(te,se){let ce=N(te,"value");const ae=BigInt(I(se,"width")),he=_<<ae-_;if(ce<w){ce=-ce,(0,v.assert)(ce<=he,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:te});const oe=(_<<ae)-_;return(~ce&oe)+_}else(0,v.assert)(ce<he,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:te});return ce}maths.toTwos=k;function P(te,se){const ce=q(te,"value"),ae=BigInt(I(se,"bits"));return ce&(_<<ae)-_}maths.mask=P;function N(te,se){switch(typeof te){case"bigint":return te;case"number":return(0,v.assertArgument)(Number.isInteger(te),"underflow",se||"value",te),(0,v.assertArgument)(te>=-A&&te<=A,"overflow",se||"value",te),BigInt(te);case"string":try{if(te==="")throw new Error("empty string");return te[0]==="-"&&te[1]!=="-"?-BigInt(te.substring(1)):BigInt(te)}catch(ce){(0,v.assertArgument)(!1,`invalid BigNumberish string: ${ce.message}`,se||"value",te)}}(0,v.assertArgument)(!1,"invalid BigNumberish value",se||"value",te)}maths.getBigInt=N;function q(te,se){const ce=N(te,se);return(0,v.assert)(ce>=w,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:te}),ce}maths.getUint=q;const B="0123456789abcdef";function O(te){if(te instanceof Uint8Array){let se="0x0";for(const ce of te)se+=B[ce>>4],se+=B[ce&15];return BigInt(se)}return N(te)}maths.toBigInt=O;function I(te,se){switch(typeof te){case"bigint":return(0,v.assertArgument)(te>=-A&&te<=A,"overflow",se||"value",te),Number(te);case"number":return(0,v.assertArgument)(Number.isInteger(te),"underflow",se||"value",te),(0,v.assertArgument)(te>=-A&&te<=A,"overflow",se||"value",te),te;case"string":try{if(te==="")throw new Error("empty string");return I(BigInt(te),se)}catch(ce){(0,v.assertArgument)(!1,`invalid numeric string: ${ce.message}`,se||"value",te)}}(0,v.assertArgument)(!1,"invalid numeric value",se||"value",te)}maths.getNumber=I;function D(te){return I(O(te))}maths.toNumber=D;function V(te,se){let ae=q(te,"value").toString(16);if(se==null)ae.length%2&&(ae="0"+ae);else{const he=I(se,"width");for((0,v.assert)(he*2>=ae.length,`value exceeds width (${he} bits)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:te});ae.length<he*2;)ae="0"+ae}return"0x"+ae}maths.toBeHex=V;function ee(te){const se=q(te,"value");if(se===w)return new Uint8Array([]);let ce=se.toString(16);ce.length%2&&(ce="0"+ce);const ae=new Uint8Array(ce.length/2);for(let he=0;he<ae.length;he++){const oe=he*2;ae[he]=parseInt(ce.substring(oe,oe+2),16)}return ae}maths.toBeArray=ee;function J(te){let se=(0,b.hexlify)((0,b.isBytesLike)(te)?te:ee(te)).substring(2);for(;se.startsWith("0");)se=se.substring(1);return se===""&&(se="0"),"0x"+se}return maths.toQuantity=J,maths}var hasRequiredBase58;function requireBase58(){if(hasRequiredBase58)return base58$1;hasRequiredBase58=1,Object.defineProperty(base58$1,"__esModule",{value:!0}),base58$1.decodeBase58=base58$1.encodeBase58=void 0;const b=requireData(),v=requireErrors(),w=requireMaths(),_="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";let A=null;function E(B){if(A==null){A={};for(let I=0;I<_.length;I++)A[_[I]]=BigInt(I)}const O=A[B];return(0,v.assertArgument)(O!=null,"invalid base58 value","letter",B),O}const k=BigInt(0),P=BigInt(58);function N(B){let O=(0,w.toBigInt)((0,b.getBytes)(B)),I="";for(;O;)I=_[Number(O%P)]+I,O/=P;return I}base58$1.encodeBase58=N;function q(B){let O=k;for(let I=0;I<B.length;I++)O*=P,O+=E(B[I]);return O}return base58$1.decodeBase58=q,base58$1}var base64Browser={},hasRequiredBase64Browser;function requireBase64Browser(){if(hasRequiredBase64Browser)return base64Browser;hasRequiredBase64Browser=1,Object.defineProperty(base64Browser,"__esModule",{value:!0}),base64Browser.encodeBase64=base64Browser.decodeBase64=void 0;const b=requireData();function v(_){_=atob(_);const A=new Uint8Array(_.length);for(let E=0;E<_.length;E++)A[E]=_.charCodeAt(E);return(0,b.getBytes)(A)}base64Browser.decodeBase64=v;function w(_){const A=(0,b.getBytes)(_);let E="";for(let k=0;k<A.length;k++)E+=String.fromCharCode(A[k]);return btoa(E)}return base64Browser.encodeBase64=w,base64Browser}var events$1={},hasRequiredEvents;function requireEvents(){if(hasRequiredEvents)return events$1;hasRequiredEvents=1,Object.defineProperty(events$1,"__esModule",{value:!0}),events$1.EventPayload=void 0;const b=requireProperties();class v{filter;emitter;#e;constructor(_,A,E){this.#e=A,(0,b.defineProperties)(this,{emitter:_,filter:E})}async removeListener(){this.#e!=null&&await this.emitter.off(this.filter,this.#e)}}return events$1.EventPayload=v,events$1}var fetch$1={},utf8={},hasRequiredUtf8;function requireUtf8(){return hasRequiredUtf8||(hasRequiredUtf8=1,function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.toUtf8CodePoints=b.toUtf8String=b.toUtf8Bytes=b.Utf8ErrorFuncs=void 0;const v=requireData(),w=requireErrors();function _(O,I,D,V,ee){(0,w.assertArgument)(!1,`invalid codepoint at offset ${I}; ${O}`,"bytes",D)}function A(O,I,D,V,ee){if(O==="BAD_PREFIX"||O==="UNEXPECTED_CONTINUE"){let J=0;for(let te=I+1;te<D.length&&D[te]>>6===2;te++)J++;return J}return O==="OVERRUN"?D.length-I-1:0}function E(O,I,D,V,ee){return O==="OVERLONG"?((0,w.assertArgument)(typeof ee=="number","invalid bad code point for replacement","badCodepoint",ee),V.push(ee),0):(V.push(65533),A(O,I,D))}b.Utf8ErrorFuncs=Object.freeze({error:_,ignore:A,replace:E});function k(O,I){I==null&&(I=b.Utf8ErrorFuncs.error);const D=(0,v.getBytes)(O,"bytes"),V=[];let ee=0;for(;ee<D.length;){const J=D[ee++];if(!(J>>7)){V.push(J);continue}let te=null,se=null;if((J&224)===192)te=1,se=127;else if((J&240)===224)te=2,se=2047;else if((J&248)===240)te=3,se=65535;else{(J&192)===128?ee+=I("UNEXPECTED_CONTINUE",ee-1,D,V):ee+=I("BAD_PREFIX",ee-1,D,V);continue}if(ee-1+te>=D.length){ee+=I("OVERRUN",ee-1,D,V);continue}let ce=J&(1<<8-te-1)-1;for(let ae=0;ae<te;ae++){let he=D[ee];if((he&192)!=128){ee+=I("MISSING_CONTINUE",ee,D,V),ce=null;break}ce=ce<<6|he&63,ee++}if(ce!==null){if(ce>1114111){ee+=I("OUT_OF_RANGE",ee-1-te,D,V,ce);continue}if(ce>=55296&&ce<=57343){ee+=I("UTF16_SURROGATE",ee-1-te,D,V,ce);continue}if(ce<=se){ee+=I("OVERLONG",ee-1-te,D,V,ce);continue}V.push(ce)}}return V}function P(O,I){I!=null&&((0,w.assertNormalize)(I),O=O.normalize(I));let D=[];for(let V=0;V<O.length;V++){const ee=O.charCodeAt(V);if(ee<128)D.push(ee);else if(ee<2048)D.push(ee>>6|192),D.push(ee&63|128);else if((ee&64512)==55296){V++;const J=O.charCodeAt(V);(0,w.assertArgument)(V<O.length&&(J&64512)===56320,"invalid surrogate pair","str",O);const te=65536+((ee&1023)<<10)+(J&1023);D.push(te>>18|240),D.push(te>>12&63|128),D.push(te>>6&63|128),D.push(te&63|128)}else D.push(ee>>12|224),D.push(ee>>6&63|128),D.push(ee&63|128)}return new Uint8Array(D)}b.toUtf8Bytes=P;function N(O){return O.map(I=>I<=65535?String.fromCharCode(I):(I-=65536,String.fromCharCode((I>>10&1023)+55296,(I&1023)+56320))).join("")}function q(O,I){return N(k(O,I))}b.toUtf8String=q;function B(O,I){return k(P(O,I))}b.toUtf8CodePoints=B}(utf8)),utf8}var geturlBrowser={},hasRequiredGeturlBrowser;function requireGeturlBrowser(){if(hasRequiredGeturlBrowser)return geturlBrowser;hasRequiredGeturlBrowser=1,Object.defineProperty(geturlBrowser,"__esModule",{value:!0}),geturlBrowser.getUrl=geturlBrowser.createGetUrl=void 0;const b=requireErrors();function v(A){async function E(k,P){const N=k.url.split(":")[0].toLowerCase();(0,b.assert)(N==="http"||N==="https",`unsupported protocol ${N}`,"UNSUPPORTED_OPERATION",{info:{protocol:N},operation:"request"}),(0,b.assert)(N==="https"||!k.credentials||k.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let q;if(P){const ee=new AbortController;q=ee.signal,P.addListener(()=>{ee.abort()})}const B={method:k.method,headers:new Headers(Array.from(k)),body:k.body||void 0,signal:q},O=await fetch(k.url,B),I={};O.headers.forEach((ee,J)=>{I[J.toLowerCase()]=ee});const D=await O.arrayBuffer(),V=D==null?null:new Uint8Array(D);return{statusCode:O.status,statusMessage:O.statusText,headers:I,body:V}}return E}geturlBrowser.createGetUrl=v;const w=v();async function _(A,E){return w(A,E)}return geturlBrowser.getUrl=_,geturlBrowser}var hasRequiredFetch;function requireFetch(){if(hasRequiredFetch)return fetch$1;hasRequiredFetch=1,Object.defineProperty(fetch$1,"__esModule",{value:!0}),fetch$1.FetchResponse=fetch$1.FetchRequest=fetch$1.FetchCancelSignal=void 0;const b=requireBase64Browser(),v=requireData(),w=requireErrors(),_=requireProperties(),A=requireUtf8(),E=requireGeturlBrowser(),k=12,P=250;let N=(0,E.createGetUrl)();const q=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),B=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let O=!1;async function I(de,le){try{const be=de.match(q);if(!be)throw new Error("invalid data");return new ce(200,"OK",{"content-type":be[1]||"text/plain"},be[2]?(0,b.decodeBase64)(be[3]):he(be[3]))}catch{return new ce(599,"BAD REQUEST (invalid data: URI)",{},null,new se(de))}}function D(de){async function le(be,pe){try{const fe=be.match(B);if(!fe)throw new Error("invalid link");return new se(`${de}${fe[2]}`)}catch{return new ce(599,"BAD REQUEST (invalid IPFS URI)",{},null,new se(be))}}return le}const V={data:I,ipfs:D("https://gateway.ipfs.io/ipfs/")},ee=new WeakMap;class J{#e;#t;constructor(le){this.#e=[],this.#t=!1,ee.set(le,()=>{if(!this.#t){this.#t=!0;for(const be of this.#e)setTimeout(()=>{be()},0);this.#e=[]}})}addListener(le){(0,w.assert)(!this.#t,"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),this.#e.push(le)}get cancelled(){return this.#t}checkSignal(){(0,w.assert)(!this.cancelled,"cancelled","CANCELLED",{})}}fetch$1.FetchCancelSignal=J;function te(de){if(de==null)throw new Error("missing signal; should not happen");return de.checkSignal(),de}class se{#e;#t;#r;#n;#i;#s;#a;#o;#u;#f;#l;#d;#c;#h;#b;get url(){return this.#s}set url(le){this.#s=String(le)}get body(){return this.#a==null?null:new Uint8Array(this.#a)}set body(le){if(le==null)this.#a=void 0,this.#o=void 0;else if(typeof le=="string")this.#a=(0,A.toUtf8Bytes)(le),this.#o="text/plain";else if(le instanceof Uint8Array)this.#a=le,this.#o="application/octet-stream";else if(typeof le=="object")this.#a=(0,A.toUtf8Bytes)(JSON.stringify(le)),this.#o="application/json";else throw new Error("invalid body")}hasBody(){return this.#a!=null}get method(){return this.#n?this.#n:this.hasBody()?"POST":"GET"}set method(le){le==null&&(le=""),this.#n=String(le).toUpperCase()}get headers(){const le=Object.assign({},this.#r);return this.#u&&(le.authorization=`Basic ${(0,b.encodeBase64)((0,A.toUtf8Bytes)(this.#u))}`),this.allowGzip&&(le["accept-encoding"]="gzip"),le["content-type"]==null&&this.#o&&(le["content-type"]=this.#o),this.body&&(le["content-length"]=String(this.body.length)),le}getHeader(le){return this.headers[le.toLowerCase()]}setHeader(le,be){this.#r[String(le).toLowerCase()]=String(be)}clearHeaders(){this.#r={}}[Symbol.iterator](){const le=this.headers,be=Object.keys(le);let pe=0;return{next:()=>{if(pe<be.length){const fe=be[pe++];return{value:[fe,le[fe]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return this.#u||null}setCredentials(le,be){(0,w.assertArgument)(!le.match(/:/),"invalid basic authentication username","username","[REDACTED]"),this.#u=`${le}:${be}`}get allowGzip(){return this.#t}set allowGzip(le){this.#t=!!le}get allowInsecureAuthentication(){return!!this.#e}set allowInsecureAuthentication(le){this.#e=!!le}get timeout(){return this.#i}set timeout(le){(0,w.assertArgument)(le>=0,"timeout must be non-zero","timeout",le),this.#i=le}get preflightFunc(){return this.#f||null}set preflightFunc(le){this.#f=le}get processFunc(){return this.#l||null}set processFunc(le){this.#l=le}get retryFunc(){return this.#d||null}set retryFunc(le){this.#d=le}get getUrlFunc(){return this.#b||N}set getUrlFunc(le){this.#b=le}constructor(le){this.#s=String(le),this.#e=!1,this.#t=!0,this.#r={},this.#n="",this.#i=3e5,this.#h={slotInterval:P,maxAttempts:k},this.#b=null}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${this.#a?(0,v.hexlify)(this.#a):"null"}>`}setThrottleParams(le){le.slotInterval!=null&&(this.#h.slotInterval=le.slotInterval),le.maxAttempts!=null&&(this.#h.maxAttempts=le.maxAttempts)}async#p(le,be,pe,fe,Z){if(le>=this.#h.maxAttempts)return Z.makeServerError("exceeded maximum retry limit");(0,w.assert)(ae()<=be,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:fe}),pe>0&&await oe(pe);let U=this.clone();const S=(U.url.split(":")[0]||"").toLowerCase();if(S in V){const X=await V[S](U.url,te(fe.#c));if(X instanceof ce){let re=X;if(this.processFunc){te(fe.#c);try{re=await this.processFunc(U,re)}catch(ie){(ie.throttle==null||typeof ie.stall!="number")&&re.makeServerError("error in post-processing function",ie).assertOk()}}return re}U=X}this.preflightFunc&&(U=await this.preflightFunc(U));const C=await this.getUrlFunc(U,te(fe.#c));let F=new ce(C.statusCode,C.statusMessage,C.headers,C.body,fe);if(F.statusCode===301||F.statusCode===302){try{const X=F.headers.location||"";return U.redirect(X).#p(le+1,be,0,fe,F)}catch{}return F}else if(F.statusCode===429&&(this.retryFunc==null||await this.retryFunc(U,F,le))){const X=F.headers["retry-after"];let re=this.#h.slotInterval*Math.trunc(Math.random()*Math.pow(2,le));return typeof X=="string"&&X.match(/^[1-9][0-9]*$/)&&(re=parseInt(X)),U.clone().#p(le+1,be,re,fe,F)}if(this.processFunc){te(fe.#c);try{F=await this.processFunc(U,F)}catch(X){(X.throttle==null||typeof X.stall!="number")&&F.makeServerError("error in post-processing function",X).assertOk();let re=this.#h.slotInterval*Math.trunc(Math.random()*Math.pow(2,le));return X.stall>=0&&(re=X.stall),U.clone().#p(le+1,be,re,fe,F)}}return F}send(){return(0,w.assert)(this.#c==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),this.#c=new J(this),this.#p(0,ae()+this.timeout,0,this,new ce(0,"",{},null,this))}cancel(){(0,w.assert)(this.#c!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const le=ee.get(this);if(!le)throw new Error("missing signal; should not happen");le()}redirect(le){const be=this.url.split(":")[0].toLowerCase(),pe=le.split(":")[0].toLowerCase();(0,w.assert)(this.method==="GET"&&(be!=="https"||pe!=="http")&&le.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(le)})`});const fe=new se(le);return fe.method="GET",fe.allowGzip=this.allowGzip,fe.timeout=this.timeout,fe.#r=Object.assign({},this.#r),this.#a&&(fe.#a=new Uint8Array(this.#a)),fe.#o=this.#o,fe}clone(){const le=new se(this.url);return le.#n=this.#n,this.#a&&(le.#a=this.#a),le.#o=this.#o,le.#r=Object.assign({},this.#r),le.#u=this.#u,this.allowGzip&&(le.allowGzip=!0),le.timeout=this.timeout,this.allowInsecureAuthentication&&(le.allowInsecureAuthentication=!0),le.#f=this.#f,le.#l=this.#l,le.#d=this.#d,le.#b=this.#b,le}static lockConfig(){O=!0}static getGateway(le){return V[le.toLowerCase()]||null}static registerGateway(le,be){if(le=le.toLowerCase(),le==="http"||le==="https")throw new Error(`cannot intercept ${le}; use registerGetUrl`);if(O)throw new Error("gateways locked");V[le]=be}static registerGetUrl(le){if(O)throw new Error("gateways locked");N=le}static createGetUrlFunc(le){return(0,E.createGetUrl)(le)}static createDataGateway(){return I}static createIpfsGatewayFunc(le){return D(le)}}fetch$1.FetchRequest=se;class ce{#e;#t;#r;#n;#i;#s;toString(){return`<FetchResponse status=${this.statusCode} body=${this.#n?(0,v.hexlify)(this.#n):"null"}>`}get statusCode(){return this.#e}get statusMessage(){return this.#t}get headers(){return Object.assign({},this.#r)}get body(){return this.#n==null?null:new Uint8Array(this.#n)}get bodyText(){try{return this.#n==null?"":(0,A.toUtf8String)(this.#n)}catch{(0,w.assert)(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{(0,w.assert)(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const le=this.headers,be=Object.keys(le);let pe=0;return{next:()=>{if(pe<be.length){const fe=be[pe++];return{value:[fe,le[fe]],done:!1}}return{value:void 0,done:!0}}}}constructor(le,be,pe,fe,Z){this.#e=le,this.#t=be,this.#r=Object.keys(pe).reduce((U,S)=>(U[S.toLowerCase()]=String(pe[S]),U),{}),this.#n=fe==null?null:new Uint8Array(fe),this.#i=Z||null,this.#s={message:""}}makeServerError(le,be){let pe;le?pe=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${le})`:(le=`${this.statusCode} ${this.statusMessage}`,pe=`CLIENT ESCALATED SERVER ERROR (${le})`);const fe=new ce(599,pe,this.headers,this.body,this.#i||void 0);return fe.#s={message:le,error:be},fe}throwThrottleError(le,be){be==null?be=-1:(0,w.assertArgument)(Number.isInteger(be)&&be>=0,"invalid stall timeout","stall",be);const pe=new Error(le||"throttling requests");throw(0,_.defineProperties)(pe,{stall:be,throttle:!0}),pe}getHeader(le){return this.headers[le.toLowerCase()]}hasBody(){return this.#n!=null}get request(){return this.#i}ok(){return this.#s.message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:le,error:be}=this.#s;le===""&&(le=`server response ${this.statusCode} ${this.statusMessage}`),(0,w.assert)(!1,le,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:be})}}fetch$1.FetchResponse=ce;function ae(){return new Date().getTime()}function he(de){return(0,A.toUtf8Bytes)(de.replace(/%([0-9a-f][0-9a-f])/gi,(le,be)=>String.fromCharCode(parseInt(be,16))))}function oe(de){return new Promise(le=>setTimeout(le,de))}return fetch$1}var fixednumber={},hasRequiredFixednumber;function requireFixednumber(){if(hasRequiredFixednumber)return fixednumber;hasRequiredFixednumber=1,Object.defineProperty(fixednumber,"__esModule",{value:!0}),fixednumber.FixedNumber=void 0;const b=requireData(),v=requireErrors(),w=requireMaths(),_=requireProperties(),A=BigInt(-1),E=BigInt(0),k=BigInt(1),P=BigInt(5),N={};let q="0000";for(;q.length<80;)q+=q;function B(ee){let J=q;for(;J.length<ee;)J+=J;return BigInt("1"+J.substring(0,ee))}function O(ee,J,te){const se=BigInt(J.width);if(J.signed){const ce=k<<se-k;(0,v.assert)(te==null||ee>=-ce&&ee<ce,"overflow","NUMERIC_FAULT",{operation:te,fault:"overflow",value:ee}),ee>E?ee=(0,w.fromTwos)((0,w.mask)(ee,se),se):ee=-(0,w.fromTwos)((0,w.mask)(-ee,se),se)}else{const ce=k<<se;(0,v.assert)(te==null||ee>=0&&ee<ce,"overflow","NUMERIC_FAULT",{operation:te,fault:"overflow",value:ee}),ee=(ee%ce+ce)%ce&ce-k}return ee}function I(ee){typeof ee=="number"&&(ee=`fixed128x${ee}`);let J=!0,te=128,se=18;if(typeof ee=="string"){if(ee!=="fixed")if(ee==="ufixed")J=!1;else{const ae=ee.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);(0,v.assertArgument)(ae,"invalid fixed format","format",ee),J=ae[1]!=="u",te=parseInt(ae[2]),se=parseInt(ae[3])}}else if(ee){const ae=ee,he=(oe,de,le)=>ae[oe]==null?le:((0,v.assertArgument)(typeof ae[oe]===de,"invalid fixed format ("+oe+" not "+de+")","format."+oe,ae[oe]),ae[oe]);J=he("signed","boolean",J),te=he("width","number",te),se=he("decimals","number",se)}(0,v.assertArgument)(te%8===0,"invalid FixedNumber width (not byte aligned)","format.width",te),(0,v.assertArgument)(se<=80,"invalid FixedNumber decimals (too large)","format.decimals",se);const ce=(J?"":"u")+"fixed"+String(te)+"x"+String(se);return{signed:J,width:te,decimals:se,name:ce}}function D(ee,J){let te="";ee<E&&(te="-",ee*=A);let se=ee.toString();if(J===0)return te+se;for(;se.length<=J;)se=q+se;const ce=se.length-J;for(se=se.substring(0,ce)+"."+se.substring(ce);se[0]==="0"&&se[1]!==".";)se=se.substring(1);for(;se[se.length-1]==="0"&&se[se.length-2]!==".";)se=se.substring(0,se.length-1);return te+se}class V{format;#e;#t;#r;_value;constructor(J,te,se){(0,v.assertPrivate)(J,N,"FixedNumber"),this.#t=te,this.#e=se;const ce=D(te,se.decimals);(0,_.defineProperties)(this,{format:se.name,_value:ce}),this.#r=B(se.decimals)}get signed(){return this.#e.signed}get width(){return this.#e.width}get decimals(){return this.#e.decimals}get value(){return this.#t}#n(J){(0,v.assertArgument)(this.format===J.format,"incompatible format; use fixedNumber.toFormat","other",J)}#i(J,te){return J=O(J,this.#e,te),new V(N,J,this.#e)}#s(J,te){return this.#n(J),this.#i(this.#t+J.#t,te)}addUnsafe(J){return this.#s(J)}add(J){return this.#s(J,"add")}#a(J,te){return this.#n(J),this.#i(this.#t-J.#t,te)}subUnsafe(J){return this.#a(J)}sub(J){return this.#a(J,"sub")}#o(J,te){return this.#n(J),this.#i(this.#t*J.#t/this.#r,te)}mulUnsafe(J){return this.#o(J)}mul(J){return this.#o(J,"mul")}mulSignal(J){this.#n(J);const te=this.#t*J.#t;return(0,v.assert)(te%this.#r===E,"precision lost during signalling mul","NUMERIC_FAULT",{operation:"mulSignal",fault:"underflow",value:this}),this.#i(te/this.#r,"mulSignal")}#u(J,te){return(0,v.assert)(J.#t!==E,"division by zero","NUMERIC_FAULT",{operation:"div",fault:"divide-by-zero",value:this}),this.#n(J),this.#i(this.#t*this.#r/J.#t,te)}divUnsafe(J){return this.#u(J)}div(J){return this.#u(J,"div")}divSignal(J){(0,v.assert)(J.#t!==E,"division by zero","NUMERIC_FAULT",{operation:"div",fault:"divide-by-zero",value:this}),this.#n(J);const te=this.#t*this.#r;return(0,v.assert)(te%J.#t===E,"precision lost during signalling div","NUMERIC_FAULT",{operation:"divSignal",fault:"underflow",value:this}),this.#i(te/J.#t,"divSignal")}cmp(J){let te=this.value,se=J.value;const ce=this.decimals-J.decimals;return ce>0?se*=B(ce):ce<0&&(te*=B(-ce)),te<se?-1:te>se?1:0}eq(J){return this.cmp(J)===0}lt(J){return this.cmp(J)<0}lte(J){return this.cmp(J)<=0}gt(J){return this.cmp(J)>0}gte(J){return this.cmp(J)>=0}floor(){let J=this.#t;return this.#t<E&&(J-=this.#r-k),J=this.#t/this.#r*this.#r,this.#i(J,"floor")}ceiling(){let J=this.#t;return this.#t>E&&(J+=this.#r-k),J=this.#t/this.#r*this.#r,this.#i(J,"ceiling")}round(J){if(J==null&&(J=0),J>=this.decimals)return this;const te=this.decimals-J,se=P*B(te-1);let ce=this.value+se;const ae=B(te);return ce=ce/ae*ae,O(ce,this.#e,"round"),new V(N,ce,this.#e)}isZero(){return this.#t===E}isNegative(){return this.#t<E}toString(){return this._value}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(J){return V.fromString(this.toString(),J)}static fromValue(J,te,se){const ce=te==null?0:(0,w.getNumber)(te),ae=I(se);let he=(0,w.getBigInt)(J,"value");const oe=ce-ae.decimals;if(oe>0){const de=B(oe);(0,v.assert)(he%de===E,"value loses precision for format","NUMERIC_FAULT",{operation:"fromValue",fault:"underflow",value:J}),he/=de}else oe<0&&(he*=B(-oe));return O(he,ae,"fromValue"),new V(N,he,ae)}static fromString(J,te){const se=J.match(/^(-?)([0-9]*)\.?([0-9]*)$/);(0,v.assertArgument)(se&&se[2].length+se[3].length>0,"invalid FixedNumber string value","value",J);const ce=I(te);let ae=se[2]||"0",he=se[3]||"";for(;he.length<ce.decimals;)he+=q;(0,v.assert)(he.substring(ce.decimals).match(/^0*$/),"too many decimals for format","NUMERIC_FAULT",{operation:"fromString",fault:"underflow",value:J}),he=he.substring(0,ce.decimals);const oe=BigInt(se[1]+ae+he);return O(oe,ce,"fromString"),new V(N,oe,ce)}static fromBytes(J,te){let se=(0,w.toBigInt)((0,b.getBytes)(J,"value"));const ce=I(te);return ce.signed&&(se=(0,w.fromTwos)(se,ce.width)),O(se,ce,"fromBytes"),new V(N,se,ce)}}return fixednumber.FixedNumber=V,fixednumber}var rlpDecode={},hasRequiredRlpDecode;function requireRlpDecode(){if(hasRequiredRlpDecode)return rlpDecode;hasRequiredRlpDecode=1,Object.defineProperty(rlpDecode,"__esModule",{value:!0}),rlpDecode.decodeRlp=void 0;const b=requireData(),v=requireErrors(),w=requireData();function _(N){let q=N.toString(16);for(;q.length<2;)q="0"+q;return"0x"+q}function A(N,q,B){let O=0;for(let I=0;I<B;I++)O=O*256+N[q+I];return O}function E(N,q,B,O){const I=[];for(;B<q+1+O;){const D=k(N,B);I.push(D.result),B+=D.consumed,(0,v.assert)(B<=q+1+O,"child data too short","BUFFER_OVERRUN",{buffer:N,length:O,offset:q})}return{consumed:1+O,result:I}}function k(N,q){(0,v.assert)(N.length!==0,"data too short","BUFFER_OVERRUN",{buffer:N,length:0,offset:1});const B=O=>{(0,v.assert)(O<=N.length,"data short segment too short","BUFFER_OVERRUN",{buffer:N,length:N.length,offset:O})};if(N[q]>=248){const O=N[q]-247;B(q+1+O);const I=A(N,q+1,O);return B(q+1+O+I),E(N,q,q+1+O,O+I)}else if(N[q]>=192){const O=N[q]-192;return B(q+1+O),E(N,q,q+1,O)}else if(N[q]>=184){const O=N[q]-183;B(q+1+O);const I=A(N,q+1,O);B(q+1+O+I);const D=(0,b.hexlify)(N.slice(q+1+O,q+1+O+I));return{consumed:1+O+I,result:D}}else if(N[q]>=128){const O=N[q]-128;B(q+1+O);const I=(0,b.hexlify)(N.slice(q+1,q+1+O));return{consumed:1+O,result:I}}return{consumed:1,result:_(N[q])}}function P(N){const q=(0,w.getBytes)(N,"data"),B=k(q,0);return(0,v.assertArgument)(B.consumed===q.length,"unexpected junk after rlp payload","data",N),B.result}return rlpDecode.decodeRlp=P,rlpDecode}var rlpEncode={},hasRequiredRlpEncode;function requireRlpEncode(){if(hasRequiredRlpEncode)return rlpEncode;hasRequiredRlpEncode=1,Object.defineProperty(rlpEncode,"__esModule",{value:!0}),rlpEncode.encodeRlp=void 0;const b=requireData();function v(E){const k=[];for(;E;)k.unshift(E&255),E>>=8;return k}function w(E){if(Array.isArray(E)){let N=[];if(E.forEach(function(B){N=N.concat(w(B))}),N.length<=55)return N.unshift(192+N.length),N;const q=v(N.length);return q.unshift(247+q.length),q.concat(N)}const k=Array.prototype.slice.call((0,b.getBytes)(E,"object"));if(k.length===1&&k[0]<=127)return k;if(k.length<=55)return k.unshift(128+k.length),k;const P=v(k.length);return P.unshift(183+P.length),P.concat(k)}const _="0123456789abcdef";function A(E){let k="0x";for(const P of w(E))k+=_[P>>4],k+=_[P&15];return k}return rlpEncode.encodeRlp=A,rlpEncode}var units={},hasRequiredUnits;function requireUnits(){if(hasRequiredUnits)return units;hasRequiredUnits=1,Object.defineProperty(units,"__esModule",{value:!0}),units.parseEther=units.formatEther=units.parseUnits=units.formatUnits=void 0;const b=requireErrors(),v=requireFixednumber(),w=requireMaths(),_=["wei","kwei","mwei","gwei","szabo","finney","ether"];function A(N,q){let B=18;if(typeof q=="string"){const O=_.indexOf(q);(0,b.assertArgument)(O>=0,"invalid unit","unit",q),B=3*O}else q!=null&&(B=(0,w.getNumber)(q,"unit"));return v.FixedNumber.fromValue(N,B,{decimals:B,width:512}).toString()}units.formatUnits=A;function E(N,q){(0,b.assertArgument)(typeof N=="string","value must be a string","value",N);let B=18;if(typeof q=="string"){const O=_.indexOf(q);(0,b.assertArgument)(O>=0,"invalid unit","unit",q),B=3*O}else q!=null&&(B=(0,w.getNumber)(q,"unit"));return v.FixedNumber.fromString(N,{decimals:B,width:512}).value}units.parseUnits=E;function k(N){return A(N,18)}units.formatEther=k;function P(N){return E(N,18)}return units.parseEther=P,units}var uuid={},hasRequiredUuid;function requireUuid(){if(hasRequiredUuid)return uuid;hasRequiredUuid=1,Object.defineProperty(uuid,"__esModule",{value:!0}),uuid.uuidV4=void 0;const b=requireData();function v(w){const _=(0,b.getBytes)(w,"randomBytes");_[6]=_[6]&15|64,_[8]=_[8]&63|128;const A=(0,b.hexlify)(_);return[A.substring(2,10),A.substring(10,14),A.substring(14,18),A.substring(18,22),A.substring(22,34)].join("-")}return uuid.uuidV4=v,uuid}var hasRequiredUtils$3;function requireUtils$3(){return hasRequiredUtils$3||(hasRequiredUtils$3=1,function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.toUtf8String=b.toUtf8CodePoints=b.toUtf8Bytes=b.parseUnits=b.formatUnits=b.parseEther=b.formatEther=b.encodeRlp=b.decodeRlp=b.defineProperties=b.resolveProperties=b.toQuantity=b.toBeArray=b.toBeHex=b.toNumber=b.toBigInt=b.getUint=b.getNumber=b.getBigInt=b.mask=b.toTwos=b.fromTwos=b.FixedNumber=b.FetchCancelSignal=b.FetchResponse=b.FetchRequest=b.EventPayload=b.makeError=b.assertNormalize=b.assertPrivate=b.assertArgumentCount=b.assertArgument=b.assert=b.isError=b.isCallException=b.zeroPadBytes=b.zeroPadValue=b.stripZerosLeft=b.dataSlice=b.dataLength=b.concat=b.hexlify=b.isBytesLike=b.isHexString=b.getBytesCopy=b.getBytes=b.encodeBase64=b.decodeBase64=b.encodeBase58=b.decodeBase58=void 0,b.uuidV4=b.Utf8ErrorFuncs=void 0;var v=requireBase58();Object.defineProperty(b,"decodeBase58",{enumerable:!0,get:function(){return v.decodeBase58}}),Object.defineProperty(b,"encodeBase58",{enumerable:!0,get:function(){return v.encodeBase58}});var w=requireBase64Browser();Object.defineProperty(b,"decodeBase64",{enumerable:!0,get:function(){return w.decodeBase64}}),Object.defineProperty(b,"encodeBase64",{enumerable:!0,get:function(){return w.encodeBase64}});var _=requireData();Object.defineProperty(b,"getBytes",{enumerable:!0,get:function(){return _.getBytes}}),Object.defineProperty(b,"getBytesCopy",{enumerable:!0,get:function(){return _.getBytesCopy}}),Object.defineProperty(b,"isHexString",{enumerable:!0,get:function(){return _.isHexString}}),Object.defineProperty(b,"isBytesLike",{enumerable:!0,get:function(){return _.isBytesLike}}),Object.defineProperty(b,"hexlify",{enumerable:!0,get:function(){return _.hexlify}}),Object.defineProperty(b,"concat",{enumerable:!0,get:function(){return _.concat}}),Object.defineProperty(b,"dataLength",{enumerable:!0,get:function(){return _.dataLength}}),Object.defineProperty(b,"dataSlice",{enumerable:!0,get:function(){return _.dataSlice}}),Object.defineProperty(b,"stripZerosLeft",{enumerable:!0,get:function(){return _.stripZerosLeft}}),Object.defineProperty(b,"zeroPadValue",{enumerable:!0,get:function(){return _.zeroPadValue}}),Object.defineProperty(b,"zeroPadBytes",{enumerable:!0,get:function(){return _.zeroPadBytes}});var A=requireErrors();Object.defineProperty(b,"isCallException",{enumerable:!0,get:function(){return A.isCallException}}),Object.defineProperty(b,"isError",{enumerable:!0,get:function(){return A.isError}}),Object.defineProperty(b,"assert",{enumerable:!0,get:function(){return A.assert}}),Object.defineProperty(b,"assertArgument",{enumerable:!0,get:function(){return A.assertArgument}}),Object.defineProperty(b,"assertArgumentCount",{enumerable:!0,get:function(){return A.assertArgumentCount}}),Object.defineProperty(b,"assertPrivate",{enumerable:!0,get:function(){return A.assertPrivate}}),Object.defineProperty(b,"assertNormalize",{enumerable:!0,get:function(){return A.assertNormalize}}),Object.defineProperty(b,"makeError",{enumerable:!0,get:function(){return A.makeError}});var E=requireEvents();Object.defineProperty(b,"EventPayload",{enumerable:!0,get:function(){return E.EventPayload}});var k=requireFetch();Object.defineProperty(b,"FetchRequest",{enumerable:!0,get:function(){return k.FetchRequest}}),Object.defineProperty(b,"FetchResponse",{enumerable:!0,get:function(){return k.FetchResponse}}),Object.defineProperty(b,"FetchCancelSignal",{enumerable:!0,get:function(){return k.FetchCancelSignal}});var P=requireFixednumber();Object.defineProperty(b,"FixedNumber",{enumerable:!0,get:function(){return P.FixedNumber}});var N=requireMaths();Object.defineProperty(b,"fromTwos",{enumerable:!0,get:function(){return N.fromTwos}}),Object.defineProperty(b,"toTwos",{enumerable:!0,get:function(){return N.toTwos}}),Object.defineProperty(b,"mask",{enumerable:!0,get:function(){return N.mask}}),Object.defineProperty(b,"getBigInt",{enumerable:!0,get:function(){return N.getBigInt}}),Object.defineProperty(b,"getNumber",{enumerable:!0,get:function(){return N.getNumber}}),Object.defineProperty(b,"getUint",{enumerable:!0,get:function(){return N.getUint}}),Object.defineProperty(b,"toBigInt",{enumerable:!0,get:function(){return N.toBigInt}}),Object.defineProperty(b,"toNumber",{enumerable:!0,get:function(){return N.toNumber}}),Object.defineProperty(b,"toBeHex",{enumerable:!0,get:function(){return N.toBeHex}}),Object.defineProperty(b,"toBeArray",{enumerable:!0,get:function(){return N.toBeArray}}),Object.defineProperty(b,"toQuantity",{enumerable:!0,get:function(){return N.toQuantity}});var q=requireProperties();Object.defineProperty(b,"resolveProperties",{enumerable:!0,get:function(){return q.resolveProperties}}),Object.defineProperty(b,"defineProperties",{enumerable:!0,get:function(){return q.defineProperties}});var B=requireRlpDecode();Object.defineProperty(b,"decodeRlp",{enumerable:!0,get:function(){return B.decodeRlp}});var O=requireRlpEncode();Object.defineProperty(b,"encodeRlp",{enumerable:!0,get:function(){return O.encodeRlp}});var I=requireUnits();Object.defineProperty(b,"formatEther",{enumerable:!0,get:function(){return I.formatEther}}),Object.defineProperty(b,"parseEther",{enumerable:!0,get:function(){return I.parseEther}}),Object.defineProperty(b,"formatUnits",{enumerable:!0,get:function(){return I.formatUnits}}),Object.defineProperty(b,"parseUnits",{enumerable:!0,get:function(){return I.parseUnits}});var D=requireUtf8();Object.defineProperty(b,"toUtf8Bytes",{enumerable:!0,get:function(){return D.toUtf8Bytes}}),Object.defineProperty(b,"toUtf8CodePoints",{enumerable:!0,get:function(){return D.toUtf8CodePoints}}),Object.defineProperty(b,"toUtf8String",{enumerable:!0,get:function(){return D.toUtf8String}}),Object.defineProperty(b,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return D.Utf8ErrorFuncs}});var V=requireUuid();Object.defineProperty(b,"uuidV4",{enumerable:!0,get:function(){return V.uuidV4}})}(utils$s)),utils$s}var abstractCoder={},hasRequiredAbstractCoder;function requireAbstractCoder(){return hasRequiredAbstractCoder||(hasRequiredAbstractCoder=1,function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.Reader=b.Writer=b.Coder=b.checkResultErrors=b.Result=b.WordSize=void 0;const v=requireUtils$3();b.WordSize=32;const w=new Uint8Array(b.WordSize),_=["then"],A={};function E(I,D){const V=new Error(`deferred error during ABI decoding triggered accessing ${I}`);throw V.error=D,V}class k extends Array{#e;constructor(...D){const V=D[0];let ee=D[1],J=(D[2]||[]).slice(),te=!0;V!==A&&(ee=D,J=[],te=!1),super(ee.length),ee.forEach((ce,ae)=>{this[ae]=ce});const se=J.reduce((ce,ae)=>(typeof ae=="string"&&ce.set(ae,(ce.get(ae)||0)+1),ce),new Map);if(this.#e=Object.freeze(ee.map((ce,ae)=>{const he=J[ae];return he!=null&&se.get(he)===1?he:null})),!!te)return Object.freeze(this),new Proxy(this,{get:(ce,ae,he)=>{if(typeof ae=="string"){if(ae.match(/^[0-9]+$/)){const de=(0,v.getNumber)(ae,"%index");if(de<0||de>=this.length)throw new RangeError("out of result range");const le=ce[de];return le instanceof Error&&E(`index ${de}`,le),le}if(_.indexOf(ae)>=0)return Reflect.get(ce,ae,he);const oe=ce[ae];if(oe instanceof Function)return function(...de){return oe.apply(this===he?ce:this,de)};if(!(ae in ce))return ce.getValue.apply(this===he?ce:this,[ae])}return Reflect.get(ce,ae,he)}})}toArray(){const D=[];return this.forEach((V,ee)=>{V instanceof Error&&E(`index ${ee}`,V),D.push(V)}),D}toObject(){return this.#e.reduce((D,V,ee)=>((0,v.assert)(V!=null,"value at index ${ index } unnamed","UNSUPPORTED_OPERATION",{operation:"toObject()"}),V in D||(D[V]=this.getValue(V)),D),{})}slice(D,V){D==null&&(D=0),D<0&&(D+=this.length,D<0&&(D=0)),V==null&&(V=this.length),V<0&&(V+=this.length,V<0&&(V=0)),V>this.length&&(V=this.length);const ee=[],J=[];for(let te=D;te<V;te++)ee.push(this[te]),J.push(this.#e[te]);return new k(A,ee,J)}filter(D,V){const ee=[],J=[];for(let te=0;te<this.length;te++){const se=this[te];se instanceof Error&&E(`index ${te}`,se),D.call(V,se,te,this)&&(ee.push(se),J.push(this.#e[te]))}return new k(A,ee,J)}map(D,V){const ee=[];for(let J=0;J<this.length;J++){const te=this[J];te instanceof Error&&E(`index ${J}`,te),ee.push(D.call(V,te,J,this))}return ee}getValue(D){const V=this.#e.indexOf(D);if(V===-1)return;const ee=this[V];return ee instanceof Error&&E(`property ${JSON.stringify(D)}`,ee.error),ee}static fromItems(D,V){return new k(A,D,V)}}b.Result=k;function P(I){const D=[],V=function(ee,J){if(Array.isArray(J))for(let te in J){const se=ee.slice();se.push(te);try{V(se,J[te])}catch(ce){D.push({path:se,error:ce})}}};return V([],I),D}b.checkResultErrors=P;function N(I){let D=(0,v.toBeArray)(I);return(0,v.assert)(D.length<=b.WordSize,"value out-of-bounds","BUFFER_OVERRUN",{buffer:D,length:b.WordSize,offset:D.length}),D.length!==b.WordSize&&(D=(0,v.getBytesCopy)((0,v.concat)([w.slice(D.length%b.WordSize),D]))),D}class q{name;type;localName;dynamic;constructor(D,V,ee,J){(0,v.defineProperties)(this,{name:D,type:V,localName:ee,dynamic:J},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(D,V){(0,v.assertArgument)(!1,D,this.localName,V)}}b.Coder=q;class B{#e;#t;constructor(){this.#e=[],this.#t=0}get data(){return(0,v.concat)(this.#e)}get length(){return this.#t}#r(D){return this.#e.push(D),this.#t+=D.length,D.length}appendWriter(D){return this.#r((0,v.getBytesCopy)(D.data))}writeBytes(D){let V=(0,v.getBytesCopy)(D);const ee=V.length%b.WordSize;return ee&&(V=(0,v.getBytesCopy)((0,v.concat)([V,w.slice(ee)]))),this.#r(V)}writeValue(D){return this.#r(N(D))}writeUpdatableValue(){const D=this.#e.length;return this.#e.push(w),this.#t+=b.WordSize,V=>{this.#e[D]=N(V)}}}b.Writer=B;class O{allowLoose;#e;#t;constructor(D,V){(0,v.defineProperties)(this,{allowLoose:!!V}),this.#e=(0,v.getBytesCopy)(D),this.#t=0}get data(){return(0,v.hexlify)(this.#e)}get dataLength(){return this.#e.length}get consumed(){return this.#t}get bytes(){return new Uint8Array(this.#e)}#r(D,V,ee){let J=Math.ceil(V/b.WordSize)*b.WordSize;return this.#t+J>this.#e.length&&(this.allowLoose&&ee&&this.#t+V<=this.#e.length?J=V:(0,v.assert)(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:(0,v.getBytesCopy)(this.#e),length:this.#e.length,offset:this.#t+J})),this.#e.slice(this.#t,this.#t+J)}subReader(D){return new O(this.#e.slice(this.#t+D),this.allowLoose)}readBytes(D,V){let ee=this.#r(0,D,!!V);return this.#t+=ee.length,ee.slice(0,D)}readValue(){return(0,v.toBigInt)(this.readBytes(b.WordSize))}readIndex(){return(0,v.toNumber)(this.readBytes(b.WordSize))}}b.Reader=O}(abstractCoder)),abstractCoder}var address$3={},address$2={},address$1={},crypto$3={},hmac$2={},cryptoBrowser={},hmac$1={},_assert={},hasRequired_assert;function require_assert(){if(hasRequired_assert)return _assert;hasRequired_assert=1,Object.defineProperty(_assert,"__esModule",{value:!0}),_assert.output=_assert.exists=_assert.hash=_assert.bytes=_assert.bool=_assert.number=void 0;function b(P){if(!Number.isSafeInteger(P)||P<0)throw new Error(`Wrong positive integer: ${P}`)}_assert.number=b;function v(P){if(typeof P!="boolean")throw new Error(`Expected boolean, not ${P}`)}_assert.bool=v;function w(P,...N){if(!(P instanceof Uint8Array))throw new Error("Expected Uint8Array");if(N.length>0&&!N.includes(P.length))throw new Error(`Expected Uint8Array of length ${N}, not of length=${P.length}`)}_assert.bytes=w;function _(P){if(typeof P!="function"||typeof P.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");b(P.outputLen),b(P.blockLen)}_assert.hash=_;function A(P,N=!0){if(P.destroyed)throw new Error("Hash instance has been destroyed");if(N&&P.finished)throw new Error("Hash#digest() has already been called")}_assert.exists=A;function E(P,N){w(P);const q=N.outputLen;if(P.length<q)throw new Error(`digestInto() expects output buffer of length at least ${q}`)}_assert.output=E;const k={number:b,bool:v,bytes:w,hash:_,exists:A,output:E};return _assert.default=k,_assert}var utils$r={},crypto$2={},hasRequiredCrypto$1;function requireCrypto$1(){return hasRequiredCrypto$1||(hasRequiredCrypto$1=1,Object.defineProperty(crypto$2,"__esModule",{value:!0}),crypto$2.crypto=void 0,crypto$2.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),crypto$2}var hasRequiredUtils$2;function requireUtils$2(){return hasRequiredUtils$2||(hasRequiredUtils$2=1,function(b){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(b,"__esModule",{value:!0}),b.randomBytes=b.wrapXOFConstructorWithOpts=b.wrapConstructorWithOpts=b.wrapConstructor=b.checkOpts=b.Hash=b.concatBytes=b.toBytes=b.utf8ToBytes=b.asyncLoop=b.nextTick=b.hexToBytes=b.bytesToHex=b.isLE=b.rotr=b.createView=b.u32=b.u8=void 0;const v=requireCrypto$1(),w=oe=>oe instanceof Uint8Array,_=oe=>new Uint8Array(oe.buffer,oe.byteOffset,oe.byteLength);b.u8=_;const A=oe=>new Uint32Array(oe.buffer,oe.byteOffset,Math.floor(oe.byteLength/4));b.u32=A;const E=oe=>new DataView(oe.buffer,oe.byteOffset,oe.byteLength);b.createView=E;const k=(oe,de)=>oe<<32-de|oe>>>de;if(b.rotr=k,b.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!b.isLE)throw new Error("Non little-endian hardware is not supported");const P=Array.from({length:256},(oe,de)=>de.toString(16).padStart(2,"0"));function N(oe){if(!w(oe))throw new Error("Uint8Array expected");let de="";for(let le=0;le<oe.length;le++)de+=P[oe[le]];return de}b.bytesToHex=N;function q(oe){if(typeof oe!="string")throw new Error("hex string expected, got "+typeof oe);const de=oe.length;if(de%2)throw new Error("padded hex string expected, got unpadded hex of length "+de);const le=new Uint8Array(de/2);for(let be=0;be<le.length;be++){const pe=be*2,fe=oe.slice(pe,pe+2),Z=Number.parseInt(fe,16);if(Number.isNaN(Z)||Z<0)throw new Error("Invalid byte sequence");le[be]=Z}return le}b.hexToBytes=q;const B=async()=>{};b.nextTick=B;async function O(oe,de,le){let be=Date.now();for(let pe=0;pe<oe;pe++){le(pe);const fe=Date.now()-be;fe>=0&&fe<de||(await(0,b.nextTick)(),be+=fe)}}b.asyncLoop=O;function I(oe){if(typeof oe!="string")throw new Error(`utf8ToBytes expected string, got ${typeof oe}`);return new Uint8Array(new TextEncoder().encode(oe))}b.utf8ToBytes=I;function D(oe){if(typeof oe=="string"&&(oe=I(oe)),!w(oe))throw new Error(`expected Uint8Array, got ${typeof oe}`);return oe}b.toBytes=D;function V(...oe){const de=new Uint8Array(oe.reduce((be,pe)=>be+pe.length,0));let le=0;return oe.forEach(be=>{if(!w(be))throw new Error("Uint8Array expected");de.set(be,le),le+=be.length}),de}b.concatBytes=V;class ee{clone(){return this._cloneInto()}}b.Hash=ee;const J={}.toString;function te(oe,de){if(de!==void 0&&J.call(de)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(oe,de)}b.checkOpts=te;function se(oe){const de=be=>oe().update(D(be)).digest(),le=oe();return de.outputLen=le.outputLen,de.blockLen=le.blockLen,de.create=()=>oe(),de}b.wrapConstructor=se;function ce(oe){const de=(be,pe)=>oe(pe).update(D(be)).digest(),le=oe({});return de.outputLen=le.outputLen,de.blockLen=le.blockLen,de.create=be=>oe(be),de}b.wrapConstructorWithOpts=ce;function ae(oe){const de=(be,pe)=>oe(pe).update(D(be)).digest(),le=oe({});return de.outputLen=le.outputLen,de.blockLen=le.blockLen,de.create=be=>oe(be),de}b.wrapXOFConstructorWithOpts=ae;function he(oe=32){if(v.crypto&&typeof v.crypto.getRandomValues=="function")return v.crypto.getRandomValues(new Uint8Array(oe));throw new Error("crypto.getRandomValues must be defined")}b.randomBytes=he}(utils$r)),utils$r}var hasRequiredHmac$1;function requireHmac$1(){return hasRequiredHmac$1||(hasRequiredHmac$1=1,function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.hmac=b.HMAC=void 0;const v=require_assert(),w=requireUtils$2();class _ extends w.Hash{constructor(k,P){super(),this.finished=!1,this.destroyed=!1,(0,v.hash)(k);const N=(0,w.toBytes)(P);if(this.iHash=k.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const q=this.blockLen,B=new Uint8Array(q);B.set(N.length>q?k.create().update(N).digest():N);for(let O=0;O<B.length;O++)B[O]^=54;this.iHash.update(B),this.oHash=k.create();for(let O=0;O<B.length;O++)B[O]^=106;this.oHash.update(B),B.fill(0)}update(k){return(0,v.exists)(this),this.iHash.update(k),this}digestInto(k){(0,v.exists)(this),(0,v.bytes)(k,this.outputLen),this.finished=!0,this.iHash.digestInto(k),this.oHash.update(k),this.oHash.digestInto(k),this.destroy()}digest(){const k=new Uint8Array(this.oHash.outputLen);return this.digestInto(k),k}_cloneInto(k){k||(k=Object.create(Object.getPrototypeOf(this),{}));const{oHash:P,iHash:N,finished:q,destroyed:B,blockLen:O,outputLen:I}=this;return k=k,k.finished=q,k.destroyed=B,k.blockLen=O,k.outputLen=I,k.oHash=P._cloneInto(k.oHash),k.iHash=N._cloneInto(k.iHash),k}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}b.HMAC=_;const A=(E,k,P)=>new _(E,k).update(P).digest();b.hmac=A,b.hmac.create=(E,k)=>new _(E,k)}(hmac$1)),hmac$1}var pbkdf2$2={},hasRequiredPbkdf2$1;function requirePbkdf2$1(){if(hasRequiredPbkdf2$1)return pbkdf2$2;hasRequiredPbkdf2$1=1,Object.defineProperty(pbkdf2$2,"__esModule",{value:!0}),pbkdf2$2.pbkdf2Async=pbkdf2$2.pbkdf2=void 0;const b=require_assert(),v=requireHmac$1(),w=requireUtils$2();function _(P,N,q,B){(0,b.hash)(P);const O=(0,w.checkOpts)({dkLen:32,asyncTick:10},B),{c:I,dkLen:D,asyncTick:V}=O;if((0,b.number)(I),(0,b.number)(D),(0,b.number)(V),I<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const ee=(0,w.toBytes)(N),J=(0,w.toBytes)(q),te=new Uint8Array(D),se=v.hmac.create(P,ee),ce=se._cloneInto().update(J);return{c:I,dkLen:D,asyncTick:V,DK:te,PRF:se,PRFSalt:ce}}function A(P,N,q,B,O){return P.destroy(),N.destroy(),B&&B.destroy(),O.fill(0),q}function E(P,N,q,B){const{c:O,dkLen:I,DK:D,PRF:V,PRFSalt:ee}=_(P,N,q,B);let J;const te=new Uint8Array(4),se=(0,w.createView)(te),ce=new Uint8Array(V.outputLen);for(let ae=1,he=0;he<I;ae++,he+=V.outputLen){const oe=D.subarray(he,he+V.outputLen);se.setInt32(0,ae,!1),(J=ee._cloneInto(J)).update(te).digestInto(ce),oe.set(ce.subarray(0,oe.length));for(let de=1;de<O;de++){V._cloneInto(J).update(ce).digestInto(ce);for(let le=0;le<oe.length;le++)oe[le]^=ce[le]}}return A(V,ee,D,J,ce)}pbkdf2$2.pbkdf2=E;async function k(P,N,q,B){const{c:O,dkLen:I,asyncTick:D,DK:V,PRF:ee,PRFSalt:J}=_(P,N,q,B);let te;const se=new Uint8Array(4),ce=(0,w.createView)(se),ae=new Uint8Array(ee.outputLen);for(let he=1,oe=0;oe<I;he++,oe+=ee.outputLen){const de=V.subarray(oe,oe+ee.outputLen);ce.setInt32(0,he,!1),(te=J._cloneInto(te)).update(se).digestInto(ae),de.set(ae.subarray(0,de.length)),await(0,w.asyncLoop)(O-1,D,()=>{ee._cloneInto(te).update(ae).digestInto(ae);for(let le=0;le<de.length;le++)de[le]^=ae[le]})}return A(ee,J,V,te,ae)}return pbkdf2$2.pbkdf2Async=k,pbkdf2$2}var sha256$2={},_sha2={},hasRequired_sha2;function require_sha2(){if(hasRequired_sha2)return _sha2;hasRequired_sha2=1,Object.defineProperty(_sha2,"__esModule",{value:!0}),_sha2.SHA2=void 0;const b=require_assert(),v=requireUtils$2();function w(A,E,k,P){if(typeof A.setBigUint64=="function")return A.setBigUint64(E,k,P);const N=BigInt(32),q=BigInt(4294967295),B=Number(k>>N&q),O=Number(k&q),I=P?4:0,D=P?0:4;A.setUint32(E+I,B,P),A.setUint32(E+D,O,P)}class _ extends v.Hash{constructor(E,k,P,N){super(),this.blockLen=E,this.outputLen=k,this.padOffset=P,this.isLE=N,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(E),this.view=(0,v.createView)(this.buffer)}update(E){(0,b.exists)(this);const{view:k,buffer:P,blockLen:N}=this;E=(0,v.toBytes)(E);const q=E.length;for(let B=0;B<q;){const O=Math.min(N-this.pos,q-B);if(O===N){const I=(0,v.createView)(E);for(;N<=q-B;B+=N)this.process(I,B);continue}P.set(E.subarray(B,B+O),this.pos),this.pos+=O,B+=O,this.pos===N&&(this.process(k,0),this.pos=0)}return this.length+=E.length,this.roundClean(),this}digestInto(E){(0,b.exists)(this),(0,b.output)(E,this),this.finished=!0;const{buffer:k,view:P,blockLen:N,isLE:q}=this;let{pos:B}=this;k[B++]=128,this.buffer.subarray(B).fill(0),this.padOffset>N-B&&(this.process(P,0),B=0);for(let ee=B;ee<N;ee++)k[ee]=0;w(P,N-8,BigInt(this.length*8),q),this.process(P,0);const O=(0,v.createView)(E),I=this.outputLen;if(I%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const D=I/4,V=this.get();if(D>V.length)throw new Error("_sha2: outputLen bigger than state");for(let ee=0;ee<D;ee++)O.setUint32(4*ee,V[ee],q)}digest(){const{buffer:E,outputLen:k}=this;this.digestInto(E);const P=E.slice(0,k);return this.destroy(),P}_cloneInto(E){E||(E=new this.constructor),E.set(...this.get());const{blockLen:k,buffer:P,length:N,finished:q,destroyed:B,pos:O}=this;return E.length=N,E.pos=O,E.finished=q,E.destroyed=B,N%k&&E.buffer.set(P),E}}return _sha2.SHA2=_,_sha2}var hasRequiredSha256;function requireSha256(){if(hasRequiredSha256)return sha256$2;hasRequiredSha256=1,Object.defineProperty(sha256$2,"__esModule",{value:!0}),sha256$2.sha224=sha256$2.sha256=void 0;const b=require_sha2(),v=requireUtils$2(),w=(q,B,O)=>q&B^~q&O,_=(q,B,O)=>q&B^q&O^B&O,A=new Uint32Array([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]),E=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),k=new Uint32Array(64);class P extends b.SHA2{constructor(){super(64,32,8,!1),this.A=E[0]|0,this.B=E[1]|0,this.C=E[2]|0,this.D=E[3]|0,this.E=E[4]|0,this.F=E[5]|0,this.G=E[6]|0,this.H=E[7]|0}get(){const{A:B,B:O,C:I,D,E:V,F:ee,G:J,H:te}=this;return[B,O,I,D,V,ee,J,te]}set(B,O,I,D,V,ee,J,te){this.A=B|0,this.B=O|0,this.C=I|0,this.D=D|0,this.E=V|0,this.F=ee|0,this.G=J|0,this.H=te|0}process(B,O){for(let ae=0;ae<16;ae++,O+=4)k[ae]=B.getUint32(O,!1);for(let ae=16;ae<64;ae++){const he=k[ae-15],oe=k[ae-2],de=(0,v.rotr)(he,7)^(0,v.rotr)(he,18)^he>>>3,le=(0,v.rotr)(oe,17)^(0,v.rotr)(oe,19)^oe>>>10;k[ae]=le+k[ae-7]+de+k[ae-16]|0}let{A:I,B:D,C:V,D:ee,E:J,F:te,G:se,H:ce}=this;for(let ae=0;ae<64;ae++){const he=(0,v.rotr)(J,6)^(0,v.rotr)(J,11)^(0,v.rotr)(J,25),oe=ce+he+w(J,te,se)+A[ae]+k[ae]|0,le=((0,v.rotr)(I,2)^(0,v.rotr)(I,13)^(0,v.rotr)(I,22))+_(I,D,V)|0;ce=se,se=te,te=J,J=ee+oe|0,ee=V,V=D,D=I,I=oe+le|0}I=I+this.A|0,D=D+this.B|0,V=V+this.C|0,ee=ee+this.D|0,J=J+this.E|0,te=te+this.F|0,se=se+this.G|0,ce=ce+this.H|0,this.set(I,D,V,ee,J,te,se,ce)}roundClean(){k.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class N extends P{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}return sha256$2.sha256=(0,v.wrapConstructor)(()=>new P),sha256$2.sha224=(0,v.wrapConstructor)(()=>new N),sha256$2}var sha512$2={},_u64={},hasRequired_u64;function require_u64(){if(hasRequired_u64)return _u64;hasRequired_u64=1,Object.defineProperty(_u64,"__esModule",{value:!0}),_u64.add5L=_u64.add5H=_u64.add4H=_u64.add4L=_u64.add3H=_u64.add3L=_u64.add=_u64.rotlBL=_u64.rotlBH=_u64.rotlSL=_u64.rotlSH=_u64.rotr32L=_u64.rotr32H=_u64.rotrBL=_u64.rotrBH=_u64.rotrSL=_u64.rotrSH=_u64.shrSL=_u64.shrSH=_u64.toBig=_u64.split=_u64.fromBig=void 0;const b=BigInt(2**32-1),v=BigInt(32);function w(be,pe=!1){return pe?{h:Number(be&b),l:Number(be>>v&b)}:{h:Number(be>>v&b)|0,l:Number(be&b)|0}}_u64.fromBig=w;function _(be,pe=!1){let fe=new Uint32Array(be.length),Z=new Uint32Array(be.length);for(let U=0;U<be.length;U++){const{h:S,l:C}=w(be[U],pe);[fe[U],Z[U]]=[S,C]}return[fe,Z]}_u64.split=_;const A=(be,pe)=>BigInt(be>>>0)<<v|BigInt(pe>>>0);_u64.toBig=A;const E=(be,pe,fe)=>be>>>fe;_u64.shrSH=E;const k=(be,pe,fe)=>be<<32-fe|pe>>>fe;_u64.shrSL=k;const P=(be,pe,fe)=>be>>>fe|pe<<32-fe;_u64.rotrSH=P;const N=(be,pe,fe)=>be<<32-fe|pe>>>fe;_u64.rotrSL=N;const q=(be,pe,fe)=>be<<64-fe|pe>>>fe-32;_u64.rotrBH=q;const B=(be,pe,fe)=>be>>>fe-32|pe<<64-fe;_u64.rotrBL=B;const O=(be,pe)=>pe;_u64.rotr32H=O;const I=(be,pe)=>be;_u64.rotr32L=I;const D=(be,pe,fe)=>be<<fe|pe>>>32-fe;_u64.rotlSH=D;const V=(be,pe,fe)=>pe<<fe|be>>>32-fe;_u64.rotlSL=V;const ee=(be,pe,fe)=>pe<<fe-32|be>>>64-fe;_u64.rotlBH=ee;const J=(be,pe,fe)=>be<<fe-32|pe>>>64-fe;_u64.rotlBL=J;function te(be,pe,fe,Z){const U=(pe>>>0)+(Z>>>0);return{h:be+fe+(U/2**32|0)|0,l:U|0}}_u64.add=te;const se=(be,pe,fe)=>(be>>>0)+(pe>>>0)+(fe>>>0);_u64.add3L=se;const ce=(be,pe,fe,Z)=>pe+fe+Z+(be/2**32|0)|0;_u64.add3H=ce;const ae=(be,pe,fe,Z)=>(be>>>0)+(pe>>>0)+(fe>>>0)+(Z>>>0);_u64.add4L=ae;const he=(be,pe,fe,Z,U)=>pe+fe+Z+U+(be/2**32|0)|0;_u64.add4H=he;const oe=(be,pe,fe,Z,U)=>(be>>>0)+(pe>>>0)+(fe>>>0)+(Z>>>0)+(U>>>0);_u64.add5L=oe;const de=(be,pe,fe,Z,U,S)=>pe+fe+Z+U+S+(be/2**32|0)|0;_u64.add5H=de;const le={fromBig:w,split:_,toBig:A,shrSH:E,shrSL:k,rotrSH:P,rotrSL:N,rotrBH:q,rotrBL:B,rotr32H:O,rotr32L:I,rotlSH:D,rotlSL:V,rotlBH:ee,rotlBL:J,add:te,add3L:se,add3H:ce,add4L:ae,add4H:he,add5H:de,add5L:oe};return _u64.default=le,_u64}var hasRequiredSha512;function requireSha512(){if(hasRequiredSha512)return sha512$2;hasRequiredSha512=1,Object.defineProperty(sha512$2,"__esModule",{value:!0}),sha512$2.sha384=sha512$2.sha512_256=sha512$2.sha512_224=sha512$2.sha512=sha512$2.SHA512=void 0;const b=require_sha2(),v=require_u64(),w=requireUtils$2(),[_,A]=v.default.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(O=>BigInt(O))),E=new Uint32Array(80),k=new Uint32Array(80);class P extends b.SHA2{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:I,Al:D,Bh:V,Bl:ee,Ch:J,Cl:te,Dh:se,Dl:ce,Eh:ae,El:he,Fh:oe,Fl:de,Gh:le,Gl:be,Hh:pe,Hl:fe}=this;return[I,D,V,ee,J,te,se,ce,ae,he,oe,de,le,be,pe,fe]}set(I,D,V,ee,J,te,se,ce,ae,he,oe,de,le,be,pe,fe){this.Ah=I|0,this.Al=D|0,this.Bh=V|0,this.Bl=ee|0,this.Ch=J|0,this.Cl=te|0,this.Dh=se|0,this.Dl=ce|0,this.Eh=ae|0,this.El=he|0,this.Fh=oe|0,this.Fl=de|0,this.Gh=le|0,this.Gl=be|0,this.Hh=pe|0,this.Hl=fe|0}process(I,D){for(let S=0;S<16;S++,D+=4)E[S]=I.getUint32(D),k[S]=I.getUint32(D+=4);for(let S=16;S<80;S++){const C=E[S-15]|0,F=k[S-15]|0,X=v.default.rotrSH(C,F,1)^v.default.rotrSH(C,F,8)^v.default.shrSH(C,F,7),re=v.default.rotrSL(C,F,1)^v.default.rotrSL(C,F,8)^v.default.shrSL(C,F,7),ie=E[S-2]|0,Q=k[S-2]|0,ne=v.default.rotrSH(ie,Q,19)^v.default.rotrBH(ie,Q,61)^v.default.shrSH(ie,Q,6),L=v.default.rotrSL(ie,Q,19)^v.default.rotrBL(ie,Q,61)^v.default.shrSL(ie,Q,6),ue=v.default.add4L(re,L,k[S-7],k[S-16]),Ae=v.default.add4H(ue,X,ne,E[S-7],E[S-16]);E[S]=Ae|0,k[S]=ue|0}let{Ah:V,Al:ee,Bh:J,Bl:te,Ch:se,Cl:ce,Dh:ae,Dl:he,Eh:oe,El:de,Fh:le,Fl:be,Gh:pe,Gl:fe,Hh:Z,Hl:U}=this;for(let S=0;S<80;S++){const C=v.default.rotrSH(oe,de,14)^v.default.rotrSH(oe,de,18)^v.default.rotrBH(oe,de,41),F=v.default.rotrSL(oe,de,14)^v.default.rotrSL(oe,de,18)^v.default.rotrBL(oe,de,41),X=oe&le^~oe&pe,re=de&be^~de&fe,ie=v.default.add5L(U,F,re,A[S],k[S]),Q=v.default.add5H(ie,Z,C,X,_[S],E[S]),ne=ie|0,L=v.default.rotrSH(V,ee,28)^v.default.rotrBH(V,ee,34)^v.default.rotrBH(V,ee,39),ue=v.default.rotrSL(V,ee,28)^v.default.rotrBL(V,ee,34)^v.default.rotrBL(V,ee,39),Ae=V&J^V&se^J&se,Re=ee&te^ee&ce^te&ce;Z=pe|0,U=fe|0,pe=le|0,fe=be|0,le=oe|0,be=de|0,{h:oe,l:de}=v.default.add(ae|0,he|0,Q|0,ne|0),ae=se|0,he=ce|0,se=J|0,ce=te|0,J=V|0,te=ee|0;const Pe=v.default.add3L(ne,ue,Re);V=v.default.add3H(Pe,Q,L,Ae),ee=Pe|0}({h:V,l:ee}=v.default.add(this.Ah|0,this.Al|0,V|0,ee|0)),{h:J,l:te}=v.default.add(this.Bh|0,this.Bl|0,J|0,te|0),{h:se,l:ce}=v.default.add(this.Ch|0,this.Cl|0,se|0,ce|0),{h:ae,l:he}=v.default.add(this.Dh|0,this.Dl|0,ae|0,he|0),{h:oe,l:de}=v.default.add(this.Eh|0,this.El|0,oe|0,de|0),{h:le,l:be}=v.default.add(this.Fh|0,this.Fl|0,le|0,be|0),{h:pe,l:fe}=v.default.add(this.Gh|0,this.Gl|0,pe|0,fe|0),{h:Z,l:U}=v.default.add(this.Hh|0,this.Hl|0,Z|0,U|0),this.set(V,ee,J,te,se,ce,ae,he,oe,de,le,be,pe,fe,Z,U)}roundClean(){E.fill(0),k.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}sha512$2.SHA512=P;class N extends P{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}class q extends P{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}class B extends P{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}return sha512$2.sha512=(0,w.wrapConstructor)(()=>new P),sha512$2.sha512_224=(0,w.wrapConstructor)(()=>new N),sha512$2.sha512_256=(0,w.wrapConstructor)(()=>new q),sha512$2.sha384=(0,w.wrapConstructor)(()=>new B),sha512$2}var hasRequiredCryptoBrowser;function requireCryptoBrowser(){if(hasRequiredCryptoBrowser)return cryptoBrowser;hasRequiredCryptoBrowser=1,Object.defineProperty(cryptoBrowser,"__esModule",{value:!0}),cryptoBrowser.randomBytes=cryptoBrowser.pbkdf2Sync=cryptoBrowser.createHmac=cryptoBrowser.createHash=void 0;const b=requireHmac$1(),v=requirePbkdf2$1(),w=requireSha256(),_=requireSha512(),A=requireUtils$3();function E(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof commonjsGlobal<"u")return commonjsGlobal;throw new Error("unable to locate global object")}const k=E(),P=k.crypto||k.msCrypto;function N(I){switch(I){case"sha256":return w.sha256.create();case"sha512":return _.sha512.create()}(0,A.assertArgument)(!1,"invalid hashing algorithm name","algorithm",I)}cryptoBrowser.createHash=N;function q(I,D){const V={sha256:w.sha256,sha512:_.sha512}[I];return(0,A.assertArgument)(V!=null,"invalid hmac algorithm","algorithm",I),b.hmac.create(V,D)}cryptoBrowser.createHmac=q;function B(I,D,V,ee,J){const te={sha256:w.sha256,sha512:_.sha512}[J];return(0,A.assertArgument)(te!=null,"invalid pbkdf2 algorithm","algorithm",J),(0,v.pbkdf2)(te,I,D,{c:V,dkLen:ee})}cryptoBrowser.pbkdf2Sync=B;function O(I){(0,A.assert)(P!=null,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"}),(0,A.assertArgument)(Number.isInteger(I)&&I>0&&I<=1024,"invalid length","length",I);const D=new Uint8Array(I);return P.getRandomValues(D),D}return cryptoBrowser.randomBytes=O,cryptoBrowser}var hasRequiredHmac;function requireHmac(){if(hasRequiredHmac)return hmac$2;hasRequiredHmac=1,Object.defineProperty(hmac$2,"__esModule",{value:!0}),hmac$2.computeHmac=void 0;const b=requireCryptoBrowser(),v=requireUtils$3();let w=!1;const _=function(k,P,N){return(0,b.createHmac)(k,P).update(N).digest()};let A=_;function E(k,P,N){const q=(0,v.getBytes)(P,"key"),B=(0,v.getBytes)(N,"data");return(0,v.hexlify)(A(k,q,B))}return hmac$2.computeHmac=E,E._=_,E.lock=function(){w=!0},E.register=function(k){if(w)throw new Error("computeHmac is locked");A=k},Object.freeze(E),hmac$2}var keccak={},sha3={},hasRequiredSha3;function requireSha3(){if(hasRequiredSha3)return sha3;hasRequiredSha3=1,Object.defineProperty(sha3,"__esModule",{value:!0}),sha3.shake256=sha3.shake128=sha3.keccak_512=sha3.keccak_384=sha3.keccak_256=sha3.keccak_224=sha3.sha3_512=sha3.sha3_384=sha3.sha3_256=sha3.sha3_224=sha3.Keccak=sha3.keccakP=void 0;const b=require_assert(),v=require_u64(),w=requireUtils$2(),[_,A,E]=[[],[],[]],k=BigInt(0),P=BigInt(1),N=BigInt(2),q=BigInt(7),B=BigInt(256),O=BigInt(113);for(let ae=0,he=P,oe=1,de=0;ae<24;ae++){[oe,de]=[de,(2*oe+3*de)%5],_.push(2*(5*de+oe)),A.push((ae+1)*(ae+2)/2%64);let le=k;for(let be=0;be<7;be++)he=(he<<P^(he>>q)*O)%B,he&N&&(le^=P<<(P<<BigInt(be))-P);E.push(le)}const[I,D]=(0,v.split)(E,!0),V=(ae,he,oe)=>oe>32?(0,v.rotlBH)(ae,he,oe):(0,v.rotlSH)(ae,he,oe),ee=(ae,he,oe)=>oe>32?(0,v.rotlBL)(ae,he,oe):(0,v.rotlSL)(ae,he,oe);function J(ae,he=24){const oe=new Uint32Array(10);for(let de=24-he;de<24;de++){for(let pe=0;pe<10;pe++)oe[pe]=ae[pe]^ae[pe+10]^ae[pe+20]^ae[pe+30]^ae[pe+40];for(let pe=0;pe<10;pe+=2){const fe=(pe+8)%10,Z=(pe+2)%10,U=oe[Z],S=oe[Z+1],C=V(U,S,1)^oe[fe],F=ee(U,S,1)^oe[fe+1];for(let X=0;X<50;X+=10)ae[pe+X]^=C,ae[pe+X+1]^=F}let le=ae[2],be=ae[3];for(let pe=0;pe<24;pe++){const fe=A[pe],Z=V(le,be,fe),U=ee(le,be,fe),S=_[pe];le=ae[S],be=ae[S+1],ae[S]=Z,ae[S+1]=U}for(let pe=0;pe<50;pe+=10){for(let fe=0;fe<10;fe++)oe[fe]=ae[pe+fe];for(let fe=0;fe<10;fe++)ae[pe+fe]^=~oe[(fe+2)%10]&oe[(fe+4)%10]}ae[0]^=I[de],ae[1]^=D[de]}oe.fill(0)}sha3.keccakP=J;class te extends w.Hash{constructor(he,oe,de,le=!1,be=24){if(super(),this.blockLen=he,this.suffix=oe,this.outputLen=de,this.enableXOF=le,this.rounds=be,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,b.number)(de),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,w.u32)(this.state)}keccak(){J(this.state32,this.rounds),this.posOut=0,this.pos=0}update(he){(0,b.exists)(this);const{blockLen:oe,state:de}=this;he=(0,w.toBytes)(he);const le=he.length;for(let be=0;be<le;){const pe=Math.min(oe-this.pos,le-be);for(let fe=0;fe<pe;fe++)de[this.pos++]^=he[be++];this.pos===oe&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:he,suffix:oe,pos:de,blockLen:le}=this;he[de]^=oe,oe&128&&de===le-1&&this.keccak(),he[le-1]^=128,this.keccak()}writeInto(he){(0,b.exists)(this,!1),(0,b.bytes)(he),this.finish();const oe=this.state,{blockLen:de}=this;for(let le=0,be=he.length;le<be;){this.posOut>=de&&this.keccak();const pe=Math.min(de-this.posOut,be-le);he.set(oe.subarray(this.posOut,this.posOut+pe),le),this.posOut+=pe,le+=pe}return he}xofInto(he){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(he)}xof(he){return(0,b.number)(he),this.xofInto(new Uint8Array(he))}digestInto(he){if((0,b.output)(he,this),this.finished)throw new Error("digest() was already called");return this.writeInto(he),this.destroy(),he}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(he){const{blockLen:oe,suffix:de,outputLen:le,rounds:be,enableXOF:pe}=this;return he||(he=new te(oe,de,le,pe,be)),he.state32.set(this.state32),he.pos=this.pos,he.posOut=this.posOut,he.finished=this.finished,he.rounds=be,he.suffix=de,he.outputLen=le,he.enableXOF=pe,he.destroyed=this.destroyed,he}}sha3.Keccak=te;const se=(ae,he,oe)=>(0,w.wrapConstructor)(()=>new te(he,ae,oe));sha3.sha3_224=se(6,144,224/8),sha3.sha3_256=se(6,136,256/8),sha3.sha3_384=se(6,104,384/8),sha3.sha3_512=se(6,72,512/8),sha3.keccak_224=se(1,144,224/8),sha3.keccak_256=se(1,136,256/8),sha3.keccak_384=se(1,104,384/8),sha3.keccak_512=se(1,72,512/8);const ce=(ae,he,oe)=>(0,w.wrapXOFConstructorWithOpts)((de={})=>new te(he,ae,de.dkLen===void 0?oe:de.dkLen,!0));return sha3.shake128=ce(31,168,128/8),sha3.shake256=ce(31,136,256/8),sha3}var hasRequiredKeccak;function requireKeccak(){if(hasRequiredKeccak)return keccak;hasRequiredKeccak=1,Object.defineProperty(keccak,"__esModule",{value:!0}),keccak.keccak256=void 0;const b=requireSha3(),v=requireUtils$3();let w=!1;const _=function(k){return(0,b.keccak_256)(k)};let A=_;function E(k){const P=(0,v.getBytes)(k,"data");return(0,v.hexlify)(A(P))}return keccak.keccak256=E,E._=_,E.lock=function(){w=!0},E.register=function(k){if(w)throw new TypeError("keccak256 is locked");A=k},Object.freeze(E),keccak}var ripemd160$2={},ripemd160$1={},hasRequiredRipemd160$1;function requireRipemd160$1(){if(hasRequiredRipemd160$1)return ripemd160$1;hasRequiredRipemd160$1=1,Object.defineProperty(ripemd160$1,"__esModule",{value:!0}),ripemd160$1.ripemd160=ripemd160$1.RIPEMD160=void 0;const b=require_sha2(),v=requireUtils$2(),w=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),_=Uint8Array.from({length:16},(J,te)=>te),A=_.map(J=>(9*J+5)%16);let E=[_],k=[A];for(let J=0;J<4;J++)for(let te of[E,k])te.push(te[J].map(se=>w[se]));const P=[[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(J=>new Uint8Array(J)),N=E.map((J,te)=>J.map(se=>P[te][se])),q=k.map((J,te)=>J.map(se=>P[te][se])),B=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),O=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),I=(J,te)=>J<<te|J>>>32-te;function D(J,te,se,ce){return J===0?te^se^ce:J===1?te&se|~te&ce:J===2?(te|~se)^ce:J===3?te&ce|se&~ce:te^(se|~ce)}const V=new Uint32Array(16);class ee extends b.SHA2{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:te,h1:se,h2:ce,h3:ae,h4:he}=this;return[te,se,ce,ae,he]}set(te,se,ce,ae,he){this.h0=te|0,this.h1=se|0,this.h2=ce|0,this.h3=ae|0,this.h4=he|0}process(te,se){for(let U=0;U<16;U++,se+=4)V[U]=te.getUint32(se,!0);let ce=this.h0|0,ae=ce,he=this.h1|0,oe=he,de=this.h2|0,le=de,be=this.h3|0,pe=be,fe=this.h4|0,Z=fe;for(let U=0;U<5;U++){const S=4-U,C=B[U],F=O[U],X=E[U],re=k[U],ie=N[U],Q=q[U];for(let ne=0;ne<16;ne++){const L=I(ce+D(U,he,de,be)+V[X[ne]]+C,ie[ne])+fe|0;ce=fe,fe=be,be=I(de,10)|0,de=he,he=L}for(let ne=0;ne<16;ne++){const L=I(ae+D(S,oe,le,pe)+V[re[ne]]+F,Q[ne])+Z|0;ae=Z,Z=pe,pe=I(le,10)|0,le=oe,oe=L}}this.set(this.h1+de+pe|0,this.h2+be+Z|0,this.h3+fe+ae|0,this.h4+ce+oe|0,this.h0+he+le|0)}roundClean(){V.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}return ripemd160$1.RIPEMD160=ee,ripemd160$1.ripemd160=(0,v.wrapConstructor)(()=>new ee),ripemd160$1}var hasRequiredRipemd160;function requireRipemd160(){if(hasRequiredRipemd160)return ripemd160$2;hasRequiredRipemd160=1,Object.defineProperty(ripemd160$2,"__esModule",{value:!0}),ripemd160$2.ripemd160=void 0;const b=requireRipemd160$1(),v=requireUtils$3();let w=!1;const _=function(k){return(0,b.ripemd160)(k)};let A=_;function E(k){const P=(0,v.getBytes)(k,"data");return(0,v.hexlify)(A(P))}return ripemd160$2.ripemd160=E,E._=_,E.lock=function(){w=!0},E.register=function(k){if(w)throw new TypeError("ripemd160 is locked");A=k},Object.freeze(E),ripemd160$2}var pbkdf2$1={},hasRequiredPbkdf2;function requirePbkdf2(){if(hasRequiredPbkdf2)return pbkdf2$1;hasRequiredPbkdf2=1,Object.defineProperty(pbkdf2$1,"__esModule",{value:!0}),pbkdf2$1.pbkdf2=void 0;const b=requireCryptoBrowser(),v=requireUtils$3();let w=!1;const _=function(k,P,N,q,B){return(0,b.pbkdf2Sync)(k,P,N,q,B)};let A=_;function E(k,P,N,q,B){const O=(0,v.getBytes)(k,"password"),I=(0,v.getBytes)(P,"salt");return(0,v.hexlify)(A(O,I,N,q,B))}return pbkdf2$1.pbkdf2=E,E._=_,E.lock=function(){w=!0},E.register=function(k){if(w)throw new Error("pbkdf2 is locked");A=k},Object.freeze(E),pbkdf2$1}var random$1={},hasRequiredRandom;function requireRandom(){if(hasRequiredRandom)return random$1;hasRequiredRandom=1,Object.defineProperty(random$1,"__esModule",{value:!0}),random$1.randomBytes=void 0;const b=requireCryptoBrowser();let v=!1;const w=function(E){return new Uint8Array((0,b.randomBytes)(E))};let _=w;function A(E){return _(E)}return random$1.randomBytes=A,A._=w,A.lock=function(){v=!0},A.register=function(E){if(v)throw new Error("randomBytes is locked");_=E},Object.freeze(A),random$1}var scrypt$1={},scrypt={},hasRequiredScrypt$1;function requireScrypt$1(){if(hasRequiredScrypt$1)return scrypt;hasRequiredScrypt$1=1,Object.defineProperty(scrypt,"__esModule",{value:!0}),scrypt.scryptAsync=scrypt.scrypt=void 0;const b=require_assert(),v=requireSha256(),w=requirePbkdf2$1(),_=requireUtils$2(),A=(O,I)=>O<<I|O>>>32-I;function E(O,I,D,V,ee,J){let te=O[I++]^D[V++],se=O[I++]^D[V++],ce=O[I++]^D[V++],ae=O[I++]^D[V++],he=O[I++]^D[V++],oe=O[I++]^D[V++],de=O[I++]^D[V++],le=O[I++]^D[V++],be=O[I++]^D[V++],pe=O[I++]^D[V++],fe=O[I++]^D[V++],Z=O[I++]^D[V++],U=O[I++]^D[V++],S=O[I++]^D[V++],C=O[I++]^D[V++],F=O[I++]^D[V++],X=te,re=se,ie=ce,Q=ae,ne=he,L=oe,ue=de,Ae=le,Re=be,Pe=pe,xe=fe,ge=Z,_e=U,ke=S,Ee=C,Se=F;for(let Oe=0;Oe<8;Oe+=2)ne^=A(X+_e|0,7),Re^=A(ne+X|0,9),_e^=A(Re+ne|0,13),X^=A(_e+Re|0,18),Pe^=A(L+re|0,7),ke^=A(Pe+L|0,9),re^=A(ke+Pe|0,13),L^=A(re+ke|0,18),Ee^=A(xe+ue|0,7),ie^=A(Ee+xe|0,9),ue^=A(ie+Ee|0,13),xe^=A(ue+ie|0,18),Q^=A(Se+ge|0,7),Ae^=A(Q+Se|0,9),ge^=A(Ae+Q|0,13),Se^=A(ge+Ae|0,18),re^=A(X+Q|0,7),ie^=A(re+X|0,9),Q^=A(ie+re|0,13),X^=A(Q+ie|0,18),ue^=A(L+ne|0,7),Ae^=A(ue+L|0,9),ne^=A(Ae+ue|0,13),L^=A(ne+Ae|0,18),ge^=A(xe+Pe|0,7),Re^=A(ge+xe|0,9),Pe^=A(Re+ge|0,13),xe^=A(Pe+Re|0,18),_e^=A(Se+Ee|0,7),ke^=A(_e+Se|0,9),Ee^=A(ke+_e|0,13),Se^=A(Ee+ke|0,18);ee[J++]=te+X|0,ee[J++]=se+re|0,ee[J++]=ce+ie|0,ee[J++]=ae+Q|0,ee[J++]=he+ne|0,ee[J++]=oe+L|0,ee[J++]=de+ue|0,ee[J++]=le+Ae|0,ee[J++]=be+Re|0,ee[J++]=pe+Pe|0,ee[J++]=fe+xe|0,ee[J++]=Z+ge|0,ee[J++]=U+_e|0,ee[J++]=S+ke|0,ee[J++]=C+Ee|0,ee[J++]=F+Se|0}function k(O,I,D,V,ee){let J=V+0,te=V+16*ee;for(let se=0;se<16;se++)D[te+se]=O[I+(2*ee-1)*16+se];for(let se=0;se<ee;se++,J+=16,I+=16)E(D,te,O,I,D,J),se>0&&(te+=16),E(D,J,O,I+=16,D,te)}function P(O,I,D){const V=(0,_.checkOpts)({dkLen:32,asyncTick:10,maxmem:1073742848},D),{N:ee,r:J,p:te,dkLen:se,asyncTick:ce,maxmem:ae,onProgress:he}=V;if((0,b.number)(ee),(0,b.number)(J),(0,b.number)(te),(0,b.number)(se),(0,b.number)(ce),(0,b.number)(ae),he!==void 0&&typeof he!="function")throw new Error("progressCb should be function");const oe=128*J,de=oe/4;if(ee<=1||ee&ee-1||ee>=2**(oe/8)||ee>2**32)throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32");if(te<0||te>(2**32-1)*32/oe)throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");if(se<0||se>(2**32-1)*32)throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");const le=oe*(ee+te);if(le>ae)throw new Error(`Scrypt: parameters too large, ${le} (128 * r * (N + p)) > ${ae} (maxmem)`);const be=(0,w.pbkdf2)(v.sha256,O,I,{c:1,dkLen:oe*te}),pe=(0,_.u32)(be),fe=(0,_.u32)(new Uint8Array(oe*ee)),Z=(0,_.u32)(new Uint8Array(oe));let U=()=>{};if(he){const S=2*ee*te,C=Math.max(Math.floor(S/1e4),1);let F=0;U=()=>{F++,he&&(!(F%C)||F===S)&&he(F/S)}}return{N:ee,r:J,p:te,dkLen:se,blockSize32:de,V:fe,B32:pe,B:be,tmp:Z,blockMixCb:U,asyncTick:ce}}function N(O,I,D,V,ee){const J=(0,w.pbkdf2)(v.sha256,O,D,{c:1,dkLen:I});return D.fill(0),V.fill(0),ee.fill(0),J}function q(O,I,D){const{N:V,r:ee,p:J,dkLen:te,blockSize32:se,V:ce,B32:ae,B:he,tmp:oe,blockMixCb:de}=P(O,I,D);for(let le=0;le<J;le++){const be=se*le;for(let pe=0;pe<se;pe++)ce[pe]=ae[be+pe];for(let pe=0,fe=0;pe<V-1;pe++)k(ce,fe,ce,fe+=se,ee),de();k(ce,(V-1)*se,ae,be,ee),de();for(let pe=0;pe<V;pe++){const fe=ae[be+se-16]%V;for(let Z=0;Z<se;Z++)oe[Z]=ae[be+Z]^ce[fe*se+Z];k(oe,0,ae,be,ee),de()}}return N(O,te,he,ce,oe)}scrypt.scrypt=q;async function B(O,I,D){const{N:V,r:ee,p:J,dkLen:te,blockSize32:se,V:ce,B32:ae,B:he,tmp:oe,blockMixCb:de,asyncTick:le}=P(O,I,D);for(let be=0;be<J;be++){const pe=se*be;for(let Z=0;Z<se;Z++)ce[Z]=ae[pe+Z];let fe=0;await(0,_.asyncLoop)(V-1,le,()=>{k(ce,fe,ce,fe+=se,ee),de()}),k(ce,(V-1)*se,ae,pe,ee),de(),await(0,_.asyncLoop)(V,le,()=>{const Z=ae[pe+se-16]%V;for(let U=0;U<se;U++)oe[U]=ae[pe+U]^ce[Z*se+U];k(oe,0,ae,pe,ee),de()})}return N(O,te,he,ce,oe)}return scrypt.scryptAsync=B,scrypt}var hasRequiredScrypt;function requireScrypt(){if(hasRequiredScrypt)return scrypt$1;hasRequiredScrypt=1,Object.defineProperty(scrypt$1,"__esModule",{value:!0}),scrypt$1.scryptSync=scrypt$1.scrypt=void 0;const b=requireScrypt$1(),v=requireUtils$3();let w=!1,_=!1;const A=async function(B,O,I,D,V,ee,J){return await(0,b.scryptAsync)(B,O,{N:I,r:D,p:V,dkLen:ee,onProgress:J})},E=function(B,O,I,D,V,ee){return(0,b.scrypt)(B,O,{N:I,r:D,p:V,dkLen:ee})};let k=A,P=E;async function N(B,O,I,D,V,ee,J){const te=(0,v.getBytes)(B,"passwd"),se=(0,v.getBytes)(O,"salt");return(0,v.hexlify)(await k(te,se,I,D,V,ee,J))}scrypt$1.scrypt=N,N._=A,N.lock=function(){_=!0},N.register=function(B){if(_)throw new Error("scrypt is locked");k=B},Object.freeze(N);function q(B,O,I,D,V,ee){const J=(0,v.getBytes)(B,"passwd"),te=(0,v.getBytes)(O,"salt");return(0,v.hexlify)(P(J,te,I,D,V,ee))}return scrypt$1.scryptSync=q,q._=E,q.lock=function(){w=!0},q.register=function(B){if(w)throw new Error("scryptSync is locked");P=B},Object.freeze(q),scrypt$1}var sha2={},hasRequiredSha2;function requireSha2(){if(hasRequiredSha2)return sha2;hasRequiredSha2=1,Object.defineProperty(sha2,"__esModule",{value:!0}),sha2.sha512=sha2.sha256=void 0;const b=requireCryptoBrowser(),v=requireUtils$3(),w=function(B){return(0,b.createHash)("sha256").update(B).digest()},_=function(B){return(0,b.createHash)("sha512").update(B).digest()};let A=w,E=_,k=!1,P=!1;function N(B){const O=(0,v.getBytes)(B,"data");return(0,v.hexlify)(A(O))}sha2.sha256=N,N._=w,N.lock=function(){k=!0},N.register=function(B){if(k)throw new Error("sha256 is locked");A=B},Object.freeze(N);function q(B){const O=(0,v.getBytes)(B,"data");return(0,v.hexlify)(E(O))}return sha2.sha512=q,q._=_,q.lock=function(){P=!0},q.register=function(B){if(P)throw new Error("sha512 is locked");E=B},Object.freeze(N),sha2}var signingKey={},secp256k1$1={},modular={},utils$q={},hasRequiredUtils$1;function requireUtils$1(){if(hasRequiredUtils$1)return utils$q;hasRequiredUtils$1=1,Object.defineProperty(utils$q,"__esModule",{value:!0}),utils$q.validateObject=utils$q.createHmacDrbg=utils$q.bitMask=utils$q.bitSet=utils$q.bitGet=utils$q.bitLen=utils$q.utf8ToBytes=utils$q.equalBytes=utils$q.concatBytes=utils$q.ensureBytes=utils$q.numberToVarBytesBE=utils$q.numberToBytesLE=utils$q.numberToBytesBE=utils$q.bytesToNumberLE=utils$q.bytesToNumberBE=utils$q.hexToBytes=utils$q.hexToNumber=utils$q.numberToHexUnpadded=utils$q.bytesToHex=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const b=BigInt(0),v=BigInt(1),w=BigInt(2),_=fe=>fe instanceof Uint8Array,A=Array.from({length:256},(fe,Z)=>Z.toString(16).padStart(2,"0"));function E(fe){if(!_(fe))throw new Error("Uint8Array expected");let Z="";for(let U=0;U<fe.length;U++)Z+=A[fe[U]];return Z}utils$q.bytesToHex=E;function k(fe){const Z=fe.toString(16);return Z.length&1?`0${Z}`:Z}utils$q.numberToHexUnpadded=k;function P(fe){if(typeof fe!="string")throw new Error("hex string expected, got "+typeof fe);return BigInt(fe===""?"0":`0x${fe}`)}utils$q.hexToNumber=P;function N(fe){if(typeof fe!="string")throw new Error("hex string expected, got "+typeof fe);const Z=fe.length;if(Z%2)throw new Error("padded hex string expected, got unpadded hex of length "+Z);const U=new Uint8Array(Z/2);for(let S=0;S<U.length;S++){const C=S*2,F=fe.slice(C,C+2),X=Number.parseInt(F,16);if(Number.isNaN(X)||X<0)throw new Error("Invalid byte sequence");U[S]=X}return U}utils$q.hexToBytes=N;function q(fe){return P(E(fe))}utils$q.bytesToNumberBE=q;function B(fe){if(!_(fe))throw new Error("Uint8Array expected");return P(E(Uint8Array.from(fe).reverse()))}utils$q.bytesToNumberLE=B;function O(fe,Z){return N(fe.toString(16).padStart(Z*2,"0"))}utils$q.numberToBytesBE=O;function I(fe,Z){return O(fe,Z).reverse()}utils$q.numberToBytesLE=I;function D(fe){return N(k(fe))}utils$q.numberToVarBytesBE=D;function V(fe,Z,U){let S;if(typeof Z=="string")try{S=N(Z)}catch(F){throw new Error(`${fe} must be valid hex string, got "${Z}". Cause: ${F}`)}else if(_(Z))S=Uint8Array.from(Z);else throw new Error(`${fe} must be hex string or Uint8Array`);const C=S.length;if(typeof U=="number"&&C!==U)throw new Error(`${fe} expected ${U} bytes, got ${C}`);return S}utils$q.ensureBytes=V;function ee(...fe){const Z=new Uint8Array(fe.reduce((S,C)=>S+C.length,0));let U=0;return fe.forEach(S=>{if(!_(S))throw new Error("Uint8Array expected");Z.set(S,U),U+=S.length}),Z}utils$q.concatBytes=ee;function J(fe,Z){if(fe.length!==Z.length)return!1;for(let U=0;U<fe.length;U++)if(fe[U]!==Z[U])return!1;return!0}utils$q.equalBytes=J;function te(fe){if(typeof fe!="string")throw new Error(`utf8ToBytes expected string, got ${typeof fe}`);return new Uint8Array(new TextEncoder().encode(fe))}utils$q.utf8ToBytes=te;function se(fe){let Z;for(Z=0;fe>b;fe>>=v,Z+=1);return Z}utils$q.bitLen=se;function ce(fe,Z){return fe>>BigInt(Z)&v}utils$q.bitGet=ce;const ae=(fe,Z,U)=>fe|(U?v:b)<<BigInt(Z);utils$q.bitSet=ae;const he=fe=>(w<<BigInt(fe-1))-v;utils$q.bitMask=he;const oe=fe=>new Uint8Array(fe),de=fe=>Uint8Array.from(fe);function le(fe,Z,U){if(typeof fe!="number"||fe<2)throw new Error("hashLen must be a number");if(typeof Z!="number"||Z<2)throw new Error("qByteLen must be a number");if(typeof U!="function")throw new Error("hmacFn must be a function");let S=oe(fe),C=oe(fe),F=0;const X=()=>{S.fill(1),C.fill(0),F=0},re=(...L)=>U(C,S,...L),ie=(L=oe())=>{C=re(de([0]),L),S=re(),L.length!==0&&(C=re(de([1]),L),S=re())},Q=()=>{if(F++>=1e3)throw new Error("drbg: tried 1000 values");let L=0;const ue=[];for(;L<Z;){S=re();const Ae=S.slice();ue.push(Ae),L+=S.length}return ee(...ue)};return(L,ue)=>{X(),ie(L);let Ae;for(;!(Ae=ue(Q()));)ie();return X(),Ae}}utils$q.createHmacDrbg=le;const be={bigint:fe=>typeof fe=="bigint",function:fe=>typeof fe=="function",boolean:fe=>typeof fe=="boolean",string:fe=>typeof fe=="string",stringOrUint8Array:fe=>typeof fe=="string"||fe instanceof Uint8Array,isSafeInteger:fe=>Number.isSafeInteger(fe),array:fe=>Array.isArray(fe),field:(fe,Z)=>Z.Fp.isValid(fe),hash:fe=>typeof fe=="function"&&Number.isSafeInteger(fe.outputLen)};function pe(fe,Z,U={}){const S=(C,F,X)=>{const re=be[F];if(typeof re!="function")throw new Error(`Invalid validator "${F}", expected function`);const ie=fe[C];if(!(X&&ie===void 0)&&!re(ie,fe))throw new Error(`Invalid param ${String(C)}=${ie} (${typeof ie}), expected ${F}`)};for(const[C,F]of Object.entries(Z))S(C,F,!1);for(const[C,F]of Object.entries(U))S(C,F,!0);return fe}return utils$q.validateObject=pe,utils$q}var hasRequiredModular;function requireModular(){if(hasRequiredModular)return modular;hasRequiredModular=1,Object.defineProperty(modular,"__esModule",{value:!0}),modular.mapHashToField=modular.getMinHashLength=modular.getFieldBytesLength=modular.hashToPrivateScalar=modular.FpSqrtEven=modular.FpSqrtOdd=modular.Field=modular.nLength=modular.FpIsSquare=modular.FpDiv=modular.FpInvertBatch=modular.FpPow=modular.validateField=modular.isNegativeLE=modular.FpSqrt=modular.tonelliShanks=modular.invert=modular.pow2=modular.pow=modular.mod=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const b=requireUtils$1(),v=BigInt(0),w=BigInt(1),_=BigInt(2),A=BigInt(3),E=BigInt(4),k=BigInt(5),P=BigInt(8);BigInt(9),BigInt(16);function N(U,S){const C=U%S;return C>=v?C:S+C}modular.mod=N;function q(U,S,C){if(C<=v||S<v)throw new Error("Expected power/modulo > 0");if(C===w)return v;let F=w;for(;S>v;)S&w&&(F=F*U%C),U=U*U%C,S>>=w;return F}modular.pow=q;function B(U,S,C){let F=U;for(;S-- >v;)F*=F,F%=C;return F}modular.pow2=B;function O(U,S){if(U===v||S<=v)throw new Error(`invert: expected positive integers, got n=${U} mod=${S}`);let C=N(U,S),F=S,X=v,re=w;for(;C!==v;){const Q=F/C,ne=F%C,L=X-re*Q;F=C,C=ne,X=re,re=L}if(F!==w)throw new Error("invert: does not exist");return N(X,S)}modular.invert=O;function I(U){const S=(U-w)/_;let C,F,X;for(C=U-w,F=0;C%_===v;C/=_,F++);for(X=_;X<U&&q(X,S,U)!==U-w;X++);if(F===1){const ie=(U+w)/E;return function(ne,L){const ue=ne.pow(L,ie);if(!ne.eql(ne.sqr(ue),L))throw new Error("Cannot find square root");return ue}}const re=(C+w)/_;return function(Q,ne){if(Q.pow(ne,S)===Q.neg(Q.ONE))throw new Error("Cannot find square root");let L=F,ue=Q.pow(Q.mul(Q.ONE,X),C),Ae=Q.pow(ne,re),Re=Q.pow(ne,C);for(;!Q.eql(Re,Q.ONE);){if(Q.eql(Re,Q.ZERO))return Q.ZERO;let Pe=1;for(let ge=Q.sqr(Re);Pe<L&&!Q.eql(ge,Q.ONE);Pe++)ge=Q.sqr(ge);const xe=Q.pow(ue,w<<BigInt(L-Pe-1));ue=Q.sqr(xe),Ae=Q.mul(Ae,xe),Re=Q.mul(Re,ue),L=Pe}return Ae}}modular.tonelliShanks=I;function D(U){if(U%E===A){const S=(U+w)/E;return function(F,X){const re=F.pow(X,S);if(!F.eql(F.sqr(re),X))throw new Error("Cannot find square root");return re}}if(U%P===k){const S=(U-k)/P;return function(F,X){const re=F.mul(X,_),ie=F.pow(re,S),Q=F.mul(X,ie),ne=F.mul(F.mul(Q,_),ie),L=F.mul(Q,F.sub(ne,F.ONE));if(!F.eql(F.sqr(L),X))throw new Error("Cannot find square root");return L}}return I(U)}modular.FpSqrt=D;const V=(U,S)=>(N(U,S)&w)===w;modular.isNegativeLE=V;const ee=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function J(U){const S={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},C=ee.reduce((F,X)=>(F[X]="function",F),S);return(0,b.validateObject)(U,C)}modular.validateField=J;function te(U,S,C){if(C<v)throw new Error("Expected power > 0");if(C===v)return U.ONE;if(C===w)return S;let F=U.ONE,X=S;for(;C>v;)C&w&&(F=U.mul(F,X)),X=U.sqr(X),C>>=w;return F}modular.FpPow=te;function se(U,S){const C=new Array(S.length),F=S.reduce((re,ie,Q)=>U.is0(ie)?re:(C[Q]=re,U.mul(re,ie)),U.ONE),X=U.inv(F);return S.reduceRight((re,ie,Q)=>U.is0(ie)?re:(C[Q]=U.mul(re,C[Q]),U.mul(re,ie)),X),C}modular.FpInvertBatch=se;function ce(U,S,C){return U.mul(S,typeof C=="bigint"?O(C,U.ORDER):U.inv(C))}modular.FpDiv=ce;function ae(U){const S=(U.ORDER-w)/_;return C=>{const F=U.pow(C,S);return U.eql(F,U.ZERO)||U.eql(F,U.ONE)}}modular.FpIsSquare=ae;function he(U,S){const C=S!==void 0?S:U.toString(2).length,F=Math.ceil(C/8);return{nBitLength:C,nByteLength:F}}modular.nLength=he;function oe(U,S,C=!1,F={}){if(U<=v)throw new Error(`Expected Field ORDER > 0, got ${U}`);const{nBitLength:X,nByteLength:re}=he(U,S);if(re>2048)throw new Error("Field lengths over 2048 bytes are not supported");const ie=D(U),Q=Object.freeze({ORDER:U,BITS:X,BYTES:re,MASK:(0,b.bitMask)(X),ZERO:v,ONE:w,create:ne=>N(ne,U),isValid:ne=>{if(typeof ne!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof ne}`);return v<=ne&&ne<U},is0:ne=>ne===v,isOdd:ne=>(ne&w)===w,neg:ne=>N(-ne,U),eql:(ne,L)=>ne===L,sqr:ne=>N(ne*ne,U),add:(ne,L)=>N(ne+L,U),sub:(ne,L)=>N(ne-L,U),mul:(ne,L)=>N(ne*L,U),pow:(ne,L)=>te(Q,ne,L),div:(ne,L)=>N(ne*O(L,U),U),sqrN:ne=>ne*ne,addN:(ne,L)=>ne+L,subN:(ne,L)=>ne-L,mulN:(ne,L)=>ne*L,inv:ne=>O(ne,U),sqrt:F.sqrt||(ne=>ie(Q,ne)),invertBatch:ne=>se(Q,ne),cmov:(ne,L,ue)=>ue?L:ne,toBytes:ne=>C?(0,b.numberToBytesLE)(ne,re):(0,b.numberToBytesBE)(ne,re),fromBytes:ne=>{if(ne.length!==re)throw new Error(`Fp.fromBytes: expected ${re}, got ${ne.length}`);return C?(0,b.bytesToNumberLE)(ne):(0,b.bytesToNumberBE)(ne)}});return Object.freeze(Q)}modular.Field=oe;function de(U,S){if(!U.isOdd)throw new Error("Field doesn't have isOdd");const C=U.sqrt(S);return U.isOdd(C)?C:U.neg(C)}modular.FpSqrtOdd=de;function le(U,S){if(!U.isOdd)throw new Error("Field doesn't have isOdd");const C=U.sqrt(S);return U.isOdd(C)?U.neg(C):C}modular.FpSqrtEven=le;function be(U,S,C=!1){U=(0,b.ensureBytes)("privateHash",U);const F=U.length,X=he(S).nByteLength+8;if(X<24||F<X||F>1024)throw new Error(`hashToPrivateScalar: expected ${X}-1024 bytes of input, got ${F}`);const re=C?(0,b.bytesToNumberLE)(U):(0,b.bytesToNumberBE)(U);return N(re,S-w)+w}modular.hashToPrivateScalar=be;function pe(U){if(typeof U!="bigint")throw new Error("field order must be bigint");const S=U.toString(2).length;return Math.ceil(S/8)}modular.getFieldBytesLength=pe;function fe(U){const S=pe(U);return S+Math.ceil(S/2)}modular.getMinHashLength=fe;function Z(U,S,C=!1){const F=U.length,X=pe(S),re=fe(S);if(F<16||F<re||F>1024)throw new Error(`expected ${re}-1024 bytes of input, got ${F}`);const ie=C?(0,b.bytesToNumberBE)(U):(0,b.bytesToNumberLE)(U),Q=N(ie,S-w)+w;return C?(0,b.numberToBytesLE)(Q,X):(0,b.numberToBytesBE)(Q,X)}return modular.mapHashToField=Z,modular}var weierstrass={},curve$1={},hasRequiredCurve;function requireCurve(){if(hasRequiredCurve)return curve$1;hasRequiredCurve=1,Object.defineProperty(curve$1,"__esModule",{value:!0}),curve$1.validateBasic=curve$1.wNAF=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const b=requireModular(),v=requireUtils$1(),w=BigInt(0),_=BigInt(1);function A(k,P){const N=(B,O)=>{const I=O.negate();return B?I:O},q=B=>{const O=Math.ceil(P/B)+1,I=2**(B-1);return{windows:O,windowSize:I}};return{constTimeNegate:N,unsafeLadder(B,O){let I=k.ZERO,D=B;for(;O>w;)O&_&&(I=I.add(D)),D=D.double(),O>>=_;return I},precomputeWindow(B,O){const{windows:I,windowSize:D}=q(O),V=[];let ee=B,J=ee;for(let te=0;te<I;te++){J=ee,V.push(J);for(let se=1;se<D;se++)J=J.add(ee),V.push(J);ee=J.double()}return V},wNAF(B,O,I){const{windows:D,windowSize:V}=q(B);let ee=k.ZERO,J=k.BASE;const te=BigInt(2**B-1),se=2**B,ce=BigInt(B);for(let ae=0;ae<D;ae++){const he=ae*V;let oe=Number(I&te);I>>=ce,oe>V&&(oe-=se,I+=_);const de=he,le=he+Math.abs(oe)-1,be=ae%2!==0,pe=oe<0;oe===0?J=J.add(N(be,O[de])):ee=ee.add(N(pe,O[le]))}return{p:ee,f:J}},wNAFCached(B,O,I,D){const V=B._WINDOW_SIZE||1;let ee=O.get(B);return ee||(ee=this.precomputeWindow(B,V),V!==1&&O.set(B,D(ee))),this.wNAF(V,ee,I)}}}curve$1.wNAF=A;function E(k){return(0,b.validateField)(k.Fp),(0,v.validateObject)(k,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,b.nLength)(k.n,k.nBitLength),...k,p:k.Fp.ORDER})}return curve$1.validateBasic=E,curve$1}var hasRequiredWeierstrass;function requireWeierstrass(){return hasRequiredWeierstrass||(hasRequiredWeierstrass=1,function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.mapToCurveSimpleSWU=b.SWUFpSqrtRatio=b.weierstrass=b.weierstrassPoints=b.DER=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const v=requireModular(),w=requireUtils$1(),_=requireUtils$1(),A=requireCurve();function E(se){const ce=(0,A.validateBasic)(se);w.validateObject(ce,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:ae,Fp:he,a:oe}=ce;if(ae){if(!he.eql(oe,he.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof ae!="object"||typeof ae.beta!="bigint"||typeof ae.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...ce})}const{bytesToNumberBE:k,hexToBytes:P}=w;b.DER={Err:class extends Error{constructor(ce=""){super(ce)}},_parseInt(se){const{Err:ce}=b.DER;if(se.length<2||se[0]!==2)throw new ce("Invalid signature integer tag");const ae=se[1],he=se.subarray(2,ae+2);if(!ae||he.length!==ae)throw new ce("Invalid signature integer: wrong length");if(he[0]&128)throw new ce("Invalid signature integer: negative");if(he[0]===0&&!(he[1]&128))throw new ce("Invalid signature integer: unnecessary leading zero");return{d:k(he),l:se.subarray(ae+2)}},toSig(se){const{Err:ce}=b.DER,ae=typeof se=="string"?P(se):se;if(!(ae instanceof Uint8Array))throw new Error("ui8a expected");let he=ae.length;if(he<2||ae[0]!=48)throw new ce("Invalid signature tag");if(ae[1]!==he-2)throw new ce("Invalid signature: incorrect length");const{d:oe,l:de}=b.DER._parseInt(ae.subarray(2)),{d:le,l:be}=b.DER._parseInt(de);if(be.length)throw new ce("Invalid signature: left bytes after parsing");return{r:oe,s:le}},hexFromSig(se){const ce=fe=>Number.parseInt(fe[0],16)&8?"00"+fe:fe,ae=fe=>{const Z=fe.toString(16);return Z.length&1?`0${Z}`:Z},he=ce(ae(se.s)),oe=ce(ae(se.r)),de=he.length/2,le=oe.length/2,be=ae(de),pe=ae(le);return`30${ae(le+de+4)}02${pe}${oe}02${be}${he}`}};const N=BigInt(0),q=BigInt(1),B=BigInt(2),O=BigInt(3),I=BigInt(4);function D(se){const ce=E(se),{Fp:ae}=ce,he=ce.toBytes||((F,X,re)=>{const ie=X.toAffine();return w.concatBytes(Uint8Array.from([4]),ae.toBytes(ie.x),ae.toBytes(ie.y))}),oe=ce.fromBytes||(F=>{const X=F.subarray(1),re=ae.fromBytes(X.subarray(0,ae.BYTES)),ie=ae.fromBytes(X.subarray(ae.BYTES,2*ae.BYTES));return{x:re,y:ie}});function de(F){const{a:X,b:re}=ce,ie=ae.sqr(F),Q=ae.mul(ie,F);return ae.add(ae.add(Q,ae.mul(F,X)),re)}if(!ae.eql(ae.sqr(ce.Gy),de(ce.Gx)))throw new Error("bad generator point: equation left != right");function le(F){return typeof F=="bigint"&&N<F&&F<ce.n}function be(F){if(!le(F))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function pe(F){const{allowedPrivateKeyLengths:X,nByteLength:re,wrapPrivateKey:ie,n:Q}=ce;if(X&&typeof F!="bigint"){if(F instanceof Uint8Array&&(F=w.bytesToHex(F)),typeof F!="string"||!X.includes(F.length))throw new Error("Invalid key");F=F.padStart(re*2,"0")}let ne;try{ne=typeof F=="bigint"?F:w.bytesToNumberBE((0,_.ensureBytes)("private key",F,re))}catch{throw new Error(`private key must be ${re} bytes, hex or bigint, not ${typeof F}`)}return ie&&(ne=v.mod(ne,Q)),be(ne),ne}const fe=new Map;function Z(F){if(!(F instanceof U))throw new Error("ProjectivePoint expected")}class U{constructor(X,re,ie){if(this.px=X,this.py=re,this.pz=ie,X==null||!ae.isValid(X))throw new Error("x required");if(re==null||!ae.isValid(re))throw new Error("y required");if(ie==null||!ae.isValid(ie))throw new Error("z required")}static fromAffine(X){const{x:re,y:ie}=X||{};if(!X||!ae.isValid(re)||!ae.isValid(ie))throw new Error("invalid affine point");if(X instanceof U)throw new Error("projective point not allowed");const Q=ne=>ae.eql(ne,ae.ZERO);return Q(re)&&Q(ie)?U.ZERO:new U(re,ie,ae.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(X){const re=ae.invertBatch(X.map(ie=>ie.pz));return X.map((ie,Q)=>ie.toAffine(re[Q])).map(U.fromAffine)}static fromHex(X){const re=U.fromAffine(oe((0,_.ensureBytes)("pointHex",X)));return re.assertValidity(),re}static fromPrivateKey(X){return U.BASE.multiply(pe(X))}_setWindowSize(X){this._WINDOW_SIZE=X,fe.delete(this)}assertValidity(){if(this.is0()){if(ce.allowInfinityPoint&&!ae.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:X,y:re}=this.toAffine();if(!ae.isValid(X)||!ae.isValid(re))throw new Error("bad point: x or y not FE");const ie=ae.sqr(re),Q=de(X);if(!ae.eql(ie,Q))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:X}=this.toAffine();if(ae.isOdd)return!ae.isOdd(X);throw new Error("Field doesn't support isOdd")}equals(X){Z(X);const{px:re,py:ie,pz:Q}=this,{px:ne,py:L,pz:ue}=X,Ae=ae.eql(ae.mul(re,ue),ae.mul(ne,Q)),Re=ae.eql(ae.mul(ie,ue),ae.mul(L,Q));return Ae&&Re}negate(){return new U(this.px,ae.neg(this.py),this.pz)}double(){const{a:X,b:re}=ce,ie=ae.mul(re,O),{px:Q,py:ne,pz:L}=this;let ue=ae.ZERO,Ae=ae.ZERO,Re=ae.ZERO,Pe=ae.mul(Q,Q),xe=ae.mul(ne,ne),ge=ae.mul(L,L),_e=ae.mul(Q,ne);return _e=ae.add(_e,_e),Re=ae.mul(Q,L),Re=ae.add(Re,Re),ue=ae.mul(X,Re),Ae=ae.mul(ie,ge),Ae=ae.add(ue,Ae),ue=ae.sub(xe,Ae),Ae=ae.add(xe,Ae),Ae=ae.mul(ue,Ae),ue=ae.mul(_e,ue),Re=ae.mul(ie,Re),ge=ae.mul(X,ge),_e=ae.sub(Pe,ge),_e=ae.mul(X,_e),_e=ae.add(_e,Re),Re=ae.add(Pe,Pe),Pe=ae.add(Re,Pe),Pe=ae.add(Pe,ge),Pe=ae.mul(Pe,_e),Ae=ae.add(Ae,Pe),ge=ae.mul(ne,L),ge=ae.add(ge,ge),Pe=ae.mul(ge,_e),ue=ae.sub(ue,Pe),Re=ae.mul(ge,xe),Re=ae.add(Re,Re),Re=ae.add(Re,Re),new U(ue,Ae,Re)}add(X){Z(X);const{px:re,py:ie,pz:Q}=this,{px:ne,py:L,pz:ue}=X;let Ae=ae.ZERO,Re=ae.ZERO,Pe=ae.ZERO;const xe=ce.a,ge=ae.mul(ce.b,O);let _e=ae.mul(re,ne),ke=ae.mul(ie,L),Ee=ae.mul(Q,ue),Se=ae.add(re,ie),Oe=ae.add(ne,L);Se=ae.mul(Se,Oe),Oe=ae.add(_e,ke),Se=ae.sub(Se,Oe),Oe=ae.add(re,Q);let Ne=ae.add(ne,ue);return Oe=ae.mul(Oe,Ne),Ne=ae.add(_e,Ee),Oe=ae.sub(Oe,Ne),Ne=ae.add(ie,Q),Ae=ae.add(L,ue),Ne=ae.mul(Ne,Ae),Ae=ae.add(ke,Ee),Ne=ae.sub(Ne,Ae),Pe=ae.mul(xe,Oe),Ae=ae.mul(ge,Ee),Pe=ae.add(Ae,Pe),Ae=ae.sub(ke,Pe),Pe=ae.add(ke,Pe),Re=ae.mul(Ae,Pe),ke=ae.add(_e,_e),ke=ae.add(ke,_e),Ee=ae.mul(xe,Ee),Oe=ae.mul(ge,Oe),ke=ae.add(ke,Ee),Ee=ae.sub(_e,Ee),Ee=ae.mul(xe,Ee),Oe=ae.add(Oe,Ee),_e=ae.mul(ke,Oe),Re=ae.add(Re,_e),_e=ae.mul(Ne,Oe),Ae=ae.mul(Se,Ae),Ae=ae.sub(Ae,_e),_e=ae.mul(Se,ke),Pe=ae.mul(Ne,Pe),Pe=ae.add(Pe,_e),new U(Ae,Re,Pe)}subtract(X){return this.add(X.negate())}is0(){return this.equals(U.ZERO)}wNAF(X){return C.wNAFCached(this,fe,X,re=>{const ie=ae.invertBatch(re.map(Q=>Q.pz));return re.map((Q,ne)=>Q.toAffine(ie[ne])).map(U.fromAffine)})}multiplyUnsafe(X){const re=U.ZERO;if(X===N)return re;if(be(X),X===q)return this;const{endo:ie}=ce;if(!ie)return C.unsafeLadder(this,X);let{k1neg:Q,k1:ne,k2neg:L,k2:ue}=ie.splitScalar(X),Ae=re,Re=re,Pe=this;for(;ne>N||ue>N;)ne&q&&(Ae=Ae.add(Pe)),ue&q&&(Re=Re.add(Pe)),Pe=Pe.double(),ne>>=q,ue>>=q;return Q&&(Ae=Ae.negate()),L&&(Re=Re.negate()),Re=new U(ae.mul(Re.px,ie.beta),Re.py,Re.pz),Ae.add(Re)}multiply(X){be(X);let re=X,ie,Q;const{endo:ne}=ce;if(ne){const{k1neg:L,k1:ue,k2neg:Ae,k2:Re}=ne.splitScalar(re);let{p:Pe,f:xe}=this.wNAF(ue),{p:ge,f:_e}=this.wNAF(Re);Pe=C.constTimeNegate(L,Pe),ge=C.constTimeNegate(Ae,ge),ge=new U(ae.mul(ge.px,ne.beta),ge.py,ge.pz),ie=Pe.add(ge),Q=xe.add(_e)}else{const{p:L,f:ue}=this.wNAF(re);ie=L,Q=ue}return U.normalizeZ([ie,Q])[0]}multiplyAndAddUnsafe(X,re,ie){const Q=U.BASE,ne=(ue,Ae)=>Ae===N||Ae===q||!ue.equals(Q)?ue.multiplyUnsafe(Ae):ue.multiply(Ae),L=ne(this,re).add(ne(X,ie));return L.is0()?void 0:L}toAffine(X){const{px:re,py:ie,pz:Q}=this,ne=this.is0();X==null&&(X=ne?ae.ONE:ae.inv(Q));const L=ae.mul(re,X),ue=ae.mul(ie,X),Ae=ae.mul(Q,X);if(ne)return{x:ae.ZERO,y:ae.ZERO};if(!ae.eql(Ae,ae.ONE))throw new Error("invZ was invalid");return{x:L,y:ue}}isTorsionFree(){const{h:X,isTorsionFree:re}=ce;if(X===q)return!0;if(re)return re(U,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:X,clearCofactor:re}=ce;return X===q?this:re?re(U,this):this.multiplyUnsafe(ce.h)}toRawBytes(X=!0){return this.assertValidity(),he(U,this,X)}toHex(X=!0){return w.bytesToHex(this.toRawBytes(X))}}U.BASE=new U(ce.Gx,ce.Gy,ae.ONE),U.ZERO=new U(ae.ZERO,ae.ONE,ae.ZERO);const S=ce.nBitLength,C=(0,A.wNAF)(U,ce.endo?Math.ceil(S/2):S);return{CURVE:ce,ProjectivePoint:U,normPrivateKeyToScalar:pe,weierstrassEquation:de,isWithinCurveOrder:le}}b.weierstrassPoints=D;function V(se){const ce=(0,A.validateBasic)(se);return w.validateObject(ce,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...ce})}function ee(se){const ce=V(se),{Fp:ae,n:he}=ce,oe=ae.BYTES+1,de=2*ae.BYTES+1;function le(Oe){return N<Oe&&Oe<ae.ORDER}function be(Oe){return v.mod(Oe,he)}function pe(Oe){return v.invert(Oe,he)}const{ProjectivePoint:fe,normPrivateKeyToScalar:Z,weierstrassEquation:U,isWithinCurveOrder:S}=D({...ce,toBytes(Oe,Ne,ve){const Ce=Ne.toAffine(),Te=ae.toBytes(Ce.x),Le=w.concatBytes;return ve?Le(Uint8Array.from([Ne.hasEvenY()?2:3]),Te):Le(Uint8Array.from([4]),Te,ae.toBytes(Ce.y))},fromBytes(Oe){const Ne=Oe.length,ve=Oe[0],Ce=Oe.subarray(1);if(Ne===oe&&(ve===2||ve===3)){const Te=w.bytesToNumberBE(Ce);if(!le(Te))throw new Error("Point is not on curve");const Le=U(Te);let Be=ae.sqrt(Le);const De=(Be&q)===q;return(ve&1)===1!==De&&(Be=ae.neg(Be)),{x:Te,y:Be}}else if(Ne===de&&ve===4){const Te=ae.fromBytes(Ce.subarray(0,ae.BYTES)),Le=ae.fromBytes(Ce.subarray(ae.BYTES,2*ae.BYTES));return{x:Te,y:Le}}else throw new Error(`Point of length ${Ne} was invalid. Expected ${oe} compressed bytes or ${de} uncompressed bytes`)}}),C=Oe=>w.bytesToHex(w.numberToBytesBE(Oe,ce.nByteLength));function F(Oe){const Ne=he>>q;return Oe>Ne}function X(Oe){return F(Oe)?be(-Oe):Oe}const re=(Oe,Ne,ve)=>w.bytesToNumberBE(Oe.slice(Ne,ve));class ie{constructor(Ne,ve,Ce){this.r=Ne,this.s=ve,this.recovery=Ce,this.assertValidity()}static fromCompact(Ne){const ve=ce.nByteLength;return Ne=(0,_.ensureBytes)("compactSignature",Ne,ve*2),new ie(re(Ne,0,ve),re(Ne,ve,2*ve))}static fromDER(Ne){const{r:ve,s:Ce}=b.DER.toSig((0,_.ensureBytes)("DER",Ne));return new ie(ve,Ce)}assertValidity(){if(!S(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!S(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(Ne){return new ie(this.r,this.s,Ne)}recoverPublicKey(Ne){const{r:ve,s:Ce,recovery:Te}=this,Le=Re((0,_.ensureBytes)("msgHash",Ne));if(Te==null||![0,1,2,3].includes(Te))throw new Error("recovery id invalid");const Be=Te===2||Te===3?ve+ce.n:ve;if(Be>=ae.ORDER)throw new Error("recovery id 2 or 3 invalid");const De=Te&1?"03":"02",Ke=fe.fromHex(De+C(Be)),We=pe(Be),Qe=be(-Le*We),Xe=be(Ce*We),at=fe.BASE.multiplyAndAddUnsafe(Ke,Qe,Xe);if(!at)throw new Error("point at infinify");return at.assertValidity(),at}hasHighS(){return F(this.s)}normalizeS(){return this.hasHighS()?new ie(this.r,be(-this.s),this.recovery):this}toDERRawBytes(){return w.hexToBytes(this.toDERHex())}toDERHex(){return b.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return w.hexToBytes(this.toCompactHex())}toCompactHex(){return C(this.r)+C(this.s)}}const Q={isValidPrivateKey(Oe){try{return Z(Oe),!0}catch{return!1}},normPrivateKeyToScalar:Z,randomPrivateKey:()=>{const Oe=v.getMinHashLength(ce.n);return v.mapHashToField(ce.randomBytes(Oe),ce.n)},precompute(Oe=8,Ne=fe.BASE){return Ne._setWindowSize(Oe),Ne.multiply(BigInt(3)),Ne}};function ne(Oe,Ne=!0){return fe.fromPrivateKey(Oe).toRawBytes(Ne)}function L(Oe){const Ne=Oe instanceof Uint8Array,ve=typeof Oe=="string",Ce=(Ne||ve)&&Oe.length;return Ne?Ce===oe||Ce===de:ve?Ce===2*oe||Ce===2*de:Oe instanceof fe}function ue(Oe,Ne,ve=!0){if(L(Oe))throw new Error("first arg must be private key");if(!L(Ne))throw new Error("second arg must be public key");return fe.fromHex(Ne).multiply(Z(Oe)).toRawBytes(ve)}const Ae=ce.bits2int||function(Oe){const Ne=w.bytesToNumberBE(Oe),ve=Oe.length*8-ce.nBitLength;return ve>0?Ne>>BigInt(ve):Ne},Re=ce.bits2int_modN||function(Oe){return be(Ae(Oe))},Pe=w.bitMask(ce.nBitLength);function xe(Oe){if(typeof Oe!="bigint")throw new Error("bigint expected");if(!(N<=Oe&&Oe<Pe))throw new Error(`bigint expected < 2^${ce.nBitLength}`);return w.numberToBytesBE(Oe,ce.nByteLength)}function ge(Oe,Ne,ve=_e){if(["recovered","canonical"].some(qe=>qe in ve))throw new Error("sign() legacy options not supported");const{hash:Ce,randomBytes:Te}=ce;let{lowS:Le,prehash:Be,extraEntropy:De}=ve;Le==null&&(Le=!0),Oe=(0,_.ensureBytes)("msgHash",Oe),Be&&(Oe=(0,_.ensureBytes)("prehashed msgHash",Ce(Oe)));const Ke=Re(Oe),We=Z(Ne),Qe=[xe(We),xe(Ke)];if(De!=null){const qe=De===!0?Te(ae.BYTES):De;Qe.push((0,_.ensureBytes)("extraEntropy",qe))}const Xe=w.concatBytes(...Qe),at=Ke;function Fe(qe){const $e=Ae(qe);if(!S($e))return;const Ie=pe($e),we=fe.BASE.multiply($e).toAffine(),me=be(we.x);if(me===N)return;const ye=be(Ie*be(at+me*We));if(ye===N)return;let Me=(we.x===me?0:2)|Number(we.y&q),je=ye;return Le&&F(ye)&&(je=X(ye),Me^=1),new ie(me,je,Me)}return{seed:Xe,k2sig:Fe}}const _e={lowS:ce.lowS,prehash:!1},ke={lowS:ce.lowS,prehash:!1};function Ee(Oe,Ne,ve=_e){const{seed:Ce,k2sig:Te}=ge(Oe,Ne,ve),Le=ce;return w.createHmacDrbg(Le.hash.outputLen,Le.nByteLength,Le.hmac)(Ce,Te)}fe.BASE._setWindowSize(8);function Se(Oe,Ne,ve,Ce=ke){const Te=Oe;if(Ne=(0,_.ensureBytes)("msgHash",Ne),ve=(0,_.ensureBytes)("publicKey",ve),"strict"in Ce)throw new Error("options.strict was renamed to lowS");const{lowS:Le,prehash:Be}=Ce;let De,Ke;try{if(typeof Te=="string"||Te instanceof Uint8Array)try{De=ie.fromDER(Te)}catch(we){if(!(we instanceof b.DER.Err))throw we;De=ie.fromCompact(Te)}else if(typeof Te=="object"&&typeof Te.r=="bigint"&&typeof Te.s=="bigint"){const{r:we,s:me}=Te;De=new ie(we,me)}else throw new Error("PARSE");Ke=fe.fromHex(ve)}catch(we){if(we.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(Le&&De.hasHighS())return!1;Be&&(Ne=ce.hash(Ne));const{r:We,s:Qe}=De,Xe=Re(Ne),at=pe(Qe),Fe=be(Xe*at),qe=be(We*at),$e=fe.BASE.multiplyAndAddUnsafe(Ke,Fe,qe)?.toAffine();return $e?be($e.x)===We:!1}return{CURVE:ce,getPublicKey:ne,getSharedSecret:ue,sign:Ee,verify:Se,ProjectivePoint:fe,Signature:ie,utils:Q}}b.weierstrass=ee;function J(se,ce){const ae=se.ORDER;let he=N;for(let F=ae-q;F%B===N;F/=B)he+=q;const oe=he,de=B<<oe-q-q,le=de*B,be=(ae-q)/le,pe=(be-q)/B,fe=le-q,Z=de,U=se.pow(ce,be),S=se.pow(ce,(be+q)/B);let C=(F,X)=>{let re=U,ie=se.pow(X,fe),Q=se.sqr(ie);Q=se.mul(Q,X);let ne=se.mul(F,Q);ne=se.pow(ne,pe),ne=se.mul(ne,ie),ie=se.mul(ne,X),Q=se.mul(ne,F);let L=se.mul(Q,ie);ne=se.pow(L,Z);let ue=se.eql(ne,se.ONE);ie=se.mul(Q,S),ne=se.mul(L,re),Q=se.cmov(ie,Q,ue),L=se.cmov(ne,L,ue);for(let Ae=oe;Ae>q;Ae--){let Re=Ae-B;Re=B<<Re-q;let Pe=se.pow(L,Re);const xe=se.eql(Pe,se.ONE);ie=se.mul(Q,re),re=se.mul(re,re),Pe=se.mul(L,re),Q=se.cmov(ie,Q,xe),L=se.cmov(Pe,L,xe)}return{isValid:ue,value:Q}};if(se.ORDER%I===O){const F=(se.ORDER-O)/I,X=se.sqrt(se.neg(ce));C=(re,ie)=>{let Q=se.sqr(ie);const ne=se.mul(re,ie);Q=se.mul(Q,ne);let L=se.pow(Q,F);L=se.mul(L,ne);const ue=se.mul(L,X),Ae=se.mul(se.sqr(L),ie),Re=se.eql(Ae,re);let Pe=se.cmov(ue,L,Re);return{isValid:Re,value:Pe}}}return C}b.SWUFpSqrtRatio=J;function te(se,ce){if(v.validateField(se),!se.isValid(ce.A)||!se.isValid(ce.B)||!se.isValid(ce.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const ae=J(se,ce.Z);if(!se.isOdd)throw new Error("Fp.isOdd is not implemented!");return he=>{let oe,de,le,be,pe,fe,Z,U;oe=se.sqr(he),oe=se.mul(oe,ce.Z),de=se.sqr(oe),de=se.add(de,oe),le=se.add(de,se.ONE),le=se.mul(le,ce.B),be=se.cmov(ce.Z,se.neg(de),!se.eql(de,se.ZERO)),be=se.mul(be,ce.A),de=se.sqr(le),fe=se.sqr(be),pe=se.mul(fe,ce.A),de=se.add(de,pe),de=se.mul(de,le),fe=se.mul(fe,be),pe=se.mul(fe,ce.B),de=se.add(de,pe),Z=se.mul(oe,le);const{isValid:S,value:C}=ae(de,fe);U=se.mul(oe,he),U=se.mul(U,C),Z=se.cmov(Z,le,S),U=se.cmov(U,C,S);const F=se.isOdd(he)===se.isOdd(U);return U=se.cmov(se.neg(U),U,F),Z=se.div(Z,be),{x:Z,y:U}}}b.mapToCurveSimpleSWU=te}(weierstrass)),weierstrass}var hashToCurve={},hasRequiredHashToCurve;function requireHashToCurve(){if(hasRequiredHashToCurve)return hashToCurve;hasRequiredHashToCurve=1,Object.defineProperty(hashToCurve,"__esModule",{value:!0}),hashToCurve.createHasher=hashToCurve.isogenyMap=hashToCurve.hash_to_field=hashToCurve.expand_message_xof=hashToCurve.expand_message_xmd=void 0;const b=requireModular(),v=requireUtils$1();function w(D){if(D instanceof Uint8Array)return D;if(typeof D=="string")return(0,v.utf8ToBytes)(D);throw new Error("DST must be Uint8Array or string")}const _=v.bytesToNumberBE;function A(D,V){if(D<0||D>=1<<8*V)throw new Error(`bad I2OSP call: value=${D} length=${V}`);const ee=Array.from({length:V}).fill(0);for(let J=V-1;J>=0;J--)ee[J]=D&255,D>>>=8;return new Uint8Array(ee)}function E(D,V){const ee=new Uint8Array(D.length);for(let J=0;J<D.length;J++)ee[J]=D[J]^V[J];return ee}function k(D){if(!(D instanceof Uint8Array))throw new Error("Uint8Array expected")}function P(D){if(!Number.isSafeInteger(D))throw new Error("number expected")}function N(D,V,ee,J){k(D),k(V),P(ee),V.length>255&&(V=J((0,v.concatBytes)((0,v.utf8ToBytes)("H2C-OVERSIZE-DST-"),V)));const{outputLen:te,blockLen:se}=J,ce=Math.ceil(ee/te);if(ce>255)throw new Error("Invalid xmd length");const ae=(0,v.concatBytes)(V,A(V.length,1)),he=A(0,se),oe=A(ee,2),de=new Array(ce),le=J((0,v.concatBytes)(he,D,oe,A(0,1),ae));de[0]=J((0,v.concatBytes)(le,A(1,1),ae));for(let pe=1;pe<=ce;pe++){const fe=[E(le,de[pe-1]),A(pe+1,1),ae];de[pe]=J((0,v.concatBytes)(...fe))}return(0,v.concatBytes)(...de).slice(0,ee)}hashToCurve.expand_message_xmd=N;function q(D,V,ee,J,te){if(k(D),k(V),P(ee),V.length>255){const se=Math.ceil(2*J/8);V=te.create({dkLen:se}).update((0,v.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(V).digest()}if(ee>65535||V.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return te.create({dkLen:ee}).update(D).update(A(ee,2)).update(V).update(A(V.length,1)).digest()}hashToCurve.expand_message_xof=q;function B(D,V,ee){(0,v.validateObject)(ee,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:J,k:te,m:se,hash:ce,expand:ae,DST:he}=ee;k(D),P(V);const oe=w(he),de=J.toString(2).length,le=Math.ceil((de+te)/8),be=V*se*le;let pe;if(ae==="xmd")pe=N(D,oe,be,ce);else if(ae==="xof")pe=q(D,oe,be,te,ce);else if(ae==="_internal_pass")pe=D;else throw new Error('expand must be "xmd" or "xof"');const fe=new Array(V);for(let Z=0;Z<V;Z++){const U=new Array(se);for(let S=0;S<se;S++){const C=le*(S+Z*se),F=pe.subarray(C,C+le);U[S]=(0,b.mod)(_(F),J)}fe[Z]=U}return fe}hashToCurve.hash_to_field=B;function O(D,V){const ee=V.map(J=>Array.from(J).reverse());return(J,te)=>{const[se,ce,ae,he]=ee.map(oe=>oe.reduce((de,le)=>D.add(D.mul(de,J),le)));return J=D.div(se,ce),te=D.mul(te,D.div(ae,he)),{x:J,y:te}}}hashToCurve.isogenyMap=O;function I(D,V,ee){if(typeof V!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(J,te){const se=B(J,2,{...ee,DST:ee.DST,...te}),ce=D.fromAffine(V(se[0])),ae=D.fromAffine(V(se[1])),he=ce.add(ae).clearCofactor();return he.assertValidity(),he},encodeToCurve(J,te){const se=B(J,1,{...ee,DST:ee.encodeDST,...te}),ce=D.fromAffine(V(se[0])).clearCofactor();return ce.assertValidity(),ce}}}return hashToCurve.createHasher=I,hashToCurve}var _shortw_utils={},hasRequired_shortw_utils;function require_shortw_utils(){if(hasRequired_shortw_utils)return _shortw_utils;hasRequired_shortw_utils=1,Object.defineProperty(_shortw_utils,"__esModule",{value:!0}),_shortw_utils.createCurve=_shortw_utils.getHash=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const b=requireHmac$1(),v=requireUtils$2(),w=requireWeierstrass();function _(E){return{hash:E,hmac:(k,...P)=>(0,b.hmac)(E,k,(0,v.concatBytes)(...P)),randomBytes:v.randomBytes}}_shortw_utils.getHash=_;function A(E,k){const P=N=>(0,w.weierstrass)({...E,..._(N)});return Object.freeze({...P(k),create:P})}return _shortw_utils.createCurve=A,_shortw_utils}var hasRequiredSecp256k1$1;function requireSecp256k1$1(){return hasRequiredSecp256k1$1||(hasRequiredSecp256k1$1=1,function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.encodeToCurve=b.hashToCurve=b.schnorr=b.secp256k1=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const v=requireSha256(),w=requireUtils$2(),_=requireModular(),A=requireWeierstrass(),E=requireUtils$1(),k=requireHashToCurve(),P=require_shortw_utils(),N=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),q=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),B=BigInt(1),O=BigInt(2),I=(ie,Q)=>(ie+Q/O)/Q;function D(ie){const Q=N,ne=BigInt(3),L=BigInt(6),ue=BigInt(11),Ae=BigInt(22),Re=BigInt(23),Pe=BigInt(44),xe=BigInt(88),ge=ie*ie*ie%Q,_e=ge*ge*ie%Q,ke=(0,_.pow2)(_e,ne,Q)*_e%Q,Ee=(0,_.pow2)(ke,ne,Q)*_e%Q,Se=(0,_.pow2)(Ee,O,Q)*ge%Q,Oe=(0,_.pow2)(Se,ue,Q)*Se%Q,Ne=(0,_.pow2)(Oe,Ae,Q)*Oe%Q,ve=(0,_.pow2)(Ne,Pe,Q)*Ne%Q,Ce=(0,_.pow2)(ve,xe,Q)*ve%Q,Te=(0,_.pow2)(Ce,Pe,Q)*Ne%Q,Le=(0,_.pow2)(Te,ne,Q)*_e%Q,Be=(0,_.pow2)(Le,Re,Q)*Oe%Q,De=(0,_.pow2)(Be,L,Q)*ge%Q,Ke=(0,_.pow2)(De,O,Q);if(!V.eql(V.sqr(Ke),ie))throw new Error("Cannot find square root");return Ke}const V=(0,_.Field)(N,void 0,void 0,{sqrt:D});b.secp256k1=(0,P.createCurve)({a:BigInt(0),b:BigInt(7),Fp:V,n:q,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:ie=>{const Q=q,ne=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),L=-B*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),ue=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),Ae=ne,Re=BigInt("0x100000000000000000000000000000000"),Pe=I(Ae*ie,Q),xe=I(-L*ie,Q);let ge=(0,_.mod)(ie-Pe*ne-xe*ue,Q),_e=(0,_.mod)(-Pe*L-xe*Ae,Q);const ke=ge>Re,Ee=_e>Re;if(ke&&(ge=Q-ge),Ee&&(_e=Q-_e),ge>Re||_e>Re)throw new Error("splitScalar: Endomorphism failed, k="+ie);return{k1neg:ke,k1:ge,k2neg:Ee,k2:_e}}}},v.sha256);const ee=BigInt(0),J=ie=>typeof ie=="bigint"&&ee<ie&&ie<N,te=ie=>typeof ie=="bigint"&&ee<ie&&ie<q,se={};function ce(ie,...Q){let ne=se[ie];if(ne===void 0){const L=(0,v.sha256)(Uint8Array.from(ie,ue=>ue.charCodeAt(0)));ne=(0,E.concatBytes)(L,L),se[ie]=ne}return(0,v.sha256)((0,E.concatBytes)(ne,...Q))}const ae=ie=>ie.toRawBytes(!0).slice(1),he=ie=>(0,E.numberToBytesBE)(ie,32),oe=ie=>(0,_.mod)(ie,N),de=ie=>(0,_.mod)(ie,q),le=b.secp256k1.ProjectivePoint,be=(ie,Q,ne)=>le.BASE.multiplyAndAddUnsafe(ie,Q,ne);function pe(ie){let Q=b.secp256k1.utils.normPrivateKeyToScalar(ie),ne=le.fromPrivateKey(Q);return{scalar:ne.hasEvenY()?Q:de(-Q),bytes:ae(ne)}}function fe(ie){if(!J(ie))throw new Error("bad x: need 0 < x < p");const Q=oe(ie*ie),ne=oe(Q*ie+BigInt(7));let L=D(ne);L%O!==ee&&(L=oe(-L));const ue=new le(ie,L,B);return ue.assertValidity(),ue}function Z(...ie){return de((0,E.bytesToNumberBE)(ce("BIP0340/challenge",...ie)))}function U(ie){return pe(ie).bytes}function S(ie,Q,ne=(0,w.randomBytes)(32)){const L=(0,E.ensureBytes)("message",ie),{bytes:ue,scalar:Ae}=pe(Q),Re=(0,E.ensureBytes)("auxRand",ne,32),Pe=he(Ae^(0,E.bytesToNumberBE)(ce("BIP0340/aux",Re))),xe=ce("BIP0340/nonce",Pe,ue,L),ge=de((0,E.bytesToNumberBE)(xe));if(ge===ee)throw new Error("sign failed: k is zero");const{bytes:_e,scalar:ke}=pe(ge),Ee=Z(_e,ue,L),Se=new Uint8Array(64);if(Se.set(_e,0),Se.set(he(de(ke+Ee*Ae)),32),!C(Se,L,ue))throw new Error("sign: Invalid signature produced");return Se}function C(ie,Q,ne){const L=(0,E.ensureBytes)("signature",ie,64),ue=(0,E.ensureBytes)("message",Q),Ae=(0,E.ensureBytes)("publicKey",ne,32);try{const Re=fe((0,E.bytesToNumberBE)(Ae)),Pe=(0,E.bytesToNumberBE)(L.subarray(0,32));if(!J(Pe))return!1;const xe=(0,E.bytesToNumberBE)(L.subarray(32,64));if(!te(xe))return!1;const ge=Z(he(Pe),ae(Re),ue),_e=be(Re,xe,de(-ge));return!(!_e||!_e.hasEvenY()||_e.toAffine().x!==Pe)}catch{return!1}}b.schnorr={getPublicKey:U,sign:S,verify:C,utils:{randomPrivateKey:b.secp256k1.utils.randomPrivateKey,lift_x:fe,pointToBytes:ae,numberToBytesBE:E.numberToBytesBE,bytesToNumberBE:E.bytesToNumberBE,taggedHash:ce,mod:_.mod}};const F=(0,k.isogenyMap)(V,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(ie=>ie.map(Q=>BigInt(Q)))),X=(0,A.mapToCurveSimpleSWU)(V,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:V.create(BigInt("-11"))}),re=(0,k.createHasher)(b.secp256k1.ProjectivePoint,ie=>{const{x:Q,y:ne}=X(V.create(ie[0]));return F(Q,ne)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:V.ORDER,m:1,k:128,expand:"xmd",hash:v.sha256});b.hashToCurve=re.hashToCurve,b.encodeToCurve=re.encodeToCurve}(secp256k1$1)),secp256k1$1}var signature$2={},constants$1={},addresses={},hasRequiredAddresses;function requireAddresses(){return hasRequiredAddresses||(hasRequiredAddresses=1,Object.defineProperty(addresses,"__esModule",{value:!0}),addresses.ZeroAddress=void 0,addresses.ZeroAddress="0x0000000000000000000000000000000000000000"),addresses}var hashes={},hasRequiredHashes;function requireHashes(){return hasRequiredHashes||(hasRequiredHashes=1,Object.defineProperty(hashes,"__esModule",{value:!0}),hashes.ZeroHash=void 0,hashes.ZeroHash="0x0000000000000000000000000000000000000000000000000000000000000000"),hashes}var numbers={},hasRequiredNumbers;function requireNumbers(){return hasRequiredNumbers||(hasRequiredNumbers=1,Object.defineProperty(numbers,"__esModule",{value:!0}),numbers.MaxInt256=numbers.MinInt256=numbers.MaxUint256=numbers.WeiPerEther=numbers.N=void 0,numbers.N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),numbers.WeiPerEther=BigInt("1000000000000000000"),numbers.MaxUint256=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),numbers.MinInt256=BigInt("0x8000000000000000000000000000000000000000000000000000000000000000")*BigInt(-1),numbers.MaxInt256=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")),numbers}var strings={},hasRequiredStrings;function requireStrings(){return hasRequiredStrings||(hasRequiredStrings=1,Object.defineProperty(strings,"__esModule",{value:!0}),strings.MessagePrefix=strings.EtherSymbol=void 0,strings.EtherSymbol="Ξ",strings.MessagePrefix=`Ethereum Signed Message:
764
- `),strings}var hasRequiredConstants$1;function requireConstants$1(){return hasRequiredConstants$1||(hasRequiredConstants$1=1,function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.MessagePrefix=b.EtherSymbol=b.MaxInt256=b.MinInt256=b.MaxUint256=b.WeiPerEther=b.N=b.ZeroHash=b.ZeroAddress=void 0;var v=requireAddresses();Object.defineProperty(b,"ZeroAddress",{enumerable:!0,get:function(){return v.ZeroAddress}});var w=requireHashes();Object.defineProperty(b,"ZeroHash",{enumerable:!0,get:function(){return w.ZeroHash}});var _=requireNumbers();Object.defineProperty(b,"N",{enumerable:!0,get:function(){return _.N}}),Object.defineProperty(b,"WeiPerEther",{enumerable:!0,get:function(){return _.WeiPerEther}}),Object.defineProperty(b,"MaxUint256",{enumerable:!0,get:function(){return _.MaxUint256}}),Object.defineProperty(b,"MinInt256",{enumerable:!0,get:function(){return _.MinInt256}}),Object.defineProperty(b,"MaxInt256",{enumerable:!0,get:function(){return _.MaxInt256}});var A=requireStrings();Object.defineProperty(b,"EtherSymbol",{enumerable:!0,get:function(){return A.EtherSymbol}}),Object.defineProperty(b,"MessagePrefix",{enumerable:!0,get:function(){return A.MessagePrefix}})}(constants$1)),constants$1}var hasRequiredSignature;function requireSignature(){if(hasRequiredSignature)return signature$2;hasRequiredSignature=1,Object.defineProperty(signature$2,"__esModule",{value:!0}),signature$2.Signature=void 0;const b=requireConstants$1(),v=requireUtils$3(),w=BigInt(0),_=BigInt(1),A=BigInt(2),E=BigInt(27),k=BigInt(28),P=BigInt(35),N={};function q(O){return(0,v.zeroPadValue)((0,v.toBeArray)(O),32)}class B{#e;#t;#r;#n;get r(){return this.#e}set r(I){(0,v.assertArgument)((0,v.dataLength)(I)===32,"invalid r","value",I),this.#e=(0,v.hexlify)(I)}get s(){return this.#t}set s(I){(0,v.assertArgument)((0,v.dataLength)(I)===32,"invalid s","value",I);const D=(0,v.hexlify)(I);(0,v.assertArgument)(parseInt(D.substring(0,3))<8,"non-canonical s","value",D),this.#t=D}get v(){return this.#r}set v(I){const D=(0,v.getNumber)(I,"value");(0,v.assertArgument)(D===27||D===28,"invalid v","v",I),this.#r=D}get networkV(){return this.#n}get legacyChainId(){const I=this.networkV;return I==null?null:B.getChainId(I)}get yParity(){return this.v===27?0:1}get yParityAndS(){const I=(0,v.getBytes)(this.s);return this.yParity&&(I[0]|=128),(0,v.hexlify)(I)}get compactSerialized(){return(0,v.concat)([this.r,this.yParityAndS])}get serialized(){return(0,v.concat)([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(I,D,V,ee){(0,v.assertPrivate)(I,N,"Signature"),this.#e=D,this.#t=V,this.#r=ee,this.#n=null}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const I=new B(N,this.r,this.s,this.v);return this.networkV&&(I.#n=this.networkV),I}toJSON(){const I=this.networkV;return{_type:"signature",networkV:I!=null?I.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(I){const D=(0,v.getBigInt)(I,"v");return D==E||D==k?w:((0,v.assertArgument)(D>=P,"invalid EIP-155 v","v",I),(D-P)/A)}static getChainIdV(I,D){return(0,v.getBigInt)(I)*A+BigInt(35+D-27)}static getNormalizedV(I){const D=(0,v.getBigInt)(I);return D===w||D===E?27:D===_||D===k?28:((0,v.assertArgument)(D>=P,"invalid v","v",I),D&_?27:28)}static from(I){function D(ae,he){(0,v.assertArgument)(ae,he,"signature",I)}if(I==null)return new B(N,b.ZeroHash,b.ZeroHash,27);if(typeof I=="string"){const ae=(0,v.getBytes)(I,"signature");if(ae.length===64){const he=(0,v.hexlify)(ae.slice(0,32)),oe=ae.slice(32,64),de=oe[0]&128?28:27;return oe[0]&=127,new B(N,he,(0,v.hexlify)(oe),de)}if(ae.length===65){const he=(0,v.hexlify)(ae.slice(0,32)),oe=ae.slice(32,64);D((oe[0]&128)===0,"non-canonical s");const de=B.getNormalizedV(ae[64]);return new B(N,he,(0,v.hexlify)(oe),de)}D(!1,"invalid raw signature length")}if(I instanceof B)return I.clone();const V=I.r;D(V!=null,"missing r");const ee=q(V),J=function(ae,he){if(ae!=null)return q(ae);if(he!=null){D((0,v.isHexString)(he,32),"invalid yParityAndS");const oe=(0,v.getBytes)(he);return oe[0]&=127,(0,v.hexlify)(oe)}D(!1,"missing s")}(I.s,I.yParityAndS);D(((0,v.getBytes)(J)[0]&128)==0,"non-canonical s");const{networkV:te,v:se}=function(ae,he,oe){if(ae!=null){const de=(0,v.getBigInt)(ae);return{networkV:de>=P?de:void 0,v:B.getNormalizedV(de)}}if(he!=null)return D((0,v.isHexString)(he,32),"invalid yParityAndS"),{v:(0,v.getBytes)(he)[0]&128?28:27};if(oe!=null){switch((0,v.getNumber)(oe,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}D(!1,"invalid yParity")}D(!1,"missing v")}(I.v,I.yParityAndS,I.yParity),ce=new B(N,ee,J,se);return te&&(ce.#n=te),D(I.yParity==null||(0,v.getNumber)(I.yParity,"sig.yParity")===ce.yParity,"yParity mismatch"),D(I.yParityAndS==null||I.yParityAndS===ce.yParityAndS,"yParityAndS mismatch"),ce}}return signature$2.Signature=B,signature$2}var hasRequiredSigningKey;function requireSigningKey(){if(hasRequiredSigningKey)return signingKey;hasRequiredSigningKey=1,Object.defineProperty(signingKey,"__esModule",{value:!0}),signingKey.SigningKey=void 0;const b=requireSecp256k1$1(),v=requireUtils$3(),w=requireSignature();class _{#e;constructor(E){(0,v.assertArgument)((0,v.dataLength)(E)===32,"invalid private key","privateKey","[REDACTED]"),this.#e=(0,v.hexlify)(E)}get privateKey(){return this.#e}get publicKey(){return _.computePublicKey(this.#e)}get compressedPublicKey(){return _.computePublicKey(this.#e,!0)}sign(E){(0,v.assertArgument)((0,v.dataLength)(E)===32,"invalid digest length","digest",E);const k=b.secp256k1.sign((0,v.getBytesCopy)(E),(0,v.getBytesCopy)(this.#e),{lowS:!0});return w.Signature.from({r:(0,v.toBeHex)(k.r,32),s:(0,v.toBeHex)(k.s,32),v:k.recovery?28:27})}computeSharedSecret(E){const k=_.computePublicKey(E);return(0,v.hexlify)(b.secp256k1.getSharedSecret((0,v.getBytesCopy)(this.#e),(0,v.getBytes)(k),!1))}static computePublicKey(E,k){let P=(0,v.getBytes)(E,"key");if(P.length===32){const q=b.secp256k1.getPublicKey(P,!!k);return(0,v.hexlify)(q)}if(P.length===64){const q=new Uint8Array(65);q[0]=4,q.set(P,1),P=q}const N=b.secp256k1.ProjectivePoint.fromHex(P);return(0,v.hexlify)(N.toRawBytes(k))}static recoverPublicKey(E,k){(0,v.assertArgument)((0,v.dataLength)(E)===32,"invalid digest length","digest",E);const P=w.Signature.from(k);let N=b.secp256k1.Signature.fromCompact((0,v.getBytesCopy)((0,v.concat)([P.r,P.s])));N=N.addRecoveryBit(P.yParity);const q=N.recoverPublicKey((0,v.getBytesCopy)(E));return(0,v.assertArgument)(q!=null,"invalid signautre for digest","signature",k),"0x"+q.toHex(!1)}static addPoints(E,k,P){const N=b.secp256k1.ProjectivePoint.fromHex(_.computePublicKey(E).substring(2)),q=b.secp256k1.ProjectivePoint.fromHex(_.computePublicKey(k).substring(2));return"0x"+N.add(q).toHex(!!P)}}return signingKey.SigningKey=_,signingKey}var hasRequiredCrypto;function requireCrypto(){return hasRequiredCrypto||(hasRequiredCrypto=1,function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.lock=b.Signature=b.SigningKey=b.scryptSync=b.scrypt=b.pbkdf2=b.sha512=b.sha256=b.ripemd160=b.keccak256=b.randomBytes=b.computeHmac=void 0;const v=requireHmac();Object.defineProperty(b,"computeHmac",{enumerable:!0,get:function(){return v.computeHmac}});const w=requireKeccak();Object.defineProperty(b,"keccak256",{enumerable:!0,get:function(){return w.keccak256}});const _=requireRipemd160();Object.defineProperty(b,"ripemd160",{enumerable:!0,get:function(){return _.ripemd160}});const A=requirePbkdf2();Object.defineProperty(b,"pbkdf2",{enumerable:!0,get:function(){return A.pbkdf2}});const E=requireRandom();Object.defineProperty(b,"randomBytes",{enumerable:!0,get:function(){return E.randomBytes}});const k=requireScrypt();Object.defineProperty(b,"scrypt",{enumerable:!0,get:function(){return k.scrypt}}),Object.defineProperty(b,"scryptSync",{enumerable:!0,get:function(){return k.scryptSync}});const P=requireSha2();Object.defineProperty(b,"sha256",{enumerable:!0,get:function(){return P.sha256}}),Object.defineProperty(b,"sha512",{enumerable:!0,get:function(){return P.sha512}});var N=requireSigningKey();Object.defineProperty(b,"SigningKey",{enumerable:!0,get:function(){return N.SigningKey}});var q=requireSignature();Object.defineProperty(b,"Signature",{enumerable:!0,get:function(){return q.Signature}});function B(){v.computeHmac.lock(),w.keccak256.lock(),A.pbkdf2.lock(),E.randomBytes.lock(),_.ripemd160.lock(),k.scrypt.lock(),k.scryptSync.lock(),P.sha256.lock(),P.sha512.lock(),E.randomBytes.lock()}b.lock=B}(crypto$3)),crypto$3}var hasRequiredAddress$3;function requireAddress$3(){if(hasRequiredAddress$3)return address$1;hasRequiredAddress$3=1,Object.defineProperty(address$1,"__esModule",{value:!0}),address$1.getIcapAddress=address$1.getAddress=void 0;const b=requireCrypto(),v=requireUtils$3(),w=BigInt(0),_=BigInt(36);function A(I){I=I.toLowerCase();const D=I.substring(2).split(""),V=new Uint8Array(40);for(let J=0;J<40;J++)V[J]=D[J].charCodeAt(0);const ee=(0,v.getBytes)((0,b.keccak256)(V));for(let J=0;J<40;J+=2)ee[J>>1]>>4>=8&&(D[J]=D[J].toUpperCase()),(ee[J>>1]&15)>=8&&(D[J+1]=D[J+1].toUpperCase());return"0x"+D.join("")}const E={};for(let I=0;I<10;I++)E[String(I)]=String(I);for(let I=0;I<26;I++)E[String.fromCharCode(65+I)]=String(10+I);const k=15;function P(I){I=I.toUpperCase(),I=I.substring(4)+I.substring(0,2)+"00";let D=I.split("").map(ee=>E[ee]).join("");for(;D.length>=k;){let ee=D.substring(0,k);D=parseInt(ee,10)%97+D.substring(ee.length)}let V=String(98-parseInt(D,10)%97);for(;V.length<2;)V="0"+V;return V}const N=function(){const I={};for(let D=0;D<36;D++){const V="0123456789abcdefghijklmnopqrstuvwxyz"[D];I[V]=BigInt(D)}return I}();function q(I){I=I.toLowerCase();let D=w;for(let V=0;V<I.length;V++)D=D*_+N[I[V]];return D}function B(I){if((0,v.assertArgument)(typeof I=="string","invalid address","address",I),I.match(/^(0x)?[0-9a-fA-F]{40}$/)){I.startsWith("0x")||(I="0x"+I);const D=A(I);return(0,v.assertArgument)(!I.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||D===I,"bad address checksum","address",I),D}if(I.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){(0,v.assertArgument)(I.substring(2,4)===P(I),"bad icap checksum","address",I);let D=q(I.substring(4)).toString(16);for(;D.length<40;)D="0"+D;return A("0x"+D)}(0,v.assertArgument)(!1,"invalid address","address",I)}address$1.getAddress=B;function O(I){let D=BigInt(B(I)).toString(36).toUpperCase();for(;D.length<30;)D="0"+D;return"XE"+P("XE00"+D)+D}return address$1.getIcapAddress=O,address$1}var contractAddress={},hasRequiredContractAddress;function requireContractAddress(){if(hasRequiredContractAddress)return contractAddress;hasRequiredContractAddress=1,Object.defineProperty(contractAddress,"__esModule",{value:!0}),contractAddress.getCreate2Address=contractAddress.getCreateAddress=void 0;const b=requireCrypto(),v=requireUtils$3(),w=requireAddress$3();function _(E){const k=(0,w.getAddress)(E.from);let N=(0,v.getBigInt)(E.nonce,"tx.nonce").toString(16);return N==="0"?N="0x":N.length%2?N="0x0"+N:N="0x"+N,(0,w.getAddress)((0,v.dataSlice)((0,b.keccak256)((0,v.encodeRlp)([k,N])),12))}contractAddress.getCreateAddress=_;function A(E,k,P){const N=(0,w.getAddress)(E),q=(0,v.getBytes)(k,"salt"),B=(0,v.getBytes)(P,"initCodeHash");return(0,v.assertArgument)(q.length===32,"salt must be 32 bytes","salt",k),(0,v.assertArgument)(B.length===32,"initCodeHash must be 32 bytes","initCodeHash",P),(0,w.getAddress)((0,v.dataSlice)((0,b.keccak256)((0,v.concat)(["0xff",N,q,B])),12))}return contractAddress.getCreate2Address=A,contractAddress}var checks$1={},hasRequiredChecks;function requireChecks(){if(hasRequiredChecks)return checks$1;hasRequiredChecks=1,Object.defineProperty(checks$1,"__esModule",{value:!0}),checks$1.resolveAddress=checks$1.isAddress=checks$1.isAddressable=void 0;const b=requireUtils$3(),v=requireAddress$3();function w(k){return k&&typeof k.getAddress=="function"}checks$1.isAddressable=w;function _(k){try{return(0,v.getAddress)(k),!0}catch{}return!1}checks$1.isAddress=_;async function A(k,P){const N=await P;return(N==null||N==="0x0000000000000000000000000000000000000000")&&((0,b.assert)(typeof k!="string","unconfigured name","UNCONFIGURED_NAME",{value:k}),(0,b.assertArgument)(!1,"invalid AddressLike value; did not resolve to a value address","target",k)),(0,v.getAddress)(N)}function E(k,P){if(typeof k=="string")return k.match(/^0x[0-9a-f]{40}$/i)?(0,v.getAddress)(k):((0,b.assert)(P!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),A(k,P.resolveName(k)));if(w(k))return A(k,k.getAddress());if(k&&typeof k.then=="function")return A(k,k);(0,b.assertArgument)(!1,"unsupported addressable value","target",k)}return checks$1.resolveAddress=E,checks$1}var hasRequiredAddress$2;function requireAddress$2(){return hasRequiredAddress$2||(hasRequiredAddress$2=1,function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.resolveAddress=b.isAddress=b.isAddressable=b.getCreate2Address=b.getCreateAddress=b.getIcapAddress=b.getAddress=void 0;var v=requireAddress$3();Object.defineProperty(b,"getAddress",{enumerable:!0,get:function(){return v.getAddress}}),Object.defineProperty(b,"getIcapAddress",{enumerable:!0,get:function(){return v.getIcapAddress}});var w=requireContractAddress();Object.defineProperty(b,"getCreateAddress",{enumerable:!0,get:function(){return w.getCreateAddress}}),Object.defineProperty(b,"getCreate2Address",{enumerable:!0,get:function(){return w.getCreate2Address}});var _=requireChecks();Object.defineProperty(b,"isAddressable",{enumerable:!0,get:function(){return _.isAddressable}}),Object.defineProperty(b,"isAddress",{enumerable:!0,get:function(){return _.isAddress}}),Object.defineProperty(b,"resolveAddress",{enumerable:!0,get:function(){return _.resolveAddress}})}(address$2)),address$2}var typed={},hasRequiredTyped;function requireTyped(){if(hasRequiredTyped)return typed;hasRequiredTyped=1,Object.defineProperty(typed,"__esModule",{value:!0}),typed.Typed=void 0;const b=requireUtils$3(),v={};function w(k,P){let N=!1;return P<0&&(N=!0,P*=-1),new E(v,`${N?"":"u"}int${P}`,k,{signed:N,width:P})}function _(k,P){return new E(v,`bytes${P||""}`,k,{size:P})}const A=Symbol.for("_ethers_typed");class E{type;value;#e;_typedSymbol;constructor(P,N,q,B){B==null&&(B=null),(0,b.assertPrivate)(v,P,"Typed"),(0,b.defineProperties)(this,{_typedSymbol:A,type:N,value:q}),this.#e=B,this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${this.value.map(P=>P.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return this.#e}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return this.#e===!0?-1:this.#e===!1?this.value.length:null}static from(P,N){return new E(v,P,N)}static uint8(P){return w(P,8)}static uint16(P){return w(P,16)}static uint24(P){return w(P,24)}static uint32(P){return w(P,32)}static uint40(P){return w(P,40)}static uint48(P){return w(P,48)}static uint56(P){return w(P,56)}static uint64(P){return w(P,64)}static uint72(P){return w(P,72)}static uint80(P){return w(P,80)}static uint88(P){return w(P,88)}static uint96(P){return w(P,96)}static uint104(P){return w(P,104)}static uint112(P){return w(P,112)}static uint120(P){return w(P,120)}static uint128(P){return w(P,128)}static uint136(P){return w(P,136)}static uint144(P){return w(P,144)}static uint152(P){return w(P,152)}static uint160(P){return w(P,160)}static uint168(P){return w(P,168)}static uint176(P){return w(P,176)}static uint184(P){return w(P,184)}static uint192(P){return w(P,192)}static uint200(P){return w(P,200)}static uint208(P){return w(P,208)}static uint216(P){return w(P,216)}static uint224(P){return w(P,224)}static uint232(P){return w(P,232)}static uint240(P){return w(P,240)}static uint248(P){return w(P,248)}static uint256(P){return w(P,256)}static uint(P){return w(P,256)}static int8(P){return w(P,-8)}static int16(P){return w(P,-16)}static int24(P){return w(P,-24)}static int32(P){return w(P,-32)}static int40(P){return w(P,-40)}static int48(P){return w(P,-48)}static int56(P){return w(P,-56)}static int64(P){return w(P,-64)}static int72(P){return w(P,-72)}static int80(P){return w(P,-80)}static int88(P){return w(P,-88)}static int96(P){return w(P,-96)}static int104(P){return w(P,-104)}static int112(P){return w(P,-112)}static int120(P){return w(P,-120)}static int128(P){return w(P,-128)}static int136(P){return w(P,-136)}static int144(P){return w(P,-144)}static int152(P){return w(P,-152)}static int160(P){return w(P,-160)}static int168(P){return w(P,-168)}static int176(P){return w(P,-176)}static int184(P){return w(P,-184)}static int192(P){return w(P,-192)}static int200(P){return w(P,-200)}static int208(P){return w(P,-208)}static int216(P){return w(P,-216)}static int224(P){return w(P,-224)}static int232(P){return w(P,-232)}static int240(P){return w(P,-240)}static int248(P){return w(P,-248)}static int256(P){return w(P,-256)}static int(P){return w(P,-256)}static bytes1(P){return _(P,1)}static bytes2(P){return _(P,2)}static bytes3(P){return _(P,3)}static bytes4(P){return _(P,4)}static bytes5(P){return _(P,5)}static bytes6(P){return _(P,6)}static bytes7(P){return _(P,7)}static bytes8(P){return _(P,8)}static bytes9(P){return _(P,9)}static bytes10(P){return _(P,10)}static bytes11(P){return _(P,11)}static bytes12(P){return _(P,12)}static bytes13(P){return _(P,13)}static bytes14(P){return _(P,14)}static bytes15(P){return _(P,15)}static bytes16(P){return _(P,16)}static bytes17(P){return _(P,17)}static bytes18(P){return _(P,18)}static bytes19(P){return _(P,19)}static bytes20(P){return _(P,20)}static bytes21(P){return _(P,21)}static bytes22(P){return _(P,22)}static bytes23(P){return _(P,23)}static bytes24(P){return _(P,24)}static bytes25(P){return _(P,25)}static bytes26(P){return _(P,26)}static bytes27(P){return _(P,27)}static bytes28(P){return _(P,28)}static bytes29(P){return _(P,29)}static bytes30(P){return _(P,30)}static bytes31(P){return _(P,31)}static bytes32(P){return _(P,32)}static address(P){return new E(v,"address",P)}static bool(P){return new E(v,"bool",!!P)}static bytes(P){return new E(v,"bytes",P)}static string(P){return new E(v,"string",P)}static array(P,N){throw new Error("not implemented yet")}static tuple(P,N){throw new Error("not implemented yet")}static overrides(P){return new E(v,"overrides",Object.assign({},P))}static isTyped(P){return P&&typeof P=="object"&&"_typedSymbol"in P&&P._typedSymbol===A}static dereference(P,N){if(E.isTyped(P)){if(P.type!==N)throw new Error(`invalid type: expecetd ${N}, got ${P.type}`);return P.value}return P}}return typed.Typed=E,typed}var hasRequiredAddress$1;function requireAddress$1(){if(hasRequiredAddress$1)return address$3;hasRequiredAddress$1=1,Object.defineProperty(address$3,"__esModule",{value:!0}),address$3.AddressCoder=void 0;const b=requireAddress$2(),v=requireMaths(),w=requireTyped(),_=requireAbstractCoder();class A extends _.Coder{constructor(k){super("address","address",k,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(k,P){let N=w.Typed.dereference(P,"string");try{N=(0,b.getAddress)(N)}catch(q){return this._throwError(q.message,P)}return k.writeValue(N)}decode(k){return(0,b.getAddress)((0,v.toBeHex)(k.readValue(),20))}}return address$3.AddressCoder=A,address$3}var array={},anonymous={},hasRequiredAnonymous;function requireAnonymous(){if(hasRequiredAnonymous)return anonymous;hasRequiredAnonymous=1,Object.defineProperty(anonymous,"__esModule",{value:!0}),anonymous.AnonymousCoder=void 0;const b=requireAbstractCoder();class v extends b.Coder{coder;constructor(_){super(_.name,_.type,"_",_.dynamic),this.coder=_}defaultValue(){return this.coder.defaultValue()}encode(_,A){return this.coder.encode(_,A)}decode(_){return this.coder.decode(_)}}return anonymous.AnonymousCoder=v,anonymous}var hasRequiredArray;function requireArray(){if(hasRequiredArray)return array;hasRequiredArray=1,Object.defineProperty(array,"__esModule",{value:!0}),array.ArrayCoder=array.unpack=array.pack=void 0;const b=requireUtils$3(),v=requireTyped(),w=requireAbstractCoder(),_=requireAnonymous();function A(P,N,q){let B=[];if(Array.isArray(q))B=q;else if(q&&typeof q=="object"){let ee={};B=N.map(J=>{const te=J.localName;return(0,b.assert)(te,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:J},value:q}),(0,b.assert)(!ee[te],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:J},value:q}),ee[te]=!0,q[te]})}else(0,b.assertArgument)(!1,"invalid tuple value","tuple",q);(0,b.assertArgument)(N.length===B.length,"types/value length mismatch","tuple",q);let O=new w.Writer,I=new w.Writer,D=[];N.forEach((ee,J)=>{let te=B[J];if(ee.dynamic){let se=I.length;ee.encode(I,te);let ce=O.writeUpdatableValue();D.push(ae=>{ce(ae+se)})}else ee.encode(O,te)}),D.forEach(ee=>{ee(O.length)});let V=P.appendWriter(O);return V+=P.appendWriter(I),V}array.pack=A;function E(P,N){let q=[],B=[],O=P.subReader(0);return N.forEach(I=>{let D=null;if(I.dynamic){let V=P.readIndex(),ee=O.subReader(V);try{D=I.decode(ee)}catch(J){if((0,b.isError)(J,"BUFFER_OVERRUN"))throw J;D=J,D.baseType=I.name,D.name=I.localName,D.type=I.type}}else try{D=I.decode(P)}catch(V){if((0,b.isError)(V,"BUFFER_OVERRUN"))throw V;D=V,D.baseType=I.name,D.name=I.localName,D.type=I.type}if(D==null)throw new Error("investigate");q.push(D),B.push(I.localName||null)}),w.Result.fromItems(q,B)}array.unpack=E;class k extends w.Coder{coder;length;constructor(N,q,B){const O=N.type+"["+(q>=0?q:"")+"]",I=q===-1||N.dynamic;super("array",O,B,I),(0,b.defineProperties)(this,{coder:N,length:q})}defaultValue(){const N=this.coder.defaultValue(),q=[];for(let B=0;B<this.length;B++)q.push(N);return q}encode(N,q){const B=v.Typed.dereference(q,"array");Array.isArray(B)||this._throwError("expected array value",B);let O=this.length;O===-1&&(O=B.length,N.writeValue(B.length)),(0,b.assertArgumentCount)(B.length,O,"coder array"+(this.localName?" "+this.localName:""));let I=[];for(let D=0;D<B.length;D++)I.push(this.coder);return A(N,I,B)}decode(N){let q=this.length;q===-1&&(q=N.readIndex(),(0,b.assert)(q*w.WordSize<=N.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:N.bytes,offset:q*w.WordSize,length:N.dataLength}));let B=[];for(let O=0;O<q;O++)B.push(new _.AnonymousCoder(this.coder));return E(N,B)}}return array.ArrayCoder=k,array}var boolean={},hasRequiredBoolean;function requireBoolean(){if(hasRequiredBoolean)return boolean;hasRequiredBoolean=1,Object.defineProperty(boolean,"__esModule",{value:!0}),boolean.BooleanCoder=void 0;const b=requireTyped(),v=requireAbstractCoder();class w extends v.Coder{constructor(A){super("bool","bool",A,!1)}defaultValue(){return!1}encode(A,E){const k=b.Typed.dereference(E,"bool");return A.writeValue(k?1:0)}decode(A){return!!A.readValue()}}return boolean.BooleanCoder=w,boolean}var bytes={},hasRequiredBytes;function requireBytes(){if(hasRequiredBytes)return bytes;hasRequiredBytes=1,Object.defineProperty(bytes,"__esModule",{value:!0}),bytes.BytesCoder=bytes.DynamicBytesCoder=void 0;const b=requireUtils$3(),v=requireAbstractCoder();class w extends v.Coder{constructor(E,k){super(E,E,k,!0)}defaultValue(){return"0x"}encode(E,k){k=(0,b.getBytesCopy)(k);let P=E.writeValue(k.length);return P+=E.writeBytes(k),P}decode(E){return E.readBytes(E.readIndex(),!0)}}bytes.DynamicBytesCoder=w;class _ extends w{constructor(E){super("bytes",E)}decode(E){return(0,b.hexlify)(super.decode(E))}}return bytes.BytesCoder=_,bytes}var fixedBytes={},hasRequiredFixedBytes;function requireFixedBytes(){if(hasRequiredFixedBytes)return fixedBytes;hasRequiredFixedBytes=1,Object.defineProperty(fixedBytes,"__esModule",{value:!0}),fixedBytes.FixedBytesCoder=void 0;const b=requireUtils$3(),v=requireTyped(),w=requireAbstractCoder();class _ extends w.Coder{size;constructor(E,k){let P="bytes"+String(E);super(P,P,k,!1),(0,b.defineProperties)(this,{size:E},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(E,k){let P=(0,b.getBytesCopy)(v.Typed.dereference(k,this.type));return P.length!==this.size&&this._throwError("incorrect data length",k),E.writeBytes(P)}decode(E){return(0,b.hexlify)(E.readBytes(this.size))}}return fixedBytes.FixedBytesCoder=_,fixedBytes}var _null={},hasRequired_null;function require_null(){if(hasRequired_null)return _null;hasRequired_null=1,Object.defineProperty(_null,"__esModule",{value:!0}),_null.NullCoder=void 0;const b=requireAbstractCoder(),v=new Uint8Array([]);class w extends b.Coder{constructor(A){super("null","",A,!1)}defaultValue(){return null}encode(A,E){return E!=null&&this._throwError("not null",E),A.writeBytes(v)}decode(A){return A.readBytes(0),null}}return _null.NullCoder=w,_null}var number={},hasRequiredNumber;function requireNumber(){if(hasRequiredNumber)return number;hasRequiredNumber=1,Object.defineProperty(number,"__esModule",{value:!0}),number.NumberCoder=void 0;const b=requireUtils$3(),v=requireTyped(),w=requireAbstractCoder(),_=BigInt(0),A=BigInt(1),E=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class k extends w.Coder{size;signed;constructor(N,q,B){const O=(q?"int":"uint")+N*8;super(O,O,B,!1),(0,b.defineProperties)(this,{size:N,signed:q},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(N,q){let B=(0,b.getBigInt)(v.Typed.dereference(q,this.type)),O=(0,b.mask)(E,w.WordSize*8);if(this.signed){let I=(0,b.mask)(O,this.size*8-1);(B>I||B<-(I+A))&&this._throwError("value out-of-bounds",q),B=(0,b.toTwos)(B,8*w.WordSize)}else(B<_||B>(0,b.mask)(O,this.size*8))&&this._throwError("value out-of-bounds",q);return N.writeValue(B)}decode(N){let q=(0,b.mask)(N.readValue(),this.size*8);return this.signed&&(q=(0,b.fromTwos)(q,this.size*8)),q}}return number.NumberCoder=k,number}var string={},hasRequiredString;function requireString(){if(hasRequiredString)return string;hasRequiredString=1,Object.defineProperty(string,"__esModule",{value:!0}),string.StringCoder=void 0;const b=requireUtf8(),v=requireTyped(),w=requireBytes();class _ extends w.DynamicBytesCoder{constructor(E){super("string",E)}defaultValue(){return""}encode(E,k){return super.encode(E,(0,b.toUtf8Bytes)(v.Typed.dereference(k,"string")))}decode(E){return(0,b.toUtf8String)(super.decode(E))}}return string.StringCoder=_,string}var tuple={},hasRequiredTuple;function requireTuple(){if(hasRequiredTuple)return tuple;hasRequiredTuple=1,Object.defineProperty(tuple,"__esModule",{value:!0}),tuple.TupleCoder=void 0;const b=requireProperties(),v=requireTyped(),w=requireAbstractCoder(),_=requireArray();class A extends w.Coder{coders;constructor(k,P){let N=!1;const q=[];k.forEach(O=>{O.dynamic&&(N=!0),q.push(O.type)});const B="tuple("+q.join(",")+")";super("tuple",B,P,N),(0,b.defineProperties)(this,{coders:Object.freeze(k.slice())})}defaultValue(){const k=[];this.coders.forEach(N=>{k.push(N.defaultValue())});const P=this.coders.reduce((N,q)=>{const B=q.localName;return B&&(N[B]||(N[B]=0),N[B]++),N},{});return this.coders.forEach((N,q)=>{let B=N.localName;!B||P[B]!==1||(B==="length"&&(B="_length"),k[B]==null&&(k[B]=k[q]))}),Object.freeze(k)}encode(k,P){const N=v.Typed.dereference(P,"tuple");return(0,_.pack)(k,this.coders,N)}decode(k){return(0,_.unpack)(k,this.coders)}}return tuple.TupleCoder=A,tuple}var fragments={},hash$4={},id={},hasRequiredId;function requireId(){if(hasRequiredId)return id;hasRequiredId=1,Object.defineProperty(id,"__esModule",{value:!0}),id.id=void 0;const b=requireCrypto(),v=requireUtils$3();function w(_){return(0,b.keccak256)((0,v.toUtf8Bytes)(_))}return id.id=w,id}var namehash={},dist={},hasRequiredDist;function requireDist(){if(hasRequiredDist)return dist;hasRequiredDist=1;var b="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8rBKtTAltbAn0jsy8Bl6utPWMDTR8Ei2kRANkDBrNHNysDBzECQWUAcwFpJ3kAiyUhAJ0BUb8AL3EfAbfNAz81KUsFWwF3YQZtAm0A+VEfAzEJDQBRSQCzAQBlAHsAM70GD/v3IZWHBwARKQAxALsjTwHZAeMPEzmXgIHwABIAGQA8AEUAQDt3gdvIEGcQZAkGTRFMdEIVEwK0D64L7REdDNkq09PgADSxB/MDWwfzA1sDWwfzB/MDWwfzA1sDWwNbA1scEvAi28gQZw9QBHUFlgWTBN4IiyZREYkHMAjaVBV0JhxPA00BBCMtSSQ7mzMTJUpMFE0LCAQ2SmyvfUADTzGzVP2QqgPTMlc5dAkGHnkSqAAyD3skNb1OhnpPcagKU0+2tYdJak5vAsY6sEAACikJm2/Dd1YGRRAfJ6kQ+ww3AbkBPw3xS9wE9QY/BM0fgRkdD9GVoAipLeEM8SbnLqWAXiP5KocF8Uv4POELUVFsD10LaQnnOmeBUgMlAREijwrhDT0IcRD3Cs1vDekRSQc9A9lJngCpBwULFR05FbkmFGKwCw05ewb/GvoLkyazEy17AAXXGiUGUQEtGwMA0y7rhbRaNVwgT2MGBwspI8sUrFAkDSlAu3hMGh8HGSWtApVDdEqLUToelyH6PEENai4XUYAH+TwJGVMLhTyiRq9FEhHWPpE9TCJNTDAEOYMsMyePCdMPiQy9fHYBXQklCbUMdRM1ERs3yQg9Bx0xlygnGQglRplgngT7owP3E9UDDwVDCUUHFwO5HDETMhUtBRGBKNsC9zbZLrcCk1aEARsFzw8pH+MQVEfkDu0InwJpA4cl7wAxFSUAGyKfCEdnAGOP3FMJLs8Iy2pwI3gDaxTrZRF3B5UOWwerHDcVwxzlcMxeD4YMKKezCV8BeQmdAWME5wgNNV+MpCBFZ1eLXBifIGVBQ14AAjUMaRWjRMGHfAKPD28SHwE5AXcHPQ0FAnsR8RFvEJkI74YINbkz/DopBFMhhyAVCisDU2zSCysm/Qz8bQGnEmYDEDRBd/Jnr2C6KBgBBx0yyUFkIfULlk/RDKAaxRhGVDIZ6AfDA/ca9yfuQVsGAwOnBxc6UTPyBMELbQiPCUMATQ6nGwfbGG4KdYzUATWPAbudA1uVhwJzkwY7Bw8Aaw+LBX3pACECqwinAAkA0wNbAD0CsQehAB0AiUUBQQMrMwEl6QKTA5cINc8BmTMB9y0EH8cMGQD7O25OAsO1AoBuZqYF4VwCkgJNOQFRKQQJUktVA7N15QDfAE8GF+NLARmvTs8e50cB43MvAMsA/wAJOQcJRQHRAfdxALsBYws1Caa3uQFR7S0AhwAZbwHbAo0A4QA5AIP1AVcAUQVd/QXXAlNNARU1HC9bZQG/AyMBNwERAH0Gz5GpzQsjBHEH1wIQHxXlAu8yB7kFAyLjE9FCyQK94lkAMhoKPAqrCqpgX2Q3CjV2PVQAEh+sPss/UgVVO1c7XDtXO1w7VztcO1c7XDtXO1wDm8Pmw+YKcF9JYe8Mqg3YRMw6TRPfYFVgNhPMLbsUxRXSJVoZQRrAJwkl6FUNDwgt12Y0CDA0eRfAAEMpbINFY4oeNApPHOtTlVT8LR8AtUumM7MNsBsZREQFS3XxYi4WEgomAmSFAmJGX1GzAV83JAKh+wJonAJmDQKfiDgfDwJmPwJmKgRyBIMDfxcDfpY5Cjl7GzmGOicnAmwhAjI6OA4CbcsCbbLzjgM3a0kvAWsA4gDlAE4JB5wMkQECD8YAEbkCdzMCdqZDAnlPRwJ4viFg30WyRvcCfEMCeswCfQ0CfPRIBEiBZygALxlJXEpfGRtK0ALRBQLQ0EsrA4hTA4fqRMmRNgLypV0HAwOyS9JMMSkH001QTbMCi0MCitzFHwshR2sJuwKOOwKOYESbhQKO3QKOYHxRuFM5AQ5S2FSJApP/ApMQAO0AIFUiVbNV1AosHymZijLleGpFPz0Cl6MC77ZYJawAXSkClpMCloCgAK1ZsFoNhVEAPwKWuQKWUlxIXNUCmc8CmWhczl0LHQKcnznGOqECnBoCn58CnryOACETNS4TAp31Ap6WALlBYThh8wKe1wKgcgGtAp6jIwKeUqljzGQrKS8CJ7MCJoICoP8CoFDbAqYzAqXSAqgDAIECp/ZogGi1AAdNaiBq1QKs5wKssgKtawKtBgJXIQJV4AKx5dsDH1JsmwKywRECsuwbbORtZ21MYwMl0QK2YD9DbpQDKUkCuGICuUsZArkue3A6cOUCvR0DLbYDMhUCvoxyBgMzdQK+HnMmc1MCw88CwwhzhnRPOUl05AM8qwEDPJ4DPcMCxYACxksCxhSNAshtVQLISALJUwLJMgJkoQLd1nh9ZXiyeSlL1AMYp2cGAmH4GfeVKHsPXpZevxUCz28Cz3AzT1fW9xejAMqxAs93AS3uA04Wfk8JAtwrAtuOAtJTA1JgA1NjAQUDVZCAjUMEzxrxZEl5A4LSg5EC2ssC2eKEFIRNp0ADhqkAMwNkEoZ1Xf0AWQLfaQLevHd7AuIz7RgB8zQrAfSfAfLWiwLr9wLpdH0DAur9AuroAP1LAb0C7o0C66CWrpcHAu5DA4XkmH1w5HGlAvMHAG0DjhqZlwL3FwORcgOSiwL3nAL53QL4apogmq+/O5siA52HAv7+AR8APZ8gAZ+3AwWRA6ZuA6bdANXJAwZuoYyiCQ0DDE0BEwEjB3EGZb1rCQC/BG/DFY8etxEAG3k9ACcDNxJRA42DAWcrJQCM8wAlAOanC6OVCLsGI6fJBgCvBRnDBvElRUYFFoAFcD9GSDNCKUK8X3kZX8QAls0FOgCQVCGbwTsuYDoZutcONxjOGJHJ/gVfBWAFXwVgBWsFYAVfBWAFXwVgBV8FYAVfBWBOHQjfjW8KCgoKbF7xMwTRA7kGN8PDAMMEr8MA70gxFroFTj5xPnhCR0K+X30/X/AAWBkzswCNBsxzzASm70aCRS4rDDMeLz49fnXfcsH5GcoscQFz13Y4HwVnBXLJycnACNdRYwgICAqEXoWTxgA7P4kACxbZBu21Kw0AjMsTAwkVAOVtJUUsJ1JCuULESUArXy9gPi9AKwnJRQYKTD9LPoA+iT54PnkCkULEUUpDX9NWV3JVEjQAc1w3A3IBE3YnX+g7QiMJb6MKaiszRCUuQrNCxDPMCcwEX9EWJzYREBEEBwIHKn6l33JCNVIfybPJtAltydPUCmhBZw/tEKsZAJOVJU1CLRuxbUHOQAo7P0s+eEJHHA8SJVRPdGM0NVrpvBoKhfUlM0JHHGUQUhEWO1xLSj8MO0ucNAqJIzVCRxv9EFsqKyA4OQgNj2nwZgp5ZNFgE2A1K3YHS2AhQQojJmC7DgpzGG1WYFUZCQYHZO9gHWCdYIVgu2BTYJlwFh8GvRbcXbG8YgtDHrMBwzPVyQonHQgkCyYBgQJ0Ajc4nVqIAwGSCsBPIgDsK3SWEtIVBa5N8gGjAo+kVwVIZwD/AEUSCDweX4ITrRQsJ8K3TwBXFDwEAB0TvzVcAtoTS20RIwDgVgZ9BBImYgA5AL4Coi8LFnezOkCnIQFjAY4KBAPh9RcGsgZSBsEAJctdsWIRu2kTkQstRw7DAcMBKgpPBGIGMDAwKCYnKTQaLg4AKRSVAFwCdl+YUZ0JdicFD3lPAdt1F9ZZKCGxuE3yBxkFVGcA/wBFEgiCBwAOLHQSjxOtQDg1z7deFRMAZ8QTAGtKb1ApIiPHADkAvgKiLy1DFtYCmBiDAlDDWNB0eo7fpaMO/aEVRRv0ATEQZBIODyMEAc8JQhCbDRgzFD4TAEMAu9YBCgCsAOkAm5I3ABwAYxvONnR+MhXJAxgKQyxL2+kkJhMbhQKDBMkSsvF0AD9BNQ6uQC7WqSQHwxEAEEIu1hkhAH2z4iQPwyJPHNWpdyYBRSpnJALzoBAEVPPsH20MxA0CCEQKRgAFyAtFAlMNwwjEDUQJRArELtapMg7DDZgJIw+TGukEIwvDFkMAqAtDEMMMBhioe+QAO3MMRAACrgnEBSPY9Q0FDnbSBoMAB8MSYxkSxAEJAPIJAAB8FWMOFtMc/HcXwxhDAC7DAvOowwAewwJdKDKHAAHDAALrFUQVwwAbwyvzpWMWv8wA/ABpAy++bcYDUKPD0KhDCwKmJ1MAAmMA5+UZwxAagwipBRL/eADfw6fDGOMCGsOjk3l6BwOpo4sAEsMOGxMAA5sAbcMOAAvDp0MJGkMDwgipnNIPAwfIqUMGAOGDAAPzABXDAAcDAAnDAGmTABrDAA7DChjDjnEWAwABYwAOcwAuUyYABsMAF8MIKQANUgC6wy4AA8MADqMq8wCyYgAcIwAB8wqpAAXOCx0V4wAHowBCwwEKAGnDAAuDAB3DAAjDCakABdIAbqcZ3QCZCCkABdIAAAFDAAfjAB2jCCkABqIACYMAGzMAbSMA5sOIAAhjAAhDABTDBAkpAAbSAOOTAAlDC6kOzPtnAAdDAG6kQFAATwAKwwwAA0MACbUDPwAHIwAZgwACE6cDAAojAApDAAoDp/MGwwAJIwADEwAQQwgAFEMAEXMAD5MADfMADcMAGRMOFiMAFUMAbqMWuwHDAMIAE0MLAGkzEgDhUwACQwAEWgAXgwUjAAbYABjDBSYBgzBaAEFNALcQBxUMegAwMngBrA0IZgJ0KxQHBREPd1N0ZzKRJwaIHAZqNT4DqQq8BwngAB4DAwt2AX56T1ocKQNXAh1GATQGC3tOxYNagkgAMQA5CQADAQEAWxLjAIOYNAEzAH7tFRk6TglSAF8NAAlYAQ+S1ACAQwQorQBiAN4dAJ1wPyeTANVzuQDX3AIeEMp9eyMgXiUAEdkBkJizKltbVVAaRMqRAAEAhyQ/SDEz6BmfVwB6ATEsOClKIRcDOF0E/832AFNt5AByAnkCRxGCOs94NjXdAwINGBonDBwPALW2AwICAgAAAAAAAAYDBQMDARrUAwAtAAAAAgEGBgYGBgYFBQUFBQUEBQYHCAkEBQUFBQQAAAICAAAAIgCNAJAAlT0A6gC7ANwApEQAwgCyAK0AqADuAKYA2gCjAOcBCAEDAMcAgQBiANIA1AEDAN4A8gCQAKkBMQDqAN8A3AsBCQ8yO9ra2tq8xuLT1tRJOB0BUgFcNU0BWgFpAWgBWwFMUUlLbhMBUxsNEAs6PhMOACcUKy0vMj5AQENDQ0RFFEYGJFdXV1dZWVhZL1pbXVxcI2NnZ2ZoZypsbnZ1eHh4eHh4enp6enp6enp6enp8fH18e2IARPIASQCaAHgAMgBm+ACOAFcAVwA3AnbvAIsABfj4AGQAk/IAnwBPAGIAZP//sACFAIUAaQBWALEAJAC2AIMCQAJDAPwA5wD+AP4A6AD/AOkA6QDoAOYALwJ7AVEBQAE+AVQBPgE+AT4BOQE4ATgBOAEcAVgXADEQCAEAUx8SHgsdHhYAjgCWAKYAUQBqIAIxAHYAbwCXAxUDJzIDIUlGTzEAkQJPAMcCVwKkAMAClgKWApYClgKWApYCiwKWApYClgKWApYClgKVApUCmAKgApcClgKWApQClAKUApQCkgKVAnUB1AKXAp8ClgKWApUeAIETBQD+DQOfAmECOh8BVBg9AuIZEjMbAU4/G1WZAXusRAFpYQEFA0FPAQYAmTEeIJdyADFoAHEANgCRA5zMk/C2jGINwjMWygIZCaXdfDILBCs5dAE7YnQBugDlhoiHhoiGiYqKhouOjIaNkI6Ij4qQipGGkoaThpSSlYaWhpeKmIaZhpqGm4aci52QnoqfhuIC4XTpAt90AIp0LHSoAIsAdHQEQwRABEIERQRDBEkERgRBBEcESQRIBEQERgRJAJ5udACrA490ALxuAQ10ANFZdHQA13QCFHQA/mJ0AP4BIQD+APwA/AD9APwDhGZ03ASMK23HAP4A/AD8AP0A/CR0dACRYnQA/gCRASEA/gCRAvQA/gCRA4RmdNwEjCttxyR0AP9idAEhAP4A/gD8APwA/QD8AP8A/AD8AP0A/AOEZnTcBIwrbcckdHQAkWJ0ASEA/gCRAP4AkQL0AP4AkQOEZnTcBIwrbcckdAJLAT50AlIBQXQCU8l0dAJfdHQDpgL0A6YDpgOnA6cDpwOnA4RmdNwEjCttxyR0dACRYnQBIQOmAJEDpgCRAvQDpgCRA4RmdNwEjCttxyR0BDh0AJEEOQCRDpU5dSgCADR03gV2CwArdAEFAM5iCnR0AF1iAAYcOgp0dACRCnQAXAEIwWZ0CnRmdHQAkWZ0CnRmdEXgAFF03gp0dEY0tlT2u3SOAQTwscwhjZZKrhYcBSfFp9XNbKiVDOD2b+cpe4/Z17mQnbtzzhaeQtE2GGj0IDNTjRUSyTxxw/RPHW/+vS7d1NfRt9z9QPZg4X7QFfhCnkvgNPIItOsC2eV6hPannZNHlZ9xrwZXIMOlu3jSoQSq78WEjwLjw1ELSlF1aBvfzwk5ZX7AUvQzjPQKbDuQ+sm4wNOp4A6AdVuRS0t1y/DZpg4R6m7FNjM9HgvW7Bi88zaMjOo6lM8wtBBdj8LP4ylv3zCXPhebMKJc066o9sF71oFW/8JXu86HJbwDID5lzw5GWLR/LhT0Qqnp2JQxNZNfcbLIzPy+YypqRm/lBmGmex+82+PisxUumSeJkALIT6rJezxMH+CTJmQtt5uwTVbL3ptmjDUQzlSIvWi8Tl7ng1NpuRn1Ng4n14Qc+3Iil7OwkvNWogLSPkn3pihIFytyIGmMhOe3n1tWsuMy9BdKyqF4Z3v2SgggTL9KVvMXPnCbRe+oOuFFP3HejBG/w9gvmfNYvg6JuWia2lcSSN1uIjBktzoIazOHPJZ7kKHPz8mRWVdW3lA8WGF9dQF6Bm673boov3BUWDU2JNcahR23GtfHKLOz/viZ+rYnZFaIznXO67CYEJ1fXuTRpZhYZkKe54xeoagkNGLs+NTZHE0rX45/XvQ2RGADX6vcAvdxIUBV27wxGm2zjZo4X3ILgAlrOFheuZ6wtsvaIj4yLY7qqawlliaIcrz2G+c3vscAnCkCuMzMmZvMfu9lLwTvfX+3cVSyPdN9ZwgDZhfjRgNJcLiJ67b9xx8JHswprbiE3v9UphotAPIgnXVIN5KmMc0piXhc6cChPnN+MRhG9adtdttQTTwSIpl8I4/j//d3sz1326qTBTpPRM/Hgh3kzqEXs8ZAk4ErQhNO8hzrQ0DLkWMA/N+91tn2MdOJnWC2FCZehkQrwzwbKOjhvZsbM95QoeL9skYyMf4srVPVJSgg7pOLUtr/n9eT99oe9nLtFRpjA9okV2Kj8h9k5HaC0oivRD8VyXkJ81tcd4fHNXPCfloIQasxsuO18/46dR2jgul/UIet2G0kRvnyONMKhHs6J26FEoqSqd+rfYjeEGwHWVDpX1fh1jBBcKGMqRepju9Y00mDVHC+Xdij/j44rKfvfjGinNs1jO/0F3jB83XCDINN/HB84axlP+3E/klktRo+vl3U/aiyMJbIodE1XSsDn6UAzIoMtUObY2+k/4gY/l+AkZJ5Sj2vQrkyLm3FoxjhDX+31UXBFf9XrAH31fFqoBmDEZvhvvpnZ87N+oZEu7U9O/nnk+QWj3x8uyoRbEnf+O5UMr9i0nHP38IF5AvzrBW8YWBUR0mIAzIvndQq9N3v/Jto3aPjPXUPl8ASdPPyAp7jENf8bk7VMM9ol9XGmlBmeDMuGqt+WzuL6CXAxXjIhCPM5vACchgMJ/8XBGLO/D1isVvGhwwHHr1DLaI5mn2Jr/b1pUD90uciDaS8cXNDzCWvNmT/PhQe5e8nTnnnkt8Ds/SIjibcum/fqDhKopxAY8AkSrPn+IGDEKOO+U3XOP6djFs2H5N9+orhOahiQk5KnEUWa+CzkVzhp8bMHRbg81qhjjXuIKbHjSLSIBKWqockGtKinY+z4/RdBUF6pcc3JmnlxVcNgrI4SEzKUZSwcD2QCyxzKve+gAmg6ZuSRkpPFa6mfThu7LJNu3H5K42uCpNvPAsoedolKV/LHe/eJ+BbaG5MG0NaSGVPRUmNFMFFSSpXEcXwbVh7UETOZZtoVNRGOIbbkig3McEtR68cG0RZAoJevWYo7Dg/lZ1CQzblWeUvVHmr8fY4Nqd9JJiH/zEX24mJviH60fAyFr0A3c4bC1j3yZU60VgJxXn8JgJXLUIsiBnmKmMYz+7yBQFBvqb2eYnuW59joZBf56/wXvWIR4R8wTmV80i1mZy+S4+BUES+hzjk0uXpC///z/IlqHZ1monzlXp8aCfhGKMti73FI1KbL1q6IKO4fuBuZ59gagjn5xU79muMpHXg6S+e+gDM/U9BKLHbl9l6o8czQKl4RUkJJiqftQG2i3BMg/TQlUYFkJDYBOOvAugYuzYSDnZbDDd/aSd9x0Oe6F+bJcHfl9+gp6L5/TgA+BdFFovbfCrQ40s5vMPw8866pNX8zyFGeFWdxIpPVp9Rg1UPOVFbFZrvaFq/YAzHQgqMWpahMYfqHpmwXfHL1/kpYmGuHFwT55mQu0dylfNuq2Oq0hTMCPwqfxnuBIPLXfci4Y1ANy+1CUipQxld/izVh16WyG2Q0CQQ9NqtAnx1HCHwDj7sYxOSB0wopZSnOzxQOcExmxrVTF2BkOthVpGfuhaGECfCJpJKpjnihY+xOT2QJxN61+9K6QSqtv2Shr82I3jgJrqBg0wELFZPjvHpvzTtaJnLK6Vb97Yn933koO/saN7fsjwNKzp4l2lJVx2orjCGzC/4ZL4zCver6aQYtC5sdoychuFE6ufOiog+VWi5UDkbmvmtah/3aArEBIi39s5ILUnlFLgilcGuz9CQshEY7fw2ouoILAYPVT/gyAIq3TFAIwVsl+ktkRz/qGfnCDGrm5gsl/l9QdvCWGsjPz3dU7XuqKfdUrr/6XIgjp4rey6AJBmCmUJMjITHVdFb5m1p+dLMCL8t55zD42cmftmLEJC0Da04YiRCVUBLLa8D071/N5UBNBXDh0LFsmhV/5B5ExOB4j3WVG/S3lfK5o+V6ELHvy6RR9n4ac+VsK4VE4yphPvV+kG9FegTBH4ZRXL2HytUHCduJazB/KykjfetYxOXTLws267aGOd+I+JhKP//+VnXmS90OD/jvLcVu0asyqcuYN1mSb6XTlCkqv1vigZPIYwNF/zpWcT1GR/6aEIRjkh0yhg4LXJfaGobYJTY4JI58KiAKgmmgAKWdl5nYCeLqavRJGQNuYuZtZFGx+IkI4w4NS2xwbetNMunOjBu/hmKCI/w7tfiiyUd//4rbTeWt4izBY8YvGIN6vyKYmP/8X8wHKCeN+WRcKM70+tXKNGyevU9H2Dg5BsljnTf8YbsJ1TmMs74Ce2XlHisleguhyeg44rQOHZuw/6HTkhnnurK2d62q6yS7210SsAIaR+jXMQA+svkrLpsUY+F30Uw89uOdGAR6vo4FIME0EfVVeHTu6eKicfhSqOeXJhbftcd08sWEnNUL1C9fnprTgd83IMut8onVUF0hvqzZfHduPjbjwEXIcoYmy+P6tcJZHmeOv6VrvEdkHDJecjHuHeWANe79VG662qTjA/HCvumVv3qL+LrOcpqGps2ZGwQdFJ7PU4iuyRlBrwfO+xnPyr47s2cXVbWzAyznDiBGjCM3ksxjjqM62GE9C8f5U38kB3VjtabKp/nRdvMESPGDG90bWRLAt1Qk5DyLuazRR1YzdC1c+hZXvAWV8xA72S4A8B67vjVhbba3MMop293FeEXpe7zItMWrJG/LOH9ByOXmYnNJfjmfuX9KbrpgLOba4nZ+fl8Gbdv/ihv+6wFGKHCYrVwmhFC0J3V2bn2tIB1wCc1CST3d3X2OyxhguXcs4sm679UngzofuSeBewMFJboIQHbUh/m2JhW2hG9DIvG2t7yZIzKBTz9wBtnNC+2pCRYhSIuQ1j8xsz5VvqnyUIthvuoyyu7fNIrg/KQUVmGQaqkqZk/Vx5b33/gsEs8yX7SC1J+NV4icz6bvIE7C5G6McBaI8rVg56q5QBJWxn/87Q1sPK4+sQa8fLU5gXo4paaq4cOcQ4wR0VBHPGjKh+UlPCbA1nLXyEUX45qZ8J7/Ln4FPJE2TdzD0Z8MLSNQiykMMmSyOCiFfy84Rq60emYB2vD09KjYwsoIpeDcBDTElBbXxND72yhd9pC/1CMid/5HUMvAL27OtcIJDzNKpRPNqPOpyt2aPGz9QWIs9hQ9LiX5s8m9hjTUu/f7MyIatjjd+tSfQ3ufZxPpmJhTaBtZtKLUcfOCUqADuO+QoH8B9v6U+P0HV1GLQmtoNFTb3s74ivZgjES0qfK+8RdGgBbcCMSy8eBvh98+et1KIFqSe1KQPyXULBMTsIYnysIwiZBJYdI20vseV+wuJkcqGemehKjaAb9L57xZm3g2zX0bZ2xk/fU+bCo7TlnbW7JuF1YdURo/2Gw7VclDG1W7LOtas2LX4upifZ/23rzpsnY/ALfRgrcWP5hYmV9VxVOQA1fZvp9F2UNU+7d7xRyVm5wiLp3/0dlV7vdw1PMiZrbDAYzIVqEjRY2YU03sJhPnlwIPcZUG5ltL6S8XCxU1eYS5cjr34veBmXAvy7yN4ZjArIG0dfD/5UpBNlX1ZPoxJOwyqRi3wQWtOzd4oNKh0LkoTm8cwqgIfKhqqGOhwo71I+zXnMemTv2B2AUzABWyFztGgGULjDDzWYwJUVBTjKCn5K2QGMK1CQT7SzziOjo+BhAmqBjzuc3xYym2eedGeOIRJVyTwDw37iCMe4g5Vbnsb5ZBdxOAnMT7HU4DHpxWGuQ7GeiY30Cpbvzss55+5Km1YsbD5ea3NI9QNYIXol5apgSu9dZ8f8xS5dtHpido5BclDuLWY4lhik0tbJa07yJhH0BOyEut/GRbYTS6RfiTYWGMCkNpfSHi7HvdiTglEVHKZXaVhezH4kkXiIvKopYAlPusftpE4a5IZwvw1x/eLvoDIh/zpo9FiQInsTb2SAkKHV42XYBjpJDg4374XiVb3ws4qM0s9eSQ5HzsMU4OZJKuopFjBM+dAZEl8RUMx5uU2N486Kr141tVsGQfGjORYMCJAMsxELeNT4RmWjRcpdTGBwcx6XN9drWqPmJzcrGrH4+DRc7+n1w3kPZwu0BkNr6hQrqgo7JTB9A5kdJ/H7P4cWBMwsmuixAzJB3yrQpnGIq90lxAXLzDCdn1LPibsRt7rHNjgQBklRgPZ8vTbjXdgXrTWQsK5MdrXXQVPp0Rinq3frzZKJ0qD6Qhc40VzAraUXlob1gvkhK3vpmHgI6FRlQZNx6eRqkp0zy4AQlX813fAPtL3jMRaitGFFjo0zmErloC+h+YYdVQ6k4F/epxAoF0BmqEoKNTt6j4vQZNQ2BoqF9Vj53TOIoNmDiu9Xp15RkIgQIGcoLpfoIbenzpGUAtqFJp5W+LLnx38jHeECTJ/navKY1NWfN0sY1T8/pB8kIH3DU3DX+u6W3YwpypBMYOhbSxGjq84RZ84fWJow8pyHqn4S/9J15EcCMsXqrfwyd9mhiu3+rEo9pPpoJkdZqHjra4NvzFwuThNKy6hao/SlLw3ZADUcUp3w3SRVfW2rhl80zOgTYnKE0Hs2qp1J6H3xqPqIkvUDRMFDYyRbsFI3M9MEyovPk8rlw7/0a81cDVLmBsR2ze2pBuKb23fbeZC0uXoIvDppfTwIDxk1Oq2dGesGc+oJXWJLGkOha3CX+DUnzgAp9HGH9RsPZN63Hn4RMA5eSVhPHO+9RcRb/IOgtW31V1Q5IPGtoxPjC+MEJbVlIMYADd9aHYWUIQKopuPOHmoqSkubnAKnzgKHqgIOfW5RdAgotN6BN+O2ZYHkuemLnvQ8U9THVrS1RtLmKbcC7PeeDsYznvqzeg6VCNwmr0Yyx1wnLjyT84BZz3EJyCptD3yeueAyDWIs0L2qs/VQ3HUyqfrja0V1LdDzqAikeWuV4sc7RLIB69jEIBjCkyZedoUHqCrOvShVzyd73OdrJW0hPOuQv2qOoHDc9xVb6Yu6uq3Xqp2ZaH46A7lzevbxQEmfrzvAYSJuZ4WDk1Hz3QX1LVdiUK0EvlAGAYlG3Md30r7dcPN63yqBCIj25prpvZP0nI4+EgWoFG95V596CurXpKRBGRjQlHCvy5Ib/iW8nZJWwrET3mgd6mEhfP4KCuaLjopWs7h+MdXFdIv8dHQJgg1xi1eYqB0uDYjxwVmri0Sv5XKut/onqapC+FQiC2C1lvYJ9MVco6yDYsS3AANUfMtvtbYI2hfwZatiSsnoUeMZd34GVjkMMKA+XnjJpXgRW2SHTZplVowPmJsvXy6w3cfO1AK2dvtZEKTkC/TY9LFiKHCG0DnrMQdGm2lzlBHM9iEYynH2UcVMhUEjsc0oDBTgo2ZSQ1gzkAHeWeBXYFjYLuuf8yzTCy7/RFR81WDjXMbq2BOH5dURnxo6oivmxL3cKzKInlZkD31nvpHB9Kk7GfcfE1t+1V64b9LtgeJGlpRFxQCAqWJ5DoY77ski8gsOEOr2uywZaoO/NGa0X0y1pNQHBi3b2SUGNpcZxDT7rLbBf1FSnQ8guxGW3W+36BW0gBje4DOz6Ba6SVk0xiKgt+q2JOFyr4SYfnu+Ic1QZYIuwHBrgzr6UvOcSCzPTOo7D6IC4ISeS7zkl4h+2VoeHpnG/uWR3+ysNgPcOIXQbv0n4mr3BwQcdKJxgPSeyuP/z1Jjg4e9nUvoXegqQVIE30EHx5GHv+FAVUNTowYDJgyFhf5IvlYmEqRif6+WN1MkEJmDcQITx9FX23a4mxy1AQRsOHO/+eImX9l8EMJI3oPWzVXxSOeHU1dUWYr2uAA7AMb+vAEZSbU3qob9ibCyXeypEMpZ6863o6QPqlqGHZkuWABSTVNd4cOh9hv3qEpSx2Zy/DJMP6cItEmiBJ5PFqQnDEIt3NrA3COlOSgz43D7gpNFNJ5MBh4oFzhDPiglC2ypsNU4ISywY2erkyb1NC3Qh/IfWj0eDgZI4/ln8WPfBsT3meTjq1Uqt1E7Zl/qftqkx6aM9KueMCekSnMrcHj1CqTWWzEzPsZGcDe3Ue4Ws+XFYVxNbOFF8ezkvQGR6ZOtOLU2lQEnMBStx47vE6Pb7AYMBRj2OOfZXfisjJnpTfSNjo6sZ6qSvNxZNmDeS7Gk3yYyCk1HtKN2UnhMIjOXUzAqDv90lx9O/q/AT1ZMnit5XQe9wmQxnE/WSH0CqZ9/2Hy+Sfmpeg8RwsHI5Z8kC8H293m/LHVVM/BA7HaTJYg5Enk7M/xWpq0192ACfBai2LA/qrCjCr6Dh1BIMzMXINBmX96MJ5Hn2nxln/RXPFhwHxUmSV0EV2V0jm86/dxxuYSU1W7sVkEbN9EzkG0QFwPhyHKyb3t+Fj5WoUUTErcazE/N6EW6Lvp0d//SDPj7EV9UdJN+Amnf3Wwk3A0SlJ9Z00yvXZ7n3z70G47Hfsow8Wq1JXcfwnA+Yxa5mFsgV464KKP4T31wqIgzFPd3eCe3j5ory5fBF2hgCFyVFrLzI9eetNXvM7oQqyFgDo4CTp/hDV9NMX9JDHQ/nyHTLvZLNLF6ftn2OxjGm8+PqOwhxnPHWipkE/8wbtyri80Sr7pMNkQGMfo4ZYK9OcCC4ESVFFbLMIvlxSoRqWie0wxqnLfcLSXMSpMMQEJYDVObYsXIQNv4TGNwjq1kvT1UOkicTrG3IaBZ3XdScS3u8sgeZPVpOLkbiF940FjbCeNRINNvDbd01EPBrTCPpm12m43ze1bBB59Ia6Ovhnur/Nvx3IxwSWol+3H2qfCJR8df6aQf4v6WiONxkK+IqT4pKQrZK/LplgDI/PJZbOep8dtbV7oCr6CgfpWa8NczOkPx81iSHbsNhVSJBOtrLIMrL31LK9TqHqAbAHe0RLmmV806kRLDLNEhUEJfm9u0sxpkL93Zgd6rw+tqBfTMi59xqXHLXSHwSbSBl0EK0+loECOPtrl+/nsaFe197di4yUgoe4jKoAJDXc6DGDjrQOoFDWZJ9HXwt8xDrQP+7aRwWKWI1GF8s8O4KzxWBBcwnl3vnl1Oez3oh6Ea1vjR7/z7DDTrFtqU2W/KAEzAuXDNZ7MY73MF216dzdSbWmUp4lcm7keJfWaMHgut9x5C9mj66Z0lJ+yhsjVvyiWrfk1lzPOTdhG15Y7gQlXtacvI7qv/XNSscDwqkgwHT/gUsD5yB7LdRRvJxQGYINn9hTpodKFVSTPrtGvyQw+HlRFXIkodErAGu9Iy1YpfSPc3jkFh5CX3lPxv7aqjE/JAfTIpEjGb/H7MO0e2vsViSW1qa/Lmi4/n4DEI3g7lYrcanspDfEpKkdV1OjSLOy0BCUqVoECaB55vs06rXl4jqmLsPsFM/7vYJ0vrBhDCm/00A/H81l1uekJ/6Lml3Hb9+NKiLqATJmDpyzfYZFHumEjC662L0Bwkxi7E9U4cQA0XMVDuMYAIeLMPgQaMVOd8fmt5SflFIfuBoszeAw7ow5gXPE2Y/yBc/7jExARUf/BxIHQBF5Sn3i61w4z5xJdCyO1F1X3+3ax+JSvMeZ7S6QSKp1Fp/sjYz6Z+VgCZzibGeEoujryfMulH7Rai5kAft9ebcW50DyJr2uo2z97mTWIu45YsSnNSMrrNUuG1XsYBtD9TDYzQffKB87vWbkM4EbPAFgoBV4GQS+vtFDUqOFAoi1nTtmIOvg38N4hT2Sn8r8clmBCXspBlMBYTnrqFJGBT3wZOzAyJDre9dHH7+x7qaaKDOB4UQALD5ecS0DE4obubQEiuJZ0EpBVpLuYcce8Aa4PYd/V4DLDAJBYKQPCWTcrEaZ5HYbJi11Gd6hjGom1ii18VHYnG28NKpkz2UKVPxlhYSp8uZr367iOmoy7zsxehW9wzcy2zG0a80PBMCRQMb32hnaHeOR8fnNDzZhaNYhkOdDsBUZ3loDMa1YP0uS0cjUP3b/6DBlqmZOeNABDsLl5BI5QJups8uxAuWJdkUB/pO6Zax6tsg7fN5mjjDgMGngO+DPcKqiHIDbFIGudxtPTIyDi9SFMKBDcfdGQRv41q1AqmxgkVfJMnP8w/Bc7N9/TR6C7mGObFqFkIEom8sKi2xYqJLTCHK7cxzaZvqODo22c3wisBCP4HeAgcRbNPAsBkNRhSmD48dHupdBRw4mIvtS5oeF6zeT1KMCyhMnmhpkFAGWnGscoNkwvQ8ZM5lE/vgTHFYL99OuNxdFBxTEDd5v2qLR8y9WkXsWgG6kZNndFG+pO/UAkOCipqIhL3hq7cRSdrCq7YhUsTocEcnaFa6nVkhnSeRYUA1YO0z5itF9Sly3VlxYDw239TJJH6f3EUfYO5lb7bcFcz8Bp7Oo8QmnsUHOz/fagVUBtKEw1iT88j+aKkv8cscKNkMxjYr8344D1kFoZ7/td1W6LCNYN594301tUGRmFjAzeRg5vyoM1F6+bJZ/Q54jN/k8SFd3DxPTYaAUsivsBfgTn7Mx8H2SpPt4GOdYRnEJOH6jHM2p6SgB0gzIRq6fHxGMmSmqaPCmlfwxiuloaVIitLGN8wie2CDWhkzLoCJcODh7KIOAqbHEvXdUxaS4TTTs07Clzj/6GmVs9kiZDerMxEnhUB6QQPlcfqkG9882RqHoLiHGBoHfQuXIsAG8GTAtao2KVwRnvvam8jo1e312GQAKWEa4sUVEAMG4G6ckcONDwRcg1e2D3+ohXgY4UAWF8wHKQMrSnzCgfFpsxh+aHXMGtPQroQasRY4U6UdG0rz1Vjbka0MekOGRZQEvqQFlxseFor8zWFgHek3v29+WqN6gaK5gZOTOMZzpQIC1201LkMCXild3vWXSc5UX9xcFYfbRPzGFa1FDcPfPB/jUEq/FeGt419CI3YmBlVoHsa4KdcwQP5ZSwHHhFJ7/Ph/Rap/4vmG91eDwPP0lDfCDRCLszTqfzM71xpmiKi2HwS4WlqvGNwtvwF5Dqpn6KTq8ax00UMPkxDcZrEEEsIvHiUXXEphdb4GB4FymlPwBz4Gperqq5pW7TQ6/yNRhW8VT5NhuP0udlxo4gILq5ZxAZk8ZGh3g4CqxJlPKY7AQxupfUcVpWT5VItp1+30UqoyP4wWsRo3olRRgkWZZ2ZN6VC3OZFeXB8NbnUrSdikNptD1QiGuKkr8EmSR/AK9Rw+FF3s5uwuPbvHGiPeFOViltMK7AUaOsq9+x9cndk3iJEE5LKZRlWJbKOZweROzmPNVPkjE3K/TyA57Rs68TkZ3MR8akKpm7cFjnjPd/DdkWjgYoKHSr5Wu5ssoBYU4acRs5g2DHxUmdq8VXOXRbunD8QN0LhgkssgahcdoYsNvuXGUK/KXD/7oFb+VGdhqIn02veuM5bLudJOc2Ky0GMaG4W/xWBxIJcL7yliJOXOpx0AkBqUgzlDczmLT4iILXDxxtRR1oZa2JWFgiAb43obrJnG/TZC2KSK2wqOzRZTXavZZFMb1f3bXvVaNaK828w9TO610gk8JNf3gMfETzXXsbcvRGCG9JWQZ6+cDPqc4466Yo2RcKH+PILeKOqtnlbInR3MmBeGG3FH10yzkybuqEC2HSQwpA0An7d9+73BkDUTm30bZmoP/RGbgFN+GrCOfADgqr0WbI1a1okpFms8iHYw9hm0zUvlEMivBRxModrbJJ+9/p3jUdQQ9BCtQdxnOGrT5dzRUmw0593/mbRSdBg0nRvRZM5/E16m7ZHmDEtWhwvfdZCZ8J8M12W0yRMszXamWfQTwIZ4ayYktrnscQuWr8idp3PjT2eF/jmtdhIfcpMnb+IfZY2FebW6UY/AK3jP4u3Tu4zE4qlnQgLFbM19EBIsNf7KhjdbqQ/D6yiDb+NlEi2SKD+ivXVUK8ib0oBo366gXkR8ZxGjpJIDcEgZPa9TcYe0TIbiPl/rPUQDu3XBJ9X/GNq3FAUsKsll57DzaGMrjcT+gctp+9MLYXCq+sqP81eVQ0r9lt+gcQfZbACRbEjvlMskztZG8gbC8Qn9tt26Q7y7nDrbZq/LEz7kR6Jc6pg3N9rVX8Y5MJrGlML9p9lU4jbTkKqCveeZUJjHB03m2KRKR2TytoFkTXOLg7keU1s1lrPMQJpoOKLuAAC+y1HlJucU6ysB5hsXhvSPPLq5J7JtnqHKZ4vYjC4Vy8153QY+6780xDuGARsGbOs1WqzH0QS765rnSKEbbKlkO8oI/VDwUd0is13tKpqILu1mDJFNy/iJAWcvDgjxvusIT+PGz3ST/J9r9Mtfd0jpaGeiLYIqXc7DiHSS8TcjFVksi66PEkxW1z6ujbLLUGNNYnzOWpH8BZGK4bCK7iR+MbIv8ncDAz1u4StN3vTTzewr9IQjk9wxFxn+6N1ddKs0vffJiS08N3a4G1SVrlZ97Q/M+8G9fe5AP6d9/Qq4WRnORVhofPIKEdCr3llspUfE0oKIIYoByBRPh+bX1HLS3JWGJRhIvE1aW4NTd8ePi4Z+kXb+Z8snYfSNcqijhAgVsx4RCM54cXUiYkjeBmmC4ajOHrChoELscJJC7+9jjMjw5BagZKlgRMiSNYz7h7vvZIoQqbtQmspc0cUk1G/73iXtSpROl5wtLgQi0mW2Ex8i3WULhcggx6E1LMVHUsdc9GHI1PH3U2Ko0PyGdn9KdVOLm7FPBui0i9a0HpA60MsewVE4z8CAt5d401Gv6zXlIT5Ybit1VIA0FCs7wtvYreru1fUyW3oLAZ/+aTnZrOcYRNVA8spoRtlRoWflsRClFcgzkqiHOrf0/SVw+EpVaFlJ0g4Kxq1MMOmiQdpMNpte8lMMQqm6cIFXlnGbfJllysKDi+0JJMotkqgIxOSQgU9dn/lWkeVf8nUm3iwX2Nl3WDw9i6AUK3vBAbZZrcJpDQ/N64AVwjT07Jef30GSSmtNu2WlW7YoyW2FlWfZFQUwk867EdLYKk9VG6JgEnBiBxkY7LMo4YLQJJlAo9l/oTvJkSARDF/XtyAzM8O2t3eT/iXa6wDN3WewNmQHdPfsxChU/KtLG2Mn8i4ZqKdSlIaBZadxJmRzVS/o4yA65RTSViq60oa395Lqw0pzY4SipwE0SXXsKV+GZraGSkr/RW08wPRvqvSUkYBMA9lPx4m24az+IHmCbXA+0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";const v=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),w=4;function _(Ge){let ze=0;function Ve(){return Ge[ze++]<<8|Ge[ze++]}let Ze=Ve(),Je=1,Ye=[0,1];for(let zt=1;zt<Ze;zt++)Ye.push(Je+=Ve());let et=Ve(),nt=ze;ze+=et;let vt=0,kt=0;function bt(){return vt==0&&(kt=kt<<8|Ge[ze++],vt=8),kt>>--vt&1}const Bt=31,Pt=2**Bt,$t=Pt>>>1,Dt=$t>>1,Lt=Pt-1;let qt=0;for(let zt=0;zt<Bt;zt++)qt=qt<<1|bt();let Kt=[],Qt=0,Yt=Pt;for(;;){let zt=Math.floor(((qt-Qt+1)*Je-1)/Yt),Wt=0,Xt=Ze;for(;Xt-Wt>1;){let er=Wt+Xt>>>1;zt<Ye[er]?Xt=er:Wt=er}if(Wt==0)break;Kt.push(Wt);let Vt=Qt+Math.floor(Yt*Ye[Wt]/Je),Jt=Qt+Math.floor(Yt*Ye[Wt+1]/Je)-1;for(;!((Vt^Jt)&$t);)qt=qt<<1&Lt|bt(),Vt=Vt<<1&Lt,Jt=Jt<<1&Lt|1;for(;Vt&~Jt&Dt;)qt=qt&$t|qt<<1&Lt>>>1|bt(),Vt=Vt<<1^$t,Jt=(Jt^$t)<<1|$t|1;Qt=Vt,Yt=1+Jt-Vt}let Zt=Ze-4;return Kt.map(zt=>{switch(zt-Zt){case 3:return Zt+65792+(Ge[nt++]<<16|Ge[nt++]<<8|Ge[nt++]);case 2:return Zt+256+(Ge[nt++]<<8|Ge[nt++]);case 1:return Zt+Ge[nt++];default:return zt-1}})}function A(Ge){let ze=0;return()=>Ge[ze++]}function E(Ge){return A(_(k(Ge)))}function k(Ge){let ze=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((Je,Ye)=>ze[Je.charCodeAt(0)]=Ye);let Ve=Ge.length,Ze=new Uint8Array(6*Ve>>3);for(let Je=0,Ye=0,et=0,nt=0;Je<Ve;Je++)nt=nt<<6|ze[Ge.charCodeAt(Je)],et+=6,et>=8&&(Ze[Ye++]=nt>>(et-=8));return Ze}function P(Ge){return Ge&1?~Ge>>1:Ge>>1}function N(Ge,ze){let Ve=Array(Ge);for(let Ze=0,Je=0;Ze<Ge;Ze++)Ve[Ze]=Je+=P(ze());return Ve}function q(Ge,ze=0){let Ve=[];for(;;){let Ze=Ge(),Je=Ge();if(!Je)break;ze+=Ze;for(let Ye=0;Ye<Je;Ye++)Ve.push(ze+Ye);ze+=Je+1}return Ve}function B(Ge){return I(()=>{let ze=q(Ge);if(ze.length)return ze})}function O(Ge){let ze=[];for(;;){let Ve=Ge();if(Ve==0)break;ze.push(V(Ve,Ge))}for(;;){let Ve=Ge()-1;if(Ve<0)break;ze.push(ee(Ve,Ge))}return ze.flat()}function I(Ge){let ze=[];for(;;){let Ve=Ge(ze.length);if(!Ve)break;ze.push(Ve)}return ze}function D(Ge,ze,Ve){let Ze=Array(Ge).fill().map(()=>[]);for(let Je=0;Je<ze;Je++)N(Ge,Ve).forEach((Ye,et)=>Ze[et].push(Ye));return Ze}function V(Ge,ze){let Ve=1+ze(),Ze=ze(),Je=I(ze);return D(Je.length,1+Ge,ze).flatMap((et,nt)=>{let[vt,...kt]=et;return Array(Je[nt]).fill().map((bt,Bt)=>{let Pt=Bt*Ze;return[vt+Bt*Ve,kt.map($t=>$t+Pt)]})})}function ee(Ge,ze){let Ve=1+ze();return D(Ve,1+Ge,ze).map(Je=>[Je[0],Je.slice(1)])}function J(Ge){let ze=[],Ve=q(Ge);return Je(Ze([]),[]),ze;function Ze(Ye){let et=Ge(),nt=I(()=>{let vt=q(Ge).map(kt=>Ve[kt]);if(vt.length)return Ze(vt)});return{S:et,B:nt,Q:Ye}}function Je({S:Ye,B:et},nt,vt){if(!(Ye&4&&vt===nt[nt.length-1])){Ye&2&&(vt=nt[nt.length-1]),Ye&1&&ze.push(nt);for(let kt of et)for(let bt of kt.Q)Je(kt,[...nt,bt],vt)}}}function te(Ge){return Ge.toString(16).toUpperCase().padStart(2,"0")}function se(Ge){return`{${te(Ge)}}`}function ce(Ge){let ze=[];for(let Ve=0,Ze=Ge.length;Ve<Ze;){let Je=Ge.codePointAt(Ve);Ve+=Je<65536?1:2,ze.push(Je)}return ze}function ae(Ge){let Ve=Ge.length;if(Ve<4096)return String.fromCodePoint(...Ge);let Ze=[];for(let Je=0;Je<Ve;)Ze.push(String.fromCodePoint(...Ge.slice(Je,Je+=4096)));return Ze.join("")}function he(Ge,ze){let Ve=Ge.length,Ze=Ve-ze.length;for(let Je=0;Ze==0&&Je<Ve;Je++)Ze=Ge[Je]-ze[Je];return Ze}var oe="AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACgANAA0AAwAKAAkABAAdAAYAZwDSAdsDJgC0CkMB8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgsj26PTQyy8FfEQ8AY8IPAGcEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQUvBdALFAsVDPcNBw13DYcOMA4xDjMB4BllHI0B2grbAMDpHLkQ7QHVAPRNQQFnGRUEg0yEB2uaJF8AJpIBpob5AERSMAKNoAXqaQLUBMCzEiACnwRZEkkVsS7tANAsBG0RuAQLEPABv9HICTUBXigPZwRBApMDOwAamhtaABqEAY8KvKx3LQ4ArAB8UhwEBAVSagD8AEFZADkBIadVj2UMUgx5Il4ANQC9AxIB1BlbEPMAs30CGxlXAhwZKQIECBc6EbsCoxngzv7UzRQA8M0BawL6ZwkN7wABAD33OQRcsgLJCjMCjqUChtw/km+NAsXPAoP2BT84PwURAK0RAvptb6cApQS/OMMey5HJS84UdxpxTPkCogVFITaTOwERAK5pAvkNBOVyA7q3BKlOJSALAgUIBRcEdASpBXqzABXFSWZOawLCOqw//AolCZdvv3dSBkEQGyelEPcMMwG1ATsN7UvYBPEGOwTJH30ZGQ/NlZwIpS3dDO0m4y6hgFoj9SqDBe1L9DzdC01RaA9ZC2UJ4zpjgU4DIQENIosK3Q05CG0Q8wrJaw3lEUUHOQPVSZoApQcBCxEdNRW1JhBirAsJOXcG+xr2C48mrxMpevwF0xohBk0BKRr/AM8u54WwWjFcHE9fBgMLJSPHFKhQIA0lQLd4SBobBxUlqQKRQ3BKh1E2HpMh9jw9DWYuE1F8B/U8BRlPC4E8nkarRQ4R0j6NPUgiSUwsBDV/LC8niwnPD4UMuXxyAVkJIQmxDHETMREXN8UIOQcZLZckJxUIIUaVYJoE958D8xPRAwsFPwlBBxMDtRwtEy4VKQUNgSTXAvM21S6zAo9WgAEXBcsPJR/fEFBH4A7pCJsCZQODJesALRUhABcimwhDYwBfj9hTBS7LCMdqbCN0A2cU52ERcweRDlcHpxwzFb8c4XDIXguGCCijrwlbAXUJmQFfBOMICTVbjKAgQWdTi1gYmyBhQT9d/AIxDGUVn0S9h3gCiw9rEhsBNQFzBzkNAQJ3Ee0RaxCVCOuGBDW1M/g6JQRPIYMgEQonA09szgsnJvkM+GkBoxJiAww0PXfuZ6tgtiQX/QcZMsVBYCHxC5JPzQycGsEYQlQuGeQHvwPzGvMn6kFXBf8DowMTOk0z7gS9C2kIiwk/AEkOoxcH1xhqCnGM0AExiwG3mQNXkYMCb48GNwcLAGcLhwV55QAdAqcIowAFAM8DVwA5Aq0HnQAZAIVBAT0DJy8BIeUCjwOTCDHLAZUvAfMpBBvDDBUA9zduSgLDsQKAamaiBd1YAo4CSTUBTSUEBU5HUQOvceEA2wBLBhPfRwEVq0rLGuNDAd9vKwDHAPsABTUHBUEBzQHzbQC3AV8LMQmis7UBTekpAIMAFWsB1wKJAN0ANQB/8QFTAE0FWfkF0wJPSQERMRgrV2EBuwMfATMBDQB5BsuNpckHHwRtB9MCEBsV4QLvLge1AQMi3xPNQsUCvd5VoWACZIECYkJbTa9bNyACofcCaJgCZgkCn4Q4GwsCZjsCZiYEbgR/A38TA36SOQY5dxc5gjojIwJsHQIyNjgKAm3HAm2u74ozZ0UrAWcA3gDhAEoFB5gMjQD+C8IADbUCdy8CdqI/AnlLQwJ4uh1c20WuRtcCfD8CesgCfQkCfPAFWQUgSABIfWMkAoFtAoAAAoAFAn+uSVhKWxUXSswC0QEC0MxLJwOITwOH5kTFkTIC8qFdAwMDrkvOTC0lA89NTE2vAos/AorYwRsHHUNnBbcCjjcCjlxAl4ECjtkCjlx4UbRTNQpS1FSFApP7ApMMAOkAHFUeVa9V0AYsGymVhjLheGZFOzkCl58C77JYIagAWSUClo8ClnycAKlZrFoJgU0AOwKWtQKWTlxEXNECmcsCmWRcyl0HGQKcmznCOp0CnBYCn5sCnriKAB0PMSoPAp3xAp6SALU9YTRh7wKe0wKgbgGpAp6fHwKeTqVjyGQnJSsCJ68CJn4CoPsCoEwCot0CocQCpi8Cpc4Cp/8AfQKn8mh8aLEAA0lqHGrRAqzjAqyuAq1nAq0CAlcdAlXcArHh1wMfTmyXArK9DQKy6Bds4G1jbUhfAyXNArZcOz9ukAMpRQK4XgK5RxUCuSp3cDZw4QK9GQK72nCWAzIRAr6IcgIDM3ECvhpzInNPAsPLAsMEc4J0SzVFdOADPKcDPJoDPb8CxXwCxkcCxhCJAshpUQLIRALJTwLJLgJknQLd0nh5YXiueSVL0AMYo2cCAmH0GfOVJHsLXpJeuxECz2sCz2wvS1PS8xOfAMatAs9zASnqA04SfksFAtwnAtuKAtJPA1JcA1NfAQEDVYyAiT8AyxbtYEWCHILTgs6DjQLaxwLZ3oQQhEmnPAOGpQAvA2QOhnFZ+QBVAt9lAt64c3cC4i/tFAHzMCcB9JsB8tKHAuvzAulweQLq+QLq5AD5RwG5Au6JAuuclqqXAwLuPwOF4Jh5cOBxoQLzAwBpA44WmZMC9xMDkW4DkocC95gC+dkC+GaaHJqruzebHgOdgwL++gEbADmfHJ+zAwWNA6ZqA6bZANHFAwZqoYiiBQkDDEkCwAA/AwDhQRdTARHzA2sHl2cFAJMtK7evvdsBiZkUfxEEOQH7KQUhDp0JnwCS/SlXxQL3AZ0AtwW5AG8LbUEuFCaNLgFDAYD8AbUmAHUDDgRtACwCFgyhAAAKAj0CagPdA34EkQEgRQUhfAoABQBEABMANhICdwEABdUDa+8KxQIA9wqfJ7+xt+UBkSFBQgHpFH8RNMCJAAQAGwBaAkUChIsABjpTOpSNbQC4Oo860ACNOME63AClAOgAywE6gTo7Ofw5+Tt2iTpbO56JOm85GAFWATMBbAUvNV01njWtNWY1dTW2NcU1gjWRNdI14TWeNa017jX9NbI1wTYCNhE1xjXVNhY2JzXeNe02LjY9Ni41LSE2OjY9Njw2yTcIBJA8VzY4Nt03IDcPNsogN4k3MAoEsDxnNiQ3GTdsOo03IULUQwdC4EMLHA8PCZsobShRVQYA6X8A6bABFCnXAukBowC9BbcAbwNzBL8MDAMMAQgDAAkKCwsLCQoGBAVVBI/DvwDz9b29kaUCb0QtsRTNLt4eGBcSHAMZFhYZEhYEARAEBUEcQRxBHEEcQRxBHEEaQRxBHEFCSTxBPElISUhBNkM2QTYbNklISVmBVIgBFLWZAu0BhQCjBcEAbykBvwGJAaQcEZ0ePCklMAAhMvAIMAL54gC7Bm8EescjzQMpARQpKgDUABavAj626xQAJP0A3etzuf4NNRA7efy2Z9NQrCnC0OSyANz5BBIbJ5IFDR6miIavYS6tprjjmuKebxm5C74Q225X1pkaYYPb6f1DK4k3xMEBb9S2WMjEibTNWhsRJIA+vwNVEiXTE5iXs/wezV66oFLfp9NZGYW+Gk19J2+bCT6Ye2w6LDYdgzKMUabk595eLBCXANz9HUpWbATq9vqXVx9XDg+Pc9Xp4+bsS005SVM/BJBM4687WUuf+Uj9dEi8aDNaPxtpbDxcG1THTImUMZq4UCaaNYpsVqraNyKLJXDYsFZ/5jl7bLRtO88t7P3xZaAxhb5OdPMXqsSkp1WCieG8jXm1U99+blvLlXzPCS+M93VnJCiK+09LfaSaBAVBomyDgJua8dfUzR7ga34IvR2Nvj+A9heJ6lsl1KG4NkI1032Cnff1m1wof2B9oHJK4bi6JkEdSqeNeiuo6QoZZincoc73/TH9SXF8sCE7XyuYyW8WSgbGFCjPV0ihLKhdPs08Tx82fYAkLLc4I2wdl4apY7GU5lHRFzRWJep7Ww3wbeA3qmd59/86P4xuNaqDpygXt6M85glSBHOCGgJDnt+pN9bK7HApMguX6+06RZNjzVmcZJ+wcUrJ9//bpRNxNuKpNl9uFds+S9tdx7LaM5ZkIrPj6nIU9mnbFtVbs9s/uLgl8MVczAwet+iOEzzBlYW7RCMgE6gyNLeq6+1tIx4dpgZnd0DksJS5f+JNDpwwcPNXaaVspq1fbQajOrJgK0ofKtJ1Ne90L6VO4MOl5S886p7u6xo7OLjG8TGL+HU1JXGJgppg4nNbNJ5nlzSpuPYy21JUEcUA94PoFiZfjZue+QnyQ80ekOuZVkxx4g+cvhJfHgNl4hy1/a6+RKcKlar/J29y//EztlbVPHVUeQ1zX86eQVAjR/M3dA9w4W8LfaXp4EgM85wOWasli837PzVMOnsLzR+k3o75/lRPAJSE1xAKQzEi5v10ke+VBvRt1cwQRMd+U5mLCTGVd6XiZtgBG5cDi0w22GKcVNvHiu5LQbZEDVtz0onn7k5+heuKXVsZtSzilkLRAUmjMXEMB3J9YC50XBxPiz53SC+EhnPl9WsKCv92SM/OFFIMJZYfl0WW8tIO3UxYcwdMAj7FSmgrsZ2aAZO03BOhP1bNNZItyXYQFTpC3SG1VuPDqH9GkiCDmE+JwxyIVSO5siDErAOpEXFgjy6PQtOVDj+s6e1r8heWVvmZnTciuf4EiNZzCAd7SOMhXERIOlsHIMG399i9aLTy3m2hRLZjJVDNLS53iGIK11dPqQt0zBDyg6qc7YqkDm2M5Ve6dCWCaCbTXX2rToaIgz6+zh4lYUi/+6nqcFMAkQJKHYLK0wYk5N9szV6xihDbDDFr45lN1K4aCXBq/FitPSud9gLt5ZVn+ZqGX7cwm2z5EGMgfFpIFyhGGuDPmso6TItTMwny+7uPnLCf4W6goFQFV0oQSsc9VfMmVLcLr6ZetDZbaSFTLqnSO/bIPjA3/zAUoqgGFAEQS4IhuMzEp2I3jJzbzkk/IEmyax+rhZTwd6f+CGtwPixu8IvzACquPWPREu9ZvGkUzpRwvRRuaNN6cr0W1wWits9ICdYJ7ltbgMiSL3sTPeufgNcVqMVWFkCPDH4jG2jA0XcVgQj62Cb29v9f/z/+2KbYvIv/zzjpQAPkliaVDzNrW57TZ/ZOyZD0nlfMmAIBIAGAI0D3k/mdN4xr9v85ZbZbbqfH2jGd5hUqNZWwl5SPfoGmfElmazUIeNL1j/mkF7VNAzTq4jNt8JoQ11NQOcmhprXoxSxfRGJ9LDEOAQ+dmxAQH90iti9e2u/MoeuaGcDTHoC+xsmEeWmxEKefQuIzHbpw5Tc5cEocboAD09oipWQhtTO1wivf/O+DRe2rpl/E9wlrzBorjJsOeG1B/XPW4EaJEFdNlECEZga5ZoGRHXgYouGRuVkm8tDESiEyFNo+3s5M5puSdTyUL2llnINVHEt91XUNW4ewdMgJ4boJfEyt/iY5WXqbA+A2Fkt5Z0lutiWhe9nZIyIUjyXDC3UsaG1t+eNx6z4W/OYoTB7A6x+dNSTOi9AInctbESqm5gvOLww7OWXPrmHwVZasrl4eD113pm+JtT7JVOvnCXqdzzdTRHgJ0PiGTFYW5Gvt9R9LD6Lzfs0v/TZZHSmyVNq7viIHE6DBK7Qp07Iz55EM8SYtQvZf/obBniTWi5C2/ovHfw4VndkE5XYdjOhCMRjDeOEfXeN/CwfGduiUIfsoFeUxXeQXba7c7972XNv8w+dTjjUM0QeNAReW+J014dKAD/McQYXT7c0GQPIkn3Ll6R7gGjuiQoZD0TEeEqQpKoZ15g/0OPQI17QiSv9AUROa/V/TQN3dvLArec3RrsYlvBm1b8LWzltdugsC50lNKYLEp2a+ZZYqPejULRlOJh5zj/LVMyTDvwKhMxxwuDkxJ1QpoNI0OTWLom4Z71SNzI9TV1iXJrIu9Wcnd+MCaAw8o1jSXd94YU/1gnkrC9BUEOtQvEIQ7g0i6h+KL2JKk8Ydl7HruvgWMSAmNe+LshGhV4qnWHhO9/RIPQzY1tHRj2VqOyNsDpK0cww+56AdDC4gsWwY0XxoucIWIqs/GcwnWqlaT0KPr8mbK5U94/301i1WLt4YINTVvCFBrFZbIbY8eycOdeJ2teD5IfPLCRg7jjcFTwlMFNl9zdh/o3E/hHPwj7BWg0MU09pPrBLbrCgm54A6H+I6v27+jL5gkjWg/iYdks9jbfVP5y/n0dlgWEMlKasl7JvFZd56LfybW1eeaVO0gxTfXZwD8G4SI116yx7UKVRgui6Ya1YpixqXeNLc8IxtAwCU5IhwQgn+NqHnRaDv61CxKhOq4pOX7M6pkA+Pmpd4j1vn6ACUALoLLc4vpXci8VidLxzm7qFBe7s+quuJs6ETYmnpgS3LwSZxPIltgBDXz8M1k/W2ySNv2f9/NPhxLGK2D21dkHeSGmenRT3Yqcdl0m/h3OYr8V+lXNYGf8aCCpd4bWjE4QIPj7vUKN4Nrfs7ML6Y2OyS830JCnofg/k7lpFpt4SqZc5HGg1HCOrHvOdC8bP6FGDbE/VV0mX4IakzbdS/op+Kt3G24/8QbBV7y86sGSQ/vZzU8FXs7u6jIvwchsEP2BpIhW3G8uWNwa3HmjfH/ZjhhCWvluAcF+nMf14ClKg5hGgtPLJ98ueNAkc5Hs2WZlk2QHvfreCK1CCGO6nMZVSb99VM/ajr8WHTte9JSmkXq/i/U943HEbdzW6Re/S88dKgg8pGOLlAeNiqrcLkUR3/aClFpMXcOUP3rmETcWSfMXZE3TUOi8i+fqRnTYLflVx/Vb/6GJ7eIRZUA6k3RYR3iFSK9c4iDdNwJuZL2FKz/IK5VimcNWEqdXjSoxSgmF0UPlDoUlNrPcM7ftmA8Y9gKiqKEHuWN+AZRIwtVSxye2Kf8rM3lhJ5XcBXU9n4v0Oy1RU2M+4qM8AQPVwse8ErNSob5oFPWxuqZnVzo1qB/IBxkM3EVUKFUUlO3e51259GgNcJbCmlvrdjtoTW7rChm1wyCKzpCTwozUUEOIcWLneRLgMXh+SjGSFkAllzbGS5HK7LlfCMRNRDSvbQPjcXaenNYxCvu2Qyznz6StuxVj66SgI0T8B6/sfHAJYZaZ78thjOSIFumNWLQbeZixDCCC+v0YBtkxiBB3jefHqZ/dFHU+crbj6OvS1x/JDD7vlm7zOVPwpUC01nhxZuY/63E7g";const de=44032,le=4352,be=4449,pe=4519,fe=19,Z=21,U=28,S=Z*U,C=fe*S,F=de+C,X=le+fe,re=be+Z,ie=pe+U;function Q(Ge){return Ge>>24&255}function ne(Ge){return Ge&16777215}let L,ue,Ae,Re;function Pe(){let Ge=E(oe);L=new Map(B(Ge).flatMap((ze,Ve)=>ze.map(Ze=>[Ze,Ve+1<<24]))),ue=new Set(q(Ge)),Ae=new Map,Re=new Map;for(let[ze,Ve]of O(Ge)){if(!ue.has(ze)&&Ve.length==2){let[Ze,Je]=Ve,Ye=Re.get(Ze);Ye||(Ye=new Map,Re.set(Ze,Ye)),Ye.set(Je,ze)}Ae.set(ze,Ve.reverse())}}function xe(Ge){return Ge>=de&&Ge<F}function ge(Ge,ze){if(Ge>=le&&Ge<X&&ze>=be&&ze<re)return de+(Ge-le)*S+(ze-be)*U;if(xe(Ge)&&ze>pe&&ze<ie&&(Ge-de)%U==0)return Ge+(ze-pe);{let Ve=Re.get(Ge);return Ve&&(Ve=Ve.get(ze),Ve)?Ve:-1}}function _e(Ge){L||Pe();let ze=[],Ve=[],Ze=!1;function Je(Ye){let et=L.get(Ye);et&&(Ze=!0,Ye|=et),ze.push(Ye)}for(let Ye of Ge)for(;;){if(Ye<128)ze.push(Ye);else if(xe(Ye)){let et=Ye-de,nt=et/S|0,vt=et%S/U|0,kt=et%U;Je(le+nt),Je(be+vt),kt>0&&Je(pe+kt)}else{let et=Ae.get(Ye);et?Ve.push(...et):Je(Ye)}if(!Ve.length)break;Ye=Ve.pop()}if(Ze&&ze.length>1){let Ye=Q(ze[0]);for(let et=1;et<ze.length;et++){let nt=Q(ze[et]);if(nt==0||Ye<=nt){Ye=nt;continue}let vt=et-1;for(;;){let kt=ze[vt+1];if(ze[vt+1]=ze[vt],ze[vt]=kt,!vt||(Ye=Q(ze[--vt]),Ye<=nt))break}Ye=Q(ze[et])}}return ze}function ke(Ge){let ze=[],Ve=[],Ze=-1,Je=0;for(let Ye of Ge){let et=Q(Ye),nt=ne(Ye);if(Ze==-1)et==0?Ze=nt:ze.push(nt);else if(Je>0&&Je>=et)et==0?(ze.push(Ze,...Ve),Ve.length=0,Ze=nt):Ve.push(nt),Je=et;else{let vt=ge(Ze,nt);vt>=0?Ze=vt:Je==0&&et==0?(ze.push(Ze),Ze=nt):(Ve.push(nt),Je=et)}}return Ze>=0&&ze.push(Ze,...Ve),ze}function Ee(Ge){return _e(Ge).map(ne)}function Se(Ge){return ke(_e(Ge))}const Oe=45,Ne=46,ve=".",Ce=65039,Te=1,Le=Ge=>Array.from(Ge);function Be(Ge,ze){return Ge.P.has(ze)||Ge.Q.has(ze)}class De extends Array{get is_emoji(){return!0}}let Ke,We,Qe,Xe,at,Fe,qe,$e,Ie,we,me,ye;function Me(){if(Ke)return;let Ge=E(b);const ze=()=>q(Ge),Ve=()=>new Set(ze());Ke=new Map(O(Ge)),We=Ve(),Qe=ze(),Xe=new Set(ze().map(bt=>Qe[bt])),Qe=new Set(Qe),at=Ve(),Fe=Ve();let Ze=B(Ge),Je=Ge();const Ye=()=>new Set(ze().flatMap(bt=>Ze[bt]).concat(ze()));qe=I(bt=>{let Bt=I(Ge).map(Pt=>Pt+96);if(Bt.length){let Pt=bt>=Je;Bt[0]-=32,Bt=ae(Bt),Pt&&(Bt=`Restricted[${Bt}]`);let $t=Ye(),Dt=Ye(),Lt=!Ge();return{N:Bt,P:$t,Q:Dt,M:Lt,R:Pt}}}),$e=Ve(),Ie=new Map;let et=ze().concat(Le($e)).sort((bt,Bt)=>bt-Bt);et.forEach((bt,Bt)=>{let Pt=Ge(),$t=et[Bt]=Pt?et[Bt-Pt]:{V:[],M:new Map};$t.V.push(bt),$e.has(bt)||Ie.set(bt,$t)});for(let{V:bt,M:Bt}of new Set(Ie.values())){let Pt=[];for(let Dt of bt){let Lt=qe.filter(Kt=>Be(Kt,Dt)),qt=Pt.find(({G:Kt})=>Lt.some(Qt=>Kt.has(Qt)));qt||(qt={G:new Set,V:[]},Pt.push(qt)),qt.V.push(Dt),Lt.forEach(Kt=>qt.G.add(Kt))}let $t=Pt.flatMap(Dt=>Le(Dt.G));for(let{G:Dt,V:Lt}of Pt){let qt=new Set($t.filter(Kt=>!Dt.has(Kt)));for(let Kt of Lt)Bt.set(Kt,qt)}}let nt=new Set,vt=new Set;const kt=bt=>nt.has(bt)?vt.add(bt):nt.add(bt);for(let bt of qe){for(let Bt of bt.P)kt(Bt);for(let Bt of bt.Q)kt(Bt)}for(let bt of nt)!Ie.has(bt)&&!vt.has(bt)&&Ie.set(bt,Te);we=new Set(Le(nt).concat(Le(Ee(nt)))),me=J(Ge).map(bt=>De.from(bt)).sort(he),ye=new Map;for(let bt of me){let Bt=[ye];for(let Pt of bt){let $t=Bt.map(Dt=>{let Lt=Dt.get(Pt);return Lt||(Lt=new Map,Dt.set(Pt,Lt)),Lt});Pt===Ce?Bt.push(...$t):Bt=$t}for(let Pt of Bt)Pt.V=bt}}function je(Ge){return(st(Ge)?"":`${He(tt([Ge]))} `)+se(Ge)}function He(Ge){return`"${Ge}"‎`}function Ue(Ge){if(Ge.length>=4&&Ge[2]==Oe&&Ge[3]==Oe)throw new Error(`invalid label extension: "${ae(Ge.slice(0,4))}"`)}function rt(Ge){for(let Ve=Ge.lastIndexOf(95);Ve>0;)if(Ge[--Ve]!==95)throw new Error("underscore allowed only at start")}function it(Ge){let ze=Ge[0],Ve=v.get(ze);if(Ve)throw gt(`leading ${Ve}`);let Ze=Ge.length,Je=-1;for(let Ye=1;Ye<Ze;Ye++){ze=Ge[Ye];let et=v.get(ze);if(et){if(Je==Ye)throw gt(`${Ve} + ${et}`);Je=Ye+1,Ve=et}}if(Je==Ze)throw gt(`trailing ${Ve}`)}function tt(Ge,ze=se){let Ve=[];mt(Ge[0])&&Ve.push("◌");let Ze=0,Je=Ge.length;for(let Ye=0;Ye<Je;Ye++){let et=Ge[Ye];st(et)&&(Ve.push(ae(Ge.slice(Ze,Ye))),Ve.push(ze(et)),Ze=Ye+1)}return Ve.push(ae(Ge.slice(Ze,Je))),Ve.join("")}function mt(Ge){return Me(),Qe.has(Ge)}function st(Ge){return Me(),at.has(Ge)}function lt(){return Me(),me.map(Ge=>Ge.slice())}function Ct(Ge,ze){Me();let Ve=ze?Ee:Se;return Ge.split(ve).map(Ze=>ae(Tt(ce(Ze),Ve,yt).flat())).join(ve)}function St(Ge){return wt(xt(Ge,Se,yt))}function dt(Ge){let ze=xt(Ge,Se,Ve=>Ve);for(let{type:Ve,output:Ze,error:Je}of ze){if(Je)break;if(Ve!=="Greek"){let Ye=0;for(;;){let et=Ze.indexOf(958,Ye);if(et<0)break;Ze[et]=926,Ye=et+1}}}return wt(ze)}function Ot(Ge,ze){return xt(Ge,Se,ze?Ve=>Ve.slice():yt)}function xt(Ge,ze,Ve){if(!Ge)return[];Me();let Ze=0;return Ge.split(ve).map(Je=>{let Ye=ce(Je),et={input:Ye,offset:Ze};Ze+=Ye.length+1;try{let nt=et.tokens=Tt(Ye,ze,Ve),vt=nt.length,kt;if(!vt)throw new Error("empty label");let bt=et.output=nt.flat();if(rt(bt),!(et.emoji=vt>1||nt[0].is_emoji)&&bt.every(Pt=>Pt<128))Ue(bt),kt="ASCII";else{let Pt=nt.flatMap($t=>$t.is_emoji?[]:$t);if(!Pt.length)kt="Emoji";else{if(Qe.has(bt[0]))throw gt("leading combining mark");for(let Lt=1;Lt<vt;Lt++){let qt=nt[Lt];if(!qt.is_emoji&&Qe.has(qt[0]))throw gt(`emoji + combining mark: "${ae(nt[Lt-1])} + ${tt([qt[0]])}"`)}it(bt);let $t=Le(new Set(Pt)),[Dt]=Nt($t);pt(Dt,Pt),ht(Dt,$t),kt=Dt.N}}et.type=kt}catch(nt){et.error=nt}return et})}function ht(Ge,ze){let Ve,Ze=[];for(let Je of ze){let Ye=Ie.get(Je);if(Ye===Te)return;if(Ye){let et=Ye.M.get(Je);if(Ve=Ve?Ve.filter(nt=>et.has(nt)):Le(et),!Ve.length)return}else Ze.push(Je)}if(Ve){for(let Je of Ve)if(Ze.every(Ye=>Be(Je,Ye)))throw new Error(`whole-script confusable: ${Ge.N}/${Je.N}`)}}function Nt(Ge){let ze=qe;for(let Ve of Ge){let Ze=ze.filter(Je=>Be(Je,Ve));if(!Ze.length)throw qe.some(Je=>Be(Je,Ve))?Rt(ze[0],Ve):ct(Ve);if(ze=Ze,Ze.length==1)break}return ze}function wt(Ge){return Ge.map(({input:ze,error:Ve,output:Ze})=>{if(Ve){let Je=Ve.message;throw new Error(Ge.length==1?Je:`Invalid label ${He(tt(ze))}: ${Je}`)}return ae(Ze)}).join(ve)}function ct(Ge){return new Error(`disallowed character: ${je(Ge)}`)}function Rt(Ge,ze){let Ve=je(ze),Ze=qe.find(Je=>Je.P.has(ze));return Ze&&(Ve=`${Ze.N} ${Ve}`),new Error(`illegal mixture: ${Ge.N} + ${Ve}`)}function gt(Ge){return new Error(`illegal placement: ${Ge}`)}function pt(Ge,ze){for(let Ve of ze)if(!Be(Ge,Ve))throw Rt(Ge,Ve);if(Ge.M){let Ve=Ee(ze);for(let Ze=1,Je=Ve.length;Ze<Je;Ze++)if(Xe.has(Ve[Ze])){let Ye=Ze+1;for(let et;Ye<Je&&Xe.has(et=Ve[Ye]);Ye++)for(let nt=Ze;nt<Ye;nt++)if(Ve[nt]==et)throw new Error(`duplicate non-spacing marks: ${je(et)}`);if(Ye-Ze>w)throw new Error(`excessive non-spacing marks: ${He(tt(Ve.slice(Ze-1,Ye)))} (${Ye-Ze}/${w})`);Ze=Ye}}}function Tt(Ge,ze,Ve){let Ze=[],Je=[];for(Ge=Ge.slice().reverse();Ge.length;){let Ye=ut(Ge);if(Ye)Je.length&&(Ze.push(ze(Je)),Je=[]),Ze.push(Ve(Ye));else{let et=Ge.pop();if(we.has(et))Je.push(et);else{let nt=Ke.get(et);if(nt)Je.push(...nt);else if(!We.has(et))throw ct(et)}}}return Je.length&&Ze.push(ze(Je)),Ze}function yt(Ge){return Ge.filter(ze=>ze!=Ce)}function ut(Ge,ze){let Ve=ye,Ze,Je=Ge.length;for(;Je&&(Ve=Ve.get(Ge[--Je]),!!Ve);){let{V:Ye}=Ve;Ye&&(Ze=Ye,ze&&ze.push(...Ge.slice(Je).reverse()),Ge.length=Je)}return Ze}const Mt="valid",_t="mapped",ot="ignored",It="disallowed",Et="emoji",At="nfc",Gt="stop";function Ut(Ge,{nf:ze=!0}={}){Me();let Ve=ce(Ge).reverse(),Ze=[],Je=[];for(;Ve.length;){let Ye=ut(Ve,Ze);if(Ye)Je.push({type:Et,emoji:Ye.slice(),input:Ze,cps:yt(Ye)}),Ze=[];else{let et=Ve.pop();if(et==Ne)Je.push({type:Gt,cp:et});else if(we.has(et))Je.push({type:Mt,cps:[et]});else if(We.has(et))Je.push({type:ot,cp:et});else{let nt=Ke.get(et);nt?Je.push({type:_t,cp:et,cps:nt.slice()}):Je.push({type:It,cp:et})}}}if(ze)for(let Ye=0,et=-1;Ye<Je.length;Ye++){let nt=Je[Ye];if(jt(nt.type))if(Ft(nt.cps)){let vt=Ye+1;for(let Pt=vt;Pt<Je.length;Pt++){let{type:$t,cps:Dt}=Je[Pt];if(jt($t)){if(!Ft(Dt))break;vt=Pt+1}else if($t!==ot)break}et<0&&(et=Ye);let kt=Je.slice(et,vt),bt=kt.flatMap(Pt=>jt(Pt.type)?Pt.cps:[]),Bt=Se(bt);he(Bt,bt)?(Je.splice(et,vt-et,{type:At,input:bt,cps:Bt,tokens0:Ht(kt),tokens:Ut(ae(Bt),{nf:!1})}),Ye=et):Ye=vt-1,et=-1}else et=Ye;else nt.type!==ot&&(et=-1)}return Ht(Je)}function jt(Ge){return Ge==Mt||Ge==_t}function Ft(Ge){return Ge.some(ze=>Fe.has(ze))}function Ht(Ge){for(let ze=0;ze<Ge.length;ze++)if(Ge[ze].type==Mt){let Ve=ze+1;for(;Ve<Ge.length&&Ge[Ve].type==Mt;)Ve++;Ge.splice(ze,Ve-ze,{type:Mt,cps:Ge.slice(ze,Ve).flatMap(Ze=>Ze.cps)})}return Ge}return dist.ens_beautify=dt,dist.ens_emoji=lt,dist.ens_normalize=St,dist.ens_normalize_fragment=Ct,dist.ens_split=Ot,dist.ens_tokenize=Ut,dist.is_combining_mark=mt,dist.nfc=Se,dist.nfd=Ee,dist.safe_str_from_cps=tt,dist.should_escape=st,dist}var hasRequiredNamehash;function requireNamehash(){if(hasRequiredNamehash)return namehash;hasRequiredNamehash=1,Object.defineProperty(namehash,"__esModule",{value:!0}),namehash.dnsEncode=namehash.namehash=namehash.isValidName=namehash.ensNormalize=void 0;const b=requireCrypto(),v=requireUtils$3(),w=requireDist(),_=new Uint8Array(32);_.fill(0);function A(B){return(0,v.assertArgument)(B.length!==0,"invalid ENS name; empty component","comp",B),B}function E(B){const O=(0,v.toUtf8Bytes)(k(B)),I=[];if(B.length===0)return I;let D=0;for(let V=0;V<O.length;V++)O[V]===46&&(I.push(A(O.slice(D,V))),D=V+1);return(0,v.assertArgument)(D<O.length,"invalid ENS name; empty component","name",B),I.push(A(O.slice(D))),I}function k(B){try{if(B.length===0)throw new Error("empty label");return(0,w.ens_normalize)(B)}catch(O){(0,v.assertArgument)(!1,`invalid ENS name (${O.message})`,"name",B)}}namehash.ensNormalize=k;function P(B){try{return E(B).length!==0}catch{}return!1}namehash.isValidName=P;function N(B){(0,v.assertArgument)(typeof B=="string","invalid ENS name; not a string","name",B),(0,v.assertArgument)(B.length,"invalid ENS name (empty label)","name",B);let O=_;const I=E(B);for(;I.length;)O=(0,b.keccak256)((0,v.concat)([O,(0,b.keccak256)(I.pop())]));return(0,v.hexlify)(O)}namehash.namehash=N;function q(B){return(0,v.hexlify)((0,v.concat)(E(B).map(O=>{if(O.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const I=new Uint8Array(O.length+1);return I.set(O,1),I[0]=I.length-1,I})))+"00"}return namehash.dnsEncode=q,namehash}var message={},transaction$1={},accesslist={},hasRequiredAccesslist;function requireAccesslist(){if(hasRequiredAccesslist)return accesslist;hasRequiredAccesslist=1,Object.defineProperty(accesslist,"__esModule",{value:!0}),accesslist.accessListify=void 0;const b=requireAddress$2(),v=requireUtils$3();function w(A,E){return{address:(0,b.getAddress)(A),storageKeys:E.map((k,P)=>((0,v.assertArgument)((0,v.isHexString)(k,32),"invalid slot",`storageKeys[${P}]`,k),k.toLowerCase()))}}function _(A){if(Array.isArray(A))return A.map((k,P)=>Array.isArray(k)?((0,v.assertArgument)(k.length===2,"invalid slot set",`value[${P}]`,k),w(k[0],k[1])):((0,v.assertArgument)(k!=null&&typeof k=="object","invalid address-slot set","value",A),w(k.address,k.storageKeys)));(0,v.assertArgument)(A!=null&&typeof A=="object","invalid access list","value",A);const E=Object.keys(A).map(k=>{const P=A[k].reduce((N,q)=>(N[q]=!0,N),{});return w(k,Object.keys(P).sort())});return E.sort((k,P)=>k.address.localeCompare(P.address)),E}return accesslist.accessListify=_,accesslist}var address={},hasRequiredAddress;function requireAddress(){if(hasRequiredAddress)return address;hasRequiredAddress=1,Object.defineProperty(address,"__esModule",{value:!0}),address.recoverAddress=address.computeAddress=void 0;const b=requireAddress$2(),v=requireCrypto();function w(A){let E;return typeof A=="string"?E=v.SigningKey.computePublicKey(A,!1):E=A.publicKey,(0,b.getAddress)((0,v.keccak256)("0x"+E.substring(4)).substring(26))}address.computeAddress=w;function _(A,E){return w(v.SigningKey.recoverPublicKey(A,E))}return address.recoverAddress=_,address}var transaction={},hasRequiredTransaction$1;function requireTransaction$1(){if(hasRequiredTransaction$1)return transaction;hasRequiredTransaction$1=1,Object.defineProperty(transaction,"__esModule",{value:!0}),transaction.Transaction=void 0;const b=requireAddress$2(),v=requireCrypto(),w=requireUtils$3(),_=requireAccesslist(),A=requireAddress(),E=BigInt(0),k=BigInt(2),P=BigInt(27),N=BigInt(28),q=BigInt(35),B=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function O(be){return be==="0x"?null:(0,b.getAddress)(be)}function I(be,pe){try{return(0,_.accessListify)(be)}catch(fe){(0,w.assertArgument)(!1,fe.message,pe,be)}}function D(be,pe){return be==="0x"?0:(0,w.getNumber)(be,pe)}function V(be,pe){if(be==="0x")return E;const fe=(0,w.getBigInt)(be,pe);return(0,w.assertArgument)(fe<=B,"value exceeds uint size",pe,fe),fe}function ee(be,pe){const fe=(0,w.getBigInt)(be,"value"),Z=(0,w.toBeArray)(fe);return(0,w.assertArgument)(Z.length<=32,"value too large",`tx.${pe}`,fe),Z}function J(be){return(0,_.accessListify)(be).map(pe=>[pe.address,pe.storageKeys])}function te(be){const pe=(0,w.decodeRlp)(be);(0,w.assertArgument)(Array.isArray(pe)&&(pe.length===9||pe.length===6),"invalid field count for legacy transaction","data",be);const fe={type:0,nonce:D(pe[0],"nonce"),gasPrice:V(pe[1],"gasPrice"),gasLimit:V(pe[2],"gasLimit"),to:O(pe[3]),value:V(pe[4],"value"),data:(0,w.hexlify)(pe[5]),chainId:E};if(pe.length===6)return fe;const Z=V(pe[6],"v"),U=V(pe[7],"r"),S=V(pe[8],"s");if(U===E&&S===E)fe.chainId=Z;else{let C=(Z-q)/k;C<E&&(C=E),fe.chainId=C,(0,w.assertArgument)(C!==E||Z===P||Z===N,"non-canonical legacy v","v",pe[6]),fe.signature=v.Signature.from({r:(0,w.zeroPadValue)(pe[7],32),s:(0,w.zeroPadValue)(pe[8],32),v:Z}),fe.hash=(0,v.keccak256)(be)}return fe}function se(be,pe){const fe=[ee(be.nonce||0,"nonce"),ee(be.gasPrice||0,"gasPrice"),ee(be.gasLimit||0,"gasLimit"),be.to!=null?(0,b.getAddress)(be.to):"0x",ee(be.value||0,"value"),be.data||"0x"];let Z=E;if(be.chainId!=E)Z=(0,w.getBigInt)(be.chainId,"tx.chainId"),(0,w.assertArgument)(!pe||pe.networkV==null||pe.legacyChainId===Z,"tx.chainId/sig.v mismatch","sig",pe);else if(be.signature){const S=be.signature.legacyChainId;S!=null&&(Z=S)}if(!pe)return Z!==E&&(fe.push((0,w.toBeArray)(Z)),fe.push("0x"),fe.push("0x")),(0,w.encodeRlp)(fe);let U=BigInt(27+pe.yParity);return Z!==E?U=v.Signature.getChainIdV(Z,pe.v):BigInt(pe.v)!==U&&(0,w.assertArgument)(!1,"tx.chainId/sig.v mismatch","sig",pe),fe.push((0,w.toBeArray)(U)),fe.push((0,w.toBeArray)(pe.r)),fe.push((0,w.toBeArray)(pe.s)),(0,w.encodeRlp)(fe)}function ce(be,pe){let fe;try{if(fe=D(pe[0],"yParity"),fe!==0&&fe!==1)throw new Error("bad yParity")}catch{(0,w.assertArgument)(!1,"invalid yParity","yParity",pe[0])}const Z=(0,w.zeroPadValue)(pe[1],32),U=(0,w.zeroPadValue)(pe[2],32),S=v.Signature.from({r:Z,s:U,yParity:fe});be.signature=S}function ae(be){const pe=(0,w.decodeRlp)((0,w.getBytes)(be).slice(1));(0,w.assertArgument)(Array.isArray(pe)&&(pe.length===9||pe.length===12),"invalid field count for transaction type: 2","data",(0,w.hexlify)(be));const fe=V(pe[2],"maxPriorityFeePerGas"),Z=V(pe[3],"maxFeePerGas"),U={type:2,chainId:V(pe[0],"chainId"),nonce:D(pe[1],"nonce"),maxPriorityFeePerGas:fe,maxFeePerGas:Z,gasPrice:null,gasLimit:V(pe[4],"gasLimit"),to:O(pe[5]),value:V(pe[6],"value"),data:(0,w.hexlify)(pe[7]),accessList:I(pe[8],"accessList")};return pe.length===9||(U.hash=(0,v.keccak256)(be),ce(U,pe.slice(9))),U}function he(be,pe){const fe=[ee(be.chainId||0,"chainId"),ee(be.nonce||0,"nonce"),ee(be.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ee(be.maxFeePerGas||0,"maxFeePerGas"),ee(be.gasLimit||0,"gasLimit"),be.to!=null?(0,b.getAddress)(be.to):"0x",ee(be.value||0,"value"),be.data||"0x",J(be.accessList||[])];return pe&&(fe.push(ee(pe.yParity,"yParity")),fe.push((0,w.toBeArray)(pe.r)),fe.push((0,w.toBeArray)(pe.s))),(0,w.concat)(["0x02",(0,w.encodeRlp)(fe)])}function oe(be){const pe=(0,w.decodeRlp)((0,w.getBytes)(be).slice(1));(0,w.assertArgument)(Array.isArray(pe)&&(pe.length===8||pe.length===11),"invalid field count for transaction type: 1","data",(0,w.hexlify)(be));const fe={type:1,chainId:V(pe[0],"chainId"),nonce:D(pe[1],"nonce"),gasPrice:V(pe[2],"gasPrice"),gasLimit:V(pe[3],"gasLimit"),to:O(pe[4]),value:V(pe[5],"value"),data:(0,w.hexlify)(pe[6]),accessList:I(pe[7],"accessList")};return pe.length===8||(fe.hash=(0,v.keccak256)(be),ce(fe,pe.slice(8))),fe}function de(be,pe){const fe=[ee(be.chainId||0,"chainId"),ee(be.nonce||0,"nonce"),ee(be.gasPrice||0,"gasPrice"),ee(be.gasLimit||0,"gasLimit"),be.to!=null?(0,b.getAddress)(be.to):"0x",ee(be.value||0,"value"),be.data||"0x",J(be.accessList||[])];return pe&&(fe.push(ee(pe.yParity,"recoveryParam")),fe.push((0,w.toBeArray)(pe.r)),fe.push((0,w.toBeArray)(pe.s))),(0,w.concat)(["0x01",(0,w.encodeRlp)(fe)])}class le{#e;#t;#r;#n;#i;#s;#a;#o;#u;#f;#l;#d;get type(){return this.#e}set type(pe){switch(pe){case null:this.#e=null;break;case 0:case"legacy":this.#e=0;break;case 1:case"berlin":case"eip-2930":this.#e=1;break;case 2:case"london":case"eip-1559":this.#e=2;break;default:(0,w.assertArgument)(!1,"unsupported transaction type","type",pe)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559"}return null}get to(){return this.#t}set to(pe){this.#t=pe==null?null:(0,b.getAddress)(pe)}get nonce(){return this.#n}set nonce(pe){this.#n=(0,w.getNumber)(pe,"value")}get gasLimit(){return this.#i}set gasLimit(pe){this.#i=(0,w.getBigInt)(pe)}get gasPrice(){const pe=this.#s;return pe==null&&(this.type===0||this.type===1)?E:pe}set gasPrice(pe){this.#s=pe==null?null:(0,w.getBigInt)(pe,"gasPrice")}get maxPriorityFeePerGas(){const pe=this.#a;return pe??(this.type===2?E:null)}set maxPriorityFeePerGas(pe){this.#a=pe==null?null:(0,w.getBigInt)(pe,"maxPriorityFeePerGas")}get maxFeePerGas(){const pe=this.#o;return pe??(this.type===2?E:null)}set maxFeePerGas(pe){this.#o=pe==null?null:(0,w.getBigInt)(pe,"maxFeePerGas")}get data(){return this.#r}set data(pe){this.#r=(0,w.hexlify)(pe)}get value(){return this.#u}set value(pe){this.#u=(0,w.getBigInt)(pe,"value")}get chainId(){return this.#f}set chainId(pe){this.#f=(0,w.getBigInt)(pe)}get signature(){return this.#l||null}set signature(pe){this.#l=pe==null?null:v.Signature.from(pe)}get accessList(){const pe=this.#d||null;return pe??(this.type===1||this.type===2?[]:null)}set accessList(pe){this.#d=pe==null?null:(0,_.accessListify)(pe)}constructor(){this.#e=null,this.#t=null,this.#n=0,this.#i=BigInt(0),this.#s=null,this.#a=null,this.#o=null,this.#r="0x",this.#u=BigInt(0),this.#f=BigInt(0),this.#l=null,this.#d=null}get hash(){return this.signature==null?null:(0,v.keccak256)(this.serialized)}get unsignedHash(){return(0,v.keccak256)(this.unsignedSerialized)}get from(){return this.signature==null?null:(0,A.recoverAddress)(this.unsignedHash,this.signature)}get fromPublicKey(){return this.signature==null?null:v.SigningKey.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}get serialized(){switch((0,w.assert)(this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"}),this.inferType()){case 0:return se(this,this.signature);case 1:return de(this,this.signature);case 2:return he(this,this.signature)}(0,w.assert)(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})}get unsignedSerialized(){switch(this.inferType()){case 0:return se(this);case 1:return de(this);case 2:return he(this)}(0,w.assert)(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".unsignedSerialized"})}inferType(){return this.inferTypes().pop()}inferTypes(){const pe=this.gasPrice!=null,fe=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,Z=this.accessList!=null;this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&(0,w.assert)(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),(0,w.assert)(!fe||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),(0,w.assert)(this.type!==0||!Z,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const U=[];return this.type!=null?U.push(this.type):fe?U.push(2):pe?(U.push(1),Z||U.push(0)):Z?(U.push(1),U.push(2)):(U.push(0),U.push(1),U.push(2)),U.sort(),U}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}clone(){return le.from(this)}toJSON(){const pe=fe=>fe==null?null:fe.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:pe(this.gasLimit),gasPrice:pe(this.gasPrice),maxPriorityFeePerGas:pe(this.maxPriorityFeePerGas),maxFeePerGas:pe(this.maxFeePerGas),value:pe(this.value),chainId:pe(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(pe){if(pe==null)return new le;if(typeof pe=="string"){const Z=(0,w.getBytes)(pe);if(Z[0]>=127)return le.from(te(Z));switch(Z[0]){case 1:return le.from(oe(Z));case 2:return le.from(ae(Z))}(0,w.assert)(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const fe=new le;return pe.type!=null&&(fe.type=pe.type),pe.to!=null&&(fe.to=pe.to),pe.nonce!=null&&(fe.nonce=pe.nonce),pe.gasLimit!=null&&(fe.gasLimit=pe.gasLimit),pe.gasPrice!=null&&(fe.gasPrice=pe.gasPrice),pe.maxPriorityFeePerGas!=null&&(fe.maxPriorityFeePerGas=pe.maxPriorityFeePerGas),pe.maxFeePerGas!=null&&(fe.maxFeePerGas=pe.maxFeePerGas),pe.data!=null&&(fe.data=pe.data),pe.value!=null&&(fe.value=pe.value),pe.chainId!=null&&(fe.chainId=pe.chainId),pe.signature!=null&&(fe.signature=v.Signature.from(pe.signature)),pe.accessList!=null&&(fe.accessList=pe.accessList),pe.hash!=null&&((0,w.assertArgument)(fe.isSigned(),"unsigned transaction cannot define hash","tx",pe),(0,w.assertArgument)(fe.hash===pe.hash,"hash mismatch","tx",pe)),pe.from!=null&&((0,w.assertArgument)(fe.isSigned(),"unsigned transaction cannot define from","tx",pe),(0,w.assertArgument)(fe.from.toLowerCase()===(pe.from||"").toLowerCase(),"from mismatch","tx",pe)),fe}}return transaction.Transaction=le,transaction}var hasRequiredTransaction;function requireTransaction(){return hasRequiredTransaction||(hasRequiredTransaction=1,function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.Transaction=b.recoverAddress=b.computeAddress=b.accessListify=void 0;var v=requireAccesslist();Object.defineProperty(b,"accessListify",{enumerable:!0,get:function(){return v.accessListify}});var w=requireAddress();Object.defineProperty(b,"computeAddress",{enumerable:!0,get:function(){return w.computeAddress}}),Object.defineProperty(b,"recoverAddress",{enumerable:!0,get:function(){return w.recoverAddress}});var _=requireTransaction$1();Object.defineProperty(b,"Transaction",{enumerable:!0,get:function(){return _.Transaction}})}(transaction$1)),transaction$1}var hasRequiredMessage;function requireMessage(){if(hasRequiredMessage)return message;hasRequiredMessage=1,Object.defineProperty(message,"__esModule",{value:!0}),message.verifyMessage=message.hashMessage=void 0;const b=requireCrypto(),v=requireConstants$1(),w=requireTransaction(),_=requireUtils$3();function A(k){return typeof k=="string"&&(k=(0,_.toUtf8Bytes)(k)),(0,b.keccak256)((0,_.concat)([(0,_.toUtf8Bytes)(v.MessagePrefix),(0,_.toUtf8Bytes)(String(k.length)),k]))}message.hashMessage=A;function E(k,P){const N=A(k);return(0,w.recoverAddress)(N,P)}return message.verifyMessage=E,message}var solidity={},hasRequiredSolidity;function requireSolidity(){if(hasRequiredSolidity)return solidity;hasRequiredSolidity=1,Object.defineProperty(solidity,"__esModule",{value:!0}),solidity.solidityPackedSha256=solidity.solidityPackedKeccak256=solidity.solidityPacked=void 0;const b=requireAddress$2(),v=requireCrypto(),w=requireUtils$3(),_=new RegExp("^bytes([0-9]+)$"),A=new RegExp("^(u?int)([0-9]*)$"),E=new RegExp("^(.*)\\[([0-9]*)\\]$");function k(B,O,I){switch(B){case"address":return I?(0,w.getBytes)((0,w.zeroPadValue)(O,32)):(0,w.getBytes)((0,b.getAddress)(O));case"string":return(0,w.toUtf8Bytes)(O);case"bytes":return(0,w.getBytes)(O);case"bool":return O=O?"0x01":"0x00",I?(0,w.getBytes)((0,w.zeroPadValue)(O,32)):(0,w.getBytes)(O)}let D=B.match(A);if(D){let V=D[1]==="int",ee=parseInt(D[2]||"256");return(0,w.assertArgument)((!D[2]||D[2]===String(ee))&&ee%8===0&&ee!==0&&ee<=256,"invalid number type","type",B),I&&(ee=256),V&&(O=(0,w.toTwos)(O,ee)),(0,w.getBytes)((0,w.zeroPadValue)((0,w.toBeArray)(O),ee/8))}if(D=B.match(_),D){const V=parseInt(D[1]);return(0,w.assertArgument)(String(V)===D[1]&&V!==0&&V<=32,"invalid bytes type","type",B),(0,w.assertArgument)((0,w.dataLength)(O)===V,`invalid value for ${B}`,"value",O),I?(0,w.getBytes)((0,w.zeroPadBytes)(O,32)):O}if(D=B.match(E),D&&Array.isArray(O)){const V=D[1],ee=parseInt(D[2]||String(O.length));(0,w.assertArgument)(ee===O.length,`invalid array length for ${B}`,"value",O);const J=[];return O.forEach(function(te){J.push(k(V,te,!0))}),(0,w.getBytes)((0,w.concat)(J))}(0,w.assertArgument)(!1,"invalid type","type",B)}function P(B,O){(0,w.assertArgument)(B.length===O.length,"wrong number of values; expected ${ types.length }","values",O);const I=[];return B.forEach(function(D,V){I.push(k(D,O[V]))}),(0,w.hexlify)((0,w.concat)(I))}solidity.solidityPacked=P;function N(B,O){return(0,v.keccak256)(P(B,O))}solidity.solidityPackedKeccak256=N;function q(B,O){return(0,v.sha256)(P(B,O))}return solidity.solidityPackedSha256=q,solidity}var typedData={},hasRequiredTypedData;function requireTypedData(){if(hasRequiredTypedData)return typedData;hasRequiredTypedData=1,Object.defineProperty(typedData,"__esModule",{value:!0}),typedData.verifyTypedData=typedData.TypedDataEncoder=void 0;const b=requireAddress$2(),v=requireCrypto(),w=requireTransaction(),_=requireUtils$3(),A=requireId(),E=new Uint8Array(32);E.fill(0);const k=BigInt(-1),P=BigInt(0),N=BigInt(1),q=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function B(he){const oe=(0,_.getBytes)(he),de=oe.length%32;return de?(0,_.concat)([oe,E.slice(de)]):(0,_.hexlify)(oe)}const O=(0,_.toBeHex)(N,32),I=(0,_.toBeHex)(P,32),D={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},V=["name","version","chainId","verifyingContract","salt"];function ee(he){return function(oe){return(0,_.assertArgument)(typeof oe=="string",`invalid domain value for ${JSON.stringify(he)}`,`domain.${he}`,oe),oe}}const J={name:ee("name"),version:ee("version"),chainId:function(he){const oe=(0,_.getBigInt)(he,"domain.chainId");return(0,_.assertArgument)(oe>=0,"invalid chain ID","domain.chainId",he),Number.isSafeInteger(oe)?Number(oe):(0,_.toQuantity)(oe)},verifyingContract:function(he){try{return(0,b.getAddress)(he).toLowerCase()}catch{}(0,_.assertArgument)(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",he)},salt:function(he){const oe=(0,_.getBytes)(he,"domain.salt");return(0,_.assertArgument)(oe.length===32,'invalid domain value "salt"',"domain.salt",he),(0,_.hexlify)(oe)}};function te(he){{const oe=he.match(/^(u?)int(\d*)$/);if(oe){const de=oe[1]==="",le=parseInt(oe[2]||"256");(0,_.assertArgument)(le%8===0&&le!==0&&le<=256&&(oe[2]==null||oe[2]===String(le)),"invalid numeric width","type",he);const be=(0,_.mask)(q,de?le-1:le),pe=de?(be+N)*k:P;return function(fe){const Z=(0,_.getBigInt)(fe,"value");return(0,_.assertArgument)(Z>=pe&&Z<=be,`value out-of-bounds for ${he}`,"value",Z),(0,_.toBeHex)(de?(0,_.toTwos)(Z,256):Z,32)}}}{const oe=he.match(/^bytes(\d+)$/);if(oe){const de=parseInt(oe[1]);return(0,_.assertArgument)(de!==0&&de<=32&&oe[1]===String(de),"invalid bytes width","type",he),function(le){const be=(0,_.getBytes)(le);return(0,_.assertArgument)(be.length===de,`invalid length for ${he}`,"value",le),B(le)}}}switch(he){case"address":return function(oe){return(0,_.zeroPadValue)((0,b.getAddress)(oe),32)};case"bool":return function(oe){return oe?O:I};case"bytes":return function(oe){return(0,v.keccak256)(oe)};case"string":return function(oe){return(0,A.id)(oe)}}return null}function se(he,oe){return`${he}(${oe.map(({name:de,type:le})=>le+" "+de).join(",")})`}class ce{primaryType;#e;get types(){return JSON.parse(this.#e)}#t;#r;constructor(oe){this.#e=JSON.stringify(oe),this.#t=new Map,this.#r=new Map;const de=new Map,le=new Map,be=new Map;Object.keys(oe).forEach(Z=>{de.set(Z,new Set),le.set(Z,[]),be.set(Z,new Set)});for(const Z in oe){const U=new Set;for(const S of oe[Z]){(0,_.assertArgument)(!U.has(S.name),`duplicate variable name ${JSON.stringify(S.name)} in ${JSON.stringify(Z)}`,"types",oe),U.add(S.name);const C=S.type.match(/^([^\x5b]*)(\x5b|$)/)[1]||null;(0,_.assertArgument)(C!==Z,`circular type reference to ${JSON.stringify(C)}`,"types",oe),!te(C)&&((0,_.assertArgument)(le.has(C),`unknown type ${JSON.stringify(C)}`,"types",oe),le.get(C).push(Z),de.get(Z).add(C))}}const pe=Array.from(le.keys()).filter(Z=>le.get(Z).length===0);(0,_.assertArgument)(pe.length!==0,"missing primary type","types",oe),(0,_.assertArgument)(pe.length===1,`ambiguous primary types or unused types: ${pe.map(Z=>JSON.stringify(Z)).join(", ")}`,"types",oe),(0,_.defineProperties)(this,{primaryType:pe[0]});function fe(Z,U){(0,_.assertArgument)(!U.has(Z),`circular type reference to ${JSON.stringify(Z)}`,"types",oe),U.add(Z);for(const S of de.get(Z))if(le.has(S)){fe(S,U);for(const C of U)be.get(C).add(S)}U.delete(Z)}fe(this.primaryType,new Set);for(const[Z,U]of be){const S=Array.from(U);S.sort(),this.#t.set(Z,se(Z,oe[Z])+S.map(C=>se(C,oe[C])).join(""))}}getEncoder(oe){let de=this.#r.get(oe);return de||(de=this.#n(oe),this.#r.set(oe,de)),de}#n(oe){{const be=te(oe);if(be)return be}const de=oe.match(/^(.*)(\x5b(\d*)\x5d)$/);if(de){const be=de[1],pe=this.getEncoder(be);return fe=>{(0,_.assertArgument)(!de[3]||parseInt(de[3])===fe.length,`array length mismatch; expected length ${parseInt(de[3])}`,"value",fe);let Z=fe.map(pe);return this.#t.has(be)&&(Z=Z.map(v.keccak256)),(0,v.keccak256)((0,_.concat)(Z))}}const le=this.types[oe];if(le){const be=(0,A.id)(this.#t.get(oe));return pe=>{const fe=le.map(({name:Z,type:U})=>{const S=this.getEncoder(U)(pe[Z]);return this.#t.has(U)?(0,v.keccak256)(S):S});return fe.unshift(be),(0,_.concat)(fe)}}(0,_.assertArgument)(!1,`unknown type: ${oe}`,"type",oe)}encodeType(oe){const de=this.#t.get(oe);return(0,_.assertArgument)(de,`unknown type: ${JSON.stringify(oe)}`,"name",oe),de}encodeData(oe,de){return this.getEncoder(oe)(de)}hashStruct(oe,de){return(0,v.keccak256)(this.encodeData(oe,de))}encode(oe){return this.encodeData(this.primaryType,oe)}hash(oe){return this.hashStruct(this.primaryType,oe)}_visit(oe,de,le){if(te(oe))return le(oe,de);const be=oe.match(/^(.*)(\x5b(\d*)\x5d)$/);if(be)return(0,_.assertArgument)(!be[3]||parseInt(be[3])===de.length,`array length mismatch; expected length ${parseInt(be[3])}`,"value",de),de.map(fe=>this._visit(be[1],fe,le));const pe=this.types[oe];if(pe)return pe.reduce((fe,{name:Z,type:U})=>(fe[Z]=this._visit(U,de[Z],le),fe),{});(0,_.assertArgument)(!1,`unknown type: ${oe}`,"type",oe)}visit(oe,de){return this._visit(this.primaryType,oe,de)}static from(oe){return new ce(oe)}static getPrimaryType(oe){return ce.from(oe).primaryType}static hashStruct(oe,de,le){return ce.from(de).hashStruct(oe,le)}static hashDomain(oe){const de=[];for(const le in oe){if(oe[le]==null)continue;const be=D[le];(0,_.assertArgument)(be,`invalid typed-data domain key: ${JSON.stringify(le)}`,"domain",oe),de.push({name:le,type:be})}return de.sort((le,be)=>V.indexOf(le.name)-V.indexOf(be.name)),ce.hashStruct("EIP712Domain",{EIP712Domain:de},oe)}static encode(oe,de,le){return(0,_.concat)(["0x1901",ce.hashDomain(oe),ce.from(de).hash(le)])}static hash(oe,de,le){return(0,v.keccak256)(ce.encode(oe,de,le))}static async resolveNames(oe,de,le,be){oe=Object.assign({},oe);for(const Z in oe)oe[Z]==null&&delete oe[Z];const pe={};oe.verifyingContract&&!(0,_.isHexString)(oe.verifyingContract,20)&&(pe[oe.verifyingContract]="0x");const fe=ce.from(de);fe.visit(le,(Z,U)=>(Z==="address"&&!(0,_.isHexString)(U,20)&&(pe[U]="0x"),U));for(const Z in pe)pe[Z]=await be(Z);return oe.verifyingContract&&pe[oe.verifyingContract]&&(oe.verifyingContract=pe[oe.verifyingContract]),le=fe.visit(le,(Z,U)=>Z==="address"&&pe[U]?pe[U]:U),{domain:oe,value:le}}static getPayload(oe,de,le){ce.hashDomain(oe);const be={},pe=[];V.forEach(U=>{const S=oe[U];S!=null&&(be[U]=J[U](S),pe.push({name:U,type:D[U]}))});const fe=ce.from(de),Z=Object.assign({},de);return(0,_.assertArgument)(Z.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",de),Z.EIP712Domain=pe,fe.encode(le),{types:Z,domain:be,primaryType:fe.primaryType,message:fe.visit(le,(U,S)=>{if(U.match(/^bytes(\d*)/))return(0,_.hexlify)((0,_.getBytes)(S));if(U.match(/^u?int/))return(0,_.getBigInt)(S).toString();switch(U){case"address":return S.toLowerCase();case"bool":return!!S;case"string":return(0,_.assertArgument)(typeof S=="string","invalid string","value",S),S}(0,_.assertArgument)(!1,"unsupported type","type",U)})}}}typedData.TypedDataEncoder=ce;function ae(he,oe,de,le){return(0,w.recoverAddress)(ce.hash(he,oe,de),le)}return typedData.verifyTypedData=ae,typedData}var hasRequiredHash;function requireHash(){return hasRequiredHash||(hasRequiredHash=1,function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.verifyTypedData=b.TypedDataEncoder=b.solidityPackedSha256=b.solidityPackedKeccak256=b.solidityPacked=b.verifyMessage=b.hashMessage=b.dnsEncode=b.namehash=b.isValidName=b.ensNormalize=b.id=void 0;var v=requireId();Object.defineProperty(b,"id",{enumerable:!0,get:function(){return v.id}});var w=requireNamehash();Object.defineProperty(b,"ensNormalize",{enumerable:!0,get:function(){return w.ensNormalize}}),Object.defineProperty(b,"isValidName",{enumerable:!0,get:function(){return w.isValidName}}),Object.defineProperty(b,"namehash",{enumerable:!0,get:function(){return w.namehash}}),Object.defineProperty(b,"dnsEncode",{enumerable:!0,get:function(){return w.dnsEncode}});var _=requireMessage();Object.defineProperty(b,"hashMessage",{enumerable:!0,get:function(){return _.hashMessage}}),Object.defineProperty(b,"verifyMessage",{enumerable:!0,get:function(){return _.verifyMessage}});var A=requireSolidity();Object.defineProperty(b,"solidityPacked",{enumerable:!0,get:function(){return A.solidityPacked}}),Object.defineProperty(b,"solidityPackedKeccak256",{enumerable:!0,get:function(){return A.solidityPackedKeccak256}}),Object.defineProperty(b,"solidityPackedSha256",{enumerable:!0,get:function(){return A.solidityPackedSha256}});var E=requireTypedData();Object.defineProperty(b,"TypedDataEncoder",{enumerable:!0,get:function(){return E.TypedDataEncoder}}),Object.defineProperty(b,"verifyTypedData",{enumerable:!0,get:function(){return E.verifyTypedData}})}(hash$4)),hash$4}var hasRequiredFragments;function requireFragments(){if(hasRequiredFragments)return fragments;hasRequiredFragments=1,Object.defineProperty(fragments,"__esModule",{value:!0}),fragments.StructFragment=fragments.FunctionFragment=fragments.FallbackFragment=fragments.ConstructorFragment=fragments.EventFragment=fragments.ErrorFragment=fragments.NamedFragment=fragments.Fragment=fragments.ParamType=void 0;const b=requireUtils$3(),v=requireHash();function w(Ne){const ve=new Set;return Ne.forEach(Ce=>ve.add(Ce)),Object.freeze(ve)}const A=w("external public payable".split(" ")),E="constant external internal payable private public pure view",k=w(E.split(" ")),P="constructor error event fallback function receive struct",N=w(P.split(" ")),q="calldata memory storage payable indexed",B=w(q.split(" ")),I=[P,q,"tuple returns",E].join(" "),D=w(I.split(" ")),V={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},ee=new RegExp("^(\\s*)"),J=new RegExp("^([0-9]+)"),te=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),se=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),ce=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");class ae{#e;#t;get offset(){return this.#e}get length(){return this.#t.length-this.#e}constructor(ve){this.#e=0,this.#t=ve.slice()}clone(){return new ae(this.#t)}reset(){this.#e=0}#r(ve=0,Ce=0){return new ae(this.#t.slice(ve,Ce).map(Te=>Object.freeze(Object.assign({},Te,{match:Te.match-ve,linkBack:Te.linkBack-ve,linkNext:Te.linkNext-ve}))))}popKeyword(ve){const Ce=this.peek();if(Ce.type!=="KEYWORD"||!ve.has(Ce.text))throw new Error(`expected keyword ${Ce.text}`);return this.pop().text}popType(ve){if(this.peek().type!==ve)throw new Error(`expected ${ve}; got ${JSON.stringify(this.peek())}`);return this.pop().text}popParen(){const ve=this.peek();if(ve.type!=="OPEN_PAREN")throw new Error("bad start");const Ce=this.#r(this.#e+1,ve.match+1);return this.#e=ve.match+1,Ce}popParams(){const ve=this.peek();if(ve.type!=="OPEN_PAREN")throw new Error("bad start");const Ce=[];for(;this.#e<ve.match-1;){const Te=this.peek().linkNext;Ce.push(this.#r(this.#e+1,Te)),this.#e=Te}return this.#e=ve.match+1,Ce}peek(){if(this.#e>=this.#t.length)throw new Error("out-of-bounds");return this.#t[this.#e]}peekKeyword(ve){const Ce=this.peekType("KEYWORD");return Ce!=null&&ve.has(Ce)?Ce:null}peekType(ve){if(this.length===0)return null;const Ce=this.peek();return Ce.type===ve?Ce.text:null}pop(){const ve=this.peek();return this.#e++,ve}toString(){const ve=[];for(let Ce=this.#e;Ce<this.#t.length;Ce++){const Te=this.#t[Ce];ve.push(`${Te.type}:${Te.text}`)}return`<TokenString ${ve.join(" ")}>`}}function he(Ne){const ve=[],Ce=De=>{const Ke=Be<Ne.length?JSON.stringify(Ne[Be]):"$EOI";throw new Error(`invalid token ${Ke} at ${Be}: ${De}`)};let Te=[],Le=[],Be=0;for(;Be<Ne.length;){let De=Ne.substring(Be),Ke=De.match(ee);Ke&&(Be+=Ke[1].length,De=Ne.substring(Be));const We={depth:Te.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:Be,value:-1};ve.push(We);let Qe=V[De[0]]||"";if(Qe){if(We.type=Qe,We.text=De[0],Be++,Qe==="OPEN_PAREN")Te.push(ve.length-1),Le.push(ve.length-1);else if(Qe=="CLOSE_PAREN")Te.length===0&&Ce("no matching open bracket"),We.match=Te.pop(),ve[We.match].match=ve.length-1,We.depth--,We.linkBack=Le.pop(),ve[We.linkBack].linkNext=ve.length-1;else if(Qe==="COMMA")We.linkBack=Le.pop(),ve[We.linkBack].linkNext=ve.length-1,Le.push(ve.length-1);else if(Qe==="OPEN_BRACKET")We.type="BRACKET";else if(Qe==="CLOSE_BRACKET"){let Xe=ve.pop().text;if(ve.length>0&&ve[ve.length-1].type==="NUMBER"){const at=ve.pop().text;Xe=at+Xe,ve[ve.length-1].value=(0,b.getNumber)(at)}if(ve.length===0||ve[ve.length-1].type!=="BRACKET")throw new Error("missing opening bracket");ve[ve.length-1].text+=Xe}continue}if(Ke=De.match(te),Ke){if(We.text=Ke[1],Be+=We.text.length,D.has(We.text)){We.type="KEYWORD";continue}if(We.text.match(ce)){We.type="TYPE";continue}We.type="ID";continue}if(Ke=De.match(J),Ke){We.text=Ke[1],We.type="NUMBER",Be+=We.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(De[0])} at position ${Be}`)}return new ae(ve.map(De=>Object.freeze(De)))}function oe(Ne,ve){let Ce=[];for(const Te in ve.keys())Ne.has(Te)&&Ce.push(Te);if(Ce.length>1)throw new Error(`conflicting types: ${Ce.join(", ")}`)}function de(Ne,ve){if(ve.peekKeyword(N)){const Ce=ve.pop().text;if(Ce!==Ne)throw new Error(`expected ${Ne}, got ${Ce}`)}return ve.popType("ID")}function le(Ne,ve){const Ce=new Set;for(;;){const Te=Ne.peekType("KEYWORD");if(Te==null||ve&&!ve.has(Te))break;if(Ne.pop(),Ce.has(Te))throw new Error(`duplicate keywords: ${JSON.stringify(Te)}`);Ce.add(Te)}return Object.freeze(Ce)}function be(Ne){let ve=le(Ne,k);return oe(ve,w("constant payable nonpayable".split(" "))),oe(ve,w("pure view payable nonpayable".split(" "))),ve.has("view")?"view":ve.has("pure")?"pure":ve.has("payable")?"payable":ve.has("nonpayable")?"nonpayable":ve.has("constant")?"view":"nonpayable"}function pe(Ne,ve){return Ne.popParams().map(Ce=>Ae.from(Ce,ve))}function fe(Ne){if(Ne.peekType("AT")){if(Ne.pop(),Ne.peekType("NUMBER"))return(0,b.getBigInt)(Ne.pop().text);throw new Error("invalid gas")}return null}function Z(Ne){if(Ne.length)throw new Error(`unexpected tokens: ${Ne.toString()}`)}const U=new RegExp(/^(.*)\[([0-9]*)\]$/);function S(Ne){const ve=Ne.match(ce);if((0,b.assertArgument)(ve,"invalid type","type",Ne),Ne==="uint")return"uint256";if(Ne==="int")return"int256";if(ve[2]){const Ce=parseInt(ve[2]);(0,b.assertArgument)(Ce!==0&&Ce<=32,"invalid bytes length","type",Ne)}else if(ve[3]){const Ce=parseInt(ve[3]);(0,b.assertArgument)(Ce!==0&&Ce<=256&&Ce%8===0,"invalid numeric width","type",Ne)}return Ne}const C={},F=Symbol.for("_ethers_internal"),X="_ParamTypeInternal",re="_ErrorInternal",ie="_EventInternal",Q="_ConstructorInternal",ne="_FallbackInternal",L="_FunctionInternal",ue="_StructInternal";class Ae{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(ve,Ce,Te,Le,Be,De,Ke,We){if((0,b.assertPrivate)(ve,C,"ParamType"),Object.defineProperty(this,F,{value:X}),De&&(De=Object.freeze(De.slice())),Le==="array"){if(Ke==null||We==null)throw new Error("")}else if(Ke!=null||We!=null)throw new Error("");if(Le==="tuple"){if(De==null)throw new Error("")}else if(De!=null)throw new Error("");(0,b.defineProperties)(this,{name:Ce,type:Te,baseType:Le,indexed:Be,components:De,arrayLength:Ke,arrayChildren:We})}format(ve){if(ve==null&&(ve="sighash"),ve==="json"){const Te=this.name||"";if(this.isArray()){const Be=JSON.parse(this.arrayChildren.format("json"));return Be.name=Te,Be.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(Be)}const Le={type:this.baseType==="tuple"?"tuple":this.type,name:Te};return typeof this.indexed=="boolean"&&(Le.indexed=this.indexed),this.isTuple()&&(Le.components=this.components.map(Be=>JSON.parse(Be.format(ve)))),JSON.stringify(Le)}let Ce="";return this.isArray()?(Ce+=this.arrayChildren.format(ve),Ce+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?(ve!=="sighash"&&(Ce+=this.type),Ce+="("+this.components.map(Te=>Te.format(ve)).join(ve==="full"?", ":",")+")"):Ce+=this.type,ve!=="sighash"&&(this.indexed===!0&&(Ce+=" indexed"),ve==="full"&&this.name&&(Ce+=" "+this.name)),Ce}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(ve,Ce){if(this.isArray()){if(!Array.isArray(ve))throw new Error("invalid array value");if(this.arrayLength!==-1&&ve.length!==this.arrayLength)throw new Error("array is wrong length");const Te=this;return ve.map(Le=>Te.arrayChildren.walk(Le,Ce))}if(this.isTuple()){if(!Array.isArray(ve))throw new Error("invalid tuple value");if(ve.length!==this.components.length)throw new Error("array is wrong length");const Te=this;return ve.map((Le,Be)=>Te.components[Be].walk(Le,Ce))}return Ce(this.type,ve)}#e(ve,Ce,Te,Le){if(this.isArray()){if(!Array.isArray(Ce))throw new Error("invalid array value");if(this.arrayLength!==-1&&Ce.length!==this.arrayLength)throw new Error("array is wrong length");const De=this.arrayChildren,Ke=Ce.slice();Ke.forEach((We,Qe)=>{De.#e(ve,We,Te,Xe=>{Ke[Qe]=Xe})}),Le(Ke);return}if(this.isTuple()){const De=this.components;let Ke;if(Array.isArray(Ce))Ke=Ce.slice();else{if(Ce==null||typeof Ce!="object")throw new Error("invalid tuple value");Ke=De.map(We=>{if(!We.name)throw new Error("cannot use object value with unnamed components");if(!(We.name in Ce))throw new Error(`missing value for component ${We.name}`);return Ce[We.name]})}if(Ke.length!==this.components.length)throw new Error("array is wrong length");Ke.forEach((We,Qe)=>{De[Qe].#e(ve,We,Te,Xe=>{Ke[Qe]=Xe})}),Le(Ke);return}const Be=Te(this.type,Ce);Be.then?ve.push(async function(){Le(await Be)}()):Le(Be)}async walkAsync(ve,Ce){const Te=[],Le=[ve];return this.#e(Te,ve,Ce,Be=>{Le[0]=Be}),Te.length&&await Promise.all(Te),Le[0]}static from(ve,Ce){if(Ae.isParamType(ve))return ve;if(typeof ve=="string")try{return Ae.from(he(ve),Ce)}catch{(0,b.assertArgument)(!1,"invalid param type","obj",ve)}else if(ve instanceof ae){let Ke="",We="",Qe=null;le(ve,w(["tuple"])).has("tuple")||ve.peekType("OPEN_PAREN")?(We="tuple",Qe=ve.popParams().map(Ie=>Ae.from(Ie)),Ke=`tuple(${Qe.map(Ie=>Ie.format()).join(",")})`):(Ke=S(ve.popType("TYPE")),We=Ke);let Xe=null,at=null;for(;ve.length&&ve.peekType("BRACKET");){const Ie=ve.pop();Xe=new Ae(C,"",Ke,We,null,Qe,at,Xe),at=Ie.value,Ke+=Ie.text,We="array",Qe=null}let Fe=null;if(le(ve,B).has("indexed")){if(!Ce)throw new Error("");Fe=!0}const $e=ve.peekType("ID")?ve.pop().text:"";if(ve.length)throw new Error("leftover tokens");return new Ae(C,$e,Ke,We,Fe,Qe,at,Xe)}const Te=ve.name;(0,b.assertArgument)(!Te||typeof Te=="string"&&Te.match(se),"invalid name","obj.name",Te);let Le=ve.indexed;Le!=null&&((0,b.assertArgument)(Ce,"parameter cannot be indexed","obj.indexed",ve.indexed),Le=!!Le);let Be=ve.type,De=Be.match(U);if(De){const Ke=parseInt(De[2]||"-1"),We=Ae.from({type:De[1],components:ve.components});return new Ae(C,Te||"",Be,"array",Le,null,Ke,We)}if(Be==="tuple"||Be.startsWith("tuple(")||Be.startsWith("(")){const Ke=ve.components!=null?ve.components.map(Qe=>Ae.from(Qe)):null;return new Ae(C,Te||"",Be,"tuple",Le,Ke,null,null)}return Be=S(ve.type),new Ae(C,Te||"",Be,Be,Le,null,null,null)}static isParamType(ve){return ve&&ve[F]===X}}fragments.ParamType=Ae;class Re{type;inputs;constructor(ve,Ce,Te){(0,b.assertPrivate)(ve,C,"Fragment"),Te=Object.freeze(Te.slice()),(0,b.defineProperties)(this,{type:Ce,inputs:Te})}static from(ve){if(typeof ve=="string"){try{Re.from(JSON.parse(ve))}catch{}return Re.from(he(ve))}if(ve instanceof ae)switch(ve.peekKeyword(N)){case"constructor":return ke.from(ve);case"error":return ge.from(ve);case"event":return _e.from(ve);case"fallback":case"receive":return Ee.from(ve);case"function":return Se.from(ve);case"struct":return Oe.from(ve)}else if(typeof ve=="object"){switch(ve.type){case"constructor":return ke.from(ve);case"error":return ge.from(ve);case"event":return _e.from(ve);case"fallback":case"receive":return Ee.from(ve);case"function":return Se.from(ve);case"struct":return Oe.from(ve)}(0,b.assert)(!1,`unsupported type: ${ve.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}(0,b.assertArgument)(!1,"unsupported frgament object","obj",ve)}static isConstructor(ve){return ke.isFragment(ve)}static isError(ve){return ge.isFragment(ve)}static isEvent(ve){return _e.isFragment(ve)}static isFunction(ve){return Se.isFragment(ve)}static isStruct(ve){return Oe.isFragment(ve)}}fragments.Fragment=Re;class Pe extends Re{name;constructor(ve,Ce,Te,Le){super(ve,Ce,Le),(0,b.assertArgument)(typeof Te=="string"&&Te.match(se),"invalid identifier","name",Te),Le=Object.freeze(Le.slice()),(0,b.defineProperties)(this,{name:Te})}}fragments.NamedFragment=Pe;function xe(Ne,ve){return"("+ve.map(Ce=>Ce.format(Ne)).join(Ne==="full"?", ":",")+")"}class ge extends Pe{constructor(ve,Ce,Te){super(ve,"error",Ce,Te),Object.defineProperty(this,F,{value:re})}get selector(){return(0,v.id)(this.format("sighash")).substring(0,10)}format(ve){if(ve==null&&(ve="sighash"),ve==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(Te=>JSON.parse(Te.format(ve)))});const Ce=[];return ve!=="sighash"&&Ce.push("error"),Ce.push(this.name+xe(ve,this.inputs)),Ce.join(" ")}static from(ve){if(ge.isFragment(ve))return ve;if(typeof ve=="string")return ge.from(he(ve));if(ve instanceof ae){const Ce=de("error",ve),Te=pe(ve);return Z(ve),new ge(C,Ce,Te)}return new ge(C,ve.name,ve.inputs?ve.inputs.map(Ae.from):[])}static isFragment(ve){return ve&&ve[F]===re}}fragments.ErrorFragment=ge;class _e extends Pe{anonymous;constructor(ve,Ce,Te,Le){super(ve,"event",Ce,Te),Object.defineProperty(this,F,{value:ie}),(0,b.defineProperties)(this,{anonymous:Le})}get topicHash(){return(0,v.id)(this.format("sighash"))}format(ve){if(ve==null&&(ve="sighash"),ve==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(Te=>JSON.parse(Te.format(ve)))});const Ce=[];return ve!=="sighash"&&Ce.push("event"),Ce.push(this.name+xe(ve,this.inputs)),ve!=="sighash"&&this.anonymous&&Ce.push("anonymous"),Ce.join(" ")}static getTopicHash(ve,Ce){return Ce=(Ce||[]).map(Le=>Ae.from(Le)),new _e(C,ve,Ce,!1).topicHash}static from(ve){if(_e.isFragment(ve))return ve;if(typeof ve=="string")try{return _e.from(he(ve))}catch{(0,b.assertArgument)(!1,"invalid event fragment","obj",ve)}else if(ve instanceof ae){const Ce=de("event",ve),Te=pe(ve,!0),Le=!!le(ve,w(["anonymous"])).has("anonymous");return Z(ve),new _e(C,Ce,Te,Le)}return new _e(C,ve.name,ve.inputs?ve.inputs.map(Ce=>Ae.from(Ce,!0)):[],!!ve.anonymous)}static isFragment(ve){return ve&&ve[F]===ie}}fragments.EventFragment=_e;class ke extends Re{payable;gas;constructor(ve,Ce,Te,Le,Be){super(ve,Ce,Te),Object.defineProperty(this,F,{value:Q}),(0,b.defineProperties)(this,{payable:Le,gas:Be})}format(ve){if((0,b.assert)(ve!=null&&ve!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),ve==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(Te=>JSON.parse(Te.format(ve)))});const Ce=[`constructor${xe(ve,this.inputs)}`];return Ce.push(this.payable?"payable":"nonpayable"),this.gas!=null&&Ce.push(`@${this.gas.toString()}`),Ce.join(" ")}static from(ve){if(ke.isFragment(ve))return ve;if(typeof ve=="string")try{return ke.from(he(ve))}catch{(0,b.assertArgument)(!1,"invalid constuctor fragment","obj",ve)}else if(ve instanceof ae){le(ve,w(["constructor"]));const Ce=pe(ve),Te=!!le(ve,A).has("payable"),Le=fe(ve);return Z(ve),new ke(C,"constructor",Ce,Te,Le)}return new ke(C,"constructor",ve.inputs?ve.inputs.map(Ae.from):[],!!ve.payable,ve.gas!=null?ve.gas:null)}static isFragment(ve){return ve&&ve[F]===Q}}fragments.ConstructorFragment=ke;class Ee extends Re{payable;constructor(ve,Ce,Te){super(ve,"fallback",Ce),Object.defineProperty(this,F,{value:ne}),(0,b.defineProperties)(this,{payable:Te})}format(ve){const Ce=this.inputs.length===0?"receive":"fallback";if(ve==="json"){const Te=this.payable?"payable":"nonpayable";return JSON.stringify({type:Ce,stateMutability:Te})}return`${Ce}()${this.payable?" payable":""}`}static from(ve){if(Ee.isFragment(ve))return ve;if(typeof ve=="string")try{return Ee.from(he(ve))}catch{(0,b.assertArgument)(!1,"invalid fallback fragment","obj",ve)}else if(ve instanceof ae){const Ce=ve.toString(),Te=ve.peekKeyword(w(["fallback","receive"]));if((0,b.assertArgument)(Te,"type must be fallback or receive","obj",Ce),ve.popKeyword(w(["fallback","receive"]))==="receive"){const Ke=pe(ve);return(0,b.assertArgument)(Ke.length===0,"receive cannot have arguments","obj.inputs",Ke),le(ve,w(["payable"])),Z(ve),new Ee(C,[],!0)}let Be=pe(ve);Be.length?(0,b.assertArgument)(Be.length===1&&Be[0].type==="bytes","invalid fallback inputs","obj.inputs",Be.map(Ke=>Ke.format("minimal")).join(", ")):Be=[Ae.from("bytes")];const De=be(ve);if((0,b.assertArgument)(De==="nonpayable"||De==="payable","fallback cannot be constants","obj.stateMutability",De),le(ve,w(["returns"])).has("returns")){const Ke=pe(ve);(0,b.assertArgument)(Ke.length===1&&Ke[0].type==="bytes","invalid fallback outputs","obj.outputs",Ke.map(We=>We.format("minimal")).join(", "))}return Z(ve),new Ee(C,Be,De==="payable")}if(ve.type==="receive")return new Ee(C,[],!0);if(ve.type==="fallback"){const Ce=[Ae.from("bytes")],Te=ve.stateMutability==="payable";return new Ee(C,Ce,Te)}(0,b.assertArgument)(!1,"invalid fallback description","obj",ve)}static isFragment(ve){return ve&&ve[F]===ne}}fragments.FallbackFragment=Ee;class Se extends Pe{constant;outputs;stateMutability;payable;gas;constructor(ve,Ce,Te,Le,Be,De){super(ve,"function",Ce,Le),Object.defineProperty(this,F,{value:L}),Be=Object.freeze(Be.slice());const Ke=Te==="view"||Te==="pure",We=Te==="payable";(0,b.defineProperties)(this,{constant:Ke,gas:De,outputs:Be,payable:We,stateMutability:Te})}get selector(){return(0,v.id)(this.format("sighash")).substring(0,10)}format(ve){if(ve==null&&(ve="sighash"),ve==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(Te=>JSON.parse(Te.format(ve))),outputs:this.outputs.map(Te=>JSON.parse(Te.format(ve)))});const Ce=[];return ve!=="sighash"&&Ce.push("function"),Ce.push(this.name+xe(ve,this.inputs)),ve!=="sighash"&&(this.stateMutability!=="nonpayable"&&Ce.push(this.stateMutability),this.outputs&&this.outputs.length&&(Ce.push("returns"),Ce.push(xe(ve,this.outputs))),this.gas!=null&&Ce.push(`@${this.gas.toString()}`)),Ce.join(" ")}static getSelector(ve,Ce){return Ce=(Ce||[]).map(Le=>Ae.from(Le)),new Se(C,ve,"view",Ce,[],null).selector}static from(ve){if(Se.isFragment(ve))return ve;if(typeof ve=="string")try{return Se.from(he(ve))}catch{(0,b.assertArgument)(!1,"invalid function fragment","obj",ve)}else if(ve instanceof ae){const Te=de("function",ve),Le=pe(ve),Be=be(ve);let De=[];le(ve,w(["returns"])).has("returns")&&(De=pe(ve));const Ke=fe(ve);return Z(ve),new Se(C,Te,Be,Le,De,Ke)}let Ce=ve.stateMutability;return Ce==null&&(Ce="payable",typeof ve.constant=="boolean"?(Ce="view",ve.constant||(Ce="payable",typeof ve.payable=="boolean"&&!ve.payable&&(Ce="nonpayable"))):typeof ve.payable=="boolean"&&!ve.payable&&(Ce="nonpayable")),new Se(C,ve.name,Ce,ve.inputs?ve.inputs.map(Ae.from):[],ve.outputs?ve.outputs.map(Ae.from):[],ve.gas!=null?ve.gas:null)}static isFragment(ve){return ve&&ve[F]===L}}fragments.FunctionFragment=Se;class Oe extends Pe{constructor(ve,Ce,Te){super(ve,"struct",Ce,Te),Object.defineProperty(this,F,{value:ue})}format(){throw new Error("@TODO")}static from(ve){if(typeof ve=="string")try{return Oe.from(he(ve))}catch{(0,b.assertArgument)(!1,"invalid struct fragment","obj",ve)}else if(ve instanceof ae){const Ce=de("struct",ve),Te=pe(ve);return Z(ve),new Oe(C,Ce,Te)}return new Oe(C,ve.name,ve.inputs?ve.inputs.map(Ae.from):[])}static isFragment(ve){return ve&&ve[F]===ue}}return fragments.StructFragment=Oe,fragments}var hasRequiredAbiCoder;function requireAbiCoder(){if(hasRequiredAbiCoder)return abiCoder;hasRequiredAbiCoder=1,Object.defineProperty(abiCoder,"__esModule",{value:!0}),abiCoder.AbiCoder=void 0;const b=requireUtils$3(),v=requireAbstractCoder(),w=requireAddress$1(),_=requireArray(),A=requireBoolean(),E=requireBytes(),k=requireFixedBytes(),P=require_null(),N=requireNumber(),q=requireString(),B=requireTuple(),O=requireFragments(),I=requireAddress$2(),D=requireUtils$3(),V=new Map;V.set(0,"GENERIC_PANIC"),V.set(1,"ASSERT_FALSE"),V.set(17,"OVERFLOW"),V.set(18,"DIVIDE_BY_ZERO"),V.set(33,"ENUM_RANGE_ERROR"),V.set(34,"BAD_STORAGE_DATA"),V.set(49,"STACK_UNDERFLOW"),V.set(50,"ARRAY_RANGE_ERROR"),V.set(65,"OUT_OF_MEMORY"),V.set(81,"UNINITIALIZED_FUNCTION_CALL");const ee=new RegExp(/^bytes([0-9]*)$/),J=new RegExp(/^(u?int)([0-9]*)$/);let te=null;function se(ae,he,oe,de){let le="missing revert data",be=null;const pe=null;let fe=null;if(oe){le="execution reverted";const U=(0,D.getBytes)(oe);if(oe=(0,D.hexlify)(oe),U.length===0)le+=" (no data present; likely require(false) occurred",be="require(false)";else if(U.length%32!==4)le+=" (could not decode reason; invalid data length)";else if((0,D.hexlify)(U.slice(0,4))==="0x08c379a0")try{be=de.decode(["string"],U.slice(4))[0],fe={signature:"Error(string)",name:"Error",args:[be]},le+=`: ${JSON.stringify(be)}`}catch{le+=" (could not decode reason; invalid string data)"}else if((0,D.hexlify)(U.slice(0,4))==="0x4e487b71")try{const S=Number(de.decode(["uint256"],U.slice(4))[0]);fe={signature:"Panic(uint256)",name:"Panic",args:[S]},be=`Panic due to ${V.get(S)||"UNKNOWN"}(${S})`,le+=`: ${be}`}catch{le+=" (could not decode panic code)"}else le+=" (unknown custom error)"}const Z={to:he.to?(0,I.getAddress)(he.to):null,data:he.data||"0x"};return he.from&&(Z.from=(0,I.getAddress)(he.from)),(0,D.makeError)(le,"CALL_EXCEPTION",{action:ae,data:oe,reason:be,transaction:Z,invocation:pe,revert:fe})}class ce{#e(he){if(he.isArray())return new _.ArrayCoder(this.#e(he.arrayChildren),he.arrayLength,he.name);if(he.isTuple())return new B.TupleCoder(he.components.map(de=>this.#e(de)),he.name);switch(he.baseType){case"address":return new w.AddressCoder(he.name);case"bool":return new A.BooleanCoder(he.name);case"string":return new q.StringCoder(he.name);case"bytes":return new E.BytesCoder(he.name);case"":return new P.NullCoder(he.name)}let oe=he.type.match(J);if(oe){let de=parseInt(oe[2]||"256");return(0,b.assertArgument)(de!==0&&de<=256&&de%8===0,"invalid "+oe[1]+" bit length","param",he),new N.NumberCoder(de/8,oe[1]==="int",he.name)}if(oe=he.type.match(ee),oe){let de=parseInt(oe[1]);return(0,b.assertArgument)(de!==0&&de<=32,"invalid bytes length","param",he),new k.FixedBytesCoder(de,he.name)}(0,b.assertArgument)(!1,"invalid type","type",he.type)}getDefaultValue(he){const oe=he.map(le=>this.#e(O.ParamType.from(le)));return new B.TupleCoder(oe,"_").defaultValue()}encode(he,oe){(0,b.assertArgumentCount)(oe.length,he.length,"types/values length mismatch");const de=he.map(pe=>this.#e(O.ParamType.from(pe))),le=new B.TupleCoder(de,"_"),be=new v.Writer;return le.encode(be,oe),be.data}decode(he,oe,de){const le=he.map(pe=>this.#e(O.ParamType.from(pe)));return new B.TupleCoder(le,"_").decode(new v.Reader(oe,de))}static defaultAbiCoder(){return te==null&&(te=new ce),te}static getBuiltinCallException(he,oe,de){return se(he,oe,de,ce.defaultAbiCoder())}}return abiCoder.AbiCoder=ce,abiCoder}var bytes32={},hasRequiredBytes32;function requireBytes32(){if(hasRequiredBytes32)return bytes32;hasRequiredBytes32=1,Object.defineProperty(bytes32,"__esModule",{value:!0}),bytes32.decodeBytes32String=bytes32.encodeBytes32String=void 0;const b=requireUtils$3();function v(_){const A=(0,b.toUtf8Bytes)(_);if(A.length>31)throw new Error("bytes32 string must be less than 32 bytes");return(0,b.zeroPadBytes)(A,32)}bytes32.encodeBytes32String=v;function w(_){const A=(0,b.getBytes)(_,"bytes");if(A.length!==32)throw new Error("invalid bytes32 - not 32 bytes long");if(A[31]!==0)throw new Error("invalid bytes32 string - no null terminator");let E=31;for(;A[E-1]===0;)E--;return(0,b.toUtf8String)(A.slice(0,E))}return bytes32.decodeBytes32String=w,bytes32}var _interface={},hasRequired_interface;function require_interface(){return hasRequired_interface||(hasRequired_interface=1,function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.Interface=b.Indexed=b.ErrorDescription=b.TransactionDescription=b.LogDescription=b.Result=b.checkResultErrors=void 0;const v=requireCrypto(),w=requireHash(),_=requireUtils$3(),A=requireAbiCoder(),E=requireAbstractCoder();Object.defineProperty(b,"checkResultErrors",{enumerable:!0,get:function(){return E.checkResultErrors}}),Object.defineProperty(b,"Result",{enumerable:!0,get:function(){return E.Result}});const k=requireFragments(),P=requireTyped();class N{fragment;name;signature;topic;args;constructor(J,te,se){const ce=J.name,ae=J.format();(0,_.defineProperties)(this,{fragment:J,name:ce,signature:ae,topic:te,args:se})}}b.LogDescription=N;class q{fragment;name;args;signature;selector;value;constructor(J,te,se,ce){const ae=J.name,he=J.format();(0,_.defineProperties)(this,{fragment:J,name:ae,args:se,signature:he,selector:te,value:ce})}}b.TransactionDescription=q;class B{fragment;name;args;signature;selector;constructor(J,te,se){const ce=J.name,ae=J.format();(0,_.defineProperties)(this,{fragment:J,name:ce,args:se,signature:ae,selector:te})}}b.ErrorDescription=B;class O{hash;_isIndexed;static isIndexed(J){return!!(J&&J._isIndexed)}constructor(J){(0,_.defineProperties)(this,{hash:J,_isIndexed:!0})}}b.Indexed=O;const I={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},D={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:ee=>`reverted with reason string ${JSON.stringify(ee)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:ee=>{let J="unknown panic code";return ee>=0&&ee<=255&&I[ee.toString()]&&(J=I[ee.toString()]),`reverted with panic code 0x${ee.toString(16)} (${J})`}}};class V{fragments;deploy;fallback;receive;#e;#t;#r;#n;constructor(J){let te=[];typeof J=="string"?te=JSON.parse(J):te=J,this.#r=new Map,this.#e=new Map,this.#t=new Map;const se=[];for(const he of te)try{se.push(k.Fragment.from(he))}catch(oe){console.log("EE",oe)}(0,_.defineProperties)(this,{fragments:Object.freeze(se)});let ce=null,ae=!1;this.#n=this.getAbiCoder(),this.fragments.forEach((he,oe)=>{let de;switch(he.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}(0,_.defineProperties)(this,{deploy:he});return;case"fallback":he.inputs.length===0?ae=!0:((0,_.assertArgument)(!ce||he.payable!==ce.payable,"conflicting fallback fragments",`fragments[${oe}]`,he),ce=he,ae=ce.payable);return;case"function":de=this.#r;break;case"event":de=this.#t;break;case"error":de=this.#e;break;default:return}const le=he.format();de.has(le)||de.set(le,he)}),this.deploy||(0,_.defineProperties)(this,{deploy:k.ConstructorFragment.from("constructor()")}),(0,_.defineProperties)(this,{fallback:ce,receive:ae})}format(J){const te=J?"minimal":"full";return this.fragments.map(ce=>ce.format(te))}formatJson(){const J=this.fragments.map(te=>te.format("json"));return JSON.stringify(J.map(te=>JSON.parse(te)))}getAbiCoder(){return A.AbiCoder.defaultAbiCoder()}#i(J,te,se){if((0,_.isHexString)(J)){const ae=J.toLowerCase();for(const he of this.#r.values())if(ae===he.selector)return he;return null}if(J.indexOf("(")===-1){const ae=[];for(const[he,oe]of this.#r)he.split("(")[0]===J&&ae.push(oe);if(te){const he=te.length>0?te[te.length-1]:null;let oe=te.length,de=!0;P.Typed.isTyped(he)&&he.type==="overrides"&&(de=!1,oe--);for(let le=ae.length-1;le>=0;le--){const be=ae[le].inputs.length;be!==oe&&(!de||be!==oe-1)&&ae.splice(le,1)}for(let le=ae.length-1;le>=0;le--){const be=ae[le].inputs;for(let pe=0;pe<te.length;pe++)if(P.Typed.isTyped(te[pe])){if(pe>=be.length){if(te[pe].type==="overrides")continue;ae.splice(le,1);break}if(te[pe].type!==be[pe].baseType){ae.splice(le,1);break}}}}if(ae.length===1&&te&&te.length!==ae[0].inputs.length){const he=te[te.length-1];(he==null||Array.isArray(he)||typeof he!="object")&&ae.splice(0,1)}if(ae.length===0)return null;if(ae.length>1&&se){const he=ae.map(oe=>JSON.stringify(oe.format())).join(", ");(0,_.assertArgument)(!1,`ambiguous function description (i.e. matches ${he})`,"key",J)}return ae[0]}const ce=this.#r.get(k.FunctionFragment.from(J).format());return ce||null}getFunctionName(J){const te=this.#i(J,null,!1);return(0,_.assertArgument)(te,"no matching function","key",J),te.name}hasFunction(J){return!!this.#i(J,null,!1)}getFunction(J,te){return this.#i(J,te||null,!0)}forEachFunction(J){const te=Array.from(this.#r.keys());te.sort((se,ce)=>se.localeCompare(ce));for(let se=0;se<te.length;se++){const ce=te[se];J(this.#r.get(ce),se)}}#s(J,te,se){if((0,_.isHexString)(J)){const ae=J.toLowerCase();for(const he of this.#t.values())if(ae===he.topicHash)return he;return null}if(J.indexOf("(")===-1){const ae=[];for(const[he,oe]of this.#t)he.split("(")[0]===J&&ae.push(oe);if(te){for(let he=ae.length-1;he>=0;he--)ae[he].inputs.length<te.length&&ae.splice(he,1);for(let he=ae.length-1;he>=0;he--){const oe=ae[he].inputs;for(let de=0;de<te.length;de++)if(P.Typed.isTyped(te[de])&&te[de].type!==oe[de].baseType){ae.splice(he,1);break}}}if(ae.length===0)return null;if(ae.length>1&&se){const he=ae.map(oe=>JSON.stringify(oe.format())).join(", ");(0,_.assertArgument)(!1,`ambiguous event description (i.e. matches ${he})`,"key",J)}return ae[0]}const ce=this.#t.get(k.EventFragment.from(J).format());return ce||null}getEventName(J){const te=this.#s(J,null,!1);return(0,_.assertArgument)(te,"no matching event","key",J),te.name}hasEvent(J){return!!this.#s(J,null,!1)}getEvent(J,te){return this.#s(J,te||null,!0)}forEachEvent(J){const te=Array.from(this.#t.keys());te.sort((se,ce)=>se.localeCompare(ce));for(let se=0;se<te.length;se++){const ce=te[se];J(this.#t.get(ce),se)}}getError(J,te){if((0,_.isHexString)(J)){const ce=J.toLowerCase();if(D[ce])return k.ErrorFragment.from(D[ce].signature);for(const ae of this.#e.values())if(ce===ae.selector)return ae;return null}if(J.indexOf("(")===-1){const ce=[];for(const[ae,he]of this.#e)ae.split("(")[0]===J&&ce.push(he);if(ce.length===0)return J==="Error"?k.ErrorFragment.from("error Error(string)"):J==="Panic"?k.ErrorFragment.from("error Panic(uint256)"):null;if(ce.length>1){const ae=ce.map(he=>JSON.stringify(he.format())).join(", ");(0,_.assertArgument)(!1,`ambiguous error description (i.e. ${ae})`,"name",J)}return ce[0]}if(J=k.ErrorFragment.from(J).format(),J==="Error(string)")return k.ErrorFragment.from("error Error(string)");if(J==="Panic(uint256)")return k.ErrorFragment.from("error Panic(uint256)");const se=this.#e.get(J);return se||null}forEachError(J){const te=Array.from(this.#e.keys());te.sort((se,ce)=>se.localeCompare(ce));for(let se=0;se<te.length;se++){const ce=te[se];J(this.#e.get(ce),se)}}_decodeParams(J,te){return this.#n.decode(J,te)}_encodeParams(J,te){return this.#n.encode(J,te)}encodeDeploy(J){return this._encodeParams(this.deploy.inputs,J||[])}decodeErrorResult(J,te){if(typeof J=="string"){const se=this.getError(J);(0,_.assertArgument)(se,"unknown error","fragment",J),J=se}return(0,_.assertArgument)((0,_.dataSlice)(te,0,4)===J.selector,`data signature does not match error ${J.name}.`,"data",te),this._decodeParams(J.inputs,(0,_.dataSlice)(te,4))}encodeErrorResult(J,te){if(typeof J=="string"){const se=this.getError(J);(0,_.assertArgument)(se,"unknown error","fragment",J),J=se}return(0,_.concat)([J.selector,this._encodeParams(J.inputs,te||[])])}decodeFunctionData(J,te){if(typeof J=="string"){const se=this.getFunction(J);(0,_.assertArgument)(se,"unknown function","fragment",J),J=se}return(0,_.assertArgument)((0,_.dataSlice)(te,0,4)===J.selector,`data signature does not match function ${J.name}.`,"data",te),this._decodeParams(J.inputs,(0,_.dataSlice)(te,4))}encodeFunctionData(J,te){if(typeof J=="string"){const se=this.getFunction(J);(0,_.assertArgument)(se,"unknown function","fragment",J),J=se}return(0,_.concat)([J.selector,this._encodeParams(J.inputs,te||[])])}decodeFunctionResult(J,te){if(typeof J=="string"){const ae=this.getFunction(J);(0,_.assertArgument)(ae,"unknown function","fragment",J),J=ae}let se="invalid length for result data";const ce=(0,_.getBytesCopy)(te);if(ce.length%32===0)try{return this.#n.decode(J.outputs,ce)}catch{se="could not decode result data"}(0,_.assert)(!1,se,"BAD_DATA",{value:(0,_.hexlify)(ce),info:{method:J.name,signature:J.format()}})}makeError(J,te){const se=(0,_.getBytes)(J,"data"),ce=A.AbiCoder.getBuiltinCallException("call",te,se);if(ce.message.startsWith("execution reverted (unknown custom error)")){const oe=(0,_.hexlify)(se.slice(0,4)),de=this.getError(oe);if(de)try{const le=this.#n.decode(de.inputs,se.slice(4));ce.revert={name:de.name,signature:de.format(),args:le},ce.reason=ce.revert.signature,ce.message=`execution reverted: ${ce.reason}`}catch{ce.message="execution reverted (coult not decode custom error)"}}const he=this.parseTransaction(te);return he&&(ce.invocation={method:he.name,signature:he.signature,args:he.args}),ce}encodeFunctionResult(J,te){if(typeof J=="string"){const se=this.getFunction(J);(0,_.assertArgument)(se,"unknown function","fragment",J),J=se}return(0,_.hexlify)(this.#n.encode(J.outputs,te||[]))}encodeFilterTopics(J,te){if(typeof J=="string"){const ae=this.getEvent(J);(0,_.assertArgument)(ae,"unknown event","eventFragment",J),J=ae}(0,_.assert)(te.length<=J.inputs.length,`too many arguments for ${J.format()}`,"UNEXPECTED_ARGUMENT",{count:te.length,expectedCount:J.inputs.length});const se=[];J.anonymous||se.push(J.topicHash);const ce=(ae,he)=>ae.type==="string"?(0,w.id)(he):ae.type==="bytes"?(0,v.keccak256)((0,_.hexlify)(he)):(ae.type==="bool"&&typeof he=="boolean"?he=he?"0x01":"0x00":ae.type.match(/^u?int/)?he=(0,_.toBeHex)(he):ae.type.match(/^bytes/)?he=(0,_.zeroPadBytes)(he,32):ae.type==="address"&&this.#n.encode(["address"],[he]),(0,_.zeroPadValue)((0,_.hexlify)(he),32));for(te.forEach((ae,he)=>{const oe=J.inputs[he];if(!oe.indexed){(0,_.assertArgument)(ae==null,"cannot filter non-indexed parameters; must be null","contract."+oe.name,ae);return}ae==null?se.push(null):oe.baseType==="array"||oe.baseType==="tuple"?(0,_.assertArgument)(!1,"filtering with tuples or arrays not supported","contract."+oe.name,ae):Array.isArray(ae)?se.push(ae.map(de=>ce(oe,de))):se.push(ce(oe,ae))});se.length&&se[se.length-1]===null;)se.pop();return se}encodeEventLog(J,te){if(typeof J=="string"){const he=this.getEvent(J);(0,_.assertArgument)(he,"unknown event","eventFragment",J),J=he}const se=[],ce=[],ae=[];return J.anonymous||se.push(J.topicHash),(0,_.assertArgument)(te.length===J.inputs.length,"event arguments/values mismatch","values",te),J.inputs.forEach((he,oe)=>{const de=te[oe];if(he.indexed)if(he.type==="string")se.push((0,w.id)(de));else if(he.type==="bytes")se.push((0,v.keccak256)(de));else{if(he.baseType==="tuple"||he.baseType==="array")throw new Error("not implemented");se.push(this.#n.encode([he.type],[de]))}else ce.push(he),ae.push(de)}),{data:this.#n.encode(ce,ae),topics:se}}decodeEventLog(J,te,se){if(typeof J=="string"){const Z=this.getEvent(J);(0,_.assertArgument)(Z,"unknown event","eventFragment",J),J=Z}if(se!=null&&!J.anonymous){const Z=J.topicHash;(0,_.assertArgument)((0,_.isHexString)(se[0],32)&&se[0].toLowerCase()===Z,"fragment/topic mismatch","topics[0]",se[0]),se=se.slice(1)}const ce=[],ae=[],he=[];J.inputs.forEach((Z,U)=>{Z.indexed?Z.type==="string"||Z.type==="bytes"||Z.baseType==="tuple"||Z.baseType==="array"?(ce.push(k.ParamType.from({type:"bytes32",name:Z.name})),he.push(!0)):(ce.push(Z),he.push(!1)):(ae.push(Z),he.push(!1))});const oe=se!=null?this.#n.decode(ce,(0,_.concat)(se)):null,de=this.#n.decode(ae,te,!0),le=[],be=[];let pe=0,fe=0;return J.inputs.forEach((Z,U)=>{let S=null;if(Z.indexed)if(oe==null)S=new O(null);else if(he[U])S=new O(oe[fe++]);else try{S=oe[fe++]}catch(C){S=C}else try{S=de[pe++]}catch(C){S=C}le.push(S),be.push(Z.name||null)}),E.Result.fromItems(le,be)}parseTransaction(J){const te=(0,_.getBytes)(J.data,"tx.data"),se=(0,_.getBigInt)(J.value!=null?J.value:0,"tx.value"),ce=this.getFunction((0,_.hexlify)(te.slice(0,4)));if(!ce)return null;const ae=this.#n.decode(ce.inputs,te.slice(4));return new q(ce,ce.selector,ae,se)}parseCallResult(J){throw new Error("@TODO")}parseLog(J){const te=this.getEvent(J.topics[0]);return!te||te.anonymous?null:new N(te,te.topicHash,this.decodeEventLog(te,J.data,J.topics))}parseError(J){const te=(0,_.hexlify)(J),se=this.getError((0,_.dataSlice)(te,0,4));if(!se)return null;const ce=this.#n.decode(se.inputs,(0,_.dataSlice)(te,4));return new B(se,se.selector,ce)}static from(J){return J instanceof V?J:typeof J=="string"?new V(JSON.parse(J)):typeof J.format=="function"?new V(J.format("json")):new V(J)}}b.Interface=V}(_interface)),_interface}var hasRequiredAbi;function requireAbi(){return hasRequiredAbi||(hasRequiredAbi=1,function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.Typed=b.Result=b.TransactionDescription=b.LogDescription=b.ErrorDescription=b.Interface=b.Indexed=b.checkResultErrors=b.StructFragment=b.ParamType=b.NamedFragment=b.FunctionFragment=b.Fragment=b.FallbackFragment=b.EventFragment=b.ErrorFragment=b.ConstructorFragment=b.encodeBytes32String=b.decodeBytes32String=b.AbiCoder=void 0;var v=requireAbiCoder();Object.defineProperty(b,"AbiCoder",{enumerable:!0,get:function(){return v.AbiCoder}});var w=requireBytes32();Object.defineProperty(b,"decodeBytes32String",{enumerable:!0,get:function(){return w.decodeBytes32String}}),Object.defineProperty(b,"encodeBytes32String",{enumerable:!0,get:function(){return w.encodeBytes32String}});var _=requireFragments();Object.defineProperty(b,"ConstructorFragment",{enumerable:!0,get:function(){return _.ConstructorFragment}}),Object.defineProperty(b,"ErrorFragment",{enumerable:!0,get:function(){return _.ErrorFragment}}),Object.defineProperty(b,"EventFragment",{enumerable:!0,get:function(){return _.EventFragment}}),Object.defineProperty(b,"FallbackFragment",{enumerable:!0,get:function(){return _.FallbackFragment}}),Object.defineProperty(b,"Fragment",{enumerable:!0,get:function(){return _.Fragment}}),Object.defineProperty(b,"FunctionFragment",{enumerable:!0,get:function(){return _.FunctionFragment}}),Object.defineProperty(b,"NamedFragment",{enumerable:!0,get:function(){return _.NamedFragment}}),Object.defineProperty(b,"ParamType",{enumerable:!0,get:function(){return _.ParamType}}),Object.defineProperty(b,"StructFragment",{enumerable:!0,get:function(){return _.StructFragment}});var A=require_interface();Object.defineProperty(b,"checkResultErrors",{enumerable:!0,get:function(){return A.checkResultErrors}}),Object.defineProperty(b,"Indexed",{enumerable:!0,get:function(){return A.Indexed}}),Object.defineProperty(b,"Interface",{enumerable:!0,get:function(){return A.Interface}}),Object.defineProperty(b,"ErrorDescription",{enumerable:!0,get:function(){return A.ErrorDescription}}),Object.defineProperty(b,"LogDescription",{enumerable:!0,get:function(){return A.LogDescription}}),Object.defineProperty(b,"TransactionDescription",{enumerable:!0,get:function(){return A.TransactionDescription}}),Object.defineProperty(b,"Result",{enumerable:!0,get:function(){return A.Result}});var E=requireTyped();Object.defineProperty(b,"Typed",{enumerable:!0,get:function(){return E.Typed}})}(abi)),abi}var contract$1={},contract={},provider={},hasRequiredProvider;function requireProvider(){if(hasRequiredProvider)return provider;hasRequiredProvider=1,Object.defineProperty(provider,"__esModule",{value:!0}),provider.TransactionResponse=provider.TransactionReceipt=provider.Log=provider.Block=provider.copyRequest=provider.FeeData=void 0;const b=requireUtils$3(),v=requireTransaction(),w=BigInt(0);function _(ee){return ee??null}function A(ee){return ee==null?null:ee.toString()}class E{gasPrice;maxFeePerGas;maxPriorityFeePerGas;constructor(J,te,se){(0,b.defineProperties)(this,{gasPrice:_(J),maxFeePerGas:_(te),maxPriorityFeePerGas:_(se)})}toJSON(){const{gasPrice:J,maxFeePerGas:te,maxPriorityFeePerGas:se}=this;return{_type:"FeeData",gasPrice:A(J),maxFeePerGas:A(te),maxPriorityFeePerGas:A(se)}}}provider.FeeData=E;function k(ee){const J={};ee.to&&(J.to=ee.to),ee.from&&(J.from=ee.from),ee.data&&(J.data=(0,b.hexlify)(ee.data));const te="chainId,gasLimit,gasPrice,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const ce of te)!(ce in ee)||ee[ce]==null||(J[ce]=(0,b.getBigInt)(ee[ce],`request.${ce}`));const se="type,nonce".split(/,/);for(const ce of se)!(ce in ee)||ee[ce]==null||(J[ce]=(0,b.getNumber)(ee[ce],`request.${ce}`));return ee.accessList&&(J.accessList=(0,v.accessListify)(ee.accessList)),"blockTag"in ee&&(J.blockTag=ee.blockTag),"enableCcipRead"in ee&&(J.enableCcipRead=!!ee.enableCcipRead),"customData"in ee&&(J.customData=ee.customData),J}provider.copyRequest=k;class P{provider;number;hash;timestamp;parentHash;nonce;difficulty;gasLimit;gasUsed;miner;extraData;baseFeePerGas;#e;constructor(J,te){this.#e=J.transactions.map(se=>typeof se!="string"?new B(se,te):se),(0,b.defineProperties)(this,{provider:te,hash:_(J.hash),number:J.number,timestamp:J.timestamp,parentHash:J.parentHash,nonce:J.nonce,difficulty:J.difficulty,gasLimit:J.gasLimit,gasUsed:J.gasUsed,miner:J.miner,extraData:J.extraData,baseFeePerGas:_(J.baseFeePerGas)})}get transactions(){return this.#e.map(J=>typeof J=="string"?J:J.hash)}get prefetchedTransactions(){const J=this.#e.slice();return J.length===0?[]:((0,b.assert)(typeof J[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),J)}toJSON(){const{baseFeePerGas:J,difficulty:te,extraData:se,gasLimit:ce,gasUsed:ae,hash:he,miner:oe,nonce:de,number:le,parentHash:be,timestamp:pe,transactions:fe}=this;return{_type:"Block",baseFeePerGas:A(J),difficulty:A(te),extraData:se,gasLimit:A(ce),gasUsed:A(ae),hash:he,miner:oe,nonce:de,number:le,parentHash:be,timestamp:pe,transactions:fe}}[Symbol.iterator](){let J=0;const te=this.transactions;return{next:()=>J<this.length?{value:te[J++],done:!1}:{value:void 0,done:!0}}}get length(){return this.#e.length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(J){let te;if(typeof J=="number")te=this.#e[J];else{const se=J.toLowerCase();for(const ce of this.#e)if(typeof ce=="string"){if(ce!==se)continue;te=ce;break}else{if(ce.hash===se)continue;te=ce;break}}if(te==null)throw new Error("no such tx");return typeof te=="string"?await this.provider.getTransaction(te):te}getPrefetchedTransaction(J){const te=this.prefetchedTransactions;if(typeof J=="number")return te[J];J=J.toLowerCase();for(const se of te)if(se.hash===J)return se;(0,b.assertArgument)(!1,"no matching transaction","indexOrHash",J)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return O(this)}}provider.Block=P;class N{provider;transactionHash;blockHash;blockNumber;removed;address;data;topics;index;transactionIndex;constructor(J,te){this.provider=te;const se=Object.freeze(J.topics.slice());(0,b.defineProperties)(this,{transactionHash:J.transactionHash,blockHash:J.blockHash,blockNumber:J.blockNumber,removed:J.removed,address:J.address,data:J.data,topics:se,index:J.index,transactionIndex:J.transactionIndex})}toJSON(){const{address:J,blockHash:te,blockNumber:se,data:ce,index:ae,removed:he,topics:oe,transactionHash:de,transactionIndex:le}=this;return{_type:"log",address:J,blockHash:te,blockNumber:se,data:ce,index:ae,removed:he,topics:oe,transactionHash:de,transactionIndex:le}}async getBlock(){const J=await this.provider.getBlock(this.blockHash);return(0,b.assert)(!!J,"failed to find transaction","UNKNOWN_ERROR",{}),J}async getTransaction(){const J=await this.provider.getTransaction(this.transactionHash);return(0,b.assert)(!!J,"failed to find transaction","UNKNOWN_ERROR",{}),J}async getTransactionReceipt(){const J=await this.provider.getTransactionReceipt(this.transactionHash);return(0,b.assert)(!!J,"failed to find transaction receipt","UNKNOWN_ERROR",{}),J}removedEvent(){return V(this)}}provider.Log=N;class q{provider;to;from;contractAddress;hash;index;blockHash;blockNumber;logsBloom;gasUsed;cumulativeGasUsed;gasPrice;type;status;root;#e;constructor(J,te){this.#e=Object.freeze(J.logs.map(ce=>new N(ce,te)));let se=w;J.effectiveGasPrice!=null?se=J.effectiveGasPrice:J.gasPrice!=null&&(se=J.gasPrice),(0,b.defineProperties)(this,{provider:te,to:J.to,from:J.from,contractAddress:J.contractAddress,hash:J.hash,index:J.index,blockHash:J.blockHash,blockNumber:J.blockNumber,logsBloom:J.logsBloom,gasUsed:J.gasUsed,cumulativeGasUsed:J.cumulativeGasUsed,gasPrice:se,type:J.type,status:J.status,root:J.root})}get logs(){return this.#e}toJSON(){const{to:J,from:te,contractAddress:se,hash:ce,index:ae,blockHash:he,blockNumber:oe,logsBloom:de,logs:le,status:be,root:pe}=this;return{_type:"TransactionReceipt",blockHash:he,blockNumber:oe,contractAddress:se,cumulativeGasUsed:A(this.cumulativeGasUsed),from:te,gasPrice:A(this.gasPrice),gasUsed:A(this.gasUsed),hash:ce,index:ae,logs:le,logsBloom:de,root:pe,status:be,to:J}}get length(){return this.logs.length}[Symbol.iterator](){let J=0;return{next:()=>J<this.length?{value:this.logs[J++],done:!1}:{value:void 0,done:!0}}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){const J=await this.provider.getBlock(this.blockHash);if(J==null)throw new Error("TODO");return J}async getTransaction(){const J=await this.provider.getTransaction(this.hash);if(J==null)throw new Error("TODO");return J}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return D(this)}reorderedEvent(J){return(0,b.assert)(!J||J.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),I(this,J)}}provider.TransactionReceipt=q;class B{provider;blockNumber;blockHash;index;hash;type;to;from;nonce;gasLimit;gasPrice;maxPriorityFeePerGas;maxFeePerGas;data;value;chainId;signature;accessList;#e;constructor(J,te){this.provider=te,this.blockNumber=J.blockNumber!=null?J.blockNumber:null,this.blockHash=J.blockHash!=null?J.blockHash:null,this.hash=J.hash,this.index=J.index,this.type=J.type,this.from=J.from,this.to=J.to||null,this.gasLimit=J.gasLimit,this.nonce=J.nonce,this.data=J.data,this.value=J.value,this.gasPrice=J.gasPrice,this.maxPriorityFeePerGas=J.maxPriorityFeePerGas!=null?J.maxPriorityFeePerGas:null,this.maxFeePerGas=J.maxFeePerGas!=null?J.maxFeePerGas:null,this.chainId=J.chainId,this.signature=J.signature,this.accessList=J.accessList!=null?J.accessList:null,this.#e=-1}toJSON(){const{blockNumber:J,blockHash:te,index:se,hash:ce,type:ae,to:he,from:oe,nonce:de,data:le,signature:be,accessList:pe}=this;return{_type:"TransactionReceipt",accessList:pe,blockNumber:J,blockHash:te,chainId:A(this.chainId),data:le,from:oe,gasLimit:A(this.gasLimit),gasPrice:A(this.gasPrice),hash:ce,maxFeePerGas:A(this.maxFeePerGas),maxPriorityFeePerGas:A(this.maxPriorityFeePerGas),nonce:de,signature:be,to:he,index:se,type:ae,value:A(this.value)}}async getBlock(){let J=this.blockNumber;if(J==null){const se=await this.getTransaction();se&&(J=se.blockNumber)}if(J==null)return null;const te=this.provider.getBlock(J);if(te==null)throw new Error("TODO");return te}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:te,blockNumber:se}=await(0,b.resolveProperties)({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return te==null||te.blockNumber==null?0:se-te.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(J,te){const se=J??1,ce=te??0;let ae=this.#e,he=-1,oe=ae===-1;const de=async()=>{if(oe)return null;const{blockNumber:fe,nonce:Z}=await(0,b.resolveProperties)({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(Z<this.nonce){ae=fe;return}if(oe)return null;const U=await this.getTransaction();if(!(U&&U.blockNumber!=null))for(he===-1&&(he=ae-3,he<this.#e&&(he=this.#e));he<=fe;){if(oe)return null;const S=await this.provider.getBlock(he,!0);if(S==null)return;for(const C of S)if(C===this.hash)return;for(let C=0;C<S.length;C++){const F=await S.getTransaction(C);if(F.from===this.from&&F.nonce===this.nonce){if(oe)return null;const X=await this.provider.getTransactionReceipt(F.hash);if(X==null||fe-X.blockNumber+1<se)return;let re="replaced";F.data===this.data&&F.to===this.to&&F.value===this.value?re="repriced":F.data==="0x"&&F.from===F.to&&F.value===w&&(re="cancelled"),(0,b.assert)(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:re==="replaced"||re==="cancelled",reason:re,replacement:F.replaceableTransaction(ae),hash:F.hash,receipt:X})}}he++}},le=fe=>{if(fe==null||fe.status!==0)return fe;(0,b.assert)(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:fe.to,from:fe.from,data:""},receipt:fe})},be=await this.provider.getTransactionReceipt(this.hash);if(se===0)return le(be);if(be){if(await be.confirmations()>=se)return le(be)}else if(await de(),se===0)return null;return await new Promise((fe,Z)=>{const U=[],S=()=>{U.forEach(F=>F())};if(U.push(()=>{oe=!0}),ce>0){const F=setTimeout(()=>{S(),Z((0,b.makeError)("wait for transaction timeout","TIMEOUT"))},ce);U.push(()=>{clearTimeout(F)})}const C=async F=>{if(await F.confirmations()>=se){S();try{fe(le(F))}catch(X){Z(X)}}};if(U.push(()=>{this.provider.off(this.hash,C)}),this.provider.on(this.hash,C),ae>=0){const F=async()=>{try{await de()}catch(X){if((0,b.isError)(X,"TRANSACTION_REPLACED")){S(),Z(X);return}}oe||this.provider.once("block",F)};U.push(()=>{this.provider.off("block",F)}),this.provider.once("block",F)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}removedEvent(){return(0,b.assert)(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),D(this)}reorderedEvent(J){return(0,b.assert)(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),(0,b.assert)(!J||J.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),I(this,J)}replaceableTransaction(J){(0,b.assertArgument)(Number.isInteger(J)&&J>=0,"invalid startBlock","startBlock",J);const te=new B(this,this.provider);return te.#e=J,te}}provider.TransactionResponse=B;function O(ee){return{orphan:"drop-block",hash:ee.hash,number:ee.number}}function I(ee,J){return{orphan:"reorder-transaction",tx:ee,other:J}}function D(ee){return{orphan:"drop-transaction",tx:ee}}function V(ee){return{orphan:"drop-log",log:{transactionHash:ee.transactionHash,blockHash:ee.blockHash,blockNumber:ee.blockNumber,address:ee.address,data:ee.data,topics:Object.freeze(ee.topics.slice()),index:ee.index}}}return provider}var wrappers={},hasRequiredWrappers;function requireWrappers(){if(hasRequiredWrappers)return wrappers;hasRequiredWrappers=1,Object.defineProperty(wrappers,"__esModule",{value:!0}),wrappers.ContractEventPayload=wrappers.ContractUnknownEventPayload=wrappers.ContractTransactionResponse=wrappers.ContractTransactionReceipt=wrappers.UndecodedEventLog=wrappers.EventLog=void 0;const b=requireProvider(),v=requireUtils$3();class w extends b.Log{interface;fragment;args;constructor(q,B,O){super(q,q.provider);const I=B.decodeEventLog(O,q.data,q.topics);(0,v.defineProperties)(this,{args:I,fragment:O,interface:B})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}wrappers.EventLog=w;class _ extends b.Log{error;constructor(q,B){super(q,q.provider),(0,v.defineProperties)(this,{error:B})}}wrappers.UndecodedEventLog=_;class A extends b.TransactionReceipt{#e;constructor(q,B,O){super(O,B),this.#e=q}get logs(){return super.logs.map(q=>{const B=q.topics.length?this.#e.getEvent(q.topics[0]):null;if(B)try{return new w(q,this.#e,B)}catch(O){return new _(q,O)}return q})}}wrappers.ContractTransactionReceipt=A;class E extends b.TransactionResponse{#e;constructor(q,B,O){super(O,B),this.#e=q}async wait(q){const B=await super.wait(q);return B==null?null:new A(this.#e,this.provider,B)}}wrappers.ContractTransactionResponse=E;class k extends v.EventPayload{log;constructor(q,B,O,I){super(q,B,O),(0,v.defineProperties)(this,{log:I})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}wrappers.ContractUnknownEventPayload=k;class P extends k{constructor(q,B,O,I,D){super(q,B,O,new w(D,q.interface,I));const V=q.interface.decodeEventLog(I,this.log.data,this.log.topics);(0,v.defineProperties)(this,{args:V,fragment:I})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}return wrappers.ContractEventPayload=P,wrappers}var hasRequiredContract$1;function requireContract$1(){if(hasRequiredContract$1)return contract;hasRequiredContract$1=1,Object.defineProperty(contract,"__esModule",{value:!0}),contract.Contract=contract.BaseContract=contract.resolveArgs=contract.copyOverrides=void 0;const b=requireAbi(),v=requireAddress$2(),w=requireProvider(),_=requireUtils$3(),A=requireWrappers(),E=BigInt(0);function k(re){return re&&typeof re.call=="function"}function P(re){return re&&typeof re.estimateGas=="function"}function N(re){return re&&typeof re.resolveName=="function"}function q(re){return re&&typeof re.sendTransaction=="function"}function B(re){if(re!=null){if(N(re))return re;if(re.provider)return re.provider}}class O{#e;fragment;constructor(ie,Q,ne){if((0,_.defineProperties)(this,{fragment:Q}),Q.inputs.length<ne.length)throw new Error("too many arguments");const L=I(ie.runner,"resolveName"),ue=N(L)?L:null;this.#e=async function(){const Ae=await Promise.all(Q.inputs.map((Re,Pe)=>ne[Pe]==null?null:Re.walkAsync(ne[Pe],(ge,_e)=>ge==="address"?Array.isArray(_e)?Promise.all(_e.map(ke=>(0,v.resolveAddress)(ke,ue))):(0,v.resolveAddress)(_e,ue):_e)));return ie.interface.encodeFilterTopics(Q,Ae)}()}getTopicFilter(){return this.#e}}function I(re,ie){return re==null?null:typeof re[ie]=="function"?re:re.provider&&typeof re.provider[ie]=="function"?re.provider:null}function D(re){return re==null?null:re.provider||null}async function V(re,ie){const Q=b.Typed.dereference(re,"overrides");(0,_.assertArgument)(typeof Q=="object","invalid overrides parameter","overrides",re);const ne=(0,w.copyRequest)(Q);return(0,_.assertArgument)(ne.to==null||(ie||[]).indexOf("to")>=0,"cannot override to","overrides.to",ne.to),(0,_.assertArgument)(ne.data==null||(ie||[]).indexOf("data")>=0,"cannot override data","overrides.data",ne.data),ne.from&&(ne.from=ne.from),ne}contract.copyOverrides=V;async function ee(re,ie,Q){const ne=I(re,"resolveName"),L=N(ne)?ne:null;return await Promise.all(ie.map((ue,Ae)=>ue.walkAsync(Q[Ae],(Re,Pe)=>(Pe=b.Typed.dereference(Pe,Re),Re==="address"?(0,v.resolveAddress)(Pe,L):Pe))))}contract.resolveArgs=ee;function J(re){const ie=async function(Ae){const Re=await V(Ae,["data"]);Re.to=await re.getAddress(),Re.from&&(Re.from=await(0,v.resolveAddress)(Re.from,B(re.runner)));const Pe=re.interface,xe=(0,_.getBigInt)(Re.value||E,"overrides.value")===E,ge=(Re.data||"0x")==="0x";Pe.fallback&&!Pe.fallback.payable&&Pe.receive&&!ge&&!xe&&(0,_.assertArgument)(!1,"cannot send data to receive or send value to non-payable fallback","overrides",Ae),(0,_.assertArgument)(Pe.fallback||ge,"cannot send data to receive-only contract","overrides.data",Re.data);const _e=Pe.receive||Pe.fallback&&Pe.fallback.payable;return(0,_.assertArgument)(_e||xe,"cannot send value to non-payable fallback","overrides.value",Re.value),(0,_.assertArgument)(Pe.fallback||ge,"cannot send data to receive-only contract","overrides.data",Re.data),Re},Q=async function(Ae){const Re=I(re.runner,"call");(0,_.assert)(k(Re),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const Pe=await ie(Ae);try{return await Re.call(Pe)}catch(xe){throw(0,_.isCallException)(xe)&&xe.data?re.interface.makeError(xe.data,Pe):xe}},ne=async function(Ae){const Re=re.runner;(0,_.assert)(q(Re),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const Pe=await Re.sendTransaction(await ie(Ae)),xe=D(re.runner);return new A.ContractTransactionResponse(re.interface,xe,Pe)},L=async function(Ae){const Re=I(re.runner,"estimateGas");return(0,_.assert)(P(Re),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await Re.estimateGas(await ie(Ae))},ue=async Ae=>await ne(Ae);return(0,_.defineProperties)(ue,{_contract:re,estimateGas:L,populateTransaction:ie,send:ne,staticCall:Q}),ue}function te(re,ie){const Q=function(...xe){const ge=re.interface.getFunction(ie,xe);return(0,_.assert)(ge,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:ie,args:xe}}),ge},ne=async function(...xe){const ge=Q(...xe);let _e={};if(ge.inputs.length+1===xe.length&&(_e=await V(xe.pop()),_e.from&&(_e.from=await(0,v.resolveAddress)(_e.from,B(re.runner)))),ge.inputs.length!==xe.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const ke=await ee(re.runner,ge.inputs,xe);return Object.assign({},_e,await(0,_.resolveProperties)({to:re.getAddress(),data:re.interface.encodeFunctionData(ge,ke)}))},L=async function(...xe){const ge=await Re(...xe);return ge.length===1?ge[0]:ge},ue=async function(...xe){const ge=re.runner;(0,_.assert)(q(ge),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const _e=await ge.sendTransaction(await ne(...xe)),ke=D(re.runner);return new A.ContractTransactionResponse(re.interface,ke,_e)},Ae=async function(...xe){const ge=I(re.runner,"estimateGas");return(0,_.assert)(P(ge),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await ge.estimateGas(await ne(...xe))},Re=async function(...xe){const ge=I(re.runner,"call");(0,_.assert)(k(ge),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const _e=await ne(...xe);let ke="0x";try{ke=await ge.call(_e)}catch(Se){throw(0,_.isCallException)(Se)&&Se.data?re.interface.makeError(Se.data,_e):Se}const Ee=Q(...xe);return re.interface.decodeFunctionResult(Ee,ke)},Pe=async(...xe)=>Q(...xe).constant?await L(...xe):await ue(...xe);return(0,_.defineProperties)(Pe,{name:re.interface.getFunctionName(ie),_contract:re,_key:ie,getFragment:Q,estimateGas:Ae,populateTransaction:ne,send:ue,staticCall:L,staticCallResult:Re}),Object.defineProperty(Pe,"fragment",{configurable:!1,enumerable:!0,get:()=>{const xe=re.interface.getFunction(ie);return(0,_.assert)(xe,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:ie}}),xe}}),Pe}function se(re,ie){const Q=function(...L){const ue=re.interface.getEvent(ie,L);return(0,_.assert)(ue,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:ie,args:L}}),ue},ne=function(...L){return new O(re,Q(...L),L)};return(0,_.defineProperties)(ne,{name:re.interface.getEventName(ie),_contract:re,_key:ie,getFragment:Q}),Object.defineProperty(ne,"fragment",{configurable:!1,enumerable:!0,get:()=>{const L=re.interface.getEvent(ie);return(0,_.assert)(L,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:ie}}),L}}),ne}const ce=Symbol.for("_ethersInternal_contract"),ae=new WeakMap;function he(re,ie){ae.set(re[ce],ie)}function oe(re){return ae.get(re[ce])}function de(re){return re&&typeof re=="object"&&"getTopicFilter"in re&&typeof re.getTopicFilter=="function"&&re.fragment}async function le(re,ie){let Q,ne=null;if(Array.isArray(ie)){const ue=function(Ae){if((0,_.isHexString)(Ae,32))return Ae;const Re=re.interface.getEvent(Ae);return(0,_.assertArgument)(Re,"unknown fragment","name",Ae),Re.topicHash};Q=ie.map(Ae=>Ae==null?null:Array.isArray(Ae)?Ae.map(ue):ue(Ae))}else ie==="*"?Q=[null]:typeof ie=="string"?(0,_.isHexString)(ie,32)?Q=[ie]:(ne=re.interface.getEvent(ie),(0,_.assertArgument)(ne,"unknown fragment","event",ie),Q=[ne.topicHash]):de(ie)?Q=await ie.getTopicFilter():"fragment"in ie?(ne=ie.fragment,Q=[ne.topicHash]):(0,_.assertArgument)(!1,"unknown event name","event",ie);Q=Q.map(ue=>{if(ue==null)return null;if(Array.isArray(ue)){const Ae=Array.from(new Set(ue.map(Re=>Re.toLowerCase())).values());return Ae.length===1?Ae[0]:(Ae.sort(),Ae)}return ue.toLowerCase()});const L=Q.map(ue=>ue==null?"null":Array.isArray(ue)?ue.join("|"):ue).join("&");return{fragment:ne,tag:L,topics:Q}}async function be(re,ie){const{subs:Q}=oe(re);return Q.get((await le(re,ie)).tag)||null}async function pe(re,ie,Q){const ne=D(re.runner);(0,_.assert)(ne,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:ie});const{fragment:L,tag:ue,topics:Ae}=await le(re,Q),{addr:Re,subs:Pe}=oe(re);let xe=Pe.get(ue);if(!xe){const _e={address:Re||re,topics:Ae},ke=Ne=>{let ve=L;if(ve==null)try{ve=re.interface.getEvent(Ne.topics[0])}catch{}if(ve){const Ce=ve,Te=L?re.interface.decodeEventLog(L,Ne.data,Ne.topics):[];U(re,Q,Te,Le=>new A.ContractEventPayload(re,Le,Q,Ce,Ne))}else U(re,Q,[],Ce=>new A.ContractUnknownEventPayload(re,Ce,Q,Ne))};let Ee=[];xe={tag:ue,listeners:[],start:()=>{Ee.length||Ee.push(ne.on(_e,ke))},stop:async()=>{if(Ee.length==0)return;let Ne=Ee;Ee=[],await Promise.all(Ne),ne.off(_e,ke)}},Pe.set(ue,xe)}return xe}let fe=Promise.resolve();async function Z(re,ie,Q,ne){await fe;const L=await be(re,ie);if(!L)return!1;const ue=L.listeners.length;return L.listeners=L.listeners.filter(({listener:Ae,once:Re})=>{const Pe=Array.from(Q);ne&&Pe.push(ne(Re?null:Ae));try{Ae.call(re,...Pe)}catch{}return!Re}),L.listeners.length===0&&(L.stop(),oe(re).subs.delete(L.tag)),ue>0}async function U(re,ie,Q,ne){try{await fe}catch{}const L=Z(re,ie,Q,ne);return fe=L,await L}const S=["then"];class C{target;interface;runner;filters;[ce];fallback;constructor(ie,Q,ne,L){(0,_.assertArgument)(typeof ie=="string"||(0,v.isAddressable)(ie),"invalid value for Contract target","target",ie),ne==null&&(ne=null);const ue=b.Interface.from(Q);(0,_.defineProperties)(this,{target:ie,runner:ne,interface:ue}),Object.defineProperty(this,ce,{value:{}});let Ae,Re=null,Pe=null;if(L){const _e=D(ne);Pe=new A.ContractTransactionResponse(this.interface,_e,L)}let xe=new Map;if(typeof ie=="string")if((0,_.isHexString)(ie))Re=ie,Ae=Promise.resolve(ie);else{const _e=I(ne,"resolveName");if(!N(_e))throw(0,_.makeError)("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});Ae=_e.resolveName(ie).then(ke=>{if(ke==null)throw(0,_.makeError)("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:ie});return oe(this).addr=ke,ke})}else Ae=ie.getAddress().then(_e=>{if(_e==null)throw new Error("TODO");return oe(this).addr=_e,_e});he(this,{addrPromise:Ae,addr:Re,deployTx:Pe,subs:xe});const ge=new Proxy({},{get:(_e,ke,Ee)=>{if(typeof ke=="symbol"||S.indexOf(ke)>=0)return Reflect.get(_e,ke,Ee);try{return this.getEvent(ke)}catch(Se){if(!(0,_.isError)(Se,"INVALID_ARGUMENT")||Se.argument!=="key")throw Se}},has:(_e,ke)=>S.indexOf(ke)>=0?Reflect.has(_e,ke):Reflect.has(_e,ke)||this.interface.hasEvent(String(ke))});return(0,_.defineProperties)(this,{filters:ge}),(0,_.defineProperties)(this,{fallback:ue.receive||ue.fallback?J(this):null}),new Proxy(this,{get:(_e,ke,Ee)=>{if(typeof ke=="symbol"||ke in _e||S.indexOf(ke)>=0)return Reflect.get(_e,ke,Ee);try{return _e.getFunction(ke)}catch(Se){if(!(0,_.isError)(Se,"INVALID_ARGUMENT")||Se.argument!=="key")throw Se}},has:(_e,ke)=>typeof ke=="symbol"||ke in _e||S.indexOf(ke)>=0?Reflect.has(_e,ke):_e.interface.hasFunction(ke)})}connect(ie){return new C(this.target,this.interface,ie)}attach(ie){return new C(ie,this.interface,this.runner)}async getAddress(){return await oe(this).addrPromise}async getDeployedCode(){const ie=D(this.runner);(0,_.assert)(ie,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const Q=await ie.getCode(await this.getAddress());return Q==="0x"?null:Q}async waitForDeployment(){const ie=this.deploymentTransaction();if(ie)return await ie.wait(),this;if(await this.getDeployedCode()!=null)return this;const ne=D(this.runner);return(0,_.assert)(ne!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((L,ue)=>{const Ae=async()=>{try{if(await this.getDeployedCode()!=null)return L(this);ne.once("block",Ae)}catch(Re){ue(Re)}};Ae()})}deploymentTransaction(){return oe(this).deployTx}getFunction(ie){return typeof ie!="string"&&(ie=ie.format()),te(this,ie)}getEvent(ie){return typeof ie!="string"&&(ie=ie.format()),se(this,ie)}async queryTransaction(ie){throw new Error("@TODO")}async queryFilter(ie,Q,ne){Q==null&&(Q=0),ne==null&&(ne="latest");const{addr:L,addrPromise:ue}=oe(this),Ae=L||await ue,{fragment:Re,topics:Pe}=await le(this,ie),xe={address:Ae,topics:Pe,fromBlock:Q,toBlock:ne},ge=D(this.runner);return(0,_.assert)(ge,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await ge.getLogs(xe)).map(_e=>{let ke=Re;if(ke==null)try{ke=this.interface.getEvent(_e.topics[0])}catch{}if(ke)try{return new A.EventLog(_e,this.interface,ke)}catch(Ee){return new A.UndecodedEventLog(_e,Ee)}return new w.Log(_e,ge)})}async on(ie,Q){const ne=await pe(this,"on",ie);return ne.listeners.push({listener:Q,once:!1}),ne.start(),this}async once(ie,Q){const ne=await pe(this,"once",ie);return ne.listeners.push({listener:Q,once:!0}),ne.start(),this}async emit(ie,...Q){return await U(this,ie,Q,null)}async listenerCount(ie){if(ie){const L=await be(this,ie);return L?L.listeners.length:0}const{subs:Q}=oe(this);let ne=0;for(const{listeners:L}of Q.values())ne+=L.length;return ne}async listeners(ie){if(ie){const L=await be(this,ie);return L?L.listeners.map(({listener:ue})=>ue):[]}const{subs:Q}=oe(this);let ne=[];for(const{listeners:L}of Q.values())ne=ne.concat(L.map(({listener:ue})=>ue));return ne}async off(ie,Q){const ne=await be(this,ie);if(!ne)return this;if(Q){const L=ne.listeners.map(({listener:ue})=>ue).indexOf(Q);L>=0&&ne.listeners.splice(L,1)}return(Q==null||ne.listeners.length===0)&&(ne.stop(),oe(this).subs.delete(ne.tag)),this}async removeAllListeners(ie){if(ie){const Q=await be(this,ie);if(!Q)return this;Q.stop(),oe(this).subs.delete(Q.tag)}else{const{subs:Q}=oe(this);for(const{tag:ne,stop:L}of Q.values())L(),Q.delete(ne)}return this}async addListener(ie,Q){return await this.on(ie,Q)}async removeListener(ie,Q){return await this.off(ie,Q)}static buildClass(ie){class Q extends C{constructor(L,ue=null){super(L,ie,ue)}}return Q}static from(ie,Q,ne){return ne==null&&(ne=null),new this(ie,Q,ne)}}contract.BaseContract=C;function F(){return C}class X extends F(){}return contract.Contract=X,contract}var factory={},hasRequiredFactory;function requireFactory(){if(hasRequiredFactory)return factory;hasRequiredFactory=1,Object.defineProperty(factory,"__esModule",{value:!0}),factory.ContractFactory=void 0;const b=requireAbi(),v=requireAddress$2(),w=requireUtils$3(),_=requireContract$1();class A{interface;bytecode;runner;constructor(k,P,N){const q=b.Interface.from(k);P instanceof Uint8Array||(typeof P=="object"&&(P=P.object),P.startsWith("0x")||(P="0x"+P)),P=(0,w.hexlify)((0,w.getBytes)(P)),(0,w.defineProperties)(this,{bytecode:P,interface:q,runner:N||null})}attach(k){return new _.BaseContract(k,this.interface,this.runner)}async getDeployTransaction(...k){let P={};const N=this.interface.deploy;if(N.inputs.length+1===k.length&&(P=await(0,_.copyOverrides)(k.pop())),N.inputs.length!==k.length)throw new Error("incorrect number of arguments to constructor");const q=await(0,_.resolveArgs)(this.runner,N.inputs,k),B=(0,w.concat)([this.bytecode,this.interface.encodeDeploy(q)]);return Object.assign({},P,{data:B})}async deploy(...k){const P=await this.getDeployTransaction(...k);(0,w.assert)(this.runner&&typeof this.runner.sendTransaction=="function","factory runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const N=await this.runner.sendTransaction(P),q=(0,v.getCreateAddress)(N);return new _.BaseContract(q,this.interface,this.runner,N)}connect(k){return new A(this.interface,this.bytecode,k)}static fromSolidity(k,P){(0,w.assertArgument)(k!=null,"bad compiler output","output",k),typeof k=="string"&&(k=JSON.parse(k));const N=k.abi;let q="";return k.bytecode?q=k.bytecode:k.evm&&k.evm.bytecode&&(q=k.evm.bytecode),new this(N,q,P)}}return factory.ContractFactory=A,factory}var hasRequiredContract;function requireContract(){return hasRequiredContract||(hasRequiredContract=1,function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.UndecodedEventLog=b.EventLog=b.ContractTransactionResponse=b.ContractTransactionReceipt=b.ContractUnknownEventPayload=b.ContractEventPayload=b.ContractFactory=b.Contract=b.BaseContract=void 0;var v=requireContract$1();Object.defineProperty(b,"BaseContract",{enumerable:!0,get:function(){return v.BaseContract}}),Object.defineProperty(b,"Contract",{enumerable:!0,get:function(){return v.Contract}});var w=requireFactory();Object.defineProperty(b,"ContractFactory",{enumerable:!0,get:function(){return w.ContractFactory}});var _=requireWrappers();Object.defineProperty(b,"ContractEventPayload",{enumerable:!0,get:function(){return _.ContractEventPayload}}),Object.defineProperty(b,"ContractUnknownEventPayload",{enumerable:!0,get:function(){return _.ContractUnknownEventPayload}}),Object.defineProperty(b,"ContractTransactionReceipt",{enumerable:!0,get:function(){return _.ContractTransactionReceipt}}),Object.defineProperty(b,"ContractTransactionResponse",{enumerable:!0,get:function(){return _.ContractTransactionResponse}}),Object.defineProperty(b,"EventLog",{enumerable:!0,get:function(){return _.EventLog}}),Object.defineProperty(b,"UndecodedEventLog",{enumerable:!0,get:function(){return _.UndecodedEventLog}})}(contract$1)),contract$1}var providers={},abstractProvider={},ensResolver={},hasRequiredEnsResolver;function requireEnsResolver(){if(hasRequiredEnsResolver)return ensResolver;hasRequiredEnsResolver=1,Object.defineProperty(ensResolver,"__esModule",{value:!0}),ensResolver.EnsResolver=ensResolver.BasicMulticoinProviderPlugin=ensResolver.MulticoinProviderPlugin=void 0;const b=requireAddress$2(),v=requireConstants$1(),w=requireContract(),_=requireHash(),A=requireUtils$3();function E(I){return I.match(/^ipfs:\/\/ipfs\//i)?I=I.substring(12):I.match(/^ipfs:\/\//i)?I=I.substring(7):(0,A.assertArgument)(!1,"unsupported IPFS format","link",I),`https://gateway.ipfs.io/ipfs/${I}`}class k{name;constructor(D){(0,A.defineProperties)(this,{name:D})}connect(D){return this}supportsCoinType(D){return!1}async encodeAddress(D,V){throw new Error("unsupported coin")}async decodeAddress(D,V){throw new Error("unsupported coin")}}ensResolver.MulticoinProviderPlugin=k;const P="org.ethers.plugins.provider.BasicMulticoin";class N extends k{constructor(){super(P)}}ensResolver.BasicMulticoinProviderPlugin=N;const q=new RegExp("^(ipfs)://(.*)$","i"),B=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),q,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];class O{provider;address;name;#e;#t;constructor(D,V,ee){(0,A.defineProperties)(this,{provider:D,address:V,name:ee}),this.#e=null,this.#t=new w.Contract(V,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],D)}async supportsWildcard(){return this.#e==null&&(this.#e=(async()=>{try{return await this.#t.supportsInterface("0x9061b923")}catch(D){if((0,A.isError)(D,"CALL_EXCEPTION"))return!1;throw this.#e=null,D}})()),await this.#e}async#r(D,V){V=(V||[]).slice();const ee=this.#t.interface;V.unshift((0,_.namehash)(this.name));let J=null;await this.supportsWildcard()&&(J=ee.getFunction(D),(0,A.assert)(J,"missing fragment","UNKNOWN_ERROR",{info:{funcName:D}}),V=[(0,_.dnsEncode)(this.name),ee.encodeFunctionData(J,V)],D="resolve(bytes,bytes)"),V.push({enableCcipRead:!0});try{const te=await this.#t[D](...V);return J?ee.decodeFunctionResult(J,te)[0]:te}catch(te){if(!(0,A.isError)(te,"CALL_EXCEPTION"))throw te}return null}async getAddress(D){if(D==null&&(D=60),D===60)try{const te=await this.#r("addr(bytes32)");return te==null||te===v.ZeroAddress?null:te}catch(te){if((0,A.isError)(te,"CALL_EXCEPTION"))return null;throw te}if(D>=0&&D<2147483648){let te=D+2147483648;const se=await this.#r("addr(bytes32,uint)",[te]);if((0,A.isHexString)(se,20))return(0,b.getAddress)(se)}let V=null;for(const te of this.provider.plugins)if(te instanceof k&&te.supportsCoinType(D)){V=te;break}if(V==null)return null;const ee=await this.#r("addr(bytes32,uint)",[D]);if(ee==null||ee==="0x")return null;const J=await V.decodeAddress(D,ee);if(J!=null)return J;(0,A.assert)(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${D})`,info:{coinType:D,data:ee}})}async getText(D){const V=await this.#r("text(bytes32,string)",[D]);return V==null||V==="0x"?null:V}async getContentHash(){const D=await this.#r("contenthash(bytes32)");if(D==null||D==="0x")return null;const V=D.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(V){const J=V[1]==="e3010170"?"ipfs":"ipns",te=parseInt(V[4],16);if(V[5].length===te*2)return`${J}://${(0,A.encodeBase58)("0x"+V[2])}`}const ee=D.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(ee&&ee[1].length===64)return`bzz://${ee[1]}`;(0,A.assert)(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:D}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const D=[{type:"name",value:this.name}];try{const V=await this.getText("avatar");if(V==null)return D.push({type:"!avatar",value:""}),{url:null,linkage:D};D.push({type:"avatar",value:V});for(let ee=0;ee<B.length;ee++){const J=V.match(B[ee]);if(J==null)continue;const te=J[1].toLowerCase();switch(te){case"https":case"data":return D.push({type:"url",value:V}),{linkage:D,url:V};case"ipfs":{const se=E(V);return D.push({type:"ipfs",value:V}),D.push({type:"url",value:se}),{linkage:D,url:se}}case"erc721":case"erc1155":{const se=te==="erc721"?"tokenURI(uint256)":"uri(uint256)";D.push({type:te,value:V});const ce=await this.getAddress();if(ce==null)return D.push({type:"!owner",value:""}),{url:null,linkage:D};const ae=(J[2]||"").split("/");if(ae.length!==2)return D.push({type:`!${te}caip`,value:J[2]||""}),{url:null,linkage:D};const he=ae[1],oe=new w.Contract(ae[0],["function tokenURI(uint) view returns (string)","function ownerOf(uint) view returns (address)","function uri(uint) view returns (string)","function balanceOf(address, uint256) view returns (uint)"],this.provider);if(te==="erc721"){const fe=await oe.ownerOf(he);if(ce!==fe)return D.push({type:"!owner",value:fe}),{url:null,linkage:D};D.push({type:"owner",value:fe})}else if(te==="erc1155"){const fe=await oe.balanceOf(ce,he);if(!fe)return D.push({type:"!balance",value:"0"}),{url:null,linkage:D};D.push({type:"balance",value:fe.toString()})}let de=await oe[se](he);if(de==null||de==="0x")return D.push({type:"!metadata-url",value:""}),{url:null,linkage:D};D.push({type:"metadata-url-base",value:de}),te==="erc1155"&&(de=de.replace("{id}",(0,A.toBeHex)(he,32).substring(2)),D.push({type:"metadata-url-expanded",value:de})),de.match(/^ipfs:/i)&&(de=E(de)),D.push({type:"metadata-url",value:de});let le={};const be=await new A.FetchRequest(de).send();be.assertOk();try{le=be.bodyJson}catch{try{D.push({type:"!metadata",value:be.bodyText})}catch{const U=be.body;return U&&D.push({type:"!metadata",value:(0,A.hexlify)(U)}),{url:null,linkage:D}}return{url:null,linkage:D}}if(!le)return D.push({type:"!metadata",value:""}),{url:null,linkage:D};D.push({type:"metadata",value:JSON.stringify(le)});let pe=le.image;if(typeof pe!="string")return D.push({type:"!imageUrl",value:""}),{url:null,linkage:D};if(!pe.match(/^(https:\/\/|data:)/i)){if(pe.match(q)==null)return D.push({type:"!imageUrl-ipfs",value:pe}),{url:null,linkage:D};D.push({type:"imageUrl-ipfs",value:pe}),pe=E(pe)}return D.push({type:"url",value:pe}),{linkage:D,url:pe}}}}}catch{}return{linkage:D,url:null}}static async getEnsAddress(D){const V=await D.getNetwork(),ee=V.getPlugin("org.ethers.plugins.network.Ens");return(0,A.assert)(ee,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:V}}),ee.address}static async#n(D,V){const ee=await O.getEnsAddress(D);try{const te=await new w.Contract(ee,["function resolver(bytes32) view returns (address)"],D).resolver((0,_.namehash)(V),{enableCcipRead:!0});return te===v.ZeroAddress?null:te}catch(J){throw J}return null}static async fromName(D,V){let ee=V;for(;;){if(ee===""||ee==="."||V!=="eth"&&ee==="eth")return null;const J=await O.#n(D,ee);if(J!=null){const te=new O(D,J,V);return ee!==V&&!await te.supportsWildcard()?null:te}ee=ee.split(".").slice(1).join(".")}}}return ensResolver.EnsResolver=O,ensResolver}var format={},hasRequiredFormat;function requireFormat(){if(hasRequiredFormat)return format;hasRequiredFormat=1,Object.defineProperty(format,"__esModule",{value:!0}),format.formatTransactionResponse=format.formatTransactionReceipt=format.formatReceiptLog=format.formatBlock=format.formatLog=format.formatUint256=format.formatHash=format.formatData=format.formatBoolean=format.object=format.arrayOf=format.allowNull=void 0;const b=requireAddress$2(),v=requireCrypto(),w=requireTransaction(),_=requireUtils$3(),A=BigInt(0);function E(he,oe){return function(de){return de==null?oe:he(de)}}format.allowNull=E;function k(he){return oe=>{if(!Array.isArray(oe))throw new Error("not an array");return oe.map(de=>he(de))}}format.arrayOf=k;function P(he,oe){return de=>{const le={};for(const be in he){let pe=be;if(oe&&be in oe&&!(pe in de)){for(const fe of oe[be])if(fe in de){pe=fe;break}}try{const fe=he[be](de[pe]);fe!==void 0&&(le[be]=fe)}catch(fe){const Z=fe instanceof Error?fe.message:"not-an-error";(0,_.assert)(!1,`invalid value for value.${be} (${Z})`,"BAD_DATA",{value:de})}}return le}}format.object=P;function N(he){switch(he){case!0:case"true":return!0;case!1:case"false":return!1}(0,_.assertArgument)(!1,`invalid boolean; ${JSON.stringify(he)}`,"value",he)}format.formatBoolean=N;function q(he){return(0,_.assertArgument)((0,_.isHexString)(he,!0),"invalid data","value",he),he}format.formatData=q;function B(he){return(0,_.assertArgument)((0,_.isHexString)(he,32),"invalid hash","value",he),he}format.formatHash=B;function O(he){if(!(0,_.isHexString)(he))throw new Error("invalid uint256");return(0,_.zeroPadValue)(he,32)}format.formatUint256=O;const I=P({address:b.getAddress,blockHash:B,blockNumber:_.getNumber,data:q,index:_.getNumber,removed:E(N,!1),topics:k(B),transactionHash:B,transactionIndex:_.getNumber},{index:["logIndex"]});function D(he){return I(he)}format.formatLog=D;const V=P({hash:E(B),parentHash:B,number:_.getNumber,timestamp:_.getNumber,nonce:E(q),difficulty:_.getBigInt,gasLimit:_.getBigInt,gasUsed:_.getBigInt,miner:E(b.getAddress),extraData:q,baseFeePerGas:E(_.getBigInt)});function ee(he){const oe=V(he);return oe.transactions=he.transactions.map(de=>typeof de=="string"?de:ae(de)),oe}format.formatBlock=ee;const J=P({transactionIndex:_.getNumber,blockNumber:_.getNumber,transactionHash:B,address:b.getAddress,topics:k(B),data:q,index:_.getNumber,blockHash:B},{index:["logIndex"]});function te(he){return J(he)}format.formatReceiptLog=te;const se=P({to:E(b.getAddress,null),from:E(b.getAddress,null),contractAddress:E(b.getAddress,null),index:_.getNumber,root:E(_.hexlify),gasUsed:_.getBigInt,logsBloom:E(q),blockHash:B,hash:B,logs:k(te),blockNumber:_.getNumber,cumulativeGasUsed:_.getBigInt,effectiveGasPrice:E(_.getBigInt),status:E(_.getNumber),type:E(_.getNumber,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function ce(he){return se(he)}format.formatTransactionReceipt=ce;function ae(he){he.to&&(0,_.getBigInt)(he.to)===A&&(he.to="0x0000000000000000000000000000000000000000");const oe=P({hash:B,type:de=>de==="0x"||de==null?0:(0,_.getNumber)(de),accessList:E(w.accessListify,null),blockHash:E(B,null),blockNumber:E(_.getNumber,null),transactionIndex:E(_.getNumber,null),from:b.getAddress,gasPrice:E(_.getBigInt),maxPriorityFeePerGas:E(_.getBigInt),maxFeePerGas:E(_.getBigInt),gasLimit:_.getBigInt,to:E(b.getAddress,null),value:_.getBigInt,nonce:_.getNumber,data:q,creates:E(b.getAddress,null),chainId:E(_.getBigInt,null)},{data:["input"],gasLimit:["gas"]})(he);if(oe.to==null&&oe.creates==null&&(oe.creates=(0,b.getCreateAddress)(oe)),(he.type===1||he.type===2)&&he.accessList==null&&(oe.accessList=[]),he.signature?oe.signature=v.Signature.from(he.signature):oe.signature=v.Signature.from(he),oe.chainId==null){const de=oe.signature.legacyChainId;de!=null&&(oe.chainId=de)}return oe.blockHash&&(0,_.getBigInt)(oe.blockHash)===A&&(oe.blockHash=null),oe}return format.formatTransactionResponse=ae,format}var network={},pluginsNetwork={},hasRequiredPluginsNetwork;function requirePluginsNetwork(){if(hasRequiredPluginsNetwork)return pluginsNetwork;hasRequiredPluginsNetwork=1,Object.defineProperty(pluginsNetwork,"__esModule",{value:!0}),pluginsNetwork.FetchUrlFeeDataNetworkPlugin=pluginsNetwork.FeeDataNetworkPlugin=pluginsNetwork.EnsPlugin=pluginsNetwork.GasCostPlugin=pluginsNetwork.NetworkPlugin=void 0;const b=requireProperties(),v=requireUtils$3(),w="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class _{name;constructor(q){(0,b.defineProperties)(this,{name:q})}clone(){return new _(this.name)}}pluginsNetwork.NetworkPlugin=_;class A extends _{effectiveBlock;txBase;txCreate;txDataZero;txDataNonzero;txAccessListStorageKey;txAccessListAddress;constructor(q,B){q==null&&(q=0),super(`org.ethers.network.plugins.GasCost#${q||0}`);const O={effectiveBlock:q};function I(D,V){let ee=(B||{})[D];ee==null&&(ee=V),(0,v.assertArgument)(typeof ee=="number",`invalud value for ${D}`,"costs",B),O[D]=ee}I("txBase",21e3),I("txCreate",32e3),I("txDataZero",4),I("txDataNonzero",16),I("txAccessListStorageKey",1900),I("txAccessListAddress",2400),(0,b.defineProperties)(this,O)}clone(){return new A(this.effectiveBlock,this)}}pluginsNetwork.GasCostPlugin=A;class E extends _{address;targetNetwork;constructor(q,B){super("org.ethers.plugins.network.Ens"),(0,b.defineProperties)(this,{address:q||w,targetNetwork:B??1})}clone(){return new E(this.address,this.targetNetwork)}}pluginsNetwork.EnsPlugin=E;class k extends _{#e;get feeDataFunc(){return this.#e}constructor(q){super("org.ethers.plugins.network.FeeData"),this.#e=q}async getFeeData(q){return await this.#e(q)}clone(){return new k(this.#e)}}pluginsNetwork.FeeDataNetworkPlugin=k;class P extends _{#e;#t;get url(){return this.#e}get processFunc(){return this.#t}constructor(q,B){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin"),this.#e=q,this.#t=B}clone(){return this}}return pluginsNetwork.FetchUrlFeeDataNetworkPlugin=P,pluginsNetwork}var hasRequiredNetwork;function requireNetwork(){if(hasRequiredNetwork)return network;hasRequiredNetwork=1,Object.defineProperty(network,"__esModule",{value:!0}),network.Network=void 0;const b=requireTransaction(),v=requireUtils$3(),w=requirePluginsNetwork(),_=new Map;class A{#e;#t;#r;constructor(O,I){this.#e=O,this.#t=(0,v.getBigInt)(I),this.#r=new Map}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return this.#e}set name(O){this.#e=O}get chainId(){return this.#t}set chainId(O){this.#t=(0,v.getBigInt)(O,"chainId")}matches(O){if(O==null)return!1;if(typeof O=="string"){try{return this.chainId===(0,v.getBigInt)(O)}catch{}return this.name===O}if(typeof O=="number"||typeof O=="bigint"){try{return this.chainId===(0,v.getBigInt)(O)}catch{}return!1}if(typeof O=="object"){if(O.chainId!=null){try{return this.chainId===(0,v.getBigInt)(O.chainId)}catch{}return!1}return O.name!=null?this.name===O.name:!1}return!1}get plugins(){return Array.from(this.#r.values())}attachPlugin(O){if(this.#r.get(O.name))throw new Error(`cannot replace existing plugin: ${O.name} `);return this.#r.set(O.name,O.clone()),this}getPlugin(O){return this.#r.get(O)||null}getPlugins(O){return this.plugins.filter(I=>I.name.split("#")[0]===O)}clone(){const O=new A(this.name,this.chainId);return this.plugins.forEach(I=>{O.attachPlugin(I.clone())}),O}computeIntrinsicGas(O){const I=this.getPlugin("org.ethers.plugins.network.GasCost")||new w.GasCostPlugin;let D=I.txBase;if(O.to==null&&(D+=I.txCreate),O.data)for(let V=2;V<O.data.length;V+=2)O.data.substring(V,V+2)==="00"?D+=I.txDataZero:D+=I.txDataNonzero;if(O.accessList){const V=(0,b.accessListify)(O.accessList);for(const ee in V)D+=I.txAccessListAddress+I.txAccessListStorageKey*V[ee].storageKeys.length}return D}static from(O){if(q(),O==null)return A.from("mainnet");if(typeof O=="number"&&(O=BigInt(O)),typeof O=="string"||typeof O=="bigint"){const I=_.get(O);if(I)return I();if(typeof O=="bigint")return new A("unknown",O);(0,v.assertArgument)(!1,"unknown network","network",O)}if(typeof O.clone=="function")return O.clone();if(typeof O=="object"){(0,v.assertArgument)(typeof O.name=="string"&&typeof O.chainId=="number","invalid network object name or chainId","network",O);const I=new A(O.name,O.chainId);return(O.ensAddress||O.ensNetwork!=null)&&I.attachPlugin(new w.EnsPlugin(O.ensAddress,O.ensNetwork)),I}(0,v.assertArgument)(!1,"invalid network","network",O)}static register(O,I){typeof O=="number"&&(O=BigInt(O));const D=_.get(O);D&&(0,v.assertArgument)(!1,`conflicting network for ${JSON.stringify(D.name)}`,"nameOrChainId",O),_.set(O,I)}}network.Network=A;function E(B,O){const I=String(B);if(!I.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${B}`);const D=I.split(".");if(D.length===1&&D.push(""),D.length!==2)throw new Error(`invalid gwei value: ${B}`);for(;D[1].length<O;)D[1]+="0";if(D[1].length>9){let V=BigInt(D[1].substring(0,9));D[1].substring(9).match(/^0+$/)||V++,D[1]=V.toString()}return BigInt(D[0]+D[1])}function k(B){return new w.FetchUrlFeeDataNetworkPlugin(B,async(O,I,D)=>{D.setHeader("User-Agent","ethers");let V;try{const[ee,J]=await Promise.all([D.send(),O()]);V=ee;const te=V.bodyJson.standard;return{gasPrice:J.gasPrice,maxFeePerGas:E(te.maxFee,9),maxPriorityFeePerGas:E(te.maxPriorityFee,9)}}catch(ee){(0,v.assert)(!1,`error encountered with polygon gas station (${JSON.stringify(D.url)})`,"SERVER_ERROR",{request:D,response:V,error:ee})}})}function P(B){return new w.FetchUrlFeeDataNetworkPlugin("data:",async(O,I,D)=>{const V=await O();if(V.maxFeePerGas==null||V.maxPriorityFeePerGas==null)return V;const ee=V.maxFeePerGas-V.maxPriorityFeePerGas;return{gasPrice:V.gasPrice,maxFeePerGas:ee+B,maxPriorityFeePerGas:B}})}let N=!1;function q(){if(N)return;N=!0;function B(O,I,D){const V=function(){const ee=new A(O,I);return D.ensNetwork!=null&&ee.attachPlugin(new w.EnsPlugin(null,D.ensNetwork)),ee.attachPlugin(new w.GasCostPlugin),(D.plugins||[]).forEach(J=>{ee.attachPlugin(J)}),ee};A.register(O,V),A.register(I,V),D.altNames&&D.altNames.forEach(ee=>{A.register(ee,V)})}B("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),B("ropsten",3,{ensNetwork:3}),B("rinkeby",4,{ensNetwork:4}),B("goerli",5,{ensNetwork:5}),B("kovan",42,{ensNetwork:42}),B("sepolia",11155111,{}),B("classic",61,{}),B("classicKotti",6,{}),B("arbitrum",42161,{ensNetwork:1}),B("arbitrum-goerli",421613,{}),B("bnb",56,{ensNetwork:1}),B("bnbt",97,{}),B("linea",59144,{ensNetwork:1}),B("linea-goerli",59140,{}),B("matic",137,{ensNetwork:1,plugins:[k("https://gasstation.polygon.technology/v2")]}),B("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[k("https://gasstation-testnet.polygon.technology/v2")]}),B("optimism",10,{ensNetwork:1,plugins:[P(BigInt("1000000"))]}),B("optimism-goerli",420,{}),B("xdai",100,{ensNetwork:1})}return network}var subscriberPolling={},hasRequiredSubscriberPolling;function requireSubscriberPolling(){if(hasRequiredSubscriberPolling)return subscriberPolling;hasRequiredSubscriberPolling=1,Object.defineProperty(subscriberPolling,"__esModule",{value:!0}),subscriberPolling.PollingEventSubscriber=subscriberPolling.PollingTransactionSubscriber=subscriberPolling.PollingOrphanSubscriber=subscriberPolling.OnBlockSubscriber=subscriberPolling.PollingBlockSubscriber=subscriberPolling.getPollingSubscriber=void 0;const b=requireUtils$3();function v(N){return JSON.parse(JSON.stringify(N))}function w(N,q){if(q==="block")return new _(N);if((0,b.isHexString)(q,32))return new k(N,q);(0,b.assert)(!1,"unsupported polling event","UNSUPPORTED_OPERATION",{operation:"getPollingSubscriber",info:{event:q}})}subscriberPolling.getPollingSubscriber=w;class _{#e;#t;#r;#n;constructor(q){this.#e=q,this.#t=null,this.#r=4e3,this.#n=-2}get pollingInterval(){return this.#r}set pollingInterval(q){this.#r=q}async#i(){try{const q=await this.#e.getBlockNumber();if(this.#n===-2){this.#n=q;return}if(q!==this.#n){for(let B=this.#n+1;B<=q;B++){if(this.#t==null)return;await this.#e.emit("block",B)}this.#n=q}}catch{}this.#t!=null&&(this.#t=this.#e._setTimeout(this.#i.bind(this),this.#r))}start(){this.#t||(this.#t=this.#e._setTimeout(this.#i.bind(this),this.#r),this.#i())}stop(){this.#t&&(this.#e._clearTimeout(this.#t),this.#t=null)}pause(q){this.stop(),q&&(this.#n=-2)}resume(){this.start()}}subscriberPolling.PollingBlockSubscriber=_;class A{#e;#t;#r;constructor(q){this.#e=q,this.#r=!1,this.#t=B=>{this._poll(B,this.#e)}}async _poll(q,B){throw new Error("sub-classes must override this")}start(){this.#r||(this.#r=!0,this.#t(-2),this.#e.on("block",this.#t))}stop(){this.#r&&(this.#r=!1,this.#e.off("block",this.#t))}pause(q){this.stop()}resume(){this.start()}}subscriberPolling.OnBlockSubscriber=A;class E extends A{#e;constructor(q,B){super(q),this.#e=v(B)}async _poll(q,B){throw new Error("@TODO")}}subscriberPolling.PollingOrphanSubscriber=E;class k extends A{#e;constructor(q,B){super(q),this.#e=B}async _poll(q,B){const O=await B.getTransactionReceipt(this.#e);O&&B.emit(this.#e,O)}}subscriberPolling.PollingTransactionSubscriber=k;class P{#e;#t;#r;#n;#i;constructor(q,B){this.#e=q,this.#t=v(B),this.#r=this.#s.bind(this),this.#n=!1,this.#i=-2}async#s(q){if(this.#i===-2)return;const B=v(this.#t);B.fromBlock=this.#i+1,B.toBlock=q;const O=await this.#e.getLogs(B);if(O.length===0){this.#i<q-60&&(this.#i=q-60);return}for(const I of O)this.#e.emit(this.#t,I),this.#i=I.blockNumber}start(){this.#n||(this.#n=!0,this.#i===-2&&this.#e.getBlockNumber().then(q=>{this.#i=q}),this.#e.on("block",this.#r))}stop(){this.#n&&(this.#n=!1,this.#e.off("block",this.#r))}pause(q){this.stop(),q&&(this.#i=-2)}resume(){this.start()}}return subscriberPolling.PollingEventSubscriber=P,subscriberPolling}var hasRequiredAbstractProvider;function requireAbstractProvider(){if(hasRequiredAbstractProvider)return abstractProvider;hasRequiredAbstractProvider=1,Object.defineProperty(abstractProvider,"__esModule",{value:!0}),abstractProvider.AbstractProvider=abstractProvider.UnmanagedSubscriber=void 0;const b=requireAddress$2(),v=requireConstants$1(),w=requireContract(),_=requireHash(),A=requireTransaction(),E=requireUtils$3(),k=requireEnsResolver(),P=requireFormat(),N=requireNetwork(),q=requireProvider(),B=requireSubscriberPolling(),O=BigInt(2),I=10;function D(S){return S&&typeof S.then=="function"}function V(S,C){return S+":"+JSON.stringify(C,(F,X)=>{if(X==null)return"null";if(typeof X=="bigint")return`bigint:${X.toString()}`;if(typeof X=="string")return X.toLowerCase();if(typeof X=="object"&&!Array.isArray(X)){const re=Object.keys(X);return re.sort(),re.reduce((ie,Q)=>(ie[Q]=X[Q],ie),{})}return X})}class ee{name;constructor(C){(0,E.defineProperties)(this,{name:C})}start(){}stop(){}pause(C){}resume(){}}abstractProvider.UnmanagedSubscriber=ee;function J(S){return JSON.parse(JSON.stringify(S))}function te(S){return S=Array.from(new Set(S).values()),S.sort(),S}async function se(S,C){if(S==null)throw new Error("invalid event");if(Array.isArray(S)&&(S={topics:S}),typeof S=="string")switch(S){case"block":case"pending":case"debug":case"error":case"network":return{type:S,tag:S}}if((0,E.isHexString)(S,32)){const F=S.toLowerCase();return{type:"transaction",tag:V("tx",{hash:F}),hash:F}}if(S.orphan){const F=S;return{type:"orphan",tag:V("orphan",F),filter:J(F)}}if(S.address||S.topics){const F=S,X={topics:(F.topics||[]).map(re=>re==null?null:Array.isArray(re)?te(re.map(ie=>ie.toLowerCase())):re.toLowerCase())};if(F.address){const re=[],ie=[],Q=ne=>{(0,E.isHexString)(ne)?re.push(ne):ie.push((async()=>{re.push(await(0,b.resolveAddress)(ne,C))})())};Array.isArray(F.address)?F.address.forEach(Q):Q(F.address),ie.length&&await Promise.all(ie),X.address=te(re.map(ne=>ne.toLowerCase()))}return{filter:X,tag:V("event",X),type:"event"}}(0,E.assertArgument)(!1,"unknown ProviderEvent","event",S)}function ce(){return new Date().getTime()}const ae={cacheTimeout:250,pollingInterval:4e3};class he{#e;#t;#r;#n;#i;#s;#a;#o;#u;#f;#l;#d;constructor(C,F){if(this.#d=Object.assign({},ae,F||{}),C==="any")this.#s=!0,this.#i=null;else if(C){const X=N.Network.from(C);this.#s=!1,this.#i=Promise.resolve(X),setTimeout(()=>{this.emit("network",X,null)},0)}else this.#s=!1,this.#i=null;this.#o=-1,this.#a=new Map,this.#e=new Map,this.#t=new Map,this.#r=null,this.#n=!1,this.#u=1,this.#f=new Map,this.#l=!1}get pollingInterval(){return this.#d.pollingInterval}get provider(){return this}get plugins(){return Array.from(this.#t.values())}attachPlugin(C){if(this.#t.get(C.name))throw new Error(`cannot replace existing plugin: ${C.name} `);return this.#t.set(C.name,C.connect(this)),this}getPlugin(C){return this.#t.get(C)||null}get disableCcipRead(){return this.#l}set disableCcipRead(C){this.#l=!!C}async#c(C){const F=this.#d.cacheTimeout;if(F<0)return await this._perform(C);const X=V(C.method,C);let re=this.#a.get(X);return re||(re=this._perform(C),this.#a.set(X,re),setTimeout(()=>{this.#a.get(X)===re&&this.#a.delete(X)},F)),await re}async ccipReadFetch(C,F,X){if(this.disableCcipRead||X.length===0||C.to==null)return null;const re=C.to.toLowerCase(),ie=F.toLowerCase(),Q=[];for(let ne=0;ne<X.length;ne++){const L=X[ne],ue=L.replace("{sender}",re).replace("{data}",ie),Ae=new E.FetchRequest(ue);L.indexOf("{data}")===-1&&(Ae.body={data:ie,sender:re}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:Ae,index:ne,urls:X});let Re="unknown error";const Pe=await Ae.send();try{const xe=Pe.bodyJson;if(xe.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:Ae,result:xe}),xe.data;xe.message&&(Re=xe.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:Ae,result:xe})}catch{}(0,E.assert)(Pe.statusCode<400||Pe.statusCode>=500,`response not found during CCIP fetch: ${Re}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:C,info:{url:L,errorMessage:Re}}),Q.push(Re)}(0,E.assert)(!1,`error encountered during CCIP fetch: ${Q.map(ne=>JSON.stringify(ne)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:C,info:{urls:X,errorMessages:Q}})}_wrapBlock(C,F){return new q.Block((0,P.formatBlock)(C),this)}_wrapLog(C,F){return new q.Log((0,P.formatLog)(C),this)}_wrapTransactionReceipt(C,F){return new q.TransactionReceipt((0,P.formatTransactionReceipt)(C),this)}_wrapTransactionResponse(C,F){return new q.TransactionResponse((0,P.formatTransactionResponse)(C),this)}_detectNetwork(){(0,E.assert)(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(C){(0,E.assert)(!1,`unsupported method: ${C.method}`,"UNSUPPORTED_OPERATION",{operation:C.method,info:C})}async getBlockNumber(){const C=(0,E.getNumber)(await this.#c({method:"getBlockNumber"}),"%response");return this.#o>=0&&(this.#o=C),C}_getAddress(C){return(0,b.resolveAddress)(C,this)}_getBlockTag(C){if(C==null)return"latest";switch(C){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return C}if((0,E.isHexString)(C))return(0,E.isHexString)(C,32)?C:(0,E.toQuantity)(C);if(typeof C=="bigint"&&(C=(0,E.getNumber)(C,"blockTag")),typeof C=="number")return C>=0?(0,E.toQuantity)(C):this.#o>=0?(0,E.toQuantity)(this.#o+C):this.getBlockNumber().then(F=>(0,E.toQuantity)(F+C));(0,E.assertArgument)(!1,"invalid blockTag","blockTag",C)}_getFilter(C){const F=(C.topics||[]).map(L=>L==null?null:Array.isArray(L)?te(L.map(ue=>ue.toLowerCase())):L.toLowerCase()),X="blockHash"in C?C.blockHash:void 0,re=(L,ue,Ae)=>{let Re;switch(L.length){case 0:break;case 1:Re=L[0];break;default:L.sort(),Re=L}if(X&&(ue!=null||Ae!=null))throw new Error("invalid filter");const Pe={};return Re&&(Pe.address=Re),F.length&&(Pe.topics=F),ue&&(Pe.fromBlock=ue),Ae&&(Pe.toBlock=Ae),X&&(Pe.blockHash=X),Pe};let ie=[];if(C.address)if(Array.isArray(C.address))for(const L of C.address)ie.push(this._getAddress(L));else ie.push(this._getAddress(C.address));let Q;"fromBlock"in C&&(Q=this._getBlockTag(C.fromBlock));let ne;return"toBlock"in C&&(ne=this._getBlockTag(C.toBlock)),ie.filter(L=>typeof L!="string").length||Q!=null&&typeof Q!="string"||ne!=null&&typeof ne!="string"?Promise.all([Promise.all(ie),Q,ne]).then(L=>re(L[0],L[1],L[2])):re(ie,Q,ne)}_getTransactionRequest(C){const F=(0,q.copyRequest)(C),X=[];if(["to","from"].forEach(re=>{if(F[re]==null)return;const ie=(0,b.resolveAddress)(F[re],this);D(ie)?X.push(async function(){F[re]=await ie}()):F[re]=ie}),F.blockTag!=null){const re=this._getBlockTag(F.blockTag);D(re)?X.push(async function(){F.blockTag=await re}()):F.blockTag=re}return X.length?async function(){return await Promise.all(X),F}():F}async getNetwork(){if(this.#i==null){const re=this._detectNetwork().then(ie=>(this.emit("network",ie,null),ie),ie=>{throw this.#i===re&&(this.#i=null),ie});return this.#i=re,(await re).clone()}const C=this.#i,[F,X]=await Promise.all([C,this._detectNetwork()]);return F.chainId!==X.chainId&&(this.#s?(this.emit("network",X,F),this.#i===C&&(this.#i=Promise.resolve(X))):(0,E.assert)(!1,`network changed: ${F.chainId} => ${X.chainId} `,"NETWORK_ERROR",{event:"changed"})),F.clone()}async getFeeData(){const C=await this.getNetwork(),F=async()=>{const{_block:re,gasPrice:ie}=await(0,E.resolveProperties)({_block:this.#y("latest",!1),gasPrice:(async()=>{try{const ue=await this.#c({method:"getGasPrice"});return(0,E.getBigInt)(ue,"%response")}catch{}return null})()});let Q=null,ne=null;const L=this._wrapBlock(re,C);return L&&L.baseFeePerGas&&(ne=BigInt("1000000000"),Q=L.baseFeePerGas*O+ne),new q.FeeData(ie,Q,ne)},X=C.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(X){const re=new E.FetchRequest(X.url),ie=await X.processFunc(F,this,re);return new q.FeeData(ie.gasPrice,ie.maxFeePerGas,ie.maxPriorityFeePerGas)}return await F()}async estimateGas(C){let F=this._getTransactionRequest(C);return D(F)&&(F=await F),(0,E.getBigInt)(await this.#c({method:"estimateGas",transaction:F}),"%response")}async#h(C,F,X){(0,E.assert)(X<I,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},C,{blockTag:F,enableCcipRead:!0})});const re=(0,q.copyRequest)(C);try{return(0,E.hexlify)(await this._perform({method:"call",transaction:re,blockTag:F}))}catch(ie){if(!this.disableCcipRead&&(0,E.isCallException)(ie)&&ie.data&&X>=0&&F==="latest"&&re.to!=null&&(0,E.dataSlice)(ie.data,0,4)==="0x556f1830"){const Q=ie.data,ne=await(0,b.resolveAddress)(re.to,this);let L;try{L=U((0,E.dataSlice)(ie.data,4))}catch(Re){(0,E.assert)(!1,Re.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:re,info:{data:Q}})}(0,E.assert)(L.sender.toLowerCase()===ne.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:Q,reason:"OffchainLookup",transaction:re,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:L.errorArgs}});const ue=await this.ccipReadFetch(re,L.calldata,L.urls);(0,E.assert)(ue!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:re,info:{data:ie.data,errorArgs:L.errorArgs}});const Ae={to:ne,data:(0,E.concat)([L.selector,fe([ue,L.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:Ae});try{const Re=await this.#h(Ae,F,X+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},Ae),result:Re}),Re}catch(Re){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},Ae),error:Re}),Re}}throw ie}}async#b(C){const{value:F}=await(0,E.resolveProperties)({network:this.getNetwork(),value:C});return F}async call(C){const{tx:F,blockTag:X}=await(0,E.resolveProperties)({tx:this._getTransactionRequest(C),blockTag:this._getBlockTag(C.blockTag)});return await this.#b(this.#h(F,X,C.enableCcipRead?0:-1))}async#p(C,F,X){let re=this._getAddress(F),ie=this._getBlockTag(X);return(typeof re!="string"||typeof ie!="string")&&([re,ie]=await Promise.all([re,ie])),await this.#b(this.#c(Object.assign(C,{address:re,blockTag:ie})))}async getBalance(C,F){return(0,E.getBigInt)(await this.#p({method:"getBalance"},C,F),"%response")}async getTransactionCount(C,F){return(0,E.getNumber)(await this.#p({method:"getTransactionCount"},C,F),"%response")}async getCode(C,F){return(0,E.hexlify)(await this.#p({method:"getCode"},C,F))}async getStorage(C,F,X){const re=(0,E.getBigInt)(F,"position");return(0,E.hexlify)(await this.#p({method:"getStorage",position:re},C,X))}async broadcastTransaction(C){const{blockNumber:F,hash:X,network:re}=await(0,E.resolveProperties)({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:C}),network:this.getNetwork()}),ie=A.Transaction.from(C);if(ie.hash!==X)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(ie,re).replaceableTransaction(F)}async#y(C,F){if((0,E.isHexString)(C,32))return await this.#c({method:"getBlock",blockHash:C,includeTransactions:F});let X=this._getBlockTag(C);return typeof X!="string"&&(X=await X),await this.#c({method:"getBlock",blockTag:X,includeTransactions:F})}async getBlock(C,F){const{network:X,params:re}=await(0,E.resolveProperties)({network:this.getNetwork(),params:this.#y(C,!!F)});return re==null?null:this._wrapBlock(re,X)}async getTransaction(C){const{network:F,params:X}=await(0,E.resolveProperties)({network:this.getNetwork(),params:this.#c({method:"getTransaction",hash:C})});return X==null?null:this._wrapTransactionResponse(X,F)}async getTransactionReceipt(C){const{network:F,params:X}=await(0,E.resolveProperties)({network:this.getNetwork(),params:this.#c({method:"getTransactionReceipt",hash:C})});if(X==null)return null;if(X.gasPrice==null&&X.effectiveGasPrice==null){const re=await this.#c({method:"getTransaction",hash:C});if(re==null)throw new Error("report this; could not find tx or effectiveGasPrice");X.effectiveGasPrice=re.gasPrice}return this._wrapTransactionReceipt(X,F)}async getTransactionResult(C){const{result:F}=await(0,E.resolveProperties)({network:this.getNetwork(),result:this.#c({method:"getTransactionResult",hash:C})});return F==null?null:(0,E.hexlify)(F)}async getLogs(C){let F=this._getFilter(C);D(F)&&(F=await F);const{network:X,params:re}=await(0,E.resolveProperties)({network:this.getNetwork(),params:this.#c({method:"getLogs",filter:F})});return re.map(ie=>this._wrapLog(ie,X))}_getProvider(C){(0,E.assert)(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(C){return await k.EnsResolver.fromName(this,C)}async getAvatar(C){const F=await this.getResolver(C);return F?await F.getAvatar():null}async resolveName(C){const F=await this.getResolver(C);return F?await F.getAddress():null}async lookupAddress(C){C=(0,b.getAddress)(C);const F=(0,_.namehash)(C.substring(2).toLowerCase()+".addr.reverse");try{const X=await k.EnsResolver.getEnsAddress(this),ie=await new w.Contract(X,["function resolver(bytes32) view returns (address)"],this).resolver(F);if(ie==null||ie===v.ZeroAddress)return null;const ne=await new w.Contract(ie,["function name(bytes32) view returns (string)"],this).name(F);return await this.resolveName(ne)!==C?null:ne}catch(X){if((0,E.isError)(X,"BAD_DATA")&&X.value==="0x"||(0,E.isError)(X,"CALL_EXCEPTION"))return null;throw X}return null}async waitForTransaction(C,F,X){const re=F??1;return re===0?this.getTransactionReceipt(C):new Promise(async(ie,Q)=>{let ne=null;const L=async ue=>{try{const Ae=await this.getTransactionReceipt(C);if(Ae!=null&&ue-Ae.blockNumber+1>=re){ie(Ae),ne&&(clearTimeout(ne),ne=null);return}}catch(Ae){console.log("EEE",Ae)}this.once("block",L)};X!=null&&(ne=setTimeout(()=>{ne!=null&&(ne=null,this.off("block",L),Q((0,E.makeError)("timeout","TIMEOUT",{reason:"timeout"})))},X)),L(await this.getBlockNumber())})}async waitForBlock(C){(0,E.assert)(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(C){const F=this.#f.get(C);F&&(F.timer&&clearTimeout(F.timer),this.#f.delete(C))}_setTimeout(C,F){F==null&&(F=0);const X=this.#u++,re=()=>{this.#f.delete(X),C()};if(this.paused)this.#f.set(X,{timer:null,func:re,time:F});else{const ie=setTimeout(re,F);this.#f.set(X,{timer:ie,func:re,time:ce()})}return X}_forEachSubscriber(C){for(const F of this.#e.values())C(F.subscriber)}_getSubscriber(C){switch(C.type){case"debug":case"error":case"network":return new ee(C.type);case"block":{const F=new B.PollingBlockSubscriber(this);return F.pollingInterval=this.pollingInterval,F}case"event":return new B.PollingEventSubscriber(this,C.filter);case"transaction":return new B.PollingTransactionSubscriber(this,C.hash);case"orphan":return new B.PollingOrphanSubscriber(this,C.filter)}throw new Error(`unsupported event: ${C.type}`)}_recoverSubscriber(C,F){for(const X of this.#e.values())if(X.subscriber===C){X.started&&X.subscriber.stop(),X.subscriber=F,X.started&&F.start(),this.#r!=null&&F.pause(this.#r);break}}async#m(C,F){let X=await se(C,this);return X.type==="event"&&F&&F.length>0&&F[0].removed===!0&&(X=await se({orphan:"drop-log",log:F[0]},this)),this.#e.get(X.tag)||null}async#g(C){const F=await se(C,this),X=F.tag;let re=this.#e.get(X);return re||(re={subscriber:this._getSubscriber(F),tag:X,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},this.#e.set(X,re)),re}async on(C,F){const X=await this.#g(C);return X.listeners.push({listener:F,once:!1}),X.started||(X.subscriber.start(),X.started=!0,this.#r!=null&&X.subscriber.pause(this.#r)),this}async once(C,F){const X=await this.#g(C);return X.listeners.push({listener:F,once:!0}),X.started||(X.subscriber.start(),X.started=!0,this.#r!=null&&X.subscriber.pause(this.#r)),this}async emit(C,...F){const X=await this.#m(C,F);if(!X||X.listeners.length===0)return!1;const re=X.listeners.length;return X.listeners=X.listeners.filter(({listener:ie,once:Q})=>{const ne=new E.EventPayload(this,Q?null:ie,C);try{ie.call(this,...F,ne)}catch{}return!Q}),X.listeners.length===0&&(X.started&&X.subscriber.stop(),this.#e.delete(X.tag)),re>0}async listenerCount(C){if(C){const X=await this.#m(C);return X?X.listeners.length:0}let F=0;for(const{listeners:X}of this.#e.values())F+=X.length;return F}async listeners(C){if(C){const X=await this.#m(C);return X?X.listeners.map(({listener:re})=>re):[]}let F=[];for(const{listeners:X}of this.#e.values())F=F.concat(X.map(({listener:re})=>re));return F}async off(C,F){const X=await this.#m(C);if(!X)return this;if(F){const re=X.listeners.map(({listener:ie})=>ie).indexOf(F);re>=0&&X.listeners.splice(re,1)}return(!F||X.listeners.length===0)&&(X.started&&X.subscriber.stop(),this.#e.delete(X.tag)),this}async removeAllListeners(C){if(C){const{tag:F,started:X,subscriber:re}=await this.#g(C);X&&re.stop(),this.#e.delete(F)}else for(const[F,{started:X,subscriber:re}]of this.#e)X&&re.stop(),this.#e.delete(F);return this}async addListener(C,F){return await this.on(C,F)}async removeListener(C,F){return this.off(C,F)}get destroyed(){return this.#n}destroy(){this.removeAllListeners();for(const C of this.#f.keys())this._clearTimeout(C);this.#n=!0}get paused(){return this.#r!=null}set paused(C){!!C!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(C){if(this.#o=-1,this.#r!=null){if(this.#r==!!C)return;(0,E.assert)(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(F=>F.pause(C)),this.#r=!!C;for(const F of this.#f.values())F.timer&&clearTimeout(F.timer),F.time=ce()-F.time}resume(){if(this.#r!=null){this._forEachSubscriber(C=>C.resume()),this.#r=null;for(const C of this.#f.values()){let F=C.time;F<0&&(F=0),C.time=ce(),setTimeout(C.func,F)}}}}abstractProvider.AbstractProvider=he;function oe(S,C){try{const F=de(S,C);if(F)return(0,E.toUtf8String)(F)}catch{}return null}function de(S,C){if(S==="0x")return null;try{const F=(0,E.getNumber)((0,E.dataSlice)(S,C,C+32)),X=(0,E.getNumber)((0,E.dataSlice)(S,F,F+32));return(0,E.dataSlice)(S,F+32,F+32+X)}catch{}return null}function le(S){const C=(0,E.toBeArray)(S);if(C.length>32)throw new Error("internal; should not happen");const F=new Uint8Array(32);return F.set(C,32-C.length),F}function be(S){if(S.length%32===0)return S;const C=new Uint8Array(Math.ceil(S.length/32)*32);return C.set(S),C}const pe=new Uint8Array([]);function fe(S){const C=[];let F=0;for(let X=0;X<S.length;X++)C.push(pe),F+=32;for(let X=0;X<S.length;X++){const re=(0,E.getBytes)(S[X]);C[X]=le(F),C.push(le(re.length)),C.push(be(re)),F+=32+Math.ceil(re.length/32)*32}return(0,E.concat)(C)}const Z="0x0000000000000000000000000000000000000000000000000000000000000000";function U(S){const C={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};(0,E.assert)((0,E.dataLength)(S)>=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const F=(0,E.dataSlice)(S,0,32);(0,E.assert)((0,E.dataSlice)(F,0,12)===(0,E.dataSlice)(Z,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),C.sender=(0,E.dataSlice)(F,12);try{const X=[],re=(0,E.getNumber)((0,E.dataSlice)(S,32,64)),ie=(0,E.getNumber)((0,E.dataSlice)(S,re,re+32)),Q=(0,E.dataSlice)(S,re+32);for(let ne=0;ne<ie;ne++){const L=oe(Q,ne*32);if(L==null)throw new Error("abort");X.push(L)}C.urls=X}catch{(0,E.assert)(!1,"corrupt OffchainLookup urls","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup urls"})}try{const X=de(S,64);if(X==null)throw new Error("abort");C.calldata=X}catch{(0,E.assert)(!1,"corrupt OffchainLookup calldata","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup calldata"})}(0,E.assert)((0,E.dataSlice)(S,100,128)===(0,E.dataSlice)(Z,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),C.selector=(0,E.dataSlice)(S,96,100);try{const X=de(S,128);if(X==null)throw new Error("abort");C.extraData=X}catch{(0,E.assert)(!1,"corrupt OffchainLookup extraData","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup extraData"})}return C.errorArgs="sender,urls,calldata,selector,extraData".split(/,/).map(X=>C[X]),C}return abstractProvider}var abstractSigner={},hasRequiredAbstractSigner;function requireAbstractSigner(){if(hasRequiredAbstractSigner)return abstractSigner;hasRequiredAbstractSigner=1,Object.defineProperty(abstractSigner,"__esModule",{value:!0}),abstractSigner.VoidSigner=abstractSigner.AbstractSigner=void 0;const b=requireAddress$2(),v=requireTransaction(),w=requireUtils$3(),_=requireProvider();function A(N,q){if(N.provider)return N.provider;(0,w.assert)(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:q})}async function E(N,q){let B=(0,_.copyRequest)(q);if(B.to!=null&&(B.to=(0,b.resolveAddress)(B.to,N)),B.from!=null){const O=B.from;B.from=Promise.all([N.getAddress(),(0,b.resolveAddress)(O,N)]).then(([I,D])=>((0,w.assertArgument)(I.toLowerCase()===D.toLowerCase(),"transaction from mismatch","tx.from",D),I))}else B.from=N.getAddress();return await(0,w.resolveProperties)(B)}class k{provider;constructor(q){(0,w.defineProperties)(this,{provider:q||null})}async getNonce(q){return A(this,"getTransactionCount").getTransactionCount(await this.getAddress(),q)}async populateCall(q){return await E(this,q)}async populateTransaction(q){const B=A(this,"populateTransaction"),O=await E(this,q);O.nonce==null&&(O.nonce=await this.getNonce("pending")),O.gasLimit==null&&(O.gasLimit=await this.estimateGas(O));const I=await this.provider.getNetwork();if(O.chainId!=null){const V=(0,w.getBigInt)(O.chainId);(0,w.assertArgument)(V===I.chainId,"transaction chainId mismatch","tx.chainId",q.chainId)}else O.chainId=I.chainId;const D=O.maxFeePerGas!=null||O.maxPriorityFeePerGas!=null;if(O.gasPrice!=null&&(O.type===2||D)?(0,w.assertArgument)(!1,"eip-1559 transaction do not support gasPrice","tx",q):(O.type===0||O.type===1)&&D&&(0,w.assertArgument)(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",q),(O.type===2||O.type==null)&&O.maxFeePerGas!=null&&O.maxPriorityFeePerGas!=null)O.type=2;else if(O.type===0||O.type===1){const V=await B.getFeeData();(0,w.assert)(V.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),O.gasPrice==null&&(O.gasPrice=V.gasPrice)}else{const V=await B.getFeeData();if(O.type==null)if(V.maxFeePerGas!=null&&V.maxPriorityFeePerGas!=null)if(O.type=2,O.gasPrice!=null){const ee=O.gasPrice;delete O.gasPrice,O.maxFeePerGas=ee,O.maxPriorityFeePerGas=ee}else O.maxFeePerGas==null&&(O.maxFeePerGas=V.maxFeePerGas),O.maxPriorityFeePerGas==null&&(O.maxPriorityFeePerGas=V.maxPriorityFeePerGas);else V.gasPrice!=null?((0,w.assert)(!D,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),O.gasPrice==null&&(O.gasPrice=V.gasPrice),O.type=0):(0,w.assert)(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else O.type===2&&(O.maxFeePerGas==null&&(O.maxFeePerGas=V.maxFeePerGas),O.maxPriorityFeePerGas==null&&(O.maxPriorityFeePerGas=V.maxPriorityFeePerGas))}return await(0,w.resolveProperties)(O)}async estimateGas(q){return A(this,"estimateGas").estimateGas(await this.populateCall(q))}async call(q){return A(this,"call").call(await this.populateCall(q))}async resolveName(q){return await A(this,"resolveName").resolveName(q)}async sendTransaction(q){const B=A(this,"sendTransaction"),O=await this.populateTransaction(q);delete O.from;const I=v.Transaction.from(O);return await B.broadcastTransaction(await this.signTransaction(I))}}abstractSigner.AbstractSigner=k;class P extends k{address;constructor(q,B){super(B),(0,w.defineProperties)(this,{address:q})}async getAddress(){return this.address}connect(q){return new P(this.address,q)}#e(q,B){(0,w.assert)(!1,`VoidSigner cannot sign ${q}`,"UNSUPPORTED_OPERATION",{operation:B})}async signTransaction(q){this.#e("transactions","signTransaction")}async signMessage(q){this.#e("messages","signMessage")}async signTypedData(q,B,O){this.#e("typed-data","signTypedData")}}return abstractSigner.VoidSigner=P,abstractSigner}var community={},hasRequiredCommunity;function requireCommunity(){if(hasRequiredCommunity)return community;hasRequiredCommunity=1,Object.defineProperty(community,"__esModule",{value:!0}),community.showThrottleMessage=void 0;const b=new Set;function v(w){b.has(w)||(b.add(w),console.log("========= NOTICE ========="),console.log(`Request-Rate Exceeded for ${w} (this message will not be repeated)`),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.org/api-keys/"),console.log("=========================="))}return community.showThrottleMessage=v,community}var defaultProvider={},providerAnkr={},providerJsonrpc={},subscriberFilterid={},hasRequiredSubscriberFilterid;function requireSubscriberFilterid(){if(hasRequiredSubscriberFilterid)return subscriberFilterid;hasRequiredSubscriberFilterid=1,Object.defineProperty(subscriberFilterid,"__esModule",{value:!0}),subscriberFilterid.FilterIdPendingSubscriber=subscriberFilterid.FilterIdEventSubscriber=subscriberFilterid.FilterIdSubscriber=void 0;const b=requireUtils$3(),v=requireSubscriberPolling();function w(k){return JSON.parse(JSON.stringify(k))}class _{#e;#t;#r;#n;#i;#s;constructor(P){this.#e=P,this.#t=null,this.#r=this.#a.bind(this),this.#n=!1,this.#i=null,this.#s=!1}_subscribe(P){throw new Error("subclasses must override this")}_emitResults(P,N){throw new Error("subclasses must override this")}_recover(P){throw new Error("subclasses must override this")}async#a(P){try{this.#t==null&&(this.#t=this._subscribe(this.#e));let N=null;try{N=await this.#t}catch(O){if(!(0,b.isError)(O,"UNSUPPORTED_OPERATION")||O.operation!=="eth_newFilter")throw O}if(N==null){this.#t=null,this.#e._recoverSubscriber(this,this._recover(this.#e));return}const q=await this.#e.getNetwork();if(this.#i||(this.#i=q),this.#i.chainId!==q.chainId)throw new Error("chaid changed");if(this.#s)return;const B=await this.#e.send("eth_getFilterChanges",[N]);await this._emitResults(this.#e,B)}catch(N){console.log("@TODO",N)}this.#e.once("block",this.#r)}#o(){const P=this.#t;P&&(this.#t=null,P.then(N=>{this.#e.send("eth_uninstallFilter",[N])}))}start(){this.#n||(this.#n=!0,this.#a(-2))}stop(){this.#n&&(this.#n=!1,this.#s=!0,this.#o(),this.#e.off("block",this.#r))}pause(P){P&&this.#o(),this.#e.off("block",this.#r)}resume(){this.start()}}subscriberFilterid.FilterIdSubscriber=_;class A extends _{#e;constructor(P,N){super(P),this.#e=w(N)}_recover(P){return new v.PollingEventSubscriber(P,this.#e)}async _subscribe(P){return await P.send("eth_newFilter",[this.#e])}async _emitResults(P,N){for(const q of N)P.emit(this.#e,P._wrapLog(q,P._network))}}subscriberFilterid.FilterIdEventSubscriber=A;class E extends _{async _subscribe(P){return await P.send("eth_newPendingTransactionFilter",[])}async _emitResults(P,N){for(const q of N)P.emit("pending",q)}}return subscriberFilterid.FilterIdPendingSubscriber=E,subscriberFilterid}var hasRequiredProviderJsonrpc;function requireProviderJsonrpc(){if(hasRequiredProviderJsonrpc)return providerJsonrpc;hasRequiredProviderJsonrpc=1,Object.defineProperty(providerJsonrpc,"__esModule",{value:!0}),providerJsonrpc.JsonRpcProvider=providerJsonrpc.JsonRpcApiPollingProvider=providerJsonrpc.JsonRpcApiProvider=providerJsonrpc.JsonRpcSigner=void 0;const b=requireAbi(),v=requireAddress$2(),w=requireHash(),_=requireTransaction(),A=requireUtils$3(),E=requireAbstractProvider(),k=requireAbstractSigner(),P=requireNetwork(),N=requireSubscriberFilterid(),q=requireSubscriberPolling(),B="bigint,boolean,function,number,string,symbol".split(/,/g);function O(de){if(de==null||B.indexOf(typeof de)>=0||typeof de.getAddress=="function")return de;if(Array.isArray(de))return de.map(O);if(typeof de=="object")return Object.keys(de).reduce((le,be)=>(le[be]=de[be],le),{});throw new Error(`should not happen: ${de} (${typeof de})`)}function I(de){return new Promise(le=>{setTimeout(le,de)})}function D(de){return de&&de.toLowerCase()}function V(de){return de&&typeof de.pollingInterval=="number"}const ee={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class J extends k.AbstractSigner{address;constructor(le,be){super(le),be=(0,v.getAddress)(be),(0,A.defineProperties)(this,{address:be})}connect(le){(0,A.assert)(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(le){return await this.populateCall(le)}async sendUncheckedTransaction(le){const be=O(le),pe=[];if(be.from){const Z=be.from;pe.push((async()=>{const U=await(0,v.resolveAddress)(Z,this.provider);(0,A.assertArgument)(U!=null&&U.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",le),be.from=U})())}else be.from=this.address;if(be.gasLimit==null&&pe.push((async()=>{be.gasLimit=await this.provider.estimateGas({...be,from:this.address})})()),be.to!=null){const Z=be.to;pe.push((async()=>{be.to=await(0,v.resolveAddress)(Z,this.provider)})())}pe.length&&await Promise.all(pe);const fe=this.provider.getRpcTransaction(be);return this.provider.send("eth_sendTransaction",[fe])}async sendTransaction(le){const be=await this.provider.getBlockNumber(),pe=await this.sendUncheckedTransaction(le);return await new Promise((fe,Z)=>{const U=[1e3,100],S=async()=>{const C=await this.provider.getTransaction(pe);if(C!=null){fe(C.replaceableTransaction(be));return}this.provider._setTimeout(()=>{S()},U.pop()||4e3)};S()})}async signTransaction(le){const be=O(le);if(be.from){const fe=await(0,v.resolveAddress)(be.from,this.provider);(0,A.assertArgument)(fe!=null&&fe.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",le),be.from=fe}else be.from=this.address;const pe=this.provider.getRpcTransaction(be);return await this.provider.send("eth_signTransaction",[pe])}async signMessage(le){const be=typeof le=="string"?(0,A.toUtf8Bytes)(le):le;return await this.provider.send("personal_sign",[(0,A.hexlify)(be),this.address.toLowerCase()])}async signTypedData(le,be,pe){const fe=O(pe),Z=await w.TypedDataEncoder.resolveNames(le,be,fe,async U=>{const S=await(0,v.resolveAddress)(U);return(0,A.assertArgument)(S!=null,"TypedData does not support null address","value",U),S});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(w.TypedDataEncoder.getPayload(Z.domain,be,Z.value))])}async unlock(le){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),le,null])}async _legacySignMessage(le){const be=typeof le=="string"?(0,A.toUtf8Bytes)(le):le;return await this.provider.send("eth_sign",[this.address.toLowerCase(),(0,A.hexlify)(be)])}}providerJsonrpc.JsonRpcSigner=J;class te extends E.AbstractProvider{#e;#t;#r;#n;#i;#s;#a(){if(this.#n)return;const le=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");this.#n=setTimeout(()=>{this.#n=null;const be=this.#r;for(this.#r=[];be.length;){const pe=[be.shift()];for(;be.length&&pe.length!==this.#e.batchMaxCount;)if(pe.push(be.shift()),JSON.stringify(pe.map(Z=>Z.payload)).length>this.#e.batchMaxSize){be.unshift(pe.pop());break}(async()=>{const fe=pe.length===1?pe[0].payload:pe.map(Z=>Z.payload);this.emit("debug",{action:"sendRpcPayload",payload:fe});try{const Z=await this._send(fe);this.emit("debug",{action:"receiveRpcResult",result:Z});for(const{resolve:U,reject:S,payload:C}of pe){if(this.destroyed){S((0,A.makeError)("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:C.method}));continue}const F=Z.filter(X=>X.id===C.id)[0];if(F==null){const X=(0,A.makeError)("missing response for request","BAD_DATA",{value:Z,info:{payload:C}});this.emit("error",X),S(X);continue}if("error"in F){S(this.getRpcError(C,F));continue}U(F.result)}}catch(Z){this.emit("debug",{action:"receiveRpcError",error:Z});for(const{reject:U}of pe)U(Z)}})()}},le)}constructor(le,be){super(le,be),this.#t=1,this.#e=Object.assign({},ee,be||{}),this.#r=[],this.#n=null,this.#s=null;{let fe=null;const Z=new Promise(U=>{fe=U});this.#i={promise:Z,resolve:fe}}const pe=this._getOption("staticNetwork");pe&&((0,A.assertArgument)(le==null||pe.matches(le),"staticNetwork MUST match network object","options",be),this.#s=pe)}_getOption(le){return this.#e[le]}get _network(){return(0,A.assert)(this.#s,"network is not available yet","NETWORK_ERROR"),this.#s}async _perform(le){if(le.method==="call"||le.method==="estimateGas"){let pe=le.transaction;if(pe&&pe.type!=null&&(0,A.getBigInt)(pe.type)&&pe.maxFeePerGas==null&&pe.maxPriorityFeePerGas==null){const fe=await this.getFeeData();fe.maxFeePerGas==null&&fe.maxPriorityFeePerGas==null&&(le=Object.assign({},le,{transaction:Object.assign({},pe,{type:void 0})}))}}const be=this.getRpcRequest(le);return be!=null?await this.send(be.method,be.args):super._perform(le)}async _detectNetwork(){const le=this._getOption("staticNetwork");if(le)return le;if(this.ready)return P.Network.from((0,A.getBigInt)(await this.send("eth_chainId",[])));const be={id:this.#t++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:be});let pe;try{pe=(await this._send(be))[0]}catch(fe){throw this.emit("debug",{action:"receiveRpcError",error:fe}),fe}if(this.emit("debug",{action:"receiveRpcResult",result:pe}),"result"in pe)return P.Network.from((0,A.getBigInt)(pe.result));throw this.getRpcError(be,pe)}_start(){this.#i==null||this.#i.resolve==null||(this.#i.resolve(),this.#i=null,(async()=>{for(;this.#s==null&&!this.destroyed;)try{this.#s=await this._detectNetwork()}catch(le){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",(0,A.makeError)("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:le}})),await I(1e3)}this.#a()})())}async _waitUntilReady(){if(this.#i!=null)return await this.#i.promise}_getSubscriber(le){return le.type==="pending"?new N.FilterIdPendingSubscriber(this):le.type==="event"?this._getOption("polling")?new q.PollingEventSubscriber(this,le.filter):new N.FilterIdEventSubscriber(this,le.filter):le.type==="orphan"&&le.filter.orphan==="drop-log"?new E.UnmanagedSubscriber("orphan"):super._getSubscriber(le)}get ready(){return this.#i==null}getRpcTransaction(le){const be={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(pe=>{if(le[pe]==null)return;let fe=pe;pe==="gasLimit"&&(fe="gas"),be[fe]=(0,A.toQuantity)((0,A.getBigInt)(le[pe],`tx.${pe}`))}),["from","to","data"].forEach(pe=>{le[pe]!=null&&(be[pe]=(0,A.hexlify)(le[pe]))}),le.accessList&&(be.accessList=(0,_.accessListify)(le.accessList)),be}getRpcRequest(le){switch(le.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getBalance":return{method:"eth_getBalance",args:[D(le.address),le.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[D(le.address),le.blockTag]};case"getCode":return{method:"eth_getCode",args:[D(le.address),le.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[D(le.address),"0x"+le.position.toString(16),le.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[le.signedTransaction]};case"getBlock":if("blockTag"in le)return{method:"eth_getBlockByNumber",args:[le.blockTag,!!le.includeTransactions]};if("blockHash"in le)return{method:"eth_getBlockByHash",args:[le.blockHash,!!le.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[le.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[le.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(le.transaction),le.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(le.transaction)]};case"getLogs":return le.filter&&le.filter.address!=null&&(Array.isArray(le.filter.address)?le.filter.address=le.filter.address.map(D):le.filter.address=D(le.filter.address)),{method:"eth_getLogs",args:[le.filter]}}return null}getRpcError(le,be){const{method:pe}=le,{error:fe}=be;if(pe==="eth_estimateGas"&&fe.message){const S=fe.message;if(!S.match(/revert/i)&&S.match(/insufficient funds/i))return(0,A.makeError)("insufficient funds","INSUFFICIENT_FUNDS",{transaction:le.params[0],info:{payload:le,error:fe}})}if(pe==="eth_call"||pe==="eth_estimateGas"){const S=ae(fe),C=b.AbiCoder.getBuiltinCallException(pe==="eth_call"?"call":"estimateGas",le.params[0],S?S.data:null);return C.info={error:fe,payload:le},C}const Z=JSON.stringify(oe(fe));if(typeof fe.message=="string"&&fe.message.match(/user denied|ethers-user-denied/i)){const S={eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"};return(0,A.makeError)("user rejected action","ACTION_REJECTED",{action:S[pe]||"unknown",reason:"rejected",info:{payload:le,error:fe}})}if(pe==="eth_sendRawTransaction"||pe==="eth_sendTransaction"){const S=le.params[0];if(Z.match(/insufficient funds|base fee exceeds gas limit/i))return(0,A.makeError)("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:S,info:{error:fe}});if(Z.match(/nonce/i)&&Z.match(/too low/i))return(0,A.makeError)("nonce has already been used","NONCE_EXPIRED",{transaction:S,info:{error:fe}});if(Z.match(/replacement transaction/i)&&Z.match(/underpriced/i))return(0,A.makeError)("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:S,info:{error:fe}});if(Z.match(/only replay-protected/i))return(0,A.makeError)("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:pe,info:{transaction:S,info:{error:fe}}})}let U=!!Z.match(/the method .* does not exist/i);return U||fe&&fe.details&&fe.details.startsWith("Unauthorized method:")&&(U=!0),U?(0,A.makeError)("unsupported operation","UNSUPPORTED_OPERATION",{operation:le.method,info:{error:fe,payload:le}}):(0,A.makeError)("could not coalesce error","UNKNOWN_ERROR",{error:fe,payload:le})}send(le,be){if(this.destroyed)return Promise.reject((0,A.makeError)("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:le}));const pe=this.#t++,fe=new Promise((Z,U)=>{this.#r.push({resolve:Z,reject:U,payload:{method:le,params:be,id:pe,jsonrpc:"2.0"}})});return this.#a(),fe}async getSigner(le){le==null&&(le=0);const be=this.send("eth_accounts",[]);if(typeof le=="number"){const fe=await be;if(le>=fe.length)throw new Error("no such account");return new J(this,fe[le])}const{accounts:pe}=await(0,A.resolveProperties)({network:this.getNetwork(),accounts:be});le=(0,v.getAddress)(le);for(const fe of pe)if((0,v.getAddress)(fe)===le)return new J(this,le);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(be=>new J(this,be))}destroy(){this.#n&&(clearTimeout(this.#n),this.#n=null);for(const{payload:le,reject:be}of this.#r)be((0,A.makeError)("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:le.method}));this.#r=[],super.destroy()}}providerJsonrpc.JsonRpcApiProvider=te;class se extends te{#e;constructor(le,be){super(le,be),this.#e=4e3}_getSubscriber(le){const be=super._getSubscriber(le);return V(be)&&(be.pollingInterval=this.#e),be}get pollingInterval(){return this.#e}set pollingInterval(le){if(!Number.isInteger(le)||le<0)throw new Error("invalid interval");this.#e=le,this._forEachSubscriber(be=>{V(be)&&(be.pollingInterval=this.#e)})}}providerJsonrpc.JsonRpcApiPollingProvider=se;class ce extends se{#e;constructor(le,be,pe){le==null&&(le="http://localhost:8545"),super(be,pe),typeof le=="string"?this.#e=new A.FetchRequest(le):this.#e=le.clone()}_getConnection(){return this.#e.clone()}async send(le,be){return await this._start(),await super.send(le,be)}async _send(le){const be=this._getConnection();be.body=JSON.stringify(le),be.setHeader("content-type","application/json");const pe=await be.send();pe.assertOk();let fe=pe.bodyJson;return Array.isArray(fe)||(fe=[fe]),fe}}providerJsonrpc.JsonRpcProvider=ce;function ae(de){if(de==null)return null;if(typeof de.message=="string"&&de.message.match(/revert/i)&&(0,A.isHexString)(de.data))return{message:de.message,data:de.data};if(typeof de=="object"){for(const le in de){const be=ae(de[le]);if(be)return be}return null}if(typeof de=="string")try{return ae(JSON.parse(de))}catch{}return null}function he(de,le){if(de!=null){if(typeof de.message=="string"&&le.push(de.message),typeof de=="object")for(const be in de)he(de[be],le);if(typeof de=="string")try{return he(JSON.parse(de),le)}catch{}}}function oe(de){const le=[];return he(de,le),le}return providerJsonrpc}var hasRequiredProviderAnkr;function requireProviderAnkr(){if(hasRequiredProviderAnkr)return providerAnkr;hasRequiredProviderAnkr=1,Object.defineProperty(providerAnkr,"__esModule",{value:!0}),providerAnkr.AnkrProvider=void 0;const b=requireUtils$3(),v=requireCommunity(),w=requireNetwork(),_=requireProviderJsonrpc(),A="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function E(P){switch(P){case"mainnet":return"rpc.ankr.com/eth";case"goerli":return"rpc.ankr.com/eth_goerli";case"matic":return"rpc.ankr.com/polygon";case"arbitrum":return"rpc.ankr.com/arbitrum"}(0,b.assertArgument)(!1,"unsupported network","network",P)}class k extends _.JsonRpcProvider{apiKey;constructor(N,q){N==null&&(N="mainnet");const B=w.Network.from(N);q==null&&(q=A);const O={polling:!0,staticNetwork:B},I=k.getRequest(B,q);super(I,B,O),(0,b.defineProperties)(this,{apiKey:q})}_getProvider(N){try{return new k(N,this.apiKey)}catch{}return super._getProvider(N)}static getRequest(N,q){q==null&&(q=A);const B=new b.FetchRequest(`https://${E(N.name)}/${q}`);return B.allowGzip=!0,q===A&&(B.retryFunc=async(O,I,D)=>((0,v.showThrottleMessage)("AnkrProvider"),!0)),B}getRpcError(N,q){return N.method==="eth_sendRawTransaction"&&q&&q.error&&q.error.message==="INTERNAL_ERROR: could not replace existing tx"&&(q.error.message="replacement transaction underpriced"),super.getRpcError(N,q)}isCommunityResource(){return this.apiKey===A}}return providerAnkr.AnkrProvider=k,providerAnkr}var providerAlchemy={},hasRequiredProviderAlchemy;function requireProviderAlchemy(){if(hasRequiredProviderAlchemy)return providerAlchemy;hasRequiredProviderAlchemy=1,Object.defineProperty(providerAlchemy,"__esModule",{value:!0}),providerAlchemy.AlchemyProvider=void 0;const b=requireUtils$3(),v=requireCommunity(),w=requireNetwork(),_=requireProviderJsonrpc(),A="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";function E(P){switch(P){case"mainnet":return"eth-mainnet.alchemyapi.io";case"goerli":return"eth-goerli.g.alchemy.com";case"sepolia":return"eth-sepolia.g.alchemy.com";case"arbitrum":return"arb-mainnet.g.alchemy.com";case"arbitrum-goerli":return"arb-goerli.g.alchemy.com";case"matic":return"polygon-mainnet.g.alchemy.com";case"matic-mumbai":return"polygon-mumbai.g.alchemy.com";case"optimism":return"opt-mainnet.g.alchemy.com";case"optimism-goerli":return"opt-goerli.g.alchemy.com"}(0,b.assertArgument)(!1,"unsupported network","network",P)}class k extends _.JsonRpcProvider{apiKey;constructor(N,q){N==null&&(N="mainnet");const B=w.Network.from(N);q==null&&(q=A);const O=k.getRequest(B,q);super(O,B,{staticNetwork:B}),(0,b.defineProperties)(this,{apiKey:q})}_getProvider(N){try{return new k(N,this.apiKey)}catch{}return super._getProvider(N)}async _perform(N){if(N.method==="getTransactionResult"){const{trace:q,tx:B}=await(0,b.resolveProperties)({trace:this.send("trace_transaction",[N.hash]),tx:this.getTransaction(N.hash)});if(q==null||B==null)return null;let O,I=!1;try{O=q[0].result.output,I=q[0].error==="Reverted"}catch{}if(O)return(0,b.assert)(!I,"an error occurred during transaction executions","CALL_EXCEPTION",{action:"getTransactionResult",data:O,reason:null,transaction:B,invocation:null,revert:null}),O;(0,b.assert)(!1,"could not parse trace result","BAD_DATA",{value:q})}return await super._perform(N)}isCommunityResource(){return this.apiKey===A}static getRequest(N,q){q==null&&(q=A);const B=new b.FetchRequest(`https://${E(N.name)}/v2/${q}`);return B.allowGzip=!0,q===A&&(B.retryFunc=async(O,I,D)=>((0,v.showThrottleMessage)("alchemy"),!0)),B}}return providerAlchemy.AlchemyProvider=k,providerAlchemy}var providerCloudflare={},hasRequiredProviderCloudflare;function requireProviderCloudflare(){if(hasRequiredProviderCloudflare)return providerCloudflare;hasRequiredProviderCloudflare=1,Object.defineProperty(providerCloudflare,"__esModule",{value:!0}),providerCloudflare.CloudflareProvider=void 0;const b=requireUtils$3(),v=requireNetwork(),w=requireProviderJsonrpc();class _ extends w.JsonRpcProvider{constructor(E){E==null&&(E="mainnet");const k=v.Network.from(E);(0,b.assertArgument)(k.name==="mainnet","unsupported network","network",E),super("https://cloudflare-eth.com/",k,{staticNetwork:k})}}return providerCloudflare.CloudflareProvider=_,providerCloudflare}var providerEtherscan={},hasRequiredProviderEtherscan;function requireProviderEtherscan(){if(hasRequiredProviderEtherscan)return providerEtherscan;hasRequiredProviderEtherscan=1,Object.defineProperty(providerEtherscan,"__esModule",{value:!0}),providerEtherscan.EtherscanProvider=providerEtherscan.EtherscanPlugin=void 0;const b=requireAbi(),v=requireContract(),w=requireTransaction(),_=requireUtils$3(),A=requireAbstractProvider(),E=requireNetwork(),k=requirePluginsNetwork(),P=requireCommunity(),N=2e3;function q(ee){return ee&&typeof ee.then=="function"}const B="org.ethers.plugins.provider.Etherscan";class O extends k.NetworkPlugin{baseUrl;constructor(J){super(B),(0,_.defineProperties)(this,{baseUrl:J})}clone(){return new O(this.baseUrl)}}providerEtherscan.EtherscanPlugin=O;const I=["enableCcipRead"];let D=1;class V extends A.AbstractProvider{network;apiKey;#e;constructor(J,te){const se=te??null;super();const ce=E.Network.from(J);this.#e=ce.getPlugin(B),(0,_.defineProperties)(this,{apiKey:se,network:ce}),this.getBaseUrl()}getBaseUrl(){if(this.#e)return this.#e.baseUrl;switch(this.network.name){case"mainnet":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"matic":return"https://api.polygonscan.com";case"matic-mumbai":return"https://api-testnet.polygonscan.com";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io";case"bnb":return"http://api.bscscan.com";case"bnbt":return"http://api-testnet.bscscan.com"}(0,_.assertArgument)(!1,"unsupported network","network",this.network)}getUrl(J,te){const se=Object.keys(te).reduce((ae,he)=>{const oe=te[he];return oe!=null&&(ae+=`&${he}=${oe}`),ae},""),ce=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.getBaseUrl()}/api?module=${J}${se}${ce}`}getPostUrl(){return`${this.getBaseUrl()}/api`}getPostData(J,te){return te.module=J,te.apikey=this.apiKey,te}async detectNetwork(){return this.network}async fetch(J,te,se){const ce=D++,ae=se?this.getPostUrl():this.getUrl(J,te),he=se?this.getPostData(J,te):null;this.emit("debug",{action:"sendRequest",id:ce,url:ae,payload:he});const oe=new _.FetchRequest(ae);oe.setThrottleParams({slotInterval:1e3}),oe.retryFunc=(be,pe,fe)=>(this.isCommunityResource()&&(0,P.showThrottleMessage)("Etherscan"),Promise.resolve(!0)),oe.processFunc=async(be,pe)=>{const fe=pe.hasBody()?JSON.parse((0,_.toUtf8String)(pe.body)):{},Z=(typeof fe.result=="string"?fe.result:"").toLowerCase().indexOf("rate limit")>=0;return J==="proxy"?fe&&fe.status==0&&fe.message=="NOTOK"&&Z&&(this.emit("debug",{action:"receiveError",id:ce,reason:"proxy-NOTOK",error:fe}),pe.throwThrottleError(fe.result,N)):Z&&(this.emit("debug",{action:"receiveError",id:ce,reason:"null result",error:fe.result}),pe.throwThrottleError(fe.result,N)),pe},he&&(oe.setHeader("content-type","application/x-www-form-urlencoded; charset=UTF-8"),oe.body=Object.keys(he).map(be=>`${be}=${he[be]}`).join("&"));const de=await oe.send();try{de.assertOk()}catch(be){this.emit("debug",{action:"receiveError",id:ce,error:be,reason:"assertOk"}),(0,_.assert)(!1,"response error","SERVER_ERROR",{request:oe,response:de})}de.hasBody()||(this.emit("debug",{action:"receiveError",id:ce,error:"missing body",reason:"null body"}),(0,_.assert)(!1,"missing response","SERVER_ERROR",{request:oe,response:de}));const le=JSON.parse((0,_.toUtf8String)(de.body));return J==="proxy"?(le.jsonrpc!="2.0"&&(this.emit("debug",{action:"receiveError",id:ce,result:le,reason:"invalid JSON-RPC"}),(0,_.assert)(!1,"invalid JSON-RPC response (missing jsonrpc='2.0')","SERVER_ERROR",{request:oe,response:de,info:{result:le}})),le.error&&(this.emit("debug",{action:"receiveError",id:ce,result:le,reason:"JSON-RPC error"}),(0,_.assert)(!1,"error response","SERVER_ERROR",{request:oe,response:de,info:{result:le}})),this.emit("debug",{action:"receiveRequest",id:ce,result:le}),le.result):le.status==0&&(le.message==="No records found"||le.message==="No transactions found")?(this.emit("debug",{action:"receiveRequest",id:ce,result:le}),le.result):((le.status!=1||typeof le.message=="string"&&!le.message.match(/^OK/))&&(this.emit("debug",{action:"receiveError",id:ce,result:le}),(0,_.assert)(!1,"error response","SERVER_ERROR",{request:oe,response:de,info:{result:le}})),this.emit("debug",{action:"receiveRequest",id:ce,result:le}),le.result)}_getTransactionPostData(J){const te={};for(let se in J){if(I.indexOf(se)>=0||J[se]==null)continue;let ce=J[se];se==="type"&&ce===0||se==="blockTag"&&ce==="latest"||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[se]?ce=(0,_.toQuantity)(ce):se==="accessList"?ce="["+(0,w.accessListify)(ce).map(ae=>`{address:"${ae.address}",storageKeys:["${ae.storageKeys.join('","')}"]}`).join(",")+"]":ce=(0,_.hexlify)(ce),te[se]=ce)}return te}_checkError(J,te,se){let ce="";if((0,_.isError)(te,"SERVER_ERROR")){try{ce=te.info.result.error.message}catch{}if(!ce)try{ce=te.info.message}catch{}}if(J.method==="estimateGas"&&!ce.match(/revert/i)&&ce.match(/insufficient funds/i)&&(0,_.assert)(!1,"insufficient funds","INSUFFICIENT_FUNDS",{transaction:J.transaction}),(J.method==="call"||J.method==="estimateGas")&&ce.match(/execution reverted/i)){let ae="";try{ae=te.info.result.error.data}catch{}const he=b.AbiCoder.getBuiltinCallException(J.method,J.transaction,ae);throw he.info={request:J,error:te},he}if(ce&&J.method==="broadcastTransaction"){const ae=w.Transaction.from(J.signedTransaction);ce.match(/replacement/i)&&ce.match(/underpriced/i)&&(0,_.assert)(!1,"replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:ae}),ce.match(/insufficient funds/)&&(0,_.assert)(!1,"insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:ae}),ce.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&(0,_.assert)(!1,"nonce has already been used","NONCE_EXPIRED",{transaction:ae})}throw te}async _detectNetwork(){return this.network}async _perform(J){switch(J.method){case"chainId":return this.network.chainId;case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:J.address,tag:J.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:J.address,tag:J.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:J.address,tag:J.blockTag});case"getStorage":return this.fetch("proxy",{action:"eth_getStorageAt",address:J.address,position:J.position,tag:J.blockTag});case"broadcastTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:J.signedTransaction},!0).catch(te=>this._checkError(J,te,J.signedTransaction));case"getBlock":if("blockTag"in J)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:J.blockTag,boolean:J.includeTransactions?"true":"false"});(0,_.assert)(!1,"getBlock by blockHash not supported by Etherscan","UNSUPPORTED_OPERATION",{operation:"getBlock(blockHash)"});case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:J.hash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:J.hash});case"call":{if(J.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const te=this._getTransactionPostData(J.transaction);te.module="proxy",te.action="eth_call";try{return await this.fetch("proxy",te,!0)}catch(se){return this._checkError(J,se,J.transaction)}}case"estimateGas":{const te=this._getTransactionPostData(J.transaction);te.module="proxy",te.action="eth_estimateGas";try{return await this.fetch("proxy",te,!0)}catch(se){return this._checkError(J,se,J.transaction)}}}return super._perform(J)}async getNetwork(){return this.network}async getEtherPrice(){return this.network.name!=="mainnet"?0:parseFloat((await this.fetch("stats",{action:"ethprice"})).ethusd)}async getContract(J){let te=this._getAddress(J);q(te)&&(te=await te);try{const se=await this.fetch("contract",{action:"getabi",address:te}),ce=JSON.parse(se);return new v.Contract(te,ce,this)}catch{return null}}isCommunityResource(){return this.apiKey==null}}return providerEtherscan.EtherscanProvider=V,providerEtherscan}var providerInfura={},providerWebsocket={},wsBrowser={},hasRequiredWsBrowser;function requireWsBrowser(){if(hasRequiredWsBrowser)return wsBrowser;hasRequiredWsBrowser=1,Object.defineProperty(wsBrowser,"__esModule",{value:!0}),wsBrowser.WebSocket=void 0;function b(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof commonjsGlobal<"u")return commonjsGlobal;throw new Error("unable to locate global object")}const v=b().WebSocket;return wsBrowser.WebSocket=v,wsBrowser}var providerSocket={},hasRequiredProviderSocket;function requireProviderSocket(){if(hasRequiredProviderSocket)return providerSocket;hasRequiredProviderSocket=1,Object.defineProperty(providerSocket,"__esModule",{value:!0}),providerSocket.SocketProvider=providerSocket.SocketEventSubscriber=providerSocket.SocketPendingSubscriber=providerSocket.SocketBlockSubscriber=providerSocket.SocketSubscriber=void 0;const b=requireAbstractProvider(),v=requireUtils$3(),w=requireProviderJsonrpc();class _{#e;#t;get filter(){return JSON.parse(this.#t)}#r;#n;#i;constructor(q,B){this.#e=q,this.#t=JSON.stringify(B),this.#r=null,this.#n=null,this.#i=null}start(){this.#r=this.#e.send("eth_subscribe",this.filter).then(q=>(this.#e._register(q,this),q))}stop(){this.#r.then(q=>{this.#e.send("eth_unsubscribe",[q])}),this.#r=null}pause(q){(0,v.assert)(q,"preserve logs while paused not supported by SocketSubscriber yet","UNSUPPORTED_OPERATION",{operation:"pause(false)"}),this.#n=!!q}resume(){this.#n=null}_handleMessage(q){if(this.#r!=null&&this.#n===null){let B=this.#i;B==null?B=this._emit(this.#e,q):B=B.then(async()=>{await this._emit(this.#e,q)}),this.#i=B.then(()=>{this.#i===B&&(this.#i=null)})}}async _emit(q,B){throw new Error("sub-classes must implemente this; _emit")}}providerSocket.SocketSubscriber=_;class A extends _{constructor(q){super(q,["newHeads"])}async _emit(q,B){q.emit("block",parseInt(B.number))}}providerSocket.SocketBlockSubscriber=A;class E extends _{constructor(q){super(q,["newPendingTransactions"])}async _emit(q,B){q.emit("pending",B)}}providerSocket.SocketPendingSubscriber=E;class k extends _{#e;get logFilter(){return JSON.parse(this.#e)}constructor(q,B){super(q,["logs",B]),this.#e=JSON.stringify(B)}async _emit(q,B){q.emit(this.logFilter,q._wrapLog(B,q._network))}}providerSocket.SocketEventSubscriber=k;class P extends w.JsonRpcApiProvider{#e;#t;#r;constructor(q){super(q,{batchMaxCount:1}),this.#e=new Map,this.#t=new Map,this.#r=new Map}_getSubscriber(q){switch(q.type){case"close":return new b.UnmanagedSubscriber("close");case"block":return new A(this);case"pending":return new E(this);case"event":return new k(this,q.filter);case"orphan":if(q.filter.orphan==="drop-log")return new b.UnmanagedSubscriber("drop-log")}return super._getSubscriber(q)}_register(q,B){this.#t.set(q,B);const O=this.#r.get(q);if(O){for(const I of O)B._handleMessage(I);this.#r.delete(q)}}async _send(q){(0,v.assertArgument)(!Array.isArray(q),"WebSocket does not support batch send","payload",q);const B=new Promise((O,I)=>{this.#e.set(q.id,{payload:q,resolve:O,reject:I})});return await this._waitUntilReady(),await this._write(JSON.stringify(q)),[await B]}async _processMessage(q){const B=JSON.parse(q);if(B&&typeof B=="object"&&"id"in B){const O=this.#e.get(B.id);if(O==null){this.emit("error",(0,v.makeError)("received result for unknown id","UNKNOWN_ERROR",{reasonCode:"UNKNOWN_ID",result:B}));return}this.#e.delete(B.id),O.resolve(B)}else if(B&&B.method==="eth_subscription"){const O=B.params.subscription,I=this.#t.get(O);if(I)I._handleMessage(B.params.result);else{let D=this.#r.get(O);D==null&&(D=[],this.#r.set(O,D)),D.push(B.params.result)}}else{this.emit("error",(0,v.makeError)("received unexpected message","UNKNOWN_ERROR",{reasonCode:"UNEXPECTED_MESSAGE",result:B}));return}}async _write(q){throw new Error("sub-classes must override this")}}return providerSocket.SocketProvider=P,providerSocket}var hasRequiredProviderWebsocket;function requireProviderWebsocket(){if(hasRequiredProviderWebsocket)return providerWebsocket;hasRequiredProviderWebsocket=1,Object.defineProperty(providerWebsocket,"__esModule",{value:!0}),providerWebsocket.WebSocketProvider=void 0;const b=requireWsBrowser(),v=requireProviderSocket();class w extends v.SocketProvider{#e;#t;get websocket(){if(this.#t==null)throw new Error("websocket closed");return this.#t}constructor(A,E){super(E),typeof A=="string"?(this.#e=()=>new b.WebSocket(A),this.#t=this.#e()):typeof A=="function"?(this.#e=A,this.#t=A()):(this.#e=null,this.#t=A),this.websocket.onopen=async()=>{try{await this._start(),this.resume()}catch(k){console.log("failed to start WebsocketProvider",k)}},this.websocket.onmessage=k=>{this._processMessage(k.data)}}async _write(A){this.websocket.send(A)}async destroy(){this.#t!=null&&(this.#t.close(),this.#t=null),super.destroy()}}return providerWebsocket.WebSocketProvider=w,providerWebsocket}var hasRequiredProviderInfura;function requireProviderInfura(){if(hasRequiredProviderInfura)return providerInfura;hasRequiredProviderInfura=1,Object.defineProperty(providerInfura,"__esModule",{value:!0}),providerInfura.InfuraProvider=providerInfura.InfuraWebSocketProvider=void 0;const b=requireUtils$3(),v=requireCommunity(),w=requireNetwork(),_=requireProviderJsonrpc(),A=requireProviderWebsocket(),E="84842078b09946638c03157f83405213";function k(q){switch(q){case"mainnet":return"mainnet.infura.io";case"goerli":return"goerli.infura.io";case"sepolia":return"sepolia.infura.io";case"arbitrum":return"arbitrum-mainnet.infura.io";case"arbitrum-goerli":return"arbitrum-goerli.infura.io";case"linea":return"linea-mainnet.infura.io";case"linea-goerli":return"linea-goerli.infura.io";case"matic":return"polygon-mainnet.infura.io";case"matic-mumbai":return"polygon-mumbai.infura.io";case"optimism":return"optimism-mainnet.infura.io";case"optimism-goerli":return"optimism-goerli.infura.io"}(0,b.assertArgument)(!1,"unsupported network","network",q)}class P extends A.WebSocketProvider{projectId;projectSecret;constructor(B,O){const I=new N(B,O),D=I._getConnection();(0,b.assert)(!D.credentials,"INFURA WebSocket project secrets unsupported","UNSUPPORTED_OPERATION",{operation:"InfuraProvider.getWebSocketProvider()"});const V=D.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(V,B),(0,b.defineProperties)(this,{projectId:I.projectId,projectSecret:I.projectSecret})}isCommunityResource(){return this.projectId===E}}providerInfura.InfuraWebSocketProvider=P;class N extends _.JsonRpcProvider{projectId;projectSecret;constructor(B,O,I){B==null&&(B="mainnet");const D=w.Network.from(B);O==null&&(O=E),I==null&&(I=null);const V=N.getRequest(D,O,I);super(V,D,{staticNetwork:D}),(0,b.defineProperties)(this,{projectId:O,projectSecret:I})}_getProvider(B){try{return new N(B,this.projectId,this.projectSecret)}catch{}return super._getProvider(B)}isCommunityResource(){return this.projectId===E}static getWebSocketProvider(B,O){return new P(B,O)}static getRequest(B,O,I){O==null&&(O=E),I==null&&(I=null);const D=new b.FetchRequest(`https://${k(B.name)}/v3/${O}`);return D.allowGzip=!0,I&&D.setCredentials("",I),O===E&&(D.retryFunc=async(V,ee,J)=>((0,v.showThrottleMessage)("InfuraProvider"),!0)),D}}return providerInfura.InfuraProvider=N,providerInfura}var providerQuicknode={},hasRequiredProviderQuicknode;function requireProviderQuicknode(){if(hasRequiredProviderQuicknode)return providerQuicknode;hasRequiredProviderQuicknode=1,Object.defineProperty(providerQuicknode,"__esModule",{value:!0}),providerQuicknode.QuickNodeProvider=void 0;const b=requireUtils$3(),v=requireCommunity(),w=requireNetwork(),_=requireProviderJsonrpc(),A="919b412a057b5e9c9b6dce193c5a60242d6efadb";function E(P){switch(P){case"mainnet":return"ethers.quiknode.pro";case"goerli":return"ethers.ethereum-goerli.quiknode.pro";case"arbitrum":return"ethers.arbitrum-mainnet.quiknode.pro";case"arbitrum-goerli":return"ethers.arbitrum-goerli.quiknode.pro";case"matic":return"ethers.matic.quiknode.pro";case"matic-mumbai":return"ethers.matic-testnet.quiknode.pro";case"optimism":return"ethers.optimism.quiknode.pro";case"optimism-goerli":return"ethers.optimism-goerli.quiknode.pro"}(0,b.assertArgument)(!1,"unsupported network","network",P)}class k extends _.JsonRpcProvider{token;constructor(N,q){N==null&&(N="mainnet");const B=w.Network.from(N);q==null&&(q=A);const O=k.getRequest(B,q);super(O,B,{staticNetwork:B}),(0,b.defineProperties)(this,{token:q})}_getProvider(N){try{return new k(N,this.token)}catch{}return super._getProvider(N)}isCommunityResource(){return this.token===A}static getRequest(N,q){q==null&&(q=A);const B=new b.FetchRequest(`https://${E(N.name)}/${q}`);return B.allowGzip=!0,q===A&&(B.retryFunc=async(O,I,D)=>((0,v.showThrottleMessage)("QuickNodeProvider"),!0)),B}}return providerQuicknode.QuickNodeProvider=k,providerQuicknode}var providerFallback={},hasRequiredProviderFallback;function requireProviderFallback(){if(hasRequiredProviderFallback)return providerFallback;hasRequiredProviderFallback=1,Object.defineProperty(providerFallback,"__esModule",{value:!0}),providerFallback.FallbackProvider=void 0;const b=requireUtils$3(),v=requireAbstractProvider(),w=requireNetwork(),_=BigInt("1"),A=BigInt("2");function E(ce){for(let ae=ce.length-1;ae>0;ae--){const he=Math.floor(Math.random()*(ae+1)),oe=ce[ae];ce[ae]=ce[he],ce[he]=oe}}function k(ce){return new Promise(ae=>{setTimeout(ae,ce)})}function P(){return new Date().getTime()}function N(ce){return JSON.stringify(ce,(ae,he)=>typeof he=="bigint"?{type:"bigint",value:he.toString()}:he)}const q={stallTimeout:400,priority:1,weight:1},B={blockNumber:-2,requests:0,lateResponses:0,errorResponses:0,outOfSync:-1,unsupportedEvents:0,rollingDuration:0,score:0,_network:null,_updateNumber:null,_totalTime:0,_lastFatalError:null,_lastFatalErrorTimestamp:0};async function O(ce,ae){for(;(ce.blockNumber<0||ce.blockNumber<ae)&&(ce._updateNumber||(ce._updateNumber=(async()=>{try{const he=await ce.provider.getBlockNumber();he>ce.blockNumber&&(ce.blockNumber=he)}catch(he){ce.blockNumber=-2,ce._lastFatalError=he,ce._lastFatalErrorTimestamp=P()}ce._updateNumber=null})()),await ce._updateNumber,ce.outOfSync++,!ce._lastFatalError););}function I(ce){if(ce==null)return"null";if(Array.isArray(ce))return"["+ce.map(I).join(",")+"]";if(typeof ce=="object"&&typeof ce.toJSON=="function")return I(ce.toJSON());switch(typeof ce){case"boolean":case"symbol":return ce.toString();case"bigint":case"number":return BigInt(ce).toString();case"string":return JSON.stringify(ce);case"object":{const ae=Object.keys(ce);return ae.sort(),"{"+ae.map(he=>`${JSON.stringify(he)}:${I(ce[he])}`).join(",")+"}"}}throw console.log("Could not serialize",ce),new Error("Hmm...")}function D(ce){if("error"in ce){const he=ce.error;return{tag:I(he),value:he}}const ae=ce.result;return{tag:I(ae),value:ae}}function V(ce,ae){const he=new Map;for(const{value:de,tag:le,weight:be}of ae){const pe=he.get(le)||{value:de,weight:0};pe.weight+=be,he.set(le,pe)}let oe=null;for(const de of he.values())de.weight>=ce&&(!oe||de.weight>oe.weight)&&(oe=de);if(oe)return oe.value}function ee(ce,ae){let he=0;const oe=new Map;let de=null;const le=[];for(const{value:pe,tag:fe,weight:Z}of ae)if(pe instanceof Error){const U=oe.get(fe)||{value:pe,weight:0};U.weight+=Z,oe.set(fe,U),(de==null||U.weight>de.weight)&&(de=U)}else le.push(BigInt(pe)),he+=Z;if(he<ce)return de&&de.weight>=ce?de.value:void 0;le.sort((pe,fe)=>pe<fe?-1:fe>pe?1:0);const be=Math.floor(le.length/2);return le.length%2?le[be]:(le[be-1]+le[be]+_)/A}function J(ce,ae){const he=V(ce,ae);if(he!==void 0)return he;for(const oe of ae)if(oe.value)return oe.value}function te(ce,ae){if(ce===1)return(0,b.getNumber)(ee(ce,ae),"%internal");const he=new Map,oe=(be,pe)=>{const fe=he.get(be)||{result:be,weight:0};fe.weight+=pe,he.set(be,fe)};for(const{weight:be,value:pe}of ae){const fe=(0,b.getNumber)(pe);oe(fe-1,be),oe(fe,be),oe(fe+1,be)}let de=0,le;for(const{weight:be,result:pe}of he.values())be>=ce&&(be>de||le!=null&&be===de&&pe>le)&&(de=be,le=pe);return le}class se extends v.AbstractProvider{quorum;eventQuorum;eventWorkers;#e;#t;#r;constructor(ae,he,oe){super(he,oe),this.#e=ae.map(de=>de instanceof v.AbstractProvider?Object.assign({provider:de},q,B):Object.assign({},q,de,B)),this.#t=-2,this.#r=null,oe&&oe.quorum!=null?this.quorum=oe.quorum:this.quorum=Math.ceil(this.#e.reduce((de,le)=>(de+=le.weight,de),0)/2),this.eventQuorum=1,this.eventWorkers=1,(0,b.assertArgument)(this.quorum<=this.#e.reduce((de,le)=>de+le.weight,0),"quorum exceed provider wieght","quorum",this.quorum)}get providerConfigs(){return this.#e.map(ae=>{const he=Object.assign({},ae);for(const oe in he)oe[0]==="_"&&delete he[oe];return he})}async _detectNetwork(){return w.Network.from((0,b.getBigInt)(await this._perform({method:"chainId"})))}async _translatePerform(ae,he){switch(he.method){case"broadcastTransaction":return await ae.broadcastTransaction(he.signedTransaction);case"call":return await ae.call(Object.assign({},he.transaction,{blockTag:he.blockTag}));case"chainId":return(await ae.getNetwork()).chainId;case"estimateGas":return await ae.estimateGas(he.transaction);case"getBalance":return await ae.getBalance(he.address,he.blockTag);case"getBlock":{const oe="blockHash"in he?he.blockHash:he.blockTag;return await ae.getBlock(oe,he.includeTransactions)}case"getBlockNumber":return await ae.getBlockNumber();case"getCode":return await ae.getCode(he.address,he.blockTag);case"getGasPrice":return(await ae.getFeeData()).gasPrice;case"getLogs":return await ae.getLogs(he.filter);case"getStorage":return await ae.getStorage(he.address,he.position,he.blockTag);case"getTransaction":return await ae.getTransaction(he.hash);case"getTransactionCount":return await ae.getTransactionCount(he.address,he.blockTag);case"getTransactionReceipt":return await ae.getTransactionReceipt(he.hash);case"getTransactionResult":return await ae.getTransactionResult(he.hash)}}#n(ae){const he=Array.from(ae).map(de=>de.config),oe=this.#e.slice();E(oe),oe.sort((de,le)=>de.priority-le.priority);for(const de of oe)if(!de._lastFatalError&&he.indexOf(de)===-1)return de;return null}#i(ae,he){const oe=this.#n(ae);if(oe==null)return null;const de={config:oe,result:null,didBump:!1,perform:null,staller:null},le=P();return de.perform=(async()=>{try{oe.requests++;const pe=await this._translatePerform(oe.provider,he);de.result={result:pe}}catch(pe){oe.errorResponses++,de.result={error:pe}}const be=P()-le;oe._totalTime+=be,oe.rollingDuration=.95*oe.rollingDuration+.05*be,de.perform=null})(),de.staller=(async()=>{await k(oe.stallTimeout),de.staller=null})(),ae.add(de),de}async#s(){let ae=this.#r;if(!ae){const he=[];this.#e.forEach(oe=>{he.push((async()=>{await O(oe,0),oe._lastFatalError||(oe._network=await oe.provider.getNetwork())})())}),this.#r=ae=(async()=>{await Promise.all(he);let oe=null;for(const de of this.#e){if(de._lastFatalError)continue;const le=de._network;oe==null?oe=le.chainId:le.chainId!==oe&&(0,b.assert)(!1,"cannot mix providers on different networks","UNSUPPORTED_OPERATION",{operation:"new FallbackProvider"})}})()}await ae}async#a(ae,he){const oe=[];for(const de of ae)if(de.result!=null){const{tag:le,value:be}=D(de.result);oe.push({tag:le,value:be,weight:de.config.weight})}if(!(oe.reduce((de,le)=>de+le.weight,0)<this.quorum)){switch(he.method){case"getBlockNumber":{this.#t===-2&&(this.#t=Math.ceil((0,b.getNumber)(ee(this.quorum,this.#e.filter(le=>!le._lastFatalError).map(le=>({value:le.blockNumber,tag:(0,b.getNumber)(le.blockNumber).toString(),weight:le.weight}))))));const de=te(this.quorum,oe);return de===void 0?void 0:(de>this.#t&&(this.#t=de),this.#t)}case"getGasPrice":case"estimateGas":return ee(this.quorum,oe);case"getBlock":return"blockTag"in he&&he.blockTag==="pending"?J(this.quorum,oe):V(this.quorum,oe);case"call":case"chainId":case"getBalance":case"getTransactionCount":case"getCode":case"getStorage":case"getTransaction":case"getTransactionReceipt":case"getLogs":return V(this.quorum,oe);case"broadcastTransaction":return J(this.quorum,oe)}(0,b.assert)(!1,"unsupported method","UNSUPPORTED_OPERATION",{operation:`_perform(${N(he.method)})`})}}async#o(ae,he){if(ae.size===0)throw new Error("no runners?!");const oe=[];let de=0;for(const be of ae){if(be.perform&&oe.push(be.perform),be.staller){oe.push(be.staller);continue}be.didBump||(be.didBump=!0,de++)}const le=await this.#a(ae,he);if(le!==void 0){if(le instanceof Error)throw le;return le}for(let be=0;be<de;be++)this.#i(ae,he);return(0,b.assert)(oe.length>0,"quorum not met","SERVER_ERROR",{request:"%sub-requests",info:{request:he,results:Array.from(ae).map(be=>N(be.result))}}),await Promise.race(oe),await this.#o(ae,he)}async _perform(ae){if(ae.method==="broadcastTransaction"){const de=await Promise.all(this.#e.map(async({provider:be,weight:pe})=>{try{const fe=await be._perform(ae);return Object.assign(D({result:fe}),{weight:pe})}catch(fe){return Object.assign(D({error:fe}),{weight:pe})}})),le=J(this.quorum,de);if((0,b.assert)(le!==void 0,"problem multi-broadcasting","SERVER_ERROR",{request:"%sub-requests",info:{request:ae,results:de.map(N)}}),le instanceof Error)throw le;return le}await this.#s();const he=new Set;for(let de=0;de<this.quorum;de++)this.#i(he,ae);const oe=await this.#o(he,ae);for(const de of he)de.perform&&de.result==null&&de.config.lateResponses++;return oe}async destroy(){for(const{provider:ae}of this.#e)ae.destroy();super.destroy()}}return providerFallback.FallbackProvider=se,providerFallback}var hasRequiredDefaultProvider;function requireDefaultProvider(){if(hasRequiredDefaultProvider)return defaultProvider;hasRequiredDefaultProvider=1,Object.defineProperty(defaultProvider,"__esModule",{value:!0}),defaultProvider.getDefaultProvider=void 0;const b=requireUtils$3(),v=requireProviderAnkr(),w=requireProviderAlchemy(),_=requireProviderCloudflare(),A=requireProviderEtherscan(),E=requireProviderInfura(),k=requireProviderQuicknode(),P=requireProviderFallback(),N=requireProviderJsonrpc(),q=requireNetwork(),B=requireProviderWebsocket();function O(V){return V&&typeof V.send=="function"&&typeof V.close=="function"}const I="goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" ");function D(V,ee){ee==null&&(ee={});const J=ae=>ee[ae]==="-"?!1:typeof ee.exclusive=="string"?ae===ee.exclusive:Array.isArray(ee.exclusive)?ee.exclusive.indexOf(ae)!==-1:!0;if(typeof V=="string"&&V.match(/^https?:/))return new N.JsonRpcProvider(V);if(typeof V=="string"&&V.match(/^wss?:/)||O(V))return new B.WebSocketProvider(V);let te=null;try{te=q.Network.from(V)}catch{}const se=[];if(J("publicPolygon")&&te&&te.name==="matic"&&se.push(new N.JsonRpcProvider("https://polygon-rpc.com/",te,{staticNetwork:te})),J("alchemy"))try{se.push(new w.AlchemyProvider(V,ee.alchemy))}catch{}if(J("ankr")&&ee.ankr!=null)try{se.push(new v.AnkrProvider(V,ee.ankr))}catch{}if(J("cloudflare"))try{se.push(new _.CloudflareProvider(V))}catch{}if(J("etherscan"))try{se.push(new A.EtherscanProvider(V,ee.etherscan))}catch{}if(J("infura"))try{let ae=ee.infura,he;typeof ae=="object"&&(he=ae.projectSecret,ae=ae.projectId),se.push(new E.InfuraProvider(V,ae,he))}catch{}if(J("quicknode"))try{let ae=ee.quicknode;se.push(new k.QuickNodeProvider(V,ae))}catch{}if((0,b.assert)(se.length,"unsupported default network","UNSUPPORTED_OPERATION",{operation:"getDefaultProvider"}),se.length===1)return se[0];let ce=Math.floor(se.length/2);return ce>2&&(ce=2),te&&I.indexOf(te.name)!==-1&&(ce=1),ee&&ee.quorum&&(ce=ee.quorum),new P.FallbackProvider(se,void 0,{quorum:ce})}return defaultProvider.getDefaultProvider=D,defaultProvider}var signerNoncemanager={},hasRequiredSignerNoncemanager;function requireSignerNoncemanager(){if(hasRequiredSignerNoncemanager)return signerNoncemanager;hasRequiredSignerNoncemanager=1,Object.defineProperty(signerNoncemanager,"__esModule",{value:!0}),signerNoncemanager.NonceManager=void 0;const b=requireUtils$3(),v=requireAbstractSigner();class w extends v.AbstractSigner{signer;#e;#t;constructor(A){super(A.provider),(0,b.defineProperties)(this,{signer:A}),this.#e=null,this.#t=0}async getAddress(){return this.signer.getAddress()}connect(A){return new w(this.signer.connect(A))}async getNonce(A){if(A==="pending"){this.#e==null&&(this.#e=super.getNonce("pending"));const E=this.#t;return await this.#e+E}return super.getNonce(A)}increment(){this.#t++}reset(){this.#t=0,this.#e=null}async sendTransaction(A){const E=this.getNonce("pending");return this.increment(),A=await this.signer.populateTransaction(A),A.nonce=await E,await this.signer.sendTransaction(A)}signTransaction(A){return this.signer.signTransaction(A)}signMessage(A){return this.signer.signMessage(A)}signTypedData(A,E,k){return this.signer.signTypedData(A,E,k)}}return signerNoncemanager.NonceManager=w,signerNoncemanager}var providerBrowser={},hasRequiredProviderBrowser;function requireProviderBrowser(){if(hasRequiredProviderBrowser)return providerBrowser;hasRequiredProviderBrowser=1,Object.defineProperty(providerBrowser,"__esModule",{value:!0}),providerBrowser.BrowserProvider=void 0;const b=requireUtils$3(),v=requireProviderJsonrpc();class w extends v.JsonRpcApiPollingProvider{#e;constructor(A,E){super(E,{batchMaxCount:1}),this.#e=async(k,P)=>{const N={method:k,params:P};this.emit("debug",{action:"sendEip1193Request",payload:N});try{const q=await A.request(N);return this.emit("debug",{action:"receiveEip1193Result",result:q}),q}catch(q){const B=new Error(q.message);throw B.code=q.code,B.data=q.data,B.payload=N,this.emit("debug",{action:"receiveEip1193Error",error:B}),B}}}async send(A,E){return await this._start(),await super.send(A,E)}async _send(A){(0,b.assertArgument)(!Array.isArray(A),"EIP-1193 does not support batch request","payload",A);try{const E=await this.#e(A.method,A.params||[]);return[{id:A.id,result:E}]}catch(E){return[{id:A.id,error:{code:E.code,data:E.data,message:E.message}}]}}getRpcError(A,E){switch(E=JSON.parse(JSON.stringify(E)),E.error.code||-1){case 4001:E.error.message=`ethers-user-denied: ${E.error.message}`;break;case 4200:E.error.message=`ethers-unsupported: ${E.error.message}`;break}return super.getRpcError(A,E)}async hasSigner(A){A==null&&(A=0);const E=await this.send("eth_accounts",[]);return typeof A=="number"?E.length>A:(A=A.toLowerCase(),E.filter(k=>k.toLowerCase()===A).length!==0)}async getSigner(A){if(A==null&&(A=0),!await this.hasSigner(A))try{await this.#e("eth_requestAccounts",[])}catch(E){const k=E.payload;throw this.getRpcError(k,{id:k.id,error:E})}return await super.getSigner(A)}}return providerBrowser.BrowserProvider=w,providerBrowser}var providerPocket={},hasRequiredProviderPocket;function requireProviderPocket(){if(hasRequiredProviderPocket)return providerPocket;hasRequiredProviderPocket=1,Object.defineProperty(providerPocket,"__esModule",{value:!0}),providerPocket.PocketProvider=void 0;const b=requireUtils$3(),v=requireCommunity(),w=requireNetwork(),_=requireProviderJsonrpc(),A="62e1ad51b37b8e00394bda3b";function E(P){switch(P){case"mainnet":return"eth-mainnet.gateway.pokt.network";case"goerli":return"eth-goerli.gateway.pokt.network";case"matic":return"poly-mainnet.gateway.pokt.network";case"matic-mumbai":return"polygon-mumbai-rpc.gateway.pokt.network"}(0,b.assertArgument)(!1,"unsupported network","network",P)}class k extends _.JsonRpcProvider{applicationId;applicationSecret;constructor(N,q,B){N==null&&(N="mainnet");const O=w.Network.from(N);q==null&&(q=A),B==null&&(B=null);const I={staticNetwork:O},D=k.getRequest(O,q,B);super(D,O,I),(0,b.defineProperties)(this,{applicationId:q,applicationSecret:B})}_getProvider(N){try{return new k(N,this.applicationId,this.applicationSecret)}catch{}return super._getProvider(N)}static getRequest(N,q,B){q==null&&(q=A);const O=new b.FetchRequest(`https://${E(N.name)}/v1/lb/${q}`);return O.allowGzip=!0,B&&O.setCredentials("",B),q===A&&(O.retryFunc=async(I,D,V)=>((0,v.showThrottleMessage)("PocketProvider"),!0)),O}isCommunityResource(){return this.applicationId===A}}return providerPocket.PocketProvider=k,providerPocket}var providerIpcsocketBrowser={},hasRequiredProviderIpcsocketBrowser;function requireProviderIpcsocketBrowser(){if(hasRequiredProviderIpcsocketBrowser)return providerIpcsocketBrowser;hasRequiredProviderIpcsocketBrowser=1,Object.defineProperty(providerIpcsocketBrowser,"__esModule",{value:!0}),providerIpcsocketBrowser.IpcSocketProvider=void 0;const b=void 0;return providerIpcsocketBrowser.IpcSocketProvider=b,providerIpcsocketBrowser}var hasRequiredProviders;function requireProviders(){return hasRequiredProviders||(hasRequiredProviders=1,function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.SocketEventSubscriber=b.SocketPendingSubscriber=b.SocketBlockSubscriber=b.SocketSubscriber=b.WebSocketProvider=b.SocketProvider=b.IpcSocketProvider=b.QuickNodeProvider=b.PocketProvider=b.InfuraWebSocketProvider=b.InfuraProvider=b.EtherscanPlugin=b.EtherscanProvider=b.CloudflareProvider=b.AnkrProvider=b.AlchemyProvider=b.BrowserProvider=b.JsonRpcSigner=b.JsonRpcProvider=b.JsonRpcApiProvider=b.FallbackProvider=b.copyRequest=b.TransactionResponse=b.TransactionReceipt=b.Log=b.FeeData=b.Block=b.FetchUrlFeeDataNetworkPlugin=b.FeeDataNetworkPlugin=b.EnsPlugin=b.GasCostPlugin=b.NetworkPlugin=b.NonceManager=b.Network=b.MulticoinProviderPlugin=b.EnsResolver=b.getDefaultProvider=b.showThrottleMessage=b.VoidSigner=b.AbstractSigner=b.UnmanagedSubscriber=b.AbstractProvider=void 0;var v=requireAbstractProvider();Object.defineProperty(b,"AbstractProvider",{enumerable:!0,get:function(){return v.AbstractProvider}}),Object.defineProperty(b,"UnmanagedSubscriber",{enumerable:!0,get:function(){return v.UnmanagedSubscriber}});var w=requireAbstractSigner();Object.defineProperty(b,"AbstractSigner",{enumerable:!0,get:function(){return w.AbstractSigner}}),Object.defineProperty(b,"VoidSigner",{enumerable:!0,get:function(){return w.VoidSigner}});var _=requireCommunity();Object.defineProperty(b,"showThrottleMessage",{enumerable:!0,get:function(){return _.showThrottleMessage}});var A=requireDefaultProvider();Object.defineProperty(b,"getDefaultProvider",{enumerable:!0,get:function(){return A.getDefaultProvider}});var E=requireEnsResolver();Object.defineProperty(b,"EnsResolver",{enumerable:!0,get:function(){return E.EnsResolver}}),Object.defineProperty(b,"MulticoinProviderPlugin",{enumerable:!0,get:function(){return E.MulticoinProviderPlugin}});var k=requireNetwork();Object.defineProperty(b,"Network",{enumerable:!0,get:function(){return k.Network}});var P=requireSignerNoncemanager();Object.defineProperty(b,"NonceManager",{enumerable:!0,get:function(){return P.NonceManager}});var N=requirePluginsNetwork();Object.defineProperty(b,"NetworkPlugin",{enumerable:!0,get:function(){return N.NetworkPlugin}}),Object.defineProperty(b,"GasCostPlugin",{enumerable:!0,get:function(){return N.GasCostPlugin}}),Object.defineProperty(b,"EnsPlugin",{enumerable:!0,get:function(){return N.EnsPlugin}}),Object.defineProperty(b,"FeeDataNetworkPlugin",{enumerable:!0,get:function(){return N.FeeDataNetworkPlugin}}),Object.defineProperty(b,"FetchUrlFeeDataNetworkPlugin",{enumerable:!0,get:function(){return N.FetchUrlFeeDataNetworkPlugin}});var q=requireProvider();Object.defineProperty(b,"Block",{enumerable:!0,get:function(){return q.Block}}),Object.defineProperty(b,"FeeData",{enumerable:!0,get:function(){return q.FeeData}}),Object.defineProperty(b,"Log",{enumerable:!0,get:function(){return q.Log}}),Object.defineProperty(b,"TransactionReceipt",{enumerable:!0,get:function(){return q.TransactionReceipt}}),Object.defineProperty(b,"TransactionResponse",{enumerable:!0,get:function(){return q.TransactionResponse}}),Object.defineProperty(b,"copyRequest",{enumerable:!0,get:function(){return q.copyRequest}});var B=requireProviderFallback();Object.defineProperty(b,"FallbackProvider",{enumerable:!0,get:function(){return B.FallbackProvider}});var O=requireProviderJsonrpc();Object.defineProperty(b,"JsonRpcApiProvider",{enumerable:!0,get:function(){return O.JsonRpcApiProvider}}),Object.defineProperty(b,"JsonRpcProvider",{enumerable:!0,get:function(){return O.JsonRpcProvider}}),Object.defineProperty(b,"JsonRpcSigner",{enumerable:!0,get:function(){return O.JsonRpcSigner}});var I=requireProviderBrowser();Object.defineProperty(b,"BrowserProvider",{enumerable:!0,get:function(){return I.BrowserProvider}});var D=requireProviderAlchemy();Object.defineProperty(b,"AlchemyProvider",{enumerable:!0,get:function(){return D.AlchemyProvider}});var V=requireProviderAnkr();Object.defineProperty(b,"AnkrProvider",{enumerable:!0,get:function(){return V.AnkrProvider}});var ee=requireProviderCloudflare();Object.defineProperty(b,"CloudflareProvider",{enumerable:!0,get:function(){return ee.CloudflareProvider}});var J=requireProviderEtherscan();Object.defineProperty(b,"EtherscanProvider",{enumerable:!0,get:function(){return J.EtherscanProvider}}),Object.defineProperty(b,"EtherscanPlugin",{enumerable:!0,get:function(){return J.EtherscanPlugin}});var te=requireProviderInfura();Object.defineProperty(b,"InfuraProvider",{enumerable:!0,get:function(){return te.InfuraProvider}}),Object.defineProperty(b,"InfuraWebSocketProvider",{enumerable:!0,get:function(){return te.InfuraWebSocketProvider}});var se=requireProviderPocket();Object.defineProperty(b,"PocketProvider",{enumerable:!0,get:function(){return se.PocketProvider}});var ce=requireProviderQuicknode();Object.defineProperty(b,"QuickNodeProvider",{enumerable:!0,get:function(){return ce.QuickNodeProvider}});const ae=requireProviderIpcsocketBrowser();Object.defineProperty(b,"IpcSocketProvider",{enumerable:!0,get:function(){return ae.IpcSocketProvider}});var he=requireProviderSocket();Object.defineProperty(b,"SocketProvider",{enumerable:!0,get:function(){return he.SocketProvider}});var oe=requireProviderWebsocket();Object.defineProperty(b,"WebSocketProvider",{enumerable:!0,get:function(){return oe.WebSocketProvider}});var de=requireProviderSocket();Object.defineProperty(b,"SocketSubscriber",{enumerable:!0,get:function(){return de.SocketSubscriber}}),Object.defineProperty(b,"SocketBlockSubscriber",{enumerable:!0,get:function(){return de.SocketBlockSubscriber}}),Object.defineProperty(b,"SocketPendingSubscriber",{enumerable:!0,get:function(){return de.SocketPendingSubscriber}}),Object.defineProperty(b,"SocketEventSubscriber",{enumerable:!0,get:function(){return de.SocketEventSubscriber}})}(providers)),providers}var wallet$1={},baseWallet={},hasRequiredBaseWallet;function requireBaseWallet(){if(hasRequiredBaseWallet)return baseWallet;hasRequiredBaseWallet=1,Object.defineProperty(baseWallet,"__esModule",{value:!0}),baseWallet.BaseWallet=void 0;const b=requireAddress$2(),v=requireHash(),w=requireProviders(),_=requireTransaction(),A=requireUtils$3();class E extends w.AbstractSigner{address;#e;constructor(P,N){super(N),(0,A.assertArgument)(P&&typeof P.sign=="function","invalid private key","privateKey","[ REDACTED ]"),this.#e=P;const q=(0,_.computeAddress)(this.signingKey.publicKey);(0,A.defineProperties)(this,{address:q})}get signingKey(){return this.#e}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(P){return new E(this.#e,P)}async signTransaction(P){const{to:N,from:q}=await(0,A.resolveProperties)({to:P.to?(0,b.resolveAddress)(P.to,this.provider):void 0,from:P.from?(0,b.resolveAddress)(P.from,this.provider):void 0});N!=null&&(P.to=N),q!=null&&(P.from=q),P.from!=null&&((0,A.assertArgument)((0,b.getAddress)(P.from)===this.address,"transaction from address mismatch","tx.from",P.from),delete P.from);const B=_.Transaction.from(P);return B.signature=this.signingKey.sign(B.unsignedHash),B.serialized}async signMessage(P){return this.signMessageSync(P)}signMessageSync(P){return this.signingKey.sign((0,v.hashMessage)(P)).serialized}async signTypedData(P,N,q){const B=await v.TypedDataEncoder.resolveNames(P,N,q,async O=>{(0,A.assert)(this.provider!=null,"cannot resolve ENS names without a provider","UNSUPPORTED_OPERATION",{operation:"resolveName",info:{name:O}});const I=await this.provider.resolveName(O);return(0,A.assert)(I!=null,"unconfigured ENS name","UNCONFIGURED_NAME",{value:O}),I});return this.signingKey.sign(v.TypedDataEncoder.hash(B.domain,N,B.value)).serialized}}return baseWallet.BaseWallet=E,baseWallet}var hdwallet={},langEn={},wordlistOwl={},decodeOwl={},hasRequiredDecodeOwl;function requireDecodeOwl(){if(hasRequiredDecodeOwl)return decodeOwl;hasRequiredDecodeOwl=1,Object.defineProperty(decodeOwl,"__esModule",{value:!0}),decodeOwl.decodeOwl=decodeOwl.decode=void 0;const b=requireUtils$3(),v=" !#$%&'()*+,-./<=>?@[]^_`{|}~",w=/^[a-z]*$/i;function _(k,P){let N=97;return k.reduce((q,B)=>(B===P?N++:B.match(w)?q.push(String.fromCharCode(N)+B):(N=97,q.push(B)),q),[])}function A(k,P){for(let B=v.length-1;B>=0;B--)k=k.split(v[B]).join(P.substring(2*B,2*B+2));const N=[],q=k.replace(/(:|([0-9])|([A-Z][a-z]*))/g,(B,O,I,D)=>{if(I)for(let V=parseInt(I);V>=0;V--)N.push(";");else N.push(O.toLowerCase());return""});if(q)throw new Error(`leftovers: ${JSON.stringify(q)}`);return _(_(N,";"),":")}decodeOwl.decode=A;function E(k){return(0,b.assertArgument)(k[0]==="0","unsupported auwl data","data",k),A(k.substring(1+2*v.length),k.substring(1,1+2*v.length))}return decodeOwl.decodeOwl=E,decodeOwl}var wordlist={},hasRequiredWordlist;function requireWordlist(){if(hasRequiredWordlist)return wordlist;hasRequiredWordlist=1,Object.defineProperty(wordlist,"__esModule",{value:!0}),wordlist.Wordlist=void 0;const b=requireUtils$3();class v{locale;constructor(_){(0,b.defineProperties)(this,{locale:_})}split(_){return _.toLowerCase().split(/\s+/g)}join(_){return _.join(" ")}}return wordlist.Wordlist=v,wordlist}var hasRequiredWordlistOwl;function requireWordlistOwl(){if(hasRequiredWordlistOwl)return wordlistOwl;hasRequiredWordlistOwl=1,Object.defineProperty(wordlistOwl,"__esModule",{value:!0}),wordlistOwl.WordlistOwl=void 0;const b=requireHash(),v=requireUtils$3(),w=requireDecodeOwl(),_=requireWordlist();class A extends _.Wordlist{#e;#t;constructor(k,P,N){super(k),this.#e=P,this.#t=N,this.#r=null}get _data(){return this.#e}_decodeWords(){return(0,w.decodeOwl)(this.#e)}#r;#n(){if(this.#r==null){const k=this._decodeWords();if((0,b.id)(k.join(`
765
- `)+`
766
- `)!==this.#t)throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`);this.#r=k}return this.#r}getWord(k){const P=this.#n();return(0,v.assertArgument)(k>=0&&k<P.length,`invalid word index: ${k}`,"index",k),P[k]}getWordIndex(k){return this.#n().indexOf(k)}}return wordlistOwl.WordlistOwl=A,wordlistOwl}var hasRequiredLangEn;function requireLangEn(){if(hasRequiredLangEn)return langEn;hasRequiredLangEn=1,Object.defineProperty(langEn,"__esModule",{value:!0}),langEn.LangEn=void 0;const b=requireWordlistOwl(),v="0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN<aNn RRelyRga(R*lSeS-SketTt!3A^AnAutyCau'ComeEfF%eG(Ha=H(dLie=LowLtN^Nef./TrayTt Twe&Y#d3Cyc!DKeNdOlogyRdR`Tt _{AdeAmeAnketA,EakE[IndOodO[omOu'UeUrUsh_rdAtDyIlMbNeNusOkO,Rd R(gRrowSsTtomUn)XY_{etA(AndA[A=EadEezeI{Id+IefIghtIngIskOccoliOk&OnzeOomO` OwnUsh2Bb!DdyD+tFf$oIldLbLkL!tNd!Nk Rd&Rg R,SS(e[SyTt Y Zz:Bba+B(B!CtusGeKe~LmM aMpNN$N)lNdyNn#NoeNvasNy#Pab!P.$Pta(RRb#RdRgoRpetRryRtSeShS(o/!Su$TT$ogT^Teg%yTt!UghtU'Ut]Ve3Il(gL yM|NsusNturyRe$Rta(_irAlkAmp]An+AosApt Ar+A'AtEapE{Ee'EfErryE,I{&IefIldIm}yOi)Oo'R#-U{!UnkUrn0G?Nnam#Rc!Tiz&TyVil_imApArifyAwAyE<ErkEv I{I|IffImbIn-IpO{OgO'O`OudOwnUbUmpU, Ut^_^A,C#utDeFfeeIlInL!@L%LumnMb(eMeMf%tM-Mm#Mp<yNc tNdu@NfirmNg*[N}@Nsid NtrolNv()OkOlPp PyR$ReRnR*@/Tt#U^UntryUp!Ur'Us(V Yo>_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dRiousRr|Rta(R=Sh]/omTe3C!:DMa+MpN)Ng R(gShUght WnY3AlBa>BrisCadeCemb CideCl(eC%a>C*a'ErF&'F(eFyG*eLayLiv M<dMi'Ni$Nti,NyP?tP&dPos.P`PutyRi=ScribeS tSignSkSpair/royTailTe@VelopVi)Vo>3AgramAlAm#dAryCeE'lEtFf G.$Gn.yLemmaNn NosaurRe@RtSag*eScov Sea'ShSmi[S%d Splay/<)V tVideV%)Zzy5Ct%Cum|G~Lph(Ma(Na>NkeyN%OrSeUb!Ve_ftAg#AmaA,-AwEamE[IftIllInkIpI=OpUmY2CkMbNeR(g/T^Ty1Arf1Nam-:G G!RlyRnR`Sily/Sy1HoOlogyOnomy0GeItUca>1F%t0G1GhtTh 2BowD E@r-Eg<tEm|Eph<tEvat%I>Se0B?kBodyBra)Er+Ot]PloyPow Pty0Ab!A@DD![D%'EmyErgyF%)Ga+G(eH<)JoyLi,OughR-hRollSu*T Ti*TryVelope1Isode0U$Uip0AA'OdeOs]R%Upt0CapeSayS&)Ta>0Ern$H-s1Id&)IlOkeOl=1A@Amp!Ce[Ch<+C.eCludeCu'Ecu>Erci'Hau,Hib.I!I,ItOt-P<dPe@Pi*Pla(Po'P*[T&dTra0EEbrow:Br-CeCultyDeIntI`~L'MeMilyMousNNcyNtasyRmSh]TT$Th TigueUltV%.e3Atu*Bru?yD $EEdElMa!N)/iv$T^V W3B Ct]EldGu*LeLmLt N$NdNeNg NishReRmR,Sc$ShTT}[X_gAmeAshAtAv%EeIghtIpOatO{O%Ow UidUshY_mCusGIlLd~owOdOtR)Re,R+tRkRtu}RumRw?dSsil/ UndX_gi!AmeEqu|EshI&dIn+OgOntO,OwnOz&U.2ElNNnyRna)RyTu*:D+tInLaxy~ yMePRa+Rba+Rd&Rl-Rm|SSpTeTh U+Ze3N $NiusN*Nt!Nu(e/u*2O,0AntFtGg!Ng RaffeRlVe_dAn)A*A[IdeImp'ObeOomOryO=OwUe_tDde[LdOdO'RillaSpelSsipV nWn_bA)A(AntApeA[Av.yEatE&IdIefItOc yOupOwUnt_rdE[IdeIltIt?N3M:B.IrLfMm M, NdPpyRb%RdRshR=,TVeWkZ?d3AdAl`ArtAvyD+hogIght~oLmetLpNRo3Dd&Gh~NtPRe/%y5BbyCkeyLdLeLiday~owMeNeyOdPeRnRr%R'Sp.$/TelUrV 5BGeM<Mb!M%Nd*dNgryNtRd!RryRtSb<d3Brid:1EOn0EaEntifyLe2N%e4LLeg$L}[0A+Ita>M&'Mu}Pa@Po'Pro=Pul'0ChCludeComeC*a'DexD-a>Do%Du,ryF<tFl-tF%mHa!H .Iti$Je@JuryMa>N Noc|PutQuiryS<eSe@SideSpi*/$lTa@T e,ToVe,V.eVol=3On0L<dOla>Sue0Em1Ory:CketGu?RZz3AlousAns~yWel9BInKeUr}yY5D+I)MpNg!Ni%Nk/:Ng?oo3EnEpT^upY3CkDD}yNdNgdomSsTT^&TeTt&Wi4EeIfeO{Ow:BBelB%Dd DyKeMpNgua+PtopR+T T(UghUndryVaWWnWsu.Y Zy3Ad AfArnA=Ctu*FtGG$G&dIsu*M#NdNg`NsOp?dSs#Tt Vel3ArB tyBr?yC&'FeFtGhtKeMbM.NkOnQuid/Tt!VeZ?d5AdAnB, C$CkG-NelyNgOpTt yUdUn+VeY$5CkyGga+Mb N?N^Xury3R-s:Ch(eDG-G}tIdIlInJ%KeMm$NNa+Nda>NgoNs]Nu$P!Rb!R^Rg(R(eRketRria+SkSs/ T^T i$ThTrixTt XimumZe3AdowAnAsu*AtCh<-D$DiaLodyLtMb M%yNt]NuRcyR+R.RryShSsa+T$Thod3Dd!DnightLk~]M-NdNimumN%Nu>Rac!Rr%S ySs/akeXXedXtu*5Bi!DelDifyMM|N.%NkeyN, N`OnR$ReRn(gSqu.oTh T]T%Unta(U'VeVie5ChFf(LeLtiplySc!SeumShroomS-/Tu$3Self/ yTh:I=MePk(Rrow/yT]Tu*3ArCkEdGati=G!@I` PhewR=/TTw%kUtr$V WsXt3CeGht5B!I'M(eeOd!Rm$R`SeTab!TeTh(gTi)VelW5C!?Mb R'T:K0EyJe@Li+Scu*S =Ta(Vious0CurE<Tob 0Or1FF Fi)T&2L1Ay0DI=Ymp-0It0CeEI#L(eLy1EnEraIn]Po'T]1An+B.Ch?dD D(?yG<I|Ig($Ph<0Tr-h0H 0Tdo%T TputTside0AlEnEr0NN 0Yg&0/ 0O}:CtDd!GeIrLa)LmNdaNelN-N` P RadeR|RkRrotRtySsT^ThTi|TrolTt nU'VeYm|3A)AnutArAs<tL-<NN$tyNcilOp!Pp Rfe@Rm.Rs#T2O}OtoRa'Ys-$0AnoCn-Ctu*E)GGe#~LotNkO} Pe/olT^Zza_)A}tA,-A>AyEa'Ed+U{UgUn+2EmEtIntL?LeLi)NdNyOlPul?Rt]S.]Ssib!/TatoTt yV tyWd W _@i)Ai'Ed-tEf Epa*Es|EttyEv|I)IdeIm?yIntI%.yIs#Iva>IzeOb!mO)[Odu)Of.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOg<OtOwUsh0AllArtI!OkeOo`0A{AkeApIffOw0ApCc Ci$CkDaFtL?Ldi LidLut]L=Me#eNgOnRryRtUlUndUpUr)U`0A)A*Ati$AwnEakEci$EedEllEndH eI)Id IkeInIr.L.OilOns%O#OrtOtRayReadR(gY0Ua*UeezeUir*l_b!AdiumAffA+AirsAmpAndArtA>AyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NN<tNnisNtRm/Xt_nkAtEmeEnE%yE*EyIngIsOughtReeRi=RowUmbUnd 0CketDeG LtMb MeNyPRedSsueT!5A,BaccoDayDdl EGe` I!tK&MatoM%rowNeNgueNightOlO`PP-Pp!R^RnadoRtoi'SsT$Uri,W?dW WnY_{AdeAff-Ag-A(Ansf ApAshA=lAyEatEeEndI$IbeI{Igg ImIpOphyOub!U{UeUlyUmpetU,U`Y2BeIt]Mb!NaN}lRkeyRnRt!1El=EntyI)InI,O1PeP-$:5Ly5B*lla0Ab!Awa*C!Cov D DoFairFoldHappyIf%mIqueItIv 'KnownLo{TilUsu$Veil1Da>GradeHoldOnP Set1B<Ge0A+EEdEfulE![U$0Il.y:C<tCuumGueLidL!yL=NNishP%Rious/Ult3H-!L=tNd%Ntu*NueRbRifyRs]RyS'lT <3Ab!Br<tCiousCt%yDeoEw~a+Nta+Ol(Rtu$RusSaS.Su$T$Vid5C$I)IdLc<oLumeTeYa+:GeG#ItLk~LnutNtRfa*RmRri%ShSp/eT VeY3Al`Ap#ArA'lA` BDd(gEk&dIrdLcome/T_!AtEatEelEnE*IpIsp 0DeD`FeLd~NNdowNeNgNkNn Nt ReSdomSeShT}[5LfM<Nd OdOlRdRkRldRryR`_pE{E,!I,I>Ong::Rd3Ar~ow9UUngU`:3BraRo9NeO",w="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60";let _=null;class A extends b.WordlistOwl{constructor(){super("en",v,w)}static wordlist(){return _==null&&(_=new A),_}}return langEn.LangEn=A,langEn}var mnemonic={},hasRequiredMnemonic;function requireMnemonic(){if(hasRequiredMnemonic)return mnemonic;hasRequiredMnemonic=1,Object.defineProperty(mnemonic,"__esModule",{value:!0}),mnemonic.Mnemonic=void 0;const b=requireCrypto(),v=requireUtils$3(),w=requireLangEn();function _(q){return(1<<q)-1<<8-q&255}function A(q){return(1<<q)-1&255}function E(q,B){(0,v.assertNormalize)("NFKD"),B==null&&(B=w.LangEn.wordlist());const O=B.split(q);(0,v.assertArgument)(O.length%3===0&&O.length>=12&&O.length<=24,"invalid mnemonic length","mnemonic","[ REDACTED ]");const I=new Uint8Array(Math.ceil(11*O.length/8));let D=0;for(let se=0;se<O.length;se++){let ce=B.getWordIndex(O[se].normalize("NFKD"));(0,v.assertArgument)(ce>=0,`invalid mnemonic word at index ${se}`,"mnemonic","[ REDACTED ]");for(let ae=0;ae<11;ae++)ce&1<<10-ae&&(I[D>>3]|=1<<7-D%8),D++}const V=32*O.length/3,ee=O.length/3,J=_(ee),te=(0,v.getBytes)((0,b.sha256)(I.slice(0,V/8)))[0]&J;return(0,v.assertArgument)(te===(I[I.length-1]&J),"invalid mnemonic checksum","mnemonic","[ REDACTED ]"),(0,v.hexlify)(I.slice(0,V/8))}function k(q,B){(0,v.assertArgument)(q.length%4===0&&q.length>=16&&q.length<=32,"invalid entropy size","entropy","[ REDACTED ]"),B==null&&(B=w.LangEn.wordlist());const O=[0];let I=11;for(let ee=0;ee<q.length;ee++)I>8?(O[O.length-1]<<=8,O[O.length-1]|=q[ee],I-=8):(O[O.length-1]<<=I,O[O.length-1]|=q[ee]>>8-I,O.push(q[ee]&A(8-I)),I+=3);const D=q.length/4,V=parseInt((0,b.sha256)(q).substring(2,4),16)&_(D);return O[O.length-1]<<=D,O[O.length-1]|=V>>8-D,B.join(O.map(ee=>B.getWord(ee)))}const P={};class N{phrase;password;wordlist;entropy;constructor(B,O,I,D,V){D==null&&(D=""),V==null&&(V=w.LangEn.wordlist()),(0,v.assertPrivate)(B,P,"Mnemonic"),(0,v.defineProperties)(this,{phrase:I,password:D,wordlist:V,entropy:O})}computeSeed(){const B=(0,v.toUtf8Bytes)("mnemonic"+this.password,"NFKD");return(0,b.pbkdf2)((0,v.toUtf8Bytes)(this.phrase,"NFKD"),B,2048,64,"sha512")}static fromPhrase(B,O,I){const D=E(B,I);return B=k((0,v.getBytes)(D),I),new N(P,D,B,O,I)}static fromEntropy(B,O,I){const D=(0,v.getBytes)(B,"entropy"),V=k(D,I);return new N(P,(0,v.hexlify)(D),V,O,I)}static entropyToPhrase(B,O){const I=(0,v.getBytes)(B,"entropy");return k(I,O)}static phraseToEntropy(B,O){return E(B,O)}static isValidMnemonic(B,O){try{return E(B,O),!0}catch{}return!1}}return mnemonic.Mnemonic=N,mnemonic}var jsonKeystore={},lib_commonjs={},aes$6={},hasRequiredAes;function requireAes(){if(hasRequiredAes)return aes$6;hasRequiredAes=1;/*! MIT License. Copyright 2015-2022 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */var b=commonjsGlobal&&commonjsGlobal.__classPrivateFieldGet||function(de,le,be,pe){if(be==="a"&&!pe)throw new TypeError("Private accessor was defined without a getter");if(typeof le=="function"?de!==le||!pe:!le.has(de))throw new TypeError("Cannot read private member from an object whose class did not declare it");return be==="m"?pe:be==="a"?pe.call(de):pe?pe.value:le.get(de)},v=commonjsGlobal&&commonjsGlobal.__classPrivateFieldSet||function(de,le,be,pe,fe){if(pe==="m")throw new TypeError("Private method is not writable");if(pe==="a"&&!fe)throw new TypeError("Private accessor was defined without a setter");if(typeof le=="function"?de!==le||!fe:!le.has(de))throw new TypeError("Cannot write private member to an object whose class did not declare it");return pe==="a"?fe.call(de,be):fe?fe.value=be:le.set(de,be),be},w,_,A;Object.defineProperty(aes$6,"__esModule",{value:!0}),aes$6.AES=void 0;const E={16:10,24:12,32:14},k=[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],P=[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],N=[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],q=[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],B=[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],O=[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],I=[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],D=[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],V=[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],ee=[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],J=[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],te=[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],se=[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],ce=[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],ae=[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 he(de){const le=[];for(let be=0;be<de.length;be+=4)le.push(de[be]<<24|de[be+1]<<16|de[be+2]<<8|de[be+3]);return le}class oe{get key(){return b(this,w,"f").slice()}constructor(le){if(w.set(this,void 0),_.set(this,void 0),A.set(this,void 0),!(this instanceof oe))throw Error("AES must be instanitated with `new`");v(this,w,new Uint8Array(le),"f");const be=E[this.key.length];if(be==null)throw new TypeError("invalid key size (must be 16, 24 or 32 bytes)");v(this,A,[],"f"),v(this,_,[],"f");for(let X=0;X<=be;X++)b(this,A,"f").push([0,0,0,0]),b(this,_,"f").push([0,0,0,0]);const pe=(be+1)*4,fe=this.key.length/4,Z=he(this.key);let U;for(let X=0;X<fe;X++)U=X>>2,b(this,A,"f")[U][X%4]=Z[X],b(this,_,"f")[be-U][X%4]=Z[X];let S=0,C=fe,F;for(;C<pe;){if(F=Z[fe-1],Z[0]^=P[F>>16&255]<<24^P[F>>8&255]<<16^P[F&255]<<8^P[F>>24&255]^k[S]<<24,S+=1,fe!=8)for(let Q=1;Q<fe;Q++)Z[Q]^=Z[Q-1];else{for(let Q=1;Q<fe/2;Q++)Z[Q]^=Z[Q-1];F=Z[fe/2-1],Z[fe/2]^=P[F&255]^P[F>>8&255]<<8^P[F>>16&255]<<16^P[F>>24&255]<<24;for(let Q=fe/2+1;Q<fe;Q++)Z[Q]^=Z[Q-1]}let X=0,re,ie;for(;X<fe&&C<pe;)re=C>>2,ie=C%4,b(this,A,"f")[re][ie]=Z[X],b(this,_,"f")[be-re][ie]=Z[X++],C++}for(let X=1;X<be;X++)for(let re=0;re<4;re++)F=b(this,_,"f")[X][re],b(this,_,"f")[X][re]=te[F>>24&255]^se[F>>16&255]^ce[F>>8&255]^ae[F&255]}encrypt(le){if(le.length!=16)throw new TypeError("invalid plaintext size (must be 16 bytes)");const be=b(this,A,"f").length-1,pe=[0,0,0,0];let fe=he(le);for(let S=0;S<4;S++)fe[S]^=b(this,A,"f")[0][S];for(let S=1;S<be;S++){for(let C=0;C<4;C++)pe[C]=q[fe[C]>>24&255]^B[fe[(C+1)%4]>>16&255]^O[fe[(C+2)%4]>>8&255]^I[fe[(C+3)%4]&255]^b(this,A,"f")[S][C];fe=pe.slice()}const Z=new Uint8Array(16);let U=0;for(let S=0;S<4;S++)U=b(this,A,"f")[be][S],Z[4*S]=(P[fe[S]>>24&255]^U>>24)&255,Z[4*S+1]=(P[fe[(S+1)%4]>>16&255]^U>>16)&255,Z[4*S+2]=(P[fe[(S+2)%4]>>8&255]^U>>8)&255,Z[4*S+3]=(P[fe[(S+3)%4]&255]^U)&255;return Z}decrypt(le){if(le.length!=16)throw new TypeError("invalid ciphertext size (must be 16 bytes)");const be=b(this,_,"f").length-1,pe=[0,0,0,0];let fe=he(le);for(let S=0;S<4;S++)fe[S]^=b(this,_,"f")[0][S];for(let S=1;S<be;S++){for(let C=0;C<4;C++)pe[C]=D[fe[C]>>24&255]^V[fe[(C+3)%4]>>16&255]^ee[fe[(C+2)%4]>>8&255]^J[fe[(C+1)%4]&255]^b(this,_,"f")[S][C];fe=pe.slice()}const Z=new Uint8Array(16);let U=0;for(let S=0;S<4;S++)U=b(this,_,"f")[be][S],Z[4*S]=(N[fe[S]>>24&255]^U>>24)&255,Z[4*S+1]=(N[fe[(S+3)%4]>>16&255]^U>>16)&255,Z[4*S+2]=(N[fe[(S+2)%4]>>8&255]^U>>8)&255,Z[4*S+3]=(N[fe[(S+1)%4]&255]^U)&255;return Z}}return aes$6.AES=oe,w=new WeakMap,_=new WeakMap,A=new WeakMap,aes$6}var mode={},hasRequiredMode;function requireMode(){if(hasRequiredMode)return mode;hasRequiredMode=1,Object.defineProperty(mode,"__esModule",{value:!0}),mode.ModeOfOperation=void 0;const b=requireAes();class v{constructor(_,A,E){if(E&&!(this instanceof E))throw new Error(`${_} must be instantiated with "new"`);Object.defineProperties(this,{aes:{enumerable:!0,value:new b.AES(A)},name:{enumerable:!0,value:_}})}}return mode.ModeOfOperation=v,mode}var modeCbc={},hasRequiredModeCbc;function requireModeCbc(){if(hasRequiredModeCbc)return modeCbc;hasRequiredModeCbc=1;var b=commonjsGlobal&&commonjsGlobal.__classPrivateFieldSet||function(k,P,N,q,B){if(q==="m")throw new TypeError("Private method is not writable");if(q==="a"&&!B)throw new TypeError("Private accessor was defined without a setter");if(typeof P=="function"?k!==P||!B:!P.has(k))throw new TypeError("Cannot write private member to an object whose class did not declare it");return q==="a"?B.call(k,N):B?B.value=N:P.set(k,N),N},v=commonjsGlobal&&commonjsGlobal.__classPrivateFieldGet||function(k,P,N,q){if(N==="a"&&!q)throw new TypeError("Private accessor was defined without a getter");if(typeof P=="function"?k!==P||!q:!P.has(k))throw new TypeError("Cannot read private member from an object whose class did not declare it");return N==="m"?q:N==="a"?q.call(k):q?q.value:P.get(k)},w,_;Object.defineProperty(modeCbc,"__esModule",{value:!0}),modeCbc.CBC=void 0;const A=requireMode();class E extends A.ModeOfOperation{constructor(P,N){if(super("ECC",P,E),w.set(this,void 0),_.set(this,void 0),N){if(N.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");b(this,w,new Uint8Array(N),"f")}else b(this,w,new Uint8Array(16),"f");b(this,_,this.iv,"f")}get iv(){return new Uint8Array(v(this,w,"f"))}encrypt(P){if(P.length%16)throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)");const N=new Uint8Array(P.length);for(let q=0;q<P.length;q+=16){for(let B=0;B<16;B++)v(this,_,"f")[B]^=P[q+B];b(this,_,this.aes.encrypt(v(this,_,"f")),"f"),N.set(v(this,_,"f"),q)}return N}decrypt(P){if(P.length%16)throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)");const N=new Uint8Array(P.length);for(let q=0;q<P.length;q+=16){const B=this.aes.decrypt(P.subarray(q,q+16));for(let O=0;O<16;O++)N[q+O]=B[O]^v(this,_,"f")[O],v(this,_,"f")[O]=P[q+O]}return N}}return modeCbc.CBC=E,w=new WeakMap,_=new WeakMap,modeCbc}var modeCfb={},hasRequiredModeCfb;function requireModeCfb(){if(hasRequiredModeCfb)return modeCfb;hasRequiredModeCfb=1;var b=commonjsGlobal&&commonjsGlobal.__classPrivateFieldSet||function(N,q,B,O,I){if(O==="m")throw new TypeError("Private method is not writable");if(O==="a"&&!I)throw new TypeError("Private accessor was defined without a setter");if(typeof q=="function"?N!==q||!I:!q.has(N))throw new TypeError("Cannot write private member to an object whose class did not declare it");return O==="a"?I.call(N,B):I?I.value=B:q.set(N,B),B},v=commonjsGlobal&&commonjsGlobal.__classPrivateFieldGet||function(N,q,B,O){if(B==="a"&&!O)throw new TypeError("Private accessor was defined without a getter");if(typeof q=="function"?N!==q||!O:!q.has(N))throw new TypeError("Cannot read private member from an object whose class did not declare it");return B==="m"?O:B==="a"?O.call(N):O?O.value:q.get(N)},w,_,A,E;Object.defineProperty(modeCfb,"__esModule",{value:!0}),modeCfb.CFB=void 0;const k=requireMode();class P extends k.ModeOfOperation{constructor(q,B,O=8){if(super("CFB",q,P),w.add(this),_.set(this,void 0),A.set(this,void 0),!Number.isInteger(O)||O%8)throw new TypeError("invalid segmentSize");if(Object.defineProperties(this,{segmentSize:{enumerable:!0,value:O}}),B){if(B.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");b(this,_,new Uint8Array(B),"f")}else b(this,_,new Uint8Array(16),"f");b(this,A,this.iv,"f")}get iv(){return new Uint8Array(v(this,_,"f"))}encrypt(q){if(8*q.length%this.segmentSize)throw new TypeError("invalid plaintext size (must be multiple of segmentSize bytes)");const B=this.segmentSize/8,O=new Uint8Array(q);for(let I=0;I<O.length;I+=B){const D=this.aes.encrypt(v(this,A,"f"));for(let V=0;V<B;V++)O[I+V]^=D[V];v(this,w,"m",E).call(this,O.subarray(I))}return O}decrypt(q){if(8*q.length%this.segmentSize)throw new TypeError("invalid ciphertext size (must be multiple of segmentSize bytes)");const B=this.segmentSize/8,O=new Uint8Array(q);for(let I=0;I<O.length;I+=B){const D=this.aes.encrypt(v(this,A,"f"));for(let V=0;V<B;V++)O[I+V]^=D[V];v(this,w,"m",E).call(this,q.subarray(I))}return O}}return modeCfb.CFB=P,_=new WeakMap,A=new WeakMap,w=new WeakSet,E=function(q){const B=this.segmentSize/8;v(this,A,"f").set(v(this,A,"f").subarray(B)),v(this,A,"f").set(q.subarray(0,B),16-B)},modeCfb}var modeCtr={},hasRequiredModeCtr;function requireModeCtr(){if(hasRequiredModeCtr)return modeCtr;hasRequiredModeCtr=1;var b=commonjsGlobal&&commonjsGlobal.__classPrivateFieldSet||function(P,N,q,B,O){if(B==="m")throw new TypeError("Private method is not writable");if(B==="a"&&!O)throw new TypeError("Private accessor was defined without a setter");if(typeof N=="function"?P!==N||!O:!N.has(P))throw new TypeError("Cannot write private member to an object whose class did not declare it");return B==="a"?O.call(P,q):O?O.value=q:N.set(P,q),q},v=commonjsGlobal&&commonjsGlobal.__classPrivateFieldGet||function(P,N,q,B){if(q==="a"&&!B)throw new TypeError("Private accessor was defined without a getter");if(typeof N=="function"?P!==N||!B:!N.has(P))throw new TypeError("Cannot read private member from an object whose class did not declare it");return q==="m"?B:q==="a"?B.call(P):B?B.value:N.get(P)},w,_,A;Object.defineProperty(modeCtr,"__esModule",{value:!0}),modeCtr.CTR=void 0;const E=requireMode();class k extends E.ModeOfOperation{constructor(N,q){super("CTR",N,k),w.set(this,void 0),_.set(this,void 0),A.set(this,void 0),b(this,A,new Uint8Array(16),"f"),v(this,A,"f").fill(0),b(this,w,v(this,A,"f"),"f"),b(this,_,16,"f"),q==null&&(q=1),typeof q=="number"?this.setCounterValue(q):this.setCounterBytes(q)}get counter(){return new Uint8Array(v(this,A,"f"))}setCounterValue(N){if(!Number.isInteger(N)||N<0||N>Number.MAX_SAFE_INTEGER)throw new TypeError("invalid counter initial integer value");for(let q=15;q>=0;--q)v(this,A,"f")[q]=N%256,N=Math.floor(N/256)}setCounterBytes(N){if(N.length!==16)throw new TypeError("invalid counter initial Uint8Array value length");v(this,A,"f").set(N)}increment(){for(let N=15;N>=0;N--)if(v(this,A,"f")[N]===255)v(this,A,"f")[N]=0;else{v(this,A,"f")[N]++;break}}encrypt(N){var q,B;const O=new Uint8Array(N);for(let I=0;I<O.length;I++)v(this,_,"f")===16&&(b(this,w,this.aes.encrypt(v(this,A,"f")),"f"),b(this,_,0,"f"),this.increment()),O[I]^=v(this,w,"f")[b(this,_,(B=v(this,_,"f"),q=B++,B),"f"),q];return O}decrypt(N){return this.encrypt(N)}}return modeCtr.CTR=k,w=new WeakMap,_=new WeakMap,A=new WeakMap,modeCtr}var modeEcb={},hasRequiredModeEcb;function requireModeEcb(){if(hasRequiredModeEcb)return modeEcb;hasRequiredModeEcb=1,Object.defineProperty(modeEcb,"__esModule",{value:!0}),modeEcb.ECB=void 0;const b=requireMode();class v extends b.ModeOfOperation{constructor(_){super("ECB",_,v)}encrypt(_){if(_.length%16)throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)");const A=new Uint8Array(_.length);for(let E=0;E<_.length;E+=16)A.set(this.aes.encrypt(_.subarray(E,E+16)),E);return A}decrypt(_){if(_.length%16)throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)");const A=new Uint8Array(_.length);for(let E=0;E<_.length;E+=16)A.set(this.aes.decrypt(_.subarray(E,E+16)),E);return A}}return modeEcb.ECB=v,modeEcb}var modeOfb={},hasRequiredModeOfb;function requireModeOfb(){if(hasRequiredModeOfb)return modeOfb;hasRequiredModeOfb=1;var b=commonjsGlobal&&commonjsGlobal.__classPrivateFieldSet||function(P,N,q,B,O){if(B==="m")throw new TypeError("Private method is not writable");if(B==="a"&&!O)throw new TypeError("Private accessor was defined without a setter");if(typeof N=="function"?P!==N||!O:!N.has(P))throw new TypeError("Cannot write private member to an object whose class did not declare it");return B==="a"?O.call(P,q):O?O.value=q:N.set(P,q),q},v=commonjsGlobal&&commonjsGlobal.__classPrivateFieldGet||function(P,N,q,B){if(q==="a"&&!B)throw new TypeError("Private accessor was defined without a getter");if(typeof N=="function"?P!==N||!B:!N.has(P))throw new TypeError("Cannot read private member from an object whose class did not declare it");return q==="m"?B:q==="a"?B.call(P):B?B.value:N.get(P)},w,_,A;Object.defineProperty(modeOfb,"__esModule",{value:!0}),modeOfb.OFB=void 0;const E=requireMode();class k extends E.ModeOfOperation{constructor(N,q){if(super("OFB",N,k),w.set(this,void 0),_.set(this,void 0),A.set(this,void 0),q){if(q.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");b(this,w,new Uint8Array(q),"f")}else b(this,w,new Uint8Array(16),"f");b(this,_,this.iv,"f"),b(this,A,16,"f")}get iv(){return new Uint8Array(v(this,w,"f"))}encrypt(N){var q,B;if(N.length%16)throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)");const O=new Uint8Array(N);for(let I=0;I<O.length;I++)v(this,A,"f")===16&&(b(this,_,this.aes.encrypt(v(this,_,"f")),"f"),b(this,A,0,"f")),O[I]^=v(this,_,"f")[b(this,A,(B=v(this,A,"f"),q=B++,B),"f"),q];return O}decrypt(N){if(N.length%16)throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)");return this.encrypt(N)}}return modeOfb.OFB=k,w=new WeakMap,_=new WeakMap,A=new WeakMap,modeOfb}var padding={},hasRequiredPadding;function requirePadding(){if(hasRequiredPadding)return padding;hasRequiredPadding=1,Object.defineProperty(padding,"__esModule",{value:!0}),padding.pkcs7Strip=padding.pkcs7Pad=void 0;function b(w){const _=16-w.length%16,A=new Uint8Array(w.length+_);A.set(w);for(let E=w.length;E<A.length;E++)A[E]=_;return A}padding.pkcs7Pad=b;function v(w){if(w.length<16)throw new TypeError("PKCS#7 invalid length");const _=w[w.length-1];if(_>16)throw new TypeError("PKCS#7 padding byte out of range");const A=w.length-_;for(let E=0;E<_;E++)if(w[A+E]!==_)throw new TypeError("PKCS#7 invalid padding byte");return new Uint8Array(w.subarray(0,A))}return padding.pkcs7Strip=v,padding}var hasRequiredLib_commonjs;function requireLib_commonjs(){return hasRequiredLib_commonjs||(hasRequiredLib_commonjs=1,function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.pkcs7Strip=b.pkcs7Pad=b.OFB=b.ECB=b.CTR=b.CFB=b.CBC=b.ModeOfOperation=b.AES=void 0;var v=requireAes();Object.defineProperty(b,"AES",{enumerable:!0,get:function(){return v.AES}});var w=requireMode();Object.defineProperty(b,"ModeOfOperation",{enumerable:!0,get:function(){return w.ModeOfOperation}});var _=requireModeCbc();Object.defineProperty(b,"CBC",{enumerable:!0,get:function(){return _.CBC}});var A=requireModeCfb();Object.defineProperty(b,"CFB",{enumerable:!0,get:function(){return A.CFB}});var E=requireModeCtr();Object.defineProperty(b,"CTR",{enumerable:!0,get:function(){return E.CTR}});var k=requireModeEcb();Object.defineProperty(b,"ECB",{enumerable:!0,get:function(){return k.ECB}});var P=requireModeOfb();Object.defineProperty(b,"OFB",{enumerable:!0,get:function(){return P.OFB}});var N=requirePadding();Object.defineProperty(b,"pkcs7Pad",{enumerable:!0,get:function(){return N.pkcs7Pad}}),Object.defineProperty(b,"pkcs7Strip",{enumerable:!0,get:function(){return N.pkcs7Strip}})}(lib_commonjs)),lib_commonjs}var utils$p={},hasRequiredUtils;function requireUtils(){if(hasRequiredUtils)return utils$p;hasRequiredUtils=1,Object.defineProperty(utils$p,"__esModule",{value:!0}),utils$p.spelunk=utils$p.getPassword=utils$p.zpad=utils$p.looseArrayify=void 0;const b=requireUtils$3();function v(E){return typeof E=="string"&&!E.startsWith("0x")&&(E="0x"+E),(0,b.getBytesCopy)(E)}utils$p.looseArrayify=v;function w(E,k){for(E=String(E);E.length<k;)E="0"+E;return E}utils$p.zpad=w;function _(E){return typeof E=="string"?(0,b.toUtf8Bytes)(E,"NFKC"):(0,b.getBytesCopy)(E)}utils$p.getPassword=_;function A(E,k){const P=k.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i);(0,b.assertArgument)(P!=null,"invalid path","path",k);const N=P[1],q=P[3],B=P[4]==="!";let O=E;for(const I of N.toLowerCase().split(".")){if(Array.isArray(O)){if(!I.match(/^[0-9]+$/))break;O=O[parseInt(I)]}else if(typeof O=="object"){let D=null;for(const V in O)if(V.toLowerCase()===I){D=O[V];break}O=D}else O=null;if(O==null)break}if((0,b.assertArgument)(!B||O!=null,"missing required value","path",N),q&&O!=null){if(q==="int"){if(typeof O=="string"&&O.match(/^-?[0-9]+$/))return parseInt(O);if(Number.isSafeInteger(O))return O}if(q==="number"&&typeof O=="string"&&O.match(/^-?[0-9.]*$/))return parseFloat(O);if(q==="data"&&typeof O=="string")return v(O);if(q==="array"&&Array.isArray(O)||q===typeof O)return O;(0,b.assertArgument)(!1,`wrong type found for ${q} `,"path",N)}return O}return utils$p.spelunk=A,utils$p}var hasRequiredJsonKeystore;function requireJsonKeystore(){if(hasRequiredJsonKeystore)return jsonKeystore;hasRequiredJsonKeystore=1,Object.defineProperty(jsonKeystore,"__esModule",{value:!0}),jsonKeystore.encryptKeystoreJson=jsonKeystore.encryptKeystoreJsonSync=jsonKeystore.decryptKeystoreJson=jsonKeystore.decryptKeystoreJsonSync=jsonKeystore.isKeystoreJson=void 0;const b=requireLib_commonjs(),v=requireAddress$2(),w=requireCrypto(),_=requireTransaction(),A=requireUtils$3(),E=requireUtils(),k=require_version(),P="m/44'/60'/0'/0/0";function N(ce){try{const ae=JSON.parse(ce);if((ae.version!=null?parseInt(ae.version):0)===3)return!0}catch{}return!1}jsonKeystore.isKeystoreJson=N;function q(ce,ae,he){if((0,E.spelunk)(ce,"crypto.cipher:string")==="aes-128-ctr"){const de=(0,E.spelunk)(ce,"crypto.cipherparams.iv:data!"),le=new b.CTR(ae,de);return(0,A.hexlify)(le.decrypt(he))}(0,A.assert)(!1,"unsupported cipher","UNSUPPORTED_OPERATION",{operation:"decrypt"})}function B(ce,ae){const he=(0,A.getBytes)(ae),oe=(0,E.spelunk)(ce,"crypto.ciphertext:data!"),de=(0,A.hexlify)((0,w.keccak256)((0,A.concat)([he.slice(16,32),oe]))).substring(2);(0,A.assertArgument)(de===(0,E.spelunk)(ce,"crypto.mac:string!").toLowerCase(),"incorrect password","password","[ REDACTED ]");const le=q(ce,he.slice(0,16),oe),be=(0,_.computeAddress)(le);if(ce.address){let Z=ce.address.toLowerCase();Z.startsWith("0x")||(Z="0x"+Z),(0,A.assertArgument)((0,v.getAddress)(Z)===be,"keystore address/privateKey mismatch","address",ce.address)}const pe={address:be,privateKey:le};if((0,E.spelunk)(ce,"x-ethers.version:string")==="0.1"){const Z=he.slice(32,64),U=(0,E.spelunk)(ce,"x-ethers.mnemonicCiphertext:data!"),S=(0,E.spelunk)(ce,"x-ethers.mnemonicCounter:data!"),C=new b.CTR(Z,S);pe.mnemonic={path:(0,E.spelunk)(ce,"x-ethers.path:string")||P,locale:(0,E.spelunk)(ce,"x-ethers.locale:string")||"en",entropy:(0,A.hexlify)((0,A.getBytes)(C.decrypt(U)))}}return pe}function O(ce){const ae=(0,E.spelunk)(ce,"crypto.kdf:string");if(ae&&typeof ae=="string"){if(ae.toLowerCase()==="scrypt"){const he=(0,E.spelunk)(ce,"crypto.kdfparams.salt:data!"),oe=(0,E.spelunk)(ce,"crypto.kdfparams.n:int!"),de=(0,E.spelunk)(ce,"crypto.kdfparams.r:int!"),le=(0,E.spelunk)(ce,"crypto.kdfparams.p:int!");(0,A.assertArgument)(oe>0&&(oe&oe-1)===0,"invalid kdf.N","kdf.N",oe),(0,A.assertArgument)(de>0&&le>0,"invalid kdf","kdf",ae);const be=(0,E.spelunk)(ce,"crypto.kdfparams.dklen:int!");return(0,A.assertArgument)(be===32,"invalid kdf.dklen","kdf.dflen",be),{name:"scrypt",salt:he,N:oe,r:de,p:le,dkLen:64}}else if(ae.toLowerCase()==="pbkdf2"){const he=(0,E.spelunk)(ce,"crypto.kdfparams.salt:data!"),oe=(0,E.spelunk)(ce,"crypto.kdfparams.prf:string!"),de=oe.split("-").pop();(0,A.assertArgument)(de==="sha256"||de==="sha512","invalid kdf.pdf","kdf.pdf",oe);const le=(0,E.spelunk)(ce,"crypto.kdfparams.c:int!"),be=(0,E.spelunk)(ce,"crypto.kdfparams.dklen:int!");return(0,A.assertArgument)(be===32,"invalid kdf.dklen","kdf.dklen",be),{name:"pbkdf2",salt:he,count:le,dkLen:be,algorithm:de}}}(0,A.assertArgument)(!1,"unsupported key-derivation function","kdf",ae)}function I(ce,ae){const he=JSON.parse(ce),oe=(0,E.getPassword)(ae),de=O(he);if(de.name==="pbkdf2"){const{salt:S,count:C,dkLen:F,algorithm:X}=de,re=(0,w.pbkdf2)(oe,S,C,F,X);return B(he,re)}(0,A.assert)(de.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:de});const{salt:le,N:be,r:pe,p:fe,dkLen:Z}=de,U=(0,w.scryptSync)(oe,le,be,pe,fe,Z);return B(he,U)}jsonKeystore.decryptKeystoreJsonSync=I;function D(ce){return new Promise(ae=>{setTimeout(()=>{ae()},ce)})}async function V(ce,ae,he){const oe=JSON.parse(ce),de=(0,E.getPassword)(ae),le=O(oe);if(le.name==="pbkdf2"){he&&(he(0),await D(0));const{salt:C,count:F,dkLen:X,algorithm:re}=le,ie=(0,w.pbkdf2)(de,C,F,X,re);return he&&(he(1),await D(0)),B(oe,ie)}(0,A.assert)(le.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:le});const{salt:be,N:pe,r:fe,p:Z,dkLen:U}=le,S=await(0,w.scrypt)(de,be,pe,fe,Z,U,he);return B(oe,S)}jsonKeystore.decryptKeystoreJson=V;function ee(ce){const ae=ce.salt!=null?(0,A.getBytes)(ce.salt,"options.salt"):(0,w.randomBytes)(32);let he=1<<17,oe=8,de=1;return ce.scrypt&&(ce.scrypt.N&&(he=ce.scrypt.N),ce.scrypt.r&&(oe=ce.scrypt.r),ce.scrypt.p&&(de=ce.scrypt.p)),(0,A.assertArgument)(typeof he=="number"&&he>0&&Number.isSafeInteger(he)&&(BigInt(he)&BigInt(he-1))===BigInt(0),"invalid scrypt N parameter","options.N",he),(0,A.assertArgument)(typeof oe=="number"&&oe>0&&Number.isSafeInteger(oe),"invalid scrypt r parameter","options.r",oe),(0,A.assertArgument)(typeof de=="number"&&de>0&&Number.isSafeInteger(de),"invalid scrypt p parameter","options.p",de),{name:"scrypt",dkLen:32,salt:ae,N:he,r:oe,p:de}}function J(ce,ae,he,oe){const de=(0,A.getBytes)(he.privateKey,"privateKey"),le=oe.iv!=null?(0,A.getBytes)(oe.iv,"options.iv"):(0,w.randomBytes)(16);(0,A.assertArgument)(le.length===16,"invalid options.iv length","options.iv",oe.iv);const be=oe.uuid!=null?(0,A.getBytes)(oe.uuid,"options.uuid"):(0,w.randomBytes)(16);(0,A.assertArgument)(be.length===16,"invalid options.uuid length","options.uuid",oe.iv);const pe=ce.slice(0,16),fe=ce.slice(16,32),Z=new b.CTR(pe,le),U=(0,A.getBytes)(Z.encrypt(de)),S=(0,w.keccak256)((0,A.concat)([fe,U])),C={address:he.address.substring(2).toLowerCase(),id:(0,A.uuidV4)(be),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:(0,A.hexlify)(le).substring(2)},ciphertext:(0,A.hexlify)(U).substring(2),kdf:"scrypt",kdfparams:{salt:(0,A.hexlify)(ae.salt).substring(2),n:ae.N,dklen:32,p:ae.p,r:ae.r},mac:S.substring(2)}};if(he.mnemonic){const F=oe.client!=null?oe.client:`ethers/${k.version}`,X=he.mnemonic.path||P,re=he.mnemonic.locale||"en",ie=ce.slice(32,64),Q=(0,A.getBytes)(he.mnemonic.entropy,"account.mnemonic.entropy"),ne=(0,w.randomBytes)(16),L=new b.CTR(ie,ne),ue=(0,A.getBytes)(L.encrypt(Q)),Ae=new Date,Pe="UTC--"+(Ae.getUTCFullYear()+"-"+(0,E.zpad)(Ae.getUTCMonth()+1,2)+"-"+(0,E.zpad)(Ae.getUTCDate(),2)+"T"+(0,E.zpad)(Ae.getUTCHours(),2)+"-"+(0,E.zpad)(Ae.getUTCMinutes(),2)+"-"+(0,E.zpad)(Ae.getUTCSeconds(),2)+".0Z")+"--"+C.address;C["x-ethers"]={client:F,gethFilename:Pe,path:X,locale:re,mnemonicCounter:(0,A.hexlify)(ne).substring(2),mnemonicCiphertext:(0,A.hexlify)(ue).substring(2),version:"0.1"}}return JSON.stringify(C)}function te(ce,ae,he){he==null&&(he={});const oe=(0,E.getPassword)(ae),de=ee(he),le=(0,w.scryptSync)(oe,de.salt,de.N,de.r,de.p,64);return J((0,A.getBytes)(le),de,ce,he)}jsonKeystore.encryptKeystoreJsonSync=te;async function se(ce,ae,he){he==null&&(he={});const oe=(0,E.getPassword)(ae),de=ee(he),le=await(0,w.scrypt)(oe,de.salt,de.N,de.r,de.p,64,he.progressCallback);return J((0,A.getBytes)(le),de,ce,he)}return jsonKeystore.encryptKeystoreJson=se,jsonKeystore}var hasRequiredHdwallet;function requireHdwallet(){return hasRequiredHdwallet||(hasRequiredHdwallet=1,function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.getIndexedAccountPath=b.getAccountPath=b.HDNodeVoidWallet=b.HDNodeWallet=b.defaultPath=void 0;const v=requireCrypto(),w=requireProviders(),_=requireTransaction(),A=requireUtils$3(),E=requireLangEn(),k=requireBaseWallet(),P=requireMnemonic(),N=requireJsonKeystore();b.defaultPath="m/44'/60'/0'/0/0";const q=new Uint8Array([66,105,116,99,111,105,110,32,115,101,101,100]),B=2147483648,O=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),I="0123456789abcdef";function D(oe,de){let le="";for(;oe;)le=I[oe%16]+le,oe=Math.trunc(oe/16);for(;le.length<de*2;)le="0"+le;return"0x"+le}function V(oe){const de=(0,A.getBytes)(oe),le=(0,A.dataSlice)((0,v.sha256)((0,v.sha256)(de)),0,4),be=(0,A.concat)([de,le]);return(0,A.encodeBase58)(be)}const ee={};function J(oe,de,le,be){const pe=new Uint8Array(37);oe&B?((0,A.assert)(be!=null,"cannot derive child of neutered node","UNSUPPORTED_OPERATION",{operation:"deriveChild"}),pe.set((0,A.getBytes)(be),1)):pe.set((0,A.getBytes)(le));for(let Z=24;Z>=0;Z-=8)pe[33+(Z>>3)]=oe>>24-Z&255;const fe=(0,A.getBytes)((0,v.computeHmac)("sha512",de,pe));return{IL:fe.slice(0,32),IR:fe.slice(32)}}function te(oe,de){const le=de.split("/");(0,A.assertArgument)(le.length>0&&(le[0]==="m"||oe.depth>0),"invalid path","path",de),le[0]==="m"&&le.shift();let be=oe;for(let pe=0;pe<le.length;pe++){const fe=le[pe];if(fe.match(/^[0-9]+'$/)){const Z=parseInt(fe.substring(0,fe.length-1));(0,A.assertArgument)(Z<B,"invalid path index",`path[${pe}]`,fe),be=be.deriveChild(B+Z)}else if(fe.match(/^[0-9]+$/)){const Z=parseInt(fe);(0,A.assertArgument)(Z<B,"invalid path index",`path[${pe}]`,fe),be=be.deriveChild(Z)}else(0,A.assertArgument)(!1,"invalid path component",`path[${pe}]`,fe)}return be}class se extends k.BaseWallet{publicKey;fingerprint;parentFingerprint;mnemonic;chainCode;path;index;depth;constructor(de,le,be,pe,fe,Z,U,S,C){super(le,C),(0,A.assertPrivate)(de,ee,"HDNodeWallet"),(0,A.defineProperties)(this,{publicKey:le.compressedPublicKey});const F=(0,A.dataSlice)((0,v.ripemd160)((0,v.sha256)(this.publicKey)),0,4);(0,A.defineProperties)(this,{parentFingerprint:be,fingerprint:F,chainCode:pe,path:fe,index:Z,depth:U}),(0,A.defineProperties)(this,{mnemonic:S})}connect(de){return new se(ee,this.signingKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.mnemonic,de)}#e(){const de={address:this.address,privateKey:this.privateKey},le=this.mnemonic;return this.path&&le&&le.wordlist.locale==="en"&&le.password===""&&(de.mnemonic={path:this.path,locale:"en",entropy:le.entropy}),de}async encrypt(de,le){return await(0,N.encryptKeystoreJson)(this.#e(),de,{progressCallback:le})}encryptSync(de){return(0,N.encryptKeystoreJsonSync)(this.#e(),de)}get extendedKey(){return(0,A.assert)(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),V((0,A.concat)(["0x0488ADE4",D(this.depth,1),this.parentFingerprint,D(this.index,4),this.chainCode,(0,A.concat)(["0x00",this.privateKey])]))}hasPath(){return this.path!=null}neuter(){return new ce(ee,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.provider)}deriveChild(de){const le=(0,A.getNumber)(de,"index");(0,A.assertArgument)(le<=4294967295,"invalid index","index",le);let be=this.path;be&&(be+="/"+(le&~B),le&B&&(be+="'"));const{IR:pe,IL:fe}=J(le,this.chainCode,this.publicKey,this.privateKey),Z=new v.SigningKey((0,A.toBeHex)(((0,A.toBigInt)(fe)+BigInt(this.privateKey))%O,32));return new se(ee,Z,this.fingerprint,(0,A.hexlify)(pe),be,le,this.depth+1,this.mnemonic,this.provider)}derivePath(de){return te(this,de)}static#t(de,le){(0,A.assertArgument)((0,A.isBytesLike)(de),"invalid seed","seed","[REDACTED]");const be=(0,A.getBytes)(de,"seed");(0,A.assertArgument)(be.length>=16&&be.length<=64,"invalid seed","seed","[REDACTED]");const pe=(0,A.getBytes)((0,v.computeHmac)("sha512",q,be)),fe=new v.SigningKey((0,A.hexlify)(pe.slice(0,32)));return new se(ee,fe,"0x00000000",(0,A.hexlify)(pe.slice(32)),"m",0,0,le,null)}static fromExtendedKey(de){const le=(0,A.toBeArray)((0,A.decodeBase58)(de));(0,A.assertArgument)(le.length===82||V(le.slice(0,78))===de,"invalid extended key","extendedKey","[ REDACTED ]");const be=le[4],pe=(0,A.hexlify)(le.slice(5,9)),fe=parseInt((0,A.hexlify)(le.slice(9,13)).substring(2),16),Z=(0,A.hexlify)(le.slice(13,45)),U=le.slice(45,78);switch((0,A.hexlify)(le.slice(0,4))){case"0x0488b21e":case"0x043587cf":{const S=(0,A.hexlify)(U);return new ce(ee,(0,_.computeAddress)(S),S,pe,Z,null,fe,be,null)}case"0x0488ade4":case"0x04358394 ":if(U[0]!==0)break;return new se(ee,new v.SigningKey(U.slice(1)),pe,Z,null,fe,be,null,null)}(0,A.assertArgument)(!1,"invalid extended key prefix","extendedKey","[ REDACTED ]")}static createRandom(de,le,be){de==null&&(de=""),le==null&&(le=b.defaultPath),be==null&&(be=E.LangEn.wordlist());const pe=P.Mnemonic.fromEntropy((0,v.randomBytes)(16),de,be);return se.#t(pe.computeSeed(),pe).derivePath(le)}static fromMnemonic(de,le){return le||(le=b.defaultPath),se.#t(de.computeSeed(),de).derivePath(le)}static fromPhrase(de,le,be,pe){le==null&&(le=""),be==null&&(be=b.defaultPath),pe==null&&(pe=E.LangEn.wordlist());const fe=P.Mnemonic.fromPhrase(de,le,pe);return se.#t(fe.computeSeed(),fe).derivePath(be)}static fromSeed(de){return se.#t(de,null)}}b.HDNodeWallet=se;class ce extends w.VoidSigner{publicKey;fingerprint;parentFingerprint;chainCode;path;index;depth;constructor(de,le,be,pe,fe,Z,U,S,C){super(le,C),(0,A.assertPrivate)(de,ee,"HDNodeVoidWallet"),(0,A.defineProperties)(this,{publicKey:be});const F=(0,A.dataSlice)((0,v.ripemd160)((0,v.sha256)(be)),0,4);(0,A.defineProperties)(this,{publicKey:be,fingerprint:F,parentFingerprint:pe,chainCode:fe,path:Z,index:U,depth:S})}connect(de){return new ce(ee,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,de)}get extendedKey(){return(0,A.assert)(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),V((0,A.concat)(["0x0488B21E",D(this.depth,1),this.parentFingerprint,D(this.index,4),this.chainCode,this.publicKey]))}hasPath(){return this.path!=null}deriveChild(de){const le=(0,A.getNumber)(de,"index");(0,A.assertArgument)(le<=4294967295,"invalid index","index",le);let be=this.path;be&&(be+="/"+(le&~B),le&B&&(be+="'"));const{IR:pe,IL:fe}=J(le,this.chainCode,this.publicKey,null),Z=v.SigningKey.addPoints(fe,this.publicKey,!0),U=(0,_.computeAddress)(Z);return new ce(ee,U,Z,this.fingerprint,(0,A.hexlify)(pe),be,le,this.depth+1,this.provider)}derivePath(de){return te(this,de)}}b.HDNodeVoidWallet=ce;function ae(oe){const de=(0,A.getNumber)(oe,"index");return(0,A.assertArgument)(de>=0&&de<B,"invalid account index","index",de),`m/44'/60'/${de}'/0/0`}b.getAccountPath=ae;function he(oe){const de=(0,A.getNumber)(oe,"index");return(0,A.assertArgument)(de>=0&&de<B,"invalid account index","index",de),`m/44'/60'/0'/0/${de}`}b.getIndexedAccountPath=he}(hdwallet)),hdwallet}var jsonCrowdsale={},hasRequiredJsonCrowdsale;function requireJsonCrowdsale(){if(hasRequiredJsonCrowdsale)return jsonCrowdsale;hasRequiredJsonCrowdsale=1,Object.defineProperty(jsonCrowdsale,"__esModule",{value:!0}),jsonCrowdsale.decryptCrowdsaleJson=jsonCrowdsale.isCrowdsaleJson=void 0;const b=requireLib_commonjs(),v=requireAddress$2(),w=requireCrypto(),_=requireHash(),A=requireUtils$3(),E=requireUtils();function k(N){try{if(JSON.parse(N).encseed)return!0}catch{}return!1}jsonCrowdsale.isCrowdsaleJson=k;function P(N,q){const B=JSON.parse(N),O=(0,E.getPassword)(q),I=(0,v.getAddress)((0,E.spelunk)(B,"ethaddr:string!")),D=(0,E.looseArrayify)((0,E.spelunk)(B,"encseed:string!"));(0,A.assertArgument)(D&&D.length%16===0,"invalid encseed","json",N);const V=(0,A.getBytes)((0,w.pbkdf2)(O,O,2e3,32,"sha256")).slice(0,16),ee=D.slice(0,16),J=D.slice(16),te=new b.CBC(V,ee),se=(0,b.pkcs7Strip)((0,A.getBytes)(te.decrypt(J)));let ce="";for(let ae=0;ae<se.length;ae++)ce+=String.fromCharCode(se[ae]);return{address:I,privateKey:(0,_.id)(ce)}}return jsonCrowdsale.decryptCrowdsaleJson=P,jsonCrowdsale}var wallet={},hasRequiredWallet$1;function requireWallet$1(){if(hasRequiredWallet$1)return wallet;hasRequiredWallet$1=1,Object.defineProperty(wallet,"__esModule",{value:!0}),wallet.Wallet=void 0;const b=requireCrypto(),v=requireUtils$3(),w=requireBaseWallet(),_=requireHdwallet(),A=requireJsonCrowdsale(),E=requireJsonKeystore(),k=requireMnemonic();function P(q){return new Promise(B=>{setTimeout(()=>{B()},q)})}class N extends w.BaseWallet{constructor(B,O){typeof B=="string"&&!B.startsWith("0x")&&(B="0x"+B);let I=typeof B=="string"?new b.SigningKey(B):B;super(I,O)}connect(B){return new N(this.signingKey,B)}async encrypt(B,O){const I={address:this.address,privateKey:this.privateKey};return await(0,E.encryptKeystoreJson)(I,B,{progressCallback:O})}encryptSync(B){const O={address:this.address,privateKey:this.privateKey};return(0,E.encryptKeystoreJsonSync)(O,B)}static#e(B){if((0,v.assertArgument)(B,"invalid JSON wallet","json","[ REDACTED ]"),"mnemonic"in B&&B.mnemonic&&B.mnemonic.locale==="en"){const I=k.Mnemonic.fromEntropy(B.mnemonic.entropy),D=_.HDNodeWallet.fromMnemonic(I,B.mnemonic.path);if(D.address===B.address&&D.privateKey===B.privateKey)return D;console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key")}const O=new N(B.privateKey);return(0,v.assertArgument)(O.address===B.address,"address/privateKey mismatch","json","[ REDACTED ]"),O}static async fromEncryptedJson(B,O,I){let D=null;return(0,E.isKeystoreJson)(B)?D=await(0,E.decryptKeystoreJson)(B,O,I):(0,A.isCrowdsaleJson)(B)&&(I&&(I(0),await P(0)),D=(0,A.decryptCrowdsaleJson)(B,O),I&&(I(1),await P(0))),N.#e(D)}static fromEncryptedJsonSync(B,O){let I=null;return(0,E.isKeystoreJson)(B)?I=(0,E.decryptKeystoreJsonSync)(B,O):(0,A.isCrowdsaleJson)(B)?I=(0,A.decryptCrowdsaleJson)(B,O):(0,v.assertArgument)(!1,"invalid JSON wallet","json","[ REDACTED ]"),N.#e(I)}static createRandom(B){const O=_.HDNodeWallet.createRandom();return B?O.connect(B):O}static fromPhrase(B,O){const I=_.HDNodeWallet.fromPhrase(B);return O?I.connect(O):I}}return wallet.Wallet=N,wallet}var hasRequiredWallet;function requireWallet(){return hasRequiredWallet||(hasRequiredWallet=1,function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.Wallet=b.Mnemonic=b.encryptKeystoreJsonSync=b.encryptKeystoreJson=b.decryptKeystoreJson=b.decryptKeystoreJsonSync=b.isKeystoreJson=b.decryptCrowdsaleJson=b.isCrowdsaleJson=b.HDNodeVoidWallet=b.HDNodeWallet=b.getIndexedAccountPath=b.getAccountPath=b.defaultPath=b.BaseWallet=void 0;var v=requireBaseWallet();Object.defineProperty(b,"BaseWallet",{enumerable:!0,get:function(){return v.BaseWallet}});var w=requireHdwallet();Object.defineProperty(b,"defaultPath",{enumerable:!0,get:function(){return w.defaultPath}}),Object.defineProperty(b,"getAccountPath",{enumerable:!0,get:function(){return w.getAccountPath}}),Object.defineProperty(b,"getIndexedAccountPath",{enumerable:!0,get:function(){return w.getIndexedAccountPath}}),Object.defineProperty(b,"HDNodeWallet",{enumerable:!0,get:function(){return w.HDNodeWallet}}),Object.defineProperty(b,"HDNodeVoidWallet",{enumerable:!0,get:function(){return w.HDNodeVoidWallet}});var _=requireJsonCrowdsale();Object.defineProperty(b,"isCrowdsaleJson",{enumerable:!0,get:function(){return _.isCrowdsaleJson}}),Object.defineProperty(b,"decryptCrowdsaleJson",{enumerable:!0,get:function(){return _.decryptCrowdsaleJson}});var A=requireJsonKeystore();Object.defineProperty(b,"isKeystoreJson",{enumerable:!0,get:function(){return A.isKeystoreJson}}),Object.defineProperty(b,"decryptKeystoreJsonSync",{enumerable:!0,get:function(){return A.decryptKeystoreJsonSync}}),Object.defineProperty(b,"decryptKeystoreJson",{enumerable:!0,get:function(){return A.decryptKeystoreJson}}),Object.defineProperty(b,"encryptKeystoreJson",{enumerable:!0,get:function(){return A.encryptKeystoreJson}}),Object.defineProperty(b,"encryptKeystoreJsonSync",{enumerable:!0,get:function(){return A.encryptKeystoreJsonSync}});var E=requireMnemonic();Object.defineProperty(b,"Mnemonic",{enumerable:!0,get:function(){return E.Mnemonic}});var k=requireWallet$1();Object.defineProperty(b,"Wallet",{enumerable:!0,get:function(){return k.Wallet}})}(wallet$1)),wallet$1}var wordlists={},wordlistOwla={},decodeOwla={},bitReader={},hasRequiredBitReader;function requireBitReader(){if(hasRequiredBitReader)return bitReader;hasRequiredBitReader=1,Object.defineProperty(bitReader,"__esModule",{value:!0}),bitReader.decodeBits=void 0;const b=")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_";function v(w,_){const A=(1<<w)-1,E=[];let k=0,P=0,N=0;for(let q=0;q<_.length;q++)for(k=k<<6|b.indexOf(_[q]),P+=6;P>=w;){const B=k>>P-w;k&=(1<<P-w)-1,P-=w,B===0?N+=A:(E.push(B+N),N=0)}return E}return bitReader.decodeBits=v,bitReader}var hasRequiredDecodeOwla;function requireDecodeOwla(){if(hasRequiredDecodeOwla)return decodeOwla;hasRequiredDecodeOwla=1,Object.defineProperty(decodeOwla,"__esModule",{value:!0}),decodeOwla.decodeOwlA=void 0;const b=requireUtils$3(),v=requireBitReader(),w=requireDecodeOwl();function _(A,E){let k=(0,w.decodeOwl)(A).join(",");return E.split(/,/g).forEach(P=>{const N=P.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/);(0,b.assertArgument)(N!==null,"internal error parsing accents","accents",E);let q=0;const B=(0,v.decodeBits)(parseInt(N[3]),N[4]),O=parseInt(N[2]),I=new RegExp(`([${N[1]}])`,"g");k=k.replace(I,(D,V)=>(--B[q]===0&&(V=String.fromCharCode(V.charCodeAt(0),O),q++),V))}),k.split(",")}return decodeOwla.decodeOwlA=_,decodeOwla}var hasRequiredWordlistOwla;function requireWordlistOwla(){if(hasRequiredWordlistOwla)return wordlistOwla;hasRequiredWordlistOwla=1,Object.defineProperty(wordlistOwla,"__esModule",{value:!0}),wordlistOwla.WordlistOwlA=void 0;const b=requireWordlistOwl(),v=requireDecodeOwla();class w extends b.WordlistOwl{#e;constructor(A,E,k,P){super(A,E,P),this.#e=k}get _accent(){return this.#e}_decodeWords(){return(0,v.decodeOwlA)(this._data,this._accent)}}return wordlistOwla.WordlistOwlA=w,wordlistOwla}var wordlistsBrowser={},hasRequiredWordlistsBrowser;function requireWordlistsBrowser(){if(hasRequiredWordlistsBrowser)return wordlistsBrowser;hasRequiredWordlistsBrowser=1,Object.defineProperty(wordlistsBrowser,"__esModule",{value:!0}),wordlistsBrowser.wordlists=void 0;const b=requireLangEn();return wordlistsBrowser.wordlists={en:b.LangEn.wordlist()},wordlistsBrowser}var hasRequiredWordlists;function requireWordlists(){return hasRequiredWordlists||(hasRequiredWordlists=1,function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.wordlists=b.WordlistOwlA=b.WordlistOwl=b.LangEn=b.Wordlist=void 0;var v=requireWordlist();Object.defineProperty(b,"Wordlist",{enumerable:!0,get:function(){return v.Wordlist}});var w=requireLangEn();Object.defineProperty(b,"LangEn",{enumerable:!0,get:function(){return w.LangEn}});var _=requireWordlistOwl();Object.defineProperty(b,"WordlistOwl",{enumerable:!0,get:function(){return _.WordlistOwl}});var A=requireWordlistOwla();Object.defineProperty(b,"WordlistOwlA",{enumerable:!0,get:function(){return A.WordlistOwlA}});var E=requireWordlistsBrowser();Object.defineProperty(b,"wordlists",{enumerable:!0,get:function(){return E.wordlists}})}(wordlists)),wordlists}var hasRequiredEthers;function requireEthers(){return hasRequiredEthers||(hasRequiredEthers=1,function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.ripemd160=b.keccak256=b.randomBytes=b.computeHmac=b.UndecodedEventLog=b.EventLog=b.ContractUnknownEventPayload=b.ContractTransactionResponse=b.ContractTransactionReceipt=b.ContractEventPayload=b.ContractFactory=b.Contract=b.BaseContract=b.MessagePrefix=b.EtherSymbol=b.ZeroHash=b.N=b.MaxInt256=b.MinInt256=b.MaxUint256=b.WeiPerEther=b.ZeroAddress=b.resolveAddress=b.isAddress=b.isAddressable=b.getCreate2Address=b.getCreateAddress=b.getIcapAddress=b.getAddress=b.Typed=b.TransactionDescription=b.Result=b.LogDescription=b.Interface=b.Indexed=b.ErrorDescription=b.checkResultErrors=b.StructFragment=b.ParamType=b.NamedFragment=b.FunctionFragment=b.FallbackFragment=b.Fragment=b.EventFragment=b.ErrorFragment=b.ConstructorFragment=b.AbiCoder=b.encodeBytes32String=b.decodeBytes32String=b.version=void 0,b.EtherscanPlugin=b.EnsPlugin=b.Network=b.EnsResolver=b.WebSocketProvider=b.SocketProvider=b.IpcSocketProvider=b.QuickNodeProvider=b.PocketProvider=b.InfuraWebSocketProvider=b.InfuraProvider=b.EtherscanProvider=b.CloudflareProvider=b.AnkrProvider=b.AlchemyProvider=b.BrowserProvider=b.JsonRpcSigner=b.JsonRpcProvider=b.JsonRpcApiProvider=b.FallbackProvider=b.AbstractProvider=b.VoidSigner=b.NonceManager=b.AbstractSigner=b.TransactionResponse=b.TransactionReceipt=b.Log=b.FeeData=b.Block=b.getDefaultProvider=b.verifyTypedData=b.TypedDataEncoder=b.solidityPackedSha256=b.solidityPackedKeccak256=b.solidityPacked=b.verifyMessage=b.hashMessage=b.dnsEncode=b.namehash=b.isValidName=b.ensNormalize=b.id=b.SigningKey=b.Signature=b.lock=b.scryptSync=b.scrypt=b.pbkdf2=b.sha512=b.sha256=void 0,b.toBeArray=b.getUint=b.getNumber=b.getBigInt=b.FixedNumber=b.FetchCancelSignal=b.FetchResponse=b.FetchRequest=b.EventPayload=b.isError=b.isCallException=b.makeError=b.assertPrivate=b.assertNormalize=b.assertArgumentCount=b.assertArgument=b.assert=b.resolveProperties=b.defineProperties=b.zeroPadValue=b.zeroPadBytes=b.stripZerosLeft=b.isBytesLike=b.isHexString=b.hexlify=b.getBytesCopy=b.getBytes=b.dataSlice=b.dataLength=b.concat=b.encodeBase64=b.decodeBase64=b.encodeBase58=b.decodeBase58=b.Transaction=b.recoverAddress=b.computeAddress=b.accessListify=b.showThrottleMessage=b.copyRequest=b.UnmanagedSubscriber=b.SocketSubscriber=b.SocketPendingSubscriber=b.SocketEventSubscriber=b.SocketBlockSubscriber=b.MulticoinProviderPlugin=b.NetworkPlugin=b.GasCostPlugin=b.FetchUrlFeeDataNetworkPlugin=b.FeeDataNetworkPlugin=void 0,b.wordlists=b.WordlistOwlA=b.WordlistOwl=b.LangEn=b.Wordlist=b.encryptKeystoreJsonSync=b.encryptKeystoreJson=b.decryptKeystoreJson=b.decryptKeystoreJsonSync=b.decryptCrowdsaleJson=b.isKeystoreJson=b.isCrowdsaleJson=b.getIndexedAccountPath=b.getAccountPath=b.defaultPath=b.Wallet=b.HDNodeVoidWallet=b.HDNodeWallet=b.BaseWallet=b.Mnemonic=b.uuidV4=b.encodeRlp=b.decodeRlp=b.Utf8ErrorFuncs=b.toUtf8String=b.toUtf8CodePoints=b.toUtf8Bytes=b.parseUnits=b.formatUnits=b.parseEther=b.formatEther=b.mask=b.toTwos=b.fromTwos=b.toQuantity=b.toNumber=b.toBeHex=b.toBigInt=void 0;var v=require_version();Object.defineProperty(b,"version",{enumerable:!0,get:function(){return v.version}});var w=requireAbi();Object.defineProperty(b,"decodeBytes32String",{enumerable:!0,get:function(){return w.decodeBytes32String}}),Object.defineProperty(b,"encodeBytes32String",{enumerable:!0,get:function(){return w.encodeBytes32String}}),Object.defineProperty(b,"AbiCoder",{enumerable:!0,get:function(){return w.AbiCoder}}),Object.defineProperty(b,"ConstructorFragment",{enumerable:!0,get:function(){return w.ConstructorFragment}}),Object.defineProperty(b,"ErrorFragment",{enumerable:!0,get:function(){return w.ErrorFragment}}),Object.defineProperty(b,"EventFragment",{enumerable:!0,get:function(){return w.EventFragment}}),Object.defineProperty(b,"Fragment",{enumerable:!0,get:function(){return w.Fragment}}),Object.defineProperty(b,"FallbackFragment",{enumerable:!0,get:function(){return w.FallbackFragment}}),Object.defineProperty(b,"FunctionFragment",{enumerable:!0,get:function(){return w.FunctionFragment}}),Object.defineProperty(b,"NamedFragment",{enumerable:!0,get:function(){return w.NamedFragment}}),Object.defineProperty(b,"ParamType",{enumerable:!0,get:function(){return w.ParamType}}),Object.defineProperty(b,"StructFragment",{enumerable:!0,get:function(){return w.StructFragment}}),Object.defineProperty(b,"checkResultErrors",{enumerable:!0,get:function(){return w.checkResultErrors}}),Object.defineProperty(b,"ErrorDescription",{enumerable:!0,get:function(){return w.ErrorDescription}}),Object.defineProperty(b,"Indexed",{enumerable:!0,get:function(){return w.Indexed}}),Object.defineProperty(b,"Interface",{enumerable:!0,get:function(){return w.Interface}}),Object.defineProperty(b,"LogDescription",{enumerable:!0,get:function(){return w.LogDescription}}),Object.defineProperty(b,"Result",{enumerable:!0,get:function(){return w.Result}}),Object.defineProperty(b,"TransactionDescription",{enumerable:!0,get:function(){return w.TransactionDescription}}),Object.defineProperty(b,"Typed",{enumerable:!0,get:function(){return w.Typed}});var _=requireAddress$2();Object.defineProperty(b,"getAddress",{enumerable:!0,get:function(){return _.getAddress}}),Object.defineProperty(b,"getIcapAddress",{enumerable:!0,get:function(){return _.getIcapAddress}}),Object.defineProperty(b,"getCreateAddress",{enumerable:!0,get:function(){return _.getCreateAddress}}),Object.defineProperty(b,"getCreate2Address",{enumerable:!0,get:function(){return _.getCreate2Address}}),Object.defineProperty(b,"isAddressable",{enumerable:!0,get:function(){return _.isAddressable}}),Object.defineProperty(b,"isAddress",{enumerable:!0,get:function(){return _.isAddress}}),Object.defineProperty(b,"resolveAddress",{enumerable:!0,get:function(){return _.resolveAddress}});var A=requireConstants$1();Object.defineProperty(b,"ZeroAddress",{enumerable:!0,get:function(){return A.ZeroAddress}}),Object.defineProperty(b,"WeiPerEther",{enumerable:!0,get:function(){return A.WeiPerEther}}),Object.defineProperty(b,"MaxUint256",{enumerable:!0,get:function(){return A.MaxUint256}}),Object.defineProperty(b,"MinInt256",{enumerable:!0,get:function(){return A.MinInt256}}),Object.defineProperty(b,"MaxInt256",{enumerable:!0,get:function(){return A.MaxInt256}}),Object.defineProperty(b,"N",{enumerable:!0,get:function(){return A.N}}),Object.defineProperty(b,"ZeroHash",{enumerable:!0,get:function(){return A.ZeroHash}}),Object.defineProperty(b,"EtherSymbol",{enumerable:!0,get:function(){return A.EtherSymbol}}),Object.defineProperty(b,"MessagePrefix",{enumerable:!0,get:function(){return A.MessagePrefix}});var E=requireContract();Object.defineProperty(b,"BaseContract",{enumerable:!0,get:function(){return E.BaseContract}}),Object.defineProperty(b,"Contract",{enumerable:!0,get:function(){return E.Contract}}),Object.defineProperty(b,"ContractFactory",{enumerable:!0,get:function(){return E.ContractFactory}}),Object.defineProperty(b,"ContractEventPayload",{enumerable:!0,get:function(){return E.ContractEventPayload}}),Object.defineProperty(b,"ContractTransactionReceipt",{enumerable:!0,get:function(){return E.ContractTransactionReceipt}}),Object.defineProperty(b,"ContractTransactionResponse",{enumerable:!0,get:function(){return E.ContractTransactionResponse}}),Object.defineProperty(b,"ContractUnknownEventPayload",{enumerable:!0,get:function(){return E.ContractUnknownEventPayload}}),Object.defineProperty(b,"EventLog",{enumerable:!0,get:function(){return E.EventLog}}),Object.defineProperty(b,"UndecodedEventLog",{enumerable:!0,get:function(){return E.UndecodedEventLog}});var k=requireCrypto();Object.defineProperty(b,"computeHmac",{enumerable:!0,get:function(){return k.computeHmac}}),Object.defineProperty(b,"randomBytes",{enumerable:!0,get:function(){return k.randomBytes}}),Object.defineProperty(b,"keccak256",{enumerable:!0,get:function(){return k.keccak256}}),Object.defineProperty(b,"ripemd160",{enumerable:!0,get:function(){return k.ripemd160}}),Object.defineProperty(b,"sha256",{enumerable:!0,get:function(){return k.sha256}}),Object.defineProperty(b,"sha512",{enumerable:!0,get:function(){return k.sha512}}),Object.defineProperty(b,"pbkdf2",{enumerable:!0,get:function(){return k.pbkdf2}}),Object.defineProperty(b,"scrypt",{enumerable:!0,get:function(){return k.scrypt}}),Object.defineProperty(b,"scryptSync",{enumerable:!0,get:function(){return k.scryptSync}}),Object.defineProperty(b,"lock",{enumerable:!0,get:function(){return k.lock}}),Object.defineProperty(b,"Signature",{enumerable:!0,get:function(){return k.Signature}}),Object.defineProperty(b,"SigningKey",{enumerable:!0,get:function(){return k.SigningKey}});var P=requireHash();Object.defineProperty(b,"id",{enumerable:!0,get:function(){return P.id}}),Object.defineProperty(b,"ensNormalize",{enumerable:!0,get:function(){return P.ensNormalize}}),Object.defineProperty(b,"isValidName",{enumerable:!0,get:function(){return P.isValidName}}),Object.defineProperty(b,"namehash",{enumerable:!0,get:function(){return P.namehash}}),Object.defineProperty(b,"dnsEncode",{enumerable:!0,get:function(){return P.dnsEncode}}),Object.defineProperty(b,"hashMessage",{enumerable:!0,get:function(){return P.hashMessage}}),Object.defineProperty(b,"verifyMessage",{enumerable:!0,get:function(){return P.verifyMessage}}),Object.defineProperty(b,"solidityPacked",{enumerable:!0,get:function(){return P.solidityPacked}}),Object.defineProperty(b,"solidityPackedKeccak256",{enumerable:!0,get:function(){return P.solidityPackedKeccak256}}),Object.defineProperty(b,"solidityPackedSha256",{enumerable:!0,get:function(){return P.solidityPackedSha256}}),Object.defineProperty(b,"TypedDataEncoder",{enumerable:!0,get:function(){return P.TypedDataEncoder}}),Object.defineProperty(b,"verifyTypedData",{enumerable:!0,get:function(){return P.verifyTypedData}});var N=requireProviders();Object.defineProperty(b,"getDefaultProvider",{enumerable:!0,get:function(){return N.getDefaultProvider}}),Object.defineProperty(b,"Block",{enumerable:!0,get:function(){return N.Block}}),Object.defineProperty(b,"FeeData",{enumerable:!0,get:function(){return N.FeeData}}),Object.defineProperty(b,"Log",{enumerable:!0,get:function(){return N.Log}}),Object.defineProperty(b,"TransactionReceipt",{enumerable:!0,get:function(){return N.TransactionReceipt}}),Object.defineProperty(b,"TransactionResponse",{enumerable:!0,get:function(){return N.TransactionResponse}}),Object.defineProperty(b,"AbstractSigner",{enumerable:!0,get:function(){return N.AbstractSigner}}),Object.defineProperty(b,"NonceManager",{enumerable:!0,get:function(){return N.NonceManager}}),Object.defineProperty(b,"VoidSigner",{enumerable:!0,get:function(){return N.VoidSigner}}),Object.defineProperty(b,"AbstractProvider",{enumerable:!0,get:function(){return N.AbstractProvider}}),Object.defineProperty(b,"FallbackProvider",{enumerable:!0,get:function(){return N.FallbackProvider}}),Object.defineProperty(b,"JsonRpcApiProvider",{enumerable:!0,get:function(){return N.JsonRpcApiProvider}}),Object.defineProperty(b,"JsonRpcProvider",{enumerable:!0,get:function(){return N.JsonRpcProvider}}),Object.defineProperty(b,"JsonRpcSigner",{enumerable:!0,get:function(){return N.JsonRpcSigner}}),Object.defineProperty(b,"BrowserProvider",{enumerable:!0,get:function(){return N.BrowserProvider}}),Object.defineProperty(b,"AlchemyProvider",{enumerable:!0,get:function(){return N.AlchemyProvider}}),Object.defineProperty(b,"AnkrProvider",{enumerable:!0,get:function(){return N.AnkrProvider}}),Object.defineProperty(b,"CloudflareProvider",{enumerable:!0,get:function(){return N.CloudflareProvider}}),Object.defineProperty(b,"EtherscanProvider",{enumerable:!0,get:function(){return N.EtherscanProvider}}),Object.defineProperty(b,"InfuraProvider",{enumerable:!0,get:function(){return N.InfuraProvider}}),Object.defineProperty(b,"InfuraWebSocketProvider",{enumerable:!0,get:function(){return N.InfuraWebSocketProvider}}),Object.defineProperty(b,"PocketProvider",{enumerable:!0,get:function(){return N.PocketProvider}}),Object.defineProperty(b,"QuickNodeProvider",{enumerable:!0,get:function(){return N.QuickNodeProvider}}),Object.defineProperty(b,"IpcSocketProvider",{enumerable:!0,get:function(){return N.IpcSocketProvider}}),Object.defineProperty(b,"SocketProvider",{enumerable:!0,get:function(){return N.SocketProvider}}),Object.defineProperty(b,"WebSocketProvider",{enumerable:!0,get:function(){return N.WebSocketProvider}}),Object.defineProperty(b,"EnsResolver",{enumerable:!0,get:function(){return N.EnsResolver}}),Object.defineProperty(b,"Network",{enumerable:!0,get:function(){return N.Network}}),Object.defineProperty(b,"EnsPlugin",{enumerable:!0,get:function(){return N.EnsPlugin}}),Object.defineProperty(b,"EtherscanPlugin",{enumerable:!0,get:function(){return N.EtherscanPlugin}}),Object.defineProperty(b,"FeeDataNetworkPlugin",{enumerable:!0,get:function(){return N.FeeDataNetworkPlugin}}),Object.defineProperty(b,"FetchUrlFeeDataNetworkPlugin",{enumerable:!0,get:function(){return N.FetchUrlFeeDataNetworkPlugin}}),Object.defineProperty(b,"GasCostPlugin",{enumerable:!0,get:function(){return N.GasCostPlugin}}),Object.defineProperty(b,"NetworkPlugin",{enumerable:!0,get:function(){return N.NetworkPlugin}}),Object.defineProperty(b,"MulticoinProviderPlugin",{enumerable:!0,get:function(){return N.MulticoinProviderPlugin}}),Object.defineProperty(b,"SocketBlockSubscriber",{enumerable:!0,get:function(){return N.SocketBlockSubscriber}}),Object.defineProperty(b,"SocketEventSubscriber",{enumerable:!0,get:function(){return N.SocketEventSubscriber}}),Object.defineProperty(b,"SocketPendingSubscriber",{enumerable:!0,get:function(){return N.SocketPendingSubscriber}}),Object.defineProperty(b,"SocketSubscriber",{enumerable:!0,get:function(){return N.SocketSubscriber}}),Object.defineProperty(b,"UnmanagedSubscriber",{enumerable:!0,get:function(){return N.UnmanagedSubscriber}}),Object.defineProperty(b,"copyRequest",{enumerable:!0,get:function(){return N.copyRequest}}),Object.defineProperty(b,"showThrottleMessage",{enumerable:!0,get:function(){return N.showThrottleMessage}});var q=requireTransaction();Object.defineProperty(b,"accessListify",{enumerable:!0,get:function(){return q.accessListify}}),Object.defineProperty(b,"computeAddress",{enumerable:!0,get:function(){return q.computeAddress}}),Object.defineProperty(b,"recoverAddress",{enumerable:!0,get:function(){return q.recoverAddress}}),Object.defineProperty(b,"Transaction",{enumerable:!0,get:function(){return q.Transaction}});var B=requireUtils$3();Object.defineProperty(b,"decodeBase58",{enumerable:!0,get:function(){return B.decodeBase58}}),Object.defineProperty(b,"encodeBase58",{enumerable:!0,get:function(){return B.encodeBase58}}),Object.defineProperty(b,"decodeBase64",{enumerable:!0,get:function(){return B.decodeBase64}}),Object.defineProperty(b,"encodeBase64",{enumerable:!0,get:function(){return B.encodeBase64}}),Object.defineProperty(b,"concat",{enumerable:!0,get:function(){return B.concat}}),Object.defineProperty(b,"dataLength",{enumerable:!0,get:function(){return B.dataLength}}),Object.defineProperty(b,"dataSlice",{enumerable:!0,get:function(){return B.dataSlice}}),Object.defineProperty(b,"getBytes",{enumerable:!0,get:function(){return B.getBytes}}),Object.defineProperty(b,"getBytesCopy",{enumerable:!0,get:function(){return B.getBytesCopy}}),Object.defineProperty(b,"hexlify",{enumerable:!0,get:function(){return B.hexlify}}),Object.defineProperty(b,"isHexString",{enumerable:!0,get:function(){return B.isHexString}}),Object.defineProperty(b,"isBytesLike",{enumerable:!0,get:function(){return B.isBytesLike}}),Object.defineProperty(b,"stripZerosLeft",{enumerable:!0,get:function(){return B.stripZerosLeft}}),Object.defineProperty(b,"zeroPadBytes",{enumerable:!0,get:function(){return B.zeroPadBytes}}),Object.defineProperty(b,"zeroPadValue",{enumerable:!0,get:function(){return B.zeroPadValue}}),Object.defineProperty(b,"defineProperties",{enumerable:!0,get:function(){return B.defineProperties}}),Object.defineProperty(b,"resolveProperties",{enumerable:!0,get:function(){return B.resolveProperties}}),Object.defineProperty(b,"assert",{enumerable:!0,get:function(){return B.assert}}),Object.defineProperty(b,"assertArgument",{enumerable:!0,get:function(){return B.assertArgument}}),Object.defineProperty(b,"assertArgumentCount",{enumerable:!0,get:function(){return B.assertArgumentCount}}),Object.defineProperty(b,"assertNormalize",{enumerable:!0,get:function(){return B.assertNormalize}}),Object.defineProperty(b,"assertPrivate",{enumerable:!0,get:function(){return B.assertPrivate}}),Object.defineProperty(b,"makeError",{enumerable:!0,get:function(){return B.makeError}}),Object.defineProperty(b,"isCallException",{enumerable:!0,get:function(){return B.isCallException}}),Object.defineProperty(b,"isError",{enumerable:!0,get:function(){return B.isError}}),Object.defineProperty(b,"EventPayload",{enumerable:!0,get:function(){return B.EventPayload}}),Object.defineProperty(b,"FetchRequest",{enumerable:!0,get:function(){return B.FetchRequest}}),Object.defineProperty(b,"FetchResponse",{enumerable:!0,get:function(){return B.FetchResponse}}),Object.defineProperty(b,"FetchCancelSignal",{enumerable:!0,get:function(){return B.FetchCancelSignal}}),Object.defineProperty(b,"FixedNumber",{enumerable:!0,get:function(){return B.FixedNumber}}),Object.defineProperty(b,"getBigInt",{enumerable:!0,get:function(){return B.getBigInt}}),Object.defineProperty(b,"getNumber",{enumerable:!0,get:function(){return B.getNumber}}),Object.defineProperty(b,"getUint",{enumerable:!0,get:function(){return B.getUint}}),Object.defineProperty(b,"toBeArray",{enumerable:!0,get:function(){return B.toBeArray}}),Object.defineProperty(b,"toBigInt",{enumerable:!0,get:function(){return B.toBigInt}}),Object.defineProperty(b,"toBeHex",{enumerable:!0,get:function(){return B.toBeHex}}),Object.defineProperty(b,"toNumber",{enumerable:!0,get:function(){return B.toNumber}}),Object.defineProperty(b,"toQuantity",{enumerable:!0,get:function(){return B.toQuantity}}),Object.defineProperty(b,"fromTwos",{enumerable:!0,get:function(){return B.fromTwos}}),Object.defineProperty(b,"toTwos",{enumerable:!0,get:function(){return B.toTwos}}),Object.defineProperty(b,"mask",{enumerable:!0,get:function(){return B.mask}}),Object.defineProperty(b,"formatEther",{enumerable:!0,get:function(){return B.formatEther}}),Object.defineProperty(b,"parseEther",{enumerable:!0,get:function(){return B.parseEther}}),Object.defineProperty(b,"formatUnits",{enumerable:!0,get:function(){return B.formatUnits}}),Object.defineProperty(b,"parseUnits",{enumerable:!0,get:function(){return B.parseUnits}}),Object.defineProperty(b,"toUtf8Bytes",{enumerable:!0,get:function(){return B.toUtf8Bytes}}),Object.defineProperty(b,"toUtf8CodePoints",{enumerable:!0,get:function(){return B.toUtf8CodePoints}}),Object.defineProperty(b,"toUtf8String",{enumerable:!0,get:function(){return B.toUtf8String}}),Object.defineProperty(b,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return B.Utf8ErrorFuncs}}),Object.defineProperty(b,"decodeRlp",{enumerable:!0,get:function(){return B.decodeRlp}}),Object.defineProperty(b,"encodeRlp",{enumerable:!0,get:function(){return B.encodeRlp}}),Object.defineProperty(b,"uuidV4",{enumerable:!0,get:function(){return B.uuidV4}});var O=requireWallet();Object.defineProperty(b,"Mnemonic",{enumerable:!0,get:function(){return O.Mnemonic}}),Object.defineProperty(b,"BaseWallet",{enumerable:!0,get:function(){return O.BaseWallet}}),Object.defineProperty(b,"HDNodeWallet",{enumerable:!0,get:function(){return O.HDNodeWallet}}),Object.defineProperty(b,"HDNodeVoidWallet",{enumerable:!0,get:function(){return O.HDNodeVoidWallet}}),Object.defineProperty(b,"Wallet",{enumerable:!0,get:function(){return O.Wallet}}),Object.defineProperty(b,"defaultPath",{enumerable:!0,get:function(){return O.defaultPath}}),Object.defineProperty(b,"getAccountPath",{enumerable:!0,get:function(){return O.getAccountPath}}),Object.defineProperty(b,"getIndexedAccountPath",{enumerable:!0,get:function(){return O.getIndexedAccountPath}}),Object.defineProperty(b,"isCrowdsaleJson",{enumerable:!0,get:function(){return O.isCrowdsaleJson}}),Object.defineProperty(b,"isKeystoreJson",{enumerable:!0,get:function(){return O.isKeystoreJson}}),Object.defineProperty(b,"decryptCrowdsaleJson",{enumerable:!0,get:function(){return O.decryptCrowdsaleJson}}),Object.defineProperty(b,"decryptKeystoreJsonSync",{enumerable:!0,get:function(){return O.decryptKeystoreJsonSync}}),Object.defineProperty(b,"decryptKeystoreJson",{enumerable:!0,get:function(){return O.decryptKeystoreJson}}),Object.defineProperty(b,"encryptKeystoreJson",{enumerable:!0,get:function(){return O.encryptKeystoreJson}}),Object.defineProperty(b,"encryptKeystoreJsonSync",{enumerable:!0,get:function(){return O.encryptKeystoreJsonSync}});var I=requireWordlists();Object.defineProperty(b,"Wordlist",{enumerable:!0,get:function(){return I.Wordlist}}),Object.defineProperty(b,"LangEn",{enumerable:!0,get:function(){return I.LangEn}}),Object.defineProperty(b,"WordlistOwl",{enumerable:!0,get:function(){return I.WordlistOwl}}),Object.defineProperty(b,"WordlistOwlA",{enumerable:!0,get:function(){return I.WordlistOwlA}}),Object.defineProperty(b,"wordlists",{enumerable:!0,get:function(){return I.wordlists}})}(ethers)),ethers}(function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.ethers=void 0;const v=require$$0$1,w=v.__importStar(requireEthers());b.ethers=w,v.__exportStar(requireEthers(),b)})(lib_commonjs$1);Object.defineProperty(ethersCompat,"__esModule",{value:!0});ethersCompat.getAddress=ethersCompat.hashMessage=ethersCompat.verifyMessage=void 0;const ethers_1$1=lib_commonjs$1;let ethersVerifyMessage=null,ethersHashMessage=null,ethersGetAddress=null;try{ethersVerifyMessage=ethers_1$1.ethers.utils.verifyMessage,ethersHashMessage=ethers_1$1.ethers.utils.hashMessage,ethersGetAddress=ethers_1$1.ethers.utils.getAddress}catch{ethersVerifyMessage=ethers_1$1.ethers.verifyMessage,ethersHashMessage=ethers_1$1.ethers.hashMessage,ethersGetAddress=ethers_1$1.ethers.getAddress}ethersCompat.verifyMessage=ethersVerifyMessage;ethersCompat.hashMessage=ethersHashMessage;ethersCompat.getAddress=ethersGetAddress;var types$4={};(function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.SiweErrorType=b.SiweError=b.VerifyOptsKeys=b.VerifyParamsKeys=void 0,b.VerifyParamsKeys=["signature","scheme","domain","nonce","time"],b.VerifyOptsKeys=["provider","suppressExceptions","verificationFallback"];class v{constructor(_,A,E){this.type=_,this.expected=A,this.received=E}}b.SiweError=v,function(w){w.EXPIRED_MESSAGE="Expired message.",w.INVALID_DOMAIN="Invalid domain.",w.SCHEME_MISMATCH="Scheme does not match provided scheme for verification.",w.DOMAIN_MISMATCH="Domain does not match provided domain for verification.",w.NONCE_MISMATCH="Nonce does not match provided nonce for verification.",w.INVALID_ADDRESS="Invalid address.",w.INVALID_URI="URI does not conform to RFC 3986.",w.INVALID_NONCE="Nonce size smaller then 8 characters or is not alphanumeric.",w.NOT_YET_VALID_MESSAGE="Message is not valid yet.",w.INVALID_SIGNATURE="Signature does not match address of the message.",w.INVALID_TIME_FORMAT="Invalid time format.",w.INVALID_MESSAGE_VERSION="Invalid message version.",w.UNABLE_TO_PARSE="Unable to parse the message."}(b.SiweErrorType||(b.SiweErrorType={}))})(types$4);var utils$o={},random={},system={},browser$d={};Object.defineProperty(browser$d,"__esModule",{value:!0});browser$d.BrowserRandomSource=void 0;const QUOTA=65536;class BrowserRandomSource{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const v=typeof self<"u"?self.crypto||self.msCrypto:null;v&&v.getRandomValues!==void 0&&(this._crypto=v,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(v){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const w=new Uint8Array(v);for(let _=0;_<w.length;_+=QUOTA)this._crypto.getRandomValues(w.subarray(_,_+Math.min(w.length-_,QUOTA)));return w}}browser$d.BrowserRandomSource=BrowserRandomSource;function commonjsRequire(b){throw new Error('Could not dynamically require "'+b+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var node$1={},wipe$1={};Object.defineProperty(wipe$1,"__esModule",{value:!0});function wipe(b){for(var v=0;v<b.length;v++)b[v]=0;return b}wipe$1.wipe=wipe;var cryptoBrowserify={};function getDefaultExportFromCjs(b){return b&&b.__esModule&&Object.prototype.hasOwnProperty.call(b,"default")?b.default:b}var browser$c={exports:{}},process=browser$c.exports={},cachedSetTimeout,cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?cachedSetTimeout=setTimeout:cachedSetTimeout=defaultSetTimout}catch{cachedSetTimeout=defaultSetTimout}try{typeof clearTimeout=="function"?cachedClearTimeout=clearTimeout:cachedClearTimeout=defaultClearTimeout}catch{cachedClearTimeout=defaultClearTimeout}})();function runTimeout(b){if(cachedSetTimeout===setTimeout)return setTimeout(b,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(b,0);try{return cachedSetTimeout(b,0)}catch{try{return cachedSetTimeout.call(null,b,0)}catch{return cachedSetTimeout.call(this,b,0)}}}function runClearTimeout(b){if(cachedClearTimeout===clearTimeout)return clearTimeout(b);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(b);try{return cachedClearTimeout(b)}catch{try{return cachedClearTimeout.call(null,b)}catch{return cachedClearTimeout.call(this,b)}}}var queue=[],draining=!1,currentQueue,queueIndex=-1;function cleanUpNextTick(){!draining||!currentQueue||(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var b=runTimeout(cleanUpNextTick);draining=!0;for(var v=queue.length;v;){for(currentQueue=queue,queue=[];++queueIndex<v;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,v=queue.length}currentQueue=null,draining=!1,runClearTimeout(b)}}process.nextTick=function(b){var v=new Array(arguments.length-1);if(arguments.length>1)for(var w=1;w<arguments.length;w++)v[w-1]=arguments[w];queue.push(new Item(b,v)),queue.length===1&&!draining&&runTimeout(drainQueue)};function Item(b,v){this.fun=b,this.array=v}Item.prototype.run=function(){this.fun.apply(null,this.array)};process.title="browser";process.browser=!0;process.env={};process.argv=[];process.version="";process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(b){return[]};process.binding=function(b){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(b){throw new Error("process.chdir is not supported")};process.umask=function(){return 0};var browserExports$1=browser$c.exports;const process$1=getDefaultExportFromCjs(browserExports$1);var browser$b={exports:{}},safeBuffer$2={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(b,v){var w=require$$1$2,_=w.Buffer;function A(k,P){for(var N in k)P[N]=k[N]}_.from&&_.alloc&&_.allocUnsafe&&_.allocUnsafeSlow?b.exports=w:(A(w,v),v.Buffer=E);function E(k,P,N){return _(k,P,N)}E.prototype=Object.create(_.prototype),A(_,E),E.from=function(k,P,N){if(typeof k=="number")throw new TypeError("Argument must not be a number");return _(k,P,N)},E.alloc=function(k,P,N){if(typeof k!="number")throw new TypeError("Argument must be a number");var q=_(k);return P!==void 0?typeof N=="string"?q.fill(P,N):q.fill(P):q.fill(0),q},E.allocUnsafe=function(k){if(typeof k!="number")throw new TypeError("Argument must be a number");return _(k)},E.allocUnsafeSlow=function(k){if(typeof k!="number")throw new TypeError("Argument must be a number");return w.SlowBuffer(k)}})(safeBuffer$2,safeBuffer$2.exports);var safeBufferExports$1=safeBuffer$2.exports,MAX_BYTES=65536,MAX_UINT32=4294967295;function oldBrowser$1(){throw new Error(`Secure random number generation is not supported by this browser.
767
- Use Chrome, Firefox or Internet Explorer 11`)}var Buffer$C=safeBufferExports$1.Buffer,crypto$1=commonjsGlobal.crypto||commonjsGlobal.msCrypto;crypto$1&&crypto$1.getRandomValues?browser$b.exports=randomBytes$3:browser$b.exports=oldBrowser$1;function randomBytes$3(b,v){if(b>MAX_UINT32)throw new RangeError("requested too many random bytes");var w=Buffer$C.allocUnsafe(b);if(b>0)if(b>MAX_BYTES)for(var _=0;_<b;_+=MAX_BYTES)crypto$1.getRandomValues(w.slice(_,_+MAX_BYTES));else crypto$1.getRandomValues(w);return typeof v=="function"?process$1.nextTick(function(){v(null,w)}):w}var browserExports=browser$b.exports,inherits_browser={exports:{}};typeof Object.create=="function"?inherits_browser.exports=function(v,w){w&&(v.super_=w,v.prototype=Object.create(w.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}))}:inherits_browser.exports=function(v,w){if(w){v.super_=w;var _=function(){};_.prototype=w.prototype,v.prototype=new _,v.prototype.constructor=v}};var inherits_browserExports=inherits_browser.exports,readableBrowser$1={exports:{}},events={exports:{}},R=typeof Reflect=="object"?Reflect:null,ReflectApply=R&&typeof R.apply=="function"?R.apply:function(v,w,_){return Function.prototype.apply.call(v,w,_)},ReflectOwnKeys;R&&typeof R.ownKeys=="function"?ReflectOwnKeys=R.ownKeys:Object.getOwnPropertySymbols?ReflectOwnKeys=function(v){return Object.getOwnPropertyNames(v).concat(Object.getOwnPropertySymbols(v))}:ReflectOwnKeys=function(v){return Object.getOwnPropertyNames(v)};function ProcessEmitWarning(b){console&&console.warn&&console.warn(b)}var NumberIsNaN=Number.isNaN||function(v){return v!==v};function EventEmitter(){EventEmitter.init.call(this)}events.exports=EventEmitter;events.exports.once=once;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=void 0;EventEmitter.prototype._eventsCount=0;EventEmitter.prototype._maxListeners=void 0;var defaultMaxListeners=10;function checkListener(b){if(typeof b!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof b)}Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:!0,get:function(){return defaultMaxListeners},set:function(b){if(typeof b!="number"||b<0||NumberIsNaN(b))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+b+".");defaultMaxListeners=b}});EventEmitter.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};EventEmitter.prototype.setMaxListeners=function(v){if(typeof v!="number"||v<0||NumberIsNaN(v))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+v+".");return this._maxListeners=v,this};function _getMaxListeners(b){return b._maxListeners===void 0?EventEmitter.defaultMaxListeners:b._maxListeners}EventEmitter.prototype.getMaxListeners=function(){return _getMaxListeners(this)};EventEmitter.prototype.emit=function(v){for(var w=[],_=1;_<arguments.length;_++)w.push(arguments[_]);var A=v==="error",E=this._events;if(E!==void 0)A=A&&E.error===void 0;else if(!A)return!1;if(A){var k;if(w.length>0&&(k=w[0]),k instanceof Error)throw k;var P=new Error("Unhandled error."+(k?" ("+k.message+")":""));throw P.context=k,P}var N=E[v];if(N===void 0)return!1;if(typeof N=="function")ReflectApply(N,this,w);else for(var q=N.length,B=arrayClone(N,q),_=0;_<q;++_)ReflectApply(B[_],this,w);return!0};function _addListener(b,v,w,_){var A,E,k;if(checkListener(w),E=b._events,E===void 0?(E=b._events=Object.create(null),b._eventsCount=0):(E.newListener!==void 0&&(b.emit("newListener",v,w.listener?w.listener:w),E=b._events),k=E[v]),k===void 0)k=E[v]=w,++b._eventsCount;else if(typeof k=="function"?k=E[v]=_?[w,k]:[k,w]:_?k.unshift(w):k.push(w),A=_getMaxListeners(b),A>0&&k.length>A&&!k.warned){k.warned=!0;var P=new Error("Possible EventEmitter memory leak detected. "+k.length+" "+String(v)+" listeners added. Use emitter.setMaxListeners() to increase limit");P.name="MaxListenersExceededWarning",P.emitter=b,P.type=v,P.count=k.length,ProcessEmitWarning(P)}return b}EventEmitter.prototype.addListener=function(v,w){return _addListener(this,v,w,!1)};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.prependListener=function(v,w){return _addListener(this,v,w,!0)};function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _onceWrap(b,v,w){var _={fired:!1,wrapFn:void 0,target:b,type:v,listener:w},A=onceWrapper.bind(_);return A.listener=w,_.wrapFn=A,A}EventEmitter.prototype.once=function(v,w){return checkListener(w),this.on(v,_onceWrap(this,v,w)),this};EventEmitter.prototype.prependOnceListener=function(v,w){return checkListener(w),this.prependListener(v,_onceWrap(this,v,w)),this};EventEmitter.prototype.removeListener=function(v,w){var _,A,E,k,P;if(checkListener(w),A=this._events,A===void 0)return this;if(_=A[v],_===void 0)return this;if(_===w||_.listener===w)--this._eventsCount===0?this._events=Object.create(null):(delete A[v],A.removeListener&&this.emit("removeListener",v,_.listener||w));else if(typeof _!="function"){for(E=-1,k=_.length-1;k>=0;k--)if(_[k]===w||_[k].listener===w){P=_[k].listener,E=k;break}if(E<0)return this;E===0?_.shift():spliceOne(_,E),_.length===1&&(A[v]=_[0]),A.removeListener!==void 0&&this.emit("removeListener",v,P||w)}return this};EventEmitter.prototype.off=EventEmitter.prototype.removeListener;EventEmitter.prototype.removeAllListeners=function(v){var w,_,A;if(_=this._events,_===void 0)return this;if(_.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):_[v]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete _[v]),this;if(arguments.length===0){var E=Object.keys(_),k;for(A=0;A<E.length;++A)k=E[A],k!=="removeListener"&&this.removeAllListeners(k);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(w=_[v],typeof w=="function")this.removeListener(v,w);else if(w!==void 0)for(A=w.length-1;A>=0;A--)this.removeListener(v,w[A]);return this};function _listeners(b,v,w){var _=b._events;if(_===void 0)return[];var A=_[v];return A===void 0?[]:typeof A=="function"?w?[A.listener||A]:[A]:w?unwrapListeners(A):arrayClone(A,A.length)}EventEmitter.prototype.listeners=function(v){return _listeners(this,v,!0)};EventEmitter.prototype.rawListeners=function(v){return _listeners(this,v,!1)};EventEmitter.listenerCount=function(b,v){return typeof b.listenerCount=="function"?b.listenerCount(v):listenerCount.call(b,v)};EventEmitter.prototype.listenerCount=listenerCount;function listenerCount(b){var v=this._events;if(v!==void 0){var w=v[b];if(typeof w=="function")return 1;if(w!==void 0)return w.length}return 0}EventEmitter.prototype.eventNames=function(){return this._eventsCount>0?ReflectOwnKeys(this._events):[]};function arrayClone(b,v){for(var w=new Array(v),_=0;_<v;++_)w[_]=b[_];return w}function spliceOne(b,v){for(;v+1<b.length;v++)b[v]=b[v+1];b.pop()}function unwrapListeners(b){for(var v=new Array(b.length),w=0;w<v.length;++w)v[w]=b[w].listener||b[w];return v}function once(b,v){return new Promise(function(w,_){function A(k){b.removeListener(v,E),_(k)}function E(){typeof b.removeListener=="function"&&b.removeListener("error",A),w([].slice.call(arguments))}eventTargetAgnosticAddListener(b,v,E,{once:!0}),v!=="error"&&addErrorHandlerIfEventEmitter(b,A,{once:!0})})}function addErrorHandlerIfEventEmitter(b,v,w){typeof b.on=="function"&&eventTargetAgnosticAddListener(b,"error",v,w)}function eventTargetAgnosticAddListener(b,v,w,_){if(typeof b.on=="function")_.once?b.once(v,w):b.on(v,w);else if(typeof b.addEventListener=="function")b.addEventListener(v,function A(E){_.once&&b.removeEventListener(v,A),w(E)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof b)}var eventsExports=events.exports,streamBrowser$1,hasRequiredStreamBrowser;function requireStreamBrowser(){return hasRequiredStreamBrowser||(hasRequiredStreamBrowser=1,streamBrowser$1=eventsExports.EventEmitter),streamBrowser$1}var util$3={},types$3={},shams$1=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var v={},w=Symbol("test"),_=Object(w);if(typeof w=="string"||Object.prototype.toString.call(w)!=="[object Symbol]"||Object.prototype.toString.call(_)!=="[object Symbol]")return!1;var A=42;v[w]=A;for(w in v)return!1;if(typeof Object.keys=="function"&&Object.keys(v).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(v).length!==0)return!1;var E=Object.getOwnPropertySymbols(v);if(E.length!==1||E[0]!==w||!Object.prototype.propertyIsEnumerable.call(v,w))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var k=Object.getOwnPropertyDescriptor(v,w);if(k.value!==A||k.enumerable!==!0)return!1}return!0},hasSymbols$2=shams$1,shams=function(){return hasSymbols$2()&&!!Symbol.toStringTag},esErrors=Error,_eval=EvalError,range=RangeError,ref=ReferenceError,syntax=SyntaxError,type=TypeError,uri$1=URIError,origSymbol=typeof Symbol<"u"&&Symbol,hasSymbolSham=shams$1,hasSymbols$1=function(){return typeof origSymbol!="function"||typeof Symbol!="function"||typeof origSymbol("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:hasSymbolSham()},test={__proto__:null,foo:{}},$Object=Object,hasProto$1=function(){return{__proto__:test}.foo===test.foo&&!(test instanceof $Object)},ERROR_MESSAGE="Function.prototype.bind called on incompatible ",toStr$3=Object.prototype.toString,max=Math.max,funcType="[object Function]",concatty=function(v,w){for(var _=[],A=0;A<v.length;A+=1)_[A]=v[A];for(var E=0;E<w.length;E+=1)_[E+v.length]=w[E];return _},slicy=function(v,w){for(var _=[],A=w,E=0;A<v.length;A+=1,E+=1)_[E]=v[A];return _},joiny=function(b,v){for(var w="",_=0;_<b.length;_+=1)w+=b[_],_+1<b.length&&(w+=v);return w},implementation$1=function(v){var w=this;if(typeof w!="function"||toStr$3.apply(w)!==funcType)throw new TypeError(ERROR_MESSAGE+w);for(var _=slicy(arguments,1),A,E=function(){if(this instanceof A){var B=w.apply(this,concatty(_,arguments));return Object(B)===B?B:this}return w.apply(v,concatty(_,arguments))},k=max(0,w.length-_.length),P=[],N=0;N<k;N++)P[N]="$"+N;if(A=Function("binder","return function ("+joiny(P,",")+"){ return binder.apply(this,arguments); }")(E),w.prototype){var q=function(){};q.prototype=w.prototype,A.prototype=new q,q.prototype=null}return A},implementation=implementation$1,functionBind=Function.prototype.bind||implementation,call=Function.prototype.call,$hasOwn=Object.prototype.hasOwnProperty,bind$1=functionBind,hasown=bind$1.call(call,$hasOwn),undefined$1,$Error=esErrors,$EvalError=_eval,$RangeError=range,$ReferenceError=ref,$SyntaxError$1=syntax,$TypeError$2=type,$URIError=uri$1,$Function=Function,getEvalledConstructor=function(b){try{return $Function('"use strict"; return ('+b+").constructor;")()}catch{}},$gOPD$1=Object.getOwnPropertyDescriptor;if($gOPD$1)try{$gOPD$1({},"")}catch{$gOPD$1=null}var throwTypeError=function(){throw new $TypeError$2},ThrowTypeError=$gOPD$1?function(){try{return arguments.callee,throwTypeError}catch{try{return $gOPD$1(arguments,"callee").get}catch{return throwTypeError}}}():throwTypeError,hasSymbols=hasSymbols$1(),hasProto=hasProto$1(),getProto$1=Object.getPrototypeOf||(hasProto?function(b){return b.__proto__}:null),needsEval={},TypedArray=typeof Uint8Array>"u"||!getProto$1?undefined$1:getProto$1(Uint8Array),INTRINSICS={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?undefined$1:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?undefined$1:ArrayBuffer,"%ArrayIteratorPrototype%":hasSymbols&&getProto$1?getProto$1([][Symbol.iterator]()):undefined$1,"%AsyncFromSyncIteratorPrototype%":undefined$1,"%AsyncFunction%":needsEval,"%AsyncGenerator%":needsEval,"%AsyncGeneratorFunction%":needsEval,"%AsyncIteratorPrototype%":needsEval,"%Atomics%":typeof Atomics>"u"?undefined$1:Atomics,"%BigInt%":typeof BigInt>"u"?undefined$1:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?undefined$1:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?undefined$1:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?undefined$1:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":$Error,"%eval%":eval,"%EvalError%":$EvalError,"%Float32Array%":typeof Float32Array>"u"?undefined$1:Float32Array,"%Float64Array%":typeof Float64Array>"u"?undefined$1:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?undefined$1:FinalizationRegistry,"%Function%":$Function,"%GeneratorFunction%":needsEval,"%Int8Array%":typeof Int8Array>"u"?undefined$1:Int8Array,"%Int16Array%":typeof Int16Array>"u"?undefined$1:Int16Array,"%Int32Array%":typeof Int32Array>"u"?undefined$1:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hasSymbols&&getProto$1?getProto$1(getProto$1([][Symbol.iterator]())):undefined$1,"%JSON%":typeof JSON=="object"?JSON:undefined$1,"%Map%":typeof Map>"u"?undefined$1:Map,"%MapIteratorPrototype%":typeof Map>"u"||!hasSymbols||!getProto$1?undefined$1:getProto$1(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?undefined$1:Promise,"%Proxy%":typeof Proxy>"u"?undefined$1:Proxy,"%RangeError%":$RangeError,"%ReferenceError%":$ReferenceError,"%Reflect%":typeof Reflect>"u"?undefined$1:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?undefined$1:Set,"%SetIteratorPrototype%":typeof Set>"u"||!hasSymbols||!getProto$1?undefined$1:getProto$1(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?undefined$1:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hasSymbols&&getProto$1?getProto$1(""[Symbol.iterator]()):undefined$1,"%Symbol%":hasSymbols?Symbol:undefined$1,"%SyntaxError%":$SyntaxError$1,"%ThrowTypeError%":ThrowTypeError,"%TypedArray%":TypedArray,"%TypeError%":$TypeError$2,"%Uint8Array%":typeof Uint8Array>"u"?undefined$1:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?undefined$1:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?undefined$1:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?undefined$1:Uint32Array,"%URIError%":$URIError,"%WeakMap%":typeof WeakMap>"u"?undefined$1:WeakMap,"%WeakRef%":typeof WeakRef>"u"?undefined$1:WeakRef,"%WeakSet%":typeof WeakSet>"u"?undefined$1:WeakSet};if(getProto$1)try{null.error}catch(b){var errorProto=getProto$1(getProto$1(b));INTRINSICS["%Error.prototype%"]=errorProto}var doEval=function b(v){var w;if(v==="%AsyncFunction%")w=getEvalledConstructor("async function () {}");else if(v==="%GeneratorFunction%")w=getEvalledConstructor("function* () {}");else if(v==="%AsyncGeneratorFunction%")w=getEvalledConstructor("async function* () {}");else if(v==="%AsyncGenerator%"){var _=b("%AsyncGeneratorFunction%");_&&(w=_.prototype)}else if(v==="%AsyncIteratorPrototype%"){var A=b("%AsyncGenerator%");A&&getProto$1&&(w=getProto$1(A.prototype))}return INTRINSICS[v]=w,w},LEGACY_ALIASES={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bind=functionBind,hasOwn=hasown,$concat=bind.call(Function.call,Array.prototype.concat),$spliceApply=bind.call(Function.apply,Array.prototype.splice),$replace=bind.call(Function.call,String.prototype.replace),$strSlice=bind.call(Function.call,String.prototype.slice),$exec=bind.call(Function.call,RegExp.prototype.exec),rePropName=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=function(v){var w=$strSlice(v,0,1),_=$strSlice(v,-1);if(w==="%"&&_!=="%")throw new $SyntaxError$1("invalid intrinsic syntax, expected closing `%`");if(_==="%"&&w!=="%")throw new $SyntaxError$1("invalid intrinsic syntax, expected opening `%`");var A=[];return $replace(v,rePropName,function(E,k,P,N){A[A.length]=P?$replace(N,reEscapeChar,"$1"):k||E}),A},getBaseIntrinsic=function(v,w){var _=v,A;if(hasOwn(LEGACY_ALIASES,_)&&(A=LEGACY_ALIASES[_],_="%"+A[0]+"%"),hasOwn(INTRINSICS,_)){var E=INTRINSICS[_];if(E===needsEval&&(E=doEval(_)),typeof E>"u"&&!w)throw new $TypeError$2("intrinsic "+v+" exists, but is not available. Please file an issue!");return{alias:A,name:_,value:E}}throw new $SyntaxError$1("intrinsic "+v+" does not exist!")},getIntrinsic=function(v,w){if(typeof v!="string"||v.length===0)throw new $TypeError$2("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof w!="boolean")throw new $TypeError$2('"allowMissing" argument must be a boolean');if($exec(/^%?[^%]*%?$/,v)===null)throw new $SyntaxError$1("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var _=stringToPath(v),A=_.length>0?_[0]:"",E=getBaseIntrinsic("%"+A+"%",w),k=E.name,P=E.value,N=!1,q=E.alias;q&&(A=q[0],$spliceApply(_,$concat([0,1],q)));for(var B=1,O=!0;B<_.length;B+=1){var I=_[B],D=$strSlice(I,0,1),V=$strSlice(I,-1);if((D==='"'||D==="'"||D==="`"||V==='"'||V==="'"||V==="`")&&D!==V)throw new $SyntaxError$1("property names with quotes must have matching quotes");if((I==="constructor"||!O)&&(N=!0),A+="."+I,k="%"+A+"%",hasOwn(INTRINSICS,k))P=INTRINSICS[k];else if(P!=null){if(!(I in P)){if(!w)throw new $TypeError$2("base intrinsic for "+v+" exists, but the property is not available.");return}if($gOPD$1&&B+1>=_.length){var ee=$gOPD$1(P,I);O=!!ee,O&&"get"in ee&&!("originalValue"in ee.get)?P=ee.get:P=P[I]}else O=hasOwn(P,I),P=P[I];O&&!N&&(INTRINSICS[k]=P)}}return P},callBind$2={exports:{}},esDefineProperty,hasRequiredEsDefineProperty;function requireEsDefineProperty(){if(hasRequiredEsDefineProperty)return esDefineProperty;hasRequiredEsDefineProperty=1;var b=getIntrinsic,v=b("%Object.defineProperty%",!0)||!1;if(v)try{v({},"a",{value:1})}catch{v=!1}return esDefineProperty=v,esDefineProperty}var GetIntrinsic$2=getIntrinsic,$gOPD=GetIntrinsic$2("%Object.getOwnPropertyDescriptor%",!0);if($gOPD)try{$gOPD([],"length")}catch{$gOPD=null}var gopd$1=$gOPD,$defineProperty$1=requireEsDefineProperty(),$SyntaxError=syntax,$TypeError$1=type,gopd=gopd$1,defineDataProperty=function(v,w,_){if(!v||typeof v!="object"&&typeof v!="function")throw new $TypeError$1("`obj` must be an object or a function`");if(typeof w!="string"&&typeof w!="symbol")throw new $TypeError$1("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new $TypeError$1("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new $TypeError$1("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new $TypeError$1("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new $TypeError$1("`loose`, if provided, must be a boolean");var A=arguments.length>3?arguments[3]:null,E=arguments.length>4?arguments[4]:null,k=arguments.length>5?arguments[5]:null,P=arguments.length>6?arguments[6]:!1,N=!!gopd&&gopd(v,w);if($defineProperty$1)$defineProperty$1(v,w,{configurable:k===null&&N?N.configurable:!k,enumerable:A===null&&N?N.enumerable:!A,value:_,writable:E===null&&N?N.writable:!E});else if(P||!A&&!E&&!k)v[w]=_;else throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},$defineProperty=requireEsDefineProperty(),hasPropertyDescriptors=function(){return!!$defineProperty};hasPropertyDescriptors.hasArrayLengthDefineBug=function(){if(!$defineProperty)return null;try{return $defineProperty([],"length",{value:1}).length!==1}catch{return!0}};var hasPropertyDescriptors_1=hasPropertyDescriptors,GetIntrinsic$1=getIntrinsic,define=defineDataProperty,hasDescriptors=hasPropertyDescriptors_1(),gOPD$1=gopd$1,$TypeError=type,$floor=GetIntrinsic$1("%Math.floor%"),setFunctionLength=function(v,w){if(typeof v!="function")throw new $TypeError("`fn` is not a function");if(typeof w!="number"||w<0||w>4294967295||$floor(w)!==w)throw new $TypeError("`length` must be a positive 32-bit integer");var _=arguments.length>2&&!!arguments[2],A=!0,E=!0;if("length"in v&&gOPD$1){var k=gOPD$1(v,"length");k&&!k.configurable&&(A=!1),k&&!k.writable&&(E=!1)}return(A||E||!_)&&(hasDescriptors?define(v,"length",w,!0,!0):define(v,"length",w)),v};(function(b){var v=functionBind,w=getIntrinsic,_=setFunctionLength,A=type,E=w("%Function.prototype.apply%"),k=w("%Function.prototype.call%"),P=w("%Reflect.apply%",!0)||v.call(k,E),N=requireEsDefineProperty(),q=w("%Math.max%");b.exports=function(I){if(typeof I!="function")throw new A("a function is required");var D=P(v,k,arguments);return _(D,1+q(0,I.length-(arguments.length-1)),!0)};var B=function(){return P(v,E,arguments)};N?N(b.exports,"apply",{value:B}):b.exports.apply=B})(callBind$2);var callBindExports=callBind$2.exports,GetIntrinsic=getIntrinsic,callBind$1=callBindExports,$indexOf$1=callBind$1(GetIntrinsic("String.prototype.indexOf")),callBound$2=function(v,w){var _=GetIntrinsic(v,!!w);return typeof _=="function"&&$indexOf$1(v,".prototype.")>-1?callBind$1(_):_},hasToStringTag$3=shams(),callBound$1=callBound$2,$toString$1=callBound$1("Object.prototype.toString"),isStandardArguments=function(v){return hasToStringTag$3&&v&&typeof v=="object"&&Symbol.toStringTag in v?!1:$toString$1(v)==="[object Arguments]"},isLegacyArguments=function(v){return isStandardArguments(v)?!0:v!==null&&typeof v=="object"&&typeof v.length=="number"&&v.length>=0&&$toString$1(v)!=="[object Array]"&&$toString$1(v.callee)==="[object Function]"},supportsStandardArguments=function(){return isStandardArguments(arguments)}();isStandardArguments.isLegacyArguments=isLegacyArguments;var isArguments=supportsStandardArguments?isStandardArguments:isLegacyArguments,toStr$2=Object.prototype.toString,fnToStr$1=Function.prototype.toString,isFnRegex=/^\s*(?:function)?\*/,hasToStringTag$2=shams(),getProto=Object.getPrototypeOf,getGeneratorFunc=function(){if(!hasToStringTag$2)return!1;try{return Function("return function*() {}")()}catch{}},GeneratorFunction,isGeneratorFunction=function(v){if(typeof v!="function")return!1;if(isFnRegex.test(fnToStr$1.call(v)))return!0;if(!hasToStringTag$2){var w=toStr$2.call(v);return w==="[object GeneratorFunction]"}if(!getProto)return!1;if(typeof GeneratorFunction>"u"){var _=getGeneratorFunc();GeneratorFunction=_?getProto(_):!1}return getProto(v)===GeneratorFunction},fnToStr=Function.prototype.toString,reflectApply=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,badArrayLike,isCallableMarker;if(typeof reflectApply=="function"&&typeof Object.defineProperty=="function")try{badArrayLike=Object.defineProperty({},"length",{get:function(){throw isCallableMarker}}),isCallableMarker={},reflectApply(function(){throw 42},null,badArrayLike)}catch(b){b!==isCallableMarker&&(reflectApply=null)}else reflectApply=null;var constructorRegex=/^\s*class\b/,isES6ClassFn=function(v){try{var w=fnToStr.call(v);return constructorRegex.test(w)}catch{return!1}},tryFunctionObject=function(v){try{return isES6ClassFn(v)?!1:(fnToStr.call(v),!0)}catch{return!1}},toStr$1=Object.prototype.toString,objectClass="[object Object]",fnClass="[object Function]",genClass="[object GeneratorFunction]",ddaClass="[object HTMLAllCollection]",ddaClass2="[object HTML document.all class]",ddaClass3="[object HTMLCollection]",hasToStringTag$1=typeof Symbol=="function"&&!!Symbol.toStringTag,isIE68=!(0 in[,]),isDDA=function(){return!1};if(typeof document=="object"){var all=document.all;toStr$1.call(all)===toStr$1.call(document.all)&&(isDDA=function(v){if((isIE68||!v)&&(typeof v>"u"||typeof v=="object"))try{var w=toStr$1.call(v);return(w===ddaClass||w===ddaClass2||w===ddaClass3||w===objectClass)&&v("")==null}catch{}return!1})}var isCallable$1=reflectApply?function(v){if(isDDA(v))return!0;if(!v||typeof v!="function"&&typeof v!="object")return!1;try{reflectApply(v,null,badArrayLike)}catch(w){if(w!==isCallableMarker)return!1}return!isES6ClassFn(v)&&tryFunctionObject(v)}:function(v){if(isDDA(v))return!0;if(!v||typeof v!="function"&&typeof v!="object")return!1;if(hasToStringTag$1)return tryFunctionObject(v);if(isES6ClassFn(v))return!1;var w=toStr$1.call(v);return w!==fnClass&&w!==genClass&&!/^\[object HTML/.test(w)?!1:tryFunctionObject(v)},isCallable=isCallable$1,toStr=Object.prototype.toString,hasOwnProperty=Object.prototype.hasOwnProperty,forEachArray=function(v,w,_){for(var A=0,E=v.length;A<E;A++)hasOwnProperty.call(v,A)&&(_==null?w(v[A],A,v):w.call(_,v[A],A,v))},forEachString=function(v,w,_){for(var A=0,E=v.length;A<E;A++)_==null?w(v.charAt(A),A,v):w.call(_,v.charAt(A),A,v)},forEachObject=function(v,w,_){for(var A in v)hasOwnProperty.call(v,A)&&(_==null?w(v[A],A,v):w.call(_,v[A],A,v))},forEach$1=function(v,w,_){if(!isCallable(w))throw new TypeError("iterator must be a function");var A;arguments.length>=3&&(A=_),toStr.call(v)==="[object Array]"?forEachArray(v,w,A):typeof v=="string"?forEachString(v,w,A):forEachObject(v,w,A)},forEach_1=forEach$1,possibleTypedArrayNames=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],possibleNames=possibleTypedArrayNames,g$1=typeof globalThis>"u"?commonjsGlobal:globalThis,availableTypedArrays$1=function(){for(var v=[],w=0;w<possibleNames.length;w++)typeof g$1[possibleNames[w]]=="function"&&(v[v.length]=possibleNames[w]);return v},forEach=forEach_1,availableTypedArrays=availableTypedArrays$1,callBind=callBindExports,callBound=callBound$2,gOPD=gopd$1,$toString=callBound("Object.prototype.toString"),hasToStringTag=shams(),g=typeof globalThis>"u"?commonjsGlobal:globalThis,typedArrays=availableTypedArrays(),$slice=callBound("String.prototype.slice"),getPrototypeOf=Object.getPrototypeOf,$indexOf=callBound("Array.prototype.indexOf",!0)||function(v,w){for(var _=0;_<v.length;_+=1)if(v[_]===w)return _;return-1},cache={__proto__:null};hasToStringTag&&gOPD&&getPrototypeOf?forEach(typedArrays,function(b){var v=new g[b];if(Symbol.toStringTag in v){var w=getPrototypeOf(v),_=gOPD(w,Symbol.toStringTag);if(!_){var A=getPrototypeOf(w);_=gOPD(A,Symbol.toStringTag)}cache["$"+b]=callBind(_.get)}}):forEach(typedArrays,function(b){var v=new g[b],w=v.slice||v.set;w&&(cache["$"+b]=callBind(w))});var tryTypedArrays=function(v){var w=!1;return forEach(cache,function(_,A){if(!w)try{"$"+_(v)===A&&(w=$slice(A,1))}catch{}}),w},trySlices=function(v){var w=!1;return forEach(cache,function(_,A){if(!w)try{_(v),w=$slice(A,1)}catch{}}),w},whichTypedArray$1=function(v){if(!v||typeof v!="object")return!1;if(!hasToStringTag){var w=$slice($toString(v),8,-1);return $indexOf(typedArrays,w)>-1?w:w!=="Object"?!1:trySlices(v)}return gOPD?tryTypedArrays(v):null},whichTypedArray=whichTypedArray$1,isTypedArray=function(v){return!!whichTypedArray(v)};(function(b){var v=isArguments,w=isGeneratorFunction,_=whichTypedArray$1,A=isTypedArray;function E(Be){return Be.call.bind(Be)}var k=typeof BigInt<"u",P=typeof Symbol<"u",N=E(Object.prototype.toString),q=E(Number.prototype.valueOf),B=E(String.prototype.valueOf),O=E(Boolean.prototype.valueOf);if(k)var I=E(BigInt.prototype.valueOf);if(P)var D=E(Symbol.prototype.valueOf);function V(Be,De){if(typeof Be!="object")return!1;try{return De(Be),!0}catch{return!1}}b.isArgumentsObject=v,b.isGeneratorFunction=w,b.isTypedArray=A;function ee(Be){return typeof Promise<"u"&&Be instanceof Promise||Be!==null&&typeof Be=="object"&&typeof Be.then=="function"&&typeof Be.catch=="function"}b.isPromise=ee;function J(Be){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(Be):A(Be)||ue(Be)}b.isArrayBufferView=J;function te(Be){return _(Be)==="Uint8Array"}b.isUint8Array=te;function se(Be){return _(Be)==="Uint8ClampedArray"}b.isUint8ClampedArray=se;function ce(Be){return _(Be)==="Uint16Array"}b.isUint16Array=ce;function ae(Be){return _(Be)==="Uint32Array"}b.isUint32Array=ae;function he(Be){return _(Be)==="Int8Array"}b.isInt8Array=he;function oe(Be){return _(Be)==="Int16Array"}b.isInt16Array=oe;function de(Be){return _(Be)==="Int32Array"}b.isInt32Array=de;function le(Be){return _(Be)==="Float32Array"}b.isFloat32Array=le;function be(Be){return _(Be)==="Float64Array"}b.isFloat64Array=be;function pe(Be){return _(Be)==="BigInt64Array"}b.isBigInt64Array=pe;function fe(Be){return _(Be)==="BigUint64Array"}b.isBigUint64Array=fe;function Z(Be){return N(Be)==="[object Map]"}Z.working=typeof Map<"u"&&Z(new Map);function U(Be){return typeof Map>"u"?!1:Z.working?Z(Be):Be instanceof Map}b.isMap=U;function S(Be){return N(Be)==="[object Set]"}S.working=typeof Set<"u"&&S(new Set);function C(Be){return typeof Set>"u"?!1:S.working?S(Be):Be instanceof Set}b.isSet=C;function F(Be){return N(Be)==="[object WeakMap]"}F.working=typeof WeakMap<"u"&&F(new WeakMap);function X(Be){return typeof WeakMap>"u"?!1:F.working?F(Be):Be instanceof WeakMap}b.isWeakMap=X;function re(Be){return N(Be)==="[object WeakSet]"}re.working=typeof WeakSet<"u"&&re(new WeakSet);function ie(Be){return re(Be)}b.isWeakSet=ie;function Q(Be){return N(Be)==="[object ArrayBuffer]"}Q.working=typeof ArrayBuffer<"u"&&Q(new ArrayBuffer);function ne(Be){return typeof ArrayBuffer>"u"?!1:Q.working?Q(Be):Be instanceof ArrayBuffer}b.isArrayBuffer=ne;function L(Be){return N(Be)==="[object DataView]"}L.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&L(new DataView(new ArrayBuffer(1),0,1));function ue(Be){return typeof DataView>"u"?!1:L.working?L(Be):Be instanceof DataView}b.isDataView=ue;var Ae=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function Re(Be){return N(Be)==="[object SharedArrayBuffer]"}function Pe(Be){return typeof Ae>"u"?!1:(typeof Re.working>"u"&&(Re.working=Re(new Ae)),Re.working?Re(Be):Be instanceof Ae)}b.isSharedArrayBuffer=Pe;function xe(Be){return N(Be)==="[object AsyncFunction]"}b.isAsyncFunction=xe;function ge(Be){return N(Be)==="[object Map Iterator]"}b.isMapIterator=ge;function _e(Be){return N(Be)==="[object Set Iterator]"}b.isSetIterator=_e;function ke(Be){return N(Be)==="[object Generator]"}b.isGeneratorObject=ke;function Ee(Be){return N(Be)==="[object WebAssembly.Module]"}b.isWebAssemblyCompiledModule=Ee;function Se(Be){return V(Be,q)}b.isNumberObject=Se;function Oe(Be){return V(Be,B)}b.isStringObject=Oe;function Ne(Be){return V(Be,O)}b.isBooleanObject=Ne;function ve(Be){return k&&V(Be,I)}b.isBigIntObject=ve;function Ce(Be){return P&&V(Be,D)}b.isSymbolObject=Ce;function Te(Be){return Se(Be)||Oe(Be)||Ne(Be)||ve(Be)||Ce(Be)}b.isBoxedPrimitive=Te;function Le(Be){return typeof Uint8Array<"u"&&(ne(Be)||Pe(Be))}b.isAnyArrayBuffer=Le,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(Be){Object.defineProperty(b,Be,{enumerable:!1,value:function(){throw new Error(Be+" is not supported in userland")}})})})(types$3);var isBufferBrowser=function(v){return v&&typeof v=="object"&&typeof v.copy=="function"&&typeof v.fill=="function"&&typeof v.readUInt8=="function"};(function(b){var v=Object.getOwnPropertyDescriptors||function(ue){for(var Ae=Object.keys(ue),Re={},Pe=0;Pe<Ae.length;Pe++)Re[Ae[Pe]]=Object.getOwnPropertyDescriptor(ue,Ae[Pe]);return Re},w=/%[sdj%]/g;b.format=function(L){if(!he(L)){for(var ue=[],Ae=0;Ae<arguments.length;Ae++)ue.push(k(arguments[Ae]));return ue.join(" ")}for(var Ae=1,Re=arguments,Pe=Re.length,xe=String(L).replace(w,function(_e){if(_e==="%%")return"%";if(Ae>=Pe)return _e;switch(_e){case"%s":return String(Re[Ae++]);case"%d":return Number(Re[Ae++]);case"%j":try{return JSON.stringify(Re[Ae++])}catch{return"[Circular]"}default:return _e}}),ge=Re[Ae];Ae<Pe;ge=Re[++Ae])se(ge)||!be(ge)?xe+=" "+ge:xe+=" "+k(ge);return xe},b.deprecate=function(L,ue){if(typeof process$1<"u"&&process$1.noDeprecation===!0)return L;if(typeof process$1>"u")return function(){return b.deprecate(L,ue).apply(this,arguments)};var Ae=!1;function Re(){if(!Ae){if(process$1.throwDeprecation)throw new Error(ue);process$1.traceDeprecation?console.trace(ue):console.error(ue),Ae=!0}return L.apply(this,arguments)}return Re};var _={},A=/^$/;if(process$1.env.NODE_DEBUG){var E=process$1.env.NODE_DEBUG;E=E.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),A=new RegExp("^"+E+"$","i")}b.debuglog=function(L){if(L=L.toUpperCase(),!_[L])if(A.test(L)){var ue=process$1.pid;_[L]=function(){var Ae=b.format.apply(b,arguments);console.error("%s %d: %s",L,ue,Ae)}}else _[L]=function(){};return _[L]};function k(L,ue){var Ae={seen:[],stylize:N};return arguments.length>=3&&(Ae.depth=arguments[2]),arguments.length>=4&&(Ae.colors=arguments[3]),te(ue)?Ae.showHidden=ue:ue&&b._extend(Ae,ue),de(Ae.showHidden)&&(Ae.showHidden=!1),de(Ae.depth)&&(Ae.depth=2),de(Ae.colors)&&(Ae.colors=!1),de(Ae.customInspect)&&(Ae.customInspect=!0),Ae.colors&&(Ae.stylize=P),B(Ae,L,Ae.depth)}b.inspect=k,k.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]},k.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function P(L,ue){var Ae=k.styles[ue];return Ae?"\x1B["+k.colors[Ae][0]+"m"+L+"\x1B["+k.colors[Ae][1]+"m":L}function N(L,ue){return L}function q(L){var ue={};return L.forEach(function(Ae,Re){ue[Ae]=!0}),ue}function B(L,ue,Ae){if(L.customInspect&&ue&&Z(ue.inspect)&&ue.inspect!==b.inspect&&!(ue.constructor&&ue.constructor.prototype===ue)){var Re=ue.inspect(Ae,L);return he(Re)||(Re=B(L,Re,Ae)),Re}var Pe=O(L,ue);if(Pe)return Pe;var xe=Object.keys(ue),ge=q(xe);if(L.showHidden&&(xe=Object.getOwnPropertyNames(ue)),fe(ue)&&(xe.indexOf("message")>=0||xe.indexOf("description")>=0))return I(ue);if(xe.length===0){if(Z(ue)){var _e=ue.name?": "+ue.name:"";return L.stylize("[Function"+_e+"]","special")}if(le(ue))return L.stylize(RegExp.prototype.toString.call(ue),"regexp");if(pe(ue))return L.stylize(Date.prototype.toString.call(ue),"date");if(fe(ue))return I(ue)}var ke="",Ee=!1,Se=["{","}"];if(J(ue)&&(Ee=!0,Se=["[","]"]),Z(ue)){var Oe=ue.name?": "+ue.name:"";ke=" [Function"+Oe+"]"}if(le(ue)&&(ke=" "+RegExp.prototype.toString.call(ue)),pe(ue)&&(ke=" "+Date.prototype.toUTCString.call(ue)),fe(ue)&&(ke=" "+I(ue)),xe.length===0&&(!Ee||ue.length==0))return Se[0]+ke+Se[1];if(Ae<0)return le(ue)?L.stylize(RegExp.prototype.toString.call(ue),"regexp"):L.stylize("[Object]","special");L.seen.push(ue);var Ne;return Ee?Ne=D(L,ue,Ae,ge,xe):Ne=xe.map(function(ve){return V(L,ue,Ae,ge,ve,Ee)}),L.seen.pop(),ee(Ne,ke,Se)}function O(L,ue){if(de(ue))return L.stylize("undefined","undefined");if(he(ue)){var Ae="'"+JSON.stringify(ue).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return L.stylize(Ae,"string")}if(ae(ue))return L.stylize(""+ue,"number");if(te(ue))return L.stylize(""+ue,"boolean");if(se(ue))return L.stylize("null","null")}function I(L){return"["+Error.prototype.toString.call(L)+"]"}function D(L,ue,Ae,Re,Pe){for(var xe=[],ge=0,_e=ue.length;ge<_e;++ge)re(ue,String(ge))?xe.push(V(L,ue,Ae,Re,String(ge),!0)):xe.push("");return Pe.forEach(function(ke){ke.match(/^\d+$/)||xe.push(V(L,ue,Ae,Re,ke,!0))}),xe}function V(L,ue,Ae,Re,Pe,xe){var ge,_e,ke;if(ke=Object.getOwnPropertyDescriptor(ue,Pe)||{value:ue[Pe]},ke.get?ke.set?_e=L.stylize("[Getter/Setter]","special"):_e=L.stylize("[Getter]","special"):ke.set&&(_e=L.stylize("[Setter]","special")),re(Re,Pe)||(ge="["+Pe+"]"),_e||(L.seen.indexOf(ke.value)<0?(se(Ae)?_e=B(L,ke.value,null):_e=B(L,ke.value,Ae-1),_e.indexOf(`
768
- `)>-1&&(xe?_e=_e.split(`
769
- `).map(function(Ee){return" "+Ee}).join(`
770
- `).slice(2):_e=`
771
- `+_e.split(`
772
- `).map(function(Ee){return" "+Ee}).join(`
773
- `))):_e=L.stylize("[Circular]","special")),de(ge)){if(xe&&Pe.match(/^\d+$/))return _e;ge=JSON.stringify(""+Pe),ge.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(ge=ge.slice(1,-1),ge=L.stylize(ge,"name")):(ge=ge.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),ge=L.stylize(ge,"string"))}return ge+": "+_e}function ee(L,ue,Ae){var Re=L.reduce(function(Pe,xe){return xe.indexOf(`
774
- `)>=0,Pe+xe.replace(/\u001b\[\d\d?m/g,"").length+1},0);return Re>60?Ae[0]+(ue===""?"":ue+`
775
- `)+" "+L.join(`,
776
- `)+" "+Ae[1]:Ae[0]+ue+" "+L.join(", ")+" "+Ae[1]}b.types=types$3;function J(L){return Array.isArray(L)}b.isArray=J;function te(L){return typeof L=="boolean"}b.isBoolean=te;function se(L){return L===null}b.isNull=se;function ce(L){return L==null}b.isNullOrUndefined=ce;function ae(L){return typeof L=="number"}b.isNumber=ae;function he(L){return typeof L=="string"}b.isString=he;function oe(L){return typeof L=="symbol"}b.isSymbol=oe;function de(L){return L===void 0}b.isUndefined=de;function le(L){return be(L)&&S(L)==="[object RegExp]"}b.isRegExp=le,b.types.isRegExp=le;function be(L){return typeof L=="object"&&L!==null}b.isObject=be;function pe(L){return be(L)&&S(L)==="[object Date]"}b.isDate=pe,b.types.isDate=pe;function fe(L){return be(L)&&(S(L)==="[object Error]"||L instanceof Error)}b.isError=fe,b.types.isNativeError=fe;function Z(L){return typeof L=="function"}b.isFunction=Z;function U(L){return L===null||typeof L=="boolean"||typeof L=="number"||typeof L=="string"||typeof L=="symbol"||typeof L>"u"}b.isPrimitive=U,b.isBuffer=isBufferBrowser;function S(L){return Object.prototype.toString.call(L)}function C(L){return L<10?"0"+L.toString(10):L.toString(10)}var F=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function X(){var L=new Date,ue=[C(L.getHours()),C(L.getMinutes()),C(L.getSeconds())].join(":");return[L.getDate(),F[L.getMonth()],ue].join(" ")}b.log=function(){console.log("%s - %s",X(),b.format.apply(b,arguments))},b.inherits=inherits_browserExports,b._extend=function(L,ue){if(!ue||!be(ue))return L;for(var Ae=Object.keys(ue),Re=Ae.length;Re--;)L[Ae[Re]]=ue[Ae[Re]];return L};function re(L,ue){return Object.prototype.hasOwnProperty.call(L,ue)}var ie=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;b.promisify=function(ue){if(typeof ue!="function")throw new TypeError('The "original" argument must be of type Function');if(ie&&ue[ie]){var Ae=ue[ie];if(typeof Ae!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(Ae,ie,{value:Ae,enumerable:!1,writable:!1,configurable:!0}),Ae}function Ae(){for(var Re,Pe,xe=new Promise(function(ke,Ee){Re=ke,Pe=Ee}),ge=[],_e=0;_e<arguments.length;_e++)ge.push(arguments[_e]);ge.push(function(ke,Ee){ke?Pe(ke):Re(Ee)});try{ue.apply(this,ge)}catch(ke){Pe(ke)}return xe}return Object.setPrototypeOf(Ae,Object.getPrototypeOf(ue)),ie&&Object.defineProperty(Ae,ie,{value:Ae,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(Ae,v(ue))},b.promisify.custom=ie;function Q(L,ue){if(!L){var Ae=new Error("Promise was rejected with a falsy value");Ae.reason=L,L=Ae}return ue(L)}function ne(L){if(typeof L!="function")throw new TypeError('The "original" argument must be of type Function');function ue(){for(var Ae=[],Re=0;Re<arguments.length;Re++)Ae.push(arguments[Re]);var Pe=Ae.pop();if(typeof Pe!="function")throw new TypeError("The last argument must be of type Function");var xe=this,ge=function(){return Pe.apply(xe,arguments)};L.apply(this,Ae).then(function(_e){process$1.nextTick(ge.bind(null,null,_e))},function(_e){process$1.nextTick(Q.bind(null,_e,ge))})}return Object.setPrototypeOf(ue,Object.getPrototypeOf(L)),Object.defineProperties(ue,v(L)),ue}b.callbackify=ne})(util$3);var buffer_list,hasRequiredBuffer_list;function requireBuffer_list(){if(hasRequiredBuffer_list)return buffer_list;hasRequiredBuffer_list=1;function b(V,ee){var J=Object.keys(V);if(Object.getOwnPropertySymbols){var te=Object.getOwnPropertySymbols(V);ee&&(te=te.filter(function(se){return Object.getOwnPropertyDescriptor(V,se).enumerable})),J.push.apply(J,te)}return J}function v(V){for(var ee=1;ee<arguments.length;ee++){var J=arguments[ee]!=null?arguments[ee]:{};ee%2?b(Object(J),!0).forEach(function(te){w(V,te,J[te])}):Object.getOwnPropertyDescriptors?Object.defineProperties(V,Object.getOwnPropertyDescriptors(J)):b(Object(J)).forEach(function(te){Object.defineProperty(V,te,Object.getOwnPropertyDescriptor(J,te))})}return V}function w(V,ee,J){return ee=k(ee),ee in V?Object.defineProperty(V,ee,{value:J,enumerable:!0,configurable:!0,writable:!0}):V[ee]=J,V}function _(V,ee){if(!(V instanceof ee))throw new TypeError("Cannot call a class as a function")}function A(V,ee){for(var J=0;J<ee.length;J++){var te=ee[J];te.enumerable=te.enumerable||!1,te.configurable=!0,"value"in te&&(te.writable=!0),Object.defineProperty(V,k(te.key),te)}}function E(V,ee,J){return ee&&A(V.prototype,ee),Object.defineProperty(V,"prototype",{writable:!1}),V}function k(V){var ee=P(V,"string");return typeof ee=="symbol"?ee:String(ee)}function P(V,ee){if(typeof V!="object"||V===null)return V;var J=V[Symbol.toPrimitive];if(J!==void 0){var te=J.call(V,ee||"default");if(typeof te!="object")return te;throw new TypeError("@@toPrimitive must return a primitive value.")}return(ee==="string"?String:Number)(V)}var N=require$$1$2,q=N.Buffer,B=util$3,O=B.inspect,I=O&&O.custom||"inspect";function D(V,ee,J){q.prototype.copy.call(V,ee,J)}return buffer_list=function(){function V(){_(this,V),this.head=null,this.tail=null,this.length=0}return E(V,[{key:"push",value:function(J){var te={data:J,next:null};this.length>0?this.tail.next=te:this.head=te,this.tail=te,++this.length}},{key:"unshift",value:function(J){var te={data:J,next:this.head};this.length===0&&(this.tail=te),this.head=te,++this.length}},{key:"shift",value:function(){if(this.length!==0){var J=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,J}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(J){if(this.length===0)return"";for(var te=this.head,se=""+te.data;te=te.next;)se+=J+te.data;return se}},{key:"concat",value:function(J){if(this.length===0)return q.alloc(0);for(var te=q.allocUnsafe(J>>>0),se=this.head,ce=0;se;)D(se.data,te,ce),ce+=se.data.length,se=se.next;return te}},{key:"consume",value:function(J,te){var se;return J<this.head.data.length?(se=this.head.data.slice(0,J),this.head.data=this.head.data.slice(J)):J===this.head.data.length?se=this.shift():se=te?this._getString(J):this._getBuffer(J),se}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(J){var te=this.head,se=1,ce=te.data;for(J-=ce.length;te=te.next;){var ae=te.data,he=J>ae.length?ae.length:J;if(he===ae.length?ce+=ae:ce+=ae.slice(0,J),J-=he,J===0){he===ae.length?(++se,te.next?this.head=te.next:this.head=this.tail=null):(this.head=te,te.data=ae.slice(he));break}++se}return this.length-=se,ce}},{key:"_getBuffer",value:function(J){var te=q.allocUnsafe(J),se=this.head,ce=1;for(se.data.copy(te),J-=se.data.length;se=se.next;){var ae=se.data,he=J>ae.length?ae.length:J;if(ae.copy(te,te.length-J,0,he),J-=he,J===0){he===ae.length?(++ce,se.next?this.head=se.next:this.head=this.tail=null):(this.head=se,se.data=ae.slice(he));break}++ce}return this.length-=ce,te}},{key:I,value:function(J,te){return O(this,v(v({},te),{},{depth:0,customInspect:!1}))}}]),V}(),buffer_list}var destroy_1$1,hasRequiredDestroy;function requireDestroy(){if(hasRequiredDestroy)return destroy_1$1;hasRequiredDestroy=1;function b(k,P){var N=this,q=this._readableState&&this._readableState.destroyed,B=this._writableState&&this._writableState.destroyed;return q||B?(P?P(k):k&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process$1.nextTick(A,this,k)):process$1.nextTick(A,this,k)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(k||null,function(O){!P&&O?N._writableState?N._writableState.errorEmitted?process$1.nextTick(w,N):(N._writableState.errorEmitted=!0,process$1.nextTick(v,N,O)):process$1.nextTick(v,N,O):P?(process$1.nextTick(w,N),P(O)):process$1.nextTick(w,N)}),this)}function v(k,P){A(k,P),w(k)}function w(k){k._writableState&&!k._writableState.emitClose||k._readableState&&!k._readableState.emitClose||k.emit("close")}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)}function A(k,P){k.emit("error",P)}function E(k,P){var N=k._readableState,q=k._writableState;N&&N.autoDestroy||q&&q.autoDestroy?k.destroy(P):k.emit("error",P)}return destroy_1$1={destroy:b,undestroy:_,errorOrDestroy:E},destroy_1$1}var errorsBrowser={},hasRequiredErrorsBrowser;function requireErrorsBrowser(){if(hasRequiredErrorsBrowser)return errorsBrowser;hasRequiredErrorsBrowser=1;function b(P,N){P.prototype=Object.create(N.prototype),P.prototype.constructor=P,P.__proto__=N}var v={};function w(P,N,q){q||(q=Error);function B(I,D,V){return typeof N=="string"?N:N(I,D,V)}var O=function(I){b(D,I);function D(V,ee,J){return I.call(this,B(V,ee,J))||this}return D}(q);O.prototype.name=q.name,O.prototype.code=P,v[P]=O}function _(P,N){if(Array.isArray(P)){var q=P.length;return P=P.map(function(B){return String(B)}),q>2?"one of ".concat(N," ").concat(P.slice(0,q-1).join(", "),", or ")+P[q-1]:q===2?"one of ".concat(N," ").concat(P[0]," or ").concat(P[1]):"of ".concat(N," ").concat(P[0])}else return"of ".concat(N," ").concat(String(P))}function A(P,N,q){return P.substr(0,N.length)===N}function E(P,N,q){return(q===void 0||q>P.length)&&(q=P.length),P.substring(q-N.length,q)===N}function k(P,N,q){return typeof q!="number"&&(q=0),q+N.length>P.length?!1:P.indexOf(N,q)!==-1}return w("ERR_INVALID_OPT_VALUE",function(P,N){return'The value "'+N+'" is invalid for option "'+P+'"'},TypeError),w("ERR_INVALID_ARG_TYPE",function(P,N,q){var B;typeof N=="string"&&A(N,"not ")?(B="must not be",N=N.replace(/^not /,"")):B="must be";var O;if(E(P," argument"))O="The ".concat(P," ").concat(B," ").concat(_(N,"type"));else{var I=k(P,".")?"property":"argument";O='The "'.concat(P,'" ').concat(I," ").concat(B," ").concat(_(N,"type"))}return O+=". Received type ".concat(typeof q),O},TypeError),w("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),w("ERR_METHOD_NOT_IMPLEMENTED",function(P){return"The "+P+" method is not implemented"}),w("ERR_STREAM_PREMATURE_CLOSE","Premature close"),w("ERR_STREAM_DESTROYED",function(P){return"Cannot call "+P+" after a stream was destroyed"}),w("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),w("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),w("ERR_STREAM_WRITE_AFTER_END","write after end"),w("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),w("ERR_UNKNOWN_ENCODING",function(P){return"Unknown encoding: "+P},TypeError),w("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),errorsBrowser.codes=v,errorsBrowser}var state,hasRequiredState;function requireState(){if(hasRequiredState)return state;hasRequiredState=1;var b=requireErrorsBrowser().codes.ERR_INVALID_OPT_VALUE;function v(_,A,E){return _.highWaterMark!=null?_.highWaterMark:A?_[E]:null}function w(_,A,E,k){var P=v(A,k,E);if(P!=null){if(!(isFinite(P)&&Math.floor(P)===P)||P<0){var N=k?E:"highWaterMark";throw new b(N,P)}return Math.floor(P)}return _.objectMode?16:16*1024}return state={getHighWaterMark:w},state}var browser$a=deprecate;function deprecate(b,v){if(config("noDeprecation"))return b;var w=!1;function _(){if(!w){if(config("throwDeprecation"))throw new Error(v);config("traceDeprecation")?console.trace(v):console.warn(v),w=!0}return b.apply(this,arguments)}return _}function config(b){try{if(!commonjsGlobal.localStorage)return!1}catch{return!1}var v=commonjsGlobal.localStorage[b];return v==null?!1:String(v).toLowerCase()==="true"}var _stream_writable$1,hasRequired_stream_writable$1;function require_stream_writable$1(){if(hasRequired_stream_writable$1)return _stream_writable$1;hasRequired_stream_writable$1=1,_stream_writable$1=le;function b(Pe){var xe=this;this.next=null,this.entry=null,this.finish=function(){Re(xe,Pe)}}var v;le.WritableState=oe;var w={deprecate:browser$a},_=requireStreamBrowser(),A=require$$1$2.Buffer,E=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function k(Pe){return A.from(Pe)}function P(Pe){return A.isBuffer(Pe)||Pe instanceof E}var N=requireDestroy(),q=requireState(),B=q.getHighWaterMark,O=requireErrorsBrowser().codes,I=O.ERR_INVALID_ARG_TYPE,D=O.ERR_METHOD_NOT_IMPLEMENTED,V=O.ERR_MULTIPLE_CALLBACK,ee=O.ERR_STREAM_CANNOT_PIPE,J=O.ERR_STREAM_DESTROYED,te=O.ERR_STREAM_NULL_VALUES,se=O.ERR_STREAM_WRITE_AFTER_END,ce=O.ERR_UNKNOWN_ENCODING,ae=N.errorOrDestroy;inherits_browserExports(le,_);function he(){}function oe(Pe,xe,ge){v=v||require_stream_duplex$1(),Pe=Pe||{},typeof ge!="boolean"&&(ge=xe instanceof v),this.objectMode=!!Pe.objectMode,ge&&(this.objectMode=this.objectMode||!!Pe.writableObjectMode),this.highWaterMark=B(this,Pe,"writableHighWaterMark",ge),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var _e=Pe.decodeStrings===!1;this.decodeStrings=!_e,this.defaultEncoding=Pe.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(ke){F(xe,ke)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=Pe.emitClose!==!1,this.autoDestroy=!!Pe.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new b(this)}oe.prototype.getBuffer=function(){for(var xe=this.bufferedRequest,ge=[];xe;)ge.push(xe),xe=xe.next;return ge},function(){try{Object.defineProperty(oe.prototype,"buffer",{get:w.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var de;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(de=Function.prototype[Symbol.hasInstance],Object.defineProperty(le,Symbol.hasInstance,{value:function(xe){return de.call(this,xe)?!0:this!==le?!1:xe&&xe._writableState instanceof oe}})):de=function(xe){return xe instanceof this};function le(Pe){v=v||require_stream_duplex$1();var xe=this instanceof v;if(!xe&&!de.call(le,this))return new le(Pe);this._writableState=new oe(Pe,this,xe),this.writable=!0,Pe&&(typeof Pe.write=="function"&&(this._write=Pe.write),typeof Pe.writev=="function"&&(this._writev=Pe.writev),typeof Pe.destroy=="function"&&(this._destroy=Pe.destroy),typeof Pe.final=="function"&&(this._final=Pe.final)),_.call(this)}le.prototype.pipe=function(){ae(this,new ee)};function be(Pe,xe){var ge=new se;ae(Pe,ge),process$1.nextTick(xe,ge)}function pe(Pe,xe,ge,_e){var ke;return ge===null?ke=new te:typeof ge!="string"&&!xe.objectMode&&(ke=new I("chunk",["string","Buffer"],ge)),ke?(ae(Pe,ke),process$1.nextTick(_e,ke),!1):!0}le.prototype.write=function(Pe,xe,ge){var _e=this._writableState,ke=!1,Ee=!_e.objectMode&&P(Pe);return Ee&&!A.isBuffer(Pe)&&(Pe=k(Pe)),typeof xe=="function"&&(ge=xe,xe=null),Ee?xe="buffer":xe||(xe=_e.defaultEncoding),typeof ge!="function"&&(ge=he),_e.ending?be(this,ge):(Ee||pe(this,_e,Pe,ge))&&(_e.pendingcb++,ke=Z(this,_e,Ee,Pe,xe,ge)),ke},le.prototype.cork=function(){this._writableState.corked++},le.prototype.uncork=function(){var Pe=this._writableState;Pe.corked&&(Pe.corked--,!Pe.writing&&!Pe.corked&&!Pe.bufferProcessing&&Pe.bufferedRequest&&ie(this,Pe))},le.prototype.setDefaultEncoding=function(xe){if(typeof xe=="string"&&(xe=xe.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((xe+"").toLowerCase())>-1))throw new ce(xe);return this._writableState.defaultEncoding=xe,this},Object.defineProperty(le.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function fe(Pe,xe,ge){return!Pe.objectMode&&Pe.decodeStrings!==!1&&typeof xe=="string"&&(xe=A.from(xe,ge)),xe}Object.defineProperty(le.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Z(Pe,xe,ge,_e,ke,Ee){if(!ge){var Se=fe(xe,_e,ke);_e!==Se&&(ge=!0,ke="buffer",_e=Se)}var Oe=xe.objectMode?1:_e.length;xe.length+=Oe;var Ne=xe.length<xe.highWaterMark;if(Ne||(xe.needDrain=!0),xe.writing||xe.corked){var ve=xe.lastBufferedRequest;xe.lastBufferedRequest={chunk:_e,encoding:ke,isBuf:ge,callback:Ee,next:null},ve?ve.next=xe.lastBufferedRequest:xe.bufferedRequest=xe.lastBufferedRequest,xe.bufferedRequestCount+=1}else U(Pe,xe,!1,Oe,_e,ke,Ee);return Ne}function U(Pe,xe,ge,_e,ke,Ee,Se){xe.writelen=_e,xe.writecb=Se,xe.writing=!0,xe.sync=!0,xe.destroyed?xe.onwrite(new J("write")):ge?Pe._writev(ke,xe.onwrite):Pe._write(ke,Ee,xe.onwrite),xe.sync=!1}function S(Pe,xe,ge,_e,ke){--xe.pendingcb,ge?(process$1.nextTick(ke,_e),process$1.nextTick(ue,Pe,xe),Pe._writableState.errorEmitted=!0,ae(Pe,_e)):(ke(_e),Pe._writableState.errorEmitted=!0,ae(Pe,_e),ue(Pe,xe))}function C(Pe){Pe.writing=!1,Pe.writecb=null,Pe.length-=Pe.writelen,Pe.writelen=0}function F(Pe,xe){var ge=Pe._writableState,_e=ge.sync,ke=ge.writecb;if(typeof ke!="function")throw new V;if(C(ge),xe)S(Pe,ge,_e,xe,ke);else{var Ee=Q(ge)||Pe.destroyed;!Ee&&!ge.corked&&!ge.bufferProcessing&&ge.bufferedRequest&&ie(Pe,ge),_e?process$1.nextTick(X,Pe,ge,Ee,ke):X(Pe,ge,Ee,ke)}}function X(Pe,xe,ge,_e){ge||re(Pe,xe),xe.pendingcb--,_e(),ue(Pe,xe)}function re(Pe,xe){xe.length===0&&xe.needDrain&&(xe.needDrain=!1,Pe.emit("drain"))}function ie(Pe,xe){xe.bufferProcessing=!0;var ge=xe.bufferedRequest;if(Pe._writev&&ge&&ge.next){var _e=xe.bufferedRequestCount,ke=new Array(_e),Ee=xe.corkedRequestsFree;Ee.entry=ge;for(var Se=0,Oe=!0;ge;)ke[Se]=ge,ge.isBuf||(Oe=!1),ge=ge.next,Se+=1;ke.allBuffers=Oe,U(Pe,xe,!0,xe.length,ke,"",Ee.finish),xe.pendingcb++,xe.lastBufferedRequest=null,Ee.next?(xe.corkedRequestsFree=Ee.next,Ee.next=null):xe.corkedRequestsFree=new b(xe),xe.bufferedRequestCount=0}else{for(;ge;){var Ne=ge.chunk,ve=ge.encoding,Ce=ge.callback,Te=xe.objectMode?1:Ne.length;if(U(Pe,xe,!1,Te,Ne,ve,Ce),ge=ge.next,xe.bufferedRequestCount--,xe.writing)break}ge===null&&(xe.lastBufferedRequest=null)}xe.bufferedRequest=ge,xe.bufferProcessing=!1}le.prototype._write=function(Pe,xe,ge){ge(new D("_write()"))},le.prototype._writev=null,le.prototype.end=function(Pe,xe,ge){var _e=this._writableState;return typeof Pe=="function"?(ge=Pe,Pe=null,xe=null):typeof xe=="function"&&(ge=xe,xe=null),Pe!=null&&this.write(Pe,xe),_e.corked&&(_e.corked=1,this.uncork()),_e.ending||Ae(this,_e,ge),this},Object.defineProperty(le.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Q(Pe){return Pe.ending&&Pe.length===0&&Pe.bufferedRequest===null&&!Pe.finished&&!Pe.writing}function ne(Pe,xe){Pe._final(function(ge){xe.pendingcb--,ge&&ae(Pe,ge),xe.prefinished=!0,Pe.emit("prefinish"),ue(Pe,xe)})}function L(Pe,xe){!xe.prefinished&&!xe.finalCalled&&(typeof Pe._final=="function"&&!xe.destroyed?(xe.pendingcb++,xe.finalCalled=!0,process$1.nextTick(ne,Pe,xe)):(xe.prefinished=!0,Pe.emit("prefinish")))}function ue(Pe,xe){var ge=Q(xe);if(ge&&(L(Pe,xe),xe.pendingcb===0&&(xe.finished=!0,Pe.emit("finish"),xe.autoDestroy))){var _e=Pe._readableState;(!_e||_e.autoDestroy&&_e.endEmitted)&&Pe.destroy()}return ge}function Ae(Pe,xe,ge){xe.ending=!0,ue(Pe,xe),ge&&(xe.finished?process$1.nextTick(ge):Pe.once("finish",ge)),xe.ended=!0,Pe.writable=!1}function Re(Pe,xe,ge){var _e=Pe.entry;for(Pe.entry=null;_e;){var ke=_e.callback;xe.pendingcb--,ke(ge),_e=_e.next}xe.corkedRequestsFree.next=Pe}return Object.defineProperty(le.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(xe){this._writableState&&(this._writableState.destroyed=xe)}}),le.prototype.destroy=N.destroy,le.prototype._undestroy=N.undestroy,le.prototype._destroy=function(Pe,xe){xe(Pe)},_stream_writable$1}var _stream_duplex$1,hasRequired_stream_duplex$1;function require_stream_duplex$1(){if(hasRequired_stream_duplex$1)return _stream_duplex$1;hasRequired_stream_duplex$1=1;var b=Object.keys||function(q){var B=[];for(var O in q)B.push(O);return B};_stream_duplex$1=k;var v=require_stream_readable$1(),w=require_stream_writable$1();inherits_browserExports(k,v);for(var _=b(w.prototype),A=0;A<_.length;A++){var E=_[A];k.prototype[E]||(k.prototype[E]=w.prototype[E])}function k(q){if(!(this instanceof k))return new k(q);v.call(this,q),w.call(this,q),this.allowHalfOpen=!0,q&&(q.readable===!1&&(this.readable=!1),q.writable===!1&&(this.writable=!1),q.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",P)))}Object.defineProperty(k.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(k.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(k.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function P(){this._writableState.ended||process$1.nextTick(N,this)}function N(q){q.end()}return Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(B){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=B,this._writableState.destroyed=B)}}),_stream_duplex$1}var string_decoder={},Buffer$B=safeBufferExports$1.Buffer,isEncoding=Buffer$B.isEncoding||function(b){switch(b=""+b,b&&b.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 _normalizeEncoding(b){if(!b)return"utf8";for(var v;;)switch(b){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 b;default:if(v)return;b=(""+b).toLowerCase(),v=!0}}function normalizeEncoding(b){var v=_normalizeEncoding(b);if(typeof v!="string"&&(Buffer$B.isEncoding===isEncoding||!isEncoding(b)))throw new Error("Unknown encoding: "+b);return v||b}string_decoder.StringDecoder=StringDecoder$1;function StringDecoder$1(b){this.encoding=normalizeEncoding(b);var v;switch(this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,v=4;break;case"utf8":this.fillLast=utf8FillLast,v=4;break;case"base64":this.text=base64Text,this.end=base64End,v=3;break;default:this.write=simpleWrite,this.end=simpleEnd;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Buffer$B.allocUnsafe(v)}StringDecoder$1.prototype.write=function(b){if(b.length===0)return"";var v,w;if(this.lastNeed){if(v=this.fillLast(b),v===void 0)return"";w=this.lastNeed,this.lastNeed=0}else w=0;return w<b.length?v?v+this.text(b,w):this.text(b,w):v||""};StringDecoder$1.prototype.end=utf8End;StringDecoder$1.prototype.text=utf8Text;StringDecoder$1.prototype.fillLast=function(b){if(this.lastNeed<=b.length)return b.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);b.copy(this.lastChar,this.lastTotal-this.lastNeed,0,b.length),this.lastNeed-=b.length};function utf8CheckByte(b){return b<=127?0:b>>5===6?2:b>>4===14?3:b>>3===30?4:b>>6===2?-1:-2}function utf8CheckIncomplete(b,v,w){var _=v.length-1;if(_<w)return 0;var A=utf8CheckByte(v[_]);return A>=0?(A>0&&(b.lastNeed=A-1),A):--_<w||A===-2?0:(A=utf8CheckByte(v[_]),A>=0?(A>0&&(b.lastNeed=A-2),A):--_<w||A===-2?0:(A=utf8CheckByte(v[_]),A>=0?(A>0&&(A===2?A=0:b.lastNeed=A-3),A):0))}function utf8CheckExtraBytes(b,v,w){if((v[0]&192)!==128)return b.lastNeed=0,"�";if(b.lastNeed>1&&v.length>1){if((v[1]&192)!==128)return b.lastNeed=1,"�";if(b.lastNeed>2&&v.length>2&&(v[2]&192)!==128)return b.lastNeed=2,"�"}}function utf8FillLast(b){var v=this.lastTotal-this.lastNeed,w=utf8CheckExtraBytes(this,b);if(w!==void 0)return w;if(this.lastNeed<=b.length)return b.copy(this.lastChar,v,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);b.copy(this.lastChar,v,0,b.length),this.lastNeed-=b.length}function utf8Text(b,v){var w=utf8CheckIncomplete(this,b,v);if(!this.lastNeed)return b.toString("utf8",v);this.lastTotal=w;var _=b.length-(w-this.lastNeed);return b.copy(this.lastChar,0,_),b.toString("utf8",v,_)}function utf8End(b){var v=b&&b.length?this.write(b):"";return this.lastNeed?v+"�":v}function utf16Text(b,v){if((b.length-v)%2===0){var w=b.toString("utf16le",v);if(w){var _=w.charCodeAt(w.length-1);if(_>=55296&&_<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=b[b.length-2],this.lastChar[1]=b[b.length-1],w.slice(0,-1)}return w}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=b[b.length-1],b.toString("utf16le",v,b.length-1)}function utf16End(b){var v=b&&b.length?this.write(b):"";if(this.lastNeed){var w=this.lastTotal-this.lastNeed;return v+this.lastChar.toString("utf16le",0,w)}return v}function base64Text(b,v){var w=(b.length-v)%3;return w===0?b.toString("base64",v):(this.lastNeed=3-w,this.lastTotal=3,w===1?this.lastChar[0]=b[b.length-1]:(this.lastChar[0]=b[b.length-2],this.lastChar[1]=b[b.length-1]),b.toString("base64",v,b.length-w))}function base64End(b){var v=b&&b.length?this.write(b):"";return this.lastNeed?v+this.lastChar.toString("base64",0,3-this.lastNeed):v}function simpleWrite(b){return b.toString(this.encoding)}function simpleEnd(b){return b&&b.length?this.write(b):""}var endOfStream,hasRequiredEndOfStream;function requireEndOfStream(){if(hasRequiredEndOfStream)return endOfStream;hasRequiredEndOfStream=1;var b=requireErrorsBrowser().codes.ERR_STREAM_PREMATURE_CLOSE;function v(E){var k=!1;return function(){if(!k){k=!0;for(var P=arguments.length,N=new Array(P),q=0;q<P;q++)N[q]=arguments[q];E.apply(this,N)}}}function w(){}function _(E){return E.setHeader&&typeof E.abort=="function"}function A(E,k,P){if(typeof k=="function")return A(E,null,k);k||(k={}),P=v(P||w);var N=k.readable||k.readable!==!1&&E.readable,q=k.writable||k.writable!==!1&&E.writable,B=function(){E.writable||I()},O=E._writableState&&E._writableState.finished,I=function(){q=!1,O=!0,N||P.call(E)},D=E._readableState&&E._readableState.endEmitted,V=function(){N=!1,D=!0,q||P.call(E)},ee=function(ce){P.call(E,ce)},J=function(){var ce;if(N&&!D)return(!E._readableState||!E._readableState.ended)&&(ce=new b),P.call(E,ce);if(q&&!O)return(!E._writableState||!E._writableState.ended)&&(ce=new b),P.call(E,ce)},te=function(){E.req.on("finish",I)};return _(E)?(E.on("complete",I),E.on("abort",J),E.req?te():E.on("request",te)):q&&!E._writableState&&(E.on("end",B),E.on("close",B)),E.on("end",V),E.on("finish",I),k.error!==!1&&E.on("error",ee),E.on("close",J),function(){E.removeListener("complete",I),E.removeListener("abort",J),E.removeListener("request",te),E.req&&E.req.removeListener("finish",I),E.removeListener("end",B),E.removeListener("close",B),E.removeListener("finish",I),E.removeListener("end",V),E.removeListener("error",ee),E.removeListener("close",J)}}return endOfStream=A,endOfStream}var async_iterator,hasRequiredAsync_iterator;function requireAsync_iterator(){if(hasRequiredAsync_iterator)return async_iterator;hasRequiredAsync_iterator=1;var b;function v(ce,ae,he){return ae=w(ae),ae in ce?Object.defineProperty(ce,ae,{value:he,enumerable:!0,configurable:!0,writable:!0}):ce[ae]=he,ce}function w(ce){var ae=_(ce,"string");return typeof ae=="symbol"?ae:String(ae)}function _(ce,ae){if(typeof ce!="object"||ce===null)return ce;var he=ce[Symbol.toPrimitive];if(he!==void 0){var oe=he.call(ce,ae||"default");if(typeof oe!="object")return oe;throw new TypeError("@@toPrimitive must return a primitive value.")}return(ae==="string"?String:Number)(ce)}var A=requireEndOfStream(),E=Symbol("lastResolve"),k=Symbol("lastReject"),P=Symbol("error"),N=Symbol("ended"),q=Symbol("lastPromise"),B=Symbol("handlePromise"),O=Symbol("stream");function I(ce,ae){return{value:ce,done:ae}}function D(ce){var ae=ce[E];if(ae!==null){var he=ce[O].read();he!==null&&(ce[q]=null,ce[E]=null,ce[k]=null,ae(I(he,!1)))}}function V(ce){process$1.nextTick(D,ce)}function ee(ce,ae){return function(he,oe){ce.then(function(){if(ae[N]){he(I(void 0,!0));return}ae[B](he,oe)},oe)}}var J=Object.getPrototypeOf(function(){}),te=Object.setPrototypeOf((b={get stream(){return this[O]},next:function(){var ae=this,he=this[P];if(he!==null)return Promise.reject(he);if(this[N])return Promise.resolve(I(void 0,!0));if(this[O].destroyed)return new Promise(function(be,pe){process$1.nextTick(function(){ae[P]?pe(ae[P]):be(I(void 0,!0))})});var oe=this[q],de;if(oe)de=new Promise(ee(oe,this));else{var le=this[O].read();if(le!==null)return Promise.resolve(I(le,!1));de=new Promise(this[B])}return this[q]=de,de}},v(b,Symbol.asyncIterator,function(){return this}),v(b,"return",function(){var ae=this;return new Promise(function(he,oe){ae[O].destroy(null,function(de){if(de){oe(de);return}he(I(void 0,!0))})})}),b),J),se=function(ae){var he,oe=Object.create(te,(he={},v(he,O,{value:ae,writable:!0}),v(he,E,{value:null,writable:!0}),v(he,k,{value:null,writable:!0}),v(he,P,{value:null,writable:!0}),v(he,N,{value:ae._readableState.endEmitted,writable:!0}),v(he,B,{value:function(le,be){var pe=oe[O].read();pe?(oe[q]=null,oe[E]=null,oe[k]=null,le(I(pe,!1))):(oe[E]=le,oe[k]=be)},writable:!0}),he));return oe[q]=null,A(ae,function(de){if(de&&de.code!=="ERR_STREAM_PREMATURE_CLOSE"){var le=oe[k];le!==null&&(oe[q]=null,oe[E]=null,oe[k]=null,le(de)),oe[P]=de;return}var be=oe[E];be!==null&&(oe[q]=null,oe[E]=null,oe[k]=null,be(I(void 0,!0))),oe[N]=!0}),ae.on("readable",V.bind(null,oe)),oe};return async_iterator=se,async_iterator}var fromBrowser,hasRequiredFromBrowser;function requireFromBrowser(){return hasRequiredFromBrowser||(hasRequiredFromBrowser=1,fromBrowser=function(){throw new Error("Readable.from is not available in the browser")}),fromBrowser}var _stream_readable$1,hasRequired_stream_readable$1;function require_stream_readable$1(){if(hasRequired_stream_readable$1)return _stream_readable$1;hasRequired_stream_readable$1=1,_stream_readable$1=be;var b;be.ReadableState=le,eventsExports.EventEmitter;var v=function(Se,Oe){return Se.listeners(Oe).length},w=requireStreamBrowser(),_=require$$1$2.Buffer,A=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function E(Ee){return _.from(Ee)}function k(Ee){return _.isBuffer(Ee)||Ee instanceof A}var P=util$3,N;P&&P.debuglog?N=P.debuglog("stream"):N=function(){};var q=requireBuffer_list(),B=requireDestroy(),O=requireState(),I=O.getHighWaterMark,D=requireErrorsBrowser().codes,V=D.ERR_INVALID_ARG_TYPE,ee=D.ERR_STREAM_PUSH_AFTER_EOF,J=D.ERR_METHOD_NOT_IMPLEMENTED,te=D.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,se,ce,ae;inherits_browserExports(be,w);var he=B.errorOrDestroy,oe=["error","close","destroy","pause","resume"];function de(Ee,Se,Oe){if(typeof Ee.prependListener=="function")return Ee.prependListener(Se,Oe);!Ee._events||!Ee._events[Se]?Ee.on(Se,Oe):Array.isArray(Ee._events[Se])?Ee._events[Se].unshift(Oe):Ee._events[Se]=[Oe,Ee._events[Se]]}function le(Ee,Se,Oe){b=b||require_stream_duplex$1(),Ee=Ee||{},typeof Oe!="boolean"&&(Oe=Se instanceof b),this.objectMode=!!Ee.objectMode,Oe&&(this.objectMode=this.objectMode||!!Ee.readableObjectMode),this.highWaterMark=I(this,Ee,"readableHighWaterMark",Oe),this.buffer=new q,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=Ee.emitClose!==!1,this.autoDestroy=!!Ee.autoDestroy,this.destroyed=!1,this.defaultEncoding=Ee.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,Ee.encoding&&(se||(se=string_decoder.StringDecoder),this.decoder=new se(Ee.encoding),this.encoding=Ee.encoding)}function be(Ee){if(b=b||require_stream_duplex$1(),!(this instanceof be))return new be(Ee);var Se=this instanceof b;this._readableState=new le(Ee,this,Se),this.readable=!0,Ee&&(typeof Ee.read=="function"&&(this._read=Ee.read),typeof Ee.destroy=="function"&&(this._destroy=Ee.destroy)),w.call(this)}Object.defineProperty(be.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(Se){this._readableState&&(this._readableState.destroyed=Se)}}),be.prototype.destroy=B.destroy,be.prototype._undestroy=B.undestroy,be.prototype._destroy=function(Ee,Se){Se(Ee)},be.prototype.push=function(Ee,Se){var Oe=this._readableState,Ne;return Oe.objectMode?Ne=!0:typeof Ee=="string"&&(Se=Se||Oe.defaultEncoding,Se!==Oe.encoding&&(Ee=_.from(Ee,Se),Se=""),Ne=!0),pe(this,Ee,Se,!1,Ne)},be.prototype.unshift=function(Ee){return pe(this,Ee,null,!0,!1)};function pe(Ee,Se,Oe,Ne,ve){N("readableAddChunk",Se);var Ce=Ee._readableState;if(Se===null)Ce.reading=!1,F(Ee,Ce);else{var Te;if(ve||(Te=Z(Ce,Se)),Te)he(Ee,Te);else if(Ce.objectMode||Se&&Se.length>0)if(typeof Se!="string"&&!Ce.objectMode&&Object.getPrototypeOf(Se)!==_.prototype&&(Se=E(Se)),Ne)Ce.endEmitted?he(Ee,new te):fe(Ee,Ce,Se,!0);else if(Ce.ended)he(Ee,new ee);else{if(Ce.destroyed)return!1;Ce.reading=!1,Ce.decoder&&!Oe?(Se=Ce.decoder.write(Se),Ce.objectMode||Se.length!==0?fe(Ee,Ce,Se,!1):ie(Ee,Ce)):fe(Ee,Ce,Se,!1)}else Ne||(Ce.reading=!1,ie(Ee,Ce))}return!Ce.ended&&(Ce.length<Ce.highWaterMark||Ce.length===0)}function fe(Ee,Se,Oe,Ne){Se.flowing&&Se.length===0&&!Se.sync?(Se.awaitDrain=0,Ee.emit("data",Oe)):(Se.length+=Se.objectMode?1:Oe.length,Ne?Se.buffer.unshift(Oe):Se.buffer.push(Oe),Se.needReadable&&X(Ee)),ie(Ee,Se)}function Z(Ee,Se){var Oe;return!k(Se)&&typeof Se!="string"&&Se!==void 0&&!Ee.objectMode&&(Oe=new V("chunk",["string","Buffer","Uint8Array"],Se)),Oe}be.prototype.isPaused=function(){return this._readableState.flowing===!1},be.prototype.setEncoding=function(Ee){se||(se=string_decoder.StringDecoder);var Se=new se(Ee);this._readableState.decoder=Se,this._readableState.encoding=this._readableState.decoder.encoding;for(var Oe=this._readableState.buffer.head,Ne="";Oe!==null;)Ne+=Se.write(Oe.data),Oe=Oe.next;return this._readableState.buffer.clear(),Ne!==""&&this._readableState.buffer.push(Ne),this._readableState.length=Ne.length,this};var U=1073741824;function S(Ee){return Ee>=U?Ee=U:(Ee--,Ee|=Ee>>>1,Ee|=Ee>>>2,Ee|=Ee>>>4,Ee|=Ee>>>8,Ee|=Ee>>>16,Ee++),Ee}function C(Ee,Se){return Ee<=0||Se.length===0&&Se.ended?0:Se.objectMode?1:Ee!==Ee?Se.flowing&&Se.length?Se.buffer.head.data.length:Se.length:(Ee>Se.highWaterMark&&(Se.highWaterMark=S(Ee)),Ee<=Se.length?Ee:Se.ended?Se.length:(Se.needReadable=!0,0))}be.prototype.read=function(Ee){N("read",Ee),Ee=parseInt(Ee,10);var Se=this._readableState,Oe=Ee;if(Ee!==0&&(Se.emittedReadable=!1),Ee===0&&Se.needReadable&&((Se.highWaterMark!==0?Se.length>=Se.highWaterMark:Se.length>0)||Se.ended))return N("read: emitReadable",Se.length,Se.ended),Se.length===0&&Se.ended?ge(this):X(this),null;if(Ee=C(Ee,Se),Ee===0&&Se.ended)return Se.length===0&&ge(this),null;var Ne=Se.needReadable;N("need readable",Ne),(Se.length===0||Se.length-Ee<Se.highWaterMark)&&(Ne=!0,N("length less than watermark",Ne)),Se.ended||Se.reading?(Ne=!1,N("reading or ended",Ne)):Ne&&(N("do read"),Se.reading=!0,Se.sync=!0,Se.length===0&&(Se.needReadable=!0),this._read(Se.highWaterMark),Se.sync=!1,Se.reading||(Ee=C(Oe,Se)));var ve;return Ee>0?ve=xe(Ee,Se):ve=null,ve===null?(Se.needReadable=Se.length<=Se.highWaterMark,Ee=0):(Se.length-=Ee,Se.awaitDrain=0),Se.length===0&&(Se.ended||(Se.needReadable=!0),Oe!==Ee&&Se.ended&&ge(this)),ve!==null&&this.emit("data",ve),ve};function F(Ee,Se){if(N("onEofChunk"),!Se.ended){if(Se.decoder){var Oe=Se.decoder.end();Oe&&Oe.length&&(Se.buffer.push(Oe),Se.length+=Se.objectMode?1:Oe.length)}Se.ended=!0,Se.sync?X(Ee):(Se.needReadable=!1,Se.emittedReadable||(Se.emittedReadable=!0,re(Ee)))}}function X(Ee){var Se=Ee._readableState;N("emitReadable",Se.needReadable,Se.emittedReadable),Se.needReadable=!1,Se.emittedReadable||(N("emitReadable",Se.flowing),Se.emittedReadable=!0,process$1.nextTick(re,Ee))}function re(Ee){var Se=Ee._readableState;N("emitReadable_",Se.destroyed,Se.length,Se.ended),!Se.destroyed&&(Se.length||Se.ended)&&(Ee.emit("readable"),Se.emittedReadable=!1),Se.needReadable=!Se.flowing&&!Se.ended&&Se.length<=Se.highWaterMark,Pe(Ee)}function ie(Ee,Se){Se.readingMore||(Se.readingMore=!0,process$1.nextTick(Q,Ee,Se))}function Q(Ee,Se){for(;!Se.reading&&!Se.ended&&(Se.length<Se.highWaterMark||Se.flowing&&Se.length===0);){var Oe=Se.length;if(N("maybeReadMore read 0"),Ee.read(0),Oe===Se.length)break}Se.readingMore=!1}be.prototype._read=function(Ee){he(this,new J("_read()"))},be.prototype.pipe=function(Ee,Se){var Oe=this,Ne=this._readableState;switch(Ne.pipesCount){case 0:Ne.pipes=Ee;break;case 1:Ne.pipes=[Ne.pipes,Ee];break;default:Ne.pipes.push(Ee);break}Ne.pipesCount+=1,N("pipe count=%d opts=%j",Ne.pipesCount,Se);var ve=(!Se||Se.end!==!1)&&Ee!==process$1.stdout&&Ee!==process$1.stderr,Ce=ve?Le:Fe;Ne.endEmitted?process$1.nextTick(Ce):Oe.once("end",Ce),Ee.on("unpipe",Te);function Te(qe,$e){N("onunpipe"),qe===Oe&&$e&&$e.hasUnpiped===!1&&($e.hasUnpiped=!0,Ke())}function Le(){N("onend"),Ee.end()}var Be=ne(Oe);Ee.on("drain",Be);var De=!1;function Ke(){N("cleanup"),Ee.removeListener("close",Xe),Ee.removeListener("finish",at),Ee.removeListener("drain",Be),Ee.removeListener("error",Qe),Ee.removeListener("unpipe",Te),Oe.removeListener("end",Le),Oe.removeListener("end",Fe),Oe.removeListener("data",We),De=!0,Ne.awaitDrain&&(!Ee._writableState||Ee._writableState.needDrain)&&Be()}Oe.on("data",We);function We(qe){N("ondata");var $e=Ee.write(qe);N("dest.write",$e),$e===!1&&((Ne.pipesCount===1&&Ne.pipes===Ee||Ne.pipesCount>1&&ke(Ne.pipes,Ee)!==-1)&&!De&&(N("false write response, pause",Ne.awaitDrain),Ne.awaitDrain++),Oe.pause())}function Qe(qe){N("onerror",qe),Fe(),Ee.removeListener("error",Qe),v(Ee,"error")===0&&he(Ee,qe)}de(Ee,"error",Qe);function Xe(){Ee.removeListener("finish",at),Fe()}Ee.once("close",Xe);function at(){N("onfinish"),Ee.removeListener("close",Xe),Fe()}Ee.once("finish",at);function Fe(){N("unpipe"),Oe.unpipe(Ee)}return Ee.emit("pipe",Oe),Ne.flowing||(N("pipe resume"),Oe.resume()),Ee};function ne(Ee){return function(){var Oe=Ee._readableState;N("pipeOnDrain",Oe.awaitDrain),Oe.awaitDrain&&Oe.awaitDrain--,Oe.awaitDrain===0&&v(Ee,"data")&&(Oe.flowing=!0,Pe(Ee))}}be.prototype.unpipe=function(Ee){var Se=this._readableState,Oe={hasUnpiped:!1};if(Se.pipesCount===0)return this;if(Se.pipesCount===1)return Ee&&Ee!==Se.pipes?this:(Ee||(Ee=Se.pipes),Se.pipes=null,Se.pipesCount=0,Se.flowing=!1,Ee&&Ee.emit("unpipe",this,Oe),this);if(!Ee){var Ne=Se.pipes,ve=Se.pipesCount;Se.pipes=null,Se.pipesCount=0,Se.flowing=!1;for(var Ce=0;Ce<ve;Ce++)Ne[Ce].emit("unpipe",this,{hasUnpiped:!1});return this}var Te=ke(Se.pipes,Ee);return Te===-1?this:(Se.pipes.splice(Te,1),Se.pipesCount-=1,Se.pipesCount===1&&(Se.pipes=Se.pipes[0]),Ee.emit("unpipe",this,Oe),this)},be.prototype.on=function(Ee,Se){var Oe=w.prototype.on.call(this,Ee,Se),Ne=this._readableState;return Ee==="data"?(Ne.readableListening=this.listenerCount("readable")>0,Ne.flowing!==!1&&this.resume()):Ee==="readable"&&!Ne.endEmitted&&!Ne.readableListening&&(Ne.readableListening=Ne.needReadable=!0,Ne.flowing=!1,Ne.emittedReadable=!1,N("on readable",Ne.length,Ne.reading),Ne.length?X(this):Ne.reading||process$1.nextTick(ue,this)),Oe},be.prototype.addListener=be.prototype.on,be.prototype.removeListener=function(Ee,Se){var Oe=w.prototype.removeListener.call(this,Ee,Se);return Ee==="readable"&&process$1.nextTick(L,this),Oe},be.prototype.removeAllListeners=function(Ee){var Se=w.prototype.removeAllListeners.apply(this,arguments);return(Ee==="readable"||Ee===void 0)&&process$1.nextTick(L,this),Se};function L(Ee){var Se=Ee._readableState;Se.readableListening=Ee.listenerCount("readable")>0,Se.resumeScheduled&&!Se.paused?Se.flowing=!0:Ee.listenerCount("data")>0&&Ee.resume()}function ue(Ee){N("readable nexttick read 0"),Ee.read(0)}be.prototype.resume=function(){var Ee=this._readableState;return Ee.flowing||(N("resume"),Ee.flowing=!Ee.readableListening,Ae(this,Ee)),Ee.paused=!1,this};function Ae(Ee,Se){Se.resumeScheduled||(Se.resumeScheduled=!0,process$1.nextTick(Re,Ee,Se))}function Re(Ee,Se){N("resume",Se.reading),Se.reading||Ee.read(0),Se.resumeScheduled=!1,Ee.emit("resume"),Pe(Ee),Se.flowing&&!Se.reading&&Ee.read(0)}be.prototype.pause=function(){return N("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(N("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Pe(Ee){var Se=Ee._readableState;for(N("flow",Se.flowing);Se.flowing&&Ee.read()!==null;);}be.prototype.wrap=function(Ee){var Se=this,Oe=this._readableState,Ne=!1;Ee.on("end",function(){if(N("wrapped end"),Oe.decoder&&!Oe.ended){var Te=Oe.decoder.end();Te&&Te.length&&Se.push(Te)}Se.push(null)}),Ee.on("data",function(Te){if(N("wrapped data"),Oe.decoder&&(Te=Oe.decoder.write(Te)),!(Oe.objectMode&&Te==null)&&!(!Oe.objectMode&&(!Te||!Te.length))){var Le=Se.push(Te);Le||(Ne=!0,Ee.pause())}});for(var ve in Ee)this[ve]===void 0&&typeof Ee[ve]=="function"&&(this[ve]=function(Le){return function(){return Ee[Le].apply(Ee,arguments)}}(ve));for(var Ce=0;Ce<oe.length;Ce++)Ee.on(oe[Ce],this.emit.bind(this,oe[Ce]));return this._read=function(Te){N("wrapped _read",Te),Ne&&(Ne=!1,Ee.resume())},this},typeof Symbol=="function"&&(be.prototype[Symbol.asyncIterator]=function(){return ce===void 0&&(ce=requireAsync_iterator()),ce(this)}),Object.defineProperty(be.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(be.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(be.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(Se){this._readableState&&(this._readableState.flowing=Se)}}),be._fromList=xe,Object.defineProperty(be.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function xe(Ee,Se){if(Se.length===0)return null;var Oe;return Se.objectMode?Oe=Se.buffer.shift():!Ee||Ee>=Se.length?(Se.decoder?Oe=Se.buffer.join(""):Se.buffer.length===1?Oe=Se.buffer.first():Oe=Se.buffer.concat(Se.length),Se.buffer.clear()):Oe=Se.buffer.consume(Ee,Se.decoder),Oe}function ge(Ee){var Se=Ee._readableState;N("endReadable",Se.endEmitted),Se.endEmitted||(Se.ended=!0,process$1.nextTick(_e,Se,Ee))}function _e(Ee,Se){if(N("endReadableNT",Ee.endEmitted,Ee.length),!Ee.endEmitted&&Ee.length===0&&(Ee.endEmitted=!0,Se.readable=!1,Se.emit("end"),Ee.autoDestroy)){var Oe=Se._writableState;(!Oe||Oe.autoDestroy&&Oe.finished)&&Se.destroy()}}typeof Symbol=="function"&&(be.from=function(Ee,Se){return ae===void 0&&(ae=requireFromBrowser()),ae(be,Ee,Se)});function ke(Ee,Se){for(var Oe=0,Ne=Ee.length;Oe<Ne;Oe++)if(Ee[Oe]===Se)return Oe;return-1}return _stream_readable$1}var _stream_transform$1,hasRequired_stream_transform;function require_stream_transform(){if(hasRequired_stream_transform)return _stream_transform$1;hasRequired_stream_transform=1,_stream_transform$1=P;var b=requireErrorsBrowser().codes,v=b.ERR_METHOD_NOT_IMPLEMENTED,w=b.ERR_MULTIPLE_CALLBACK,_=b.ERR_TRANSFORM_ALREADY_TRANSFORMING,A=b.ERR_TRANSFORM_WITH_LENGTH_0,E=require_stream_duplex$1();inherits_browserExports(P,E);function k(B,O){var I=this._transformState;I.transforming=!1;var D=I.writecb;if(D===null)return this.emit("error",new w);I.writechunk=null,I.writecb=null,O!=null&&this.push(O),D(B);var V=this._readableState;V.reading=!1,(V.needReadable||V.length<V.highWaterMark)&&this._read(V.highWaterMark)}function P(B){if(!(this instanceof P))return new P(B);E.call(this,B),this._transformState={afterTransform:k.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,B&&(typeof B.transform=="function"&&(this._transform=B.transform),typeof B.flush=="function"&&(this._flush=B.flush)),this.on("prefinish",N)}function N(){var B=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(O,I){q(B,O,I)}):q(this,null,null)}P.prototype.push=function(B,O){return this._transformState.needTransform=!1,E.prototype.push.call(this,B,O)},P.prototype._transform=function(B,O,I){I(new v("_transform()"))},P.prototype._write=function(B,O,I){var D=this._transformState;if(D.writecb=I,D.writechunk=B,D.writeencoding=O,!D.transforming){var V=this._readableState;(D.needTransform||V.needReadable||V.length<V.highWaterMark)&&this._read(V.highWaterMark)}},P.prototype._read=function(B){var O=this._transformState;O.writechunk!==null&&!O.transforming?(O.transforming=!0,this._transform(O.writechunk,O.writeencoding,O.afterTransform)):O.needTransform=!0},P.prototype._destroy=function(B,O){E.prototype._destroy.call(this,B,function(I){O(I)})};function q(B,O,I){if(O)return B.emit("error",O);if(I!=null&&B.push(I),B._writableState.length)throw new A;if(B._transformState.transforming)throw new _;return B.push(null)}return _stream_transform$1}var _stream_passthrough$1,hasRequired_stream_passthrough;function require_stream_passthrough(){if(hasRequired_stream_passthrough)return _stream_passthrough$1;hasRequired_stream_passthrough=1,_stream_passthrough$1=v;var b=require_stream_transform();inherits_browserExports(v,b);function v(w){if(!(this instanceof v))return new v(w);b.call(this,w)}return v.prototype._transform=function(w,_,A){A(null,w)},_stream_passthrough$1}var pipeline_1,hasRequiredPipeline;function requirePipeline(){if(hasRequiredPipeline)return pipeline_1;hasRequiredPipeline=1;var b;function v(I){var D=!1;return function(){D||(D=!0,I.apply(void 0,arguments))}}var w=requireErrorsBrowser().codes,_=w.ERR_MISSING_ARGS,A=w.ERR_STREAM_DESTROYED;function E(I){if(I)throw I}function k(I){return I.setHeader&&typeof I.abort=="function"}function P(I,D,V,ee){ee=v(ee);var J=!1;I.on("close",function(){J=!0}),b===void 0&&(b=requireEndOfStream()),b(I,{readable:D,writable:V},function(se){if(se)return ee(se);J=!0,ee()});var te=!1;return function(se){if(!J&&!te){if(te=!0,k(I))return I.abort();if(typeof I.destroy=="function")return I.destroy();ee(se||new A("pipe"))}}}function N(I){I()}function q(I,D){return I.pipe(D)}function B(I){return!I.length||typeof I[I.length-1]!="function"?E:I.pop()}function O(){for(var I=arguments.length,D=new Array(I),V=0;V<I;V++)D[V]=arguments[V];var ee=B(D);if(Array.isArray(D[0])&&(D=D[0]),D.length<2)throw new _("streams");var J,te=D.map(function(se,ce){var ae=ce<D.length-1,he=ce>0;return P(se,ae,he,function(oe){J||(J=oe),oe&&te.forEach(N),!ae&&(te.forEach(N),ee(J))})});return D.reduce(q)}return pipeline_1=O,pipeline_1}(function(b,v){v=b.exports=require_stream_readable$1(),v.Stream=v,v.Readable=v,v.Writable=require_stream_writable$1(),v.Duplex=require_stream_duplex$1(),v.Transform=require_stream_transform(),v.PassThrough=require_stream_passthrough(),v.finished=requireEndOfStream(),v.pipeline=requirePipeline()})(readableBrowser$1,readableBrowser$1.exports);var readableBrowserExports$1=readableBrowser$1.exports,Buffer$A=safeBufferExports$1.Buffer,Transform$7=readableBrowserExports$1.Transform,inherits$q=inherits_browserExports;function throwIfNotStringOrBuffer(b,v){if(!Buffer$A.isBuffer(b)&&typeof b!="string")throw new TypeError(v+" must be a string or a buffer")}function HashBase$2(b){Transform$7.call(this),this._block=Buffer$A.allocUnsafe(b),this._blockSize=b,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}inherits$q(HashBase$2,Transform$7);HashBase$2.prototype._transform=function(b,v,w){var _=null;try{this.update(b,v)}catch(A){_=A}w(_)};HashBase$2.prototype._flush=function(b){var v=null;try{this.push(this.digest())}catch(w){v=w}b(v)};HashBase$2.prototype.update=function(b,v){if(throwIfNotStringOrBuffer(b,"Data"),this._finalized)throw new Error("Digest already called");Buffer$A.isBuffer(b)||(b=Buffer$A.from(b,v));for(var w=this._block,_=0;this._blockOffset+b.length-_>=this._blockSize;){for(var A=this._blockOffset;A<this._blockSize;)w[A++]=b[_++];this._update(),this._blockOffset=0}for(;_<b.length;)w[this._blockOffset++]=b[_++];for(var E=0,k=b.length*8;k>0;++E)this._length[E]+=k,k=this._length[E]/4294967296|0,k>0&&(this._length[E]-=4294967296*k);return this};HashBase$2.prototype._update=function(){throw new Error("_update is not implemented")};HashBase$2.prototype.digest=function(b){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var v=this._digest();b!==void 0&&(v=v.toString(b)),this._block.fill(0),this._blockOffset=0;for(var w=0;w<4;++w)this._length[w]=0;return v};HashBase$2.prototype._digest=function(){throw new Error("_digest is not implemented")};var hashBase=HashBase$2,inherits$p=inherits_browserExports,HashBase$1=hashBase,Buffer$z=safeBufferExports$1.Buffer,ARRAY16$1=new Array(16);function MD5$3(){HashBase$1.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}inherits$p(MD5$3,HashBase$1);MD5$3.prototype._update=function(){for(var b=ARRAY16$1,v=0;v<16;++v)b[v]=this._block.readInt32LE(v*4);var w=this._a,_=this._b,A=this._c,E=this._d;w=fnF(w,_,A,E,b[0],3614090360,7),E=fnF(E,w,_,A,b[1],3905402710,12),A=fnF(A,E,w,_,b[2],606105819,17),_=fnF(_,A,E,w,b[3],3250441966,22),w=fnF(w,_,A,E,b[4],4118548399,7),E=fnF(E,w,_,A,b[5],1200080426,12),A=fnF(A,E,w,_,b[6],2821735955,17),_=fnF(_,A,E,w,b[7],4249261313,22),w=fnF(w,_,A,E,b[8],1770035416,7),E=fnF(E,w,_,A,b[9],2336552879,12),A=fnF(A,E,w,_,b[10],4294925233,17),_=fnF(_,A,E,w,b[11],2304563134,22),w=fnF(w,_,A,E,b[12],1804603682,7),E=fnF(E,w,_,A,b[13],4254626195,12),A=fnF(A,E,w,_,b[14],2792965006,17),_=fnF(_,A,E,w,b[15],1236535329,22),w=fnG(w,_,A,E,b[1],4129170786,5),E=fnG(E,w,_,A,b[6],3225465664,9),A=fnG(A,E,w,_,b[11],643717713,14),_=fnG(_,A,E,w,b[0],3921069994,20),w=fnG(w,_,A,E,b[5],3593408605,5),E=fnG(E,w,_,A,b[10],38016083,9),A=fnG(A,E,w,_,b[15],3634488961,14),_=fnG(_,A,E,w,b[4],3889429448,20),w=fnG(w,_,A,E,b[9],568446438,5),E=fnG(E,w,_,A,b[14],3275163606,9),A=fnG(A,E,w,_,b[3],4107603335,14),_=fnG(_,A,E,w,b[8],1163531501,20),w=fnG(w,_,A,E,b[13],2850285829,5),E=fnG(E,w,_,A,b[2],4243563512,9),A=fnG(A,E,w,_,b[7],1735328473,14),_=fnG(_,A,E,w,b[12],2368359562,20),w=fnH(w,_,A,E,b[5],4294588738,4),E=fnH(E,w,_,A,b[8],2272392833,11),A=fnH(A,E,w,_,b[11],1839030562,16),_=fnH(_,A,E,w,b[14],4259657740,23),w=fnH(w,_,A,E,b[1],2763975236,4),E=fnH(E,w,_,A,b[4],1272893353,11),A=fnH(A,E,w,_,b[7],4139469664,16),_=fnH(_,A,E,w,b[10],3200236656,23),w=fnH(w,_,A,E,b[13],681279174,4),E=fnH(E,w,_,A,b[0],3936430074,11),A=fnH(A,E,w,_,b[3],3572445317,16),_=fnH(_,A,E,w,b[6],76029189,23),w=fnH(w,_,A,E,b[9],3654602809,4),E=fnH(E,w,_,A,b[12],3873151461,11),A=fnH(A,E,w,_,b[15],530742520,16),_=fnH(_,A,E,w,b[2],3299628645,23),w=fnI(w,_,A,E,b[0],4096336452,6),E=fnI(E,w,_,A,b[7],1126891415,10),A=fnI(A,E,w,_,b[14],2878612391,15),_=fnI(_,A,E,w,b[5],4237533241,21),w=fnI(w,_,A,E,b[12],1700485571,6),E=fnI(E,w,_,A,b[3],2399980690,10),A=fnI(A,E,w,_,b[10],4293915773,15),_=fnI(_,A,E,w,b[1],2240044497,21),w=fnI(w,_,A,E,b[8],1873313359,6),E=fnI(E,w,_,A,b[15],4264355552,10),A=fnI(A,E,w,_,b[6],2734768916,15),_=fnI(_,A,E,w,b[13],1309151649,21),w=fnI(w,_,A,E,b[4],4149444226,6),E=fnI(E,w,_,A,b[11],3174756917,10),A=fnI(A,E,w,_,b[2],718787259,15),_=fnI(_,A,E,w,b[9],3951481745,21),this._a=this._a+w|0,this._b=this._b+_|0,this._c=this._c+A|0,this._d=this._d+E|0};MD5$3.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var b=Buffer$z.allocUnsafe(16);return b.writeInt32LE(this._a,0),b.writeInt32LE(this._b,4),b.writeInt32LE(this._c,8),b.writeInt32LE(this._d,12),b};function rotl$1(b,v){return b<<v|b>>>32-v}function fnF(b,v,w,_,A,E,k){return rotl$1(b+(v&w|~v&_)+A+E|0,k)+v|0}function fnG(b,v,w,_,A,E,k){return rotl$1(b+(v&_|w&~_)+A+E|0,k)+v|0}function fnH(b,v,w,_,A,E,k){return rotl$1(b+(v^w^_)+A+E|0,k)+v|0}function fnI(b,v,w,_,A,E,k){return rotl$1(b+(w^(v|~_))+A+E|0,k)+v|0}var md5_js=MD5$3,Buffer$y=require$$1$2.Buffer,inherits$o=inherits_browserExports,HashBase=hashBase,ARRAY16=new Array(16),zl=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],zr=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],sl=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],sr=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],hl=[0,1518500249,1859775393,2400959708,2840853838],hr=[1352829926,1548603684,1836072691,2053994217,0];function RIPEMD160$4(){HashBase.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}inherits$o(RIPEMD160$4,HashBase);RIPEMD160$4.prototype._update=function(){for(var b=ARRAY16,v=0;v<16;++v)b[v]=this._block.readInt32LE(v*4);for(var w=this._a|0,_=this._b|0,A=this._c|0,E=this._d|0,k=this._e|0,P=this._a|0,N=this._b|0,q=this._c|0,B=this._d|0,O=this._e|0,I=0;I<80;I+=1){var D,V;I<16?(D=fn1(w,_,A,E,k,b[zl[I]],hl[0],sl[I]),V=fn5(P,N,q,B,O,b[zr[I]],hr[0],sr[I])):I<32?(D=fn2(w,_,A,E,k,b[zl[I]],hl[1],sl[I]),V=fn4(P,N,q,B,O,b[zr[I]],hr[1],sr[I])):I<48?(D=fn3(w,_,A,E,k,b[zl[I]],hl[2],sl[I]),V=fn3(P,N,q,B,O,b[zr[I]],hr[2],sr[I])):I<64?(D=fn4(w,_,A,E,k,b[zl[I]],hl[3],sl[I]),V=fn2(P,N,q,B,O,b[zr[I]],hr[3],sr[I])):(D=fn5(w,_,A,E,k,b[zl[I]],hl[4],sl[I]),V=fn1(P,N,q,B,O,b[zr[I]],hr[4],sr[I])),w=k,k=E,E=rotl(A,10),A=_,_=D,P=O,O=B,B=rotl(q,10),q=N,N=V}var ee=this._b+A+B|0;this._b=this._c+E+O|0,this._c=this._d+k+P|0,this._d=this._e+w+N|0,this._e=this._a+_+q|0,this._a=ee};RIPEMD160$4.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var b=Buffer$y.alloc?Buffer$y.alloc(20):new Buffer$y(20);return b.writeInt32LE(this._a,0),b.writeInt32LE(this._b,4),b.writeInt32LE(this._c,8),b.writeInt32LE(this._d,12),b.writeInt32LE(this._e,16),b};function rotl(b,v){return b<<v|b>>>32-v}function fn1(b,v,w,_,A,E,k,P){return rotl(b+(v^w^_)+E+k|0,P)+A|0}function fn2(b,v,w,_,A,E,k,P){return rotl(b+(v&w|~v&_)+E+k|0,P)+A|0}function fn3(b,v,w,_,A,E,k,P){return rotl(b+((v|~w)^_)+E+k|0,P)+A|0}function fn4(b,v,w,_,A,E,k,P){return rotl(b+(v&_|w&~_)+E+k|0,P)+A|0}function fn5(b,v,w,_,A,E,k,P){return rotl(b+(v^(w|~_))+E+k|0,P)+A|0}var ripemd160=RIPEMD160$4,sha_js={exports:{}},Buffer$x=safeBufferExports$1.Buffer;function Hash$7(b,v){this._block=Buffer$x.alloc(b),this._finalSize=v,this._blockSize=b,this._len=0}Hash$7.prototype.update=function(b,v){typeof b=="string"&&(v=v||"utf8",b=Buffer$x.from(b,v));for(var w=this._block,_=this._blockSize,A=b.length,E=this._len,k=0;k<A;){for(var P=E%_,N=Math.min(A-k,_-P),q=0;q<N;q++)w[P+q]=b[k+q];E+=N,k+=N,E%_===0&&this._update(w)}return this._len+=A,this};Hash$7.prototype.digest=function(b){var v=this._len%this._blockSize;this._block[v]=128,this._block.fill(0,v+1),v>=this._finalSize&&(this._update(this._block),this._block.fill(0));var w=this._len*8;if(w<=4294967295)this._block.writeUInt32BE(w,this._blockSize-4);else{var _=(w&4294967295)>>>0,A=(w-_)/4294967296;this._block.writeUInt32BE(A,this._blockSize-8),this._block.writeUInt32BE(_,this._blockSize-4)}this._update(this._block);var E=this._hash();return b?E.toString(b):E};Hash$7.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var hash$3=Hash$7,inherits$n=inherits_browserExports,Hash$6=hash$3,Buffer$w=safeBufferExports$1.Buffer,K$4=[1518500249,1859775393,-1894007588,-899497514],W$5=new Array(80);function Sha(){this.init(),this._w=W$5,Hash$6.call(this,64,56)}inherits$n(Sha,Hash$6);Sha.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function rotl5$1(b){return b<<5|b>>>27}function rotl30$1(b){return b<<30|b>>>2}function ft$1(b,v,w,_){return b===0?v&w|~v&_:b===2?v&w|v&_|w&_:v^w^_}Sha.prototype._update=function(b){for(var v=this._w,w=this._a|0,_=this._b|0,A=this._c|0,E=this._d|0,k=this._e|0,P=0;P<16;++P)v[P]=b.readInt32BE(P*4);for(;P<80;++P)v[P]=v[P-3]^v[P-8]^v[P-14]^v[P-16];for(var N=0;N<80;++N){var q=~~(N/20),B=rotl5$1(w)+ft$1(q,_,A,E)+k+v[N]+K$4[q]|0;k=E,E=A,A=rotl30$1(_),_=w,w=B}this._a=w+this._a|0,this._b=_+this._b|0,this._c=A+this._c|0,this._d=E+this._d|0,this._e=k+this._e|0};Sha.prototype._hash=function(){var b=Buffer$w.allocUnsafe(20);return b.writeInt32BE(this._a|0,0),b.writeInt32BE(this._b|0,4),b.writeInt32BE(this._c|0,8),b.writeInt32BE(this._d|0,12),b.writeInt32BE(this._e|0,16),b};var sha$4=Sha,inherits$m=inherits_browserExports,Hash$5=hash$3,Buffer$v=safeBufferExports$1.Buffer,K$3=[1518500249,1859775393,-1894007588,-899497514],W$4=new Array(80);function Sha1(){this.init(),this._w=W$4,Hash$5.call(this,64,56)}inherits$m(Sha1,Hash$5);Sha1.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function rotl1(b){return b<<1|b>>>31}function rotl5(b){return b<<5|b>>>27}function rotl30(b){return b<<30|b>>>2}function ft(b,v,w,_){return b===0?v&w|~v&_:b===2?v&w|v&_|w&_:v^w^_}Sha1.prototype._update=function(b){for(var v=this._w,w=this._a|0,_=this._b|0,A=this._c|0,E=this._d|0,k=this._e|0,P=0;P<16;++P)v[P]=b.readInt32BE(P*4);for(;P<80;++P)v[P]=rotl1(v[P-3]^v[P-8]^v[P-14]^v[P-16]);for(var N=0;N<80;++N){var q=~~(N/20),B=rotl5(w)+ft(q,_,A,E)+k+v[N]+K$3[q]|0;k=E,E=A,A=rotl30(_),_=w,w=B}this._a=w+this._a|0,this._b=_+this._b|0,this._c=A+this._c|0,this._d=E+this._d|0,this._e=k+this._e|0};Sha1.prototype._hash=function(){var b=Buffer$v.allocUnsafe(20);return b.writeInt32BE(this._a|0,0),b.writeInt32BE(this._b|0,4),b.writeInt32BE(this._c|0,8),b.writeInt32BE(this._d|0,12),b.writeInt32BE(this._e|0,16),b};var sha1=Sha1,inherits$l=inherits_browserExports,Hash$4=hash$3,Buffer$u=safeBufferExports$1.Buffer,K$2=[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],W$3=new Array(64);function Sha256$1(){this.init(),this._w=W$3,Hash$4.call(this,64,56)}inherits$l(Sha256$1,Hash$4);Sha256$1.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function ch(b,v,w){return w^b&(v^w)}function maj$1(b,v,w){return b&v|w&(b|v)}function sigma0$1(b){return(b>>>2|b<<30)^(b>>>13|b<<19)^(b>>>22|b<<10)}function sigma1$1(b){return(b>>>6|b<<26)^(b>>>11|b<<21)^(b>>>25|b<<7)}function gamma0(b){return(b>>>7|b<<25)^(b>>>18|b<<14)^b>>>3}function gamma1(b){return(b>>>17|b<<15)^(b>>>19|b<<13)^b>>>10}Sha256$1.prototype._update=function(b){for(var v=this._w,w=this._a|0,_=this._b|0,A=this._c|0,E=this._d|0,k=this._e|0,P=this._f|0,N=this._g|0,q=this._h|0,B=0;B<16;++B)v[B]=b.readInt32BE(B*4);for(;B<64;++B)v[B]=gamma1(v[B-2])+v[B-7]+gamma0(v[B-15])+v[B-16]|0;for(var O=0;O<64;++O){var I=q+sigma1$1(k)+ch(k,P,N)+K$2[O]+v[O]|0,D=sigma0$1(w)+maj$1(w,_,A)|0;q=N,N=P,P=k,k=E+I|0,E=A,A=_,_=w,w=I+D|0}this._a=w+this._a|0,this._b=_+this._b|0,this._c=A+this._c|0,this._d=E+this._d|0,this._e=k+this._e|0,this._f=P+this._f|0,this._g=N+this._g|0,this._h=q+this._h|0};Sha256$1.prototype._hash=function(){var b=Buffer$u.allocUnsafe(32);return b.writeInt32BE(this._a,0),b.writeInt32BE(this._b,4),b.writeInt32BE(this._c,8),b.writeInt32BE(this._d,12),b.writeInt32BE(this._e,16),b.writeInt32BE(this._f,20),b.writeInt32BE(this._g,24),b.writeInt32BE(this._h,28),b};var sha256$1=Sha256$1,inherits$k=inherits_browserExports,Sha256=sha256$1,Hash$3=hash$3,Buffer$t=safeBufferExports$1.Buffer,W$2=new Array(64);function Sha224(){this.init(),this._w=W$2,Hash$3.call(this,64,56)}inherits$k(Sha224,Sha256);Sha224.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};Sha224.prototype._hash=function(){var b=Buffer$t.allocUnsafe(28);return b.writeInt32BE(this._a,0),b.writeInt32BE(this._b,4),b.writeInt32BE(this._c,8),b.writeInt32BE(this._d,12),b.writeInt32BE(this._e,16),b.writeInt32BE(this._f,20),b.writeInt32BE(this._g,24),b};var sha224$1=Sha224,inherits$j=inherits_browserExports,Hash$2=hash$3,Buffer$s=safeBufferExports$1.Buffer,K$1=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],W$1=new Array(160);function Sha512(){this.init(),this._w=W$1,Hash$2.call(this,128,112)}inherits$j(Sha512,Hash$2);Sha512.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function Ch(b,v,w){return w^b&(v^w)}function maj(b,v,w){return b&v|w&(b|v)}function sigma0(b,v){return(b>>>28|v<<4)^(v>>>2|b<<30)^(v>>>7|b<<25)}function sigma1(b,v){return(b>>>14|v<<18)^(b>>>18|v<<14)^(v>>>9|b<<23)}function Gamma0(b,v){return(b>>>1|v<<31)^(b>>>8|v<<24)^b>>>7}function Gamma0l(b,v){return(b>>>1|v<<31)^(b>>>8|v<<24)^(b>>>7|v<<25)}function Gamma1(b,v){return(b>>>19|v<<13)^(v>>>29|b<<3)^b>>>6}function Gamma1l(b,v){return(b>>>19|v<<13)^(v>>>29|b<<3)^(b>>>6|v<<26)}function getCarry(b,v){return b>>>0<v>>>0?1:0}Sha512.prototype._update=function(b){for(var v=this._w,w=this._ah|0,_=this._bh|0,A=this._ch|0,E=this._dh|0,k=this._eh|0,P=this._fh|0,N=this._gh|0,q=this._hh|0,B=this._al|0,O=this._bl|0,I=this._cl|0,D=this._dl|0,V=this._el|0,ee=this._fl|0,J=this._gl|0,te=this._hl|0,se=0;se<32;se+=2)v[se]=b.readInt32BE(se*4),v[se+1]=b.readInt32BE(se*4+4);for(;se<160;se+=2){var ce=v[se-30],ae=v[se-15*2+1],he=Gamma0(ce,ae),oe=Gamma0l(ae,ce);ce=v[se-2*2],ae=v[se-2*2+1];var de=Gamma1(ce,ae),le=Gamma1l(ae,ce),be=v[se-7*2],pe=v[se-7*2+1],fe=v[se-16*2],Z=v[se-16*2+1],U=oe+pe|0,S=he+be+getCarry(U,oe)|0;U=U+le|0,S=S+de+getCarry(U,le)|0,U=U+Z|0,S=S+fe+getCarry(U,Z)|0,v[se]=S,v[se+1]=U}for(var C=0;C<160;C+=2){S=v[C],U=v[C+1];var F=maj(w,_,A),X=maj(B,O,I),re=sigma0(w,B),ie=sigma0(B,w),Q=sigma1(k,V),ne=sigma1(V,k),L=K$1[C],ue=K$1[C+1],Ae=Ch(k,P,N),Re=Ch(V,ee,J),Pe=te+ne|0,xe=q+Q+getCarry(Pe,te)|0;Pe=Pe+Re|0,xe=xe+Ae+getCarry(Pe,Re)|0,Pe=Pe+ue|0,xe=xe+L+getCarry(Pe,ue)|0,Pe=Pe+U|0,xe=xe+S+getCarry(Pe,U)|0;var ge=ie+X|0,_e=re+F+getCarry(ge,ie)|0;q=N,te=J,N=P,J=ee,P=k,ee=V,V=D+Pe|0,k=E+xe+getCarry(V,D)|0,E=A,D=I,A=_,I=O,_=w,O=B,B=Pe+ge|0,w=xe+_e+getCarry(B,Pe)|0}this._al=this._al+B|0,this._bl=this._bl+O|0,this._cl=this._cl+I|0,this._dl=this._dl+D|0,this._el=this._el+V|0,this._fl=this._fl+ee|0,this._gl=this._gl+J|0,this._hl=this._hl+te|0,this._ah=this._ah+w+getCarry(this._al,B)|0,this._bh=this._bh+_+getCarry(this._bl,O)|0,this._ch=this._ch+A+getCarry(this._cl,I)|0,this._dh=this._dh+E+getCarry(this._dl,D)|0,this._eh=this._eh+k+getCarry(this._el,V)|0,this._fh=this._fh+P+getCarry(this._fl,ee)|0,this._gh=this._gh+N+getCarry(this._gl,J)|0,this._hh=this._hh+q+getCarry(this._hl,te)|0};Sha512.prototype._hash=function(){var b=Buffer$s.allocUnsafe(64);function v(w,_,A){b.writeInt32BE(w,A),b.writeInt32BE(_,A+4)}return v(this._ah,this._al,0),v(this._bh,this._bl,8),v(this._ch,this._cl,16),v(this._dh,this._dl,24),v(this._eh,this._el,32),v(this._fh,this._fl,40),v(this._gh,this._gl,48),v(this._hh,this._hl,56),b};var sha512$1=Sha512,inherits$i=inherits_browserExports,SHA512$2=sha512$1,Hash$1=hash$3,Buffer$r=safeBufferExports$1.Buffer,W=new Array(160);function Sha384(){this.init(),this._w=W,Hash$1.call(this,128,112)}inherits$i(Sha384,SHA512$2);Sha384.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};Sha384.prototype._hash=function(){var b=Buffer$r.allocUnsafe(48);function v(w,_,A){b.writeInt32BE(w,A),b.writeInt32BE(_,A+4)}return v(this._ah,this._al,0),v(this._bh,this._bl,8),v(this._ch,this._cl,16),v(this._dh,this._dl,24),v(this._eh,this._el,32),v(this._fh,this._fl,40),b};var sha384$1=Sha384,exports$1=sha_js.exports=function(v){v=v.toLowerCase();var w=exports$1[v];if(!w)throw new Error(v+" is not supported (we accept pull requests)");return new w};exports$1.sha=sha$4;exports$1.sha1=sha1;exports$1.sha224=sha224$1;exports$1.sha256=sha256$1;exports$1.sha384=sha384$1;exports$1.sha512=sha512$1;var sha_jsExports=sha_js.exports,streamBrowserify=Stream,EE=eventsExports.EventEmitter,inherits$h=inherits_browserExports;inherits$h(Stream,EE);Stream.Readable=require_stream_readable$1();Stream.Writable=require_stream_writable$1();Stream.Duplex=require_stream_duplex$1();Stream.Transform=require_stream_transform();Stream.PassThrough=require_stream_passthrough();Stream.finished=requireEndOfStream();Stream.pipeline=requirePipeline();Stream.Stream=Stream;function Stream(){EE.call(this)}Stream.prototype.pipe=function(b,v){var w=this;function _(B){b.writable&&b.write(B)===!1&&w.pause&&w.pause()}w.on("data",_);function A(){w.readable&&w.resume&&w.resume()}b.on("drain",A),!b._isStdio&&(!v||v.end!==!1)&&(w.on("end",k),w.on("close",P));var E=!1;function k(){E||(E=!0,b.end())}function P(){E||(E=!0,typeof b.destroy=="function"&&b.destroy())}function N(B){if(q(),EE.listenerCount(this,"error")===0)throw B}w.on("error",N),b.on("error",N);function q(){w.removeListener("data",_),b.removeListener("drain",A),w.removeListener("end",k),w.removeListener("close",P),w.removeListener("error",N),b.removeListener("error",N),w.removeListener("end",q),w.removeListener("close",q),b.removeListener("close",q)}return w.on("end",q),w.on("close",q),b.on("close",q),b.emit("pipe",w),b};var Buffer$q=safeBufferExports$1.Buffer,Transform$6=streamBrowserify.Transform,StringDecoder=string_decoder.StringDecoder,inherits$g=inherits_browserExports;function CipherBase$1(b){Transform$6.call(this),this.hashMode=typeof b=="string",this.hashMode?this[b]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}inherits$g(CipherBase$1,Transform$6);CipherBase$1.prototype.update=function(b,v,w){typeof b=="string"&&(b=Buffer$q.from(b,v));var _=this._update(b);return this.hashMode?this:(w&&(_=this._toString(_,w)),_)};CipherBase$1.prototype.setAutoPadding=function(){};CipherBase$1.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")};CipherBase$1.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")};CipherBase$1.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")};CipherBase$1.prototype._transform=function(b,v,w){var _;try{this.hashMode?this._update(b):this.push(this._update(b))}catch(A){_=A}finally{w(_)}};CipherBase$1.prototype._flush=function(b){var v;try{this.push(this.__final())}catch(w){v=w}b(v)};CipherBase$1.prototype._finalOrDigest=function(b){var v=this.__final()||Buffer$q.alloc(0);return b&&(v=this._toString(v,b,!0)),v};CipherBase$1.prototype._toString=function(b,v,w){if(this._decoder||(this._decoder=new StringDecoder(v),this._encoding=v),this._encoding!==v)throw new Error("can't switch encodings");var _=this._decoder.write(b);return w&&(_+=this._decoder.end()),_};var cipherBase=CipherBase$1,inherits$f=inherits_browserExports,MD5$2=md5_js,RIPEMD160$3=ripemd160,sha$3=sha_jsExports,Base$5=cipherBase;function Hash(b){Base$5.call(this,"digest"),this._hash=b}inherits$f(Hash,Base$5);Hash.prototype._update=function(b){this._hash.update(b)};Hash.prototype._final=function(){return this._hash.digest()};var browser$9=function(v){return v=v.toLowerCase(),v==="md5"?new MD5$2:v==="rmd160"||v==="ripemd160"?new RIPEMD160$3:new Hash(sha$3(v))},inherits$e=inherits_browserExports,Buffer$p=safeBufferExports$1.Buffer,Base$4=cipherBase,ZEROS$2=Buffer$p.alloc(128),blocksize=64;function Hmac$3(b,v){Base$4.call(this,"digest"),typeof v=="string"&&(v=Buffer$p.from(v)),this._alg=b,this._key=v,v.length>blocksize?v=b(v):v.length<blocksize&&(v=Buffer$p.concat([v,ZEROS$2],blocksize));for(var w=this._ipad=Buffer$p.allocUnsafe(blocksize),_=this._opad=Buffer$p.allocUnsafe(blocksize),A=0;A<blocksize;A++)w[A]=v[A]^54,_[A]=v[A]^92;this._hash=[w]}inherits$e(Hmac$3,Base$4);Hmac$3.prototype._update=function(b){this._hash.push(b)};Hmac$3.prototype._final=function(){var b=this._alg(Buffer$p.concat(this._hash));return this._alg(Buffer$p.concat([this._opad,b]))};var legacy=Hmac$3,MD5$1=md5_js,md5$2=function(b){return new MD5$1().update(b).digest()},inherits$d=inherits_browserExports,Legacy=legacy,Base$3=cipherBase,Buffer$o=safeBufferExports$1.Buffer,md5$1=md5$2,RIPEMD160$2=ripemd160,sha$2=sha_jsExports,ZEROS$1=Buffer$o.alloc(128);function Hmac$2(b,v){Base$3.call(this,"digest"),typeof v=="string"&&(v=Buffer$o.from(v));var w=b==="sha512"||b==="sha384"?128:64;if(this._alg=b,this._key=v,v.length>w){var _=b==="rmd160"?new RIPEMD160$2:sha$2(b);v=_.update(v).digest()}else v.length<w&&(v=Buffer$o.concat([v,ZEROS$1],w));for(var A=this._ipad=Buffer$o.allocUnsafe(w),E=this._opad=Buffer$o.allocUnsafe(w),k=0;k<w;k++)A[k]=v[k]^54,E[k]=v[k]^92;this._hash=b==="rmd160"?new RIPEMD160$2:sha$2(b),this._hash.update(A)}inherits$d(Hmac$2,Base$3);Hmac$2.prototype._update=function(b){this._hash.update(b)};Hmac$2.prototype._final=function(){var b=this._hash.digest(),v=this._alg==="rmd160"?new RIPEMD160$2:sha$2(this._alg);return v.update(this._opad).update(b).digest()};var browser$8=function(v,w){return v=v.toLowerCase(),v==="rmd160"||v==="ripemd160"?new Hmac$2("rmd160",w):v==="md5"?new Legacy(md5$1,w):new Hmac$2(v,w)};const sha224WithRSAEncryption={sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption={sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption={sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption={sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},sha256={sign:"ecdsa",hash:"sha256",id:""},sha224={sign:"ecdsa",hash:"sha224",id:""},sha384={sign:"ecdsa",hash:"sha384",id:""},sha512={sign:"ecdsa",hash:"sha512",id:""},DSA={sign:"dsa",hash:"sha1",id:""},ripemd160WithRSA={sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption={sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},require$$6={sha224WithRSAEncryption,"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption,"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption,"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption,"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256,sha224,sha384,sha512,"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA,"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA,"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption,"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}};var algos=require$$6,browser$7={},MAX_ALLOC=Math.pow(2,30)-1,precondition=function(b,v){if(typeof b!="number")throw new TypeError("Iterations not a number");if(b<0)throw new TypeError("Bad iterations");if(typeof v!="number")throw new TypeError("Key length not a number");if(v<0||v>MAX_ALLOC||v!==v)throw new TypeError("Bad key length")},defaultEncoding$2;if(commonjsGlobal.process&&commonjsGlobal.process.browser)defaultEncoding$2="utf-8";else if(commonjsGlobal.process&&commonjsGlobal.process.version){var pVersionMajor=parseInt(process$1.version.split(".")[0].slice(1),10);defaultEncoding$2=pVersionMajor>=6?"utf-8":"binary"}else defaultEncoding$2="utf-8";var defaultEncoding_1=defaultEncoding$2,Buffer$n=safeBufferExports$1.Buffer,toBuffer$2=function(b,v,w){if(Buffer$n.isBuffer(b))return b;if(typeof b=="string")return Buffer$n.from(b,v);if(ArrayBuffer.isView(b))return Buffer$n.from(b.buffer);throw new TypeError(w+" must be a string, a Buffer, a typed array or a DataView")},md5=md5$2,RIPEMD160$1=ripemd160,sha$1=sha_jsExports,Buffer$m=safeBufferExports$1.Buffer,checkParameters$1=precondition,defaultEncoding$1=defaultEncoding_1,toBuffer$1=toBuffer$2,ZEROS=Buffer$m.alloc(128),sizes={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function Hmac$1(b,v,w){var _=getDigest(b),A=b==="sha512"||b==="sha384"?128:64;v.length>A?v=_(v):v.length<A&&(v=Buffer$m.concat([v,ZEROS],A));for(var E=Buffer$m.allocUnsafe(A+sizes[b]),k=Buffer$m.allocUnsafe(A+sizes[b]),P=0;P<A;P++)E[P]=v[P]^54,k[P]=v[P]^92;var N=Buffer$m.allocUnsafe(A+w+4);E.copy(N,0,0,A),this.ipad1=N,this.ipad2=E,this.opad=k,this.alg=b,this.blocksize=A,this.hash=_,this.size=sizes[b]}Hmac$1.prototype.run=function(b,v){b.copy(v,this.blocksize);var w=this.hash(v);return w.copy(this.opad,this.blocksize),this.hash(this.opad)};function getDigest(b){function v(_){return sha$1(b).update(_).digest()}function w(_){return new RIPEMD160$1().update(_).digest()}return b==="rmd160"||b==="ripemd160"?w:b==="md5"?md5:v}function pbkdf2(b,v,w,_,A){checkParameters$1(w,_),b=toBuffer$1(b,defaultEncoding$1,"Password"),v=toBuffer$1(v,defaultEncoding$1,"Salt"),A=A||"sha1";var E=new Hmac$1(A,b,v.length),k=Buffer$m.allocUnsafe(_),P=Buffer$m.allocUnsafe(v.length+4);v.copy(P,0,0,v.length);for(var N=0,q=sizes[A],B=Math.ceil(_/q),O=1;O<=B;O++){P.writeUInt32BE(O,v.length);for(var I=E.run(P,E.ipad1),D=I,V=1;V<w;V++){D=E.run(D,E.ipad2);for(var ee=0;ee<q;ee++)I[ee]^=D[ee]}I.copy(k,N),N+=q}return k}var syncBrowser=pbkdf2,Buffer$l=safeBufferExports$1.Buffer,checkParameters=precondition,defaultEncoding=defaultEncoding_1,sync=syncBrowser,toBuffer=toBuffer$2,ZERO_BUF,subtle=commonjsGlobal.crypto&&commonjsGlobal.crypto.subtle,toBrowser={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},checks=[];function checkNative(b){if(commonjsGlobal.process&&!commonjsGlobal.process.browser||!subtle||!subtle.importKey||!subtle.deriveBits)return Promise.resolve(!1);if(checks[b]!==void 0)return checks[b];ZERO_BUF=ZERO_BUF||Buffer$l.alloc(8);var v=browserPbkdf2(ZERO_BUF,ZERO_BUF,10,128,b).then(function(){return!0}).catch(function(){return!1});return checks[b]=v,v}var nextTick$1;function getNextTick(){return nextTick$1||(commonjsGlobal.process&&commonjsGlobal.process.nextTick?nextTick$1=commonjsGlobal.process.nextTick:commonjsGlobal.queueMicrotask?nextTick$1=commonjsGlobal.queueMicrotask:commonjsGlobal.setImmediate?nextTick$1=commonjsGlobal.setImmediate:nextTick$1=commonjsGlobal.setTimeout,nextTick$1)}function browserPbkdf2(b,v,w,_,A){return subtle.importKey("raw",b,{name:"PBKDF2"},!1,["deriveBits"]).then(function(E){return subtle.deriveBits({name:"PBKDF2",salt:v,iterations:w,hash:{name:A}},E,_<<3)}).then(function(E){return Buffer$l.from(E)})}function resolvePromise(b,v){b.then(function(w){getNextTick()(function(){v(null,w)})},function(w){getNextTick()(function(){v(w)})})}var async=function(b,v,w,_,A,E){typeof A=="function"&&(E=A,A=void 0),A=A||"sha1";var k=toBrowser[A.toLowerCase()];if(!k||typeof commonjsGlobal.Promise!="function"){getNextTick()(function(){var P;try{P=sync(b,v,w,_,A)}catch(N){return E(N)}E(null,P)});return}if(checkParameters(w,_),b=toBuffer(b,defaultEncoding,"Password"),v=toBuffer(v,defaultEncoding,"Salt"),typeof E!="function")throw new Error("No callback provided to pbkdf2");resolvePromise(checkNative(k).then(function(P){return P?browserPbkdf2(b,v,w,_,k):sync(b,v,w,_,A)}),E)};browser$7.pbkdf2=async;browser$7.pbkdf2Sync=syncBrowser;var browser$6={},des$2={},utils$n={};utils$n.readUInt32BE=function(v,w){var _=v[0+w]<<24|v[1+w]<<16|v[2+w]<<8|v[3+w];return _>>>0};utils$n.writeUInt32BE=function(v,w,_){v[0+_]=w>>>24,v[1+_]=w>>>16&255,v[2+_]=w>>>8&255,v[3+_]=w&255};utils$n.ip=function(v,w,_,A){for(var E=0,k=0,P=6;P>=0;P-=2){for(var N=0;N<=24;N+=8)E<<=1,E|=w>>>N+P&1;for(var N=0;N<=24;N+=8)E<<=1,E|=v>>>N+P&1}for(var P=6;P>=0;P-=2){for(var N=1;N<=25;N+=8)k<<=1,k|=w>>>N+P&1;for(var N=1;N<=25;N+=8)k<<=1,k|=v>>>N+P&1}_[A+0]=E>>>0,_[A+1]=k>>>0};utils$n.rip=function(v,w,_,A){for(var E=0,k=0,P=0;P<4;P++)for(var N=24;N>=0;N-=8)E<<=1,E|=w>>>N+P&1,E<<=1,E|=v>>>N+P&1;for(var P=4;P<8;P++)for(var N=24;N>=0;N-=8)k<<=1,k|=w>>>N+P&1,k<<=1,k|=v>>>N+P&1;_[A+0]=E>>>0,_[A+1]=k>>>0};utils$n.pc1=function(v,w,_,A){for(var E=0,k=0,P=7;P>=5;P--){for(var N=0;N<=24;N+=8)E<<=1,E|=w>>N+P&1;for(var N=0;N<=24;N+=8)E<<=1,E|=v>>N+P&1}for(var N=0;N<=24;N+=8)E<<=1,E|=w>>N+P&1;for(var P=1;P<=3;P++){for(var N=0;N<=24;N+=8)k<<=1,k|=w>>N+P&1;for(var N=0;N<=24;N+=8)k<<=1,k|=v>>N+P&1}for(var N=0;N<=24;N+=8)k<<=1,k|=v>>N+P&1;_[A+0]=E>>>0,_[A+1]=k>>>0};utils$n.r28shl=function(v,w){return v<<w&268435455|v>>>28-w};var pc2table=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];utils$n.pc2=function(v,w,_,A){for(var E=0,k=0,P=pc2table.length>>>1,N=0;N<P;N++)E<<=1,E|=v>>>pc2table[N]&1;for(var N=P;N<pc2table.length;N++)k<<=1,k|=w>>>pc2table[N]&1;_[A+0]=E>>>0,_[A+1]=k>>>0};utils$n.expand=function(v,w,_){var A=0,E=0;A=(v&1)<<5|v>>>27;for(var k=23;k>=15;k-=4)A<<=6,A|=v>>>k&63;for(var k=11;k>=3;k-=4)E|=v>>>k&63,E<<=6;E|=(v&31)<<1|v>>>31,w[_+0]=A>>>0,w[_+1]=E>>>0};var sTable=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];utils$n.substitute=function(v,w){for(var _=0,A=0;A<4;A++){var E=v>>>18-A*6&63,k=sTable[A*64+E];_<<=4,_|=k}for(var A=0;A<4;A++){var E=w>>>18-A*6&63,k=sTable[4*64+A*64+E];_<<=4,_|=k}return _>>>0};var permuteTable=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];utils$n.permute=function(v){for(var w=0,_=0;_<permuteTable.length;_++)w<<=1,w|=v>>>permuteTable[_]&1;return w>>>0};utils$n.padSplit=function(v,w,_){for(var A=v.toString(2);A.length<w;)A="0"+A;for(var E=[],k=0;k<w;k+=_)E.push(A.slice(k,k+_));return E.join(" ")};var minimalisticAssert=assert$k;function assert$k(b,v){if(!b)throw new Error(v||"Assertion failed")}assert$k.equal=function(v,w,_){if(v!=w)throw new Error(_||"Assertion failed: "+v+" != "+w)};var assert$j=minimalisticAssert;function Cipher$3(b){this.options=b,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=b.padding!==!1}var cipher=Cipher$3;Cipher$3.prototype._init=function(){};Cipher$3.prototype.update=function(v){return v.length===0?[]:this.type==="decrypt"?this._updateDecrypt(v):this._updateEncrypt(v)};Cipher$3.prototype._buffer=function(v,w){for(var _=Math.min(this.buffer.length-this.bufferOff,v.length-w),A=0;A<_;A++)this.buffer[this.bufferOff+A]=v[w+A];return this.bufferOff+=_,_};Cipher$3.prototype._flushBuffer=function(v,w){return this._update(this.buffer,0,v,w),this.bufferOff=0,this.blockSize};Cipher$3.prototype._updateEncrypt=function(v){var w=0,_=0,A=(this.bufferOff+v.length)/this.blockSize|0,E=new Array(A*this.blockSize);this.bufferOff!==0&&(w+=this._buffer(v,w),this.bufferOff===this.buffer.length&&(_+=this._flushBuffer(E,_)));for(var k=v.length-(v.length-w)%this.blockSize;w<k;w+=this.blockSize)this._update(v,w,E,_),_+=this.blockSize;for(;w<v.length;w++,this.bufferOff++)this.buffer[this.bufferOff]=v[w];return E};Cipher$3.prototype._updateDecrypt=function(v){for(var w=0,_=0,A=Math.ceil((this.bufferOff+v.length)/this.blockSize)-1,E=new Array(A*this.blockSize);A>0;A--)w+=this._buffer(v,w),_+=this._flushBuffer(E,_);return w+=this._buffer(v,w),E};Cipher$3.prototype.final=function(v){var w;v&&(w=this.update(v));var _;return this.type==="encrypt"?_=this._finalEncrypt():_=this._finalDecrypt(),w?w.concat(_):_};Cipher$3.prototype._pad=function(v,w){if(w===0)return!1;for(;w<v.length;)v[w++]=0;return!0};Cipher$3.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var v=new Array(this.blockSize);return this._update(this.buffer,0,v,0),v};Cipher$3.prototype._unpad=function(v){return v};Cipher$3.prototype._finalDecrypt=function(){assert$j.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var v=new Array(this.blockSize);return this._flushBuffer(v,0),this._unpad(v)};var assert$i=minimalisticAssert,inherits$c=inherits_browserExports,utils$m=utils$n,Cipher$2=cipher;function DESState(){this.tmp=new Array(2),this.keys=null}function DES$3(b){Cipher$2.call(this,b);var v=new DESState;this._desState=v,this.deriveKeys(v,b.key)}inherits$c(DES$3,Cipher$2);var des$1=DES$3;DES$3.create=function(v){return new DES$3(v)};var shiftTable=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];DES$3.prototype.deriveKeys=function(v,w){v.keys=new Array(16*2),assert$i.equal(w.length,this.blockSize,"Invalid key length");var _=utils$m.readUInt32BE(w,0),A=utils$m.readUInt32BE(w,4);utils$m.pc1(_,A,v.tmp,0),_=v.tmp[0],A=v.tmp[1];for(var E=0;E<v.keys.length;E+=2){var k=shiftTable[E>>>1];_=utils$m.r28shl(_,k),A=utils$m.r28shl(A,k),utils$m.pc2(_,A,v.keys,E)}};DES$3.prototype._update=function(v,w,_,A){var E=this._desState,k=utils$m.readUInt32BE(v,w),P=utils$m.readUInt32BE(v,w+4);utils$m.ip(k,P,E.tmp,0),k=E.tmp[0],P=E.tmp[1],this.type==="encrypt"?this._encrypt(E,k,P,E.tmp,0):this._decrypt(E,k,P,E.tmp,0),k=E.tmp[0],P=E.tmp[1],utils$m.writeUInt32BE(_,k,A),utils$m.writeUInt32BE(_,P,A+4)};DES$3.prototype._pad=function(v,w){if(this.padding===!1)return!1;for(var _=v.length-w,A=w;A<v.length;A++)v[A]=_;return!0};DES$3.prototype._unpad=function(v){if(this.padding===!1)return v;for(var w=v[v.length-1],_=v.length-w;_<v.length;_++)assert$i.equal(v[_],w);return v.slice(0,v.length-w)};DES$3.prototype._encrypt=function(v,w,_,A,E){for(var k=w,P=_,N=0;N<v.keys.length;N+=2){var q=v.keys[N],B=v.keys[N+1];utils$m.expand(P,v.tmp,0),q^=v.tmp[0],B^=v.tmp[1];var O=utils$m.substitute(q,B),I=utils$m.permute(O),D=P;P=(k^I)>>>0,k=D}utils$m.rip(P,k,A,E)};DES$3.prototype._decrypt=function(v,w,_,A,E){for(var k=_,P=w,N=v.keys.length-2;N>=0;N-=2){var q=v.keys[N],B=v.keys[N+1];utils$m.expand(k,v.tmp,0),q^=v.tmp[0],B^=v.tmp[1];var O=utils$m.substitute(q,B),I=utils$m.permute(O),D=k;k=(P^I)>>>0,P=D}utils$m.rip(k,P,A,E)};var cbc$1={},assert$h=minimalisticAssert,inherits$b=inherits_browserExports,proto={};function CBCState(b){assert$h.equal(b.length,8,"Invalid IV length"),this.iv=new Array(8);for(var v=0;v<this.iv.length;v++)this.iv[v]=b[v]}function instantiate(b){function v(E){b.call(this,E),this._cbcInit()}inherits$b(v,b);for(var w=Object.keys(proto),_=0;_<w.length;_++){var A=w[_];v.prototype[A]=proto[A]}return v.create=function(k){return new v(k)},v}cbc$1.instantiate=instantiate;proto._cbcInit=function(){var v=new CBCState(this.options.iv);this._cbcState=v};proto._update=function(v,w,_,A){var E=this._cbcState,k=this.constructor.super_.prototype,P=E.iv;if(this.type==="encrypt"){for(var N=0;N<this.blockSize;N++)P[N]^=v[w+N];k._update.call(this,P,0,_,A);for(var N=0;N<this.blockSize;N++)P[N]=_[A+N]}else{k._update.call(this,v,w,_,A);for(var N=0;N<this.blockSize;N++)_[A+N]^=P[N];for(var N=0;N<this.blockSize;N++)P[N]=v[w+N]}};var assert$g=minimalisticAssert,inherits$a=inherits_browserExports,Cipher$1=cipher,DES$2=des$1;function EDEState(b,v){assert$g.equal(v.length,24,"Invalid key length");var w=v.slice(0,8),_=v.slice(8,16),A=v.slice(16,24);b==="encrypt"?this.ciphers=[DES$2.create({type:"encrypt",key:w}),DES$2.create({type:"decrypt",key:_}),DES$2.create({type:"encrypt",key:A})]:this.ciphers=[DES$2.create({type:"decrypt",key:A}),DES$2.create({type:"encrypt",key:_}),DES$2.create({type:"decrypt",key:w})]}function EDE(b){Cipher$1.call(this,b);var v=new EDEState(this.type,this.options.key);this._edeState=v}inherits$a(EDE,Cipher$1);var ede=EDE;EDE.create=function(v){return new EDE(v)};EDE.prototype._update=function(v,w,_,A){var E=this._edeState;E.ciphers[0]._update(v,w,_,A),E.ciphers[1]._update(_,A,_,A),E.ciphers[2]._update(_,A,_,A)};EDE.prototype._pad=DES$2.prototype._pad;EDE.prototype._unpad=DES$2.prototype._unpad;des$2.utils=utils$n;des$2.Cipher=cipher;des$2.DES=des$1;des$2.CBC=cbc$1;des$2.EDE=ede;var CipherBase=cipherBase,des=des$2,inherits$9=inherits_browserExports,Buffer$k=safeBufferExports$1.Buffer,modes$3={"des-ede3-cbc":des.CBC.instantiate(des.EDE),"des-ede3":des.EDE,"des-ede-cbc":des.CBC.instantiate(des.EDE),"des-ede":des.EDE,"des-cbc":des.CBC.instantiate(des.DES),"des-ecb":des.DES};modes$3.des=modes$3["des-cbc"];modes$3.des3=modes$3["des-ede3-cbc"];var browserifyDes=DES$1;inherits$9(DES$1,CipherBase);function DES$1(b){CipherBase.call(this);var v=b.mode.toLowerCase(),w=modes$3[v],_;b.decrypt?_="decrypt":_="encrypt";var A=b.key;Buffer$k.isBuffer(A)||(A=Buffer$k.from(A)),(v==="des-ede"||v==="des-ede-cbc")&&(A=Buffer$k.concat([A,A.slice(0,8)]));var E=b.iv;Buffer$k.isBuffer(E)||(E=Buffer$k.from(E)),this._des=w.create({key:A,iv:E,type:_})}DES$1.prototype._update=function(b){return Buffer$k.from(this._des.update(b))};DES$1.prototype._final=function(){return Buffer$k.from(this._des.final())};var browser$5={},encrypter={},ecb={};ecb.encrypt=function(b,v){return b._cipher.encryptBlock(v)};ecb.decrypt=function(b,v){return b._cipher.decryptBlock(v)};var cbc={},bufferXor=function(v,w){for(var _=Math.min(v.length,w.length),A=new Buffer$D(_),E=0;E<_;++E)A[E]=v[E]^w[E];return A},xor$7=bufferXor;cbc.encrypt=function(b,v){var w=xor$7(v,b._prev);return b._prev=b._cipher.encryptBlock(w),b._prev};cbc.decrypt=function(b,v){var w=b._prev;b._prev=v;var _=b._cipher.decryptBlock(v);return xor$7(_,w)};var cfb={},Buffer$j=safeBufferExports$1.Buffer,xor$6=bufferXor;function encryptStart(b,v,w){var _=v.length,A=xor$6(v,b._cache);return b._cache=b._cache.slice(_),b._prev=Buffer$j.concat([b._prev,w?v:A]),A}cfb.encrypt=function(b,v,w){for(var _=Buffer$j.allocUnsafe(0),A;v.length;)if(b._cache.length===0&&(b._cache=b._cipher.encryptBlock(b._prev),b._prev=Buffer$j.allocUnsafe(0)),b._cache.length<=v.length)A=b._cache.length,_=Buffer$j.concat([_,encryptStart(b,v.slice(0,A),w)]),v=v.slice(A);else{_=Buffer$j.concat([_,encryptStart(b,v,w)]);break}return _};var cfb8={},Buffer$i=safeBufferExports$1.Buffer;function encryptByte$1(b,v,w){var _=b._cipher.encryptBlock(b._prev),A=_[0]^v;return b._prev=Buffer$i.concat([b._prev.slice(1),Buffer$i.from([w?v:A])]),A}cfb8.encrypt=function(b,v,w){for(var _=v.length,A=Buffer$i.allocUnsafe(_),E=-1;++E<_;)A[E]=encryptByte$1(b,v[E],w);return A};var cfb1={},Buffer$h=safeBufferExports$1.Buffer;function encryptByte(b,v,w){for(var _,A=-1,E=8,k=0,P,N;++A<E;)_=b._cipher.encryptBlock(b._prev),P=v&1<<7-A?128:0,N=_[0]^P,k+=(N&128)>>A%8,b._prev=shiftIn(b._prev,w?P:N);return k}function shiftIn(b,v){var w=b.length,_=-1,A=Buffer$h.allocUnsafe(b.length);for(b=Buffer$h.concat([b,Buffer$h.from([v])]);++_<w;)A[_]=b[_]<<1|b[_+1]>>7;return A}cfb1.encrypt=function(b,v,w){for(var _=v.length,A=Buffer$h.allocUnsafe(_),E=-1;++E<_;)A[E]=encryptByte(b,v[E],w);return A};var ofb={},xor$5=bufferXor;function getBlock$1(b){return b._prev=b._cipher.encryptBlock(b._prev),b._prev}ofb.encrypt=function(b,v){for(;b._cache.length<v.length;)b._cache=Buffer$D.concat([b._cache,getBlock$1(b)]);var w=b._cache.slice(0,v.length);return b._cache=b._cache.slice(v.length),xor$5(v,w)};var ctr={};function incr32$2(b){for(var v=b.length,w;v--;)if(w=b.readUInt8(v),w===255)b.writeUInt8(0,v);else{w++,b.writeUInt8(w,v);break}}var incr32_1=incr32$2,xor$4=bufferXor,Buffer$g=safeBufferExports$1.Buffer,incr32$1=incr32_1;function getBlock(b){var v=b._cipher.encryptBlockRaw(b._prev);return incr32$1(b._prev),v}var blockSize=16;ctr.encrypt=function(b,v){var w=Math.ceil(v.length/blockSize),_=b._cache.length;b._cache=Buffer$g.concat([b._cache,Buffer$g.allocUnsafe(w*blockSize)]);for(var A=0;A<w;A++){var E=getBlock(b),k=_+A*blockSize;b._cache.writeUInt32BE(E[0],k+0),b._cache.writeUInt32BE(E[1],k+4),b._cache.writeUInt32BE(E[2],k+8),b._cache.writeUInt32BE(E[3],k+12)}var P=b._cache.slice(0,v.length);return b._cache=b._cache.slice(v.length),xor$4(v,P)};const aes128={cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192={cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256={cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},require$$2={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128,aes192,aes256,"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}};var modeModules={ECB:ecb,CBC:cbc,CFB:cfb,CFB8:cfb8,CFB1:cfb1,OFB:ofb,CTR:ctr,GCM:ctr},modes$2=require$$2;for(var key$2 in modes$2)modes$2[key$2].module=modeModules[modes$2[key$2].mode];var modes_1=modes$2,aes$5={},Buffer$f=safeBufferExports$1.Buffer;function asUInt32Array(b){Buffer$f.isBuffer(b)||(b=Buffer$f.from(b));for(var v=b.length/4|0,w=new Array(v),_=0;_<v;_++)w[_]=b.readUInt32BE(_*4);return w}function scrubVec(b){for(var v=0;v<b.length;b++)b[v]=0}function cryptBlock(b,v,w,_,A){for(var E=w[0],k=w[1],P=w[2],N=w[3],q=b[0]^v[0],B=b[1]^v[1],O=b[2]^v[2],I=b[3]^v[3],D,V,ee,J,te=4,se=1;se<A;se++)D=E[q>>>24]^k[B>>>16&255]^P[O>>>8&255]^N[I&255]^v[te++],V=E[B>>>24]^k[O>>>16&255]^P[I>>>8&255]^N[q&255]^v[te++],ee=E[O>>>24]^k[I>>>16&255]^P[q>>>8&255]^N[B&255]^v[te++],J=E[I>>>24]^k[q>>>16&255]^P[B>>>8&255]^N[O&255]^v[te++],q=D,B=V,O=ee,I=J;return D=(_[q>>>24]<<24|_[B>>>16&255]<<16|_[O>>>8&255]<<8|_[I&255])^v[te++],V=(_[B>>>24]<<24|_[O>>>16&255]<<16|_[I>>>8&255]<<8|_[q&255])^v[te++],ee=(_[O>>>24]<<24|_[I>>>16&255]<<16|_[q>>>8&255]<<8|_[B&255])^v[te++],J=(_[I>>>24]<<24|_[q>>>16&255]<<16|_[B>>>8&255]<<8|_[O&255])^v[te++],D=D>>>0,V=V>>>0,ee=ee>>>0,J=J>>>0,[D,V,ee,J]}var RCON=[0,1,2,4,8,16,32,64,128,27,54],G$1=function(){for(var b=new Array(256),v=0;v<256;v++)v<128?b[v]=v<<1:b[v]=v<<1^283;for(var w=[],_=[],A=[[],[],[],[]],E=[[],[],[],[]],k=0,P=0,N=0;N<256;++N){var q=P^P<<1^P<<2^P<<3^P<<4;q=q>>>8^q&255^99,w[k]=q,_[q]=k;var B=b[k],O=b[B],I=b[O],D=b[q]*257^q*16843008;A[0][k]=D<<24|D>>>8,A[1][k]=D<<16|D>>>16,A[2][k]=D<<8|D>>>24,A[3][k]=D,D=I*16843009^O*65537^B*257^k*16843008,E[0][q]=D<<24|D>>>8,E[1][q]=D<<16|D>>>16,E[2][q]=D<<8|D>>>24,E[3][q]=D,k===0?k=P=1:(k=B^b[b[b[I^B]]],P^=b[b[P]])}return{SBOX:w,INV_SBOX:_,SUB_MIX:A,INV_SUB_MIX:E}}();function AES(b){this._key=asUInt32Array(b),this._reset()}AES.blockSize=4*4;AES.keySize=256/8;AES.prototype.blockSize=AES.blockSize;AES.prototype.keySize=AES.keySize;AES.prototype._reset=function(){for(var b=this._key,v=b.length,w=v+6,_=(w+1)*4,A=[],E=0;E<v;E++)A[E]=b[E];for(E=v;E<_;E++){var k=A[E-1];E%v===0?(k=k<<8|k>>>24,k=G$1.SBOX[k>>>24]<<24|G$1.SBOX[k>>>16&255]<<16|G$1.SBOX[k>>>8&255]<<8|G$1.SBOX[k&255],k^=RCON[E/v|0]<<24):v>6&&E%v===4&&(k=G$1.SBOX[k>>>24]<<24|G$1.SBOX[k>>>16&255]<<16|G$1.SBOX[k>>>8&255]<<8|G$1.SBOX[k&255]),A[E]=A[E-v]^k}for(var P=[],N=0;N<_;N++){var q=_-N,B=A[q-(N%4?0:4)];N<4||q<=4?P[N]=B:P[N]=G$1.INV_SUB_MIX[0][G$1.SBOX[B>>>24]]^G$1.INV_SUB_MIX[1][G$1.SBOX[B>>>16&255]]^G$1.INV_SUB_MIX[2][G$1.SBOX[B>>>8&255]]^G$1.INV_SUB_MIX[3][G$1.SBOX[B&255]]}this._nRounds=w,this._keySchedule=A,this._invKeySchedule=P};AES.prototype.encryptBlockRaw=function(b){return b=asUInt32Array(b),cryptBlock(b,this._keySchedule,G$1.SUB_MIX,G$1.SBOX,this._nRounds)};AES.prototype.encryptBlock=function(b){var v=this.encryptBlockRaw(b),w=Buffer$f.allocUnsafe(16);return w.writeUInt32BE(v[0],0),w.writeUInt32BE(v[1],4),w.writeUInt32BE(v[2],8),w.writeUInt32BE(v[3],12),w};AES.prototype.decryptBlock=function(b){b=asUInt32Array(b);var v=b[1];b[1]=b[3],b[3]=v;var w=cryptBlock(b,this._invKeySchedule,G$1.INV_SUB_MIX,G$1.INV_SBOX,this._nRounds),_=Buffer$f.allocUnsafe(16);return _.writeUInt32BE(w[0],0),_.writeUInt32BE(w[3],4),_.writeUInt32BE(w[2],8),_.writeUInt32BE(w[1],12),_};AES.prototype.scrub=function(){scrubVec(this._keySchedule),scrubVec(this._invKeySchedule),scrubVec(this._key)};aes$5.AES=AES;var Buffer$e=safeBufferExports$1.Buffer,ZEROES=Buffer$e.alloc(16,0);function toArray$1(b){return[b.readUInt32BE(0),b.readUInt32BE(4),b.readUInt32BE(8),b.readUInt32BE(12)]}function fromArray(b){var v=Buffer$e.allocUnsafe(16);return v.writeUInt32BE(b[0]>>>0,0),v.writeUInt32BE(b[1]>>>0,4),v.writeUInt32BE(b[2]>>>0,8),v.writeUInt32BE(b[3]>>>0,12),v}function GHASH$1(b){this.h=b,this.state=Buffer$e.alloc(16,0),this.cache=Buffer$e.allocUnsafe(0)}GHASH$1.prototype.ghash=function(b){for(var v=-1;++v<b.length;)this.state[v]^=b[v];this._multiply()};GHASH$1.prototype._multiply=function(){for(var b=toArray$1(this.h),v=[0,0,0,0],w,_,A,E=-1;++E<128;){for(_=(this.state[~~(E/8)]&1<<7-E%8)!==0,_&&(v[0]^=b[0],v[1]^=b[1],v[2]^=b[2],v[3]^=b[3]),A=(b[3]&1)!==0,w=3;w>0;w--)b[w]=b[w]>>>1|(b[w-1]&1)<<31;b[0]=b[0]>>>1,A&&(b[0]=b[0]^225<<24)}this.state=fromArray(v)};GHASH$1.prototype.update=function(b){this.cache=Buffer$e.concat([this.cache,b]);for(var v;this.cache.length>=16;)v=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(v)};GHASH$1.prototype.final=function(b,v){return this.cache.length&&this.ghash(Buffer$e.concat([this.cache,ZEROES],16)),this.ghash(fromArray([0,b,0,v])),this.state};var ghash=GHASH$1,aes$4=aes$5,Buffer$d=safeBufferExports$1.Buffer,Transform$5=cipherBase,inherits$8=inherits_browserExports,GHASH=ghash,xor$3=bufferXor,incr32=incr32_1;function xorTest(b,v){var w=0;b.length!==v.length&&w++;for(var _=Math.min(b.length,v.length),A=0;A<_;++A)w+=b[A]^v[A];return w}function calcIv(b,v,w){if(v.length===12)return b._finID=Buffer$d.concat([v,Buffer$d.from([0,0,0,1])]),Buffer$d.concat([v,Buffer$d.from([0,0,0,2])]);var _=new GHASH(w),A=v.length,E=A%16;_.update(v),E&&(E=16-E,_.update(Buffer$d.alloc(E,0))),_.update(Buffer$d.alloc(8,0));var k=A*8,P=Buffer$d.alloc(8);P.writeUIntBE(k,0,8),_.update(P),b._finID=_.state;var N=Buffer$d.from(b._finID);return incr32(N),N}function StreamCipher$3(b,v,w,_){Transform$5.call(this);var A=Buffer$d.alloc(4,0);this._cipher=new aes$4.AES(v);var E=this._cipher.encryptBlock(A);this._ghash=new GHASH(E),w=calcIv(this,w,E),this._prev=Buffer$d.from(w),this._cache=Buffer$d.allocUnsafe(0),this._secCache=Buffer$d.allocUnsafe(0),this._decrypt=_,this._alen=0,this._len=0,this._mode=b,this._authTag=null,this._called=!1}inherits$8(StreamCipher$3,Transform$5);StreamCipher$3.prototype._update=function(b){if(!this._called&&this._alen){var v=16-this._alen%16;v<16&&(v=Buffer$d.alloc(v,0),this._ghash.update(v))}this._called=!0;var w=this._mode.encrypt(this,b);return this._decrypt?this._ghash.update(b):this._ghash.update(w),this._len+=b.length,w};StreamCipher$3.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var b=xor$3(this._ghash.final(this._alen*8,this._len*8),this._cipher.encryptBlock(this._finID));if(this._decrypt&&xorTest(b,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=b,this._cipher.scrub()};StreamCipher$3.prototype.getAuthTag=function(){if(this._decrypt||!Buffer$d.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag};StreamCipher$3.prototype.setAuthTag=function(v){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=v};StreamCipher$3.prototype.setAAD=function(v){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(v),this._alen+=v.length};var authCipher=StreamCipher$3,aes$3=aes$5,Buffer$c=safeBufferExports$1.Buffer,Transform$4=cipherBase,inherits$7=inherits_browserExports;function StreamCipher$2(b,v,w,_){Transform$4.call(this),this._cipher=new aes$3.AES(v),this._prev=Buffer$c.from(w),this._cache=Buffer$c.allocUnsafe(0),this._secCache=Buffer$c.allocUnsafe(0),this._decrypt=_,this._mode=b}inherits$7(StreamCipher$2,Transform$4);StreamCipher$2.prototype._update=function(b){return this._mode.encrypt(this,b,this._decrypt)};StreamCipher$2.prototype._final=function(){this._cipher.scrub()};var streamCipher=StreamCipher$2,Buffer$b=safeBufferExports$1.Buffer,MD5=md5_js;function EVP_BytesToKey(b,v,w,_){if(Buffer$b.isBuffer(b)||(b=Buffer$b.from(b,"binary")),v&&(Buffer$b.isBuffer(v)||(v=Buffer$b.from(v,"binary")),v.length!==8))throw new RangeError("salt should be Buffer with 8 byte length");for(var A=w/8,E=Buffer$b.alloc(A),k=Buffer$b.alloc(_||0),P=Buffer$b.alloc(0);A>0||_>0;){var N=new MD5;N.update(P),N.update(b),v&&N.update(v),P=N.digest();var q=0;if(A>0){var B=E.length-A;q=Math.min(A,P.length),P.copy(E,B,0,q),A-=q}if(q<P.length&&_>0){var O=k.length-_,I=Math.min(_,P.length-q);P.copy(k,O,q,q+I),_-=I}}return P.fill(0),{key:E,iv:k}}var evp_bytestokey=EVP_BytesToKey,MODES$1=modes_1,AuthCipher$1=authCipher,Buffer$a=safeBufferExports$1.Buffer,StreamCipher$1=streamCipher,Transform$3=cipherBase,aes$2=aes$5,ebtk$2=evp_bytestokey,inherits$6=inherits_browserExports;function Cipher(b,v,w){Transform$3.call(this),this._cache=new Splitter$1,this._cipher=new aes$2.AES(v),this._prev=Buffer$a.from(w),this._mode=b,this._autopadding=!0}inherits$6(Cipher,Transform$3);Cipher.prototype._update=function(b){this._cache.add(b);for(var v,w,_=[];v=this._cache.get();)w=this._mode.encrypt(this,v),_.push(w);return Buffer$a.concat(_)};var PADDING=Buffer$a.alloc(16,16);Cipher.prototype._final=function(){var b=this._cache.flush();if(this._autopadding)return b=this._mode.encrypt(this,b),this._cipher.scrub(),b;if(!b.equals(PADDING))throw this._cipher.scrub(),new Error("data not multiple of block length")};Cipher.prototype.setAutoPadding=function(b){return this._autopadding=!!b,this};function Splitter$1(){this.cache=Buffer$a.allocUnsafe(0)}Splitter$1.prototype.add=function(b){this.cache=Buffer$a.concat([this.cache,b])};Splitter$1.prototype.get=function(){if(this.cache.length>15){var b=this.cache.slice(0,16);return this.cache=this.cache.slice(16),b}return null};Splitter$1.prototype.flush=function(){for(var b=16-this.cache.length,v=Buffer$a.allocUnsafe(b),w=-1;++w<b;)v.writeUInt8(b,w);return Buffer$a.concat([this.cache,v])};function createCipheriv$1(b,v,w){var _=MODES$1[b.toLowerCase()];if(!_)throw new TypeError("invalid suite type");if(typeof v=="string"&&(v=Buffer$a.from(v)),v.length!==_.key/8)throw new TypeError("invalid key length "+v.length);if(typeof w=="string"&&(w=Buffer$a.from(w)),_.mode!=="GCM"&&w.length!==_.iv)throw new TypeError("invalid iv length "+w.length);return _.type==="stream"?new StreamCipher$1(_.module,v,w):_.type==="auth"?new AuthCipher$1(_.module,v,w):new Cipher(_.module,v,w)}function createCipher$1(b,v){var w=MODES$1[b.toLowerCase()];if(!w)throw new TypeError("invalid suite type");var _=ebtk$2(v,!1,w.key,w.iv);return createCipheriv$1(b,_.key,_.iv)}encrypter.createCipheriv=createCipheriv$1;encrypter.createCipher=createCipher$1;var decrypter={},AuthCipher=authCipher,Buffer$9=safeBufferExports$1.Buffer,MODES=modes_1,StreamCipher=streamCipher,Transform$2=cipherBase,aes$1=aes$5,ebtk$1=evp_bytestokey,inherits$5=inherits_browserExports;function Decipher(b,v,w){Transform$2.call(this),this._cache=new Splitter,this._last=void 0,this._cipher=new aes$1.AES(v),this._prev=Buffer$9.from(w),this._mode=b,this._autopadding=!0}inherits$5(Decipher,Transform$2);Decipher.prototype._update=function(b){this._cache.add(b);for(var v,w,_=[];v=this._cache.get(this._autopadding);)w=this._mode.decrypt(this,v),_.push(w);return Buffer$9.concat(_)};Decipher.prototype._final=function(){var b=this._cache.flush();if(this._autopadding)return unpad(this._mode.decrypt(this,b));if(b)throw new Error("data not multiple of block length")};Decipher.prototype.setAutoPadding=function(b){return this._autopadding=!!b,this};function Splitter(){this.cache=Buffer$9.allocUnsafe(0)}Splitter.prototype.add=function(b){this.cache=Buffer$9.concat([this.cache,b])};Splitter.prototype.get=function(b){var v;if(b){if(this.cache.length>16)return v=this.cache.slice(0,16),this.cache=this.cache.slice(16),v}else if(this.cache.length>=16)return v=this.cache.slice(0,16),this.cache=this.cache.slice(16),v;return null};Splitter.prototype.flush=function(){if(this.cache.length)return this.cache};function unpad(b){var v=b[15];if(v<1||v>16)throw new Error("unable to decrypt data");for(var w=-1;++w<v;)if(b[w+(16-v)]!==v)throw new Error("unable to decrypt data");if(v!==16)return b.slice(0,16-v)}function createDecipheriv$1(b,v,w){var _=MODES[b.toLowerCase()];if(!_)throw new TypeError("invalid suite type");if(typeof w=="string"&&(w=Buffer$9.from(w)),_.mode!=="GCM"&&w.length!==_.iv)throw new TypeError("invalid iv length "+w.length);if(typeof v=="string"&&(v=Buffer$9.from(v)),v.length!==_.key/8)throw new TypeError("invalid key length "+v.length);return _.type==="stream"?new StreamCipher(_.module,v,w,!0):_.type==="auth"?new AuthCipher(_.module,v,w,!0):new Decipher(_.module,v,w)}function createDecipher$1(b,v){var w=MODES[b.toLowerCase()];if(!w)throw new TypeError("invalid suite type");var _=ebtk$1(v,!1,w.key,w.iv);return createDecipheriv$1(b,_.key,_.iv)}decrypter.createDecipher=createDecipher$1;decrypter.createDecipheriv=createDecipheriv$1;var ciphers$2=encrypter,deciphers=decrypter,modes$1=require$$2;function getCiphers$1(){return Object.keys(modes$1)}browser$5.createCipher=browser$5.Cipher=ciphers$2.createCipher;browser$5.createCipheriv=browser$5.Cipheriv=ciphers$2.createCipheriv;browser$5.createDecipher=browser$5.Decipher=deciphers.createDecipher;browser$5.createDecipheriv=browser$5.Decipheriv=deciphers.createDecipheriv;browser$5.listCiphers=browser$5.getCiphers=getCiphers$1;var modes={};(function(b){b["des-ecb"]={key:8,iv:0},b["des-cbc"]=b.des={key:8,iv:8},b["des-ede3-cbc"]=b.des3={key:24,iv:8},b["des-ede3"]={key:24,iv:0},b["des-ede-cbc"]={key:16,iv:8},b["des-ede"]={key:16,iv:0}})(modes);var DES=browserifyDes,aes=browser$5,aesModes=modes_1,desModes=modes,ebtk=evp_bytestokey;function createCipher(b,v){b=b.toLowerCase();var w,_;if(aesModes[b])w=aesModes[b].key,_=aesModes[b].iv;else if(desModes[b])w=desModes[b].key*8,_=desModes[b].iv;else throw new TypeError("invalid suite type");var A=ebtk(v,!1,w,_);return createCipheriv(b,A.key,A.iv)}function createDecipher(b,v){b=b.toLowerCase();var w,_;if(aesModes[b])w=aesModes[b].key,_=aesModes[b].iv;else if(desModes[b])w=desModes[b].key*8,_=desModes[b].iv;else throw new TypeError("invalid suite type");var A=ebtk(v,!1,w,_);return createDecipheriv(b,A.key,A.iv)}function createCipheriv(b,v,w){if(b=b.toLowerCase(),aesModes[b])return aes.createCipheriv(b,v,w);if(desModes[b])return new DES({key:v,iv:w,mode:b});throw new TypeError("invalid suite type")}function createDecipheriv(b,v,w){if(b=b.toLowerCase(),aesModes[b])return aes.createDecipheriv(b,v,w);if(desModes[b])return new DES({key:v,iv:w,mode:b,decrypt:!0});throw new TypeError("invalid suite type")}function getCiphers(){return Object.keys(desModes).concat(aes.getCiphers())}browser$6.createCipher=browser$6.Cipher=createCipher;browser$6.createCipheriv=browser$6.Cipheriv=createCipheriv;browser$6.createDecipher=browser$6.Decipher=createDecipher;browser$6.createDecipheriv=browser$6.Decipheriv=createDecipheriv;browser$6.listCiphers=browser$6.getCiphers=getCiphers;var browser$4={},bn$2={exports:{}};bn$2.exports;(function(b){(function(v,w){function _(fe,Z){if(!fe)throw new Error(Z||"Assertion failed")}function A(fe,Z){fe.super_=Z;var U=function(){};U.prototype=Z.prototype,fe.prototype=new U,fe.prototype.constructor=fe}function E(fe,Z,U){if(E.isBN(fe))return fe;this.negative=0,this.words=null,this.length=0,this.red=null,fe!==null&&((Z==="le"||Z==="be")&&(U=Z,Z=10),this._init(fe||0,Z||10,U||"be"))}typeof v=="object"?v.exports=E:w.BN=E,E.BN=E,E.wordSize=26;var k;try{typeof window<"u"&&typeof window.Buffer<"u"?k=window.Buffer:k=require$$1$2.Buffer}catch{}E.isBN=function(Z){return Z instanceof E?!0:Z!==null&&typeof Z=="object"&&Z.constructor.wordSize===E.wordSize&&Array.isArray(Z.words)},E.max=function(Z,U){return Z.cmp(U)>0?Z:U},E.min=function(Z,U){return Z.cmp(U)<0?Z:U},E.prototype._init=function(Z,U,S){if(typeof Z=="number")return this._initNumber(Z,U,S);if(typeof Z=="object")return this._initArray(Z,U,S);U==="hex"&&(U=16),_(U===(U|0)&&U>=2&&U<=36),Z=Z.toString().replace(/\s+/g,"");var C=0;Z[0]==="-"&&(C++,this.negative=1),C<Z.length&&(U===16?this._parseHex(Z,C,S):(this._parseBase(Z,U,C),S==="le"&&this._initArray(this.toArray(),U,S)))},E.prototype._initNumber=function(Z,U,S){Z<0&&(this.negative=1,Z=-Z),Z<67108864?(this.words=[Z&67108863],this.length=1):Z<4503599627370496?(this.words=[Z&67108863,Z/67108864&67108863],this.length=2):(_(Z<9007199254740992),this.words=[Z&67108863,Z/67108864&67108863,1],this.length=3),S==="le"&&this._initArray(this.toArray(),U,S)},E.prototype._initArray=function(Z,U,S){if(_(typeof Z.length=="number"),Z.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(Z.length/3),this.words=new Array(this.length);for(var C=0;C<this.length;C++)this.words[C]=0;var F,X,re=0;if(S==="be")for(C=Z.length-1,F=0;C>=0;C-=3)X=Z[C]|Z[C-1]<<8|Z[C-2]<<16,this.words[F]|=X<<re&67108863,this.words[F+1]=X>>>26-re&67108863,re+=24,re>=26&&(re-=26,F++);else if(S==="le")for(C=0,F=0;C<Z.length;C+=3)X=Z[C]|Z[C+1]<<8|Z[C+2]<<16,this.words[F]|=X<<re&67108863,this.words[F+1]=X>>>26-re&67108863,re+=24,re>=26&&(re-=26,F++);return this.strip()};function P(fe,Z){var U=fe.charCodeAt(Z);return U>=65&&U<=70?U-55:U>=97&&U<=102?U-87:U-48&15}function N(fe,Z,U){var S=P(fe,U);return U-1>=Z&&(S|=P(fe,U-1)<<4),S}E.prototype._parseHex=function(Z,U,S){this.length=Math.ceil((Z.length-U)/6),this.words=new Array(this.length);for(var C=0;C<this.length;C++)this.words[C]=0;var F=0,X=0,re;if(S==="be")for(C=Z.length-1;C>=U;C-=2)re=N(Z,U,C)<<F,this.words[X]|=re&67108863,F>=18?(F-=18,X+=1,this.words[X]|=re>>>26):F+=8;else{var ie=Z.length-U;for(C=ie%2===0?U+1:U;C<Z.length;C+=2)re=N(Z,U,C)<<F,this.words[X]|=re&67108863,F>=18?(F-=18,X+=1,this.words[X]|=re>>>26):F+=8}this.strip()};function q(fe,Z,U,S){for(var C=0,F=Math.min(fe.length,U),X=Z;X<F;X++){var re=fe.charCodeAt(X)-48;C*=S,re>=49?C+=re-49+10:re>=17?C+=re-17+10:C+=re}return C}E.prototype._parseBase=function(Z,U,S){this.words=[0],this.length=1;for(var C=0,F=1;F<=67108863;F*=U)C++;C--,F=F/U|0;for(var X=Z.length-S,re=X%C,ie=Math.min(X,X-re)+S,Q=0,ne=S;ne<ie;ne+=C)Q=q(Z,ne,ne+C,U),this.imuln(F),this.words[0]+Q<67108864?this.words[0]+=Q:this._iaddn(Q);if(re!==0){var L=1;for(Q=q(Z,ne,Z.length,U),ne=0;ne<re;ne++)L*=U;this.imuln(L),this.words[0]+Q<67108864?this.words[0]+=Q:this._iaddn(Q)}this.strip()},E.prototype.copy=function(Z){Z.words=new Array(this.length);for(var U=0;U<this.length;U++)Z.words[U]=this.words[U];Z.length=this.length,Z.negative=this.negative,Z.red=this.red},E.prototype.clone=function(){var Z=new E(null);return this.copy(Z),Z},E.prototype._expand=function(Z){for(;this.length<Z;)this.words[this.length++]=0;return this},E.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},E.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},E.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var B=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],O=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],I=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];E.prototype.toString=function(Z,U){Z=Z||10,U=U|0||1;var S;if(Z===16||Z==="hex"){S="";for(var C=0,F=0,X=0;X<this.length;X++){var re=this.words[X],ie=((re<<C|F)&16777215).toString(16);F=re>>>24-C&16777215,F!==0||X!==this.length-1?S=B[6-ie.length]+ie+S:S=ie+S,C+=2,C>=26&&(C-=26,X--)}for(F!==0&&(S=F.toString(16)+S);S.length%U!==0;)S="0"+S;return this.negative!==0&&(S="-"+S),S}if(Z===(Z|0)&&Z>=2&&Z<=36){var Q=O[Z],ne=I[Z];S="";var L=this.clone();for(L.negative=0;!L.isZero();){var ue=L.modn(ne).toString(Z);L=L.idivn(ne),L.isZero()?S=ue+S:S=B[Q-ue.length]+ue+S}for(this.isZero()&&(S="0"+S);S.length%U!==0;)S="0"+S;return this.negative!==0&&(S="-"+S),S}_(!1,"Base should be between 2 and 36")},E.prototype.toNumber=function(){var Z=this.words[0];return this.length===2?Z+=this.words[1]*67108864:this.length===3&&this.words[2]===1?Z+=4503599627370496+this.words[1]*67108864:this.length>2&&_(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-Z:Z},E.prototype.toJSON=function(){return this.toString(16)},E.prototype.toBuffer=function(Z,U){return _(typeof k<"u"),this.toArrayLike(k,Z,U)},E.prototype.toArray=function(Z,U){return this.toArrayLike(Array,Z,U)},E.prototype.toArrayLike=function(Z,U,S){var C=this.byteLength(),F=S||Math.max(1,C);_(C<=F,"byte array longer than desired length"),_(F>0,"Requested array length <= 0"),this.strip();var X=U==="le",re=new Z(F),ie,Q,ne=this.clone();if(X){for(Q=0;!ne.isZero();Q++)ie=ne.andln(255),ne.iushrn(8),re[Q]=ie;for(;Q<F;Q++)re[Q]=0}else{for(Q=0;Q<F-C;Q++)re[Q]=0;for(Q=0;!ne.isZero();Q++)ie=ne.andln(255),ne.iushrn(8),re[F-Q-1]=ie}return re},Math.clz32?E.prototype._countBits=function(Z){return 32-Math.clz32(Z)}:E.prototype._countBits=function(Z){var U=Z,S=0;return U>=4096&&(S+=13,U>>>=13),U>=64&&(S+=7,U>>>=7),U>=8&&(S+=4,U>>>=4),U>=2&&(S+=2,U>>>=2),S+U},E.prototype._zeroBits=function(Z){if(Z===0)return 26;var U=Z,S=0;return U&8191||(S+=13,U>>>=13),U&127||(S+=7,U>>>=7),U&15||(S+=4,U>>>=4),U&3||(S+=2,U>>>=2),U&1||S++,S},E.prototype.bitLength=function(){var Z=this.words[this.length-1],U=this._countBits(Z);return(this.length-1)*26+U};function D(fe){for(var Z=new Array(fe.bitLength()),U=0;U<Z.length;U++){var S=U/26|0,C=U%26;Z[U]=(fe.words[S]&1<<C)>>>C}return Z}E.prototype.zeroBits=function(){if(this.isZero())return 0;for(var Z=0,U=0;U<this.length;U++){var S=this._zeroBits(this.words[U]);if(Z+=S,S!==26)break}return Z},E.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},E.prototype.toTwos=function(Z){return this.negative!==0?this.abs().inotn(Z).iaddn(1):this.clone()},E.prototype.fromTwos=function(Z){return this.testn(Z-1)?this.notn(Z).iaddn(1).ineg():this.clone()},E.prototype.isNeg=function(){return this.negative!==0},E.prototype.neg=function(){return this.clone().ineg()},E.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},E.prototype.iuor=function(Z){for(;this.length<Z.length;)this.words[this.length++]=0;for(var U=0;U<Z.length;U++)this.words[U]=this.words[U]|Z.words[U];return this.strip()},E.prototype.ior=function(Z){return _((this.negative|Z.negative)===0),this.iuor(Z)},E.prototype.or=function(Z){return this.length>Z.length?this.clone().ior(Z):Z.clone().ior(this)},E.prototype.uor=function(Z){return this.length>Z.length?this.clone().iuor(Z):Z.clone().iuor(this)},E.prototype.iuand=function(Z){var U;this.length>Z.length?U=Z:U=this;for(var S=0;S<U.length;S++)this.words[S]=this.words[S]&Z.words[S];return this.length=U.length,this.strip()},E.prototype.iand=function(Z){return _((this.negative|Z.negative)===0),this.iuand(Z)},E.prototype.and=function(Z){return this.length>Z.length?this.clone().iand(Z):Z.clone().iand(this)},E.prototype.uand=function(Z){return this.length>Z.length?this.clone().iuand(Z):Z.clone().iuand(this)},E.prototype.iuxor=function(Z){var U,S;this.length>Z.length?(U=this,S=Z):(U=Z,S=this);for(var C=0;C<S.length;C++)this.words[C]=U.words[C]^S.words[C];if(this!==U)for(;C<U.length;C++)this.words[C]=U.words[C];return this.length=U.length,this.strip()},E.prototype.ixor=function(Z){return _((this.negative|Z.negative)===0),this.iuxor(Z)},E.prototype.xor=function(Z){return this.length>Z.length?this.clone().ixor(Z):Z.clone().ixor(this)},E.prototype.uxor=function(Z){return this.length>Z.length?this.clone().iuxor(Z):Z.clone().iuxor(this)},E.prototype.inotn=function(Z){_(typeof Z=="number"&&Z>=0);var U=Math.ceil(Z/26)|0,S=Z%26;this._expand(U),S>0&&U--;for(var C=0;C<U;C++)this.words[C]=~this.words[C]&67108863;return S>0&&(this.words[C]=~this.words[C]&67108863>>26-S),this.strip()},E.prototype.notn=function(Z){return this.clone().inotn(Z)},E.prototype.setn=function(Z,U){_(typeof Z=="number"&&Z>=0);var S=Z/26|0,C=Z%26;return this._expand(S+1),U?this.words[S]=this.words[S]|1<<C:this.words[S]=this.words[S]&~(1<<C),this.strip()},E.prototype.iadd=function(Z){var U;if(this.negative!==0&&Z.negative===0)return this.negative=0,U=this.isub(Z),this.negative^=1,this._normSign();if(this.negative===0&&Z.negative!==0)return Z.negative=0,U=this.isub(Z),Z.negative=1,U._normSign();var S,C;this.length>Z.length?(S=this,C=Z):(S=Z,C=this);for(var F=0,X=0;X<C.length;X++)U=(S.words[X]|0)+(C.words[X]|0)+F,this.words[X]=U&67108863,F=U>>>26;for(;F!==0&&X<S.length;X++)U=(S.words[X]|0)+F,this.words[X]=U&67108863,F=U>>>26;if(this.length=S.length,F!==0)this.words[this.length]=F,this.length++;else if(S!==this)for(;X<S.length;X++)this.words[X]=S.words[X];return this},E.prototype.add=function(Z){var U;return Z.negative!==0&&this.negative===0?(Z.negative=0,U=this.sub(Z),Z.negative^=1,U):Z.negative===0&&this.negative!==0?(this.negative=0,U=Z.sub(this),this.negative=1,U):this.length>Z.length?this.clone().iadd(Z):Z.clone().iadd(this)},E.prototype.isub=function(Z){if(Z.negative!==0){Z.negative=0;var U=this.iadd(Z);return Z.negative=1,U._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Z),this.negative=1,this._normSign();var S=this.cmp(Z);if(S===0)return this.negative=0,this.length=1,this.words[0]=0,this;var C,F;S>0?(C=this,F=Z):(C=Z,F=this);for(var X=0,re=0;re<F.length;re++)U=(C.words[re]|0)-(F.words[re]|0)+X,X=U>>26,this.words[re]=U&67108863;for(;X!==0&&re<C.length;re++)U=(C.words[re]|0)+X,X=U>>26,this.words[re]=U&67108863;if(X===0&&re<C.length&&C!==this)for(;re<C.length;re++)this.words[re]=C.words[re];return this.length=Math.max(this.length,re),C!==this&&(this.negative=1),this.strip()},E.prototype.sub=function(Z){return this.clone().isub(Z)};function V(fe,Z,U){U.negative=Z.negative^fe.negative;var S=fe.length+Z.length|0;U.length=S,S=S-1|0;var C=fe.words[0]|0,F=Z.words[0]|0,X=C*F,re=X&67108863,ie=X/67108864|0;U.words[0]=re;for(var Q=1;Q<S;Q++){for(var ne=ie>>>26,L=ie&67108863,ue=Math.min(Q,Z.length-1),Ae=Math.max(0,Q-fe.length+1);Ae<=ue;Ae++){var Re=Q-Ae|0;C=fe.words[Re]|0,F=Z.words[Ae]|0,X=C*F+L,ne+=X/67108864|0,L=X&67108863}U.words[Q]=L|0,ie=ne|0}return ie!==0?U.words[Q]=ie|0:U.length--,U.strip()}var ee=function(Z,U,S){var C=Z.words,F=U.words,X=S.words,re=0,ie,Q,ne,L=C[0]|0,ue=L&8191,Ae=L>>>13,Re=C[1]|0,Pe=Re&8191,xe=Re>>>13,ge=C[2]|0,_e=ge&8191,ke=ge>>>13,Ee=C[3]|0,Se=Ee&8191,Oe=Ee>>>13,Ne=C[4]|0,ve=Ne&8191,Ce=Ne>>>13,Te=C[5]|0,Le=Te&8191,Be=Te>>>13,De=C[6]|0,Ke=De&8191,We=De>>>13,Qe=C[7]|0,Xe=Qe&8191,at=Qe>>>13,Fe=C[8]|0,qe=Fe&8191,$e=Fe>>>13,Ie=C[9]|0,we=Ie&8191,me=Ie>>>13,ye=F[0]|0,Me=ye&8191,je=ye>>>13,He=F[1]|0,Ue=He&8191,rt=He>>>13,it=F[2]|0,tt=it&8191,mt=it>>>13,st=F[3]|0,lt=st&8191,Ct=st>>>13,St=F[4]|0,dt=St&8191,Ot=St>>>13,xt=F[5]|0,ht=xt&8191,Nt=xt>>>13,wt=F[6]|0,ct=wt&8191,Rt=wt>>>13,gt=F[7]|0,pt=gt&8191,Tt=gt>>>13,yt=F[8]|0,ut=yt&8191,Mt=yt>>>13,_t=F[9]|0,ot=_t&8191,It=_t>>>13;S.negative=Z.negative^U.negative,S.length=19,ie=Math.imul(ue,Me),Q=Math.imul(ue,je),Q=Q+Math.imul(Ae,Me)|0,ne=Math.imul(Ae,je);var Et=(re+ie|0)+((Q&8191)<<13)|0;re=(ne+(Q>>>13)|0)+(Et>>>26)|0,Et&=67108863,ie=Math.imul(Pe,Me),Q=Math.imul(Pe,je),Q=Q+Math.imul(xe,Me)|0,ne=Math.imul(xe,je),ie=ie+Math.imul(ue,Ue)|0,Q=Q+Math.imul(ue,rt)|0,Q=Q+Math.imul(Ae,Ue)|0,ne=ne+Math.imul(Ae,rt)|0;var At=(re+ie|0)+((Q&8191)<<13)|0;re=(ne+(Q>>>13)|0)+(At>>>26)|0,At&=67108863,ie=Math.imul(_e,Me),Q=Math.imul(_e,je),Q=Q+Math.imul(ke,Me)|0,ne=Math.imul(ke,je),ie=ie+Math.imul(Pe,Ue)|0,Q=Q+Math.imul(Pe,rt)|0,Q=Q+Math.imul(xe,Ue)|0,ne=ne+Math.imul(xe,rt)|0,ie=ie+Math.imul(ue,tt)|0,Q=Q+Math.imul(ue,mt)|0,Q=Q+Math.imul(Ae,tt)|0,ne=ne+Math.imul(Ae,mt)|0;var Gt=(re+ie|0)+((Q&8191)<<13)|0;re=(ne+(Q>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,ie=Math.imul(Se,Me),Q=Math.imul(Se,je),Q=Q+Math.imul(Oe,Me)|0,ne=Math.imul(Oe,je),ie=ie+Math.imul(_e,Ue)|0,Q=Q+Math.imul(_e,rt)|0,Q=Q+Math.imul(ke,Ue)|0,ne=ne+Math.imul(ke,rt)|0,ie=ie+Math.imul(Pe,tt)|0,Q=Q+Math.imul(Pe,mt)|0,Q=Q+Math.imul(xe,tt)|0,ne=ne+Math.imul(xe,mt)|0,ie=ie+Math.imul(ue,lt)|0,Q=Q+Math.imul(ue,Ct)|0,Q=Q+Math.imul(Ae,lt)|0,ne=ne+Math.imul(Ae,Ct)|0;var Ut=(re+ie|0)+((Q&8191)<<13)|0;re=(ne+(Q>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,ie=Math.imul(ve,Me),Q=Math.imul(ve,je),Q=Q+Math.imul(Ce,Me)|0,ne=Math.imul(Ce,je),ie=ie+Math.imul(Se,Ue)|0,Q=Q+Math.imul(Se,rt)|0,Q=Q+Math.imul(Oe,Ue)|0,ne=ne+Math.imul(Oe,rt)|0,ie=ie+Math.imul(_e,tt)|0,Q=Q+Math.imul(_e,mt)|0,Q=Q+Math.imul(ke,tt)|0,ne=ne+Math.imul(ke,mt)|0,ie=ie+Math.imul(Pe,lt)|0,Q=Q+Math.imul(Pe,Ct)|0,Q=Q+Math.imul(xe,lt)|0,ne=ne+Math.imul(xe,Ct)|0,ie=ie+Math.imul(ue,dt)|0,Q=Q+Math.imul(ue,Ot)|0,Q=Q+Math.imul(Ae,dt)|0,ne=ne+Math.imul(Ae,Ot)|0;var jt=(re+ie|0)+((Q&8191)<<13)|0;re=(ne+(Q>>>13)|0)+(jt>>>26)|0,jt&=67108863,ie=Math.imul(Le,Me),Q=Math.imul(Le,je),Q=Q+Math.imul(Be,Me)|0,ne=Math.imul(Be,je),ie=ie+Math.imul(ve,Ue)|0,Q=Q+Math.imul(ve,rt)|0,Q=Q+Math.imul(Ce,Ue)|0,ne=ne+Math.imul(Ce,rt)|0,ie=ie+Math.imul(Se,tt)|0,Q=Q+Math.imul(Se,mt)|0,Q=Q+Math.imul(Oe,tt)|0,ne=ne+Math.imul(Oe,mt)|0,ie=ie+Math.imul(_e,lt)|0,Q=Q+Math.imul(_e,Ct)|0,Q=Q+Math.imul(ke,lt)|0,ne=ne+Math.imul(ke,Ct)|0,ie=ie+Math.imul(Pe,dt)|0,Q=Q+Math.imul(Pe,Ot)|0,Q=Q+Math.imul(xe,dt)|0,ne=ne+Math.imul(xe,Ot)|0,ie=ie+Math.imul(ue,ht)|0,Q=Q+Math.imul(ue,Nt)|0,Q=Q+Math.imul(Ae,ht)|0,ne=ne+Math.imul(Ae,Nt)|0;var Ft=(re+ie|0)+((Q&8191)<<13)|0;re=(ne+(Q>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,ie=Math.imul(Ke,Me),Q=Math.imul(Ke,je),Q=Q+Math.imul(We,Me)|0,ne=Math.imul(We,je),ie=ie+Math.imul(Le,Ue)|0,Q=Q+Math.imul(Le,rt)|0,Q=Q+Math.imul(Be,Ue)|0,ne=ne+Math.imul(Be,rt)|0,ie=ie+Math.imul(ve,tt)|0,Q=Q+Math.imul(ve,mt)|0,Q=Q+Math.imul(Ce,tt)|0,ne=ne+Math.imul(Ce,mt)|0,ie=ie+Math.imul(Se,lt)|0,Q=Q+Math.imul(Se,Ct)|0,Q=Q+Math.imul(Oe,lt)|0,ne=ne+Math.imul(Oe,Ct)|0,ie=ie+Math.imul(_e,dt)|0,Q=Q+Math.imul(_e,Ot)|0,Q=Q+Math.imul(ke,dt)|0,ne=ne+Math.imul(ke,Ot)|0,ie=ie+Math.imul(Pe,ht)|0,Q=Q+Math.imul(Pe,Nt)|0,Q=Q+Math.imul(xe,ht)|0,ne=ne+Math.imul(xe,Nt)|0,ie=ie+Math.imul(ue,ct)|0,Q=Q+Math.imul(ue,Rt)|0,Q=Q+Math.imul(Ae,ct)|0,ne=ne+Math.imul(Ae,Rt)|0;var Ht=(re+ie|0)+((Q&8191)<<13)|0;re=(ne+(Q>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,ie=Math.imul(Xe,Me),Q=Math.imul(Xe,je),Q=Q+Math.imul(at,Me)|0,ne=Math.imul(at,je),ie=ie+Math.imul(Ke,Ue)|0,Q=Q+Math.imul(Ke,rt)|0,Q=Q+Math.imul(We,Ue)|0,ne=ne+Math.imul(We,rt)|0,ie=ie+Math.imul(Le,tt)|0,Q=Q+Math.imul(Le,mt)|0,Q=Q+Math.imul(Be,tt)|0,ne=ne+Math.imul(Be,mt)|0,ie=ie+Math.imul(ve,lt)|0,Q=Q+Math.imul(ve,Ct)|0,Q=Q+Math.imul(Ce,lt)|0,ne=ne+Math.imul(Ce,Ct)|0,ie=ie+Math.imul(Se,dt)|0,Q=Q+Math.imul(Se,Ot)|0,Q=Q+Math.imul(Oe,dt)|0,ne=ne+Math.imul(Oe,Ot)|0,ie=ie+Math.imul(_e,ht)|0,Q=Q+Math.imul(_e,Nt)|0,Q=Q+Math.imul(ke,ht)|0,ne=ne+Math.imul(ke,Nt)|0,ie=ie+Math.imul(Pe,ct)|0,Q=Q+Math.imul(Pe,Rt)|0,Q=Q+Math.imul(xe,ct)|0,ne=ne+Math.imul(xe,Rt)|0,ie=ie+Math.imul(ue,pt)|0,Q=Q+Math.imul(ue,Tt)|0,Q=Q+Math.imul(Ae,pt)|0,ne=ne+Math.imul(Ae,Tt)|0;var Ge=(re+ie|0)+((Q&8191)<<13)|0;re=(ne+(Q>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,ie=Math.imul(qe,Me),Q=Math.imul(qe,je),Q=Q+Math.imul($e,Me)|0,ne=Math.imul($e,je),ie=ie+Math.imul(Xe,Ue)|0,Q=Q+Math.imul(Xe,rt)|0,Q=Q+Math.imul(at,Ue)|0,ne=ne+Math.imul(at,rt)|0,ie=ie+Math.imul(Ke,tt)|0,Q=Q+Math.imul(Ke,mt)|0,Q=Q+Math.imul(We,tt)|0,ne=ne+Math.imul(We,mt)|0,ie=ie+Math.imul(Le,lt)|0,Q=Q+Math.imul(Le,Ct)|0,Q=Q+Math.imul(Be,lt)|0,ne=ne+Math.imul(Be,Ct)|0,ie=ie+Math.imul(ve,dt)|0,Q=Q+Math.imul(ve,Ot)|0,Q=Q+Math.imul(Ce,dt)|0,ne=ne+Math.imul(Ce,Ot)|0,ie=ie+Math.imul(Se,ht)|0,Q=Q+Math.imul(Se,Nt)|0,Q=Q+Math.imul(Oe,ht)|0,ne=ne+Math.imul(Oe,Nt)|0,ie=ie+Math.imul(_e,ct)|0,Q=Q+Math.imul(_e,Rt)|0,Q=Q+Math.imul(ke,ct)|0,ne=ne+Math.imul(ke,Rt)|0,ie=ie+Math.imul(Pe,pt)|0,Q=Q+Math.imul(Pe,Tt)|0,Q=Q+Math.imul(xe,pt)|0,ne=ne+Math.imul(xe,Tt)|0,ie=ie+Math.imul(ue,ut)|0,Q=Q+Math.imul(ue,Mt)|0,Q=Q+Math.imul(Ae,ut)|0,ne=ne+Math.imul(Ae,Mt)|0;var ze=(re+ie|0)+((Q&8191)<<13)|0;re=(ne+(Q>>>13)|0)+(ze>>>26)|0,ze&=67108863,ie=Math.imul(we,Me),Q=Math.imul(we,je),Q=Q+Math.imul(me,Me)|0,ne=Math.imul(me,je),ie=ie+Math.imul(qe,Ue)|0,Q=Q+Math.imul(qe,rt)|0,Q=Q+Math.imul($e,Ue)|0,ne=ne+Math.imul($e,rt)|0,ie=ie+Math.imul(Xe,tt)|0,Q=Q+Math.imul(Xe,mt)|0,Q=Q+Math.imul(at,tt)|0,ne=ne+Math.imul(at,mt)|0,ie=ie+Math.imul(Ke,lt)|0,Q=Q+Math.imul(Ke,Ct)|0,Q=Q+Math.imul(We,lt)|0,ne=ne+Math.imul(We,Ct)|0,ie=ie+Math.imul(Le,dt)|0,Q=Q+Math.imul(Le,Ot)|0,Q=Q+Math.imul(Be,dt)|0,ne=ne+Math.imul(Be,Ot)|0,ie=ie+Math.imul(ve,ht)|0,Q=Q+Math.imul(ve,Nt)|0,Q=Q+Math.imul(Ce,ht)|0,ne=ne+Math.imul(Ce,Nt)|0,ie=ie+Math.imul(Se,ct)|0,Q=Q+Math.imul(Se,Rt)|0,Q=Q+Math.imul(Oe,ct)|0,ne=ne+Math.imul(Oe,Rt)|0,ie=ie+Math.imul(_e,pt)|0,Q=Q+Math.imul(_e,Tt)|0,Q=Q+Math.imul(ke,pt)|0,ne=ne+Math.imul(ke,Tt)|0,ie=ie+Math.imul(Pe,ut)|0,Q=Q+Math.imul(Pe,Mt)|0,Q=Q+Math.imul(xe,ut)|0,ne=ne+Math.imul(xe,Mt)|0,ie=ie+Math.imul(ue,ot)|0,Q=Q+Math.imul(ue,It)|0,Q=Q+Math.imul(Ae,ot)|0,ne=ne+Math.imul(Ae,It)|0;var Ve=(re+ie|0)+((Q&8191)<<13)|0;re=(ne+(Q>>>13)|0)+(Ve>>>26)|0,Ve&=67108863,ie=Math.imul(we,Ue),Q=Math.imul(we,rt),Q=Q+Math.imul(me,Ue)|0,ne=Math.imul(me,rt),ie=ie+Math.imul(qe,tt)|0,Q=Q+Math.imul(qe,mt)|0,Q=Q+Math.imul($e,tt)|0,ne=ne+Math.imul($e,mt)|0,ie=ie+Math.imul(Xe,lt)|0,Q=Q+Math.imul(Xe,Ct)|0,Q=Q+Math.imul(at,lt)|0,ne=ne+Math.imul(at,Ct)|0,ie=ie+Math.imul(Ke,dt)|0,Q=Q+Math.imul(Ke,Ot)|0,Q=Q+Math.imul(We,dt)|0,ne=ne+Math.imul(We,Ot)|0,ie=ie+Math.imul(Le,ht)|0,Q=Q+Math.imul(Le,Nt)|0,Q=Q+Math.imul(Be,ht)|0,ne=ne+Math.imul(Be,Nt)|0,ie=ie+Math.imul(ve,ct)|0,Q=Q+Math.imul(ve,Rt)|0,Q=Q+Math.imul(Ce,ct)|0,ne=ne+Math.imul(Ce,Rt)|0,ie=ie+Math.imul(Se,pt)|0,Q=Q+Math.imul(Se,Tt)|0,Q=Q+Math.imul(Oe,pt)|0,ne=ne+Math.imul(Oe,Tt)|0,ie=ie+Math.imul(_e,ut)|0,Q=Q+Math.imul(_e,Mt)|0,Q=Q+Math.imul(ke,ut)|0,ne=ne+Math.imul(ke,Mt)|0,ie=ie+Math.imul(Pe,ot)|0,Q=Q+Math.imul(Pe,It)|0,Q=Q+Math.imul(xe,ot)|0,ne=ne+Math.imul(xe,It)|0;var Ze=(re+ie|0)+((Q&8191)<<13)|0;re=(ne+(Q>>>13)|0)+(Ze>>>26)|0,Ze&=67108863,ie=Math.imul(we,tt),Q=Math.imul(we,mt),Q=Q+Math.imul(me,tt)|0,ne=Math.imul(me,mt),ie=ie+Math.imul(qe,lt)|0,Q=Q+Math.imul(qe,Ct)|0,Q=Q+Math.imul($e,lt)|0,ne=ne+Math.imul($e,Ct)|0,ie=ie+Math.imul(Xe,dt)|0,Q=Q+Math.imul(Xe,Ot)|0,Q=Q+Math.imul(at,dt)|0,ne=ne+Math.imul(at,Ot)|0,ie=ie+Math.imul(Ke,ht)|0,Q=Q+Math.imul(Ke,Nt)|0,Q=Q+Math.imul(We,ht)|0,ne=ne+Math.imul(We,Nt)|0,ie=ie+Math.imul(Le,ct)|0,Q=Q+Math.imul(Le,Rt)|0,Q=Q+Math.imul(Be,ct)|0,ne=ne+Math.imul(Be,Rt)|0,ie=ie+Math.imul(ve,pt)|0,Q=Q+Math.imul(ve,Tt)|0,Q=Q+Math.imul(Ce,pt)|0,ne=ne+Math.imul(Ce,Tt)|0,ie=ie+Math.imul(Se,ut)|0,Q=Q+Math.imul(Se,Mt)|0,Q=Q+Math.imul(Oe,ut)|0,ne=ne+Math.imul(Oe,Mt)|0,ie=ie+Math.imul(_e,ot)|0,Q=Q+Math.imul(_e,It)|0,Q=Q+Math.imul(ke,ot)|0,ne=ne+Math.imul(ke,It)|0;var Je=(re+ie|0)+((Q&8191)<<13)|0;re=(ne+(Q>>>13)|0)+(Je>>>26)|0,Je&=67108863,ie=Math.imul(we,lt),Q=Math.imul(we,Ct),Q=Q+Math.imul(me,lt)|0,ne=Math.imul(me,Ct),ie=ie+Math.imul(qe,dt)|0,Q=Q+Math.imul(qe,Ot)|0,Q=Q+Math.imul($e,dt)|0,ne=ne+Math.imul($e,Ot)|0,ie=ie+Math.imul(Xe,ht)|0,Q=Q+Math.imul(Xe,Nt)|0,Q=Q+Math.imul(at,ht)|0,ne=ne+Math.imul(at,Nt)|0,ie=ie+Math.imul(Ke,ct)|0,Q=Q+Math.imul(Ke,Rt)|0,Q=Q+Math.imul(We,ct)|0,ne=ne+Math.imul(We,Rt)|0,ie=ie+Math.imul(Le,pt)|0,Q=Q+Math.imul(Le,Tt)|0,Q=Q+Math.imul(Be,pt)|0,ne=ne+Math.imul(Be,Tt)|0,ie=ie+Math.imul(ve,ut)|0,Q=Q+Math.imul(ve,Mt)|0,Q=Q+Math.imul(Ce,ut)|0,ne=ne+Math.imul(Ce,Mt)|0,ie=ie+Math.imul(Se,ot)|0,Q=Q+Math.imul(Se,It)|0,Q=Q+Math.imul(Oe,ot)|0,ne=ne+Math.imul(Oe,It)|0;var Ye=(re+ie|0)+((Q&8191)<<13)|0;re=(ne+(Q>>>13)|0)+(Ye>>>26)|0,Ye&=67108863,ie=Math.imul(we,dt),Q=Math.imul(we,Ot),Q=Q+Math.imul(me,dt)|0,ne=Math.imul(me,Ot),ie=ie+Math.imul(qe,ht)|0,Q=Q+Math.imul(qe,Nt)|0,Q=Q+Math.imul($e,ht)|0,ne=ne+Math.imul($e,Nt)|0,ie=ie+Math.imul(Xe,ct)|0,Q=Q+Math.imul(Xe,Rt)|0,Q=Q+Math.imul(at,ct)|0,ne=ne+Math.imul(at,Rt)|0,ie=ie+Math.imul(Ke,pt)|0,Q=Q+Math.imul(Ke,Tt)|0,Q=Q+Math.imul(We,pt)|0,ne=ne+Math.imul(We,Tt)|0,ie=ie+Math.imul(Le,ut)|0,Q=Q+Math.imul(Le,Mt)|0,Q=Q+Math.imul(Be,ut)|0,ne=ne+Math.imul(Be,Mt)|0,ie=ie+Math.imul(ve,ot)|0,Q=Q+Math.imul(ve,It)|0,Q=Q+Math.imul(Ce,ot)|0,ne=ne+Math.imul(Ce,It)|0;var et=(re+ie|0)+((Q&8191)<<13)|0;re=(ne+(Q>>>13)|0)+(et>>>26)|0,et&=67108863,ie=Math.imul(we,ht),Q=Math.imul(we,Nt),Q=Q+Math.imul(me,ht)|0,ne=Math.imul(me,Nt),ie=ie+Math.imul(qe,ct)|0,Q=Q+Math.imul(qe,Rt)|0,Q=Q+Math.imul($e,ct)|0,ne=ne+Math.imul($e,Rt)|0,ie=ie+Math.imul(Xe,pt)|0,Q=Q+Math.imul(Xe,Tt)|0,Q=Q+Math.imul(at,pt)|0,ne=ne+Math.imul(at,Tt)|0,ie=ie+Math.imul(Ke,ut)|0,Q=Q+Math.imul(Ke,Mt)|0,Q=Q+Math.imul(We,ut)|0,ne=ne+Math.imul(We,Mt)|0,ie=ie+Math.imul(Le,ot)|0,Q=Q+Math.imul(Le,It)|0,Q=Q+Math.imul(Be,ot)|0,ne=ne+Math.imul(Be,It)|0;var nt=(re+ie|0)+((Q&8191)<<13)|0;re=(ne+(Q>>>13)|0)+(nt>>>26)|0,nt&=67108863,ie=Math.imul(we,ct),Q=Math.imul(we,Rt),Q=Q+Math.imul(me,ct)|0,ne=Math.imul(me,Rt),ie=ie+Math.imul(qe,pt)|0,Q=Q+Math.imul(qe,Tt)|0,Q=Q+Math.imul($e,pt)|0,ne=ne+Math.imul($e,Tt)|0,ie=ie+Math.imul(Xe,ut)|0,Q=Q+Math.imul(Xe,Mt)|0,Q=Q+Math.imul(at,ut)|0,ne=ne+Math.imul(at,Mt)|0,ie=ie+Math.imul(Ke,ot)|0,Q=Q+Math.imul(Ke,It)|0,Q=Q+Math.imul(We,ot)|0,ne=ne+Math.imul(We,It)|0;var vt=(re+ie|0)+((Q&8191)<<13)|0;re=(ne+(Q>>>13)|0)+(vt>>>26)|0,vt&=67108863,ie=Math.imul(we,pt),Q=Math.imul(we,Tt),Q=Q+Math.imul(me,pt)|0,ne=Math.imul(me,Tt),ie=ie+Math.imul(qe,ut)|0,Q=Q+Math.imul(qe,Mt)|0,Q=Q+Math.imul($e,ut)|0,ne=ne+Math.imul($e,Mt)|0,ie=ie+Math.imul(Xe,ot)|0,Q=Q+Math.imul(Xe,It)|0,Q=Q+Math.imul(at,ot)|0,ne=ne+Math.imul(at,It)|0;var kt=(re+ie|0)+((Q&8191)<<13)|0;re=(ne+(Q>>>13)|0)+(kt>>>26)|0,kt&=67108863,ie=Math.imul(we,ut),Q=Math.imul(we,Mt),Q=Q+Math.imul(me,ut)|0,ne=Math.imul(me,Mt),ie=ie+Math.imul(qe,ot)|0,Q=Q+Math.imul(qe,It)|0,Q=Q+Math.imul($e,ot)|0,ne=ne+Math.imul($e,It)|0;var bt=(re+ie|0)+((Q&8191)<<13)|0;re=(ne+(Q>>>13)|0)+(bt>>>26)|0,bt&=67108863,ie=Math.imul(we,ot),Q=Math.imul(we,It),Q=Q+Math.imul(me,ot)|0,ne=Math.imul(me,It);var Bt=(re+ie|0)+((Q&8191)<<13)|0;return re=(ne+(Q>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,X[0]=Et,X[1]=At,X[2]=Gt,X[3]=Ut,X[4]=jt,X[5]=Ft,X[6]=Ht,X[7]=Ge,X[8]=ze,X[9]=Ve,X[10]=Ze,X[11]=Je,X[12]=Ye,X[13]=et,X[14]=nt,X[15]=vt,X[16]=kt,X[17]=bt,X[18]=Bt,re!==0&&(X[19]=re,S.length++),S};Math.imul||(ee=V);function J(fe,Z,U){U.negative=Z.negative^fe.negative,U.length=fe.length+Z.length;for(var S=0,C=0,F=0;F<U.length-1;F++){var X=C;C=0;for(var re=S&67108863,ie=Math.min(F,Z.length-1),Q=Math.max(0,F-fe.length+1);Q<=ie;Q++){var ne=F-Q,L=fe.words[ne]|0,ue=Z.words[Q]|0,Ae=L*ue,Re=Ae&67108863;X=X+(Ae/67108864|0)|0,Re=Re+re|0,re=Re&67108863,X=X+(Re>>>26)|0,C+=X>>>26,X&=67108863}U.words[F]=re,S=X,X=C}return S!==0?U.words[F]=S:U.length--,U.strip()}function te(fe,Z,U){var S=new se;return S.mulp(fe,Z,U)}E.prototype.mulTo=function(Z,U){var S,C=this.length+Z.length;return this.length===10&&Z.length===10?S=ee(this,Z,U):C<63?S=V(this,Z,U):C<1024?S=J(this,Z,U):S=te(this,Z,U),S};function se(fe,Z){this.x=fe,this.y=Z}se.prototype.makeRBT=function(Z){for(var U=new Array(Z),S=E.prototype._countBits(Z)-1,C=0;C<Z;C++)U[C]=this.revBin(C,S,Z);return U},se.prototype.revBin=function(Z,U,S){if(Z===0||Z===S-1)return Z;for(var C=0,F=0;F<U;F++)C|=(Z&1)<<U-F-1,Z>>=1;return C},se.prototype.permute=function(Z,U,S,C,F,X){for(var re=0;re<X;re++)C[re]=U[Z[re]],F[re]=S[Z[re]]},se.prototype.transform=function(Z,U,S,C,F,X){this.permute(X,Z,U,S,C,F);for(var re=1;re<F;re<<=1)for(var ie=re<<1,Q=Math.cos(2*Math.PI/ie),ne=Math.sin(2*Math.PI/ie),L=0;L<F;L+=ie)for(var ue=Q,Ae=ne,Re=0;Re<re;Re++){var Pe=S[L+Re],xe=C[L+Re],ge=S[L+Re+re],_e=C[L+Re+re],ke=ue*ge-Ae*_e;_e=ue*_e+Ae*ge,ge=ke,S[L+Re]=Pe+ge,C[L+Re]=xe+_e,S[L+Re+re]=Pe-ge,C[L+Re+re]=xe-_e,Re!==ie&&(ke=Q*ue-ne*Ae,Ae=Q*Ae+ne*ue,ue=ke)}},se.prototype.guessLen13b=function(Z,U){var S=Math.max(U,Z)|1,C=S&1,F=0;for(S=S/2|0;S;S=S>>>1)F++;return 1<<F+1+C},se.prototype.conjugate=function(Z,U,S){if(!(S<=1))for(var C=0;C<S/2;C++){var F=Z[C];Z[C]=Z[S-C-1],Z[S-C-1]=F,F=U[C],U[C]=-U[S-C-1],U[S-C-1]=-F}},se.prototype.normalize13b=function(Z,U){for(var S=0,C=0;C<U/2;C++){var F=Math.round(Z[2*C+1]/U)*8192+Math.round(Z[2*C]/U)+S;Z[C]=F&67108863,F<67108864?S=0:S=F/67108864|0}return Z},se.prototype.convert13b=function(Z,U,S,C){for(var F=0,X=0;X<U;X++)F=F+(Z[X]|0),S[2*X]=F&8191,F=F>>>13,S[2*X+1]=F&8191,F=F>>>13;for(X=2*U;X<C;++X)S[X]=0;_(F===0),_((F&-8192)===0)},se.prototype.stub=function(Z){for(var U=new Array(Z),S=0;S<Z;S++)U[S]=0;return U},se.prototype.mulp=function(Z,U,S){var C=2*this.guessLen13b(Z.length,U.length),F=this.makeRBT(C),X=this.stub(C),re=new Array(C),ie=new Array(C),Q=new Array(C),ne=new Array(C),L=new Array(C),ue=new Array(C),Ae=S.words;Ae.length=C,this.convert13b(Z.words,Z.length,re,C),this.convert13b(U.words,U.length,ne,C),this.transform(re,X,ie,Q,C,F),this.transform(ne,X,L,ue,C,F);for(var Re=0;Re<C;Re++){var Pe=ie[Re]*L[Re]-Q[Re]*ue[Re];Q[Re]=ie[Re]*ue[Re]+Q[Re]*L[Re],ie[Re]=Pe}return this.conjugate(ie,Q,C),this.transform(ie,Q,Ae,X,C,F),this.conjugate(Ae,X,C),this.normalize13b(Ae,C),S.negative=Z.negative^U.negative,S.length=Z.length+U.length,S.strip()},E.prototype.mul=function(Z){var U=new E(null);return U.words=new Array(this.length+Z.length),this.mulTo(Z,U)},E.prototype.mulf=function(Z){var U=new E(null);return U.words=new Array(this.length+Z.length),te(this,Z,U)},E.prototype.imul=function(Z){return this.clone().mulTo(Z,this)},E.prototype.imuln=function(Z){_(typeof Z=="number"),_(Z<67108864);for(var U=0,S=0;S<this.length;S++){var C=(this.words[S]|0)*Z,F=(C&67108863)+(U&67108863);U>>=26,U+=C/67108864|0,U+=F>>>26,this.words[S]=F&67108863}return U!==0&&(this.words[S]=U,this.length++),this},E.prototype.muln=function(Z){return this.clone().imuln(Z)},E.prototype.sqr=function(){return this.mul(this)},E.prototype.isqr=function(){return this.imul(this.clone())},E.prototype.pow=function(Z){var U=D(Z);if(U.length===0)return new E(1);for(var S=this,C=0;C<U.length&&U[C]===0;C++,S=S.sqr());if(++C<U.length)for(var F=S.sqr();C<U.length;C++,F=F.sqr())U[C]!==0&&(S=S.mul(F));return S},E.prototype.iushln=function(Z){_(typeof Z=="number"&&Z>=0);var U=Z%26,S=(Z-U)/26,C=67108863>>>26-U<<26-U,F;if(U!==0){var X=0;for(F=0;F<this.length;F++){var re=this.words[F]&C,ie=(this.words[F]|0)-re<<U;this.words[F]=ie|X,X=re>>>26-U}X&&(this.words[F]=X,this.length++)}if(S!==0){for(F=this.length-1;F>=0;F--)this.words[F+S]=this.words[F];for(F=0;F<S;F++)this.words[F]=0;this.length+=S}return this.strip()},E.prototype.ishln=function(Z){return _(this.negative===0),this.iushln(Z)},E.prototype.iushrn=function(Z,U,S){_(typeof Z=="number"&&Z>=0);var C;U?C=(U-U%26)/26:C=0;var F=Z%26,X=Math.min((Z-F)/26,this.length),re=67108863^67108863>>>F<<F,ie=S;if(C-=X,C=Math.max(0,C),ie){for(var Q=0;Q<X;Q++)ie.words[Q]=this.words[Q];ie.length=X}if(X!==0)if(this.length>X)for(this.length-=X,Q=0;Q<this.length;Q++)this.words[Q]=this.words[Q+X];else this.words[0]=0,this.length=1;var ne=0;for(Q=this.length-1;Q>=0&&(ne!==0||Q>=C);Q--){var L=this.words[Q]|0;this.words[Q]=ne<<26-F|L>>>F,ne=L&re}return ie&&ne!==0&&(ie.words[ie.length++]=ne),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},E.prototype.ishrn=function(Z,U,S){return _(this.negative===0),this.iushrn(Z,U,S)},E.prototype.shln=function(Z){return this.clone().ishln(Z)},E.prototype.ushln=function(Z){return this.clone().iushln(Z)},E.prototype.shrn=function(Z){return this.clone().ishrn(Z)},E.prototype.ushrn=function(Z){return this.clone().iushrn(Z)},E.prototype.testn=function(Z){_(typeof Z=="number"&&Z>=0);var U=Z%26,S=(Z-U)/26,C=1<<U;if(this.length<=S)return!1;var F=this.words[S];return!!(F&C)},E.prototype.imaskn=function(Z){_(typeof Z=="number"&&Z>=0);var U=Z%26,S=(Z-U)/26;if(_(this.negative===0,"imaskn works only with positive numbers"),this.length<=S)return this;if(U!==0&&S++,this.length=Math.min(S,this.length),U!==0){var C=67108863^67108863>>>U<<U;this.words[this.length-1]&=C}return this.strip()},E.prototype.maskn=function(Z){return this.clone().imaskn(Z)},E.prototype.iaddn=function(Z){return _(typeof Z=="number"),_(Z<67108864),Z<0?this.isubn(-Z):this.negative!==0?this.length===1&&(this.words[0]|0)<Z?(this.words[0]=Z-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(Z),this.negative=1,this):this._iaddn(Z)},E.prototype._iaddn=function(Z){this.words[0]+=Z;for(var U=0;U<this.length&&this.words[U]>=67108864;U++)this.words[U]-=67108864,U===this.length-1?this.words[U+1]=1:this.words[U+1]++;return this.length=Math.max(this.length,U+1),this},E.prototype.isubn=function(Z){if(_(typeof Z=="number"),_(Z<67108864),Z<0)return this.iaddn(-Z);if(this.negative!==0)return this.negative=0,this.iaddn(Z),this.negative=1,this;if(this.words[0]-=Z,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var U=0;U<this.length&&this.words[U]<0;U++)this.words[U]+=67108864,this.words[U+1]-=1;return this.strip()},E.prototype.addn=function(Z){return this.clone().iaddn(Z)},E.prototype.subn=function(Z){return this.clone().isubn(Z)},E.prototype.iabs=function(){return this.negative=0,this},E.prototype.abs=function(){return this.clone().iabs()},E.prototype._ishlnsubmul=function(Z,U,S){var C=Z.length+S,F;this._expand(C);var X,re=0;for(F=0;F<Z.length;F++){X=(this.words[F+S]|0)+re;var ie=(Z.words[F]|0)*U;X-=ie&67108863,re=(X>>26)-(ie/67108864|0),this.words[F+S]=X&67108863}for(;F<this.length-S;F++)X=(this.words[F+S]|0)+re,re=X>>26,this.words[F+S]=X&67108863;if(re===0)return this.strip();for(_(re===-1),re=0,F=0;F<this.length;F++)X=-(this.words[F]|0)+re,re=X>>26,this.words[F]=X&67108863;return this.negative=1,this.strip()},E.prototype._wordDiv=function(Z,U){var S=this.length-Z.length,C=this.clone(),F=Z,X=F.words[F.length-1]|0,re=this._countBits(X);S=26-re,S!==0&&(F=F.ushln(S),C.iushln(S),X=F.words[F.length-1]|0);var ie=C.length-F.length,Q;if(U!=="mod"){Q=new E(null),Q.length=ie+1,Q.words=new Array(Q.length);for(var ne=0;ne<Q.length;ne++)Q.words[ne]=0}var L=C.clone()._ishlnsubmul(F,1,ie);L.negative===0&&(C=L,Q&&(Q.words[ie]=1));for(var ue=ie-1;ue>=0;ue--){var Ae=(C.words[F.length+ue]|0)*67108864+(C.words[F.length+ue-1]|0);for(Ae=Math.min(Ae/X|0,67108863),C._ishlnsubmul(F,Ae,ue);C.negative!==0;)Ae--,C.negative=0,C._ishlnsubmul(F,1,ue),C.isZero()||(C.negative^=1);Q&&(Q.words[ue]=Ae)}return Q&&Q.strip(),C.strip(),U!=="div"&&S!==0&&C.iushrn(S),{div:Q||null,mod:C}},E.prototype.divmod=function(Z,U,S){if(_(!Z.isZero()),this.isZero())return{div:new E(0),mod:new E(0)};var C,F,X;return this.negative!==0&&Z.negative===0?(X=this.neg().divmod(Z,U),U!=="mod"&&(C=X.div.neg()),U!=="div"&&(F=X.mod.neg(),S&&F.negative!==0&&F.iadd(Z)),{div:C,mod:F}):this.negative===0&&Z.negative!==0?(X=this.divmod(Z.neg(),U),U!=="mod"&&(C=X.div.neg()),{div:C,mod:X.mod}):this.negative&Z.negative?(X=this.neg().divmod(Z.neg(),U),U!=="div"&&(F=X.mod.neg(),S&&F.negative!==0&&F.isub(Z)),{div:X.div,mod:F}):Z.length>this.length||this.cmp(Z)<0?{div:new E(0),mod:this}:Z.length===1?U==="div"?{div:this.divn(Z.words[0]),mod:null}:U==="mod"?{div:null,mod:new E(this.modn(Z.words[0]))}:{div:this.divn(Z.words[0]),mod:new E(this.modn(Z.words[0]))}:this._wordDiv(Z,U)},E.prototype.div=function(Z){return this.divmod(Z,"div",!1).div},E.prototype.mod=function(Z){return this.divmod(Z,"mod",!1).mod},E.prototype.umod=function(Z){return this.divmod(Z,"mod",!0).mod},E.prototype.divRound=function(Z){var U=this.divmod(Z);if(U.mod.isZero())return U.div;var S=U.div.negative!==0?U.mod.isub(Z):U.mod,C=Z.ushrn(1),F=Z.andln(1),X=S.cmp(C);return X<0||F===1&&X===0?U.div:U.div.negative!==0?U.div.isubn(1):U.div.iaddn(1)},E.prototype.modn=function(Z){_(Z<=67108863);for(var U=(1<<26)%Z,S=0,C=this.length-1;C>=0;C--)S=(U*S+(this.words[C]|0))%Z;return S},E.prototype.idivn=function(Z){_(Z<=67108863);for(var U=0,S=this.length-1;S>=0;S--){var C=(this.words[S]|0)+U*67108864;this.words[S]=C/Z|0,U=C%Z}return this.strip()},E.prototype.divn=function(Z){return this.clone().idivn(Z)},E.prototype.egcd=function(Z){_(Z.negative===0),_(!Z.isZero());var U=this,S=Z.clone();U.negative!==0?U=U.umod(Z):U=U.clone();for(var C=new E(1),F=new E(0),X=new E(0),re=new E(1),ie=0;U.isEven()&&S.isEven();)U.iushrn(1),S.iushrn(1),++ie;for(var Q=S.clone(),ne=U.clone();!U.isZero();){for(var L=0,ue=1;!(U.words[0]&ue)&&L<26;++L,ue<<=1);if(L>0)for(U.iushrn(L);L-- >0;)(C.isOdd()||F.isOdd())&&(C.iadd(Q),F.isub(ne)),C.iushrn(1),F.iushrn(1);for(var Ae=0,Re=1;!(S.words[0]&Re)&&Ae<26;++Ae,Re<<=1);if(Ae>0)for(S.iushrn(Ae);Ae-- >0;)(X.isOdd()||re.isOdd())&&(X.iadd(Q),re.isub(ne)),X.iushrn(1),re.iushrn(1);U.cmp(S)>=0?(U.isub(S),C.isub(X),F.isub(re)):(S.isub(U),X.isub(C),re.isub(F))}return{a:X,b:re,gcd:S.iushln(ie)}},E.prototype._invmp=function(Z){_(Z.negative===0),_(!Z.isZero());var U=this,S=Z.clone();U.negative!==0?U=U.umod(Z):U=U.clone();for(var C=new E(1),F=new E(0),X=S.clone();U.cmpn(1)>0&&S.cmpn(1)>0;){for(var re=0,ie=1;!(U.words[0]&ie)&&re<26;++re,ie<<=1);if(re>0)for(U.iushrn(re);re-- >0;)C.isOdd()&&C.iadd(X),C.iushrn(1);for(var Q=0,ne=1;!(S.words[0]&ne)&&Q<26;++Q,ne<<=1);if(Q>0)for(S.iushrn(Q);Q-- >0;)F.isOdd()&&F.iadd(X),F.iushrn(1);U.cmp(S)>=0?(U.isub(S),C.isub(F)):(S.isub(U),F.isub(C))}var L;return U.cmpn(1)===0?L=C:L=F,L.cmpn(0)<0&&L.iadd(Z),L},E.prototype.gcd=function(Z){if(this.isZero())return Z.abs();if(Z.isZero())return this.abs();var U=this.clone(),S=Z.clone();U.negative=0,S.negative=0;for(var C=0;U.isEven()&&S.isEven();C++)U.iushrn(1),S.iushrn(1);do{for(;U.isEven();)U.iushrn(1);for(;S.isEven();)S.iushrn(1);var F=U.cmp(S);if(F<0){var X=U;U=S,S=X}else if(F===0||S.cmpn(1)===0)break;U.isub(S)}while(!0);return S.iushln(C)},E.prototype.invm=function(Z){return this.egcd(Z).a.umod(Z)},E.prototype.isEven=function(){return(this.words[0]&1)===0},E.prototype.isOdd=function(){return(this.words[0]&1)===1},E.prototype.andln=function(Z){return this.words[0]&Z},E.prototype.bincn=function(Z){_(typeof Z=="number");var U=Z%26,S=(Z-U)/26,C=1<<U;if(this.length<=S)return this._expand(S+1),this.words[S]|=C,this;for(var F=C,X=S;F!==0&&X<this.length;X++){var re=this.words[X]|0;re+=F,F=re>>>26,re&=67108863,this.words[X]=re}return F!==0&&(this.words[X]=F,this.length++),this},E.prototype.isZero=function(){return this.length===1&&this.words[0]===0},E.prototype.cmpn=function(Z){var U=Z<0;if(this.negative!==0&&!U)return-1;if(this.negative===0&&U)return 1;this.strip();var S;if(this.length>1)S=1;else{U&&(Z=-Z),_(Z<=67108863,"Number is too big");var C=this.words[0]|0;S=C===Z?0:C<Z?-1:1}return this.negative!==0?-S|0:S},E.prototype.cmp=function(Z){if(this.negative!==0&&Z.negative===0)return-1;if(this.negative===0&&Z.negative!==0)return 1;var U=this.ucmp(Z);return this.negative!==0?-U|0:U},E.prototype.ucmp=function(Z){if(this.length>Z.length)return 1;if(this.length<Z.length)return-1;for(var U=0,S=this.length-1;S>=0;S--){var C=this.words[S]|0,F=Z.words[S]|0;if(C!==F){C<F?U=-1:C>F&&(U=1);break}}return U},E.prototype.gtn=function(Z){return this.cmpn(Z)===1},E.prototype.gt=function(Z){return this.cmp(Z)===1},E.prototype.gten=function(Z){return this.cmpn(Z)>=0},E.prototype.gte=function(Z){return this.cmp(Z)>=0},E.prototype.ltn=function(Z){return this.cmpn(Z)===-1},E.prototype.lt=function(Z){return this.cmp(Z)===-1},E.prototype.lten=function(Z){return this.cmpn(Z)<=0},E.prototype.lte=function(Z){return this.cmp(Z)<=0},E.prototype.eqn=function(Z){return this.cmpn(Z)===0},E.prototype.eq=function(Z){return this.cmp(Z)===0},E.red=function(Z){return new be(Z)},E.prototype.toRed=function(Z){return _(!this.red,"Already a number in reduction context"),_(this.negative===0,"red works only with positives"),Z.convertTo(this)._forceRed(Z)},E.prototype.fromRed=function(){return _(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},E.prototype._forceRed=function(Z){return this.red=Z,this},E.prototype.forceRed=function(Z){return _(!this.red,"Already a number in reduction context"),this._forceRed(Z)},E.prototype.redAdd=function(Z){return _(this.red,"redAdd works only with red numbers"),this.red.add(this,Z)},E.prototype.redIAdd=function(Z){return _(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Z)},E.prototype.redSub=function(Z){return _(this.red,"redSub works only with red numbers"),this.red.sub(this,Z)},E.prototype.redISub=function(Z){return _(this.red,"redISub works only with red numbers"),this.red.isub(this,Z)},E.prototype.redShl=function(Z){return _(this.red,"redShl works only with red numbers"),this.red.shl(this,Z)},E.prototype.redMul=function(Z){return _(this.red,"redMul works only with red numbers"),this.red._verify2(this,Z),this.red.mul(this,Z)},E.prototype.redIMul=function(Z){return _(this.red,"redMul works only with red numbers"),this.red._verify2(this,Z),this.red.imul(this,Z)},E.prototype.redSqr=function(){return _(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},E.prototype.redISqr=function(){return _(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},E.prototype.redSqrt=function(){return _(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},E.prototype.redInvm=function(){return _(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},E.prototype.redNeg=function(){return _(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},E.prototype.redPow=function(Z){return _(this.red&&!Z.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Z)};var ce={k256:null,p224:null,p192:null,p25519:null};function ae(fe,Z){this.name=fe,this.p=new E(Z,16),this.n=this.p.bitLength(),this.k=new E(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}ae.prototype._tmp=function(){var Z=new E(null);return Z.words=new Array(Math.ceil(this.n/13)),Z},ae.prototype.ireduce=function(Z){var U=Z,S;do this.split(U,this.tmp),U=this.imulK(U),U=U.iadd(this.tmp),S=U.bitLength();while(S>this.n);var C=S<this.n?-1:U.ucmp(this.p);return C===0?(U.words[0]=0,U.length=1):C>0?U.isub(this.p):U.strip!==void 0?U.strip():U._strip(),U},ae.prototype.split=function(Z,U){Z.iushrn(this.n,0,U)},ae.prototype.imulK=function(Z){return Z.imul(this.k)};function he(){ae.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}A(he,ae),he.prototype.split=function(Z,U){for(var S=4194303,C=Math.min(Z.length,9),F=0;F<C;F++)U.words[F]=Z.words[F];if(U.length=C,Z.length<=9){Z.words[0]=0,Z.length=1;return}var X=Z.words[9];for(U.words[U.length++]=X&S,F=10;F<Z.length;F++){var re=Z.words[F]|0;Z.words[F-10]=(re&S)<<4|X>>>22,X=re}X>>>=22,Z.words[F-10]=X,X===0&&Z.length>10?Z.length-=10:Z.length-=9},he.prototype.imulK=function(Z){Z.words[Z.length]=0,Z.words[Z.length+1]=0,Z.length+=2;for(var U=0,S=0;S<Z.length;S++){var C=Z.words[S]|0;U+=C*977,Z.words[S]=U&67108863,U=C*64+(U/67108864|0)}return Z.words[Z.length-1]===0&&(Z.length--,Z.words[Z.length-1]===0&&Z.length--),Z};function oe(){ae.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}A(oe,ae);function de(){ae.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}A(de,ae);function le(){ae.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}A(le,ae),le.prototype.imulK=function(Z){for(var U=0,S=0;S<Z.length;S++){var C=(Z.words[S]|0)*19+U,F=C&67108863;C>>>=26,Z.words[S]=F,U=C}return U!==0&&(Z.words[Z.length++]=U),Z},E._prime=function(Z){if(ce[Z])return ce[Z];var U;if(Z==="k256")U=new he;else if(Z==="p224")U=new oe;else if(Z==="p192")U=new de;else if(Z==="p25519")U=new le;else throw new Error("Unknown prime "+Z);return ce[Z]=U,U};function be(fe){if(typeof fe=="string"){var Z=E._prime(fe);this.m=Z.p,this.prime=Z}else _(fe.gtn(1),"modulus must be greater than 1"),this.m=fe,this.prime=null}be.prototype._verify1=function(Z){_(Z.negative===0,"red works only with positives"),_(Z.red,"red works only with red numbers")},be.prototype._verify2=function(Z,U){_((Z.negative|U.negative)===0,"red works only with positives"),_(Z.red&&Z.red===U.red,"red works only with red numbers")},be.prototype.imod=function(Z){return this.prime?this.prime.ireduce(Z)._forceRed(this):Z.umod(this.m)._forceRed(this)},be.prototype.neg=function(Z){return Z.isZero()?Z.clone():this.m.sub(Z)._forceRed(this)},be.prototype.add=function(Z,U){this._verify2(Z,U);var S=Z.add(U);return S.cmp(this.m)>=0&&S.isub(this.m),S._forceRed(this)},be.prototype.iadd=function(Z,U){this._verify2(Z,U);var S=Z.iadd(U);return S.cmp(this.m)>=0&&S.isub(this.m),S},be.prototype.sub=function(Z,U){this._verify2(Z,U);var S=Z.sub(U);return S.cmpn(0)<0&&S.iadd(this.m),S._forceRed(this)},be.prototype.isub=function(Z,U){this._verify2(Z,U);var S=Z.isub(U);return S.cmpn(0)<0&&S.iadd(this.m),S},be.prototype.shl=function(Z,U){return this._verify1(Z),this.imod(Z.ushln(U))},be.prototype.imul=function(Z,U){return this._verify2(Z,U),this.imod(Z.imul(U))},be.prototype.mul=function(Z,U){return this._verify2(Z,U),this.imod(Z.mul(U))},be.prototype.isqr=function(Z){return this.imul(Z,Z.clone())},be.prototype.sqr=function(Z){return this.mul(Z,Z)},be.prototype.sqrt=function(Z){if(Z.isZero())return Z.clone();var U=this.m.andln(3);if(_(U%2===1),U===3){var S=this.m.add(new E(1)).iushrn(2);return this.pow(Z,S)}for(var C=this.m.subn(1),F=0;!C.isZero()&&C.andln(1)===0;)F++,C.iushrn(1);_(!C.isZero());var X=new E(1).toRed(this),re=X.redNeg(),ie=this.m.subn(1).iushrn(1),Q=this.m.bitLength();for(Q=new E(2*Q*Q).toRed(this);this.pow(Q,ie).cmp(re)!==0;)Q.redIAdd(re);for(var ne=this.pow(Q,C),L=this.pow(Z,C.addn(1).iushrn(1)),ue=this.pow(Z,C),Ae=F;ue.cmp(X)!==0;){for(var Re=ue,Pe=0;Re.cmp(X)!==0;Pe++)Re=Re.redSqr();_(Pe<Ae);var xe=this.pow(ne,new E(1).iushln(Ae-Pe-1));L=L.redMul(xe),ne=xe.redSqr(),ue=ue.redMul(ne),Ae=Pe}return L},be.prototype.invm=function(Z){var U=Z._invmp(this.m);return U.negative!==0?(U.negative=0,this.imod(U).redNeg()):this.imod(U)},be.prototype.pow=function(Z,U){if(U.isZero())return new E(1).toRed(this);if(U.cmpn(1)===0)return Z.clone();var S=4,C=new Array(1<<S);C[0]=new E(1).toRed(this),C[1]=Z;for(var F=2;F<C.length;F++)C[F]=this.mul(C[F-1],Z);var X=C[0],re=0,ie=0,Q=U.bitLength()%26;for(Q===0&&(Q=26),F=U.length-1;F>=0;F--){for(var ne=U.words[F],L=Q-1;L>=0;L--){var ue=ne>>L&1;if(X!==C[0]&&(X=this.sqr(X)),ue===0&&re===0){ie=0;continue}re<<=1,re|=ue,ie++,!(ie!==S&&(F!==0||L!==0))&&(X=this.mul(X,C[re]),ie=0,re=0)}Q=26}return X},be.prototype.convertTo=function(Z){var U=Z.umod(this.m);return U===Z?U.clone():U},be.prototype.convertFrom=function(Z){var U=Z.clone();return U.red=null,U},E.mont=function(Z){return new pe(Z)};function pe(fe){be.call(this,fe),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new E(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}A(pe,be),pe.prototype.convertTo=function(Z){return this.imod(Z.ushln(this.shift))},pe.prototype.convertFrom=function(Z){var U=this.imod(Z.mul(this.rinv));return U.red=null,U},pe.prototype.imul=function(Z,U){if(Z.isZero()||U.isZero())return Z.words[0]=0,Z.length=1,Z;var S=Z.imul(U),C=S.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),F=S.isub(C).iushrn(this.shift),X=F;return F.cmp(this.m)>=0?X=F.isub(this.m):F.cmpn(0)<0&&(X=F.iadd(this.m)),X._forceRed(this)},pe.prototype.mul=function(Z,U){if(Z.isZero()||U.isZero())return new E(0)._forceRed(this);var S=Z.mul(U),C=S.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),F=S.isub(C).iushrn(this.shift),X=F;return F.cmp(this.m)>=0?X=F.isub(this.m):F.cmpn(0)<0&&(X=F.iadd(this.m)),X._forceRed(this)},pe.prototype.invm=function(Z){var U=this.imod(Z._invmp(this.m).mul(this.r2));return U._forceRed(this)}})(b,commonjsGlobal)})(bn$2);var bnExports$2=bn$2.exports,brorand={exports:{}},hasRequiredBrorand;function requireBrorand(){if(hasRequiredBrorand)return brorand.exports;hasRequiredBrorand=1;var b;brorand.exports=function(A){return b||(b=new v(null)),b.generate(A)};function v(_){this.rand=_}if(brorand.exports.Rand=v,v.prototype.generate=function(A){return this._rand(A)},v.prototype._rand=function(A){if(this.rand.getBytes)return this.rand.getBytes(A);for(var E=new Uint8Array(A),k=0;k<E.length;k++)E[k]=this.rand.getByte();return E},typeof self=="object")self.crypto&&self.crypto.getRandomValues?v.prototype._rand=function(A){var E=new Uint8Array(A);return self.crypto.getRandomValues(E),E}:self.msCrypto&&self.msCrypto.getRandomValues?v.prototype._rand=function(A){var E=new Uint8Array(A);return self.msCrypto.getRandomValues(E),E}:typeof window=="object"&&(v.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var w=requireCryptoBrowserify();if(typeof w.randomBytes!="function")throw new Error("Not supported");v.prototype._rand=function(A){return w.randomBytes(A)}}catch{}return brorand.exports}var mr,hasRequiredMr;function requireMr(){if(hasRequiredMr)return mr;hasRequiredMr=1;var b=bnExports$2,v=requireBrorand();function w(_){this.rand=_||new v.Rand}return mr=w,w.create=function(A){return new w(A)},w.prototype._randbelow=function(A){var E=A.bitLength(),k=Math.ceil(E/8);do var P=new b(this.rand.generate(k));while(P.cmp(A)>=0);return P},w.prototype._randrange=function(A,E){var k=E.sub(A);return A.add(this._randbelow(k))},w.prototype.test=function(A,E,k){var P=A.bitLength(),N=b.mont(A),q=new b(1).toRed(N);E||(E=Math.max(1,P/48|0));for(var B=A.subn(1),O=0;!B.testn(O);O++);for(var I=A.shrn(O),D=B.toRed(N),V=!0;E>0;E--){var ee=this._randrange(new b(2),B);k&&k(ee);var J=ee.toRed(N).redPow(I);if(!(J.cmp(q)===0||J.cmp(D)===0)){for(var te=1;te<O;te++){if(J=J.redSqr(),J.cmp(q)===0)return!1;if(J.cmp(D)===0)break}if(te===O)return!1}}return V},w.prototype.getDivisor=function(A,E){var k=A.bitLength(),P=b.mont(A),N=new b(1).toRed(P);E||(E=Math.max(1,k/48|0));for(var q=A.subn(1),B=0;!q.testn(B);B++);for(var O=A.shrn(B),I=q.toRed(P);E>0;E--){var D=this._randrange(new b(2),q),V=A.gcd(D);if(V.cmpn(1)!==0)return V;var ee=D.toRed(P).redPow(O);if(!(ee.cmp(N)===0||ee.cmp(I)===0)){for(var J=1;J<B;J++){if(ee=ee.redSqr(),ee.cmp(N)===0)return ee.fromRed().subn(1).gcd(A);if(ee.cmp(I)===0)break}if(J===B)return ee=ee.redSqr(),ee.fromRed().subn(1).gcd(A)}}return!1},mr}var generatePrime,hasRequiredGeneratePrime;function requireGeneratePrime(){if(hasRequiredGeneratePrime)return generatePrime;hasRequiredGeneratePrime=1;var b=browserExports;generatePrime=J,J.simpleSieve=V,J.fermatTest=ee;var v=bnExports$2,w=new v(24),_=requireMr(),A=new _,E=new v(1),k=new v(2),P=new v(5);new v(16),new v(8);var N=new v(10),q=new v(3);new v(7);var B=new v(11),O=new v(4);new v(12);var I=null;function D(){if(I!==null)return I;var te=1048576,se=[];se[0]=2;for(var ce=1,ae=3;ae<te;ae+=2){for(var he=Math.ceil(Math.sqrt(ae)),oe=0;oe<ce&&se[oe]<=he&&ae%se[oe]!==0;oe++);ce!==oe&&se[oe]<=he||(se[ce++]=ae)}return I=se,se}function V(te){for(var se=D(),ce=0;ce<se.length;ce++)if(te.modn(se[ce])===0)return te.cmpn(se[ce])===0;return!0}function ee(te){var se=v.mont(te);return k.toRed(se).redPow(te.subn(1)).fromRed().cmpn(1)===0}function J(te,se){if(te<16)return se===2||se===5?new v([140,123]):new v([140,39]);se=new v(se);for(var ce,ae;;){for(ce=new v(b(Math.ceil(te/8)));ce.bitLength()>te;)ce.ishrn(1);if(ce.isEven()&&ce.iadd(E),ce.testn(1)||ce.iadd(k),se.cmp(k)){if(!se.cmp(P))for(;ce.mod(N).cmp(q);)ce.iadd(O)}else for(;ce.mod(w).cmp(B);)ce.iadd(O);if(ae=ce.shrn(1),V(ae)&&V(ce)&&ee(ae)&&ee(ce)&&A.test(ae)&&A.test(ce))return ce}}return generatePrime}const modp1={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},require$$1$1={modp1,modp2,modp5,modp14,modp15,modp16,modp17,modp18};var dh,hasRequiredDh;function requireDh(){if(hasRequiredDh)return dh;hasRequiredDh=1;var b=bnExports$2,v=requireMr(),w=new v,_=new b(24),A=new b(11),E=new b(10),k=new b(3),P=new b(7),N=requireGeneratePrime(),q=browserExports;dh=V;function B(J,te){return te=te||"utf8",Buffer$D.isBuffer(J)||(J=new Buffer$D(J,te)),this._pub=new b(J),this}function O(J,te){return te=te||"utf8",Buffer$D.isBuffer(J)||(J=new Buffer$D(J,te)),this._priv=new b(J),this}var I={};function D(J,te){var se=te.toString("hex"),ce=[se,J.toString(16)].join("_");if(ce in I)return I[ce];var ae=0;if(J.isEven()||!N.simpleSieve||!N.fermatTest(J)||!w.test(J))return ae+=1,se==="02"||se==="05"?ae+=8:ae+=4,I[ce]=ae,ae;w.test(J.shrn(1))||(ae+=2);var he;switch(se){case"02":J.mod(_).cmp(A)&&(ae+=8);break;case"05":he=J.mod(E),he.cmp(k)&&he.cmp(P)&&(ae+=8);break;default:ae+=4}return I[ce]=ae,ae}function V(J,te,se){this.setGenerator(te),this.__prime=new b(J),this._prime=b.mont(this.__prime),this._primeLen=J.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,se?(this.setPublicKey=B,this.setPrivateKey=O):this._primeCode=8}Object.defineProperty(V.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=D(this.__prime,this.__gen)),this._primeCode}}),V.prototype.generateKeys=function(){return this._priv||(this._priv=new b(q(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},V.prototype.computeSecret=function(J){J=new b(J),J=J.toRed(this._prime);var te=J.redPow(this._priv).fromRed(),se=new Buffer$D(te.toArray()),ce=this.getPrime();if(se.length<ce.length){var ae=new Buffer$D(ce.length-se.length);ae.fill(0),se=Buffer$D.concat([ae,se])}return se},V.prototype.getPublicKey=function(te){return ee(this._pub,te)},V.prototype.getPrivateKey=function(te){return ee(this._priv,te)},V.prototype.getPrime=function(J){return ee(this.__prime,J)},V.prototype.getGenerator=function(J){return ee(this._gen,J)},V.prototype.setGenerator=function(J,te){return te=te||"utf8",Buffer$D.isBuffer(J)||(J=new Buffer$D(J,te)),this.__gen=J,this._gen=new b(J),this};function ee(J,te){var se=new Buffer$D(J.toArray());return te?se.toString(te):se}return dh}var hasRequiredBrowser$2;function requireBrowser$2(){if(hasRequiredBrowser$2)return browser$4;hasRequiredBrowser$2=1;var b=requireGeneratePrime(),v=require$$1$1,w=requireDh();function _(k){var P=new Buffer$D(v[k].prime,"hex"),N=new Buffer$D(v[k].gen,"hex");return new w(P,N)}var A={binary:!0,hex:!0,base64:!0};function E(k,P,N,q){return Buffer$D.isBuffer(P)||A[P]===void 0?E(k,"binary",P,N):(P=P||"binary",q=q||"binary",N=N||new Buffer$D([2]),Buffer$D.isBuffer(N)||(N=new Buffer$D(N,q)),typeof k=="number"?new w(b(k,N),N,!0):(Buffer$D.isBuffer(k)||(k=new Buffer$D(k,P)),new w(k,N,!0)))}return browser$4.DiffieHellmanGroup=browser$4.createDiffieHellmanGroup=browser$4.getDiffieHellman=_,browser$4.createDiffieHellman=browser$4.DiffieHellman=E,browser$4}var readableBrowser={exports:{}},processNextickArgs={exports:{}};typeof process$1>"u"||!process$1.version||process$1.version.indexOf("v0.")===0||process$1.version.indexOf("v1.")===0&&process$1.version.indexOf("v1.8.")!==0?processNextickArgs.exports={nextTick}:processNextickArgs.exports=process$1;function nextTick(b,v,w,_){if(typeof b!="function")throw new TypeError('"callback" argument must be a function');var A=arguments.length,E,k;switch(A){case 0:case 1:return process$1.nextTick(b);case 2:return process$1.nextTick(function(){b.call(null,v)});case 3:return process$1.nextTick(function(){b.call(null,v,w)});case 4:return process$1.nextTick(function(){b.call(null,v,w,_)});default:for(E=new Array(A-1),k=0;k<E.length;)E[k++]=arguments[k];return process$1.nextTick(function(){b.apply(null,E)})}}var processNextickArgsExports=processNextickArgs.exports,toString={}.toString,isarray=Array.isArray||function(b){return toString.call(b)=="[object Array]"},streamBrowser=eventsExports.EventEmitter,safeBuffer$1={exports:{}};(function(b,v){var w=require$$1$2,_=w.Buffer;function A(k,P){for(var N in k)P[N]=k[N]}_.from&&_.alloc&&_.allocUnsafe&&_.allocUnsafeSlow?b.exports=w:(A(w,v),v.Buffer=E);function E(k,P,N){return _(k,P,N)}A(_,E),E.from=function(k,P,N){if(typeof k=="number")throw new TypeError("Argument must not be a number");return _(k,P,N)},E.alloc=function(k,P,N){if(typeof k!="number")throw new TypeError("Argument must be a number");var q=_(k);return P!==void 0?typeof N=="string"?q.fill(P,N):q.fill(P):q.fill(0),q},E.allocUnsafe=function(k){if(typeof k!="number")throw new TypeError("Argument must be a number");return _(k)},E.allocUnsafeSlow=function(k){if(typeof k!="number")throw new TypeError("Argument must be a number");return w.SlowBuffer(k)}})(safeBuffer$1,safeBuffer$1.exports);var safeBufferExports=safeBuffer$1.exports,util$2={};function isArray(b){return Array.isArray?Array.isArray(b):objectToString(b)==="[object Array]"}util$2.isArray=isArray;function isBoolean(b){return typeof b=="boolean"}util$2.isBoolean=isBoolean;function isNull(b){return b===null}util$2.isNull=isNull;function isNullOrUndefined(b){return b==null}util$2.isNullOrUndefined=isNullOrUndefined;function isNumber(b){return typeof b=="number"}util$2.isNumber=isNumber;function isString(b){return typeof b=="string"}util$2.isString=isString;function isSymbol(b){return typeof b=="symbol"}util$2.isSymbol=isSymbol;function isUndefined(b){return b===void 0}util$2.isUndefined=isUndefined;function isRegExp(b){return objectToString(b)==="[object RegExp]"}util$2.isRegExp=isRegExp;function isObject(b){return typeof b=="object"&&b!==null}util$2.isObject=isObject;function isDate(b){return objectToString(b)==="[object Date]"}util$2.isDate=isDate;function isError(b){return objectToString(b)==="[object Error]"||b instanceof Error}util$2.isError=isError;function isFunction(b){return typeof b=="function"}util$2.isFunction=isFunction;function isPrimitive(b){return b===null||typeof b=="boolean"||typeof b=="number"||typeof b=="string"||typeof b=="symbol"||typeof b>"u"}util$2.isPrimitive=isPrimitive;util$2.isBuffer=require$$1$2.Buffer.isBuffer;function objectToString(b){return Object.prototype.toString.call(b)}var BufferList={exports:{}},hasRequiredBufferList;function requireBufferList(){return hasRequiredBufferList||(hasRequiredBufferList=1,function(b){function v(E,k){if(!(E instanceof k))throw new TypeError("Cannot call a class as a function")}var w=safeBufferExports.Buffer,_=util$3;function A(E,k,P){E.copy(k,P)}b.exports=function(){function E(){v(this,E),this.head=null,this.tail=null,this.length=0}return E.prototype.push=function(P){var N={data:P,next:null};this.length>0?this.tail.next=N:this.head=N,this.tail=N,++this.length},E.prototype.unshift=function(P){var N={data:P,next:this.head};this.length===0&&(this.tail=N),this.head=N,++this.length},E.prototype.shift=function(){if(this.length!==0){var P=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,P}},E.prototype.clear=function(){this.head=this.tail=null,this.length=0},E.prototype.join=function(P){if(this.length===0)return"";for(var N=this.head,q=""+N.data;N=N.next;)q+=P+N.data;return q},E.prototype.concat=function(P){if(this.length===0)return w.alloc(0);for(var N=w.allocUnsafe(P>>>0),q=this.head,B=0;q;)A(q.data,N,B),B+=q.data.length,q=q.next;return N},E}(),_&&_.inspect&&_.inspect.custom&&(b.exports.prototype[_.inspect.custom]=function(){var E=_.inspect({length:this.length});return this.constructor.name+" "+E})}(BufferList)),BufferList.exports}var pna=processNextickArgsExports;function destroy(b,v){var w=this,_=this._readableState&&this._readableState.destroyed,A=this._writableState&&this._writableState.destroyed;return _||A?(v?v(b):b&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,pna.nextTick(emitErrorNT,this,b)):pna.nextTick(emitErrorNT,this,b)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(b||null,function(E){!v&&E?w._writableState?w._writableState.errorEmitted||(w._writableState.errorEmitted=!0,pna.nextTick(emitErrorNT,w,E)):pna.nextTick(emitErrorNT,w,E):v&&v(E)}),this)}function undestroy(){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)}function emitErrorNT(b,v){b.emit("error",v)}var destroy_1={destroy,undestroy},_stream_writable,hasRequired_stream_writable;function require_stream_writable(){if(hasRequired_stream_writable)return _stream_writable;hasRequired_stream_writable=1;var b=processNextickArgsExports;_stream_writable=ee;function v(X){var re=this;this.next=null,this.entry=null,this.finish=function(){F(re,X)}}var w=!process$1.browser&&["v0.10","v0.9."].indexOf(process$1.version.slice(0,5))>-1?setImmediate:b.nextTick,_;ee.WritableState=D;var A=Object.create(util$2);A.inherits=inherits_browserExports;var E={deprecate:browser$a},k=streamBrowser,P=safeBufferExports.Buffer,N=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function q(X){return P.from(X)}function B(X){return P.isBuffer(X)||X instanceof N}var O=destroy_1;A.inherits(ee,k);function I(){}function D(X,re){_=_||require_stream_duplex(),X=X||{};var ie=re instanceof _;this.objectMode=!!X.objectMode,ie&&(this.objectMode=this.objectMode||!!X.writableObjectMode);var Q=X.highWaterMark,ne=X.writableHighWaterMark,L=this.objectMode?16:16*1024;Q||Q===0?this.highWaterMark=Q:ie&&(ne||ne===0)?this.highWaterMark=ne:this.highWaterMark=L,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var ue=X.decodeStrings===!1;this.decodeStrings=!ue,this.defaultEncoding=X.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Ae){de(re,Ae)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new v(this)}D.prototype.getBuffer=function(){for(var re=this.bufferedRequest,ie=[];re;)ie.push(re),re=re.next;return ie},function(){try{Object.defineProperty(D.prototype,"buffer",{get:E.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var V;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(V=Function.prototype[Symbol.hasInstance],Object.defineProperty(ee,Symbol.hasInstance,{value:function(X){return V.call(this,X)?!0:this!==ee?!1:X&&X._writableState instanceof D}})):V=function(X){return X instanceof this};function ee(X){if(_=_||require_stream_duplex(),!V.call(ee,this)&&!(this instanceof _))return new ee(X);this._writableState=new D(X,this),this.writable=!0,X&&(typeof X.write=="function"&&(this._write=X.write),typeof X.writev=="function"&&(this._writev=X.writev),typeof X.destroy=="function"&&(this._destroy=X.destroy),typeof X.final=="function"&&(this._final=X.final)),k.call(this)}ee.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function J(X,re){var ie=new Error("write after end");X.emit("error",ie),b.nextTick(re,ie)}function te(X,re,ie,Q){var ne=!0,L=!1;return ie===null?L=new TypeError("May not write null values to stream"):typeof ie!="string"&&ie!==void 0&&!re.objectMode&&(L=new TypeError("Invalid non-string/buffer chunk")),L&&(X.emit("error",L),b.nextTick(Q,L),ne=!1),ne}ee.prototype.write=function(X,re,ie){var Q=this._writableState,ne=!1,L=!Q.objectMode&&B(X);return L&&!P.isBuffer(X)&&(X=q(X)),typeof re=="function"&&(ie=re,re=null),L?re="buffer":re||(re=Q.defaultEncoding),typeof ie!="function"&&(ie=I),Q.ended?J(this,ie):(L||te(this,Q,X,ie))&&(Q.pendingcb++,ne=ce(this,Q,L,X,re,ie)),ne},ee.prototype.cork=function(){var X=this._writableState;X.corked++},ee.prototype.uncork=function(){var X=this._writableState;X.corked&&(X.corked--,!X.writing&&!X.corked&&!X.bufferProcessing&&X.bufferedRequest&&pe(this,X))},ee.prototype.setDefaultEncoding=function(re){if(typeof re=="string"&&(re=re.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((re+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+re);return this._writableState.defaultEncoding=re,this};function se(X,re,ie){return!X.objectMode&&X.decodeStrings!==!1&&typeof re=="string"&&(re=P.from(re,ie)),re}Object.defineProperty(ee.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function ce(X,re,ie,Q,ne,L){if(!ie){var ue=se(re,Q,ne);Q!==ue&&(ie=!0,ne="buffer",Q=ue)}var Ae=re.objectMode?1:Q.length;re.length+=Ae;var Re=re.length<re.highWaterMark;if(Re||(re.needDrain=!0),re.writing||re.corked){var Pe=re.lastBufferedRequest;re.lastBufferedRequest={chunk:Q,encoding:ne,isBuf:ie,callback:L,next:null},Pe?Pe.next=re.lastBufferedRequest:re.bufferedRequest=re.lastBufferedRequest,re.bufferedRequestCount+=1}else ae(X,re,!1,Ae,Q,ne,L);return Re}function ae(X,re,ie,Q,ne,L,ue){re.writelen=Q,re.writecb=ue,re.writing=!0,re.sync=!0,ie?X._writev(ne,re.onwrite):X._write(ne,L,re.onwrite),re.sync=!1}function he(X,re,ie,Q,ne){--re.pendingcb,ie?(b.nextTick(ne,Q),b.nextTick(S,X,re),X._writableState.errorEmitted=!0,X.emit("error",Q)):(ne(Q),X._writableState.errorEmitted=!0,X.emit("error",Q),S(X,re))}function oe(X){X.writing=!1,X.writecb=null,X.length-=X.writelen,X.writelen=0}function de(X,re){var ie=X._writableState,Q=ie.sync,ne=ie.writecb;if(oe(ie),re)he(X,ie,Q,re,ne);else{var L=fe(ie);!L&&!ie.corked&&!ie.bufferProcessing&&ie.bufferedRequest&&pe(X,ie),Q?w(le,X,ie,L,ne):le(X,ie,L,ne)}}function le(X,re,ie,Q){ie||be(X,re),re.pendingcb--,Q(),S(X,re)}function be(X,re){re.length===0&&re.needDrain&&(re.needDrain=!1,X.emit("drain"))}function pe(X,re){re.bufferProcessing=!0;var ie=re.bufferedRequest;if(X._writev&&ie&&ie.next){var Q=re.bufferedRequestCount,ne=new Array(Q),L=re.corkedRequestsFree;L.entry=ie;for(var ue=0,Ae=!0;ie;)ne[ue]=ie,ie.isBuf||(Ae=!1),ie=ie.next,ue+=1;ne.allBuffers=Ae,ae(X,re,!0,re.length,ne,"",L.finish),re.pendingcb++,re.lastBufferedRequest=null,L.next?(re.corkedRequestsFree=L.next,L.next=null):re.corkedRequestsFree=new v(re),re.bufferedRequestCount=0}else{for(;ie;){var Re=ie.chunk,Pe=ie.encoding,xe=ie.callback,ge=re.objectMode?1:Re.length;if(ae(X,re,!1,ge,Re,Pe,xe),ie=ie.next,re.bufferedRequestCount--,re.writing)break}ie===null&&(re.lastBufferedRequest=null)}re.bufferedRequest=ie,re.bufferProcessing=!1}ee.prototype._write=function(X,re,ie){ie(new Error("_write() is not implemented"))},ee.prototype._writev=null,ee.prototype.end=function(X,re,ie){var Q=this._writableState;typeof X=="function"?(ie=X,X=null,re=null):typeof re=="function"&&(ie=re,re=null),X!=null&&this.write(X,re),Q.corked&&(Q.corked=1,this.uncork()),Q.ending||C(this,Q,ie)};function fe(X){return X.ending&&X.length===0&&X.bufferedRequest===null&&!X.finished&&!X.writing}function Z(X,re){X._final(function(ie){re.pendingcb--,ie&&X.emit("error",ie),re.prefinished=!0,X.emit("prefinish"),S(X,re)})}function U(X,re){!re.prefinished&&!re.finalCalled&&(typeof X._final=="function"?(re.pendingcb++,re.finalCalled=!0,b.nextTick(Z,X,re)):(re.prefinished=!0,X.emit("prefinish")))}function S(X,re){var ie=fe(re);return ie&&(U(X,re),re.pendingcb===0&&(re.finished=!0,X.emit("finish"))),ie}function C(X,re,ie){re.ending=!0,S(X,re),ie&&(re.finished?b.nextTick(ie):X.once("finish",ie)),re.ended=!0,X.writable=!1}function F(X,re,ie){var Q=X.entry;for(X.entry=null;Q;){var ne=Q.callback;re.pendingcb--,ne(ie),Q=Q.next}re.corkedRequestsFree.next=X}return Object.defineProperty(ee.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(X){this._writableState&&(this._writableState.destroyed=X)}}),ee.prototype.destroy=O.destroy,ee.prototype._undestroy=O.undestroy,ee.prototype._destroy=function(X,re){this.end(),re(X)},_stream_writable}var _stream_duplex,hasRequired_stream_duplex;function require_stream_duplex(){if(hasRequired_stream_duplex)return _stream_duplex;hasRequired_stream_duplex=1;var b=processNextickArgsExports,v=Object.keys||function(O){var I=[];for(var D in O)I.push(D);return I};_stream_duplex=N;var w=Object.create(util$2);w.inherits=inherits_browserExports;var _=require_stream_readable(),A=require_stream_writable();w.inherits(N,_);for(var E=v(A.prototype),k=0;k<E.length;k++){var P=E[k];N.prototype[P]||(N.prototype[P]=A.prototype[P])}function N(O){if(!(this instanceof N))return new N(O);_.call(this,O),A.call(this,O),O&&O.readable===!1&&(this.readable=!1),O&&O.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,O&&O.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",q)}Object.defineProperty(N.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function q(){this.allowHalfOpen||this._writableState.ended||b.nextTick(B,this)}function B(O){O.end()}return Object.defineProperty(N.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(O){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=O,this._writableState.destroyed=O)}}),N.prototype._destroy=function(O,I){this.push(null),this.end(),b.nextTick(I,O)},_stream_duplex}var _stream_readable,hasRequired_stream_readable;function require_stream_readable(){if(hasRequired_stream_readable)return _stream_readable;hasRequired_stream_readable=1;var b=processNextickArgsExports;_stream_readable=se;var v=isarray,w;se.ReadableState=te,eventsExports.EventEmitter;var _=function(xe,ge){return xe.listeners(ge).length},A=streamBrowser,E=safeBufferExports.Buffer,k=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function P(xe){return E.from(xe)}function N(xe){return E.isBuffer(xe)||xe instanceof k}var q=Object.create(util$2);q.inherits=inherits_browserExports;var B=util$3,O=void 0;B&&B.debuglog?O=B.debuglog("stream"):O=function(){};var I=requireBufferList(),D=destroy_1,V;q.inherits(se,A);var ee=["error","close","destroy","pause","resume"];function J(xe,ge,_e){if(typeof xe.prependListener=="function")return xe.prependListener(ge,_e);!xe._events||!xe._events[ge]?xe.on(ge,_e):v(xe._events[ge])?xe._events[ge].unshift(_e):xe._events[ge]=[_e,xe._events[ge]]}function te(xe,ge){w=w||require_stream_duplex(),xe=xe||{};var _e=ge instanceof w;this.objectMode=!!xe.objectMode,_e&&(this.objectMode=this.objectMode||!!xe.readableObjectMode);var ke=xe.highWaterMark,Ee=xe.readableHighWaterMark,Se=this.objectMode?16:16*1024;ke||ke===0?this.highWaterMark=ke:_e&&(Ee||Ee===0)?this.highWaterMark=Ee:this.highWaterMark=Se,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new I,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.destroyed=!1,this.defaultEncoding=xe.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,xe.encoding&&(V||(V=string_decoder.StringDecoder),this.decoder=new V(xe.encoding),this.encoding=xe.encoding)}function se(xe){if(w=w||require_stream_duplex(),!(this instanceof se))return new se(xe);this._readableState=new te(xe,this),this.readable=!0,xe&&(typeof xe.read=="function"&&(this._read=xe.read),typeof xe.destroy=="function"&&(this._destroy=xe.destroy)),A.call(this)}Object.defineProperty(se.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(xe){this._readableState&&(this._readableState.destroyed=xe)}}),se.prototype.destroy=D.destroy,se.prototype._undestroy=D.undestroy,se.prototype._destroy=function(xe,ge){this.push(null),ge(xe)},se.prototype.push=function(xe,ge){var _e=this._readableState,ke;return _e.objectMode?ke=!0:typeof xe=="string"&&(ge=ge||_e.defaultEncoding,ge!==_e.encoding&&(xe=E.from(xe,ge),ge=""),ke=!0),ce(this,xe,ge,!1,ke)},se.prototype.unshift=function(xe){return ce(this,xe,null,!0,!1)};function ce(xe,ge,_e,ke,Ee){var Se=xe._readableState;if(ge===null)Se.reading=!1,pe(xe,Se);else{var Oe;Ee||(Oe=he(Se,ge)),Oe?xe.emit("error",Oe):Se.objectMode||ge&&ge.length>0?(typeof ge!="string"&&!Se.objectMode&&Object.getPrototypeOf(ge)!==E.prototype&&(ge=P(ge)),ke?Se.endEmitted?xe.emit("error",new Error("stream.unshift() after end event")):ae(xe,Se,ge,!0):Se.ended?xe.emit("error",new Error("stream.push() after EOF")):(Se.reading=!1,Se.decoder&&!_e?(ge=Se.decoder.write(ge),Se.objectMode||ge.length!==0?ae(xe,Se,ge,!1):U(xe,Se)):ae(xe,Se,ge,!1))):ke||(Se.reading=!1)}return oe(Se)}function ae(xe,ge,_e,ke){ge.flowing&&ge.length===0&&!ge.sync?(xe.emit("data",_e),xe.read(0)):(ge.length+=ge.objectMode?1:_e.length,ke?ge.buffer.unshift(_e):ge.buffer.push(_e),ge.needReadable&&fe(xe)),U(xe,ge)}function he(xe,ge){var _e;return!N(ge)&&typeof ge!="string"&&ge!==void 0&&!xe.objectMode&&(_e=new TypeError("Invalid non-string/buffer chunk")),_e}function oe(xe){return!xe.ended&&(xe.needReadable||xe.length<xe.highWaterMark||xe.length===0)}se.prototype.isPaused=function(){return this._readableState.flowing===!1},se.prototype.setEncoding=function(xe){return V||(V=string_decoder.StringDecoder),this._readableState.decoder=new V(xe),this._readableState.encoding=xe,this};var de=8388608;function le(xe){return xe>=de?xe=de:(xe--,xe|=xe>>>1,xe|=xe>>>2,xe|=xe>>>4,xe|=xe>>>8,xe|=xe>>>16,xe++),xe}function be(xe,ge){return xe<=0||ge.length===0&&ge.ended?0:ge.objectMode?1:xe!==xe?ge.flowing&&ge.length?ge.buffer.head.data.length:ge.length:(xe>ge.highWaterMark&&(ge.highWaterMark=le(xe)),xe<=ge.length?xe:ge.ended?ge.length:(ge.needReadable=!0,0))}se.prototype.read=function(xe){O("read",xe),xe=parseInt(xe,10);var ge=this._readableState,_e=xe;if(xe!==0&&(ge.emittedReadable=!1),xe===0&&ge.needReadable&&(ge.length>=ge.highWaterMark||ge.ended))return O("read: emitReadable",ge.length,ge.ended),ge.length===0&&ge.ended?Ae(this):fe(this),null;if(xe=be(xe,ge),xe===0&&ge.ended)return ge.length===0&&Ae(this),null;var ke=ge.needReadable;O("need readable",ke),(ge.length===0||ge.length-xe<ge.highWaterMark)&&(ke=!0,O("length less than watermark",ke)),ge.ended||ge.reading?(ke=!1,O("reading or ended",ke)):ke&&(O("do read"),ge.reading=!0,ge.sync=!0,ge.length===0&&(ge.needReadable=!0),this._read(ge.highWaterMark),ge.sync=!1,ge.reading||(xe=be(_e,ge)));var Ee;return xe>0?Ee=Q(xe,ge):Ee=null,Ee===null?(ge.needReadable=!0,xe=0):ge.length-=xe,ge.length===0&&(ge.ended||(ge.needReadable=!0),_e!==xe&&ge.ended&&Ae(this)),Ee!==null&&this.emit("data",Ee),Ee};function pe(xe,ge){if(!ge.ended){if(ge.decoder){var _e=ge.decoder.end();_e&&_e.length&&(ge.buffer.push(_e),ge.length+=ge.objectMode?1:_e.length)}ge.ended=!0,fe(xe)}}function fe(xe){var ge=xe._readableState;ge.needReadable=!1,ge.emittedReadable||(O("emitReadable",ge.flowing),ge.emittedReadable=!0,ge.sync?b.nextTick(Z,xe):Z(xe))}function Z(xe){O("emit readable"),xe.emit("readable"),ie(xe)}function U(xe,ge){ge.readingMore||(ge.readingMore=!0,b.nextTick(S,xe,ge))}function S(xe,ge){for(var _e=ge.length;!ge.reading&&!ge.flowing&&!ge.ended&&ge.length<ge.highWaterMark&&(O("maybeReadMore read 0"),xe.read(0),_e!==ge.length);)_e=ge.length;ge.readingMore=!1}se.prototype._read=function(xe){this.emit("error",new Error("_read() is not implemented"))},se.prototype.pipe=function(xe,ge){var _e=this,ke=this._readableState;switch(ke.pipesCount){case 0:ke.pipes=xe;break;case 1:ke.pipes=[ke.pipes,xe];break;default:ke.pipes.push(xe);break}ke.pipesCount+=1,O("pipe count=%d opts=%j",ke.pipesCount,ge);var Ee=(!ge||ge.end!==!1)&&xe!==process$1.stdout&&xe!==process$1.stderr,Se=Ee?Ne:Qe;ke.endEmitted?b.nextTick(Se):_e.once("end",Se),xe.on("unpipe",Oe);function Oe(Xe,at){O("onunpipe"),Xe===_e&&at&&at.hasUnpiped===!1&&(at.hasUnpiped=!0,Te())}function Ne(){O("onend"),xe.end()}var ve=C(_e);xe.on("drain",ve);var Ce=!1;function Te(){O("cleanup"),xe.removeListener("close",Ke),xe.removeListener("finish",We),xe.removeListener("drain",ve),xe.removeListener("error",De),xe.removeListener("unpipe",Oe),_e.removeListener("end",Ne),_e.removeListener("end",Qe),_e.removeListener("data",Be),Ce=!0,ke.awaitDrain&&(!xe._writableState||xe._writableState.needDrain)&&ve()}var Le=!1;_e.on("data",Be);function Be(Xe){O("ondata"),Le=!1;var at=xe.write(Xe);at===!1&&!Le&&((ke.pipesCount===1&&ke.pipes===xe||ke.pipesCount>1&&Pe(ke.pipes,xe)!==-1)&&!Ce&&(O("false write response, pause",ke.awaitDrain),ke.awaitDrain++,Le=!0),_e.pause())}function De(Xe){O("onerror",Xe),Qe(),xe.removeListener("error",De),_(xe,"error")===0&&xe.emit("error",Xe)}J(xe,"error",De);function Ke(){xe.removeListener("finish",We),Qe()}xe.once("close",Ke);function We(){O("onfinish"),xe.removeListener("close",Ke),Qe()}xe.once("finish",We);function Qe(){O("unpipe"),_e.unpipe(xe)}return xe.emit("pipe",_e),ke.flowing||(O("pipe resume"),_e.resume()),xe};function C(xe){return function(){var ge=xe._readableState;O("pipeOnDrain",ge.awaitDrain),ge.awaitDrain&&ge.awaitDrain--,ge.awaitDrain===0&&_(xe,"data")&&(ge.flowing=!0,ie(xe))}}se.prototype.unpipe=function(xe){var ge=this._readableState,_e={hasUnpiped:!1};if(ge.pipesCount===0)return this;if(ge.pipesCount===1)return xe&&xe!==ge.pipes?this:(xe||(xe=ge.pipes),ge.pipes=null,ge.pipesCount=0,ge.flowing=!1,xe&&xe.emit("unpipe",this,_e),this);if(!xe){var ke=ge.pipes,Ee=ge.pipesCount;ge.pipes=null,ge.pipesCount=0,ge.flowing=!1;for(var Se=0;Se<Ee;Se++)ke[Se].emit("unpipe",this,{hasUnpiped:!1});return this}var Oe=Pe(ge.pipes,xe);return Oe===-1?this:(ge.pipes.splice(Oe,1),ge.pipesCount-=1,ge.pipesCount===1&&(ge.pipes=ge.pipes[0]),xe.emit("unpipe",this,_e),this)},se.prototype.on=function(xe,ge){var _e=A.prototype.on.call(this,xe,ge);if(xe==="data")this._readableState.flowing!==!1&&this.resume();else if(xe==="readable"){var ke=this._readableState;!ke.endEmitted&&!ke.readableListening&&(ke.readableListening=ke.needReadable=!0,ke.emittedReadable=!1,ke.reading?ke.length&&fe(this):b.nextTick(F,this))}return _e},se.prototype.addListener=se.prototype.on;function F(xe){O("readable nexttick read 0"),xe.read(0)}se.prototype.resume=function(){var xe=this._readableState;return xe.flowing||(O("resume"),xe.flowing=!0,X(this,xe)),this};function X(xe,ge){ge.resumeScheduled||(ge.resumeScheduled=!0,b.nextTick(re,xe,ge))}function re(xe,ge){ge.reading||(O("resume read 0"),xe.read(0)),ge.resumeScheduled=!1,ge.awaitDrain=0,xe.emit("resume"),ie(xe),ge.flowing&&!ge.reading&&xe.read(0)}se.prototype.pause=function(){return O("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(O("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function ie(xe){var ge=xe._readableState;for(O("flow",ge.flowing);ge.flowing&&xe.read()!==null;);}se.prototype.wrap=function(xe){var ge=this,_e=this._readableState,ke=!1;xe.on("end",function(){if(O("wrapped end"),_e.decoder&&!_e.ended){var Oe=_e.decoder.end();Oe&&Oe.length&&ge.push(Oe)}ge.push(null)}),xe.on("data",function(Oe){if(O("wrapped data"),_e.decoder&&(Oe=_e.decoder.write(Oe)),!(_e.objectMode&&Oe==null)&&!(!_e.objectMode&&(!Oe||!Oe.length))){var Ne=ge.push(Oe);Ne||(ke=!0,xe.pause())}});for(var Ee in xe)this[Ee]===void 0&&typeof xe[Ee]=="function"&&(this[Ee]=function(Oe){return function(){return xe[Oe].apply(xe,arguments)}}(Ee));for(var Se=0;Se<ee.length;Se++)xe.on(ee[Se],this.emit.bind(this,ee[Se]));return this._read=function(Oe){O("wrapped _read",Oe),ke&&(ke=!1,xe.resume())},this},Object.defineProperty(se.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),se._fromList=Q;function Q(xe,ge){if(ge.length===0)return null;var _e;return ge.objectMode?_e=ge.buffer.shift():!xe||xe>=ge.length?(ge.decoder?_e=ge.buffer.join(""):ge.buffer.length===1?_e=ge.buffer.head.data:_e=ge.buffer.concat(ge.length),ge.buffer.clear()):_e=ne(xe,ge.buffer,ge.decoder),_e}function ne(xe,ge,_e){var ke;return xe<ge.head.data.length?(ke=ge.head.data.slice(0,xe),ge.head.data=ge.head.data.slice(xe)):xe===ge.head.data.length?ke=ge.shift():ke=_e?L(xe,ge):ue(xe,ge),ke}function L(xe,ge){var _e=ge.head,ke=1,Ee=_e.data;for(xe-=Ee.length;_e=_e.next;){var Se=_e.data,Oe=xe>Se.length?Se.length:xe;if(Oe===Se.length?Ee+=Se:Ee+=Se.slice(0,xe),xe-=Oe,xe===0){Oe===Se.length?(++ke,_e.next?ge.head=_e.next:ge.head=ge.tail=null):(ge.head=_e,_e.data=Se.slice(Oe));break}++ke}return ge.length-=ke,Ee}function ue(xe,ge){var _e=E.allocUnsafe(xe),ke=ge.head,Ee=1;for(ke.data.copy(_e),xe-=ke.data.length;ke=ke.next;){var Se=ke.data,Oe=xe>Se.length?Se.length:xe;if(Se.copy(_e,_e.length-xe,0,Oe),xe-=Oe,xe===0){Oe===Se.length?(++Ee,ke.next?ge.head=ke.next:ge.head=ge.tail=null):(ge.head=ke,ke.data=Se.slice(Oe));break}++Ee}return ge.length-=Ee,_e}function Ae(xe){var ge=xe._readableState;if(ge.length>0)throw new Error('"endReadable()" called on non-empty stream');ge.endEmitted||(ge.ended=!0,b.nextTick(Re,ge,xe))}function Re(xe,ge){!xe.endEmitted&&xe.length===0&&(xe.endEmitted=!0,ge.readable=!1,ge.emit("end"))}function Pe(xe,ge){for(var _e=0,ke=xe.length;_e<ke;_e++)if(xe[_e]===ge)return _e;return-1}return _stream_readable}var _stream_transform=Transform$1,Duplex=require_stream_duplex(),util$1=Object.create(util$2);util$1.inherits=inherits_browserExports;util$1.inherits(Transform$1,Duplex);function afterTransform(b,v){var w=this._transformState;w.transforming=!1;var _=w.writecb;if(!_)return this.emit("error",new Error("write callback called multiple times"));w.writechunk=null,w.writecb=null,v!=null&&this.push(v),_(b);var A=this._readableState;A.reading=!1,(A.needReadable||A.length<A.highWaterMark)&&this._read(A.highWaterMark)}function Transform$1(b){if(!(this instanceof Transform$1))return new Transform$1(b);Duplex.call(this,b),this._transformState={afterTransform:afterTransform.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,b&&(typeof b.transform=="function"&&(this._transform=b.transform),typeof b.flush=="function"&&(this._flush=b.flush)),this.on("prefinish",prefinish)}function prefinish(){var b=this;typeof this._flush=="function"?this._flush(function(v,w){done(b,v,w)}):done(this,null,null)}Transform$1.prototype.push=function(b,v){return this._transformState.needTransform=!1,Duplex.prototype.push.call(this,b,v)};Transform$1.prototype._transform=function(b,v,w){throw new Error("_transform() is not implemented")};Transform$1.prototype._write=function(b,v,w){var _=this._transformState;if(_.writecb=w,_.writechunk=b,_.writeencoding=v,!_.transforming){var A=this._readableState;(_.needTransform||A.needReadable||A.length<A.highWaterMark)&&this._read(A.highWaterMark)}};Transform$1.prototype._read=function(b){var v=this._transformState;v.writechunk!==null&&v.writecb&&!v.transforming?(v.transforming=!0,this._transform(v.writechunk,v.writeencoding,v.afterTransform)):v.needTransform=!0};Transform$1.prototype._destroy=function(b,v){var w=this;Duplex.prototype._destroy.call(this,b,function(_){v(_),w.emit("close")})};function done(b,v,w){if(v)return b.emit("error",v);if(w!=null&&b.push(w),b._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(b._transformState.transforming)throw new Error("Calling transform done when still transforming");return b.push(null)}var _stream_passthrough=PassThrough,Transform=_stream_transform,util=Object.create(util$2);util.inherits=inherits_browserExports;util.inherits(PassThrough,Transform);function PassThrough(b){if(!(this instanceof PassThrough))return new PassThrough(b);Transform.call(this,b)}PassThrough.prototype._transform=function(b,v,w){w(null,b)};(function(b,v){v=b.exports=require_stream_readable(),v.Stream=v,v.Readable=v,v.Writable=require_stream_writable(),v.Duplex=require_stream_duplex(),v.Transform=_stream_transform,v.PassThrough=_stream_passthrough})(readableBrowser,readableBrowser.exports);var readableBrowserExports=readableBrowser.exports,sign={exports:{}},bn$1={exports:{}};bn$1.exports;(function(b){(function(v,w){function _(U,S){if(!U)throw new Error(S||"Assertion failed")}function A(U,S){U.super_=S;var C=function(){};C.prototype=S.prototype,U.prototype=new C,U.prototype.constructor=U}function E(U,S,C){if(E.isBN(U))return U;this.negative=0,this.words=null,this.length=0,this.red=null,U!==null&&((S==="le"||S==="be")&&(C=S,S=10),this._init(U||0,S||10,C||"be"))}typeof v=="object"?v.exports=E:w.BN=E,E.BN=E,E.wordSize=26;var k;try{typeof window<"u"&&typeof window.Buffer<"u"?k=window.Buffer:k=require$$1$2.Buffer}catch{}E.isBN=function(S){return S instanceof E?!0:S!==null&&typeof S=="object"&&S.constructor.wordSize===E.wordSize&&Array.isArray(S.words)},E.max=function(S,C){return S.cmp(C)>0?S:C},E.min=function(S,C){return S.cmp(C)<0?S:C},E.prototype._init=function(S,C,F){if(typeof S=="number")return this._initNumber(S,C,F);if(typeof S=="object")return this._initArray(S,C,F);C==="hex"&&(C=16),_(C===(C|0)&&C>=2&&C<=36),S=S.toString().replace(/\s+/g,"");var X=0;S[0]==="-"&&(X++,this.negative=1),X<S.length&&(C===16?this._parseHex(S,X,F):(this._parseBase(S,C,X),F==="le"&&this._initArray(this.toArray(),C,F)))},E.prototype._initNumber=function(S,C,F){S<0&&(this.negative=1,S=-S),S<67108864?(this.words=[S&67108863],this.length=1):S<4503599627370496?(this.words=[S&67108863,S/67108864&67108863],this.length=2):(_(S<9007199254740992),this.words=[S&67108863,S/67108864&67108863,1],this.length=3),F==="le"&&this._initArray(this.toArray(),C,F)},E.prototype._initArray=function(S,C,F){if(_(typeof S.length=="number"),S.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(S.length/3),this.words=new Array(this.length);for(var X=0;X<this.length;X++)this.words[X]=0;var re,ie,Q=0;if(F==="be")for(X=S.length-1,re=0;X>=0;X-=3)ie=S[X]|S[X-1]<<8|S[X-2]<<16,this.words[re]|=ie<<Q&67108863,this.words[re+1]=ie>>>26-Q&67108863,Q+=24,Q>=26&&(Q-=26,re++);else if(F==="le")for(X=0,re=0;X<S.length;X+=3)ie=S[X]|S[X+1]<<8|S[X+2]<<16,this.words[re]|=ie<<Q&67108863,this.words[re+1]=ie>>>26-Q&67108863,Q+=24,Q>=26&&(Q-=26,re++);return this._strip()};function P(U,S){var C=U.charCodeAt(S);if(C>=48&&C<=57)return C-48;if(C>=65&&C<=70)return C-55;if(C>=97&&C<=102)return C-87;_(!1,"Invalid character in "+U)}function N(U,S,C){var F=P(U,C);return C-1>=S&&(F|=P(U,C-1)<<4),F}E.prototype._parseHex=function(S,C,F){this.length=Math.ceil((S.length-C)/6),this.words=new Array(this.length);for(var X=0;X<this.length;X++)this.words[X]=0;var re=0,ie=0,Q;if(F==="be")for(X=S.length-1;X>=C;X-=2)Q=N(S,C,X)<<re,this.words[ie]|=Q&67108863,re>=18?(re-=18,ie+=1,this.words[ie]|=Q>>>26):re+=8;else{var ne=S.length-C;for(X=ne%2===0?C+1:C;X<S.length;X+=2)Q=N(S,C,X)<<re,this.words[ie]|=Q&67108863,re>=18?(re-=18,ie+=1,this.words[ie]|=Q>>>26):re+=8}this._strip()};function q(U,S,C,F){for(var X=0,re=0,ie=Math.min(U.length,C),Q=S;Q<ie;Q++){var ne=U.charCodeAt(Q)-48;X*=F,ne>=49?re=ne-49+10:ne>=17?re=ne-17+10:re=ne,_(ne>=0&&re<F,"Invalid character"),X+=re}return X}E.prototype._parseBase=function(S,C,F){this.words=[0],this.length=1;for(var X=0,re=1;re<=67108863;re*=C)X++;X--,re=re/C|0;for(var ie=S.length-F,Q=ie%X,ne=Math.min(ie,ie-Q)+F,L=0,ue=F;ue<ne;ue+=X)L=q(S,ue,ue+X,C),this.imuln(re),this.words[0]+L<67108864?this.words[0]+=L:this._iaddn(L);if(Q!==0){var Ae=1;for(L=q(S,ue,S.length,C),ue=0;ue<Q;ue++)Ae*=C;this.imuln(Ae),this.words[0]+L<67108864?this.words[0]+=L:this._iaddn(L)}this._strip()},E.prototype.copy=function(S){S.words=new Array(this.length);for(var C=0;C<this.length;C++)S.words[C]=this.words[C];S.length=this.length,S.negative=this.negative,S.red=this.red};function B(U,S){U.words=S.words,U.length=S.length,U.negative=S.negative,U.red=S.red}if(E.prototype._move=function(S){B(S,this)},E.prototype.clone=function(){var S=new E(null);return this.copy(S),S},E.prototype._expand=function(S){for(;this.length<S;)this.words[this.length++]=0;return this},E.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},E.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{E.prototype[Symbol.for("nodejs.util.inspect.custom")]=O}catch{E.prototype.inspect=O}else E.prototype.inspect=O;function O(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var I=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],D=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],V=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];E.prototype.toString=function(S,C){S=S||10,C=C|0||1;var F;if(S===16||S==="hex"){F="";for(var X=0,re=0,ie=0;ie<this.length;ie++){var Q=this.words[ie],ne=((Q<<X|re)&16777215).toString(16);re=Q>>>24-X&16777215,X+=2,X>=26&&(X-=26,ie--),re!==0||ie!==this.length-1?F=I[6-ne.length]+ne+F:F=ne+F}for(re!==0&&(F=re.toString(16)+F);F.length%C!==0;)F="0"+F;return this.negative!==0&&(F="-"+F),F}if(S===(S|0)&&S>=2&&S<=36){var L=D[S],ue=V[S];F="";var Ae=this.clone();for(Ae.negative=0;!Ae.isZero();){var Re=Ae.modrn(ue).toString(S);Ae=Ae.idivn(ue),Ae.isZero()?F=Re+F:F=I[L-Re.length]+Re+F}for(this.isZero()&&(F="0"+F);F.length%C!==0;)F="0"+F;return this.negative!==0&&(F="-"+F),F}_(!1,"Base should be between 2 and 36")},E.prototype.toNumber=function(){var S=this.words[0];return this.length===2?S+=this.words[1]*67108864:this.length===3&&this.words[2]===1?S+=4503599627370496+this.words[1]*67108864:this.length>2&&_(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-S:S},E.prototype.toJSON=function(){return this.toString(16,2)},k&&(E.prototype.toBuffer=function(S,C){return this.toArrayLike(k,S,C)}),E.prototype.toArray=function(S,C){return this.toArrayLike(Array,S,C)};var ee=function(S,C){return S.allocUnsafe?S.allocUnsafe(C):new S(C)};E.prototype.toArrayLike=function(S,C,F){this._strip();var X=this.byteLength(),re=F||Math.max(1,X);_(X<=re,"byte array longer than desired length"),_(re>0,"Requested array length <= 0");var ie=ee(S,re),Q=C==="le"?"LE":"BE";return this["_toArrayLike"+Q](ie,X),ie},E.prototype._toArrayLikeLE=function(S,C){for(var F=0,X=0,re=0,ie=0;re<this.length;re++){var Q=this.words[re]<<ie|X;S[F++]=Q&255,F<S.length&&(S[F++]=Q>>8&255),F<S.length&&(S[F++]=Q>>16&255),ie===6?(F<S.length&&(S[F++]=Q>>24&255),X=0,ie=0):(X=Q>>>24,ie+=2)}if(F<S.length)for(S[F++]=X;F<S.length;)S[F++]=0},E.prototype._toArrayLikeBE=function(S,C){for(var F=S.length-1,X=0,re=0,ie=0;re<this.length;re++){var Q=this.words[re]<<ie|X;S[F--]=Q&255,F>=0&&(S[F--]=Q>>8&255),F>=0&&(S[F--]=Q>>16&255),ie===6?(F>=0&&(S[F--]=Q>>24&255),X=0,ie=0):(X=Q>>>24,ie+=2)}if(F>=0)for(S[F--]=X;F>=0;)S[F--]=0},Math.clz32?E.prototype._countBits=function(S){return 32-Math.clz32(S)}:E.prototype._countBits=function(S){var C=S,F=0;return C>=4096&&(F+=13,C>>>=13),C>=64&&(F+=7,C>>>=7),C>=8&&(F+=4,C>>>=4),C>=2&&(F+=2,C>>>=2),F+C},E.prototype._zeroBits=function(S){if(S===0)return 26;var C=S,F=0;return C&8191||(F+=13,C>>>=13),C&127||(F+=7,C>>>=7),C&15||(F+=4,C>>>=4),C&3||(F+=2,C>>>=2),C&1||F++,F},E.prototype.bitLength=function(){var S=this.words[this.length-1],C=this._countBits(S);return(this.length-1)*26+C};function J(U){for(var S=new Array(U.bitLength()),C=0;C<S.length;C++){var F=C/26|0,X=C%26;S[C]=U.words[F]>>>X&1}return S}E.prototype.zeroBits=function(){if(this.isZero())return 0;for(var S=0,C=0;C<this.length;C++){var F=this._zeroBits(this.words[C]);if(S+=F,F!==26)break}return S},E.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},E.prototype.toTwos=function(S){return this.negative!==0?this.abs().inotn(S).iaddn(1):this.clone()},E.prototype.fromTwos=function(S){return this.testn(S-1)?this.notn(S).iaddn(1).ineg():this.clone()},E.prototype.isNeg=function(){return this.negative!==0},E.prototype.neg=function(){return this.clone().ineg()},E.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},E.prototype.iuor=function(S){for(;this.length<S.length;)this.words[this.length++]=0;for(var C=0;C<S.length;C++)this.words[C]=this.words[C]|S.words[C];return this._strip()},E.prototype.ior=function(S){return _((this.negative|S.negative)===0),this.iuor(S)},E.prototype.or=function(S){return this.length>S.length?this.clone().ior(S):S.clone().ior(this)},E.prototype.uor=function(S){return this.length>S.length?this.clone().iuor(S):S.clone().iuor(this)},E.prototype.iuand=function(S){var C;this.length>S.length?C=S:C=this;for(var F=0;F<C.length;F++)this.words[F]=this.words[F]&S.words[F];return this.length=C.length,this._strip()},E.prototype.iand=function(S){return _((this.negative|S.negative)===0),this.iuand(S)},E.prototype.and=function(S){return this.length>S.length?this.clone().iand(S):S.clone().iand(this)},E.prototype.uand=function(S){return this.length>S.length?this.clone().iuand(S):S.clone().iuand(this)},E.prototype.iuxor=function(S){var C,F;this.length>S.length?(C=this,F=S):(C=S,F=this);for(var X=0;X<F.length;X++)this.words[X]=C.words[X]^F.words[X];if(this!==C)for(;X<C.length;X++)this.words[X]=C.words[X];return this.length=C.length,this._strip()},E.prototype.ixor=function(S){return _((this.negative|S.negative)===0),this.iuxor(S)},E.prototype.xor=function(S){return this.length>S.length?this.clone().ixor(S):S.clone().ixor(this)},E.prototype.uxor=function(S){return this.length>S.length?this.clone().iuxor(S):S.clone().iuxor(this)},E.prototype.inotn=function(S){_(typeof S=="number"&&S>=0);var C=Math.ceil(S/26)|0,F=S%26;this._expand(C),F>0&&C--;for(var X=0;X<C;X++)this.words[X]=~this.words[X]&67108863;return F>0&&(this.words[X]=~this.words[X]&67108863>>26-F),this._strip()},E.prototype.notn=function(S){return this.clone().inotn(S)},E.prototype.setn=function(S,C){_(typeof S=="number"&&S>=0);var F=S/26|0,X=S%26;return this._expand(F+1),C?this.words[F]=this.words[F]|1<<X:this.words[F]=this.words[F]&~(1<<X),this._strip()},E.prototype.iadd=function(S){var C;if(this.negative!==0&&S.negative===0)return this.negative=0,C=this.isub(S),this.negative^=1,this._normSign();if(this.negative===0&&S.negative!==0)return S.negative=0,C=this.isub(S),S.negative=1,C._normSign();var F,X;this.length>S.length?(F=this,X=S):(F=S,X=this);for(var re=0,ie=0;ie<X.length;ie++)C=(F.words[ie]|0)+(X.words[ie]|0)+re,this.words[ie]=C&67108863,re=C>>>26;for(;re!==0&&ie<F.length;ie++)C=(F.words[ie]|0)+re,this.words[ie]=C&67108863,re=C>>>26;if(this.length=F.length,re!==0)this.words[this.length]=re,this.length++;else if(F!==this)for(;ie<F.length;ie++)this.words[ie]=F.words[ie];return this},E.prototype.add=function(S){var C;return S.negative!==0&&this.negative===0?(S.negative=0,C=this.sub(S),S.negative^=1,C):S.negative===0&&this.negative!==0?(this.negative=0,C=S.sub(this),this.negative=1,C):this.length>S.length?this.clone().iadd(S):S.clone().iadd(this)},E.prototype.isub=function(S){if(S.negative!==0){S.negative=0;var C=this.iadd(S);return S.negative=1,C._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(S),this.negative=1,this._normSign();var F=this.cmp(S);if(F===0)return this.negative=0,this.length=1,this.words[0]=0,this;var X,re;F>0?(X=this,re=S):(X=S,re=this);for(var ie=0,Q=0;Q<re.length;Q++)C=(X.words[Q]|0)-(re.words[Q]|0)+ie,ie=C>>26,this.words[Q]=C&67108863;for(;ie!==0&&Q<X.length;Q++)C=(X.words[Q]|0)+ie,ie=C>>26,this.words[Q]=C&67108863;if(ie===0&&Q<X.length&&X!==this)for(;Q<X.length;Q++)this.words[Q]=X.words[Q];return this.length=Math.max(this.length,Q),X!==this&&(this.negative=1),this._strip()},E.prototype.sub=function(S){return this.clone().isub(S)};function te(U,S,C){C.negative=S.negative^U.negative;var F=U.length+S.length|0;C.length=F,F=F-1|0;var X=U.words[0]|0,re=S.words[0]|0,ie=X*re,Q=ie&67108863,ne=ie/67108864|0;C.words[0]=Q;for(var L=1;L<F;L++){for(var ue=ne>>>26,Ae=ne&67108863,Re=Math.min(L,S.length-1),Pe=Math.max(0,L-U.length+1);Pe<=Re;Pe++){var xe=L-Pe|0;X=U.words[xe]|0,re=S.words[Pe]|0,ie=X*re+Ae,ue+=ie/67108864|0,Ae=ie&67108863}C.words[L]=Ae|0,ne=ue|0}return ne!==0?C.words[L]=ne|0:C.length--,C._strip()}var se=function(S,C,F){var X=S.words,re=C.words,ie=F.words,Q=0,ne,L,ue,Ae=X[0]|0,Re=Ae&8191,Pe=Ae>>>13,xe=X[1]|0,ge=xe&8191,_e=xe>>>13,ke=X[2]|0,Ee=ke&8191,Se=ke>>>13,Oe=X[3]|0,Ne=Oe&8191,ve=Oe>>>13,Ce=X[4]|0,Te=Ce&8191,Le=Ce>>>13,Be=X[5]|0,De=Be&8191,Ke=Be>>>13,We=X[6]|0,Qe=We&8191,Xe=We>>>13,at=X[7]|0,Fe=at&8191,qe=at>>>13,$e=X[8]|0,Ie=$e&8191,we=$e>>>13,me=X[9]|0,ye=me&8191,Me=me>>>13,je=re[0]|0,He=je&8191,Ue=je>>>13,rt=re[1]|0,it=rt&8191,tt=rt>>>13,mt=re[2]|0,st=mt&8191,lt=mt>>>13,Ct=re[3]|0,St=Ct&8191,dt=Ct>>>13,Ot=re[4]|0,xt=Ot&8191,ht=Ot>>>13,Nt=re[5]|0,wt=Nt&8191,ct=Nt>>>13,Rt=re[6]|0,gt=Rt&8191,pt=Rt>>>13,Tt=re[7]|0,yt=Tt&8191,ut=Tt>>>13,Mt=re[8]|0,_t=Mt&8191,ot=Mt>>>13,It=re[9]|0,Et=It&8191,At=It>>>13;F.negative=S.negative^C.negative,F.length=19,ne=Math.imul(Re,He),L=Math.imul(Re,Ue),L=L+Math.imul(Pe,He)|0,ue=Math.imul(Pe,Ue);var Gt=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,ne=Math.imul(ge,He),L=Math.imul(ge,Ue),L=L+Math.imul(_e,He)|0,ue=Math.imul(_e,Ue),ne=ne+Math.imul(Re,it)|0,L=L+Math.imul(Re,tt)|0,L=L+Math.imul(Pe,it)|0,ue=ue+Math.imul(Pe,tt)|0;var Ut=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,ne=Math.imul(Ee,He),L=Math.imul(Ee,Ue),L=L+Math.imul(Se,He)|0,ue=Math.imul(Se,Ue),ne=ne+Math.imul(ge,it)|0,L=L+Math.imul(ge,tt)|0,L=L+Math.imul(_e,it)|0,ue=ue+Math.imul(_e,tt)|0,ne=ne+Math.imul(Re,st)|0,L=L+Math.imul(Re,lt)|0,L=L+Math.imul(Pe,st)|0,ue=ue+Math.imul(Pe,lt)|0;var jt=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(jt>>>26)|0,jt&=67108863,ne=Math.imul(Ne,He),L=Math.imul(Ne,Ue),L=L+Math.imul(ve,He)|0,ue=Math.imul(ve,Ue),ne=ne+Math.imul(Ee,it)|0,L=L+Math.imul(Ee,tt)|0,L=L+Math.imul(Se,it)|0,ue=ue+Math.imul(Se,tt)|0,ne=ne+Math.imul(ge,st)|0,L=L+Math.imul(ge,lt)|0,L=L+Math.imul(_e,st)|0,ue=ue+Math.imul(_e,lt)|0,ne=ne+Math.imul(Re,St)|0,L=L+Math.imul(Re,dt)|0,L=L+Math.imul(Pe,St)|0,ue=ue+Math.imul(Pe,dt)|0;var Ft=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,ne=Math.imul(Te,He),L=Math.imul(Te,Ue),L=L+Math.imul(Le,He)|0,ue=Math.imul(Le,Ue),ne=ne+Math.imul(Ne,it)|0,L=L+Math.imul(Ne,tt)|0,L=L+Math.imul(ve,it)|0,ue=ue+Math.imul(ve,tt)|0,ne=ne+Math.imul(Ee,st)|0,L=L+Math.imul(Ee,lt)|0,L=L+Math.imul(Se,st)|0,ue=ue+Math.imul(Se,lt)|0,ne=ne+Math.imul(ge,St)|0,L=L+Math.imul(ge,dt)|0,L=L+Math.imul(_e,St)|0,ue=ue+Math.imul(_e,dt)|0,ne=ne+Math.imul(Re,xt)|0,L=L+Math.imul(Re,ht)|0,L=L+Math.imul(Pe,xt)|0,ue=ue+Math.imul(Pe,ht)|0;var Ht=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,ne=Math.imul(De,He),L=Math.imul(De,Ue),L=L+Math.imul(Ke,He)|0,ue=Math.imul(Ke,Ue),ne=ne+Math.imul(Te,it)|0,L=L+Math.imul(Te,tt)|0,L=L+Math.imul(Le,it)|0,ue=ue+Math.imul(Le,tt)|0,ne=ne+Math.imul(Ne,st)|0,L=L+Math.imul(Ne,lt)|0,L=L+Math.imul(ve,st)|0,ue=ue+Math.imul(ve,lt)|0,ne=ne+Math.imul(Ee,St)|0,L=L+Math.imul(Ee,dt)|0,L=L+Math.imul(Se,St)|0,ue=ue+Math.imul(Se,dt)|0,ne=ne+Math.imul(ge,xt)|0,L=L+Math.imul(ge,ht)|0,L=L+Math.imul(_e,xt)|0,ue=ue+Math.imul(_e,ht)|0,ne=ne+Math.imul(Re,wt)|0,L=L+Math.imul(Re,ct)|0,L=L+Math.imul(Pe,wt)|0,ue=ue+Math.imul(Pe,ct)|0;var Ge=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,ne=Math.imul(Qe,He),L=Math.imul(Qe,Ue),L=L+Math.imul(Xe,He)|0,ue=Math.imul(Xe,Ue),ne=ne+Math.imul(De,it)|0,L=L+Math.imul(De,tt)|0,L=L+Math.imul(Ke,it)|0,ue=ue+Math.imul(Ke,tt)|0,ne=ne+Math.imul(Te,st)|0,L=L+Math.imul(Te,lt)|0,L=L+Math.imul(Le,st)|0,ue=ue+Math.imul(Le,lt)|0,ne=ne+Math.imul(Ne,St)|0,L=L+Math.imul(Ne,dt)|0,L=L+Math.imul(ve,St)|0,ue=ue+Math.imul(ve,dt)|0,ne=ne+Math.imul(Ee,xt)|0,L=L+Math.imul(Ee,ht)|0,L=L+Math.imul(Se,xt)|0,ue=ue+Math.imul(Se,ht)|0,ne=ne+Math.imul(ge,wt)|0,L=L+Math.imul(ge,ct)|0,L=L+Math.imul(_e,wt)|0,ue=ue+Math.imul(_e,ct)|0,ne=ne+Math.imul(Re,gt)|0,L=L+Math.imul(Re,pt)|0,L=L+Math.imul(Pe,gt)|0,ue=ue+Math.imul(Pe,pt)|0;var ze=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(ze>>>26)|0,ze&=67108863,ne=Math.imul(Fe,He),L=Math.imul(Fe,Ue),L=L+Math.imul(qe,He)|0,ue=Math.imul(qe,Ue),ne=ne+Math.imul(Qe,it)|0,L=L+Math.imul(Qe,tt)|0,L=L+Math.imul(Xe,it)|0,ue=ue+Math.imul(Xe,tt)|0,ne=ne+Math.imul(De,st)|0,L=L+Math.imul(De,lt)|0,L=L+Math.imul(Ke,st)|0,ue=ue+Math.imul(Ke,lt)|0,ne=ne+Math.imul(Te,St)|0,L=L+Math.imul(Te,dt)|0,L=L+Math.imul(Le,St)|0,ue=ue+Math.imul(Le,dt)|0,ne=ne+Math.imul(Ne,xt)|0,L=L+Math.imul(Ne,ht)|0,L=L+Math.imul(ve,xt)|0,ue=ue+Math.imul(ve,ht)|0,ne=ne+Math.imul(Ee,wt)|0,L=L+Math.imul(Ee,ct)|0,L=L+Math.imul(Se,wt)|0,ue=ue+Math.imul(Se,ct)|0,ne=ne+Math.imul(ge,gt)|0,L=L+Math.imul(ge,pt)|0,L=L+Math.imul(_e,gt)|0,ue=ue+Math.imul(_e,pt)|0,ne=ne+Math.imul(Re,yt)|0,L=L+Math.imul(Re,ut)|0,L=L+Math.imul(Pe,yt)|0,ue=ue+Math.imul(Pe,ut)|0;var Ve=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Ve>>>26)|0,Ve&=67108863,ne=Math.imul(Ie,He),L=Math.imul(Ie,Ue),L=L+Math.imul(we,He)|0,ue=Math.imul(we,Ue),ne=ne+Math.imul(Fe,it)|0,L=L+Math.imul(Fe,tt)|0,L=L+Math.imul(qe,it)|0,ue=ue+Math.imul(qe,tt)|0,ne=ne+Math.imul(Qe,st)|0,L=L+Math.imul(Qe,lt)|0,L=L+Math.imul(Xe,st)|0,ue=ue+Math.imul(Xe,lt)|0,ne=ne+Math.imul(De,St)|0,L=L+Math.imul(De,dt)|0,L=L+Math.imul(Ke,St)|0,ue=ue+Math.imul(Ke,dt)|0,ne=ne+Math.imul(Te,xt)|0,L=L+Math.imul(Te,ht)|0,L=L+Math.imul(Le,xt)|0,ue=ue+Math.imul(Le,ht)|0,ne=ne+Math.imul(Ne,wt)|0,L=L+Math.imul(Ne,ct)|0,L=L+Math.imul(ve,wt)|0,ue=ue+Math.imul(ve,ct)|0,ne=ne+Math.imul(Ee,gt)|0,L=L+Math.imul(Ee,pt)|0,L=L+Math.imul(Se,gt)|0,ue=ue+Math.imul(Se,pt)|0,ne=ne+Math.imul(ge,yt)|0,L=L+Math.imul(ge,ut)|0,L=L+Math.imul(_e,yt)|0,ue=ue+Math.imul(_e,ut)|0,ne=ne+Math.imul(Re,_t)|0,L=L+Math.imul(Re,ot)|0,L=L+Math.imul(Pe,_t)|0,ue=ue+Math.imul(Pe,ot)|0;var Ze=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Ze>>>26)|0,Ze&=67108863,ne=Math.imul(ye,He),L=Math.imul(ye,Ue),L=L+Math.imul(Me,He)|0,ue=Math.imul(Me,Ue),ne=ne+Math.imul(Ie,it)|0,L=L+Math.imul(Ie,tt)|0,L=L+Math.imul(we,it)|0,ue=ue+Math.imul(we,tt)|0,ne=ne+Math.imul(Fe,st)|0,L=L+Math.imul(Fe,lt)|0,L=L+Math.imul(qe,st)|0,ue=ue+Math.imul(qe,lt)|0,ne=ne+Math.imul(Qe,St)|0,L=L+Math.imul(Qe,dt)|0,L=L+Math.imul(Xe,St)|0,ue=ue+Math.imul(Xe,dt)|0,ne=ne+Math.imul(De,xt)|0,L=L+Math.imul(De,ht)|0,L=L+Math.imul(Ke,xt)|0,ue=ue+Math.imul(Ke,ht)|0,ne=ne+Math.imul(Te,wt)|0,L=L+Math.imul(Te,ct)|0,L=L+Math.imul(Le,wt)|0,ue=ue+Math.imul(Le,ct)|0,ne=ne+Math.imul(Ne,gt)|0,L=L+Math.imul(Ne,pt)|0,L=L+Math.imul(ve,gt)|0,ue=ue+Math.imul(ve,pt)|0,ne=ne+Math.imul(Ee,yt)|0,L=L+Math.imul(Ee,ut)|0,L=L+Math.imul(Se,yt)|0,ue=ue+Math.imul(Se,ut)|0,ne=ne+Math.imul(ge,_t)|0,L=L+Math.imul(ge,ot)|0,L=L+Math.imul(_e,_t)|0,ue=ue+Math.imul(_e,ot)|0,ne=ne+Math.imul(Re,Et)|0,L=L+Math.imul(Re,At)|0,L=L+Math.imul(Pe,Et)|0,ue=ue+Math.imul(Pe,At)|0;var Je=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Je>>>26)|0,Je&=67108863,ne=Math.imul(ye,it),L=Math.imul(ye,tt),L=L+Math.imul(Me,it)|0,ue=Math.imul(Me,tt),ne=ne+Math.imul(Ie,st)|0,L=L+Math.imul(Ie,lt)|0,L=L+Math.imul(we,st)|0,ue=ue+Math.imul(we,lt)|0,ne=ne+Math.imul(Fe,St)|0,L=L+Math.imul(Fe,dt)|0,L=L+Math.imul(qe,St)|0,ue=ue+Math.imul(qe,dt)|0,ne=ne+Math.imul(Qe,xt)|0,L=L+Math.imul(Qe,ht)|0,L=L+Math.imul(Xe,xt)|0,ue=ue+Math.imul(Xe,ht)|0,ne=ne+Math.imul(De,wt)|0,L=L+Math.imul(De,ct)|0,L=L+Math.imul(Ke,wt)|0,ue=ue+Math.imul(Ke,ct)|0,ne=ne+Math.imul(Te,gt)|0,L=L+Math.imul(Te,pt)|0,L=L+Math.imul(Le,gt)|0,ue=ue+Math.imul(Le,pt)|0,ne=ne+Math.imul(Ne,yt)|0,L=L+Math.imul(Ne,ut)|0,L=L+Math.imul(ve,yt)|0,ue=ue+Math.imul(ve,ut)|0,ne=ne+Math.imul(Ee,_t)|0,L=L+Math.imul(Ee,ot)|0,L=L+Math.imul(Se,_t)|0,ue=ue+Math.imul(Se,ot)|0,ne=ne+Math.imul(ge,Et)|0,L=L+Math.imul(ge,At)|0,L=L+Math.imul(_e,Et)|0,ue=ue+Math.imul(_e,At)|0;var Ye=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Ye>>>26)|0,Ye&=67108863,ne=Math.imul(ye,st),L=Math.imul(ye,lt),L=L+Math.imul(Me,st)|0,ue=Math.imul(Me,lt),ne=ne+Math.imul(Ie,St)|0,L=L+Math.imul(Ie,dt)|0,L=L+Math.imul(we,St)|0,ue=ue+Math.imul(we,dt)|0,ne=ne+Math.imul(Fe,xt)|0,L=L+Math.imul(Fe,ht)|0,L=L+Math.imul(qe,xt)|0,ue=ue+Math.imul(qe,ht)|0,ne=ne+Math.imul(Qe,wt)|0,L=L+Math.imul(Qe,ct)|0,L=L+Math.imul(Xe,wt)|0,ue=ue+Math.imul(Xe,ct)|0,ne=ne+Math.imul(De,gt)|0,L=L+Math.imul(De,pt)|0,L=L+Math.imul(Ke,gt)|0,ue=ue+Math.imul(Ke,pt)|0,ne=ne+Math.imul(Te,yt)|0,L=L+Math.imul(Te,ut)|0,L=L+Math.imul(Le,yt)|0,ue=ue+Math.imul(Le,ut)|0,ne=ne+Math.imul(Ne,_t)|0,L=L+Math.imul(Ne,ot)|0,L=L+Math.imul(ve,_t)|0,ue=ue+Math.imul(ve,ot)|0,ne=ne+Math.imul(Ee,Et)|0,L=L+Math.imul(Ee,At)|0,L=L+Math.imul(Se,Et)|0,ue=ue+Math.imul(Se,At)|0;var et=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(et>>>26)|0,et&=67108863,ne=Math.imul(ye,St),L=Math.imul(ye,dt),L=L+Math.imul(Me,St)|0,ue=Math.imul(Me,dt),ne=ne+Math.imul(Ie,xt)|0,L=L+Math.imul(Ie,ht)|0,L=L+Math.imul(we,xt)|0,ue=ue+Math.imul(we,ht)|0,ne=ne+Math.imul(Fe,wt)|0,L=L+Math.imul(Fe,ct)|0,L=L+Math.imul(qe,wt)|0,ue=ue+Math.imul(qe,ct)|0,ne=ne+Math.imul(Qe,gt)|0,L=L+Math.imul(Qe,pt)|0,L=L+Math.imul(Xe,gt)|0,ue=ue+Math.imul(Xe,pt)|0,ne=ne+Math.imul(De,yt)|0,L=L+Math.imul(De,ut)|0,L=L+Math.imul(Ke,yt)|0,ue=ue+Math.imul(Ke,ut)|0,ne=ne+Math.imul(Te,_t)|0,L=L+Math.imul(Te,ot)|0,L=L+Math.imul(Le,_t)|0,ue=ue+Math.imul(Le,ot)|0,ne=ne+Math.imul(Ne,Et)|0,L=L+Math.imul(Ne,At)|0,L=L+Math.imul(ve,Et)|0,ue=ue+Math.imul(ve,At)|0;var nt=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(nt>>>26)|0,nt&=67108863,ne=Math.imul(ye,xt),L=Math.imul(ye,ht),L=L+Math.imul(Me,xt)|0,ue=Math.imul(Me,ht),ne=ne+Math.imul(Ie,wt)|0,L=L+Math.imul(Ie,ct)|0,L=L+Math.imul(we,wt)|0,ue=ue+Math.imul(we,ct)|0,ne=ne+Math.imul(Fe,gt)|0,L=L+Math.imul(Fe,pt)|0,L=L+Math.imul(qe,gt)|0,ue=ue+Math.imul(qe,pt)|0,ne=ne+Math.imul(Qe,yt)|0,L=L+Math.imul(Qe,ut)|0,L=L+Math.imul(Xe,yt)|0,ue=ue+Math.imul(Xe,ut)|0,ne=ne+Math.imul(De,_t)|0,L=L+Math.imul(De,ot)|0,L=L+Math.imul(Ke,_t)|0,ue=ue+Math.imul(Ke,ot)|0,ne=ne+Math.imul(Te,Et)|0,L=L+Math.imul(Te,At)|0,L=L+Math.imul(Le,Et)|0,ue=ue+Math.imul(Le,At)|0;var vt=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(vt>>>26)|0,vt&=67108863,ne=Math.imul(ye,wt),L=Math.imul(ye,ct),L=L+Math.imul(Me,wt)|0,ue=Math.imul(Me,ct),ne=ne+Math.imul(Ie,gt)|0,L=L+Math.imul(Ie,pt)|0,L=L+Math.imul(we,gt)|0,ue=ue+Math.imul(we,pt)|0,ne=ne+Math.imul(Fe,yt)|0,L=L+Math.imul(Fe,ut)|0,L=L+Math.imul(qe,yt)|0,ue=ue+Math.imul(qe,ut)|0,ne=ne+Math.imul(Qe,_t)|0,L=L+Math.imul(Qe,ot)|0,L=L+Math.imul(Xe,_t)|0,ue=ue+Math.imul(Xe,ot)|0,ne=ne+Math.imul(De,Et)|0,L=L+Math.imul(De,At)|0,L=L+Math.imul(Ke,Et)|0,ue=ue+Math.imul(Ke,At)|0;var kt=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(kt>>>26)|0,kt&=67108863,ne=Math.imul(ye,gt),L=Math.imul(ye,pt),L=L+Math.imul(Me,gt)|0,ue=Math.imul(Me,pt),ne=ne+Math.imul(Ie,yt)|0,L=L+Math.imul(Ie,ut)|0,L=L+Math.imul(we,yt)|0,ue=ue+Math.imul(we,ut)|0,ne=ne+Math.imul(Fe,_t)|0,L=L+Math.imul(Fe,ot)|0,L=L+Math.imul(qe,_t)|0,ue=ue+Math.imul(qe,ot)|0,ne=ne+Math.imul(Qe,Et)|0,L=L+Math.imul(Qe,At)|0,L=L+Math.imul(Xe,Et)|0,ue=ue+Math.imul(Xe,At)|0;var bt=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(bt>>>26)|0,bt&=67108863,ne=Math.imul(ye,yt),L=Math.imul(ye,ut),L=L+Math.imul(Me,yt)|0,ue=Math.imul(Me,ut),ne=ne+Math.imul(Ie,_t)|0,L=L+Math.imul(Ie,ot)|0,L=L+Math.imul(we,_t)|0,ue=ue+Math.imul(we,ot)|0,ne=ne+Math.imul(Fe,Et)|0,L=L+Math.imul(Fe,At)|0,L=L+Math.imul(qe,Et)|0,ue=ue+Math.imul(qe,At)|0;var Bt=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,ne=Math.imul(ye,_t),L=Math.imul(ye,ot),L=L+Math.imul(Me,_t)|0,ue=Math.imul(Me,ot),ne=ne+Math.imul(Ie,Et)|0,L=L+Math.imul(Ie,At)|0,L=L+Math.imul(we,Et)|0,ue=ue+Math.imul(we,At)|0;var Pt=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,ne=Math.imul(ye,Et),L=Math.imul(ye,At),L=L+Math.imul(Me,Et)|0,ue=Math.imul(Me,At);var $t=(Q+ne|0)+((L&8191)<<13)|0;return Q=(ue+(L>>>13)|0)+($t>>>26)|0,$t&=67108863,ie[0]=Gt,ie[1]=Ut,ie[2]=jt,ie[3]=Ft,ie[4]=Ht,ie[5]=Ge,ie[6]=ze,ie[7]=Ve,ie[8]=Ze,ie[9]=Je,ie[10]=Ye,ie[11]=et,ie[12]=nt,ie[13]=vt,ie[14]=kt,ie[15]=bt,ie[16]=Bt,ie[17]=Pt,ie[18]=$t,Q!==0&&(ie[19]=Q,F.length++),F};Math.imul||(se=te);function ce(U,S,C){C.negative=S.negative^U.negative,C.length=U.length+S.length;for(var F=0,X=0,re=0;re<C.length-1;re++){var ie=X;X=0;for(var Q=F&67108863,ne=Math.min(re,S.length-1),L=Math.max(0,re-U.length+1);L<=ne;L++){var ue=re-L,Ae=U.words[ue]|0,Re=S.words[L]|0,Pe=Ae*Re,xe=Pe&67108863;ie=ie+(Pe/67108864|0)|0,xe=xe+Q|0,Q=xe&67108863,ie=ie+(xe>>>26)|0,X+=ie>>>26,ie&=67108863}C.words[re]=Q,F=ie,ie=X}return F!==0?C.words[re]=F:C.length--,C._strip()}function ae(U,S,C){return ce(U,S,C)}E.prototype.mulTo=function(S,C){var F,X=this.length+S.length;return this.length===10&&S.length===10?F=se(this,S,C):X<63?F=te(this,S,C):X<1024?F=ce(this,S,C):F=ae(this,S,C),F},E.prototype.mul=function(S){var C=new E(null);return C.words=new Array(this.length+S.length),this.mulTo(S,C)},E.prototype.mulf=function(S){var C=new E(null);return C.words=new Array(this.length+S.length),ae(this,S,C)},E.prototype.imul=function(S){return this.clone().mulTo(S,this)},E.prototype.imuln=function(S){var C=S<0;C&&(S=-S),_(typeof S=="number"),_(S<67108864);for(var F=0,X=0;X<this.length;X++){var re=(this.words[X]|0)*S,ie=(re&67108863)+(F&67108863);F>>=26,F+=re/67108864|0,F+=ie>>>26,this.words[X]=ie&67108863}return F!==0&&(this.words[X]=F,this.length++),C?this.ineg():this},E.prototype.muln=function(S){return this.clone().imuln(S)},E.prototype.sqr=function(){return this.mul(this)},E.prototype.isqr=function(){return this.imul(this.clone())},E.prototype.pow=function(S){var C=J(S);if(C.length===0)return new E(1);for(var F=this,X=0;X<C.length&&C[X]===0;X++,F=F.sqr());if(++X<C.length)for(var re=F.sqr();X<C.length;X++,re=re.sqr())C[X]!==0&&(F=F.mul(re));return F},E.prototype.iushln=function(S){_(typeof S=="number"&&S>=0);var C=S%26,F=(S-C)/26,X=67108863>>>26-C<<26-C,re;if(C!==0){var ie=0;for(re=0;re<this.length;re++){var Q=this.words[re]&X,ne=(this.words[re]|0)-Q<<C;this.words[re]=ne|ie,ie=Q>>>26-C}ie&&(this.words[re]=ie,this.length++)}if(F!==0){for(re=this.length-1;re>=0;re--)this.words[re+F]=this.words[re];for(re=0;re<F;re++)this.words[re]=0;this.length+=F}return this._strip()},E.prototype.ishln=function(S){return _(this.negative===0),this.iushln(S)},E.prototype.iushrn=function(S,C,F){_(typeof S=="number"&&S>=0);var X;C?X=(C-C%26)/26:X=0;var re=S%26,ie=Math.min((S-re)/26,this.length),Q=67108863^67108863>>>re<<re,ne=F;if(X-=ie,X=Math.max(0,X),ne){for(var L=0;L<ie;L++)ne.words[L]=this.words[L];ne.length=ie}if(ie!==0)if(this.length>ie)for(this.length-=ie,L=0;L<this.length;L++)this.words[L]=this.words[L+ie];else this.words[0]=0,this.length=1;var ue=0;for(L=this.length-1;L>=0&&(ue!==0||L>=X);L--){var Ae=this.words[L]|0;this.words[L]=ue<<26-re|Ae>>>re,ue=Ae&Q}return ne&&ue!==0&&(ne.words[ne.length++]=ue),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},E.prototype.ishrn=function(S,C,F){return _(this.negative===0),this.iushrn(S,C,F)},E.prototype.shln=function(S){return this.clone().ishln(S)},E.prototype.ushln=function(S){return this.clone().iushln(S)},E.prototype.shrn=function(S){return this.clone().ishrn(S)},E.prototype.ushrn=function(S){return this.clone().iushrn(S)},E.prototype.testn=function(S){_(typeof S=="number"&&S>=0);var C=S%26,F=(S-C)/26,X=1<<C;if(this.length<=F)return!1;var re=this.words[F];return!!(re&X)},E.prototype.imaskn=function(S){_(typeof S=="number"&&S>=0);var C=S%26,F=(S-C)/26;if(_(this.negative===0,"imaskn works only with positive numbers"),this.length<=F)return this;if(C!==0&&F++,this.length=Math.min(F,this.length),C!==0){var X=67108863^67108863>>>C<<C;this.words[this.length-1]&=X}return this._strip()},E.prototype.maskn=function(S){return this.clone().imaskn(S)},E.prototype.iaddn=function(S){return _(typeof S=="number"),_(S<67108864),S<0?this.isubn(-S):this.negative!==0?this.length===1&&(this.words[0]|0)<=S?(this.words[0]=S-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(S),this.negative=1,this):this._iaddn(S)},E.prototype._iaddn=function(S){this.words[0]+=S;for(var C=0;C<this.length&&this.words[C]>=67108864;C++)this.words[C]-=67108864,C===this.length-1?this.words[C+1]=1:this.words[C+1]++;return this.length=Math.max(this.length,C+1),this},E.prototype.isubn=function(S){if(_(typeof S=="number"),_(S<67108864),S<0)return this.iaddn(-S);if(this.negative!==0)return this.negative=0,this.iaddn(S),this.negative=1,this;if(this.words[0]-=S,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var C=0;C<this.length&&this.words[C]<0;C++)this.words[C]+=67108864,this.words[C+1]-=1;return this._strip()},E.prototype.addn=function(S){return this.clone().iaddn(S)},E.prototype.subn=function(S){return this.clone().isubn(S)},E.prototype.iabs=function(){return this.negative=0,this},E.prototype.abs=function(){return this.clone().iabs()},E.prototype._ishlnsubmul=function(S,C,F){var X=S.length+F,re;this._expand(X);var ie,Q=0;for(re=0;re<S.length;re++){ie=(this.words[re+F]|0)+Q;var ne=(S.words[re]|0)*C;ie-=ne&67108863,Q=(ie>>26)-(ne/67108864|0),this.words[re+F]=ie&67108863}for(;re<this.length-F;re++)ie=(this.words[re+F]|0)+Q,Q=ie>>26,this.words[re+F]=ie&67108863;if(Q===0)return this._strip();for(_(Q===-1),Q=0,re=0;re<this.length;re++)ie=-(this.words[re]|0)+Q,Q=ie>>26,this.words[re]=ie&67108863;return this.negative=1,this._strip()},E.prototype._wordDiv=function(S,C){var F=this.length-S.length,X=this.clone(),re=S,ie=re.words[re.length-1]|0,Q=this._countBits(ie);F=26-Q,F!==0&&(re=re.ushln(F),X.iushln(F),ie=re.words[re.length-1]|0);var ne=X.length-re.length,L;if(C!=="mod"){L=new E(null),L.length=ne+1,L.words=new Array(L.length);for(var ue=0;ue<L.length;ue++)L.words[ue]=0}var Ae=X.clone()._ishlnsubmul(re,1,ne);Ae.negative===0&&(X=Ae,L&&(L.words[ne]=1));for(var Re=ne-1;Re>=0;Re--){var Pe=(X.words[re.length+Re]|0)*67108864+(X.words[re.length+Re-1]|0);for(Pe=Math.min(Pe/ie|0,67108863),X._ishlnsubmul(re,Pe,Re);X.negative!==0;)Pe--,X.negative=0,X._ishlnsubmul(re,1,Re),X.isZero()||(X.negative^=1);L&&(L.words[Re]=Pe)}return L&&L._strip(),X._strip(),C!=="div"&&F!==0&&X.iushrn(F),{div:L||null,mod:X}},E.prototype.divmod=function(S,C,F){if(_(!S.isZero()),this.isZero())return{div:new E(0),mod:new E(0)};var X,re,ie;return this.negative!==0&&S.negative===0?(ie=this.neg().divmod(S,C),C!=="mod"&&(X=ie.div.neg()),C!=="div"&&(re=ie.mod.neg(),F&&re.negative!==0&&re.iadd(S)),{div:X,mod:re}):this.negative===0&&S.negative!==0?(ie=this.divmod(S.neg(),C),C!=="mod"&&(X=ie.div.neg()),{div:X,mod:ie.mod}):this.negative&S.negative?(ie=this.neg().divmod(S.neg(),C),C!=="div"&&(re=ie.mod.neg(),F&&re.negative!==0&&re.isub(S)),{div:ie.div,mod:re}):S.length>this.length||this.cmp(S)<0?{div:new E(0),mod:this}:S.length===1?C==="div"?{div:this.divn(S.words[0]),mod:null}:C==="mod"?{div:null,mod:new E(this.modrn(S.words[0]))}:{div:this.divn(S.words[0]),mod:new E(this.modrn(S.words[0]))}:this._wordDiv(S,C)},E.prototype.div=function(S){return this.divmod(S,"div",!1).div},E.prototype.mod=function(S){return this.divmod(S,"mod",!1).mod},E.prototype.umod=function(S){return this.divmod(S,"mod",!0).mod},E.prototype.divRound=function(S){var C=this.divmod(S);if(C.mod.isZero())return C.div;var F=C.div.negative!==0?C.mod.isub(S):C.mod,X=S.ushrn(1),re=S.andln(1),ie=F.cmp(X);return ie<0||re===1&&ie===0?C.div:C.div.negative!==0?C.div.isubn(1):C.div.iaddn(1)},E.prototype.modrn=function(S){var C=S<0;C&&(S=-S),_(S<=67108863);for(var F=(1<<26)%S,X=0,re=this.length-1;re>=0;re--)X=(F*X+(this.words[re]|0))%S;return C?-X:X},E.prototype.modn=function(S){return this.modrn(S)},E.prototype.idivn=function(S){var C=S<0;C&&(S=-S),_(S<=67108863);for(var F=0,X=this.length-1;X>=0;X--){var re=(this.words[X]|0)+F*67108864;this.words[X]=re/S|0,F=re%S}return this._strip(),C?this.ineg():this},E.prototype.divn=function(S){return this.clone().idivn(S)},E.prototype.egcd=function(S){_(S.negative===0),_(!S.isZero());var C=this,F=S.clone();C.negative!==0?C=C.umod(S):C=C.clone();for(var X=new E(1),re=new E(0),ie=new E(0),Q=new E(1),ne=0;C.isEven()&&F.isEven();)C.iushrn(1),F.iushrn(1),++ne;for(var L=F.clone(),ue=C.clone();!C.isZero();){for(var Ae=0,Re=1;!(C.words[0]&Re)&&Ae<26;++Ae,Re<<=1);if(Ae>0)for(C.iushrn(Ae);Ae-- >0;)(X.isOdd()||re.isOdd())&&(X.iadd(L),re.isub(ue)),X.iushrn(1),re.iushrn(1);for(var Pe=0,xe=1;!(F.words[0]&xe)&&Pe<26;++Pe,xe<<=1);if(Pe>0)for(F.iushrn(Pe);Pe-- >0;)(ie.isOdd()||Q.isOdd())&&(ie.iadd(L),Q.isub(ue)),ie.iushrn(1),Q.iushrn(1);C.cmp(F)>=0?(C.isub(F),X.isub(ie),re.isub(Q)):(F.isub(C),ie.isub(X),Q.isub(re))}return{a:ie,b:Q,gcd:F.iushln(ne)}},E.prototype._invmp=function(S){_(S.negative===0),_(!S.isZero());var C=this,F=S.clone();C.negative!==0?C=C.umod(S):C=C.clone();for(var X=new E(1),re=new E(0),ie=F.clone();C.cmpn(1)>0&&F.cmpn(1)>0;){for(var Q=0,ne=1;!(C.words[0]&ne)&&Q<26;++Q,ne<<=1);if(Q>0)for(C.iushrn(Q);Q-- >0;)X.isOdd()&&X.iadd(ie),X.iushrn(1);for(var L=0,ue=1;!(F.words[0]&ue)&&L<26;++L,ue<<=1);if(L>0)for(F.iushrn(L);L-- >0;)re.isOdd()&&re.iadd(ie),re.iushrn(1);C.cmp(F)>=0?(C.isub(F),X.isub(re)):(F.isub(C),re.isub(X))}var Ae;return C.cmpn(1)===0?Ae=X:Ae=re,Ae.cmpn(0)<0&&Ae.iadd(S),Ae},E.prototype.gcd=function(S){if(this.isZero())return S.abs();if(S.isZero())return this.abs();var C=this.clone(),F=S.clone();C.negative=0,F.negative=0;for(var X=0;C.isEven()&&F.isEven();X++)C.iushrn(1),F.iushrn(1);do{for(;C.isEven();)C.iushrn(1);for(;F.isEven();)F.iushrn(1);var re=C.cmp(F);if(re<0){var ie=C;C=F,F=ie}else if(re===0||F.cmpn(1)===0)break;C.isub(F)}while(!0);return F.iushln(X)},E.prototype.invm=function(S){return this.egcd(S).a.umod(S)},E.prototype.isEven=function(){return(this.words[0]&1)===0},E.prototype.isOdd=function(){return(this.words[0]&1)===1},E.prototype.andln=function(S){return this.words[0]&S},E.prototype.bincn=function(S){_(typeof S=="number");var C=S%26,F=(S-C)/26,X=1<<C;if(this.length<=F)return this._expand(F+1),this.words[F]|=X,this;for(var re=X,ie=F;re!==0&&ie<this.length;ie++){var Q=this.words[ie]|0;Q+=re,re=Q>>>26,Q&=67108863,this.words[ie]=Q}return re!==0&&(this.words[ie]=re,this.length++),this},E.prototype.isZero=function(){return this.length===1&&this.words[0]===0},E.prototype.cmpn=function(S){var C=S<0;if(this.negative!==0&&!C)return-1;if(this.negative===0&&C)return 1;this._strip();var F;if(this.length>1)F=1;else{C&&(S=-S),_(S<=67108863,"Number is too big");var X=this.words[0]|0;F=X===S?0:X<S?-1:1}return this.negative!==0?-F|0:F},E.prototype.cmp=function(S){if(this.negative!==0&&S.negative===0)return-1;if(this.negative===0&&S.negative!==0)return 1;var C=this.ucmp(S);return this.negative!==0?-C|0:C},E.prototype.ucmp=function(S){if(this.length>S.length)return 1;if(this.length<S.length)return-1;for(var C=0,F=this.length-1;F>=0;F--){var X=this.words[F]|0,re=S.words[F]|0;if(X!==re){X<re?C=-1:X>re&&(C=1);break}}return C},E.prototype.gtn=function(S){return this.cmpn(S)===1},E.prototype.gt=function(S){return this.cmp(S)===1},E.prototype.gten=function(S){return this.cmpn(S)>=0},E.prototype.gte=function(S){return this.cmp(S)>=0},E.prototype.ltn=function(S){return this.cmpn(S)===-1},E.prototype.lt=function(S){return this.cmp(S)===-1},E.prototype.lten=function(S){return this.cmpn(S)<=0},E.prototype.lte=function(S){return this.cmp(S)<=0},E.prototype.eqn=function(S){return this.cmpn(S)===0},E.prototype.eq=function(S){return this.cmp(S)===0},E.red=function(S){return new fe(S)},E.prototype.toRed=function(S){return _(!this.red,"Already a number in reduction context"),_(this.negative===0,"red works only with positives"),S.convertTo(this)._forceRed(S)},E.prototype.fromRed=function(){return _(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},E.prototype._forceRed=function(S){return this.red=S,this},E.prototype.forceRed=function(S){return _(!this.red,"Already a number in reduction context"),this._forceRed(S)},E.prototype.redAdd=function(S){return _(this.red,"redAdd works only with red numbers"),this.red.add(this,S)},E.prototype.redIAdd=function(S){return _(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,S)},E.prototype.redSub=function(S){return _(this.red,"redSub works only with red numbers"),this.red.sub(this,S)},E.prototype.redISub=function(S){return _(this.red,"redISub works only with red numbers"),this.red.isub(this,S)},E.prototype.redShl=function(S){return _(this.red,"redShl works only with red numbers"),this.red.shl(this,S)},E.prototype.redMul=function(S){return _(this.red,"redMul works only with red numbers"),this.red._verify2(this,S),this.red.mul(this,S)},E.prototype.redIMul=function(S){return _(this.red,"redMul works only with red numbers"),this.red._verify2(this,S),this.red.imul(this,S)},E.prototype.redSqr=function(){return _(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},E.prototype.redISqr=function(){return _(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},E.prototype.redSqrt=function(){return _(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},E.prototype.redInvm=function(){return _(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},E.prototype.redNeg=function(){return _(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},E.prototype.redPow=function(S){return _(this.red&&!S.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,S)};var he={k256:null,p224:null,p192:null,p25519:null};function oe(U,S){this.name=U,this.p=new E(S,16),this.n=this.p.bitLength(),this.k=new E(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}oe.prototype._tmp=function(){var S=new E(null);return S.words=new Array(Math.ceil(this.n/13)),S},oe.prototype.ireduce=function(S){var C=S,F;do this.split(C,this.tmp),C=this.imulK(C),C=C.iadd(this.tmp),F=C.bitLength();while(F>this.n);var X=F<this.n?-1:C.ucmp(this.p);return X===0?(C.words[0]=0,C.length=1):X>0?C.isub(this.p):C.strip!==void 0?C.strip():C._strip(),C},oe.prototype.split=function(S,C){S.iushrn(this.n,0,C)},oe.prototype.imulK=function(S){return S.imul(this.k)};function de(){oe.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}A(de,oe),de.prototype.split=function(S,C){for(var F=4194303,X=Math.min(S.length,9),re=0;re<X;re++)C.words[re]=S.words[re];if(C.length=X,S.length<=9){S.words[0]=0,S.length=1;return}var ie=S.words[9];for(C.words[C.length++]=ie&F,re=10;re<S.length;re++){var Q=S.words[re]|0;S.words[re-10]=(Q&F)<<4|ie>>>22,ie=Q}ie>>>=22,S.words[re-10]=ie,ie===0&&S.length>10?S.length-=10:S.length-=9},de.prototype.imulK=function(S){S.words[S.length]=0,S.words[S.length+1]=0,S.length+=2;for(var C=0,F=0;F<S.length;F++){var X=S.words[F]|0;C+=X*977,S.words[F]=C&67108863,C=X*64+(C/67108864|0)}return S.words[S.length-1]===0&&(S.length--,S.words[S.length-1]===0&&S.length--),S};function le(){oe.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}A(le,oe);function be(){oe.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}A(be,oe);function pe(){oe.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}A(pe,oe),pe.prototype.imulK=function(S){for(var C=0,F=0;F<S.length;F++){var X=(S.words[F]|0)*19+C,re=X&67108863;X>>>=26,S.words[F]=re,C=X}return C!==0&&(S.words[S.length++]=C),S},E._prime=function(S){if(he[S])return he[S];var C;if(S==="k256")C=new de;else if(S==="p224")C=new le;else if(S==="p192")C=new be;else if(S==="p25519")C=new pe;else throw new Error("Unknown prime "+S);return he[S]=C,C};function fe(U){if(typeof U=="string"){var S=E._prime(U);this.m=S.p,this.prime=S}else _(U.gtn(1),"modulus must be greater than 1"),this.m=U,this.prime=null}fe.prototype._verify1=function(S){_(S.negative===0,"red works only with positives"),_(S.red,"red works only with red numbers")},fe.prototype._verify2=function(S,C){_((S.negative|C.negative)===0,"red works only with positives"),_(S.red&&S.red===C.red,"red works only with red numbers")},fe.prototype.imod=function(S){return this.prime?this.prime.ireduce(S)._forceRed(this):(B(S,S.umod(this.m)._forceRed(this)),S)},fe.prototype.neg=function(S){return S.isZero()?S.clone():this.m.sub(S)._forceRed(this)},fe.prototype.add=function(S,C){this._verify2(S,C);var F=S.add(C);return F.cmp(this.m)>=0&&F.isub(this.m),F._forceRed(this)},fe.prototype.iadd=function(S,C){this._verify2(S,C);var F=S.iadd(C);return F.cmp(this.m)>=0&&F.isub(this.m),F},fe.prototype.sub=function(S,C){this._verify2(S,C);var F=S.sub(C);return F.cmpn(0)<0&&F.iadd(this.m),F._forceRed(this)},fe.prototype.isub=function(S,C){this._verify2(S,C);var F=S.isub(C);return F.cmpn(0)<0&&F.iadd(this.m),F},fe.prototype.shl=function(S,C){return this._verify1(S),this.imod(S.ushln(C))},fe.prototype.imul=function(S,C){return this._verify2(S,C),this.imod(S.imul(C))},fe.prototype.mul=function(S,C){return this._verify2(S,C),this.imod(S.mul(C))},fe.prototype.isqr=function(S){return this.imul(S,S.clone())},fe.prototype.sqr=function(S){return this.mul(S,S)},fe.prototype.sqrt=function(S){if(S.isZero())return S.clone();var C=this.m.andln(3);if(_(C%2===1),C===3){var F=this.m.add(new E(1)).iushrn(2);return this.pow(S,F)}for(var X=this.m.subn(1),re=0;!X.isZero()&&X.andln(1)===0;)re++,X.iushrn(1);_(!X.isZero());var ie=new E(1).toRed(this),Q=ie.redNeg(),ne=this.m.subn(1).iushrn(1),L=this.m.bitLength();for(L=new E(2*L*L).toRed(this);this.pow(L,ne).cmp(Q)!==0;)L.redIAdd(Q);for(var ue=this.pow(L,X),Ae=this.pow(S,X.addn(1).iushrn(1)),Re=this.pow(S,X),Pe=re;Re.cmp(ie)!==0;){for(var xe=Re,ge=0;xe.cmp(ie)!==0;ge++)xe=xe.redSqr();_(ge<Pe);var _e=this.pow(ue,new E(1).iushln(Pe-ge-1));Ae=Ae.redMul(_e),ue=_e.redSqr(),Re=Re.redMul(ue),Pe=ge}return Ae},fe.prototype.invm=function(S){var C=S._invmp(this.m);return C.negative!==0?(C.negative=0,this.imod(C).redNeg()):this.imod(C)},fe.prototype.pow=function(S,C){if(C.isZero())return new E(1).toRed(this);if(C.cmpn(1)===0)return S.clone();var F=4,X=new Array(1<<F);X[0]=new E(1).toRed(this),X[1]=S;for(var re=2;re<X.length;re++)X[re]=this.mul(X[re-1],S);var ie=X[0],Q=0,ne=0,L=C.bitLength()%26;for(L===0&&(L=26),re=C.length-1;re>=0;re--){for(var ue=C.words[re],Ae=L-1;Ae>=0;Ae--){var Re=ue>>Ae&1;if(ie!==X[0]&&(ie=this.sqr(ie)),Re===0&&Q===0){ne=0;continue}Q<<=1,Q|=Re,ne++,!(ne!==F&&(re!==0||Ae!==0))&&(ie=this.mul(ie,X[Q]),ne=0,Q=0)}L=26}return ie},fe.prototype.convertTo=function(S){var C=S.umod(this.m);return C===S?C.clone():C},fe.prototype.convertFrom=function(S){var C=S.clone();return C.red=null,C},E.mont=function(S){return new Z(S)};function Z(U){fe.call(this,U),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new E(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}A(Z,fe),Z.prototype.convertTo=function(S){return this.imod(S.ushln(this.shift))},Z.prototype.convertFrom=function(S){var C=this.imod(S.mul(this.rinv));return C.red=null,C},Z.prototype.imul=function(S,C){if(S.isZero()||C.isZero())return S.words[0]=0,S.length=1,S;var F=S.imul(C),X=F.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),re=F.isub(X).iushrn(this.shift),ie=re;return re.cmp(this.m)>=0?ie=re.isub(this.m):re.cmpn(0)<0&&(ie=re.iadd(this.m)),ie._forceRed(this)},Z.prototype.mul=function(S,C){if(S.isZero()||C.isZero())return new E(0)._forceRed(this);var F=S.mul(C),X=F.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),re=F.isub(X).iushrn(this.shift),ie=re;return re.cmp(this.m)>=0?ie=re.isub(this.m):re.cmpn(0)<0&&(ie=re.iadd(this.m)),ie._forceRed(this)},Z.prototype.invm=function(S){var C=this.imod(S._invmp(this.m).mul(this.r2));return C._forceRed(this)}})(b,commonjsGlobal)})(bn$1);var bnExports$1=bn$1.exports,BN$a=bnExports$1,randomBytes$2=browserExports,Buffer$8=safeBufferExports$1.Buffer;function getr(b){var v=b.modulus.byteLength(),w;do w=new BN$a(randomBytes$2(v));while(w.cmp(b.modulus)>=0||!w.umod(b.prime1)||!w.umod(b.prime2));return w}function blind(b){var v=getr(b),w=v.toRed(BN$a.mont(b.modulus)).redPow(new BN$a(b.publicExponent)).fromRed();return{blinder:w,unblinder:v.invm(b.modulus)}}function crt$2(b,v){var w=blind(v),_=v.modulus.byteLength(),A=new BN$a(b).mul(w.blinder).umod(v.modulus),E=A.toRed(BN$a.mont(v.prime1)),k=A.toRed(BN$a.mont(v.prime2)),P=v.coefficient,N=v.prime1,q=v.prime2,B=E.redPow(v.exponent1).fromRed(),O=k.redPow(v.exponent2).fromRed(),I=B.isub(O).imul(P).umod(N).imul(q);return O.iadd(I).imul(w.unblinder).umod(v.modulus).toArrayLike(Buffer$8,"be",_)}crt$2.getr=getr;var browserifyRsa=crt$2,elliptic={};const name="elliptic",version="6.5.7",description="EC cryptography",main="lib/elliptic.js",files=["lib"],scripts={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository={type:"git",url:"git@github.com:indutny/elliptic"},keywords=["EC","Elliptic","curve","Cryptography"],author="Fedor Indutny <fedor@indutny.com>",license="MIT",bugs={url:"https://github.com/indutny/elliptic/issues"},homepage="https://github.com/indutny/elliptic",devDependencies={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0={name,version,description,main,files,scripts,repository,keywords,author,license,bugs,homepage,devDependencies,dependencies};var utils$l={},utils$k={};(function(b){var v=b;function w(E,k){if(Array.isArray(E))return E.slice();if(!E)return[];var P=[];if(typeof E!="string"){for(var N=0;N<E.length;N++)P[N]=E[N]|0;return P}if(k==="hex"){E=E.replace(/[^a-z0-9]+/ig,""),E.length%2!==0&&(E="0"+E);for(var N=0;N<E.length;N+=2)P.push(parseInt(E[N]+E[N+1],16))}else for(var N=0;N<E.length;N++){var q=E.charCodeAt(N),B=q>>8,O=q&255;B?P.push(B,O):P.push(O)}return P}v.toArray=w;function _(E){return E.length===1?"0"+E:E}v.zero2=_;function A(E){for(var k="",P=0;P<E.length;P++)k+=_(E[P].toString(16));return k}v.toHex=A,v.encode=function(k,P){return P==="hex"?A(k):k}})(utils$k);(function(b){var v=b,w=bnExports$2,_=minimalisticAssert,A=utils$k;v.assert=_,v.toArray=A.toArray,v.zero2=A.zero2,v.toHex=A.toHex,v.encode=A.encode;function E(B,O,I){var D=new Array(Math.max(B.bitLength(),I)+1),V;for(V=0;V<D.length;V+=1)D[V]=0;var ee=1<<O+1,J=B.clone();for(V=0;V<D.length;V++){var te,se=J.andln(ee-1);J.isOdd()?(se>(ee>>1)-1?te=(ee>>1)-se:te=se,J.isubn(te)):te=0,D[V]=te,J.iushrn(1)}return D}v.getNAF=E;function k(B,O){var I=[[],[]];B=B.clone(),O=O.clone();for(var D=0,V=0,ee;B.cmpn(-D)>0||O.cmpn(-V)>0;){var J=B.andln(3)+D&3,te=O.andln(3)+V&3;J===3&&(J=-1),te===3&&(te=-1);var se;J&1?(ee=B.andln(7)+D&7,(ee===3||ee===5)&&te===2?se=-J:se=J):se=0,I[0].push(se);var ce;te&1?(ee=O.andln(7)+V&7,(ee===3||ee===5)&&J===2?ce=-te:ce=te):ce=0,I[1].push(ce),2*D===se+1&&(D=1-D),2*V===ce+1&&(V=1-V),B.iushrn(1),O.iushrn(1)}return I}v.getJSF=k;function P(B,O,I){var D="_"+O;B.prototype[O]=function(){return this[D]!==void 0?this[D]:this[D]=I.call(this)}}v.cachedProperty=P;function N(B){return typeof B=="string"?v.toArray(B,"hex"):B}v.parseBytes=N;function q(B){return new w(B,"hex","le")}v.intFromLE=q})(utils$l);var curve={},BN$9=bnExports$2,utils$j=utils$l,getNAF=utils$j.getNAF,getJSF=utils$j.getJSF,assert$f=utils$j.assert;function BaseCurve(b,v){this.type=b,this.p=new BN$9(v.p,16),this.red=v.prime?BN$9.red(v.prime):BN$9.mont(this.p),this.zero=new BN$9(0).toRed(this.red),this.one=new BN$9(1).toRed(this.red),this.two=new BN$9(2).toRed(this.red),this.n=v.n&&new BN$9(v.n,16),this.g=v.g&&this.pointFromJSON(v.g,v.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var w=this.n&&this.p.div(this.n);!w||w.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var base$3=BaseCurve;BaseCurve.prototype.point=function(){throw new Error("Not implemented")};BaseCurve.prototype.validate=function(){throw new Error("Not implemented")};BaseCurve.prototype._fixedNafMul=function(v,w){assert$f(v.precomputed);var _=v._getDoubles(),A=getNAF(w,1,this._bitLength),E=(1<<_.step+1)-(_.step%2===0?2:1);E/=3;var k=[],P,N;for(P=0;P<A.length;P+=_.step){N=0;for(var q=P+_.step-1;q>=P;q--)N=(N<<1)+A[q];k.push(N)}for(var B=this.jpoint(null,null,null),O=this.jpoint(null,null,null),I=E;I>0;I--){for(P=0;P<k.length;P++)N=k[P],N===I?O=O.mixedAdd(_.points[P]):N===-I&&(O=O.mixedAdd(_.points[P].neg()));B=B.add(O)}return B.toP()};BaseCurve.prototype._wnafMul=function(v,w){var _=4,A=v._getNAFPoints(_);_=A.wnd;for(var E=A.points,k=getNAF(w,_,this._bitLength),P=this.jpoint(null,null,null),N=k.length-1;N>=0;N--){for(var q=0;N>=0&&k[N]===0;N--)q++;if(N>=0&&q++,P=P.dblp(q),N<0)break;var B=k[N];assert$f(B!==0),v.type==="affine"?B>0?P=P.mixedAdd(E[B-1>>1]):P=P.mixedAdd(E[-B-1>>1].neg()):B>0?P=P.add(E[B-1>>1]):P=P.add(E[-B-1>>1].neg())}return v.type==="affine"?P.toP():P};BaseCurve.prototype._wnafMulAdd=function(v,w,_,A,E){var k=this._wnafT1,P=this._wnafT2,N=this._wnafT3,q=0,B,O,I;for(B=0;B<A;B++){I=w[B];var D=I._getNAFPoints(v);k[B]=D.wnd,P[B]=D.points}for(B=A-1;B>=1;B-=2){var V=B-1,ee=B;if(k[V]!==1||k[ee]!==1){N[V]=getNAF(_[V],k[V],this._bitLength),N[ee]=getNAF(_[ee],k[ee],this._bitLength),q=Math.max(N[V].length,q),q=Math.max(N[ee].length,q);continue}var J=[w[V],null,null,w[ee]];w[V].y.cmp(w[ee].y)===0?(J[1]=w[V].add(w[ee]),J[2]=w[V].toJ().mixedAdd(w[ee].neg())):w[V].y.cmp(w[ee].y.redNeg())===0?(J[1]=w[V].toJ().mixedAdd(w[ee]),J[2]=w[V].add(w[ee].neg())):(J[1]=w[V].toJ().mixedAdd(w[ee]),J[2]=w[V].toJ().mixedAdd(w[ee].neg()));var te=[-3,-1,-5,-7,0,7,5,1,3],se=getJSF(_[V],_[ee]);for(q=Math.max(se[0].length,q),N[V]=new Array(q),N[ee]=new Array(q),O=0;O<q;O++){var ce=se[0][O]|0,ae=se[1][O]|0;N[V][O]=te[(ce+1)*3+(ae+1)],N[ee][O]=0,P[V]=J}}var he=this.jpoint(null,null,null),oe=this._wnafT4;for(B=q;B>=0;B--){for(var de=0;B>=0;){var le=!0;for(O=0;O<A;O++)oe[O]=N[O][B]|0,oe[O]!==0&&(le=!1);if(!le)break;de++,B--}if(B>=0&&de++,he=he.dblp(de),B<0)break;for(O=0;O<A;O++){var be=oe[O];be!==0&&(be>0?I=P[O][be-1>>1]:be<0&&(I=P[O][-be-1>>1].neg()),I.type==="affine"?he=he.mixedAdd(I):he=he.add(I))}}for(B=0;B<A;B++)P[B]=null;return E?he:he.toP()};function BasePoint(b,v){this.curve=b,this.type=v,this.precomputed=null}BaseCurve.BasePoint=BasePoint;BasePoint.prototype.eq=function(){throw new Error("Not implemented")};BasePoint.prototype.validate=function(){return this.curve.validate(this)};BaseCurve.prototype.decodePoint=function(v,w){v=utils$j.toArray(v,w);var _=this.p.byteLength();if((v[0]===4||v[0]===6||v[0]===7)&&v.length-1===2*_){v[0]===6?assert$f(v[v.length-1]%2===0):v[0]===7&&assert$f(v[v.length-1]%2===1);var A=this.point(v.slice(1,1+_),v.slice(1+_,1+2*_));return A}else if((v[0]===2||v[0]===3)&&v.length-1===_)return this.pointFromX(v.slice(1,1+_),v[0]===3);throw new Error("Unknown point format")};BasePoint.prototype.encodeCompressed=function(v){return this.encode(v,!0)};BasePoint.prototype._encode=function(v){var w=this.curve.p.byteLength(),_=this.getX().toArray("be",w);return v?[this.getY().isEven()?2:3].concat(_):[4].concat(_,this.getY().toArray("be",w))};BasePoint.prototype.encode=function(v,w){return utils$j.encode(this._encode(w),v)};BasePoint.prototype.precompute=function(v){if(this.precomputed)return this;var w={doubles:null,naf:null,beta:null};return w.naf=this._getNAFPoints(8),w.doubles=this._getDoubles(4,v),w.beta=this._getBeta(),this.precomputed=w,this};BasePoint.prototype._hasDoubles=function(v){if(!this.precomputed)return!1;var w=this.precomputed.doubles;return w?w.points.length>=Math.ceil((v.bitLength()+1)/w.step):!1};BasePoint.prototype._getDoubles=function(v,w){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var _=[this],A=this,E=0;E<w;E+=v){for(var k=0;k<v;k++)A=A.dbl();_.push(A)}return{step:v,points:_}};BasePoint.prototype._getNAFPoints=function(v){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var w=[this],_=(1<<v)-1,A=_===1?null:this.dbl(),E=1;E<_;E++)w[E]=w[E-1].add(A);return{wnd:v,points:w}};BasePoint.prototype._getBeta=function(){return null};BasePoint.prototype.dblp=function(v){for(var w=this,_=0;_<v;_++)w=w.dbl();return w};var utils$i=utils$l,BN$8=bnExports$2,inherits$4=inherits_browserExports,Base$2=base$3,assert$e=utils$i.assert;function ShortCurve(b){Base$2.call(this,"short",b),this.a=new BN$8(b.a,16).toRed(this.red),this.b=new BN$8(b.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(b),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}inherits$4(ShortCurve,Base$2);var short=ShortCurve;ShortCurve.prototype._getEndomorphism=function(v){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var w,_;if(v.beta)w=new BN$8(v.beta,16).toRed(this.red);else{var A=this._getEndoRoots(this.p);w=A[0].cmp(A[1])<0?A[0]:A[1],w=w.toRed(this.red)}if(v.lambda)_=new BN$8(v.lambda,16);else{var E=this._getEndoRoots(this.n);this.g.mul(E[0]).x.cmp(this.g.x.redMul(w))===0?_=E[0]:(_=E[1],assert$e(this.g.mul(_).x.cmp(this.g.x.redMul(w))===0))}var k;return v.basis?k=v.basis.map(function(P){return{a:new BN$8(P.a,16),b:new BN$8(P.b,16)}}):k=this._getEndoBasis(_),{beta:w,lambda:_,basis:k}}};ShortCurve.prototype._getEndoRoots=function(v){var w=v===this.p?this.red:BN$8.mont(v),_=new BN$8(2).toRed(w).redInvm(),A=_.redNeg(),E=new BN$8(3).toRed(w).redNeg().redSqrt().redMul(_),k=A.redAdd(E).fromRed(),P=A.redSub(E).fromRed();return[k,P]};ShortCurve.prototype._getEndoBasis=function(v){for(var w=this.n.ushrn(Math.floor(this.n.bitLength()/2)),_=v,A=this.n.clone(),E=new BN$8(1),k=new BN$8(0),P=new BN$8(0),N=new BN$8(1),q,B,O,I,D,V,ee,J=0,te,se;_.cmpn(0)!==0;){var ce=A.div(_);te=A.sub(ce.mul(_)),se=P.sub(ce.mul(E));var ae=N.sub(ce.mul(k));if(!O&&te.cmp(w)<0)q=ee.neg(),B=E,O=te.neg(),I=se;else if(O&&++J===2)break;ee=te,A=_,_=te,P=E,E=se,N=k,k=ae}D=te.neg(),V=se;var he=O.sqr().add(I.sqr()),oe=D.sqr().add(V.sqr());return oe.cmp(he)>=0&&(D=q,V=B),O.negative&&(O=O.neg(),I=I.neg()),D.negative&&(D=D.neg(),V=V.neg()),[{a:O,b:I},{a:D,b:V}]};ShortCurve.prototype._endoSplit=function(v){var w=this.endo.basis,_=w[0],A=w[1],E=A.b.mul(v).divRound(this.n),k=_.b.neg().mul(v).divRound(this.n),P=E.mul(_.a),N=k.mul(A.a),q=E.mul(_.b),B=k.mul(A.b),O=v.sub(P).sub(N),I=q.add(B).neg();return{k1:O,k2:I}};ShortCurve.prototype.pointFromX=function(v,w){v=new BN$8(v,16),v.red||(v=v.toRed(this.red));var _=v.redSqr().redMul(v).redIAdd(v.redMul(this.a)).redIAdd(this.b),A=_.redSqrt();if(A.redSqr().redSub(_).cmp(this.zero)!==0)throw new Error("invalid point");var E=A.fromRed().isOdd();return(w&&!E||!w&&E)&&(A=A.redNeg()),this.point(v,A)};ShortCurve.prototype.validate=function(v){if(v.inf)return!0;var w=v.x,_=v.y,A=this.a.redMul(w),E=w.redSqr().redMul(w).redIAdd(A).redIAdd(this.b);return _.redSqr().redISub(E).cmpn(0)===0};ShortCurve.prototype._endoWnafMulAdd=function(v,w,_){for(var A=this._endoWnafT1,E=this._endoWnafT2,k=0;k<v.length;k++){var P=this._endoSplit(w[k]),N=v[k],q=N._getBeta();P.k1.negative&&(P.k1.ineg(),N=N.neg(!0)),P.k2.negative&&(P.k2.ineg(),q=q.neg(!0)),A[k*2]=N,A[k*2+1]=q,E[k*2]=P.k1,E[k*2+1]=P.k2}for(var B=this._wnafMulAdd(1,A,E,k*2,_),O=0;O<k*2;O++)A[O]=null,E[O]=null;return B};function Point$2(b,v,w,_){Base$2.BasePoint.call(this,b,"affine"),v===null&&w===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new BN$8(v,16),this.y=new BN$8(w,16),_&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}inherits$4(Point$2,Base$2.BasePoint);ShortCurve.prototype.point=function(v,w,_){return new Point$2(this,v,w,_)};ShortCurve.prototype.pointFromJSON=function(v,w){return Point$2.fromJSON(this,v,w)};Point$2.prototype._getBeta=function(){if(this.curve.endo){var v=this.precomputed;if(v&&v.beta)return v.beta;var w=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(v){var _=this.curve,A=function(E){return _.point(E.x.redMul(_.endo.beta),E.y)};v.beta=w,w.precomputed={beta:null,naf:v.naf&&{wnd:v.naf.wnd,points:v.naf.points.map(A)},doubles:v.doubles&&{step:v.doubles.step,points:v.doubles.points.map(A)}}}return w}};Point$2.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]};Point$2.fromJSON=function(v,w,_){typeof w=="string"&&(w=JSON.parse(w));var A=v.point(w[0],w[1],_);if(!w[2])return A;function E(P){return v.point(P[0],P[1],_)}var k=w[2];return A.precomputed={beta:null,doubles:k.doubles&&{step:k.doubles.step,points:[A].concat(k.doubles.points.map(E))},naf:k.naf&&{wnd:k.naf.wnd,points:[A].concat(k.naf.points.map(E))}},A};Point$2.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"};Point$2.prototype.isInfinity=function(){return this.inf};Point$2.prototype.add=function(v){if(this.inf)return v;if(v.inf)return this;if(this.eq(v))return this.dbl();if(this.neg().eq(v))return this.curve.point(null,null);if(this.x.cmp(v.x)===0)return this.curve.point(null,null);var w=this.y.redSub(v.y);w.cmpn(0)!==0&&(w=w.redMul(this.x.redSub(v.x).redInvm()));var _=w.redSqr().redISub(this.x).redISub(v.x),A=w.redMul(this.x.redSub(_)).redISub(this.y);return this.curve.point(_,A)};Point$2.prototype.dbl=function(){if(this.inf)return this;var v=this.y.redAdd(this.y);if(v.cmpn(0)===0)return this.curve.point(null,null);var w=this.curve.a,_=this.x.redSqr(),A=v.redInvm(),E=_.redAdd(_).redIAdd(_).redIAdd(w).redMul(A),k=E.redSqr().redISub(this.x.redAdd(this.x)),P=E.redMul(this.x.redSub(k)).redISub(this.y);return this.curve.point(k,P)};Point$2.prototype.getX=function(){return this.x.fromRed()};Point$2.prototype.getY=function(){return this.y.fromRed()};Point$2.prototype.mul=function(v){return v=new BN$8(v,16),this.isInfinity()?this:this._hasDoubles(v)?this.curve._fixedNafMul(this,v):this.curve.endo?this.curve._endoWnafMulAdd([this],[v]):this.curve._wnafMul(this,v)};Point$2.prototype.mulAdd=function(v,w,_){var A=[this,w],E=[v,_];return this.curve.endo?this.curve._endoWnafMulAdd(A,E):this.curve._wnafMulAdd(1,A,E,2)};Point$2.prototype.jmulAdd=function(v,w,_){var A=[this,w],E=[v,_];return this.curve.endo?this.curve._endoWnafMulAdd(A,E,!0):this.curve._wnafMulAdd(1,A,E,2,!0)};Point$2.prototype.eq=function(v){return this===v||this.inf===v.inf&&(this.inf||this.x.cmp(v.x)===0&&this.y.cmp(v.y)===0)};Point$2.prototype.neg=function(v){if(this.inf)return this;var w=this.curve.point(this.x,this.y.redNeg());if(v&&this.precomputed){var _=this.precomputed,A=function(E){return E.neg()};w.precomputed={naf:_.naf&&{wnd:_.naf.wnd,points:_.naf.points.map(A)},doubles:_.doubles&&{step:_.doubles.step,points:_.doubles.points.map(A)}}}return w};Point$2.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var v=this.curve.jpoint(this.x,this.y,this.curve.one);return v};function JPoint(b,v,w,_){Base$2.BasePoint.call(this,b,"jacobian"),v===null&&w===null&&_===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$8(0)):(this.x=new BN$8(v,16),this.y=new BN$8(w,16),this.z=new BN$8(_,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}inherits$4(JPoint,Base$2.BasePoint);ShortCurve.prototype.jpoint=function(v,w,_){return new JPoint(this,v,w,_)};JPoint.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var v=this.z.redInvm(),w=v.redSqr(),_=this.x.redMul(w),A=this.y.redMul(w).redMul(v);return this.curve.point(_,A)};JPoint.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};JPoint.prototype.add=function(v){if(this.isInfinity())return v;if(v.isInfinity())return this;var w=v.z.redSqr(),_=this.z.redSqr(),A=this.x.redMul(w),E=v.x.redMul(_),k=this.y.redMul(w.redMul(v.z)),P=v.y.redMul(_.redMul(this.z)),N=A.redSub(E),q=k.redSub(P);if(N.cmpn(0)===0)return q.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var B=N.redSqr(),O=B.redMul(N),I=A.redMul(B),D=q.redSqr().redIAdd(O).redISub(I).redISub(I),V=q.redMul(I.redISub(D)).redISub(k.redMul(O)),ee=this.z.redMul(v.z).redMul(N);return this.curve.jpoint(D,V,ee)};JPoint.prototype.mixedAdd=function(v){if(this.isInfinity())return v.toJ();if(v.isInfinity())return this;var w=this.z.redSqr(),_=this.x,A=v.x.redMul(w),E=this.y,k=v.y.redMul(w).redMul(this.z),P=_.redSub(A),N=E.redSub(k);if(P.cmpn(0)===0)return N.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var q=P.redSqr(),B=q.redMul(P),O=_.redMul(q),I=N.redSqr().redIAdd(B).redISub(O).redISub(O),D=N.redMul(O.redISub(I)).redISub(E.redMul(B)),V=this.z.redMul(P);return this.curve.jpoint(I,D,V)};JPoint.prototype.dblp=function(v){if(v===0)return this;if(this.isInfinity())return this;if(!v)return this.dbl();var w;if(this.curve.zeroA||this.curve.threeA){var _=this;for(w=0;w<v;w++)_=_.dbl();return _}var A=this.curve.a,E=this.curve.tinv,k=this.x,P=this.y,N=this.z,q=N.redSqr().redSqr(),B=P.redAdd(P);for(w=0;w<v;w++){var O=k.redSqr(),I=B.redSqr(),D=I.redSqr(),V=O.redAdd(O).redIAdd(O).redIAdd(A.redMul(q)),ee=k.redMul(I),J=V.redSqr().redISub(ee.redAdd(ee)),te=ee.redISub(J),se=V.redMul(te);se=se.redIAdd(se).redISub(D);var ce=B.redMul(N);w+1<v&&(q=q.redMul(D)),k=J,N=ce,B=se}return this.curve.jpoint(k,B.redMul(E),N)};JPoint.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};JPoint.prototype._zeroDbl=function(){var v,w,_;if(this.zOne){var A=this.x.redSqr(),E=this.y.redSqr(),k=E.redSqr(),P=this.x.redAdd(E).redSqr().redISub(A).redISub(k);P=P.redIAdd(P);var N=A.redAdd(A).redIAdd(A),q=N.redSqr().redISub(P).redISub(P),B=k.redIAdd(k);B=B.redIAdd(B),B=B.redIAdd(B),v=q,w=N.redMul(P.redISub(q)).redISub(B),_=this.y.redAdd(this.y)}else{var O=this.x.redSqr(),I=this.y.redSqr(),D=I.redSqr(),V=this.x.redAdd(I).redSqr().redISub(O).redISub(D);V=V.redIAdd(V);var ee=O.redAdd(O).redIAdd(O),J=ee.redSqr(),te=D.redIAdd(D);te=te.redIAdd(te),te=te.redIAdd(te),v=J.redISub(V).redISub(V),w=ee.redMul(V.redISub(v)).redISub(te),_=this.y.redMul(this.z),_=_.redIAdd(_)}return this.curve.jpoint(v,w,_)};JPoint.prototype._threeDbl=function(){var v,w,_;if(this.zOne){var A=this.x.redSqr(),E=this.y.redSqr(),k=E.redSqr(),P=this.x.redAdd(E).redSqr().redISub(A).redISub(k);P=P.redIAdd(P);var N=A.redAdd(A).redIAdd(A).redIAdd(this.curve.a),q=N.redSqr().redISub(P).redISub(P);v=q;var B=k.redIAdd(k);B=B.redIAdd(B),B=B.redIAdd(B),w=N.redMul(P.redISub(q)).redISub(B),_=this.y.redAdd(this.y)}else{var O=this.z.redSqr(),I=this.y.redSqr(),D=this.x.redMul(I),V=this.x.redSub(O).redMul(this.x.redAdd(O));V=V.redAdd(V).redIAdd(V);var ee=D.redIAdd(D);ee=ee.redIAdd(ee);var J=ee.redAdd(ee);v=V.redSqr().redISub(J),_=this.y.redAdd(this.z).redSqr().redISub(I).redISub(O);var te=I.redSqr();te=te.redIAdd(te),te=te.redIAdd(te),te=te.redIAdd(te),w=V.redMul(ee.redISub(v)).redISub(te)}return this.curve.jpoint(v,w,_)};JPoint.prototype._dbl=function(){var v=this.curve.a,w=this.x,_=this.y,A=this.z,E=A.redSqr().redSqr(),k=w.redSqr(),P=_.redSqr(),N=k.redAdd(k).redIAdd(k).redIAdd(v.redMul(E)),q=w.redAdd(w);q=q.redIAdd(q);var B=q.redMul(P),O=N.redSqr().redISub(B.redAdd(B)),I=B.redISub(O),D=P.redSqr();D=D.redIAdd(D),D=D.redIAdd(D),D=D.redIAdd(D);var V=N.redMul(I).redISub(D),ee=_.redAdd(_).redMul(A);return this.curve.jpoint(O,V,ee)};JPoint.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var v=this.x.redSqr(),w=this.y.redSqr(),_=this.z.redSqr(),A=w.redSqr(),E=v.redAdd(v).redIAdd(v),k=E.redSqr(),P=this.x.redAdd(w).redSqr().redISub(v).redISub(A);P=P.redIAdd(P),P=P.redAdd(P).redIAdd(P),P=P.redISub(k);var N=P.redSqr(),q=A.redIAdd(A);q=q.redIAdd(q),q=q.redIAdd(q),q=q.redIAdd(q);var B=E.redIAdd(P).redSqr().redISub(k).redISub(N).redISub(q),O=w.redMul(B);O=O.redIAdd(O),O=O.redIAdd(O);var I=this.x.redMul(N).redISub(O);I=I.redIAdd(I),I=I.redIAdd(I);var D=this.y.redMul(B.redMul(q.redISub(B)).redISub(P.redMul(N)));D=D.redIAdd(D),D=D.redIAdd(D),D=D.redIAdd(D);var V=this.z.redAdd(P).redSqr().redISub(_).redISub(N);return this.curve.jpoint(I,D,V)};JPoint.prototype.mul=function(v,w){return v=new BN$8(v,w),this.curve._wnafMul(this,v)};JPoint.prototype.eq=function(v){if(v.type==="affine")return this.eq(v.toJ());if(this===v)return!0;var w=this.z.redSqr(),_=v.z.redSqr();if(this.x.redMul(_).redISub(v.x.redMul(w)).cmpn(0)!==0)return!1;var A=w.redMul(this.z),E=_.redMul(v.z);return this.y.redMul(E).redISub(v.y.redMul(A)).cmpn(0)===0};JPoint.prototype.eqXToP=function(v){var w=this.z.redSqr(),_=v.toRed(this.curve.red).redMul(w);if(this.x.cmp(_)===0)return!0;for(var A=v.clone(),E=this.curve.redN.redMul(w);;){if(A.iadd(this.curve.n),A.cmp(this.curve.p)>=0)return!1;if(_.redIAdd(E),this.x.cmp(_)===0)return!0}};JPoint.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"};JPoint.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var BN$7=bnExports$2,inherits$3=inherits_browserExports,Base$1=base$3,utils$h=utils$l;function MontCurve(b){Base$1.call(this,"mont",b),this.a=new BN$7(b.a,16).toRed(this.red),this.b=new BN$7(b.b,16).toRed(this.red),this.i4=new BN$7(4).toRed(this.red).redInvm(),this.two=new BN$7(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits$3(MontCurve,Base$1);var mont=MontCurve;MontCurve.prototype.validate=function(v){var w=v.normalize().x,_=w.redSqr(),A=_.redMul(w).redAdd(_.redMul(this.a)).redAdd(w),E=A.redSqrt();return E.redSqr().cmp(A)===0};function Point$1(b,v,w){Base$1.BasePoint.call(this,b,"projective"),v===null&&w===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN$7(v,16),this.z=new BN$7(w,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}inherits$3(Point$1,Base$1.BasePoint);MontCurve.prototype.decodePoint=function(v,w){return this.point(utils$h.toArray(v,w),1)};MontCurve.prototype.point=function(v,w){return new Point$1(this,v,w)};MontCurve.prototype.pointFromJSON=function(v){return Point$1.fromJSON(this,v)};Point$1.prototype.precompute=function(){};Point$1.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};Point$1.fromJSON=function(v,w){return new Point$1(v,w[0],w[1]||v.one)};Point$1.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};Point$1.prototype.isInfinity=function(){return this.z.cmpn(0)===0};Point$1.prototype.dbl=function(){var v=this.x.redAdd(this.z),w=v.redSqr(),_=this.x.redSub(this.z),A=_.redSqr(),E=w.redSub(A),k=w.redMul(A),P=E.redMul(A.redAdd(this.curve.a24.redMul(E)));return this.curve.point(k,P)};Point$1.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.diffAdd=function(v,w){var _=this.x.redAdd(this.z),A=this.x.redSub(this.z),E=v.x.redAdd(v.z),k=v.x.redSub(v.z),P=k.redMul(_),N=E.redMul(A),q=w.z.redMul(P.redAdd(N).redSqr()),B=w.x.redMul(P.redISub(N).redSqr());return this.curve.point(q,B)};Point$1.prototype.mul=function(v){for(var w=v.clone(),_=this,A=this.curve.point(null,null),E=this,k=[];w.cmpn(0)!==0;w.iushrn(1))k.push(w.andln(1));for(var P=k.length-1;P>=0;P--)k[P]===0?(_=_.diffAdd(A,E),A=A.dbl()):(A=_.diffAdd(A,E),_=_.dbl());return A};Point$1.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.eq=function(v){return this.getX().cmp(v.getX())===0};Point$1.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Point$1.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var utils$g=utils$l,BN$6=bnExports$2,inherits$2=inherits_browserExports,Base=base$3,assert$d=utils$g.assert;function EdwardsCurve(b){this.twisted=(b.a|0)!==1,this.mOneA=this.twisted&&(b.a|0)===-1,this.extended=this.mOneA,Base.call(this,"edwards",b),this.a=new BN$6(b.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new BN$6(b.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new BN$6(b.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert$d(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(b.c|0)===1}inherits$2(EdwardsCurve,Base);var edwards=EdwardsCurve;EdwardsCurve.prototype._mulA=function(v){return this.mOneA?v.redNeg():this.a.redMul(v)};EdwardsCurve.prototype._mulC=function(v){return this.oneC?v:this.c.redMul(v)};EdwardsCurve.prototype.jpoint=function(v,w,_,A){return this.point(v,w,_,A)};EdwardsCurve.prototype.pointFromX=function(v,w){v=new BN$6(v,16),v.red||(v=v.toRed(this.red));var _=v.redSqr(),A=this.c2.redSub(this.a.redMul(_)),E=this.one.redSub(this.c2.redMul(this.d).redMul(_)),k=A.redMul(E.redInvm()),P=k.redSqrt();if(P.redSqr().redSub(k).cmp(this.zero)!==0)throw new Error("invalid point");var N=P.fromRed().isOdd();return(w&&!N||!w&&N)&&(P=P.redNeg()),this.point(v,P)};EdwardsCurve.prototype.pointFromY=function(v,w){v=new BN$6(v,16),v.red||(v=v.toRed(this.red));var _=v.redSqr(),A=_.redSub(this.c2),E=_.redMul(this.d).redMul(this.c2).redSub(this.a),k=A.redMul(E.redInvm());if(k.cmp(this.zero)===0){if(w)throw new Error("invalid point");return this.point(this.zero,v)}var P=k.redSqrt();if(P.redSqr().redSub(k).cmp(this.zero)!==0)throw new Error("invalid point");return P.fromRed().isOdd()!==w&&(P=P.redNeg()),this.point(P,v)};EdwardsCurve.prototype.validate=function(v){if(v.isInfinity())return!0;v.normalize();var w=v.x.redSqr(),_=v.y.redSqr(),A=w.redMul(this.a).redAdd(_),E=this.c2.redMul(this.one.redAdd(this.d.redMul(w).redMul(_)));return A.cmp(E)===0};function Point(b,v,w,_,A){Base.BasePoint.call(this,b,"projective"),v===null&&w===null&&_===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new BN$6(v,16),this.y=new BN$6(w,16),this.z=_?new BN$6(_,16):this.curve.one,this.t=A&&new BN$6(A,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}inherits$2(Point,Base.BasePoint);EdwardsCurve.prototype.pointFromJSON=function(v){return Point.fromJSON(this,v)};EdwardsCurve.prototype.point=function(v,w,_,A){return new Point(this,v,w,_,A)};Point.fromJSON=function(v,w){return new Point(v,w[0],w[1],w[2])};Point.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};Point.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Point.prototype._extDbl=function(){var v=this.x.redSqr(),w=this.y.redSqr(),_=this.z.redSqr();_=_.redIAdd(_);var A=this.curve._mulA(v),E=this.x.redAdd(this.y).redSqr().redISub(v).redISub(w),k=A.redAdd(w),P=k.redSub(_),N=A.redSub(w),q=E.redMul(P),B=k.redMul(N),O=E.redMul(N),I=P.redMul(k);return this.curve.point(q,B,I,O)};Point.prototype._projDbl=function(){var v=this.x.redAdd(this.y).redSqr(),w=this.x.redSqr(),_=this.y.redSqr(),A,E,k,P,N,q;if(this.curve.twisted){P=this.curve._mulA(w);var B=P.redAdd(_);this.zOne?(A=v.redSub(w).redSub(_).redMul(B.redSub(this.curve.two)),E=B.redMul(P.redSub(_)),k=B.redSqr().redSub(B).redSub(B)):(N=this.z.redSqr(),q=B.redSub(N).redISub(N),A=v.redSub(w).redISub(_).redMul(q),E=B.redMul(P.redSub(_)),k=B.redMul(q))}else P=w.redAdd(_),N=this.curve._mulC(this.z).redSqr(),q=P.redSub(N).redSub(N),A=this.curve._mulC(v.redISub(P)).redMul(q),E=this.curve._mulC(P).redMul(w.redISub(_)),k=P.redMul(q);return this.curve.point(A,E,k)};Point.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Point.prototype._extAdd=function(v){var w=this.y.redSub(this.x).redMul(v.y.redSub(v.x)),_=this.y.redAdd(this.x).redMul(v.y.redAdd(v.x)),A=this.t.redMul(this.curve.dd).redMul(v.t),E=this.z.redMul(v.z.redAdd(v.z)),k=_.redSub(w),P=E.redSub(A),N=E.redAdd(A),q=_.redAdd(w),B=k.redMul(P),O=N.redMul(q),I=k.redMul(q),D=P.redMul(N);return this.curve.point(B,O,D,I)};Point.prototype._projAdd=function(v){var w=this.z.redMul(v.z),_=w.redSqr(),A=this.x.redMul(v.x),E=this.y.redMul(v.y),k=this.curve.d.redMul(A).redMul(E),P=_.redSub(k),N=_.redAdd(k),q=this.x.redAdd(this.y).redMul(v.x.redAdd(v.y)).redISub(A).redISub(E),B=w.redMul(P).redMul(q),O,I;return this.curve.twisted?(O=w.redMul(N).redMul(E.redSub(this.curve._mulA(A))),I=P.redMul(N)):(O=w.redMul(N).redMul(E.redSub(A)),I=this.curve._mulC(P).redMul(N)),this.curve.point(B,O,I)};Point.prototype.add=function(v){return this.isInfinity()?v:v.isInfinity()?this:this.curve.extended?this._extAdd(v):this._projAdd(v)};Point.prototype.mul=function(v){return this._hasDoubles(v)?this.curve._fixedNafMul(this,v):this.curve._wnafMul(this,v)};Point.prototype.mulAdd=function(v,w,_){return this.curve._wnafMulAdd(1,[this,w],[v,_],2,!1)};Point.prototype.jmulAdd=function(v,w,_){return this.curve._wnafMulAdd(1,[this,w],[v,_],2,!0)};Point.prototype.normalize=function(){if(this.zOne)return this;var v=this.z.redInvm();return this.x=this.x.redMul(v),this.y=this.y.redMul(v),this.t&&(this.t=this.t.redMul(v)),this.z=this.curve.one,this.zOne=!0,this};Point.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()};Point.prototype.getY=function(){return this.normalize(),this.y.fromRed()};Point.prototype.eq=function(v){return this===v||this.getX().cmp(v.getX())===0&&this.getY().cmp(v.getY())===0};Point.prototype.eqXToP=function(v){var w=v.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(w)===0)return!0;for(var _=v.clone(),A=this.curve.redN.redMul(this.z);;){if(_.iadd(this.curve.n),_.cmp(this.curve.p)>=0)return!1;if(w.redIAdd(A),this.x.cmp(w)===0)return!0}};Point.prototype.toP=Point.prototype.normalize;Point.prototype.mixedAdd=Point.prototype.add;(function(b){var v=b;v.base=base$3,v.short=short,v.mont=mont,v.edwards=edwards})(curve);var curves$1={},hash$2={},utils$f={},assert$c=minimalisticAssert,inherits$1=inherits_browserExports;utils$f.inherits=inherits$1;function isSurrogatePair(b,v){return(b.charCodeAt(v)&64512)!==55296||v<0||v+1>=b.length?!1:(b.charCodeAt(v+1)&64512)===56320}function toArray(b,v){if(Array.isArray(b))return b.slice();if(!b)return[];var w=[];if(typeof b=="string")if(v){if(v==="hex")for(b=b.replace(/[^a-z0-9]+/ig,""),b.length%2!==0&&(b="0"+b),A=0;A<b.length;A+=2)w.push(parseInt(b[A]+b[A+1],16))}else for(var _=0,A=0;A<b.length;A++){var E=b.charCodeAt(A);E<128?w[_++]=E:E<2048?(w[_++]=E>>6|192,w[_++]=E&63|128):isSurrogatePair(b,A)?(E=65536+((E&1023)<<10)+(b.charCodeAt(++A)&1023),w[_++]=E>>18|240,w[_++]=E>>12&63|128,w[_++]=E>>6&63|128,w[_++]=E&63|128):(w[_++]=E>>12|224,w[_++]=E>>6&63|128,w[_++]=E&63|128)}else for(A=0;A<b.length;A++)w[A]=b[A]|0;return w}utils$f.toArray=toArray;function toHex(b){for(var v="",w=0;w<b.length;w++)v+=zero2(b[w].toString(16));return v}utils$f.toHex=toHex;function htonl(b){var v=b>>>24|b>>>8&65280|b<<8&16711680|(b&255)<<24;return v>>>0}utils$f.htonl=htonl;function toHex32(b,v){for(var w="",_=0;_<b.length;_++){var A=b[_];v==="little"&&(A=htonl(A)),w+=zero8(A.toString(16))}return w}utils$f.toHex32=toHex32;function zero2(b){return b.length===1?"0"+b:b}utils$f.zero2=zero2;function zero8(b){return b.length===7?"0"+b:b.length===6?"00"+b:b.length===5?"000"+b:b.length===4?"0000"+b:b.length===3?"00000"+b:b.length===2?"000000"+b:b.length===1?"0000000"+b:b}utils$f.zero8=zero8;function join32(b,v,w,_){var A=w-v;assert$c(A%4===0);for(var E=new Array(A/4),k=0,P=v;k<E.length;k++,P+=4){var N;_==="big"?N=b[P]<<24|b[P+1]<<16|b[P+2]<<8|b[P+3]:N=b[P+3]<<24|b[P+2]<<16|b[P+1]<<8|b[P],E[k]=N>>>0}return E}utils$f.join32=join32;function split32(b,v){for(var w=new Array(b.length*4),_=0,A=0;_<b.length;_++,A+=4){var E=b[_];v==="big"?(w[A]=E>>>24,w[A+1]=E>>>16&255,w[A+2]=E>>>8&255,w[A+3]=E&255):(w[A+3]=E>>>24,w[A+2]=E>>>16&255,w[A+1]=E>>>8&255,w[A]=E&255)}return w}utils$f.split32=split32;function rotr32$1(b,v){return b>>>v|b<<32-v}utils$f.rotr32=rotr32$1;function rotl32$2(b,v){return b<<v|b>>>32-v}utils$f.rotl32=rotl32$2;function sum32$3(b,v){return b+v>>>0}utils$f.sum32=sum32$3;function sum32_3$1(b,v,w){return b+v+w>>>0}utils$f.sum32_3=sum32_3$1;function sum32_4$2(b,v,w,_){return b+v+w+_>>>0}utils$f.sum32_4=sum32_4$2;function sum32_5$2(b,v,w,_,A){return b+v+w+_+A>>>0}utils$f.sum32_5=sum32_5$2;function sum64$1(b,v,w,_){var A=b[v],E=b[v+1],k=_+E>>>0,P=(k<_?1:0)+w+A;b[v]=P>>>0,b[v+1]=k}utils$f.sum64=sum64$1;function sum64_hi$1(b,v,w,_){var A=v+_>>>0,E=(A<v?1:0)+b+w;return E>>>0}utils$f.sum64_hi=sum64_hi$1;function sum64_lo$1(b,v,w,_){var A=v+_;return A>>>0}utils$f.sum64_lo=sum64_lo$1;function sum64_4_hi$1(b,v,w,_,A,E,k,P){var N=0,q=v;q=q+_>>>0,N+=q<v?1:0,q=q+E>>>0,N+=q<E?1:0,q=q+P>>>0,N+=q<P?1:0;var B=b+w+A+k+N;return B>>>0}utils$f.sum64_4_hi=sum64_4_hi$1;function sum64_4_lo$1(b,v,w,_,A,E,k,P){var N=v+_+E+P;return N>>>0}utils$f.sum64_4_lo=sum64_4_lo$1;function sum64_5_hi$1(b,v,w,_,A,E,k,P,N,q){var B=0,O=v;O=O+_>>>0,B+=O<v?1:0,O=O+E>>>0,B+=O<E?1:0,O=O+P>>>0,B+=O<P?1:0,O=O+q>>>0,B+=O<q?1:0;var I=b+w+A+k+N+B;return I>>>0}utils$f.sum64_5_hi=sum64_5_hi$1;function sum64_5_lo$1(b,v,w,_,A,E,k,P,N,q){var B=v+_+E+P+q;return B>>>0}utils$f.sum64_5_lo=sum64_5_lo$1;function rotr64_hi$1(b,v,w){var _=v<<32-w|b>>>w;return _>>>0}utils$f.rotr64_hi=rotr64_hi$1;function rotr64_lo$1(b,v,w){var _=b<<32-w|v>>>w;return _>>>0}utils$f.rotr64_lo=rotr64_lo$1;function shr64_hi$1(b,v,w){return b>>>w}utils$f.shr64_hi=shr64_hi$1;function shr64_lo$1(b,v,w){var _=b<<32-w|v>>>w;return _>>>0}utils$f.shr64_lo=shr64_lo$1;var common$5={},utils$e=utils$f,assert$b=minimalisticAssert;function BlockHash$4(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}common$5.BlockHash=BlockHash$4;BlockHash$4.prototype.update=function(v,w){if(v=utils$e.toArray(v,w),this.pending?this.pending=this.pending.concat(v):this.pending=v,this.pendingTotal+=v.length,this.pending.length>=this._delta8){v=this.pending;var _=v.length%this._delta8;this.pending=v.slice(v.length-_,v.length),this.pending.length===0&&(this.pending=null),v=utils$e.join32(v,0,v.length-_,this.endian);for(var A=0;A<v.length;A+=this._delta32)this._update(v,A,A+this._delta32)}return this};BlockHash$4.prototype.digest=function(v){return this.update(this._pad()),assert$b(this.pending===null),this._digest(v)};BlockHash$4.prototype._pad=function(){var v=this.pendingTotal,w=this._delta8,_=w-(v+this.padLength)%w,A=new Array(_+this.padLength);A[0]=128;for(var E=1;E<_;E++)A[E]=0;if(v<<=3,this.endian==="big"){for(var k=8;k<this.padLength;k++)A[E++]=0;A[E++]=0,A[E++]=0,A[E++]=0,A[E++]=0,A[E++]=v>>>24&255,A[E++]=v>>>16&255,A[E++]=v>>>8&255,A[E++]=v&255}else for(A[E++]=v&255,A[E++]=v>>>8&255,A[E++]=v>>>16&255,A[E++]=v>>>24&255,A[E++]=0,A[E++]=0,A[E++]=0,A[E++]=0,k=8;k<this.padLength;k++)A[E++]=0;return A};var sha={},common$4={},utils$d=utils$f,rotr32=utils$d.rotr32;function ft_1$1(b,v,w,_){if(b===0)return ch32$1(v,w,_);if(b===1||b===3)return p32(v,w,_);if(b===2)return maj32$1(v,w,_)}common$4.ft_1=ft_1$1;function ch32$1(b,v,w){return b&v^~b&w}common$4.ch32=ch32$1;function maj32$1(b,v,w){return b&v^b&w^v&w}common$4.maj32=maj32$1;function p32(b,v,w){return b^v^w}common$4.p32=p32;function s0_256$1(b){return rotr32(b,2)^rotr32(b,13)^rotr32(b,22)}common$4.s0_256=s0_256$1;function s1_256$1(b){return rotr32(b,6)^rotr32(b,11)^rotr32(b,25)}common$4.s1_256=s1_256$1;function g0_256$1(b){return rotr32(b,7)^rotr32(b,18)^b>>>3}common$4.g0_256=g0_256$1;function g1_256$1(b){return rotr32(b,17)^rotr32(b,19)^b>>>10}common$4.g1_256=g1_256$1;var utils$c=utils$f,common$3=common$5,shaCommon$1=common$4,rotl32$1=utils$c.rotl32,sum32$2=utils$c.sum32,sum32_5$1=utils$c.sum32_5,ft_1=shaCommon$1.ft_1,BlockHash$3=common$3.BlockHash,sha1_K=[1518500249,1859775393,2400959708,3395469782];function SHA1(){if(!(this instanceof SHA1))return new SHA1;BlockHash$3.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}utils$c.inherits(SHA1,BlockHash$3);var _1=SHA1;SHA1.blockSize=512;SHA1.outSize=160;SHA1.hmacStrength=80;SHA1.padLength=64;SHA1.prototype._update=function(v,w){for(var _=this.W,A=0;A<16;A++)_[A]=v[w+A];for(;A<_.length;A++)_[A]=rotl32$1(_[A-3]^_[A-8]^_[A-14]^_[A-16],1);var E=this.h[0],k=this.h[1],P=this.h[2],N=this.h[3],q=this.h[4];for(A=0;A<_.length;A++){var B=~~(A/20),O=sum32_5$1(rotl32$1(E,5),ft_1(B,k,P,N),q,_[A],sha1_K[B]);q=N,N=P,P=rotl32$1(k,30),k=E,E=O}this.h[0]=sum32$2(this.h[0],E),this.h[1]=sum32$2(this.h[1],k),this.h[2]=sum32$2(this.h[2],P),this.h[3]=sum32$2(this.h[3],N),this.h[4]=sum32$2(this.h[4],q)};SHA1.prototype._digest=function(v){return v==="hex"?utils$c.toHex32(this.h,"big"):utils$c.split32(this.h,"big")};var utils$b=utils$f,common$2=common$5,shaCommon=common$4,assert$a=minimalisticAssert,sum32$1=utils$b.sum32,sum32_4$1=utils$b.sum32_4,sum32_5=utils$b.sum32_5,ch32=shaCommon.ch32,maj32=shaCommon.maj32,s0_256=shaCommon.s0_256,s1_256=shaCommon.s1_256,g0_256=shaCommon.g0_256,g1_256=shaCommon.g1_256,BlockHash$2=common$2.BlockHash,sha256_K=[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];function SHA256$1(){if(!(this instanceof SHA256$1))return new SHA256$1;BlockHash$2.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=sha256_K,this.W=new Array(64)}utils$b.inherits(SHA256$1,BlockHash$2);var _256=SHA256$1;SHA256$1.blockSize=512;SHA256$1.outSize=256;SHA256$1.hmacStrength=192;SHA256$1.padLength=64;SHA256$1.prototype._update=function(v,w){for(var _=this.W,A=0;A<16;A++)_[A]=v[w+A];for(;A<_.length;A++)_[A]=sum32_4$1(g1_256(_[A-2]),_[A-7],g0_256(_[A-15]),_[A-16]);var E=this.h[0],k=this.h[1],P=this.h[2],N=this.h[3],q=this.h[4],B=this.h[5],O=this.h[6],I=this.h[7];for(assert$a(this.k.length===_.length),A=0;A<_.length;A++){var D=sum32_5(I,s1_256(q),ch32(q,B,O),this.k[A],_[A]),V=sum32$1(s0_256(E),maj32(E,k,P));I=O,O=B,B=q,q=sum32$1(N,D),N=P,P=k,k=E,E=sum32$1(D,V)}this.h[0]=sum32$1(this.h[0],E),this.h[1]=sum32$1(this.h[1],k),this.h[2]=sum32$1(this.h[2],P),this.h[3]=sum32$1(this.h[3],N),this.h[4]=sum32$1(this.h[4],q),this.h[5]=sum32$1(this.h[5],B),this.h[6]=sum32$1(this.h[6],O),this.h[7]=sum32$1(this.h[7],I)};SHA256$1.prototype._digest=function(v){return v==="hex"?utils$b.toHex32(this.h,"big"):utils$b.split32(this.h,"big")};var utils$a=utils$f,SHA256=_256;function SHA224(){if(!(this instanceof SHA224))return new SHA224;SHA256.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}utils$a.inherits(SHA224,SHA256);var _224=SHA224;SHA224.blockSize=512;SHA224.outSize=224;SHA224.hmacStrength=192;SHA224.padLength=64;SHA224.prototype._digest=function(v){return v==="hex"?utils$a.toHex32(this.h.slice(0,7),"big"):utils$a.split32(this.h.slice(0,7),"big")};var utils$9=utils$f,common$1=common$5,assert$9=minimalisticAssert,rotr64_hi=utils$9.rotr64_hi,rotr64_lo=utils$9.rotr64_lo,shr64_hi=utils$9.shr64_hi,shr64_lo=utils$9.shr64_lo,sum64=utils$9.sum64,sum64_hi=utils$9.sum64_hi,sum64_lo=utils$9.sum64_lo,sum64_4_hi=utils$9.sum64_4_hi,sum64_4_lo=utils$9.sum64_4_lo,sum64_5_hi=utils$9.sum64_5_hi,sum64_5_lo=utils$9.sum64_5_lo,BlockHash$1=common$1.BlockHash,sha512_K=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function SHA512$1(){if(!(this instanceof SHA512$1))return new SHA512$1;BlockHash$1.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=sha512_K,this.W=new Array(160)}utils$9.inherits(SHA512$1,BlockHash$1);var _512=SHA512$1;SHA512$1.blockSize=1024;SHA512$1.outSize=512;SHA512$1.hmacStrength=192;SHA512$1.padLength=128;SHA512$1.prototype._prepareBlock=function(v,w){for(var _=this.W,A=0;A<32;A++)_[A]=v[w+A];for(;A<_.length;A+=2){var E=g1_512_hi(_[A-4],_[A-3]),k=g1_512_lo(_[A-4],_[A-3]),P=_[A-14],N=_[A-13],q=g0_512_hi(_[A-30],_[A-29]),B=g0_512_lo(_[A-30],_[A-29]),O=_[A-32],I=_[A-31];_[A]=sum64_4_hi(E,k,P,N,q,B,O,I),_[A+1]=sum64_4_lo(E,k,P,N,q,B,O,I)}};SHA512$1.prototype._update=function(v,w){this._prepareBlock(v,w);var _=this.W,A=this.h[0],E=this.h[1],k=this.h[2],P=this.h[3],N=this.h[4],q=this.h[5],B=this.h[6],O=this.h[7],I=this.h[8],D=this.h[9],V=this.h[10],ee=this.h[11],J=this.h[12],te=this.h[13],se=this.h[14],ce=this.h[15];assert$9(this.k.length===_.length);for(var ae=0;ae<_.length;ae+=2){var he=se,oe=ce,de=s1_512_hi(I,D),le=s1_512_lo(I,D),be=ch64_hi(I,D,V,ee,J),pe=ch64_lo(I,D,V,ee,J,te),fe=this.k[ae],Z=this.k[ae+1],U=_[ae],S=_[ae+1],C=sum64_5_hi(he,oe,de,le,be,pe,fe,Z,U,S),F=sum64_5_lo(he,oe,de,le,be,pe,fe,Z,U,S);he=s0_512_hi(A,E),oe=s0_512_lo(A,E),de=maj64_hi(A,E,k,P,N),le=maj64_lo(A,E,k,P,N,q);var X=sum64_hi(he,oe,de,le),re=sum64_lo(he,oe,de,le);se=J,ce=te,J=V,te=ee,V=I,ee=D,I=sum64_hi(B,O,C,F),D=sum64_lo(O,O,C,F),B=N,O=q,N=k,q=P,k=A,P=E,A=sum64_hi(C,F,X,re),E=sum64_lo(C,F,X,re)}sum64(this.h,0,A,E),sum64(this.h,2,k,P),sum64(this.h,4,N,q),sum64(this.h,6,B,O),sum64(this.h,8,I,D),sum64(this.h,10,V,ee),sum64(this.h,12,J,te),sum64(this.h,14,se,ce)};SHA512$1.prototype._digest=function(v){return v==="hex"?utils$9.toHex32(this.h,"big"):utils$9.split32(this.h,"big")};function ch64_hi(b,v,w,_,A){var E=b&w^~b&A;return E<0&&(E+=4294967296),E}function ch64_lo(b,v,w,_,A,E){var k=v&_^~v&E;return k<0&&(k+=4294967296),k}function maj64_hi(b,v,w,_,A){var E=b&w^b&A^w&A;return E<0&&(E+=4294967296),E}function maj64_lo(b,v,w,_,A,E){var k=v&_^v&E^_&E;return k<0&&(k+=4294967296),k}function s0_512_hi(b,v){var w=rotr64_hi(b,v,28),_=rotr64_hi(v,b,2),A=rotr64_hi(v,b,7),E=w^_^A;return E<0&&(E+=4294967296),E}function s0_512_lo(b,v){var w=rotr64_lo(b,v,28),_=rotr64_lo(v,b,2),A=rotr64_lo(v,b,7),E=w^_^A;return E<0&&(E+=4294967296),E}function s1_512_hi(b,v){var w=rotr64_hi(b,v,14),_=rotr64_hi(b,v,18),A=rotr64_hi(v,b,9),E=w^_^A;return E<0&&(E+=4294967296),E}function s1_512_lo(b,v){var w=rotr64_lo(b,v,14),_=rotr64_lo(b,v,18),A=rotr64_lo(v,b,9),E=w^_^A;return E<0&&(E+=4294967296),E}function g0_512_hi(b,v){var w=rotr64_hi(b,v,1),_=rotr64_hi(b,v,8),A=shr64_hi(b,v,7),E=w^_^A;return E<0&&(E+=4294967296),E}function g0_512_lo(b,v){var w=rotr64_lo(b,v,1),_=rotr64_lo(b,v,8),A=shr64_lo(b,v,7),E=w^_^A;return E<0&&(E+=4294967296),E}function g1_512_hi(b,v){var w=rotr64_hi(b,v,19),_=rotr64_hi(v,b,29),A=shr64_hi(b,v,6),E=w^_^A;return E<0&&(E+=4294967296),E}function g1_512_lo(b,v){var w=rotr64_lo(b,v,19),_=rotr64_lo(v,b,29),A=shr64_lo(b,v,6),E=w^_^A;return E<0&&(E+=4294967296),E}var utils$8=utils$f,SHA512=_512;function SHA384(){if(!(this instanceof SHA384))return new SHA384;SHA512.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}utils$8.inherits(SHA384,SHA512);var _384=SHA384;SHA384.blockSize=1024;SHA384.outSize=384;SHA384.hmacStrength=192;SHA384.padLength=128;SHA384.prototype._digest=function(v){return v==="hex"?utils$8.toHex32(this.h.slice(0,12),"big"):utils$8.split32(this.h.slice(0,12),"big")};sha.sha1=_1;sha.sha224=_224;sha.sha256=_256;sha.sha384=_384;sha.sha512=_512;var ripemd={},utils$7=utils$f,common=common$5,rotl32=utils$7.rotl32,sum32=utils$7.sum32,sum32_3=utils$7.sum32_3,sum32_4=utils$7.sum32_4,BlockHash=common.BlockHash;function RIPEMD160(){if(!(this instanceof RIPEMD160))return new RIPEMD160;BlockHash.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}utils$7.inherits(RIPEMD160,BlockHash);ripemd.ripemd160=RIPEMD160;RIPEMD160.blockSize=512;RIPEMD160.outSize=160;RIPEMD160.hmacStrength=192;RIPEMD160.padLength=64;RIPEMD160.prototype._update=function(v,w){for(var _=this.h[0],A=this.h[1],E=this.h[2],k=this.h[3],P=this.h[4],N=_,q=A,B=E,O=k,I=P,D=0;D<80;D++){var V=sum32(rotl32(sum32_4(_,f(D,A,E,k),v[r[D]+w],K(D)),s[D]),P);_=P,P=k,k=rotl32(E,10),E=A,A=V,V=sum32(rotl32(sum32_4(N,f(79-D,q,B,O),v[rh[D]+w],Kh(D)),sh[D]),I),N=I,I=O,O=rotl32(B,10),B=q,q=V}V=sum32_3(this.h[1],E,O),this.h[1]=sum32_3(this.h[2],k,I),this.h[2]=sum32_3(this.h[3],P,N),this.h[3]=sum32_3(this.h[4],_,q),this.h[4]=sum32_3(this.h[0],A,B),this.h[0]=V};RIPEMD160.prototype._digest=function(v){return v==="hex"?utils$7.toHex32(this.h,"little"):utils$7.split32(this.h,"little")};function f(b,v,w,_){return b<=15?v^w^_:b<=31?v&w|~v&_:b<=47?(v|~w)^_:b<=63?v&_|w&~_:v^(w|~_)}function K(b){return b<=15?0:b<=31?1518500249:b<=47?1859775393:b<=63?2400959708:2840853838}function Kh(b){return b<=15?1352829926:b<=31?1548603684:b<=47?1836072691:b<=63?2053994217:0}var r=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],rh=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],s=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],sh=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],utils$6=utils$f,assert$8=minimalisticAssert;function Hmac(b,v,w){if(!(this instanceof Hmac))return new Hmac(b,v,w);this.Hash=b,this.blockSize=b.blockSize/8,this.outSize=b.outSize/8,this.inner=null,this.outer=null,this._init(utils$6.toArray(v,w))}var hmac=Hmac;Hmac.prototype._init=function(v){v.length>this.blockSize&&(v=new this.Hash().update(v).digest()),assert$8(v.length<=this.blockSize);for(var w=v.length;w<this.blockSize;w++)v.push(0);for(w=0;w<v.length;w++)v[w]^=54;for(this.inner=new this.Hash().update(v),w=0;w<v.length;w++)v[w]^=106;this.outer=new this.Hash().update(v)};Hmac.prototype.update=function(v,w){return this.inner.update(v,w),this};Hmac.prototype.digest=function(v){return this.outer.update(this.inner.digest()),this.outer.digest(v)};(function(b){var v=b;v.utils=utils$f,v.common=common$5,v.sha=sha,v.ripemd=ripemd,v.hmac=hmac,v.sha1=v.sha.sha1,v.sha256=v.sha.sha256,v.sha224=v.sha.sha224,v.sha384=v.sha.sha384,v.sha512=v.sha.sha512,v.ripemd160=v.ripemd.ripemd160})(hash$2);var secp256k1,hasRequiredSecp256k1;function requireSecp256k1(){return hasRequiredSecp256k1||(hasRequiredSecp256k1=1,secp256k1={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),secp256k1}(function(b){var v=b,w=hash$2,_=curve,A=utils$l,E=A.assert;function k(q){q.type==="short"?this.curve=new _.short(q):q.type==="edwards"?this.curve=new _.edwards(q):this.curve=new _.mont(q),this.g=this.curve.g,this.n=this.curve.n,this.hash=q.hash,E(this.g.validate(),"Invalid curve"),E(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}v.PresetCurve=k;function P(q,B){Object.defineProperty(v,q,{configurable:!0,enumerable:!0,get:function(){var O=new k(B);return Object.defineProperty(v,q,{configurable:!0,enumerable:!0,value:O}),O}})}P("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:w.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),P("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:w.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),P("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:w.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),P("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:w.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),P("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:w.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),P("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:w.sha256,gRed:!1,g:["9"]}),P("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:w.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var N;try{N=requireSecp256k1()}catch{N=void 0}P("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:w.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",N]})})(curves$1);var hash$1=hash$2,utils$5=utils$k,assert$7=minimalisticAssert;function HmacDRBG(b){if(!(this instanceof HmacDRBG))return new HmacDRBG(b);this.hash=b.hash,this.predResist=!!b.predResist,this.outLen=this.hash.outSize,this.minEntropy=b.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var v=utils$5.toArray(b.entropy,b.entropyEnc||"hex"),w=utils$5.toArray(b.nonce,b.nonceEnc||"hex"),_=utils$5.toArray(b.pers,b.persEnc||"hex");assert$7(v.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(v,w,_)}var hmacDrbg=HmacDRBG;HmacDRBG.prototype._init=function(v,w,_){var A=v.concat(w).concat(_);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var E=0;E<this.V.length;E++)this.K[E]=0,this.V[E]=1;this._update(A),this._reseed=1,this.reseedInterval=281474976710656};HmacDRBG.prototype._hmac=function(){return new hash$1.hmac(this.hash,this.K)};HmacDRBG.prototype._update=function(v){var w=this._hmac().update(this.V).update([0]);v&&(w=w.update(v)),this.K=w.digest(),this.V=this._hmac().update(this.V).digest(),v&&(this.K=this._hmac().update(this.V).update([1]).update(v).digest(),this.V=this._hmac().update(this.V).digest())};HmacDRBG.prototype.reseed=function(v,w,_,A){typeof w!="string"&&(A=_,_=w,w=null),v=utils$5.toArray(v,w),_=utils$5.toArray(_,A),assert$7(v.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(v.concat(_||[])),this._reseed=1};HmacDRBG.prototype.generate=function(v,w,_,A){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof w!="string"&&(A=_,_=w,w=null),_&&(_=utils$5.toArray(_,A||"hex"),this._update(_));for(var E=[];E.length<v;)this.V=this._hmac().update(this.V).digest(),E=E.concat(this.V);var k=E.slice(0,v);return this._update(_),this._reseed++,utils$5.encode(k,w)};var BN$5=bnExports$2,utils$4=utils$l,assert$6=utils$4.assert;function KeyPair$2(b,v){this.ec=b,this.priv=null,this.pub=null,v.priv&&this._importPrivate(v.priv,v.privEnc),v.pub&&this._importPublic(v.pub,v.pubEnc)}var key$1=KeyPair$2;KeyPair$2.fromPublic=function(v,w,_){return w instanceof KeyPair$2?w:new KeyPair$2(v,{pub:w,pubEnc:_})};KeyPair$2.fromPrivate=function(v,w,_){return w instanceof KeyPair$2?w:new KeyPair$2(v,{priv:w,privEnc:_})};KeyPair$2.prototype.validate=function(){var v=this.getPublic();return v.isInfinity()?{result:!1,reason:"Invalid public key"}:v.validate()?v.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};KeyPair$2.prototype.getPublic=function(v,w){return typeof v=="string"&&(w=v,v=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),w?this.pub.encode(w,v):this.pub};KeyPair$2.prototype.getPrivate=function(v){return v==="hex"?this.priv.toString(16,2):this.priv};KeyPair$2.prototype._importPrivate=function(v,w){this.priv=new BN$5(v,w||16),this.priv=this.priv.umod(this.ec.curve.n)};KeyPair$2.prototype._importPublic=function(v,w){if(v.x||v.y){this.ec.curve.type==="mont"?assert$6(v.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&assert$6(v.x&&v.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(v.x,v.y);return}this.pub=this.ec.curve.decodePoint(v,w)};KeyPair$2.prototype.derive=function(v){return v.validate()||assert$6(v.validate(),"public point not validated"),v.mul(this.priv).getX()};KeyPair$2.prototype.sign=function(v,w,_){return this.ec.sign(v,this,w,_)};KeyPair$2.prototype.verify=function(v,w){return this.ec.verify(v,w,this)};KeyPair$2.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var BN$4=bnExports$2,utils$3=utils$l,assert$5=utils$3.assert;function Signature$2(b,v){if(b instanceof Signature$2)return b;this._importDER(b,v)||(assert$5(b.r&&b.s,"Signature without r or s"),this.r=new BN$4(b.r,16),this.s=new BN$4(b.s,16),b.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=b.recoveryParam)}var signature$1=Signature$2;function Position(){this.place=0}function getLength(b,v){var w=b[v.place++];if(!(w&128))return w;var _=w&15;if(_===0||_>4||b[v.place]===0)return!1;for(var A=0,E=0,k=v.place;E<_;E++,k++)A<<=8,A|=b[k],A>>>=0;return A<=127?!1:(v.place=k,A)}function rmPadding(b){for(var v=0,w=b.length-1;!b[v]&&!(b[v+1]&128)&&v<w;)v++;return v===0?b:b.slice(v)}Signature$2.prototype._importDER=function(v,w){v=utils$3.toArray(v,w);var _=new Position;if(v[_.place++]!==48)return!1;var A=getLength(v,_);if(A===!1||A+_.place!==v.length||v[_.place++]!==2)return!1;var E=getLength(v,_);if(E===!1||v[_.place]&128)return!1;var k=v.slice(_.place,E+_.place);if(_.place+=E,v[_.place++]!==2)return!1;var P=getLength(v,_);if(P===!1||v.length!==P+_.place||v[_.place]&128)return!1;var N=v.slice(_.place,P+_.place);if(k[0]===0)if(k[1]&128)k=k.slice(1);else return!1;if(N[0]===0)if(N[1]&128)N=N.slice(1);else return!1;return this.r=new BN$4(k),this.s=new BN$4(N),this.recoveryParam=null,!0};function constructLength(b,v){if(v<128){b.push(v);return}var w=1+(Math.log(v)/Math.LN2>>>3);for(b.push(w|128);--w;)b.push(v>>>(w<<3)&255);b.push(v)}Signature$2.prototype.toDER=function(v){var w=this.r.toArray(),_=this.s.toArray();for(w[0]&128&&(w=[0].concat(w)),_[0]&128&&(_=[0].concat(_)),w=rmPadding(w),_=rmPadding(_);!_[0]&&!(_[1]&128);)_=_.slice(1);var A=[2];constructLength(A,w.length),A=A.concat(w),A.push(2),constructLength(A,_.length);var E=A.concat(_),k=[48];return constructLength(k,E.length),k=k.concat(E),utils$3.encode(k,v)};var ec,hasRequiredEc;function requireEc(){if(hasRequiredEc)return ec;hasRequiredEc=1;var b=bnExports$2,v=hmacDrbg,w=utils$l,_=curves$1,A=requireBrorand(),E=w.assert,k=key$1,P=signature$1;function N(q){if(!(this instanceof N))return new N(q);typeof q=="string"&&(E(Object.prototype.hasOwnProperty.call(_,q),"Unknown curve "+q),q=_[q]),q instanceof _.PresetCurve&&(q={curve:q}),this.curve=q.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=q.curve.g,this.g.precompute(q.curve.n.bitLength()+1),this.hash=q.hash||q.curve.hash}return ec=N,N.prototype.keyPair=function(B){return new k(this,B)},N.prototype.keyFromPrivate=function(B,O){return k.fromPrivate(this,B,O)},N.prototype.keyFromPublic=function(B,O){return k.fromPublic(this,B,O)},N.prototype.genKeyPair=function(B){B||(B={});for(var O=new v({hash:this.hash,pers:B.pers,persEnc:B.persEnc||"utf8",entropy:B.entropy||A(this.hash.hmacStrength),entropyEnc:B.entropy&&B.entropyEnc||"utf8",nonce:this.n.toArray()}),I=this.n.byteLength(),D=this.n.sub(new b(2));;){var V=new b(O.generate(I));if(!(V.cmp(D)>0))return V.iaddn(1),this.keyFromPrivate(V)}},N.prototype._truncateToN=function(B,O){var I=B.byteLength()*8-this.n.bitLength();return I>0&&(B=B.ushrn(I)),!O&&B.cmp(this.n)>=0?B.sub(this.n):B},N.prototype.sign=function(B,O,I,D){typeof I=="object"&&(D=I,I=null),D||(D={}),O=this.keyFromPrivate(O,I),B=this._truncateToN(new b(B,16));for(var V=this.n.byteLength(),ee=O.getPrivate().toArray("be",V),J=B.toArray("be",V),te=new v({hash:this.hash,entropy:ee,nonce:J,pers:D.pers,persEnc:D.persEnc||"utf8"}),se=this.n.sub(new b(1)),ce=0;;ce++){var ae=D.k?D.k(ce):new b(te.generate(this.n.byteLength()));if(ae=this._truncateToN(ae,!0),!(ae.cmpn(1)<=0||ae.cmp(se)>=0)){var he=this.g.mul(ae);if(!he.isInfinity()){var oe=he.getX(),de=oe.umod(this.n);if(de.cmpn(0)!==0){var le=ae.invm(this.n).mul(de.mul(O.getPrivate()).iadd(B));if(le=le.umod(this.n),le.cmpn(0)!==0){var be=(he.getY().isOdd()?1:0)|(oe.cmp(de)!==0?2:0);return D.canonical&&le.cmp(this.nh)>0&&(le=this.n.sub(le),be^=1),new P({r:de,s:le,recoveryParam:be})}}}}}},N.prototype.verify=function(B,O,I,D){B=this._truncateToN(new b(B,16)),I=this.keyFromPublic(I,D),O=new P(O,"hex");var V=O.r,ee=O.s;if(V.cmpn(1)<0||V.cmp(this.n)>=0||ee.cmpn(1)<0||ee.cmp(this.n)>=0)return!1;var J=ee.invm(this.n),te=J.mul(B).umod(this.n),se=J.mul(V).umod(this.n),ce;return this.curve._maxwellTrick?(ce=this.g.jmulAdd(te,I.getPublic(),se),ce.isInfinity()?!1:ce.eqXToP(V)):(ce=this.g.mulAdd(te,I.getPublic(),se),ce.isInfinity()?!1:ce.getX().umod(this.n).cmp(V)===0)},N.prototype.recoverPubKey=function(q,B,O,I){E((3&O)===O,"The recovery param is more than two bits"),B=new P(B,I);var D=this.n,V=new b(q),ee=B.r,J=B.s,te=O&1,se=O>>1;if(ee.cmp(this.curve.p.umod(this.curve.n))>=0&&se)throw new Error("Unable to find sencond key candinate");se?ee=this.curve.pointFromX(ee.add(this.curve.n),te):ee=this.curve.pointFromX(ee,te);var ce=B.r.invm(D),ae=D.sub(V).mul(ce).umod(D),he=J.mul(ce).umod(D);return this.g.mulAdd(ae,ee,he)},N.prototype.getKeyRecoveryParam=function(q,B,O,I){if(B=new P(B,I),B.recoveryParam!==null)return B.recoveryParam;for(var D=0;D<4;D++){var V;try{V=this.recoverPubKey(q,B,D)}catch{continue}if(V.eq(O))return D}throw new Error("Unable to find valid recovery factor")},ec}var utils$2=utils$l,assert$4=utils$2.assert,parseBytes$2=utils$2.parseBytes,cachedProperty$1=utils$2.cachedProperty;function KeyPair$1(b,v){this.eddsa=b,this._secret=parseBytes$2(v.secret),b.isPoint(v.pub)?this._pub=v.pub:this._pubBytes=parseBytes$2(v.pub)}KeyPair$1.fromPublic=function(v,w){return w instanceof KeyPair$1?w:new KeyPair$1(v,{pub:w})};KeyPair$1.fromSecret=function(v,w){return w instanceof KeyPair$1?w:new KeyPair$1(v,{secret:w})};KeyPair$1.prototype.secret=function(){return this._secret};cachedProperty$1(KeyPair$1,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});cachedProperty$1(KeyPair$1,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});cachedProperty$1(KeyPair$1,"privBytes",function(){var v=this.eddsa,w=this.hash(),_=v.encodingLength-1,A=w.slice(0,v.encodingLength);return A[0]&=248,A[_]&=127,A[_]|=64,A});cachedProperty$1(KeyPair$1,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});cachedProperty$1(KeyPair$1,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});cachedProperty$1(KeyPair$1,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});KeyPair$1.prototype.sign=function(v){return assert$4(this._secret,"KeyPair can only verify"),this.eddsa.sign(v,this)};KeyPair$1.prototype.verify=function(v,w){return this.eddsa.verify(v,w,this)};KeyPair$1.prototype.getSecret=function(v){return assert$4(this._secret,"KeyPair is public only"),utils$2.encode(this.secret(),v)};KeyPair$1.prototype.getPublic=function(v){return utils$2.encode(this.pubBytes(),v)};var key=KeyPair$1,BN$3=bnExports$2,utils$1=utils$l,assert$3=utils$1.assert,cachedProperty=utils$1.cachedProperty,parseBytes$1=utils$1.parseBytes;function Signature$1(b,v){this.eddsa=b,typeof v!="object"&&(v=parseBytes$1(v)),Array.isArray(v)&&(assert$3(v.length===b.encodingLength*2,"Signature has invalid size"),v={R:v.slice(0,b.encodingLength),S:v.slice(b.encodingLength)}),assert$3(v.R&&v.S,"Signature without R or S"),b.isPoint(v.R)&&(this._R=v.R),v.S instanceof BN$3&&(this._S=v.S),this._Rencoded=Array.isArray(v.R)?v.R:v.Rencoded,this._Sencoded=Array.isArray(v.S)?v.S:v.Sencoded}cachedProperty(Signature$1,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});cachedProperty(Signature$1,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});cachedProperty(Signature$1,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});cachedProperty(Signature$1,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});Signature$1.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};Signature$1.prototype.toHex=function(){return utils$1.encode(this.toBytes(),"hex").toUpperCase()};var signature=Signature$1,hash=hash$2,curves=curves$1,utils=utils$l,assert$2=utils.assert,parseBytes=utils.parseBytes,KeyPair=key,Signature=signature;function EDDSA(b){if(assert$2(b==="ed25519","only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(b);b=curves[b].curve,this.curve=b,this.g=b.g,this.g.precompute(b.n.bitLength()+1),this.pointClass=b.point().constructor,this.encodingLength=Math.ceil(b.n.bitLength()/8),this.hash=hash.sha512}var eddsa=EDDSA;EDDSA.prototype.sign=function(v,w){v=parseBytes(v);var _=this.keyFromSecret(w),A=this.hashInt(_.messagePrefix(),v),E=this.g.mul(A),k=this.encodePoint(E),P=this.hashInt(k,_.pubBytes(),v).mul(_.priv()),N=A.add(P).umod(this.curve.n);return this.makeSignature({R:E,S:N,Rencoded:k})};EDDSA.prototype.verify=function(v,w,_){if(v=parseBytes(v),w=this.makeSignature(w),w.S().gte(w.eddsa.curve.n)||w.S().isNeg())return!1;var A=this.keyFromPublic(_),E=this.hashInt(w.Rencoded(),A.pubBytes(),v),k=this.g.mul(w.S()),P=w.R().add(A.pub().mul(E));return P.eq(k)};EDDSA.prototype.hashInt=function(){for(var v=this.hash(),w=0;w<arguments.length;w++)v.update(arguments[w]);return utils.intFromLE(v.digest()).umod(this.curve.n)};EDDSA.prototype.keyFromPublic=function(v){return KeyPair.fromPublic(this,v)};EDDSA.prototype.keyFromSecret=function(v){return KeyPair.fromSecret(this,v)};EDDSA.prototype.makeSignature=function(v){return v instanceof Signature?v:new Signature(this,v)};EDDSA.prototype.encodePoint=function(v){var w=v.getY().toArray("le",this.encodingLength);return w[this.encodingLength-1]|=v.getX().isOdd()?128:0,w};EDDSA.prototype.decodePoint=function(v){v=utils.parseBytes(v);var w=v.length-1,_=v.slice(0,w).concat(v[w]&-129),A=(v[w]&128)!==0,E=utils.intFromLE(_);return this.curve.pointFromY(E,A)};EDDSA.prototype.encodeInt=function(v){return v.toArray("le",this.encodingLength)};EDDSA.prototype.decodeInt=function(v){return utils.intFromLE(v)};EDDSA.prototype.isPoint=function(v){return v instanceof this.pointClass};var hasRequiredElliptic;function requireElliptic(){return hasRequiredElliptic||(hasRequiredElliptic=1,function(b){var v=b;v.version=require$$0.version,v.utils=utils$l,v.rand=requireBrorand(),v.curve=curve,v.curves=curves$1,v.ec=requireEc(),v.eddsa=eddsa}(elliptic)),elliptic}var bn={exports:{}};bn.exports;(function(b){(function(v,w){function _(U,S){if(!U)throw new Error(S||"Assertion failed")}function A(U,S){U.super_=S;var C=function(){};C.prototype=S.prototype,U.prototype=new C,U.prototype.constructor=U}function E(U,S,C){if(E.isBN(U))return U;this.negative=0,this.words=null,this.length=0,this.red=null,U!==null&&((S==="le"||S==="be")&&(C=S,S=10),this._init(U||0,S||10,C||"be"))}typeof v=="object"?v.exports=E:w.BN=E,E.BN=E,E.wordSize=26;var k;try{typeof window<"u"&&typeof window.Buffer<"u"?k=window.Buffer:k=require$$1$2.Buffer}catch{}E.isBN=function(S){return S instanceof E?!0:S!==null&&typeof S=="object"&&S.constructor.wordSize===E.wordSize&&Array.isArray(S.words)},E.max=function(S,C){return S.cmp(C)>0?S:C},E.min=function(S,C){return S.cmp(C)<0?S:C},E.prototype._init=function(S,C,F){if(typeof S=="number")return this._initNumber(S,C,F);if(typeof S=="object")return this._initArray(S,C,F);C==="hex"&&(C=16),_(C===(C|0)&&C>=2&&C<=36),S=S.toString().replace(/\s+/g,"");var X=0;S[0]==="-"&&(X++,this.negative=1),X<S.length&&(C===16?this._parseHex(S,X,F):(this._parseBase(S,C,X),F==="le"&&this._initArray(this.toArray(),C,F)))},E.prototype._initNumber=function(S,C,F){S<0&&(this.negative=1,S=-S),S<67108864?(this.words=[S&67108863],this.length=1):S<4503599627370496?(this.words=[S&67108863,S/67108864&67108863],this.length=2):(_(S<9007199254740992),this.words=[S&67108863,S/67108864&67108863,1],this.length=3),F==="le"&&this._initArray(this.toArray(),C,F)},E.prototype._initArray=function(S,C,F){if(_(typeof S.length=="number"),S.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(S.length/3),this.words=new Array(this.length);for(var X=0;X<this.length;X++)this.words[X]=0;var re,ie,Q=0;if(F==="be")for(X=S.length-1,re=0;X>=0;X-=3)ie=S[X]|S[X-1]<<8|S[X-2]<<16,this.words[re]|=ie<<Q&67108863,this.words[re+1]=ie>>>26-Q&67108863,Q+=24,Q>=26&&(Q-=26,re++);else if(F==="le")for(X=0,re=0;X<S.length;X+=3)ie=S[X]|S[X+1]<<8|S[X+2]<<16,this.words[re]|=ie<<Q&67108863,this.words[re+1]=ie>>>26-Q&67108863,Q+=24,Q>=26&&(Q-=26,re++);return this._strip()};function P(U,S){var C=U.charCodeAt(S);if(C>=48&&C<=57)return C-48;if(C>=65&&C<=70)return C-55;if(C>=97&&C<=102)return C-87;_(!1,"Invalid character in "+U)}function N(U,S,C){var F=P(U,C);return C-1>=S&&(F|=P(U,C-1)<<4),F}E.prototype._parseHex=function(S,C,F){this.length=Math.ceil((S.length-C)/6),this.words=new Array(this.length);for(var X=0;X<this.length;X++)this.words[X]=0;var re=0,ie=0,Q;if(F==="be")for(X=S.length-1;X>=C;X-=2)Q=N(S,C,X)<<re,this.words[ie]|=Q&67108863,re>=18?(re-=18,ie+=1,this.words[ie]|=Q>>>26):re+=8;else{var ne=S.length-C;for(X=ne%2===0?C+1:C;X<S.length;X+=2)Q=N(S,C,X)<<re,this.words[ie]|=Q&67108863,re>=18?(re-=18,ie+=1,this.words[ie]|=Q>>>26):re+=8}this._strip()};function q(U,S,C,F){for(var X=0,re=0,ie=Math.min(U.length,C),Q=S;Q<ie;Q++){var ne=U.charCodeAt(Q)-48;X*=F,ne>=49?re=ne-49+10:ne>=17?re=ne-17+10:re=ne,_(ne>=0&&re<F,"Invalid character"),X+=re}return X}E.prototype._parseBase=function(S,C,F){this.words=[0],this.length=1;for(var X=0,re=1;re<=67108863;re*=C)X++;X--,re=re/C|0;for(var ie=S.length-F,Q=ie%X,ne=Math.min(ie,ie-Q)+F,L=0,ue=F;ue<ne;ue+=X)L=q(S,ue,ue+X,C),this.imuln(re),this.words[0]+L<67108864?this.words[0]+=L:this._iaddn(L);if(Q!==0){var Ae=1;for(L=q(S,ue,S.length,C),ue=0;ue<Q;ue++)Ae*=C;this.imuln(Ae),this.words[0]+L<67108864?this.words[0]+=L:this._iaddn(L)}this._strip()},E.prototype.copy=function(S){S.words=new Array(this.length);for(var C=0;C<this.length;C++)S.words[C]=this.words[C];S.length=this.length,S.negative=this.negative,S.red=this.red};function B(U,S){U.words=S.words,U.length=S.length,U.negative=S.negative,U.red=S.red}if(E.prototype._move=function(S){B(S,this)},E.prototype.clone=function(){var S=new E(null);return this.copy(S),S},E.prototype._expand=function(S){for(;this.length<S;)this.words[this.length++]=0;return this},E.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},E.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{E.prototype[Symbol.for("nodejs.util.inspect.custom")]=O}catch{E.prototype.inspect=O}else E.prototype.inspect=O;function O(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var I=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],D=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],V=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];E.prototype.toString=function(S,C){S=S||10,C=C|0||1;var F;if(S===16||S==="hex"){F="";for(var X=0,re=0,ie=0;ie<this.length;ie++){var Q=this.words[ie],ne=((Q<<X|re)&16777215).toString(16);re=Q>>>24-X&16777215,X+=2,X>=26&&(X-=26,ie--),re!==0||ie!==this.length-1?F=I[6-ne.length]+ne+F:F=ne+F}for(re!==0&&(F=re.toString(16)+F);F.length%C!==0;)F="0"+F;return this.negative!==0&&(F="-"+F),F}if(S===(S|0)&&S>=2&&S<=36){var L=D[S],ue=V[S];F="";var Ae=this.clone();for(Ae.negative=0;!Ae.isZero();){var Re=Ae.modrn(ue).toString(S);Ae=Ae.idivn(ue),Ae.isZero()?F=Re+F:F=I[L-Re.length]+Re+F}for(this.isZero()&&(F="0"+F);F.length%C!==0;)F="0"+F;return this.negative!==0&&(F="-"+F),F}_(!1,"Base should be between 2 and 36")},E.prototype.toNumber=function(){var S=this.words[0];return this.length===2?S+=this.words[1]*67108864:this.length===3&&this.words[2]===1?S+=4503599627370496+this.words[1]*67108864:this.length>2&&_(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-S:S},E.prototype.toJSON=function(){return this.toString(16,2)},k&&(E.prototype.toBuffer=function(S,C){return this.toArrayLike(k,S,C)}),E.prototype.toArray=function(S,C){return this.toArrayLike(Array,S,C)};var ee=function(S,C){return S.allocUnsafe?S.allocUnsafe(C):new S(C)};E.prototype.toArrayLike=function(S,C,F){this._strip();var X=this.byteLength(),re=F||Math.max(1,X);_(X<=re,"byte array longer than desired length"),_(re>0,"Requested array length <= 0");var ie=ee(S,re),Q=C==="le"?"LE":"BE";return this["_toArrayLike"+Q](ie,X),ie},E.prototype._toArrayLikeLE=function(S,C){for(var F=0,X=0,re=0,ie=0;re<this.length;re++){var Q=this.words[re]<<ie|X;S[F++]=Q&255,F<S.length&&(S[F++]=Q>>8&255),F<S.length&&(S[F++]=Q>>16&255),ie===6?(F<S.length&&(S[F++]=Q>>24&255),X=0,ie=0):(X=Q>>>24,ie+=2)}if(F<S.length)for(S[F++]=X;F<S.length;)S[F++]=0},E.prototype._toArrayLikeBE=function(S,C){for(var F=S.length-1,X=0,re=0,ie=0;re<this.length;re++){var Q=this.words[re]<<ie|X;S[F--]=Q&255,F>=0&&(S[F--]=Q>>8&255),F>=0&&(S[F--]=Q>>16&255),ie===6?(F>=0&&(S[F--]=Q>>24&255),X=0,ie=0):(X=Q>>>24,ie+=2)}if(F>=0)for(S[F--]=X;F>=0;)S[F--]=0},Math.clz32?E.prototype._countBits=function(S){return 32-Math.clz32(S)}:E.prototype._countBits=function(S){var C=S,F=0;return C>=4096&&(F+=13,C>>>=13),C>=64&&(F+=7,C>>>=7),C>=8&&(F+=4,C>>>=4),C>=2&&(F+=2,C>>>=2),F+C},E.prototype._zeroBits=function(S){if(S===0)return 26;var C=S,F=0;return C&8191||(F+=13,C>>>=13),C&127||(F+=7,C>>>=7),C&15||(F+=4,C>>>=4),C&3||(F+=2,C>>>=2),C&1||F++,F},E.prototype.bitLength=function(){var S=this.words[this.length-1],C=this._countBits(S);return(this.length-1)*26+C};function J(U){for(var S=new Array(U.bitLength()),C=0;C<S.length;C++){var F=C/26|0,X=C%26;S[C]=U.words[F]>>>X&1}return S}E.prototype.zeroBits=function(){if(this.isZero())return 0;for(var S=0,C=0;C<this.length;C++){var F=this._zeroBits(this.words[C]);if(S+=F,F!==26)break}return S},E.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},E.prototype.toTwos=function(S){return this.negative!==0?this.abs().inotn(S).iaddn(1):this.clone()},E.prototype.fromTwos=function(S){return this.testn(S-1)?this.notn(S).iaddn(1).ineg():this.clone()},E.prototype.isNeg=function(){return this.negative!==0},E.prototype.neg=function(){return this.clone().ineg()},E.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},E.prototype.iuor=function(S){for(;this.length<S.length;)this.words[this.length++]=0;for(var C=0;C<S.length;C++)this.words[C]=this.words[C]|S.words[C];return this._strip()},E.prototype.ior=function(S){return _((this.negative|S.negative)===0),this.iuor(S)},E.prototype.or=function(S){return this.length>S.length?this.clone().ior(S):S.clone().ior(this)},E.prototype.uor=function(S){return this.length>S.length?this.clone().iuor(S):S.clone().iuor(this)},E.prototype.iuand=function(S){var C;this.length>S.length?C=S:C=this;for(var F=0;F<C.length;F++)this.words[F]=this.words[F]&S.words[F];return this.length=C.length,this._strip()},E.prototype.iand=function(S){return _((this.negative|S.negative)===0),this.iuand(S)},E.prototype.and=function(S){return this.length>S.length?this.clone().iand(S):S.clone().iand(this)},E.prototype.uand=function(S){return this.length>S.length?this.clone().iuand(S):S.clone().iuand(this)},E.prototype.iuxor=function(S){var C,F;this.length>S.length?(C=this,F=S):(C=S,F=this);for(var X=0;X<F.length;X++)this.words[X]=C.words[X]^F.words[X];if(this!==C)for(;X<C.length;X++)this.words[X]=C.words[X];return this.length=C.length,this._strip()},E.prototype.ixor=function(S){return _((this.negative|S.negative)===0),this.iuxor(S)},E.prototype.xor=function(S){return this.length>S.length?this.clone().ixor(S):S.clone().ixor(this)},E.prototype.uxor=function(S){return this.length>S.length?this.clone().iuxor(S):S.clone().iuxor(this)},E.prototype.inotn=function(S){_(typeof S=="number"&&S>=0);var C=Math.ceil(S/26)|0,F=S%26;this._expand(C),F>0&&C--;for(var X=0;X<C;X++)this.words[X]=~this.words[X]&67108863;return F>0&&(this.words[X]=~this.words[X]&67108863>>26-F),this._strip()},E.prototype.notn=function(S){return this.clone().inotn(S)},E.prototype.setn=function(S,C){_(typeof S=="number"&&S>=0);var F=S/26|0,X=S%26;return this._expand(F+1),C?this.words[F]=this.words[F]|1<<X:this.words[F]=this.words[F]&~(1<<X),this._strip()},E.prototype.iadd=function(S){var C;if(this.negative!==0&&S.negative===0)return this.negative=0,C=this.isub(S),this.negative^=1,this._normSign();if(this.negative===0&&S.negative!==0)return S.negative=0,C=this.isub(S),S.negative=1,C._normSign();var F,X;this.length>S.length?(F=this,X=S):(F=S,X=this);for(var re=0,ie=0;ie<X.length;ie++)C=(F.words[ie]|0)+(X.words[ie]|0)+re,this.words[ie]=C&67108863,re=C>>>26;for(;re!==0&&ie<F.length;ie++)C=(F.words[ie]|0)+re,this.words[ie]=C&67108863,re=C>>>26;if(this.length=F.length,re!==0)this.words[this.length]=re,this.length++;else if(F!==this)for(;ie<F.length;ie++)this.words[ie]=F.words[ie];return this},E.prototype.add=function(S){var C;return S.negative!==0&&this.negative===0?(S.negative=0,C=this.sub(S),S.negative^=1,C):S.negative===0&&this.negative!==0?(this.negative=0,C=S.sub(this),this.negative=1,C):this.length>S.length?this.clone().iadd(S):S.clone().iadd(this)},E.prototype.isub=function(S){if(S.negative!==0){S.negative=0;var C=this.iadd(S);return S.negative=1,C._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(S),this.negative=1,this._normSign();var F=this.cmp(S);if(F===0)return this.negative=0,this.length=1,this.words[0]=0,this;var X,re;F>0?(X=this,re=S):(X=S,re=this);for(var ie=0,Q=0;Q<re.length;Q++)C=(X.words[Q]|0)-(re.words[Q]|0)+ie,ie=C>>26,this.words[Q]=C&67108863;for(;ie!==0&&Q<X.length;Q++)C=(X.words[Q]|0)+ie,ie=C>>26,this.words[Q]=C&67108863;if(ie===0&&Q<X.length&&X!==this)for(;Q<X.length;Q++)this.words[Q]=X.words[Q];return this.length=Math.max(this.length,Q),X!==this&&(this.negative=1),this._strip()},E.prototype.sub=function(S){return this.clone().isub(S)};function te(U,S,C){C.negative=S.negative^U.negative;var F=U.length+S.length|0;C.length=F,F=F-1|0;var X=U.words[0]|0,re=S.words[0]|0,ie=X*re,Q=ie&67108863,ne=ie/67108864|0;C.words[0]=Q;for(var L=1;L<F;L++){for(var ue=ne>>>26,Ae=ne&67108863,Re=Math.min(L,S.length-1),Pe=Math.max(0,L-U.length+1);Pe<=Re;Pe++){var xe=L-Pe|0;X=U.words[xe]|0,re=S.words[Pe]|0,ie=X*re+Ae,ue+=ie/67108864|0,Ae=ie&67108863}C.words[L]=Ae|0,ne=ue|0}return ne!==0?C.words[L]=ne|0:C.length--,C._strip()}var se=function(S,C,F){var X=S.words,re=C.words,ie=F.words,Q=0,ne,L,ue,Ae=X[0]|0,Re=Ae&8191,Pe=Ae>>>13,xe=X[1]|0,ge=xe&8191,_e=xe>>>13,ke=X[2]|0,Ee=ke&8191,Se=ke>>>13,Oe=X[3]|0,Ne=Oe&8191,ve=Oe>>>13,Ce=X[4]|0,Te=Ce&8191,Le=Ce>>>13,Be=X[5]|0,De=Be&8191,Ke=Be>>>13,We=X[6]|0,Qe=We&8191,Xe=We>>>13,at=X[7]|0,Fe=at&8191,qe=at>>>13,$e=X[8]|0,Ie=$e&8191,we=$e>>>13,me=X[9]|0,ye=me&8191,Me=me>>>13,je=re[0]|0,He=je&8191,Ue=je>>>13,rt=re[1]|0,it=rt&8191,tt=rt>>>13,mt=re[2]|0,st=mt&8191,lt=mt>>>13,Ct=re[3]|0,St=Ct&8191,dt=Ct>>>13,Ot=re[4]|0,xt=Ot&8191,ht=Ot>>>13,Nt=re[5]|0,wt=Nt&8191,ct=Nt>>>13,Rt=re[6]|0,gt=Rt&8191,pt=Rt>>>13,Tt=re[7]|0,yt=Tt&8191,ut=Tt>>>13,Mt=re[8]|0,_t=Mt&8191,ot=Mt>>>13,It=re[9]|0,Et=It&8191,At=It>>>13;F.negative=S.negative^C.negative,F.length=19,ne=Math.imul(Re,He),L=Math.imul(Re,Ue),L=L+Math.imul(Pe,He)|0,ue=Math.imul(Pe,Ue);var Gt=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,ne=Math.imul(ge,He),L=Math.imul(ge,Ue),L=L+Math.imul(_e,He)|0,ue=Math.imul(_e,Ue),ne=ne+Math.imul(Re,it)|0,L=L+Math.imul(Re,tt)|0,L=L+Math.imul(Pe,it)|0,ue=ue+Math.imul(Pe,tt)|0;var Ut=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,ne=Math.imul(Ee,He),L=Math.imul(Ee,Ue),L=L+Math.imul(Se,He)|0,ue=Math.imul(Se,Ue),ne=ne+Math.imul(ge,it)|0,L=L+Math.imul(ge,tt)|0,L=L+Math.imul(_e,it)|0,ue=ue+Math.imul(_e,tt)|0,ne=ne+Math.imul(Re,st)|0,L=L+Math.imul(Re,lt)|0,L=L+Math.imul(Pe,st)|0,ue=ue+Math.imul(Pe,lt)|0;var jt=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(jt>>>26)|0,jt&=67108863,ne=Math.imul(Ne,He),L=Math.imul(Ne,Ue),L=L+Math.imul(ve,He)|0,ue=Math.imul(ve,Ue),ne=ne+Math.imul(Ee,it)|0,L=L+Math.imul(Ee,tt)|0,L=L+Math.imul(Se,it)|0,ue=ue+Math.imul(Se,tt)|0,ne=ne+Math.imul(ge,st)|0,L=L+Math.imul(ge,lt)|0,L=L+Math.imul(_e,st)|0,ue=ue+Math.imul(_e,lt)|0,ne=ne+Math.imul(Re,St)|0,L=L+Math.imul(Re,dt)|0,L=L+Math.imul(Pe,St)|0,ue=ue+Math.imul(Pe,dt)|0;var Ft=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,ne=Math.imul(Te,He),L=Math.imul(Te,Ue),L=L+Math.imul(Le,He)|0,ue=Math.imul(Le,Ue),ne=ne+Math.imul(Ne,it)|0,L=L+Math.imul(Ne,tt)|0,L=L+Math.imul(ve,it)|0,ue=ue+Math.imul(ve,tt)|0,ne=ne+Math.imul(Ee,st)|0,L=L+Math.imul(Ee,lt)|0,L=L+Math.imul(Se,st)|0,ue=ue+Math.imul(Se,lt)|0,ne=ne+Math.imul(ge,St)|0,L=L+Math.imul(ge,dt)|0,L=L+Math.imul(_e,St)|0,ue=ue+Math.imul(_e,dt)|0,ne=ne+Math.imul(Re,xt)|0,L=L+Math.imul(Re,ht)|0,L=L+Math.imul(Pe,xt)|0,ue=ue+Math.imul(Pe,ht)|0;var Ht=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,ne=Math.imul(De,He),L=Math.imul(De,Ue),L=L+Math.imul(Ke,He)|0,ue=Math.imul(Ke,Ue),ne=ne+Math.imul(Te,it)|0,L=L+Math.imul(Te,tt)|0,L=L+Math.imul(Le,it)|0,ue=ue+Math.imul(Le,tt)|0,ne=ne+Math.imul(Ne,st)|0,L=L+Math.imul(Ne,lt)|0,L=L+Math.imul(ve,st)|0,ue=ue+Math.imul(ve,lt)|0,ne=ne+Math.imul(Ee,St)|0,L=L+Math.imul(Ee,dt)|0,L=L+Math.imul(Se,St)|0,ue=ue+Math.imul(Se,dt)|0,ne=ne+Math.imul(ge,xt)|0,L=L+Math.imul(ge,ht)|0,L=L+Math.imul(_e,xt)|0,ue=ue+Math.imul(_e,ht)|0,ne=ne+Math.imul(Re,wt)|0,L=L+Math.imul(Re,ct)|0,L=L+Math.imul(Pe,wt)|0,ue=ue+Math.imul(Pe,ct)|0;var Ge=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,ne=Math.imul(Qe,He),L=Math.imul(Qe,Ue),L=L+Math.imul(Xe,He)|0,ue=Math.imul(Xe,Ue),ne=ne+Math.imul(De,it)|0,L=L+Math.imul(De,tt)|0,L=L+Math.imul(Ke,it)|0,ue=ue+Math.imul(Ke,tt)|0,ne=ne+Math.imul(Te,st)|0,L=L+Math.imul(Te,lt)|0,L=L+Math.imul(Le,st)|0,ue=ue+Math.imul(Le,lt)|0,ne=ne+Math.imul(Ne,St)|0,L=L+Math.imul(Ne,dt)|0,L=L+Math.imul(ve,St)|0,ue=ue+Math.imul(ve,dt)|0,ne=ne+Math.imul(Ee,xt)|0,L=L+Math.imul(Ee,ht)|0,L=L+Math.imul(Se,xt)|0,ue=ue+Math.imul(Se,ht)|0,ne=ne+Math.imul(ge,wt)|0,L=L+Math.imul(ge,ct)|0,L=L+Math.imul(_e,wt)|0,ue=ue+Math.imul(_e,ct)|0,ne=ne+Math.imul(Re,gt)|0,L=L+Math.imul(Re,pt)|0,L=L+Math.imul(Pe,gt)|0,ue=ue+Math.imul(Pe,pt)|0;var ze=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(ze>>>26)|0,ze&=67108863,ne=Math.imul(Fe,He),L=Math.imul(Fe,Ue),L=L+Math.imul(qe,He)|0,ue=Math.imul(qe,Ue),ne=ne+Math.imul(Qe,it)|0,L=L+Math.imul(Qe,tt)|0,L=L+Math.imul(Xe,it)|0,ue=ue+Math.imul(Xe,tt)|0,ne=ne+Math.imul(De,st)|0,L=L+Math.imul(De,lt)|0,L=L+Math.imul(Ke,st)|0,ue=ue+Math.imul(Ke,lt)|0,ne=ne+Math.imul(Te,St)|0,L=L+Math.imul(Te,dt)|0,L=L+Math.imul(Le,St)|0,ue=ue+Math.imul(Le,dt)|0,ne=ne+Math.imul(Ne,xt)|0,L=L+Math.imul(Ne,ht)|0,L=L+Math.imul(ve,xt)|0,ue=ue+Math.imul(ve,ht)|0,ne=ne+Math.imul(Ee,wt)|0,L=L+Math.imul(Ee,ct)|0,L=L+Math.imul(Se,wt)|0,ue=ue+Math.imul(Se,ct)|0,ne=ne+Math.imul(ge,gt)|0,L=L+Math.imul(ge,pt)|0,L=L+Math.imul(_e,gt)|0,ue=ue+Math.imul(_e,pt)|0,ne=ne+Math.imul(Re,yt)|0,L=L+Math.imul(Re,ut)|0,L=L+Math.imul(Pe,yt)|0,ue=ue+Math.imul(Pe,ut)|0;var Ve=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Ve>>>26)|0,Ve&=67108863,ne=Math.imul(Ie,He),L=Math.imul(Ie,Ue),L=L+Math.imul(we,He)|0,ue=Math.imul(we,Ue),ne=ne+Math.imul(Fe,it)|0,L=L+Math.imul(Fe,tt)|0,L=L+Math.imul(qe,it)|0,ue=ue+Math.imul(qe,tt)|0,ne=ne+Math.imul(Qe,st)|0,L=L+Math.imul(Qe,lt)|0,L=L+Math.imul(Xe,st)|0,ue=ue+Math.imul(Xe,lt)|0,ne=ne+Math.imul(De,St)|0,L=L+Math.imul(De,dt)|0,L=L+Math.imul(Ke,St)|0,ue=ue+Math.imul(Ke,dt)|0,ne=ne+Math.imul(Te,xt)|0,L=L+Math.imul(Te,ht)|0,L=L+Math.imul(Le,xt)|0,ue=ue+Math.imul(Le,ht)|0,ne=ne+Math.imul(Ne,wt)|0,L=L+Math.imul(Ne,ct)|0,L=L+Math.imul(ve,wt)|0,ue=ue+Math.imul(ve,ct)|0,ne=ne+Math.imul(Ee,gt)|0,L=L+Math.imul(Ee,pt)|0,L=L+Math.imul(Se,gt)|0,ue=ue+Math.imul(Se,pt)|0,ne=ne+Math.imul(ge,yt)|0,L=L+Math.imul(ge,ut)|0,L=L+Math.imul(_e,yt)|0,ue=ue+Math.imul(_e,ut)|0,ne=ne+Math.imul(Re,_t)|0,L=L+Math.imul(Re,ot)|0,L=L+Math.imul(Pe,_t)|0,ue=ue+Math.imul(Pe,ot)|0;var Ze=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Ze>>>26)|0,Ze&=67108863,ne=Math.imul(ye,He),L=Math.imul(ye,Ue),L=L+Math.imul(Me,He)|0,ue=Math.imul(Me,Ue),ne=ne+Math.imul(Ie,it)|0,L=L+Math.imul(Ie,tt)|0,L=L+Math.imul(we,it)|0,ue=ue+Math.imul(we,tt)|0,ne=ne+Math.imul(Fe,st)|0,L=L+Math.imul(Fe,lt)|0,L=L+Math.imul(qe,st)|0,ue=ue+Math.imul(qe,lt)|0,ne=ne+Math.imul(Qe,St)|0,L=L+Math.imul(Qe,dt)|0,L=L+Math.imul(Xe,St)|0,ue=ue+Math.imul(Xe,dt)|0,ne=ne+Math.imul(De,xt)|0,L=L+Math.imul(De,ht)|0,L=L+Math.imul(Ke,xt)|0,ue=ue+Math.imul(Ke,ht)|0,ne=ne+Math.imul(Te,wt)|0,L=L+Math.imul(Te,ct)|0,L=L+Math.imul(Le,wt)|0,ue=ue+Math.imul(Le,ct)|0,ne=ne+Math.imul(Ne,gt)|0,L=L+Math.imul(Ne,pt)|0,L=L+Math.imul(ve,gt)|0,ue=ue+Math.imul(ve,pt)|0,ne=ne+Math.imul(Ee,yt)|0,L=L+Math.imul(Ee,ut)|0,L=L+Math.imul(Se,yt)|0,ue=ue+Math.imul(Se,ut)|0,ne=ne+Math.imul(ge,_t)|0,L=L+Math.imul(ge,ot)|0,L=L+Math.imul(_e,_t)|0,ue=ue+Math.imul(_e,ot)|0,ne=ne+Math.imul(Re,Et)|0,L=L+Math.imul(Re,At)|0,L=L+Math.imul(Pe,Et)|0,ue=ue+Math.imul(Pe,At)|0;var Je=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Je>>>26)|0,Je&=67108863,ne=Math.imul(ye,it),L=Math.imul(ye,tt),L=L+Math.imul(Me,it)|0,ue=Math.imul(Me,tt),ne=ne+Math.imul(Ie,st)|0,L=L+Math.imul(Ie,lt)|0,L=L+Math.imul(we,st)|0,ue=ue+Math.imul(we,lt)|0,ne=ne+Math.imul(Fe,St)|0,L=L+Math.imul(Fe,dt)|0,L=L+Math.imul(qe,St)|0,ue=ue+Math.imul(qe,dt)|0,ne=ne+Math.imul(Qe,xt)|0,L=L+Math.imul(Qe,ht)|0,L=L+Math.imul(Xe,xt)|0,ue=ue+Math.imul(Xe,ht)|0,ne=ne+Math.imul(De,wt)|0,L=L+Math.imul(De,ct)|0,L=L+Math.imul(Ke,wt)|0,ue=ue+Math.imul(Ke,ct)|0,ne=ne+Math.imul(Te,gt)|0,L=L+Math.imul(Te,pt)|0,L=L+Math.imul(Le,gt)|0,ue=ue+Math.imul(Le,pt)|0,ne=ne+Math.imul(Ne,yt)|0,L=L+Math.imul(Ne,ut)|0,L=L+Math.imul(ve,yt)|0,ue=ue+Math.imul(ve,ut)|0,ne=ne+Math.imul(Ee,_t)|0,L=L+Math.imul(Ee,ot)|0,L=L+Math.imul(Se,_t)|0,ue=ue+Math.imul(Se,ot)|0,ne=ne+Math.imul(ge,Et)|0,L=L+Math.imul(ge,At)|0,L=L+Math.imul(_e,Et)|0,ue=ue+Math.imul(_e,At)|0;var Ye=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Ye>>>26)|0,Ye&=67108863,ne=Math.imul(ye,st),L=Math.imul(ye,lt),L=L+Math.imul(Me,st)|0,ue=Math.imul(Me,lt),ne=ne+Math.imul(Ie,St)|0,L=L+Math.imul(Ie,dt)|0,L=L+Math.imul(we,St)|0,ue=ue+Math.imul(we,dt)|0,ne=ne+Math.imul(Fe,xt)|0,L=L+Math.imul(Fe,ht)|0,L=L+Math.imul(qe,xt)|0,ue=ue+Math.imul(qe,ht)|0,ne=ne+Math.imul(Qe,wt)|0,L=L+Math.imul(Qe,ct)|0,L=L+Math.imul(Xe,wt)|0,ue=ue+Math.imul(Xe,ct)|0,ne=ne+Math.imul(De,gt)|0,L=L+Math.imul(De,pt)|0,L=L+Math.imul(Ke,gt)|0,ue=ue+Math.imul(Ke,pt)|0,ne=ne+Math.imul(Te,yt)|0,L=L+Math.imul(Te,ut)|0,L=L+Math.imul(Le,yt)|0,ue=ue+Math.imul(Le,ut)|0,ne=ne+Math.imul(Ne,_t)|0,L=L+Math.imul(Ne,ot)|0,L=L+Math.imul(ve,_t)|0,ue=ue+Math.imul(ve,ot)|0,ne=ne+Math.imul(Ee,Et)|0,L=L+Math.imul(Ee,At)|0,L=L+Math.imul(Se,Et)|0,ue=ue+Math.imul(Se,At)|0;var et=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(et>>>26)|0,et&=67108863,ne=Math.imul(ye,St),L=Math.imul(ye,dt),L=L+Math.imul(Me,St)|0,ue=Math.imul(Me,dt),ne=ne+Math.imul(Ie,xt)|0,L=L+Math.imul(Ie,ht)|0,L=L+Math.imul(we,xt)|0,ue=ue+Math.imul(we,ht)|0,ne=ne+Math.imul(Fe,wt)|0,L=L+Math.imul(Fe,ct)|0,L=L+Math.imul(qe,wt)|0,ue=ue+Math.imul(qe,ct)|0,ne=ne+Math.imul(Qe,gt)|0,L=L+Math.imul(Qe,pt)|0,L=L+Math.imul(Xe,gt)|0,ue=ue+Math.imul(Xe,pt)|0,ne=ne+Math.imul(De,yt)|0,L=L+Math.imul(De,ut)|0,L=L+Math.imul(Ke,yt)|0,ue=ue+Math.imul(Ke,ut)|0,ne=ne+Math.imul(Te,_t)|0,L=L+Math.imul(Te,ot)|0,L=L+Math.imul(Le,_t)|0,ue=ue+Math.imul(Le,ot)|0,ne=ne+Math.imul(Ne,Et)|0,L=L+Math.imul(Ne,At)|0,L=L+Math.imul(ve,Et)|0,ue=ue+Math.imul(ve,At)|0;var nt=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(nt>>>26)|0,nt&=67108863,ne=Math.imul(ye,xt),L=Math.imul(ye,ht),L=L+Math.imul(Me,xt)|0,ue=Math.imul(Me,ht),ne=ne+Math.imul(Ie,wt)|0,L=L+Math.imul(Ie,ct)|0,L=L+Math.imul(we,wt)|0,ue=ue+Math.imul(we,ct)|0,ne=ne+Math.imul(Fe,gt)|0,L=L+Math.imul(Fe,pt)|0,L=L+Math.imul(qe,gt)|0,ue=ue+Math.imul(qe,pt)|0,ne=ne+Math.imul(Qe,yt)|0,L=L+Math.imul(Qe,ut)|0,L=L+Math.imul(Xe,yt)|0,ue=ue+Math.imul(Xe,ut)|0,ne=ne+Math.imul(De,_t)|0,L=L+Math.imul(De,ot)|0,L=L+Math.imul(Ke,_t)|0,ue=ue+Math.imul(Ke,ot)|0,ne=ne+Math.imul(Te,Et)|0,L=L+Math.imul(Te,At)|0,L=L+Math.imul(Le,Et)|0,ue=ue+Math.imul(Le,At)|0;var vt=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(vt>>>26)|0,vt&=67108863,ne=Math.imul(ye,wt),L=Math.imul(ye,ct),L=L+Math.imul(Me,wt)|0,ue=Math.imul(Me,ct),ne=ne+Math.imul(Ie,gt)|0,L=L+Math.imul(Ie,pt)|0,L=L+Math.imul(we,gt)|0,ue=ue+Math.imul(we,pt)|0,ne=ne+Math.imul(Fe,yt)|0,L=L+Math.imul(Fe,ut)|0,L=L+Math.imul(qe,yt)|0,ue=ue+Math.imul(qe,ut)|0,ne=ne+Math.imul(Qe,_t)|0,L=L+Math.imul(Qe,ot)|0,L=L+Math.imul(Xe,_t)|0,ue=ue+Math.imul(Xe,ot)|0,ne=ne+Math.imul(De,Et)|0,L=L+Math.imul(De,At)|0,L=L+Math.imul(Ke,Et)|0,ue=ue+Math.imul(Ke,At)|0;var kt=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(kt>>>26)|0,kt&=67108863,ne=Math.imul(ye,gt),L=Math.imul(ye,pt),L=L+Math.imul(Me,gt)|0,ue=Math.imul(Me,pt),ne=ne+Math.imul(Ie,yt)|0,L=L+Math.imul(Ie,ut)|0,L=L+Math.imul(we,yt)|0,ue=ue+Math.imul(we,ut)|0,ne=ne+Math.imul(Fe,_t)|0,L=L+Math.imul(Fe,ot)|0,L=L+Math.imul(qe,_t)|0,ue=ue+Math.imul(qe,ot)|0,ne=ne+Math.imul(Qe,Et)|0,L=L+Math.imul(Qe,At)|0,L=L+Math.imul(Xe,Et)|0,ue=ue+Math.imul(Xe,At)|0;var bt=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(bt>>>26)|0,bt&=67108863,ne=Math.imul(ye,yt),L=Math.imul(ye,ut),L=L+Math.imul(Me,yt)|0,ue=Math.imul(Me,ut),ne=ne+Math.imul(Ie,_t)|0,L=L+Math.imul(Ie,ot)|0,L=L+Math.imul(we,_t)|0,ue=ue+Math.imul(we,ot)|0,ne=ne+Math.imul(Fe,Et)|0,L=L+Math.imul(Fe,At)|0,L=L+Math.imul(qe,Et)|0,ue=ue+Math.imul(qe,At)|0;var Bt=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,ne=Math.imul(ye,_t),L=Math.imul(ye,ot),L=L+Math.imul(Me,_t)|0,ue=Math.imul(Me,ot),ne=ne+Math.imul(Ie,Et)|0,L=L+Math.imul(Ie,At)|0,L=L+Math.imul(we,Et)|0,ue=ue+Math.imul(we,At)|0;var Pt=(Q+ne|0)+((L&8191)<<13)|0;Q=(ue+(L>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,ne=Math.imul(ye,Et),L=Math.imul(ye,At),L=L+Math.imul(Me,Et)|0,ue=Math.imul(Me,At);var $t=(Q+ne|0)+((L&8191)<<13)|0;return Q=(ue+(L>>>13)|0)+($t>>>26)|0,$t&=67108863,ie[0]=Gt,ie[1]=Ut,ie[2]=jt,ie[3]=Ft,ie[4]=Ht,ie[5]=Ge,ie[6]=ze,ie[7]=Ve,ie[8]=Ze,ie[9]=Je,ie[10]=Ye,ie[11]=et,ie[12]=nt,ie[13]=vt,ie[14]=kt,ie[15]=bt,ie[16]=Bt,ie[17]=Pt,ie[18]=$t,Q!==0&&(ie[19]=Q,F.length++),F};Math.imul||(se=te);function ce(U,S,C){C.negative=S.negative^U.negative,C.length=U.length+S.length;for(var F=0,X=0,re=0;re<C.length-1;re++){var ie=X;X=0;for(var Q=F&67108863,ne=Math.min(re,S.length-1),L=Math.max(0,re-U.length+1);L<=ne;L++){var ue=re-L,Ae=U.words[ue]|0,Re=S.words[L]|0,Pe=Ae*Re,xe=Pe&67108863;ie=ie+(Pe/67108864|0)|0,xe=xe+Q|0,Q=xe&67108863,ie=ie+(xe>>>26)|0,X+=ie>>>26,ie&=67108863}C.words[re]=Q,F=ie,ie=X}return F!==0?C.words[re]=F:C.length--,C._strip()}function ae(U,S,C){return ce(U,S,C)}E.prototype.mulTo=function(S,C){var F,X=this.length+S.length;return this.length===10&&S.length===10?F=se(this,S,C):X<63?F=te(this,S,C):X<1024?F=ce(this,S,C):F=ae(this,S,C),F},E.prototype.mul=function(S){var C=new E(null);return C.words=new Array(this.length+S.length),this.mulTo(S,C)},E.prototype.mulf=function(S){var C=new E(null);return C.words=new Array(this.length+S.length),ae(this,S,C)},E.prototype.imul=function(S){return this.clone().mulTo(S,this)},E.prototype.imuln=function(S){var C=S<0;C&&(S=-S),_(typeof S=="number"),_(S<67108864);for(var F=0,X=0;X<this.length;X++){var re=(this.words[X]|0)*S,ie=(re&67108863)+(F&67108863);F>>=26,F+=re/67108864|0,F+=ie>>>26,this.words[X]=ie&67108863}return F!==0&&(this.words[X]=F,this.length++),C?this.ineg():this},E.prototype.muln=function(S){return this.clone().imuln(S)},E.prototype.sqr=function(){return this.mul(this)},E.prototype.isqr=function(){return this.imul(this.clone())},E.prototype.pow=function(S){var C=J(S);if(C.length===0)return new E(1);for(var F=this,X=0;X<C.length&&C[X]===0;X++,F=F.sqr());if(++X<C.length)for(var re=F.sqr();X<C.length;X++,re=re.sqr())C[X]!==0&&(F=F.mul(re));return F},E.prototype.iushln=function(S){_(typeof S=="number"&&S>=0);var C=S%26,F=(S-C)/26,X=67108863>>>26-C<<26-C,re;if(C!==0){var ie=0;for(re=0;re<this.length;re++){var Q=this.words[re]&X,ne=(this.words[re]|0)-Q<<C;this.words[re]=ne|ie,ie=Q>>>26-C}ie&&(this.words[re]=ie,this.length++)}if(F!==0){for(re=this.length-1;re>=0;re--)this.words[re+F]=this.words[re];for(re=0;re<F;re++)this.words[re]=0;this.length+=F}return this._strip()},E.prototype.ishln=function(S){return _(this.negative===0),this.iushln(S)},E.prototype.iushrn=function(S,C,F){_(typeof S=="number"&&S>=0);var X;C?X=(C-C%26)/26:X=0;var re=S%26,ie=Math.min((S-re)/26,this.length),Q=67108863^67108863>>>re<<re,ne=F;if(X-=ie,X=Math.max(0,X),ne){for(var L=0;L<ie;L++)ne.words[L]=this.words[L];ne.length=ie}if(ie!==0)if(this.length>ie)for(this.length-=ie,L=0;L<this.length;L++)this.words[L]=this.words[L+ie];else this.words[0]=0,this.length=1;var ue=0;for(L=this.length-1;L>=0&&(ue!==0||L>=X);L--){var Ae=this.words[L]|0;this.words[L]=ue<<26-re|Ae>>>re,ue=Ae&Q}return ne&&ue!==0&&(ne.words[ne.length++]=ue),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},E.prototype.ishrn=function(S,C,F){return _(this.negative===0),this.iushrn(S,C,F)},E.prototype.shln=function(S){return this.clone().ishln(S)},E.prototype.ushln=function(S){return this.clone().iushln(S)},E.prototype.shrn=function(S){return this.clone().ishrn(S)},E.prototype.ushrn=function(S){return this.clone().iushrn(S)},E.prototype.testn=function(S){_(typeof S=="number"&&S>=0);var C=S%26,F=(S-C)/26,X=1<<C;if(this.length<=F)return!1;var re=this.words[F];return!!(re&X)},E.prototype.imaskn=function(S){_(typeof S=="number"&&S>=0);var C=S%26,F=(S-C)/26;if(_(this.negative===0,"imaskn works only with positive numbers"),this.length<=F)return this;if(C!==0&&F++,this.length=Math.min(F,this.length),C!==0){var X=67108863^67108863>>>C<<C;this.words[this.length-1]&=X}return this._strip()},E.prototype.maskn=function(S){return this.clone().imaskn(S)},E.prototype.iaddn=function(S){return _(typeof S=="number"),_(S<67108864),S<0?this.isubn(-S):this.negative!==0?this.length===1&&(this.words[0]|0)<=S?(this.words[0]=S-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(S),this.negative=1,this):this._iaddn(S)},E.prototype._iaddn=function(S){this.words[0]+=S;for(var C=0;C<this.length&&this.words[C]>=67108864;C++)this.words[C]-=67108864,C===this.length-1?this.words[C+1]=1:this.words[C+1]++;return this.length=Math.max(this.length,C+1),this},E.prototype.isubn=function(S){if(_(typeof S=="number"),_(S<67108864),S<0)return this.iaddn(-S);if(this.negative!==0)return this.negative=0,this.iaddn(S),this.negative=1,this;if(this.words[0]-=S,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var C=0;C<this.length&&this.words[C]<0;C++)this.words[C]+=67108864,this.words[C+1]-=1;return this._strip()},E.prototype.addn=function(S){return this.clone().iaddn(S)},E.prototype.subn=function(S){return this.clone().isubn(S)},E.prototype.iabs=function(){return this.negative=0,this},E.prototype.abs=function(){return this.clone().iabs()},E.prototype._ishlnsubmul=function(S,C,F){var X=S.length+F,re;this._expand(X);var ie,Q=0;for(re=0;re<S.length;re++){ie=(this.words[re+F]|0)+Q;var ne=(S.words[re]|0)*C;ie-=ne&67108863,Q=(ie>>26)-(ne/67108864|0),this.words[re+F]=ie&67108863}for(;re<this.length-F;re++)ie=(this.words[re+F]|0)+Q,Q=ie>>26,this.words[re+F]=ie&67108863;if(Q===0)return this._strip();for(_(Q===-1),Q=0,re=0;re<this.length;re++)ie=-(this.words[re]|0)+Q,Q=ie>>26,this.words[re]=ie&67108863;return this.negative=1,this._strip()},E.prototype._wordDiv=function(S,C){var F=this.length-S.length,X=this.clone(),re=S,ie=re.words[re.length-1]|0,Q=this._countBits(ie);F=26-Q,F!==0&&(re=re.ushln(F),X.iushln(F),ie=re.words[re.length-1]|0);var ne=X.length-re.length,L;if(C!=="mod"){L=new E(null),L.length=ne+1,L.words=new Array(L.length);for(var ue=0;ue<L.length;ue++)L.words[ue]=0}var Ae=X.clone()._ishlnsubmul(re,1,ne);Ae.negative===0&&(X=Ae,L&&(L.words[ne]=1));for(var Re=ne-1;Re>=0;Re--){var Pe=(X.words[re.length+Re]|0)*67108864+(X.words[re.length+Re-1]|0);for(Pe=Math.min(Pe/ie|0,67108863),X._ishlnsubmul(re,Pe,Re);X.negative!==0;)Pe--,X.negative=0,X._ishlnsubmul(re,1,Re),X.isZero()||(X.negative^=1);L&&(L.words[Re]=Pe)}return L&&L._strip(),X._strip(),C!=="div"&&F!==0&&X.iushrn(F),{div:L||null,mod:X}},E.prototype.divmod=function(S,C,F){if(_(!S.isZero()),this.isZero())return{div:new E(0),mod:new E(0)};var X,re,ie;return this.negative!==0&&S.negative===0?(ie=this.neg().divmod(S,C),C!=="mod"&&(X=ie.div.neg()),C!=="div"&&(re=ie.mod.neg(),F&&re.negative!==0&&re.iadd(S)),{div:X,mod:re}):this.negative===0&&S.negative!==0?(ie=this.divmod(S.neg(),C),C!=="mod"&&(X=ie.div.neg()),{div:X,mod:ie.mod}):this.negative&S.negative?(ie=this.neg().divmod(S.neg(),C),C!=="div"&&(re=ie.mod.neg(),F&&re.negative!==0&&re.isub(S)),{div:ie.div,mod:re}):S.length>this.length||this.cmp(S)<0?{div:new E(0),mod:this}:S.length===1?C==="div"?{div:this.divn(S.words[0]),mod:null}:C==="mod"?{div:null,mod:new E(this.modrn(S.words[0]))}:{div:this.divn(S.words[0]),mod:new E(this.modrn(S.words[0]))}:this._wordDiv(S,C)},E.prototype.div=function(S){return this.divmod(S,"div",!1).div},E.prototype.mod=function(S){return this.divmod(S,"mod",!1).mod},E.prototype.umod=function(S){return this.divmod(S,"mod",!0).mod},E.prototype.divRound=function(S){var C=this.divmod(S);if(C.mod.isZero())return C.div;var F=C.div.negative!==0?C.mod.isub(S):C.mod,X=S.ushrn(1),re=S.andln(1),ie=F.cmp(X);return ie<0||re===1&&ie===0?C.div:C.div.negative!==0?C.div.isubn(1):C.div.iaddn(1)},E.prototype.modrn=function(S){var C=S<0;C&&(S=-S),_(S<=67108863);for(var F=(1<<26)%S,X=0,re=this.length-1;re>=0;re--)X=(F*X+(this.words[re]|0))%S;return C?-X:X},E.prototype.modn=function(S){return this.modrn(S)},E.prototype.idivn=function(S){var C=S<0;C&&(S=-S),_(S<=67108863);for(var F=0,X=this.length-1;X>=0;X--){var re=(this.words[X]|0)+F*67108864;this.words[X]=re/S|0,F=re%S}return this._strip(),C?this.ineg():this},E.prototype.divn=function(S){return this.clone().idivn(S)},E.prototype.egcd=function(S){_(S.negative===0),_(!S.isZero());var C=this,F=S.clone();C.negative!==0?C=C.umod(S):C=C.clone();for(var X=new E(1),re=new E(0),ie=new E(0),Q=new E(1),ne=0;C.isEven()&&F.isEven();)C.iushrn(1),F.iushrn(1),++ne;for(var L=F.clone(),ue=C.clone();!C.isZero();){for(var Ae=0,Re=1;!(C.words[0]&Re)&&Ae<26;++Ae,Re<<=1);if(Ae>0)for(C.iushrn(Ae);Ae-- >0;)(X.isOdd()||re.isOdd())&&(X.iadd(L),re.isub(ue)),X.iushrn(1),re.iushrn(1);for(var Pe=0,xe=1;!(F.words[0]&xe)&&Pe<26;++Pe,xe<<=1);if(Pe>0)for(F.iushrn(Pe);Pe-- >0;)(ie.isOdd()||Q.isOdd())&&(ie.iadd(L),Q.isub(ue)),ie.iushrn(1),Q.iushrn(1);C.cmp(F)>=0?(C.isub(F),X.isub(ie),re.isub(Q)):(F.isub(C),ie.isub(X),Q.isub(re))}return{a:ie,b:Q,gcd:F.iushln(ne)}},E.prototype._invmp=function(S){_(S.negative===0),_(!S.isZero());var C=this,F=S.clone();C.negative!==0?C=C.umod(S):C=C.clone();for(var X=new E(1),re=new E(0),ie=F.clone();C.cmpn(1)>0&&F.cmpn(1)>0;){for(var Q=0,ne=1;!(C.words[0]&ne)&&Q<26;++Q,ne<<=1);if(Q>0)for(C.iushrn(Q);Q-- >0;)X.isOdd()&&X.iadd(ie),X.iushrn(1);for(var L=0,ue=1;!(F.words[0]&ue)&&L<26;++L,ue<<=1);if(L>0)for(F.iushrn(L);L-- >0;)re.isOdd()&&re.iadd(ie),re.iushrn(1);C.cmp(F)>=0?(C.isub(F),X.isub(re)):(F.isub(C),re.isub(X))}var Ae;return C.cmpn(1)===0?Ae=X:Ae=re,Ae.cmpn(0)<0&&Ae.iadd(S),Ae},E.prototype.gcd=function(S){if(this.isZero())return S.abs();if(S.isZero())return this.abs();var C=this.clone(),F=S.clone();C.negative=0,F.negative=0;for(var X=0;C.isEven()&&F.isEven();X++)C.iushrn(1),F.iushrn(1);do{for(;C.isEven();)C.iushrn(1);for(;F.isEven();)F.iushrn(1);var re=C.cmp(F);if(re<0){var ie=C;C=F,F=ie}else if(re===0||F.cmpn(1)===0)break;C.isub(F)}while(!0);return F.iushln(X)},E.prototype.invm=function(S){return this.egcd(S).a.umod(S)},E.prototype.isEven=function(){return(this.words[0]&1)===0},E.prototype.isOdd=function(){return(this.words[0]&1)===1},E.prototype.andln=function(S){return this.words[0]&S},E.prototype.bincn=function(S){_(typeof S=="number");var C=S%26,F=(S-C)/26,X=1<<C;if(this.length<=F)return this._expand(F+1),this.words[F]|=X,this;for(var re=X,ie=F;re!==0&&ie<this.length;ie++){var Q=this.words[ie]|0;Q+=re,re=Q>>>26,Q&=67108863,this.words[ie]=Q}return re!==0&&(this.words[ie]=re,this.length++),this},E.prototype.isZero=function(){return this.length===1&&this.words[0]===0},E.prototype.cmpn=function(S){var C=S<0;if(this.negative!==0&&!C)return-1;if(this.negative===0&&C)return 1;this._strip();var F;if(this.length>1)F=1;else{C&&(S=-S),_(S<=67108863,"Number is too big");var X=this.words[0]|0;F=X===S?0:X<S?-1:1}return this.negative!==0?-F|0:F},E.prototype.cmp=function(S){if(this.negative!==0&&S.negative===0)return-1;if(this.negative===0&&S.negative!==0)return 1;var C=this.ucmp(S);return this.negative!==0?-C|0:C},E.prototype.ucmp=function(S){if(this.length>S.length)return 1;if(this.length<S.length)return-1;for(var C=0,F=this.length-1;F>=0;F--){var X=this.words[F]|0,re=S.words[F]|0;if(X!==re){X<re?C=-1:X>re&&(C=1);break}}return C},E.prototype.gtn=function(S){return this.cmpn(S)===1},E.prototype.gt=function(S){return this.cmp(S)===1},E.prototype.gten=function(S){return this.cmpn(S)>=0},E.prototype.gte=function(S){return this.cmp(S)>=0},E.prototype.ltn=function(S){return this.cmpn(S)===-1},E.prototype.lt=function(S){return this.cmp(S)===-1},E.prototype.lten=function(S){return this.cmpn(S)<=0},E.prototype.lte=function(S){return this.cmp(S)<=0},E.prototype.eqn=function(S){return this.cmpn(S)===0},E.prototype.eq=function(S){return this.cmp(S)===0},E.red=function(S){return new fe(S)},E.prototype.toRed=function(S){return _(!this.red,"Already a number in reduction context"),_(this.negative===0,"red works only with positives"),S.convertTo(this)._forceRed(S)},E.prototype.fromRed=function(){return _(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},E.prototype._forceRed=function(S){return this.red=S,this},E.prototype.forceRed=function(S){return _(!this.red,"Already a number in reduction context"),this._forceRed(S)},E.prototype.redAdd=function(S){return _(this.red,"redAdd works only with red numbers"),this.red.add(this,S)},E.prototype.redIAdd=function(S){return _(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,S)},E.prototype.redSub=function(S){return _(this.red,"redSub works only with red numbers"),this.red.sub(this,S)},E.prototype.redISub=function(S){return _(this.red,"redISub works only with red numbers"),this.red.isub(this,S)},E.prototype.redShl=function(S){return _(this.red,"redShl works only with red numbers"),this.red.shl(this,S)},E.prototype.redMul=function(S){return _(this.red,"redMul works only with red numbers"),this.red._verify2(this,S),this.red.mul(this,S)},E.prototype.redIMul=function(S){return _(this.red,"redMul works only with red numbers"),this.red._verify2(this,S),this.red.imul(this,S)},E.prototype.redSqr=function(){return _(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},E.prototype.redISqr=function(){return _(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},E.prototype.redSqrt=function(){return _(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},E.prototype.redInvm=function(){return _(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},E.prototype.redNeg=function(){return _(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},E.prototype.redPow=function(S){return _(this.red&&!S.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,S)};var he={k256:null,p224:null,p192:null,p25519:null};function oe(U,S){this.name=U,this.p=new E(S,16),this.n=this.p.bitLength(),this.k=new E(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}oe.prototype._tmp=function(){var S=new E(null);return S.words=new Array(Math.ceil(this.n/13)),S},oe.prototype.ireduce=function(S){var C=S,F;do this.split(C,this.tmp),C=this.imulK(C),C=C.iadd(this.tmp),F=C.bitLength();while(F>this.n);var X=F<this.n?-1:C.ucmp(this.p);return X===0?(C.words[0]=0,C.length=1):X>0?C.isub(this.p):C.strip!==void 0?C.strip():C._strip(),C},oe.prototype.split=function(S,C){S.iushrn(this.n,0,C)},oe.prototype.imulK=function(S){return S.imul(this.k)};function de(){oe.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}A(de,oe),de.prototype.split=function(S,C){for(var F=4194303,X=Math.min(S.length,9),re=0;re<X;re++)C.words[re]=S.words[re];if(C.length=X,S.length<=9){S.words[0]=0,S.length=1;return}var ie=S.words[9];for(C.words[C.length++]=ie&F,re=10;re<S.length;re++){var Q=S.words[re]|0;S.words[re-10]=(Q&F)<<4|ie>>>22,ie=Q}ie>>>=22,S.words[re-10]=ie,ie===0&&S.length>10?S.length-=10:S.length-=9},de.prototype.imulK=function(S){S.words[S.length]=0,S.words[S.length+1]=0,S.length+=2;for(var C=0,F=0;F<S.length;F++){var X=S.words[F]|0;C+=X*977,S.words[F]=C&67108863,C=X*64+(C/67108864|0)}return S.words[S.length-1]===0&&(S.length--,S.words[S.length-1]===0&&S.length--),S};function le(){oe.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}A(le,oe);function be(){oe.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}A(be,oe);function pe(){oe.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}A(pe,oe),pe.prototype.imulK=function(S){for(var C=0,F=0;F<S.length;F++){var X=(S.words[F]|0)*19+C,re=X&67108863;X>>>=26,S.words[F]=re,C=X}return C!==0&&(S.words[S.length++]=C),S},E._prime=function(S){if(he[S])return he[S];var C;if(S==="k256")C=new de;else if(S==="p224")C=new le;else if(S==="p192")C=new be;else if(S==="p25519")C=new pe;else throw new Error("Unknown prime "+S);return he[S]=C,C};function fe(U){if(typeof U=="string"){var S=E._prime(U);this.m=S.p,this.prime=S}else _(U.gtn(1),"modulus must be greater than 1"),this.m=U,this.prime=null}fe.prototype._verify1=function(S){_(S.negative===0,"red works only with positives"),_(S.red,"red works only with red numbers")},fe.prototype._verify2=function(S,C){_((S.negative|C.negative)===0,"red works only with positives"),_(S.red&&S.red===C.red,"red works only with red numbers")},fe.prototype.imod=function(S){return this.prime?this.prime.ireduce(S)._forceRed(this):(B(S,S.umod(this.m)._forceRed(this)),S)},fe.prototype.neg=function(S){return S.isZero()?S.clone():this.m.sub(S)._forceRed(this)},fe.prototype.add=function(S,C){this._verify2(S,C);var F=S.add(C);return F.cmp(this.m)>=0&&F.isub(this.m),F._forceRed(this)},fe.prototype.iadd=function(S,C){this._verify2(S,C);var F=S.iadd(C);return F.cmp(this.m)>=0&&F.isub(this.m),F},fe.prototype.sub=function(S,C){this._verify2(S,C);var F=S.sub(C);return F.cmpn(0)<0&&F.iadd(this.m),F._forceRed(this)},fe.prototype.isub=function(S,C){this._verify2(S,C);var F=S.isub(C);return F.cmpn(0)<0&&F.iadd(this.m),F},fe.prototype.shl=function(S,C){return this._verify1(S),this.imod(S.ushln(C))},fe.prototype.imul=function(S,C){return this._verify2(S,C),this.imod(S.imul(C))},fe.prototype.mul=function(S,C){return this._verify2(S,C),this.imod(S.mul(C))},fe.prototype.isqr=function(S){return this.imul(S,S.clone())},fe.prototype.sqr=function(S){return this.mul(S,S)},fe.prototype.sqrt=function(S){if(S.isZero())return S.clone();var C=this.m.andln(3);if(_(C%2===1),C===3){var F=this.m.add(new E(1)).iushrn(2);return this.pow(S,F)}for(var X=this.m.subn(1),re=0;!X.isZero()&&X.andln(1)===0;)re++,X.iushrn(1);_(!X.isZero());var ie=new E(1).toRed(this),Q=ie.redNeg(),ne=this.m.subn(1).iushrn(1),L=this.m.bitLength();for(L=new E(2*L*L).toRed(this);this.pow(L,ne).cmp(Q)!==0;)L.redIAdd(Q);for(var ue=this.pow(L,X),Ae=this.pow(S,X.addn(1).iushrn(1)),Re=this.pow(S,X),Pe=re;Re.cmp(ie)!==0;){for(var xe=Re,ge=0;xe.cmp(ie)!==0;ge++)xe=xe.redSqr();_(ge<Pe);var _e=this.pow(ue,new E(1).iushln(Pe-ge-1));Ae=Ae.redMul(_e),ue=_e.redSqr(),Re=Re.redMul(ue),Pe=ge}return Ae},fe.prototype.invm=function(S){var C=S._invmp(this.m);return C.negative!==0?(C.negative=0,this.imod(C).redNeg()):this.imod(C)},fe.prototype.pow=function(S,C){if(C.isZero())return new E(1).toRed(this);if(C.cmpn(1)===0)return S.clone();var F=4,X=new Array(1<<F);X[0]=new E(1).toRed(this),X[1]=S;for(var re=2;re<X.length;re++)X[re]=this.mul(X[re-1],S);var ie=X[0],Q=0,ne=0,L=C.bitLength()%26;for(L===0&&(L=26),re=C.length-1;re>=0;re--){for(var ue=C.words[re],Ae=L-1;Ae>=0;Ae--){var Re=ue>>Ae&1;if(ie!==X[0]&&(ie=this.sqr(ie)),Re===0&&Q===0){ne=0;continue}Q<<=1,Q|=Re,ne++,!(ne!==F&&(re!==0||Ae!==0))&&(ie=this.mul(ie,X[Q]),ne=0,Q=0)}L=26}return ie},fe.prototype.convertTo=function(S){var C=S.umod(this.m);return C===S?C.clone():C},fe.prototype.convertFrom=function(S){var C=S.clone();return C.red=null,C},E.mont=function(S){return new Z(S)};function Z(U){fe.call(this,U),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new E(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}A(Z,fe),Z.prototype.convertTo=function(S){return this.imod(S.ushln(this.shift))},Z.prototype.convertFrom=function(S){var C=this.imod(S.mul(this.rinv));return C.red=null,C},Z.prototype.imul=function(S,C){if(S.isZero()||C.isZero())return S.words[0]=0,S.length=1,S;var F=S.imul(C),X=F.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),re=F.isub(X).iushrn(this.shift),ie=re;return re.cmp(this.m)>=0?ie=re.isub(this.m):re.cmpn(0)<0&&(ie=re.iadd(this.m)),ie._forceRed(this)},Z.prototype.mul=function(S,C){if(S.isZero()||C.isZero())return new E(0)._forceRed(this);var F=S.mul(C),X=F.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),re=F.isub(X).iushrn(this.shift),ie=re;return re.cmp(this.m)>=0?ie=re.isub(this.m):re.cmpn(0)<0&&(ie=re.iadd(this.m)),ie._forceRed(this)},Z.prototype.invm=function(S){var C=this.imod(S._invmp(this.m).mul(this.r2));return C._forceRed(this)}})(b,commonjsGlobal)})(bn);var bnExports=bn.exports,asn1$3={},asn1$2={},api={},vmBrowserify={},hasRequiredVmBrowserify;function requireVmBrowserify(){return hasRequiredVmBrowserify||(hasRequiredVmBrowserify=1,function(exports){var indexOf=function(b,v){if(b.indexOf)return b.indexOf(v);for(var w=0;w<b.length;w++)if(b[w]===v)return w;return-1},Object_keys=function(b){if(Object.keys)return Object.keys(b);var v=[];for(var w in b)v.push(w);return v},forEach=function(b,v){if(b.forEach)return b.forEach(v);for(var w=0;w<b.length;w++)v(b[w],w,b)},defineProp=function(){try{return Object.defineProperty({},"_",{}),function(b,v,w){Object.defineProperty(b,v,{writable:!0,enumerable:!1,configurable:!0,value:w})}}catch{return function(v,w,_){v[w]=_}}}(),globals=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];function Context(){}Context.prototype={};var Script=exports.Script=function(v){if(!(this instanceof Script))return new Script(v);this.code=v};Script.prototype.runInContext=function(b){if(!(b instanceof Context))throw new TypeError("needs a 'context' argument.");var v=document.createElement("iframe");v.style||(v.style={}),v.style.display="none",document.body.appendChild(v);var w=v.contentWindow,_=w.eval,A=w.execScript;!_&&A&&(A.call(w,"null"),_=w.eval),forEach(Object_keys(b),function(P){w[P]=b[P]}),forEach(globals,function(P){b[P]&&(w[P]=b[P])});var E=Object_keys(w),k=_.call(w,this.code);return forEach(Object_keys(w),function(P){(P in b||indexOf(E,P)===-1)&&(b[P]=w[P])}),forEach(globals,function(P){P in b||defineProp(b,P,w[P])}),document.body.removeChild(v),k},Script.prototype.runInThisContext=function(){return eval(this.code)},Script.prototype.runInNewContext=function(b){var v=Script.createContext(b),w=this.runInContext(v);return b&&forEach(Object_keys(v),function(_){b[_]=v[_]}),w},forEach(Object_keys(Script.prototype),function(b){exports[b]=Script[b]=function(v){var w=Script(v);return w[b].apply(w,[].slice.call(arguments,1))}}),exports.isContext=function(b){return b instanceof Context},exports.createScript=function(b){return exports.Script(b)},exports.createContext=Script.createContext=function(b){var v=new Context;return typeof b=="object"&&forEach(Object_keys(b),function(w){v[w]=b[w]}),v}}(vmBrowserify)),vmBrowserify}var hasRequiredApi;function requireApi(){return hasRequiredApi||(hasRequiredApi=1,function(b){var v=requireAsn1(),w=inherits_browserExports,_=b;_.define=function(k,P){return new A(k,P)};function A(E,k){this.name=E,this.body=k,this.decoders={},this.encoders={}}A.prototype._createNamed=function(k){var P;try{P=requireVmBrowserify().runInThisContext("(function "+this.name+`(entity) {
777
- this._initNamed(entity);
778
- })`)}catch{P=function(q){this._initNamed(q)}}return w(P,k),P.prototype._initNamed=function(q){k.call(this,q)},new P(this)},A.prototype._getDecoder=function(k){return k=k||"der",this.decoders.hasOwnProperty(k)||(this.decoders[k]=this._createNamed(v.decoders[k])),this.decoders[k]},A.prototype.decode=function(k,P,N){return this._getDecoder(P).decode(k,N)},A.prototype._getEncoder=function(k){return k=k||"der",this.encoders.hasOwnProperty(k)||(this.encoders[k]=this._createNamed(v.encoders[k])),this.encoders[k]},A.prototype.encode=function(k,P,N){return this._getEncoder(P).encode(k,N)}}(api)),api}var base$2={},reporter={},inherits=inherits_browserExports;function Reporter(b){this._reporterState={obj:null,path:[],options:b||{},errors:[]}}reporter.Reporter=Reporter;Reporter.prototype.isError=function b(v){return v instanceof ReporterError};Reporter.prototype.save=function b(){var v=this._reporterState;return{obj:v.obj,pathLen:v.path.length}};Reporter.prototype.restore=function b(v){var w=this._reporterState;w.obj=v.obj,w.path=w.path.slice(0,v.pathLen)};Reporter.prototype.enterKey=function b(v){return this._reporterState.path.push(v)};Reporter.prototype.exitKey=function b(v){var w=this._reporterState;w.path=w.path.slice(0,v-1)};Reporter.prototype.leaveKey=function b(v,w,_){var A=this._reporterState;this.exitKey(v),A.obj!==null&&(A.obj[w]=_)};Reporter.prototype.path=function b(){return this._reporterState.path.join("/")};Reporter.prototype.enterObject=function b(){var v=this._reporterState,w=v.obj;return v.obj={},w};Reporter.prototype.leaveObject=function b(v){var w=this._reporterState,_=w.obj;return w.obj=v,_};Reporter.prototype.error=function b(v){var w,_=this._reporterState,A=v instanceof ReporterError;if(A?w=v:w=new ReporterError(_.path.map(function(E){return"["+JSON.stringify(E)+"]"}).join(""),v.message||v,v.stack),!_.options.partial)throw w;return A||_.errors.push(w),w};Reporter.prototype.wrapResult=function b(v){var w=this._reporterState;return w.options.partial?{result:this.isError(v)?null:v,errors:w.errors}:v};function ReporterError(b,v){this.path=b,this.rethrow(v)}inherits(ReporterError,Error);ReporterError.prototype.rethrow=function b(v){if(this.message=v+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,ReporterError),!this.stack)try{throw new Error(this.message)}catch(w){this.stack=w.stack}return this};var buffer={},hasRequiredBuffer;function requireBuffer(){if(hasRequiredBuffer)return buffer;hasRequiredBuffer=1;var b=inherits_browserExports,v=requireBase().Reporter,w=require$$1$2.Buffer;function _(E,k){if(v.call(this,k),!w.isBuffer(E)){this.error("Input not Buffer");return}this.base=E,this.offset=0,this.length=E.length}b(_,v),buffer.DecoderBuffer=_,_.prototype.save=function(){return{offset:this.offset,reporter:v.prototype.save.call(this)}},_.prototype.restore=function(k){var P=new _(this.base);return P.offset=k.offset,P.length=this.offset,this.offset=k.offset,v.prototype.restore.call(this,k.reporter),P},_.prototype.isEmpty=function(){return this.offset===this.length},_.prototype.readUInt8=function(k){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(k||"DecoderBuffer overrun")},_.prototype.skip=function(k,P){if(!(this.offset+k<=this.length))return this.error(P||"DecoderBuffer overrun");var N=new _(this.base);return N._reporterState=this._reporterState,N.offset=this.offset,N.length=this.offset+k,this.offset+=k,N},_.prototype.raw=function(k){return this.base.slice(k?k.offset:this.offset,this.length)};function A(E,k){if(Array.isArray(E))this.length=0,this.value=E.map(function(P){return P instanceof A||(P=new A(P,k)),this.length+=P.length,P},this);else if(typeof E=="number"){if(!(0<=E&&E<=255))return k.error("non-byte EncoderBuffer value");this.value=E,this.length=1}else if(typeof E=="string")this.value=E,this.length=w.byteLength(E);else if(w.isBuffer(E))this.value=E,this.length=E.length;else return k.error("Unsupported type: "+typeof E)}return buffer.EncoderBuffer=A,A.prototype.join=function(k,P){return k||(k=new w(this.length)),P||(P=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(N){N.join(k,P),P+=N.length}):(typeof this.value=="number"?k[P]=this.value:typeof this.value=="string"?k.write(this.value,P):w.isBuffer(this.value)&&this.value.copy(k,P),P+=this.length)),k},buffer}var node,hasRequiredNode;function requireNode(){if(hasRequiredNode)return node;hasRequiredNode=1;var b=requireBase().Reporter,v=requireBase().EncoderBuffer,w=requireBase().DecoderBuffer,_=minimalisticAssert,A=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],E=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(A),k=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function P(q,B){var O={};this._baseState=O,O.enc=q,O.parent=B||null,O.children=null,O.tag=null,O.args=null,O.reverseArgs=null,O.choice=null,O.optional=!1,O.any=!1,O.obj=!1,O.use=null,O.useDecoder=null,O.key=null,O.default=null,O.explicit=null,O.implicit=null,O.contains=null,O.parent||(O.children=[],this._wrap())}node=P;var N=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];return P.prototype.clone=function(){var B=this._baseState,O={};N.forEach(function(D){O[D]=B[D]});var I=new this.constructor(O.parent);return I._baseState=O,I},P.prototype._wrap=function(){var B=this._baseState;E.forEach(function(O){this[O]=function(){var D=new this.constructor(this);return B.children.push(D),D[O].apply(D,arguments)}},this)},P.prototype._init=function(B){var O=this._baseState;_(O.parent===null),B.call(this),O.children=O.children.filter(function(I){return I._baseState.parent===this},this),_.equal(O.children.length,1,"Root node can have only one child")},P.prototype._useArgs=function(B){var O=this._baseState,I=B.filter(function(D){return D instanceof this.constructor},this);B=B.filter(function(D){return!(D instanceof this.constructor)},this),I.length!==0&&(_(O.children===null),O.children=I,I.forEach(function(D){D._baseState.parent=this},this)),B.length!==0&&(_(O.args===null),O.args=B,O.reverseArgs=B.map(function(D){if(typeof D!="object"||D.constructor!==Object)return D;var V={};return Object.keys(D).forEach(function(ee){ee==(ee|0)&&(ee|=0);var J=D[ee];V[J]=ee}),V}))},k.forEach(function(q){P.prototype[q]=function(){var O=this._baseState;throw new Error(q+" not implemented for encoding: "+O.enc)}}),A.forEach(function(q){P.prototype[q]=function(){var O=this._baseState,I=Array.prototype.slice.call(arguments);return _(O.tag===null),O.tag=q,this._useArgs(I),this}}),P.prototype.use=function(B){_(B);var O=this._baseState;return _(O.use===null),O.use=B,this},P.prototype.optional=function(){var B=this._baseState;return B.optional=!0,this},P.prototype.def=function(B){var O=this._baseState;return _(O.default===null),O.default=B,O.optional=!0,this},P.prototype.explicit=function(B){var O=this._baseState;return _(O.explicit===null&&O.implicit===null),O.explicit=B,this},P.prototype.implicit=function(B){var O=this._baseState;return _(O.explicit===null&&O.implicit===null),O.implicit=B,this},P.prototype.obj=function(){var B=this._baseState,O=Array.prototype.slice.call(arguments);return B.obj=!0,O.length!==0&&this._useArgs(O),this},P.prototype.key=function(B){var O=this._baseState;return _(O.key===null),O.key=B,this},P.prototype.any=function(){var B=this._baseState;return B.any=!0,this},P.prototype.choice=function(B){var O=this._baseState;return _(O.choice===null),O.choice=B,this._useArgs(Object.keys(B).map(function(I){return B[I]})),this},P.prototype.contains=function(B){var O=this._baseState;return _(O.use===null),O.contains=B,this},P.prototype._decode=function(B,O){var I=this._baseState;if(I.parent===null)return B.wrapResult(I.children[0]._decode(B,O));var D=I.default,V=!0,ee=null;if(I.key!==null&&(ee=B.enterKey(I.key)),I.optional){var J=null;if(I.explicit!==null?J=I.explicit:I.implicit!==null?J=I.implicit:I.tag!==null&&(J=I.tag),J===null&&!I.any){var te=B.save();try{I.choice===null?this._decodeGeneric(I.tag,B,O):this._decodeChoice(B,O),V=!0}catch{V=!1}B.restore(te)}else if(V=this._peekTag(B,J,I.any),B.isError(V))return V}var se;if(I.obj&&V&&(se=B.enterObject()),V){if(I.explicit!==null){var ce=this._decodeTag(B,I.explicit);if(B.isError(ce))return ce;B=ce}var ae=B.offset;if(I.use===null&&I.choice===null){if(I.any)var te=B.save();var he=this._decodeTag(B,I.implicit!==null?I.implicit:I.tag,I.any);if(B.isError(he))return he;I.any?D=B.raw(te):B=he}if(O&&O.track&&I.tag!==null&&O.track(B.path(),ae,B.length,"tagged"),O&&O.track&&I.tag!==null&&O.track(B.path(),B.offset,B.length,"content"),I.any?D=D:I.choice===null?D=this._decodeGeneric(I.tag,B,O):D=this._decodeChoice(B,O),B.isError(D))return D;if(!I.any&&I.choice===null&&I.children!==null&&I.children.forEach(function(le){le._decode(B,O)}),I.contains&&(I.tag==="octstr"||I.tag==="bitstr")){var oe=new w(D);D=this._getUse(I.contains,B._reporterState.obj)._decode(oe,O)}}return I.obj&&V&&(D=B.leaveObject(se)),I.key!==null&&(D!==null||V===!0)?B.leaveKey(ee,I.key,D):ee!==null&&B.exitKey(ee),D},P.prototype._decodeGeneric=function(B,O,I){var D=this._baseState;return B==="seq"||B==="set"?null:B==="seqof"||B==="setof"?this._decodeList(O,B,D.args[0],I):/str$/.test(B)?this._decodeStr(O,B,I):B==="objid"&&D.args?this._decodeObjid(O,D.args[0],D.args[1],I):B==="objid"?this._decodeObjid(O,null,null,I):B==="gentime"||B==="utctime"?this._decodeTime(O,B,I):B==="null_"?this._decodeNull(O,I):B==="bool"?this._decodeBool(O,I):B==="objDesc"?this._decodeStr(O,B,I):B==="int"||B==="enum"?this._decodeInt(O,D.args&&D.args[0],I):D.use!==null?this._getUse(D.use,O._reporterState.obj)._decode(O,I):O.error("unknown tag: "+B)},P.prototype._getUse=function(B,O){var I=this._baseState;return I.useDecoder=this._use(B,O),_(I.useDecoder._baseState.parent===null),I.useDecoder=I.useDecoder._baseState.children[0],I.implicit!==I.useDecoder._baseState.implicit&&(I.useDecoder=I.useDecoder.clone(),I.useDecoder._baseState.implicit=I.implicit),I.useDecoder},P.prototype._decodeChoice=function(B,O){var I=this._baseState,D=null,V=!1;return Object.keys(I.choice).some(function(ee){var J=B.save(),te=I.choice[ee];try{var se=te._decode(B,O);if(B.isError(se))return!1;D={type:ee,value:se},V=!0}catch{return B.restore(J),!1}return!0},this),V?D:B.error("Choice not matched")},P.prototype._createEncoderBuffer=function(B){return new v(B,this.reporter)},P.prototype._encode=function(B,O,I){var D=this._baseState;if(!(D.default!==null&&D.default===B)){var V=this._encodeValue(B,O,I);if(V!==void 0&&!this._skipDefault(V,O,I))return V}},P.prototype._encodeValue=function(B,O,I){var D=this._baseState;if(D.parent===null)return D.children[0]._encode(B,O||new b);var te=null;if(this.reporter=O,D.optional&&B===void 0)if(D.default!==null)B=D.default;else return;var V=null,ee=!1;if(D.any)te=this._createEncoderBuffer(B);else if(D.choice)te=this._encodeChoice(B,O);else if(D.contains)V=this._getUse(D.contains,I)._encode(B,O),ee=!0;else if(D.children)V=D.children.map(function(ae){if(ae._baseState.tag==="null_")return ae._encode(null,O,B);if(ae._baseState.key===null)return O.error("Child should have a key");var he=O.enterKey(ae._baseState.key);if(typeof B!="object")return O.error("Child expected, but input is not object");var oe=ae._encode(B[ae._baseState.key],O,B);return O.leaveKey(he),oe},this).filter(function(ae){return ae}),V=this._createEncoderBuffer(V);else if(D.tag==="seqof"||D.tag==="setof"){if(!(D.args&&D.args.length===1))return O.error("Too many args for : "+D.tag);if(!Array.isArray(B))return O.error("seqof/setof, but data is not Array");var J=this.clone();J._baseState.implicit=null,V=this._createEncoderBuffer(B.map(function(ae){var he=this._baseState;return this._getUse(he.args[0],B)._encode(ae,O)},J))}else D.use!==null?te=this._getUse(D.use,I)._encode(B,O):(V=this._encodePrimitive(D.tag,B),ee=!0);var te;if(!D.any&&D.choice===null){var se=D.implicit!==null?D.implicit:D.tag,ce=D.implicit===null?"universal":"context";se===null?D.use===null&&O.error("Tag could be omitted only for .use()"):D.use===null&&(te=this._encodeComposite(se,ee,ce,V))}return D.explicit!==null&&(te=this._encodeComposite(D.explicit,!1,"context",te)),te},P.prototype._encodeChoice=function(B,O){var I=this._baseState,D=I.choice[B.type];return D||_(!1,B.type+" not found in "+JSON.stringify(Object.keys(I.choice))),D._encode(B.value,O)},P.prototype._encodePrimitive=function(B,O){var I=this._baseState;if(/str$/.test(B))return this._encodeStr(O,B);if(B==="objid"&&I.args)return this._encodeObjid(O,I.reverseArgs[0],I.args[1]);if(B==="objid")return this._encodeObjid(O,null,null);if(B==="gentime"||B==="utctime")return this._encodeTime(O,B);if(B==="null_")return this._encodeNull();if(B==="int"||B==="enum")return this._encodeInt(O,I.args&&I.reverseArgs[0]);if(B==="bool")return this._encodeBool(O);if(B==="objDesc")return this._encodeStr(O,B);throw new Error("Unsupported tag: "+B)},P.prototype._isNumstr=function(B){return/^[0-9 ]*$/.test(B)},P.prototype._isPrintstr=function(B){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(B)},node}var hasRequiredBase;function requireBase(){return hasRequiredBase||(hasRequiredBase=1,function(b){var v=b;v.Reporter=reporter.Reporter,v.DecoderBuffer=requireBuffer().DecoderBuffer,v.EncoderBuffer=requireBuffer().EncoderBuffer,v.Node=requireNode()}(base$2)),base$2}var constants={},der={},hasRequiredDer$2;function requireDer$2(){return hasRequiredDer$2||(hasRequiredDer$2=1,function(b){var v=requireConstants();b.tagClass={0:"universal",1:"application",2:"context",3:"private"},b.tagClassByName=v._reverse(b.tagClass),b.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},b.tagByName=v._reverse(b.tag)}(der)),der}var hasRequiredConstants;function requireConstants(){return hasRequiredConstants||(hasRequiredConstants=1,function(b){var v=b;v._reverse=function(_){var A={};return Object.keys(_).forEach(function(E){(E|0)==E&&(E=E|0);var k=_[E];A[k]=E}),A},v.der=requireDer$2()}(constants)),constants}var decoders={},der_1$1,hasRequiredDer$1;function requireDer$1(){if(hasRequiredDer$1)return der_1$1;hasRequiredDer$1=1;var b=inherits_browserExports,v=requireAsn1(),w=v.base,_=v.bignum,A=v.constants.der;function E(q){this.enc="der",this.name=q.name,this.entity=q,this.tree=new k,this.tree._init(q.body)}der_1$1=E,E.prototype.decode=function(B,O){return B instanceof w.DecoderBuffer||(B=new w.DecoderBuffer(B,O)),this.tree._decode(B,O)};function k(q){w.Node.call(this,"der",q)}b(k,w.Node),k.prototype._peekTag=function(B,O,I){if(B.isEmpty())return!1;var D=B.save(),V=P(B,'Failed to peek tag: "'+O+'"');return B.isError(V)?V:(B.restore(D),V.tag===O||V.tagStr===O||V.tagStr+"of"===O||I)},k.prototype._decodeTag=function(B,O,I){var D=P(B,'Failed to decode tag of "'+O+'"');if(B.isError(D))return D;var V=N(B,D.primitive,'Failed to get length of "'+O+'"');if(B.isError(V))return V;if(!I&&D.tag!==O&&D.tagStr!==O&&D.tagStr+"of"!==O)return B.error('Failed to match tag: "'+O+'"');if(D.primitive||V!==null)return B.skip(V,'Failed to match body of: "'+O+'"');var ee=B.save(),J=this._skipUntilEnd(B,'Failed to skip indefinite length body: "'+this.tag+'"');return B.isError(J)?J:(V=B.offset-ee.offset,B.restore(ee),B.skip(V,'Failed to match body of: "'+O+'"'))},k.prototype._skipUntilEnd=function(B,O){for(;;){var I=P(B,O);if(B.isError(I))return I;var D=N(B,I.primitive,O);if(B.isError(D))return D;var V;if(I.primitive||D!==null?V=B.skip(D):V=this._skipUntilEnd(B,O),B.isError(V))return V;if(I.tagStr==="end")break}},k.prototype._decodeList=function(B,O,I,D){for(var V=[];!B.isEmpty();){var ee=this._peekTag(B,"end");if(B.isError(ee))return ee;var J=I.decode(B,"der",D);if(B.isError(J)&&ee)break;V.push(J)}return V},k.prototype._decodeStr=function(B,O){if(O==="bitstr"){var I=B.readUInt8();return B.isError(I)?I:{unused:I,data:B.raw()}}else if(O==="bmpstr"){var D=B.raw();if(D.length%2===1)return B.error("Decoding of string type: bmpstr length mismatch");for(var V="",ee=0;ee<D.length/2;ee++)V+=String.fromCharCode(D.readUInt16BE(ee*2));return V}else if(O==="numstr"){var J=B.raw().toString("ascii");return this._isNumstr(J)?J:B.error("Decoding of string type: numstr unsupported characters")}else{if(O==="octstr")return B.raw();if(O==="objDesc")return B.raw();if(O==="printstr"){var te=B.raw().toString("ascii");return this._isPrintstr(te)?te:B.error("Decoding of string type: printstr unsupported characters")}else return/str$/.test(O)?B.raw().toString():B.error("Decoding of string type: "+O+" unsupported")}},k.prototype._decodeObjid=function(B,O,I){for(var D,V=[],ee=0;!B.isEmpty();){var J=B.readUInt8();ee<<=7,ee|=J&127,J&128||(V.push(ee),ee=0)}J&128&&V.push(ee);var te=V[0]/40|0,se=V[0]%40;if(I?D=V:D=[te,se].concat(V.slice(1)),O){var ce=O[D.join(" ")];ce===void 0&&(ce=O[D.join(".")]),ce!==void 0&&(D=ce)}return D},k.prototype._decodeTime=function(B,O){var I=B.raw().toString();if(O==="gentime")var D=I.slice(0,4)|0,V=I.slice(4,6)|0,ee=I.slice(6,8)|0,J=I.slice(8,10)|0,te=I.slice(10,12)|0,se=I.slice(12,14)|0;else if(O==="utctime"){var D=I.slice(0,2)|0,V=I.slice(2,4)|0,ee=I.slice(4,6)|0,J=I.slice(6,8)|0,te=I.slice(8,10)|0,se=I.slice(10,12)|0;D<70?D=2e3+D:D=1900+D}else return B.error("Decoding "+O+" time is not supported yet");return Date.UTC(D,V-1,ee,J,te,se,0)},k.prototype._decodeNull=function(B){return null},k.prototype._decodeBool=function(B){var O=B.readUInt8();return B.isError(O)?O:O!==0},k.prototype._decodeInt=function(B,O){var I=B.raw(),D=new _(I);return O&&(D=O[D.toString(10)]||D),D},k.prototype._use=function(B,O){return typeof B=="function"&&(B=B(O)),B._getDecoder("der").tree};function P(q,B){var O=q.readUInt8(B);if(q.isError(O))return O;var I=A.tagClass[O>>6],D=(O&32)===0;if((O&31)===31){var V=O;for(O=0;(V&128)===128;){if(V=q.readUInt8(B),q.isError(V))return V;O<<=7,O|=V&127}}else O&=31;var ee=A.tag[O];return{cls:I,primitive:D,tag:O,tagStr:ee}}function N(q,B,O){var I=q.readUInt8(O);if(q.isError(I))return I;if(!B&&I===128)return null;if(!(I&128))return I;var D=I&127;if(D>4)return q.error("length octect is too long");I=0;for(var V=0;V<D;V++){I<<=8;var ee=q.readUInt8(O);if(q.isError(ee))return ee;I|=ee}return I}return der_1$1}var pem$1,hasRequiredPem$1;function requirePem$1(){if(hasRequiredPem$1)return pem$1;hasRequiredPem$1=1;var b=inherits_browserExports,v=require$$1$2.Buffer,w=requireDer$1();function _(A){w.call(this,A),this.enc="pem"}return b(_,w),pem$1=_,_.prototype.decode=function(E,k){for(var P=E.toString().split(/[\r\n]+/g),N=k.label.toUpperCase(),q=/^-----(BEGIN|END) ([^-]+)-----$/,B=-1,O=-1,I=0;I<P.length;I++){var D=P[I].match(q);if(D!==null&&D[2]===N)if(B===-1){if(D[1]!=="BEGIN")break;B=I}else{if(D[1]!=="END")break;O=I;break}}if(B===-1||O===-1)throw new Error("PEM section not found for: "+N);var V=P.slice(B+1,O).join("");V.replace(/[^a-z0-9\+\/=]+/gi,"");var ee=new v(V,"base64");return w.prototype.decode.call(this,ee,k)},pem$1}var hasRequiredDecoders;function requireDecoders(){return hasRequiredDecoders||(hasRequiredDecoders=1,function(b){var v=b;v.der=requireDer$1(),v.pem=requirePem$1()}(decoders)),decoders}var encoders={},der_1,hasRequiredDer;function requireDer(){if(hasRequiredDer)return der_1;hasRequiredDer=1;var b=inherits_browserExports,v=require$$1$2.Buffer,w=requireAsn1(),_=w.base,A=w.constants.der;function E(q){this.enc="der",this.name=q.name,this.entity=q,this.tree=new k,this.tree._init(q.body)}der_1=E,E.prototype.encode=function(B,O){return this.tree._encode(B,O).join()};function k(q){_.Node.call(this,"der",q)}b(k,_.Node),k.prototype._encodeComposite=function(B,O,I,D){var V=N(B,O,I,this.reporter);if(D.length<128){var te=new v(2);return te[0]=V,te[1]=D.length,this._createEncoderBuffer([te,D])}for(var ee=1,J=D.length;J>=256;J>>=8)ee++;var te=new v(2+ee);te[0]=V,te[1]=128|ee;for(var J=1+ee,se=D.length;se>0;J--,se>>=8)te[J]=se&255;return this._createEncoderBuffer([te,D])},k.prototype._encodeStr=function(B,O){if(O==="bitstr")return this._createEncoderBuffer([B.unused|0,B.data]);if(O==="bmpstr"){for(var I=new v(B.length*2),D=0;D<B.length;D++)I.writeUInt16BE(B.charCodeAt(D),D*2);return this._createEncoderBuffer(I)}else return O==="numstr"?this._isNumstr(B)?this._createEncoderBuffer(B):this.reporter.error("Encoding of string type: numstr supports only digits and space"):O==="printstr"?this._isPrintstr(B)?this._createEncoderBuffer(B):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(O)?this._createEncoderBuffer(B):O==="objDesc"?this._createEncoderBuffer(B):this.reporter.error("Encoding of string type: "+O+" unsupported")},k.prototype._encodeObjid=function(B,O,I){if(typeof B=="string"){if(!O)return this.reporter.error("string objid given, but no values map found");if(!O.hasOwnProperty(B))return this.reporter.error("objid not found in values map");B=O[B].split(/[\s\.]+/g);for(var D=0;D<B.length;D++)B[D]|=0}else if(Array.isArray(B)){B=B.slice();for(var D=0;D<B.length;D++)B[D]|=0}if(!Array.isArray(B))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(B));if(!I){if(B[1]>=40)return this.reporter.error("Second objid identifier OOB");B.splice(0,2,B[0]*40+B[1])}for(var V=0,D=0;D<B.length;D++){var ee=B[D];for(V++;ee>=128;ee>>=7)V++}for(var J=new v(V),te=J.length-1,D=B.length-1;D>=0;D--){var ee=B[D];for(J[te--]=ee&127;(ee>>=7)>0;)J[te--]=128|ee&127}return this._createEncoderBuffer(J)};function P(q){return q<10?"0"+q:q}k.prototype._encodeTime=function(B,O){var I,D=new Date(B);return O==="gentime"?I=[P(D.getFullYear()),P(D.getUTCMonth()+1),P(D.getUTCDate()),P(D.getUTCHours()),P(D.getUTCMinutes()),P(D.getUTCSeconds()),"Z"].join(""):O==="utctime"?I=[P(D.getFullYear()%100),P(D.getUTCMonth()+1),P(D.getUTCDate()),P(D.getUTCHours()),P(D.getUTCMinutes()),P(D.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+O+" time is not supported yet"),this._encodeStr(I,"octstr")},k.prototype._encodeNull=function(){return this._createEncoderBuffer("")},k.prototype._encodeInt=function(B,O){if(typeof B=="string"){if(!O)return this.reporter.error("String int or enum given, but no values map");if(!O.hasOwnProperty(B))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(B));B=O[B]}if(typeof B!="number"&&!v.isBuffer(B)){var I=B.toArray();!B.sign&&I[0]&128&&I.unshift(0),B=new v(I)}if(v.isBuffer(B)){var D=B.length;B.length===0&&D++;var ee=new v(D);return B.copy(ee),B.length===0&&(ee[0]=0),this._createEncoderBuffer(ee)}if(B<128)return this._createEncoderBuffer(B);if(B<256)return this._createEncoderBuffer([0,B]);for(var D=1,V=B;V>=256;V>>=8)D++;for(var ee=new Array(D),V=ee.length-1;V>=0;V--)ee[V]=B&255,B>>=8;return ee[0]&128&&ee.unshift(0),this._createEncoderBuffer(new v(ee))},k.prototype._encodeBool=function(B){return this._createEncoderBuffer(B?255:0)},k.prototype._use=function(B,O){return typeof B=="function"&&(B=B(O)),B._getEncoder("der").tree},k.prototype._skipDefault=function(B,O,I){var D=this._baseState,V;if(D.default===null)return!1;var ee=B.join();if(D.defaultBuffer===void 0&&(D.defaultBuffer=this._encodeValue(D.default,O,I).join()),ee.length!==D.defaultBuffer.length)return!1;for(V=0;V<ee.length;V++)if(ee[V]!==D.defaultBuffer[V])return!1;return!0};function N(q,B,O,I){var D;if(q==="seqof"?q="seq":q==="setof"&&(q="set"),A.tagByName.hasOwnProperty(q))D=A.tagByName[q];else if(typeof q=="number"&&(q|0)===q)D=q;else return I.error("Unknown tag: "+q);return D>=31?I.error("Multi-octet tag encoding unsupported"):(B||(D|=32),D|=A.tagClassByName[O||"universal"]<<6,D)}return der_1}var pem,hasRequiredPem;function requirePem(){if(hasRequiredPem)return pem;hasRequiredPem=1;var b=inherits_browserExports,v=requireDer();function w(_){v.call(this,_),this.enc="pem"}return b(w,v),pem=w,w.prototype.encode=function(A,E){for(var k=v.prototype.encode.call(this,A),P=k.toString("base64"),N=["-----BEGIN "+E.label+"-----"],q=0;q<P.length;q+=64)N.push(P.slice(q,q+64));return N.push("-----END "+E.label+"-----"),N.join(`
779
- `)},pem}var hasRequiredEncoders;function requireEncoders(){return hasRequiredEncoders||(hasRequiredEncoders=1,function(b){var v=b;v.der=requireDer(),v.pem=requirePem()}(encoders)),encoders}var hasRequiredAsn1;function requireAsn1(){return hasRequiredAsn1||(hasRequiredAsn1=1,function(b){var v=b;v.bignum=bnExports$2,v.define=requireApi().define,v.base=requireBase(),v.constants=requireConstants(),v.decoders=requireDecoders(),v.encoders=requireEncoders()}(asn1$2)),asn1$2}var asn=requireAsn1(),Time=asn.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),AttributeTypeValue=asn.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),AlgorithmIdentifier$1=asn.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),SubjectPublicKeyInfo=asn.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(AlgorithmIdentifier$1),this.key("subjectPublicKey").bitstr())}),RelativeDistinguishedName=asn.define("RelativeDistinguishedName",function(){this.setof(AttributeTypeValue)}),RDNSequence=asn.define("RDNSequence",function(){this.seqof(RelativeDistinguishedName)}),Name=asn.define("Name",function(){this.choice({rdnSequence:this.use(RDNSequence)})}),Validity=asn.define("Validity",function(){this.seq().obj(this.key("notBefore").use(Time),this.key("notAfter").use(Time))}),Extension=asn.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),TBSCertificate=asn.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(AlgorithmIdentifier$1),this.key("issuer").use(Name),this.key("validity").use(Validity),this.key("subject").use(Name),this.key("subjectPublicKeyInfo").use(SubjectPublicKeyInfo),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(Extension).optional())}),X509Certificate=asn.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(TBSCertificate),this.key("signatureAlgorithm").use(AlgorithmIdentifier$1),this.key("signatureValue").bitstr())}),certificate=X509Certificate,asn1$1=requireAsn1();asn1$3.certificate=certificate;var RSAPrivateKey=asn1$1.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});asn1$3.RSAPrivateKey=RSAPrivateKey;var RSAPublicKey=asn1$1.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});asn1$3.RSAPublicKey=RSAPublicKey;var AlgorithmIdentifier=asn1$1.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),PublicKey=asn1$1.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(AlgorithmIdentifier),this.key("subjectPublicKey").bitstr())});asn1$3.PublicKey=PublicKey;var PrivateKeyInfo=asn1$1.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(AlgorithmIdentifier),this.key("subjectPrivateKey").octstr())});asn1$3.PrivateKey=PrivateKeyInfo;var EncryptedPrivateKeyInfo=asn1$1.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});asn1$3.EncryptedPrivateKey=EncryptedPrivateKeyInfo;var DSAPrivateKey=asn1$1.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});asn1$3.DSAPrivateKey=DSAPrivateKey;asn1$3.DSAparam=asn1$1.define("DSAparam",function(){this.int()});var ECParameters=asn1$1.define("ECParameters",function(){this.choice({namedCurve:this.objid()})}),ECPrivateKey=asn1$1.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(ECParameters),this.key("publicKey").optional().explicit(1).bitstr())});asn1$3.ECPrivateKey=ECPrivateKey;asn1$3.signature=asn1$1.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())});const require$$1={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"};var findProc=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,startRegex=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,fullRegex=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,evp=evp_bytestokey,ciphers$1=browser$5,Buffer$7=safeBufferExports$1.Buffer,fixProc$1=function(b,v){var w=b.toString(),_=w.match(findProc),A;if(_){var k="aes"+_[1],P=Buffer$7.from(_[2],"hex"),N=Buffer$7.from(_[3].replace(/[\r\n]/g,""),"base64"),q=evp(v,P.slice(0,8),parseInt(_[1],10)).key,B=[],O=ciphers$1.createDecipheriv(k,q,P);B.push(O.update(N)),B.push(O.final()),A=Buffer$7.concat(B)}else{var E=w.match(fullRegex);A=Buffer$7.from(E[2].replace(/[\r\n]/g,""),"base64")}var I=w.match(startRegex)[1];return{tag:I,data:A}},asn1=asn1$3,aesid=require$$1,fixProc=fixProc$1,ciphers=browser$5,compat=browser$7,Buffer$6=safeBufferExports$1.Buffer;function decrypt(b,v){var w=b.algorithm.decrypt.kde.kdeparams.salt,_=parseInt(b.algorithm.decrypt.kde.kdeparams.iters.toString(),10),A=aesid[b.algorithm.decrypt.cipher.algo.join(".")],E=b.algorithm.decrypt.cipher.iv,k=b.subjectPrivateKey,P=parseInt(A.split("-")[1],10)/8,N=compat.pbkdf2Sync(v,w,_,P,"sha1"),q=ciphers.createDecipheriv(A,N,E),B=[];return B.push(q.update(k)),B.push(q.final()),Buffer$6.concat(B)}function parseKeys$2(b){var v;typeof b=="object"&&!Buffer$6.isBuffer(b)&&(v=b.passphrase,b=b.key),typeof b=="string"&&(b=Buffer$6.from(b));var w=fixProc(b,v),_=w.tag,A=w.data,E,k;switch(_){case"CERTIFICATE":k=asn1.certificate.decode(A,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(k||(k=asn1.PublicKey.decode(A,"der")),E=k.algorithm.algorithm.join("."),E){case"1.2.840.113549.1.1.1":return asn1.RSAPublicKey.decode(k.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return k.subjectPrivateKey=k.subjectPublicKey,{type:"ec",data:k};case"1.2.840.10040.4.1":return k.algorithm.params.pub_key=asn1.DSAparam.decode(k.subjectPublicKey.data,"der"),{type:"dsa",data:k.algorithm.params};default:throw new Error("unknown key id "+E)}case"ENCRYPTED PRIVATE KEY":A=asn1.EncryptedPrivateKey.decode(A,"der"),A=decrypt(A,v);case"PRIVATE KEY":switch(k=asn1.PrivateKey.decode(A,"der"),E=k.algorithm.algorithm.join("."),E){case"1.2.840.113549.1.1.1":return asn1.RSAPrivateKey.decode(k.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:k.algorithm.curve,privateKey:asn1.ECPrivateKey.decode(k.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return k.algorithm.params.priv_key=asn1.DSAparam.decode(k.subjectPrivateKey,"der"),{type:"dsa",params:k.algorithm.params};default:throw new Error("unknown key id "+E)}case"RSA PUBLIC KEY":return asn1.RSAPublicKey.decode(A,"der");case"RSA PRIVATE KEY":return asn1.RSAPrivateKey.decode(A,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:asn1.DSAPrivateKey.decode(A,"der")};case"EC PRIVATE KEY":return A=asn1.ECPrivateKey.decode(A,"der"),{curve:A.parameters.value,privateKey:A.privateKey};default:throw new Error("unknown key type "+_)}}parseKeys$2.signature=asn1.signature;var parseAsn1=parseKeys$2;const require$$4={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"};var hasRequiredSign;function requireSign(){if(hasRequiredSign)return sign.exports;hasRequiredSign=1;var b=safeBufferExports$1.Buffer,v=browser$8,w=browserifyRsa,_=requireElliptic().ec,A=bnExports,E=parseAsn1,k=require$$4,P=1;function N(te,se,ce,ae,he){var oe=E(se);if(oe.curve){if(ae!=="ecdsa"&&ae!=="ecdsa/rsa")throw new Error("wrong private key type");return q(te,oe)}else if(oe.type==="dsa"){if(ae!=="dsa")throw new Error("wrong private key type");return B(te,oe,ce)}if(ae!=="rsa"&&ae!=="ecdsa/rsa")throw new Error("wrong private key type");if(se.padding!==void 0&&se.padding!==P)throw new Error("illegal or unsupported padding mode");te=b.concat([he,te]);for(var de=oe.modulus.byteLength(),le=[0,1];te.length+le.length+1<de;)le.push(255);le.push(0);for(var be=-1;++be<te.length;)le.push(te[be]);var pe=w(le,oe);return pe}function q(te,se){var ce=k[se.curve.join(".")];if(!ce)throw new Error("unknown curve "+se.curve.join("."));var ae=new _(ce),he=ae.keyFromPrivate(se.privateKey),oe=he.sign(te);return b.from(oe.toDER())}function B(te,se,ce){for(var ae=se.params.priv_key,he=se.params.p,oe=se.params.q,de=se.params.g,le=new A(0),be,pe=D(te,oe).mod(oe),fe=!1,Z=I(ae,oe,te,ce);fe===!1;)be=ee(oe,Z,ce),le=J(de,be,he,oe),fe=be.invm(oe).imul(pe.add(ae.mul(le))).mod(oe),fe.cmpn(0)===0&&(fe=!1,le=new A(0));return O(le,fe)}function O(te,se){te=te.toArray(),se=se.toArray(),te[0]&128&&(te=[0].concat(te)),se[0]&128&&(se=[0].concat(se));var ce=te.length+se.length+4,ae=[48,ce,2,te.length];return ae=ae.concat(te,[2,se.length],se),b.from(ae)}function I(te,se,ce,ae){if(te=b.from(te.toArray()),te.length<se.byteLength()){var he=b.alloc(se.byteLength()-te.length);te=b.concat([he,te])}var oe=ce.length,de=V(ce,se),le=b.alloc(oe);le.fill(1);var be=b.alloc(oe);return be=v(ae,be).update(le).update(b.from([0])).update(te).update(de).digest(),le=v(ae,be).update(le).digest(),be=v(ae,be).update(le).update(b.from([1])).update(te).update(de).digest(),le=v(ae,be).update(le).digest(),{k:be,v:le}}function D(te,se){var ce=new A(te),ae=(te.length<<3)-se.bitLength();return ae>0&&ce.ishrn(ae),ce}function V(te,se){te=D(te,se),te=te.mod(se);var ce=b.from(te.toArray());if(ce.length<se.byteLength()){var ae=b.alloc(se.byteLength()-ce.length);ce=b.concat([ae,ce])}return ce}function ee(te,se,ce){var ae,he;do{for(ae=b.alloc(0);ae.length*8<te.bitLength();)se.v=v(ce,se.k).update(se.v).digest(),ae=b.concat([ae,se.v]);he=D(ae,te),se.k=v(ce,se.k).update(se.v).update(b.from([0])).digest(),se.v=v(ce,se.k).update(se.v).digest()}while(he.cmp(te)!==-1);return he}function J(te,se,ce,ae){return te.toRed(A.mont(ce)).redPow(se).fromRed().mod(ae)}return sign.exports=N,sign.exports.getKey=I,sign.exports.makeKey=ee,sign.exports}var verify_1,hasRequiredVerify;function requireVerify(){if(hasRequiredVerify)return verify_1;hasRequiredVerify=1;var b=safeBufferExports$1.Buffer,v=bnExports,w=requireElliptic().ec,_=parseAsn1,A=require$$4;function E(q,B,O,I,D){var V=_(O);if(V.type==="ec"){if(I!=="ecdsa"&&I!=="ecdsa/rsa")throw new Error("wrong public key type");return k(q,B,V)}else if(V.type==="dsa"){if(I!=="dsa")throw new Error("wrong public key type");return P(q,B,V)}if(I!=="rsa"&&I!=="ecdsa/rsa")throw new Error("wrong public key type");B=b.concat([D,B]);for(var ee=V.modulus.byteLength(),J=[1],te=0;B.length+J.length+2<ee;)J.push(255),te+=1;J.push(0);for(var se=-1;++se<B.length;)J.push(B[se]);J=b.from(J);var ce=v.mont(V.modulus);q=new v(q).toRed(ce),q=q.redPow(new v(V.publicExponent)),q=b.from(q.fromRed().toArray());var ae=te<8?1:0;for(ee=Math.min(q.length,J.length),q.length!==J.length&&(ae=1),se=-1;++se<ee;)ae|=q[se]^J[se];return ae===0}function k(q,B,O){var I=A[O.data.algorithm.curve.join(".")];if(!I)throw new Error("unknown curve "+O.data.algorithm.curve.join("."));var D=new w(I),V=O.data.subjectPrivateKey.data;return D.verify(B,q,V)}function P(q,B,O){var I=O.data.p,D=O.data.q,V=O.data.g,ee=O.data.pub_key,J=_.signature.decode(q,"der"),te=J.s,se=J.r;N(te,D),N(se,D);var ce=v.mont(I),ae=te.invm(D),he=V.toRed(ce).redPow(new v(B).mul(ae).mod(D)).fromRed().mul(ee.toRed(ce).redPow(se.mul(ae).mod(D)).fromRed()).mod(I).mod(D);return he.cmp(se)===0}function N(q,B){if(q.cmpn(0)<=0)throw new Error("invalid sig");if(q.cmp(B)>=0)throw new Error("invalid sig")}return verify_1=E,verify_1}var browser$3,hasRequiredBrowser$1;function requireBrowser$1(){if(hasRequiredBrowser$1)return browser$3;hasRequiredBrowser$1=1;var b=safeBufferExports$1.Buffer,v=browser$9,w=readableBrowserExports,_=inherits_browserExports,A=requireSign(),E=requireVerify(),k=require$$6;Object.keys(k).forEach(function(O){k[O].id=b.from(k[O].id,"hex"),k[O.toLowerCase()]=k[O]});function P(O){w.Writable.call(this);var I=k[O];if(!I)throw new Error("Unknown message digest");this._hashType=I.hash,this._hash=v(I.hash),this._tag=I.id,this._signType=I.sign}_(P,w.Writable),P.prototype._write=function(I,D,V){this._hash.update(I),V()},P.prototype.update=function(I,D){return this._hash.update(typeof I=="string"?b.from(I,D):I),this},P.prototype.sign=function(I,D){this.end();var V=this._hash.digest(),ee=A(V,I,this._hashType,this._signType,this._tag);return D?ee.toString(D):ee};function N(O){w.Writable.call(this);var I=k[O];if(!I)throw new Error("Unknown message digest");this._hash=v(I.hash),this._tag=I.id,this._signType=I.sign}_(N,w.Writable),N.prototype._write=function(I,D,V){this._hash.update(I),V()},N.prototype.update=function(I,D){return this._hash.update(typeof I=="string"?b.from(I,D):I),this},N.prototype.verify=function(I,D,V){var ee=typeof D=="string"?b.from(D,V):D;this.end();var J=this._hash.digest();return E(ee,J,I,this._signType,this._tag)};function q(O){return new P(O)}function B(O){return new N(O)}return browser$3={Sign:q,Verify:B,createSign:q,createVerify:B},browser$3}var browser$2,hasRequiredBrowser;function requireBrowser(){if(hasRequiredBrowser)return browser$2;hasRequiredBrowser=1;var b=requireElliptic(),v=bnExports$2;browser$2=function(k){return new _(k)};var w={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};w.p224=w.secp224r1,w.p256=w.secp256r1=w.prime256v1,w.p192=w.secp192r1=w.prime192v1,w.p384=w.secp384r1,w.p521=w.secp521r1;function _(E){this.curveType=w[E],this.curveType||(this.curveType={name:E}),this.curve=new b.ec(this.curveType.name),this.keys=void 0}_.prototype.generateKeys=function(E,k){return this.keys=this.curve.genKeyPair(),this.getPublicKey(E,k)},_.prototype.computeSecret=function(E,k,P){k=k||"utf8",Buffer$D.isBuffer(E)||(E=new Buffer$D(E,k));var N=this.curve.keyFromPublic(E).getPublic(),q=N.mul(this.keys.getPrivate()).getX();return A(q,P,this.curveType.byteLength)},_.prototype.getPublicKey=function(E,k){var P=this.keys.getPublic(k==="compressed",!0);return k==="hybrid"&&(P[P.length-1]%2?P[0]=7:P[0]=6),A(P,E)},_.prototype.getPrivateKey=function(E){return A(this.keys.getPrivate(),E)},_.prototype.setPublicKey=function(E,k){return k=k||"utf8",Buffer$D.isBuffer(E)||(E=new Buffer$D(E,k)),this.keys._importPublic(E),this},_.prototype.setPrivateKey=function(E,k){k=k||"utf8",Buffer$D.isBuffer(E)||(E=new Buffer$D(E,k));var P=new v(E);return P=P.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(P),this};function A(E,k,P){Array.isArray(E)||(E=E.toArray());var N=new Buffer$D(E);if(P&&N.length<P){var q=new Buffer$D(P-N.length);q.fill(0),N=Buffer$D.concat([q,N])}return k?N.toString(k):N}return browser$2}var browser$1={},createHash$3=browser$9,Buffer$5=safeBufferExports$1.Buffer,mgf$2=function(b,v){for(var w=Buffer$5.alloc(0),_=0,A;w.length<v;)A=i2ops(_++),w=Buffer$5.concat([w,createHash$3("sha1").update(b).update(A).digest()]);return w.slice(0,v)};function i2ops(b){var v=Buffer$5.allocUnsafe(4);return v.writeUInt32BE(b,0),v}var xor$2=function b(v,w){for(var _=v.length,A=-1;++A<_;)v[A]^=w[A];return v},BN$2=bnExports$2,Buffer$4=safeBufferExports$1.Buffer;function withPublic$2(b,v){return Buffer$4.from(b.toRed(BN$2.mont(v.modulus)).redPow(new BN$2(v.publicExponent)).fromRed().toArray())}var withPublic_1=withPublic$2,parseKeys$1=parseAsn1,randomBytes$1=browserExports,createHash$2=browser$9,mgf$1=mgf$2,xor$1=xor$2,BN$1=bnExports$2,withPublic$1=withPublic_1,crt$1=browserifyRsa,Buffer$3=safeBufferExports$1.Buffer,publicEncrypt=function b(v,w,_){var A;v.padding?A=v.padding:_?A=1:A=4;var E=parseKeys$1(v),k;if(A===4)k=oaep$1(E,w);else if(A===1)k=pkcs1$1(E,w,_);else if(A===3){if(k=new BN$1(w),k.cmp(E.modulus)>=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return _?crt$1(k,E):withPublic$1(k,E)};function oaep$1(b,v){var w=b.modulus.byteLength(),_=v.length,A=createHash$2("sha1").update(Buffer$3.alloc(0)).digest(),E=A.length,k=2*E;if(_>w-k-2)throw new Error("message too long");var P=Buffer$3.alloc(w-_-k-2),N=w-E-1,q=randomBytes$1(E),B=xor$1(Buffer$3.concat([A,P,Buffer$3.alloc(1,1),v],N),mgf$1(q,N)),O=xor$1(q,mgf$1(B,E));return new BN$1(Buffer$3.concat([Buffer$3.alloc(1),O,B],w))}function pkcs1$1(b,v,w){var _=v.length,A=b.modulus.byteLength();if(_>A-11)throw new Error("message too long");var E;return w?E=Buffer$3.alloc(A-_-3,255):E=nonZero(A-_-3),new BN$1(Buffer$3.concat([Buffer$3.from([0,w?1:2]),E,Buffer$3.alloc(1),v],A))}function nonZero(b){for(var v=Buffer$3.allocUnsafe(b),w=0,_=randomBytes$1(b*2),A=0,E;w<b;)A===_.length&&(_=randomBytes$1(b*2),A=0),E=_[A++],E&&(v[w++]=E);return v}var parseKeys=parseAsn1,mgf=mgf$2,xor=xor$2,BN=bnExports$2,crt=browserifyRsa,createHash$1=browser$9,withPublic=withPublic_1,Buffer$2=safeBufferExports$1.Buffer,privateDecrypt=function b(v,w,_){var A;v.padding?A=v.padding:_?A=1:A=4;var E=parseKeys(v),k=E.modulus.byteLength();if(w.length>k||new BN(w).cmp(E.modulus)>=0)throw new Error("decryption error");var P;_?P=withPublic(new BN(w),E):P=crt(w,E);var N=Buffer$2.alloc(k-P.length);if(P=Buffer$2.concat([N,P],k),A===4)return oaep(E,P);if(A===1)return pkcs1(E,P,_);if(A===3)return P;throw new Error("unknown padding")};function oaep(b,v){var w=b.modulus.byteLength(),_=createHash$1("sha1").update(Buffer$2.alloc(0)).digest(),A=_.length;if(v[0]!==0)throw new Error("decryption error");var E=v.slice(1,A+1),k=v.slice(A+1),P=xor(E,mgf(k,A)),N=xor(k,mgf(P,w-A-1));if(compare(_,N.slice(0,A)))throw new Error("decryption error");for(var q=A;N[q]===0;)q++;if(N[q++]!==1)throw new Error("decryption error");return N.slice(q)}function pkcs1(b,v,w){for(var _=v.slice(0,2),A=2,E=0;v[A++]!==0;)if(A>=v.length){E++;break}var k=v.slice(2,A-1);if((_.toString("hex")!=="0002"&&!w||_.toString("hex")!=="0001"&&w)&&E++,k.length<8&&E++,E)throw new Error("decryption error");return v.slice(A)}function compare(b,v){b=Buffer$2.from(b),v=Buffer$2.from(v);var w=0,_=b.length;b.length!==v.length&&(w++,_=Math.min(b.length,v.length));for(var A=-1;++A<_;)w+=b[A]^v[A];return w}(function(b){b.publicEncrypt=publicEncrypt,b.privateDecrypt=privateDecrypt,b.privateEncrypt=function(w,_){return b.publicEncrypt(w,_,!0)},b.publicDecrypt=function(w,_){return b.privateDecrypt(w,_,!0)}})(browser$1);var browser={};function oldBrowser(){throw new Error(`secure random number generation not supported by this browser
780
- use chrome, FireFox or Internet Explorer 11`)}var safeBuffer=safeBufferExports$1,randombytes=browserExports,Buffer$1=safeBuffer.Buffer,kBufferMaxLength=safeBuffer.kMaxLength,crypto=commonjsGlobal.crypto||commonjsGlobal.msCrypto,kMaxUint32=Math.pow(2,32)-1;function assertOffset(b,v){if(typeof b!="number"||b!==b)throw new TypeError("offset must be a number");if(b>kMaxUint32||b<0)throw new TypeError("offset must be a uint32");if(b>kBufferMaxLength||b>v)throw new RangeError("offset out of range")}function assertSize(b,v,w){if(typeof b!="number"||b!==b)throw new TypeError("size must be a number");if(b>kMaxUint32||b<0)throw new TypeError("size must be a uint32");if(b+v>w||b>kBufferMaxLength)throw new RangeError("buffer too small")}crypto&&crypto.getRandomValues||!process$1.browser?(browser.randomFill=randomFill,browser.randomFillSync=randomFillSync):(browser.randomFill=oldBrowser,browser.randomFillSync=oldBrowser);function randomFill(b,v,w,_){if(!Buffer$1.isBuffer(b)&&!(b instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof v=="function")_=v,v=0,w=b.length;else if(typeof w=="function")_=w,w=b.length-v;else if(typeof _!="function")throw new TypeError('"cb" argument must be a function');return assertOffset(v,b.length),assertSize(w,v,b.length),actualFill(b,v,w,_)}function actualFill(b,v,w,_){if(process$1.browser){var A=b.buffer,E=new Uint8Array(A,v,w);if(crypto.getRandomValues(E),_){process$1.nextTick(function(){_(null,b)});return}return b}if(_){randombytes(w,function(P,N){if(P)return _(P);N.copy(b,v),_(null,b)});return}var k=randombytes(w);return k.copy(b,v),b}function randomFillSync(b,v,w){if(typeof v>"u"&&(v=0),!Buffer$1.isBuffer(b)&&!(b instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return assertOffset(v,b.length),w===void 0&&(w=b.length-v),assertSize(w,v,b.length),actualFill(b,v,w)}var hasRequiredCryptoBrowserify;function requireCryptoBrowserify(){if(hasRequiredCryptoBrowserify)return cryptoBrowserify;hasRequiredCryptoBrowserify=1,cryptoBrowserify.randomBytes=cryptoBrowserify.rng=cryptoBrowserify.pseudoRandomBytes=cryptoBrowserify.prng=browserExports,cryptoBrowserify.createHash=cryptoBrowserify.Hash=browser$9,cryptoBrowserify.createHmac=cryptoBrowserify.Hmac=browser$8;var b=algos,v=Object.keys(b),w=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(v);cryptoBrowserify.getHashes=function(){return w};var _=browser$7;cryptoBrowserify.pbkdf2=_.pbkdf2,cryptoBrowserify.pbkdf2Sync=_.pbkdf2Sync;var A=browser$6;cryptoBrowserify.Cipher=A.Cipher,cryptoBrowserify.createCipher=A.createCipher,cryptoBrowserify.Cipheriv=A.Cipheriv,cryptoBrowserify.createCipheriv=A.createCipheriv,cryptoBrowserify.Decipher=A.Decipher,cryptoBrowserify.createDecipher=A.createDecipher,cryptoBrowserify.Decipheriv=A.Decipheriv,cryptoBrowserify.createDecipheriv=A.createDecipheriv,cryptoBrowserify.getCiphers=A.getCiphers,cryptoBrowserify.listCiphers=A.listCiphers;var E=requireBrowser$2();cryptoBrowserify.DiffieHellmanGroup=E.DiffieHellmanGroup,cryptoBrowserify.createDiffieHellmanGroup=E.createDiffieHellmanGroup,cryptoBrowserify.getDiffieHellman=E.getDiffieHellman,cryptoBrowserify.createDiffieHellman=E.createDiffieHellman,cryptoBrowserify.DiffieHellman=E.DiffieHellman;var k=requireBrowser$1();cryptoBrowserify.createSign=k.createSign,cryptoBrowserify.Sign=k.Sign,cryptoBrowserify.createVerify=k.createVerify,cryptoBrowserify.Verify=k.Verify,cryptoBrowserify.createECDH=requireBrowser();var P=browser$1;cryptoBrowserify.publicEncrypt=P.publicEncrypt,cryptoBrowserify.privateEncrypt=P.privateEncrypt,cryptoBrowserify.publicDecrypt=P.publicDecrypt,cryptoBrowserify.privateDecrypt=P.privateDecrypt;var N=browser;return cryptoBrowserify.randomFill=N.randomFill,cryptoBrowserify.randomFillSync=N.randomFillSync,cryptoBrowserify.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join(`
781
- `))},cryptoBrowserify.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6},cryptoBrowserify}Object.defineProperty(node$1,"__esModule",{value:!0});node$1.NodeRandomSource=void 0;const wipe_1=wipe$1;class NodeRandomSource{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof commonjsRequire<"u"){const v=requireCryptoBrowserify();v&&v.randomBytes&&(this._crypto=v,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(v){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let w=this._crypto.randomBytes(v);if(w.length!==v)throw new Error("NodeRandomSource: got fewer bytes than requested");const _=new Uint8Array(v);for(let A=0;A<_.length;A++)_[A]=w[A];return(0,wipe_1.wipe)(w),_}}node$1.NodeRandomSource=NodeRandomSource;Object.defineProperty(system,"__esModule",{value:!0});system.SystemRandomSource=void 0;const browser_1=browser$d,node_1=node$1;class SystemRandomSource{constructor(){if(this.isAvailable=!1,this.name="",this._source=new browser_1.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new node_1.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(v){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(v)}}system.SystemRandomSource=SystemRandomSource;var binary={},int={};(function(b){Object.defineProperty(b,"__esModule",{value:!0});function v(P,N){var q=P>>>16&65535,B=P&65535,O=N>>>16&65535,I=N&65535;return B*I+(q*I+B*O<<16>>>0)|0}b.mul=Math.imul||v;function w(P,N){return P+N|0}b.add=w;function _(P,N){return P-N|0}b.sub=_;function A(P,N){return P<<N|P>>>32-N}b.rotl=A;function E(P,N){return P<<32-N|P>>>N}b.rotr=E;function k(P){return typeof P=="number"&&isFinite(P)&&Math.floor(P)===P}b.isInteger=Number.isInteger||k,b.MAX_SAFE_INTEGER=9007199254740991,b.isSafeInteger=function(P){return b.isInteger(P)&&P>=-b.MAX_SAFE_INTEGER&&P<=b.MAX_SAFE_INTEGER}})(int);Object.defineProperty(binary,"__esModule",{value:!0});var int_1=int;function readInt16BE(b,v){return v===void 0&&(v=0),(b[v+0]<<8|b[v+1])<<16>>16}binary.readInt16BE=readInt16BE;function readUint16BE(b,v){return v===void 0&&(v=0),(b[v+0]<<8|b[v+1])>>>0}binary.readUint16BE=readUint16BE;function readInt16LE(b,v){return v===void 0&&(v=0),(b[v+1]<<8|b[v])<<16>>16}binary.readInt16LE=readInt16LE;function readUint16LE(b,v){return v===void 0&&(v=0),(b[v+1]<<8|b[v])>>>0}binary.readUint16LE=readUint16LE;function writeUint16BE(b,v,w){return v===void 0&&(v=new Uint8Array(2)),w===void 0&&(w=0),v[w+0]=b>>>8,v[w+1]=b>>>0,v}binary.writeUint16BE=writeUint16BE;binary.writeInt16BE=writeUint16BE;function writeUint16LE(b,v,w){return v===void 0&&(v=new Uint8Array(2)),w===void 0&&(w=0),v[w+0]=b>>>0,v[w+1]=b>>>8,v}binary.writeUint16LE=writeUint16LE;binary.writeInt16LE=writeUint16LE;function readInt32BE(b,v){return v===void 0&&(v=0),b[v]<<24|b[v+1]<<16|b[v+2]<<8|b[v+3]}binary.readInt32BE=readInt32BE;function readUint32BE(b,v){return v===void 0&&(v=0),(b[v]<<24|b[v+1]<<16|b[v+2]<<8|b[v+3])>>>0}binary.readUint32BE=readUint32BE;function readInt32LE(b,v){return v===void 0&&(v=0),b[v+3]<<24|b[v+2]<<16|b[v+1]<<8|b[v]}binary.readInt32LE=readInt32LE;function readUint32LE(b,v){return v===void 0&&(v=0),(b[v+3]<<24|b[v+2]<<16|b[v+1]<<8|b[v])>>>0}binary.readUint32LE=readUint32LE;function writeUint32BE(b,v,w){return v===void 0&&(v=new Uint8Array(4)),w===void 0&&(w=0),v[w+0]=b>>>24,v[w+1]=b>>>16,v[w+2]=b>>>8,v[w+3]=b>>>0,v}binary.writeUint32BE=writeUint32BE;binary.writeInt32BE=writeUint32BE;function writeUint32LE(b,v,w){return v===void 0&&(v=new Uint8Array(4)),w===void 0&&(w=0),v[w+0]=b>>>0,v[w+1]=b>>>8,v[w+2]=b>>>16,v[w+3]=b>>>24,v}binary.writeUint32LE=writeUint32LE;binary.writeInt32LE=writeUint32LE;function readInt64BE(b,v){v===void 0&&(v=0);var w=readInt32BE(b,v),_=readInt32BE(b,v+4);return w*4294967296+_-(_>>31)*4294967296}binary.readInt64BE=readInt64BE;function readUint64BE(b,v){v===void 0&&(v=0);var w=readUint32BE(b,v),_=readUint32BE(b,v+4);return w*4294967296+_}binary.readUint64BE=readUint64BE;function readInt64LE(b,v){v===void 0&&(v=0);var w=readInt32LE(b,v),_=readInt32LE(b,v+4);return _*4294967296+w-(w>>31)*4294967296}binary.readInt64LE=readInt64LE;function readUint64LE(b,v){v===void 0&&(v=0);var w=readUint32LE(b,v),_=readUint32LE(b,v+4);return _*4294967296+w}binary.readUint64LE=readUint64LE;function writeUint64BE(b,v,w){return v===void 0&&(v=new Uint8Array(8)),w===void 0&&(w=0),writeUint32BE(b/4294967296>>>0,v,w),writeUint32BE(b>>>0,v,w+4),v}binary.writeUint64BE=writeUint64BE;binary.writeInt64BE=writeUint64BE;function writeUint64LE(b,v,w){return v===void 0&&(v=new Uint8Array(8)),w===void 0&&(w=0),writeUint32LE(b>>>0,v,w),writeUint32LE(b/4294967296>>>0,v,w+4),v}binary.writeUint64LE=writeUint64LE;binary.writeInt64LE=writeUint64LE;function readUintBE(b,v,w){if(w===void 0&&(w=0),b%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(b/8>v.length-w)throw new Error("readUintBE: array is too short for the given bitLength");for(var _=0,A=1,E=b/8+w-1;E>=w;E--)_+=v[E]*A,A*=256;return _}binary.readUintBE=readUintBE;function readUintLE(b,v,w){if(w===void 0&&(w=0),b%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(b/8>v.length-w)throw new Error("readUintLE: array is too short for the given bitLength");for(var _=0,A=1,E=w;E<w+b/8;E++)_+=v[E]*A,A*=256;return _}binary.readUintLE=readUintLE;function writeUintBE(b,v,w,_){if(w===void 0&&(w=new Uint8Array(b/8)),_===void 0&&(_=0),b%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!int_1.isSafeInteger(v))throw new Error("writeUintBE value must be an integer");for(var A=1,E=b/8+_-1;E>=_;E--)w[E]=v/A&255,A*=256;return w}binary.writeUintBE=writeUintBE;function writeUintLE(b,v,w,_){if(w===void 0&&(w=new Uint8Array(b/8)),_===void 0&&(_=0),b%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!int_1.isSafeInteger(v))throw new Error("writeUintLE value must be an integer");for(var A=1,E=_;E<_+b/8;E++)w[E]=v/A&255,A*=256;return w}binary.writeUintLE=writeUintLE;function readFloat32BE(b,v){v===void 0&&(v=0);var w=new DataView(b.buffer,b.byteOffset,b.byteLength);return w.getFloat32(v)}binary.readFloat32BE=readFloat32BE;function readFloat32LE(b,v){v===void 0&&(v=0);var w=new DataView(b.buffer,b.byteOffset,b.byteLength);return w.getFloat32(v,!0)}binary.readFloat32LE=readFloat32LE;function readFloat64BE(b,v){v===void 0&&(v=0);var w=new DataView(b.buffer,b.byteOffset,b.byteLength);return w.getFloat64(v)}binary.readFloat64BE=readFloat64BE;function readFloat64LE(b,v){v===void 0&&(v=0);var w=new DataView(b.buffer,b.byteOffset,b.byteLength);return w.getFloat64(v,!0)}binary.readFloat64LE=readFloat64LE;function writeFloat32BE(b,v,w){v===void 0&&(v=new Uint8Array(4)),w===void 0&&(w=0);var _=new DataView(v.buffer,v.byteOffset,v.byteLength);return _.setFloat32(w,b),v}binary.writeFloat32BE=writeFloat32BE;function writeFloat32LE(b,v,w){v===void 0&&(v=new Uint8Array(4)),w===void 0&&(w=0);var _=new DataView(v.buffer,v.byteOffset,v.byteLength);return _.setFloat32(w,b,!0),v}binary.writeFloat32LE=writeFloat32LE;function writeFloat64BE(b,v,w){v===void 0&&(v=new Uint8Array(8)),w===void 0&&(w=0);var _=new DataView(v.buffer,v.byteOffset,v.byteLength);return _.setFloat64(w,b),v}binary.writeFloat64BE=writeFloat64BE;function writeFloat64LE(b,v,w){v===void 0&&(v=new Uint8Array(8)),w===void 0&&(w=0);var _=new DataView(v.buffer,v.byteOffset,v.byteLength);return _.setFloat64(w,b,!0),v}binary.writeFloat64LE=writeFloat64LE;(function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.randomStringForEntropy=b.randomString=b.randomUint32=b.randomBytes=b.defaultRandomSource=void 0;const v=system,w=binary,_=wipe$1;b.defaultRandomSource=new v.SystemRandomSource;function A(q,B=b.defaultRandomSource){return B.randomBytes(q)}b.randomBytes=A;function E(q=b.defaultRandomSource){const B=A(4,q),O=(0,w.readUint32LE)(B);return(0,_.wipe)(B),O}b.randomUint32=E;const k="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function P(q,B=k,O=b.defaultRandomSource){if(B.length<2)throw new Error("randomString charset is too short");if(B.length>256)throw new Error("randomString charset is too long");let I="";const D=B.length,V=256-256%D;for(;q>0;){const ee=A(Math.ceil(q*256/V),O);for(let J=0;J<ee.length&&q>0;J++){const te=ee[J];te<V&&(I+=B.charAt(te%D),q--)}(0,_.wipe)(ee)}return I}b.randomString=P;function N(q,B=k,O=b.defaultRandomSource){const I=Math.ceil(q/(Math.log(B.length)/Math.LN2));return P(I,B,O)}b.randomStringForEntropy=N})(random);var __awaiter$1=commonjsGlobal&&commonjsGlobal.__awaiter||function(b,v,w,_){function A(E){return E instanceof w?E:new w(function(k){k(E)})}return new(w||(w=Promise))(function(E,k){function P(B){try{q(_.next(B))}catch(O){k(O)}}function N(B){try{q(_.throw(B))}catch(O){k(O)}}function q(B){B.done?E(B.value):A(B.value).then(P,N)}q((_=_.apply(b,v||[])).next())})};Object.defineProperty(utils$o,"__esModule",{value:!0});utils$o.checkInvalidKeys=utils$o.isValidISO8601Date=utils$o.generateNonce=utils$o.checkContractWalletSignature=void 0;const random_1=random,ethers_1=lib_commonjs$1,ethersCompat_1$1=ethersCompat,EIP1271_ABI=["function isValidSignature(bytes32 _message, bytes _signature) public view returns (bytes4)"],EIP1271_MAGICVALUE="0x1626ba7e",ISO8601=/^(?<date>[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]))[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(.[0-9]+)?(([Zz])|([+|-]([01][0-9]|2[0-3]):[0-5][0-9]))$/,checkContractWalletSignature=(b,v,w)=>__awaiter$1(void 0,void 0,void 0,function*(){if(!w)return!1;const _=new ethers_1.Contract(b.address,EIP1271_ABI,w),A=(0,ethersCompat_1$1.hashMessage)(b.prepareMessage());return(yield _.isValidSignature(A,v))===EIP1271_MAGICVALUE});utils$o.checkContractWalletSignature=checkContractWalletSignature;const generateNonce=()=>{const b=(0,random_1.randomStringForEntropy)(96);if(!b||b.length<8)throw new Error("Error during nonce creation.");return b};utils$o.generateNonce=generateNonce;const isValidISO8601Date=b=>{const v=ISO8601.exec(b);if(!b)return!1;const w=new Date(v.groups.date).toISOString(),_=ISO8601.exec(w);return v.groups.date===_.groups.date};utils$o.isValidISO8601Date=isValidISO8601Date;const checkInvalidKeys=(b,v)=>{const w=[];return Object.keys(b).forEach(_=>{v.includes(_)||w.push(_)}),w};utils$o.checkInvalidKeys=checkInvalidKeys;var __createBinding=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(b,v,w,_){_===void 0&&(_=w);var A=Object.getOwnPropertyDescriptor(v,w);(!A||("get"in A?!v.__esModule:A.writable||A.configurable))&&(A={enumerable:!0,get:function(){return v[w]}}),Object.defineProperty(b,_,A)}:function(b,v,w,_){_===void 0&&(_=w),b[_]=v[w]}),__setModuleDefault=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(b,v){Object.defineProperty(b,"default",{enumerable:!0,value:v})}:function(b,v){b.default=v}),__importStar=commonjsGlobal&&commonjsGlobal.__importStar||function(b){if(b&&b.__esModule)return b;var v={};if(b!=null)for(var w in b)w!=="default"&&Object.prototype.hasOwnProperty.call(b,w)&&__createBinding(v,b,w);return __setModuleDefault(v,b),v},__awaiter=commonjsGlobal&&commonjsGlobal.__awaiter||function(b,v,w,_){function A(E){return E instanceof w?E:new w(function(k){k(E)})}return new(w||(w=Promise))(function(E,k){function P(B){try{q(_.next(B))}catch(O){k(O)}}function N(B){try{q(_.throw(B))}catch(O){k(O)}}function q(B){B.done?E(B.value):A(B.value).then(P,N)}q((_=_.apply(b,v||[])).next())})};Object.defineProperty(client,"__esModule",{value:!0});client.SiweMessage=void 0;const siwe_parser_1=parsers,uri=__importStar(validUrlExports),ethersCompat_1=ethersCompat,types_1=types$4,utils_1=utils$o;class SiweMessage{constructor(v){if(typeof v=="string"){const w=new siwe_parser_1.ParsedMessage(v);this.scheme=w.scheme,this.domain=w.domain,this.address=w.address,this.statement=w.statement,this.uri=w.uri,this.version=w.version,this.nonce=w.nonce,this.issuedAt=w.issuedAt,this.expirationTime=w.expirationTime,this.notBefore=w.notBefore,this.requestId=w.requestId,this.chainId=w.chainId,this.resources=w.resources}else this.scheme=v?.scheme,this.domain=v.domain,this.address=v.address,this.statement=v?.statement,this.uri=v.uri,this.version=v.version,this.chainId=v.chainId,this.nonce=v.nonce,this.issuedAt=v?.issuedAt,this.expirationTime=v?.expirationTime,this.notBefore=v?.notBefore,this.requestId=v?.requestId,this.resources=v?.resources,typeof this.chainId=="string"&&(this.chainId=(0,siwe_parser_1.parseIntegerNumber)(this.chainId));this.nonce=this.nonce||(0,utils_1.generateNonce)(),this.validateMessage()}toMessage(){this.validateMessage();const w=`${this.scheme?`${this.scheme}://${this.domain}`:this.domain} wants you to sign in with your Ethereum account:`,_=`URI: ${this.uri}`;let A=[w,this.address].join(`
782
- `);const E=`Version: ${this.version}`;this.nonce||(this.nonce=(0,utils_1.generateNonce)());const k="Chain ID: "+this.chainId||"1",P=`Nonce: ${this.nonce}`,N=[_,E,k,P];if(this.issuedAt=this.issuedAt||new Date().toISOString(),N.push(`Issued At: ${this.issuedAt}`),this.expirationTime){const B=`Expiration Time: ${this.expirationTime}`;N.push(B)}this.notBefore&&N.push(`Not Before: ${this.notBefore}`),this.requestId&&N.push(`Request ID: ${this.requestId}`),this.resources&&N.push(["Resources:",...this.resources.map(B=>`- ${B}`)].join(`
783
- `));const q=N.join(`
784
- `);return A=[A,this.statement].join(`
785
-
786
- `),this.statement&&(A+=`
787
- `),[A,q].join(`
788
- `)}prepareMessage(){let v;switch(this.version){case"1":{v=this.toMessage();break}default:{v=this.toMessage();break}}return v}validate(v,w){return __awaiter(this,void 0,void 0,function*(){return console.warn("validate() has been deprecated, please update your code to use verify(). validate() may be removed in future versions."),this.verify({signature:v},{provider:w,suppressExceptions:!1}).then(({data:_})=>_).catch(({error:_})=>{throw _})})}verify(v,w={suppressExceptions:!1}){return __awaiter(this,void 0,void 0,function*(){return new Promise((_,A)=>{var E,k,P;const N=ce=>w.suppressExceptions?_(ce):A(ce),q=(0,utils_1.checkInvalidKeys)(v,types_1.VerifyParamsKeys);q.length>0&&N({success:!1,data:this,error:new Error(`${q.join(", ")} is/are not valid key(s) for VerifyParams.`)});const B=(0,utils_1.checkInvalidKeys)(w,types_1.VerifyOptsKeys);q.length>0&&N({success:!1,data:this,error:new Error(`${B.join(", ")} is/are not valid key(s) for VerifyOpts.`)});const{signature:O,scheme:I,domain:D,nonce:V,time:ee}=v;I&&I!==this.scheme&&N({success:!1,data:this,error:new types_1.SiweError(types_1.SiweErrorType.SCHEME_MISMATCH,I,this.scheme)}),D&&D!==this.domain&&N({success:!1,data:this,error:new types_1.SiweError(types_1.SiweErrorType.DOMAIN_MISMATCH,D,this.domain)}),V&&V!==this.nonce&&N({success:!1,data:this,error:new types_1.SiweError(types_1.SiweErrorType.NONCE_MISMATCH,V,this.nonce)});const J=new Date(ee||new Date);if(this.expirationTime){const ce=new Date(this.expirationTime);J.getTime()>=ce.getTime()&&N({success:!1,data:this,error:new types_1.SiweError(types_1.SiweErrorType.EXPIRED_MESSAGE,`${J.toISOString()} < ${ce.toISOString()}`,`${J.toISOString()} >= ${ce.toISOString()}`)})}if(this.notBefore){const ce=new Date(this.notBefore);J.getTime()<ce.getTime()&&N({success:!1,data:this,error:new types_1.SiweError(types_1.SiweErrorType.NOT_YET_VALID_MESSAGE,`${J.toISOString()} >= ${ce.toISOString()}`,`${J.toISOString()} < ${ce.toISOString()}`)})}let te;try{te=this.prepareMessage()}catch(ce){N({success:!1,data:this,error:ce})}let se;try{se=(0,ethersCompat_1.verifyMessage)(te,O)}catch(ce){console.error(ce)}if(se===this.address)return _({success:!0,data:this});{const ce=(0,utils_1.checkContractWalletSignature)(this,O,w.provider).then(ae=>ae?{success:!0,data:this}:{success:!1,data:this,error:new types_1.SiweError(types_1.SiweErrorType.INVALID_SIGNATURE,se,`Resolved address to be ${this.address}`)}).catch(ae=>({success:!1,data:this,error:ae}));Promise.all([ce,(P=(k=(E=w?.verificationFallback)===null||E===void 0?void 0:E.call(w,v,w,this,ce))===null||k===void 0?void 0:k.then(ae=>ae))===null||P===void 0?void 0:P.catch(ae=>ae)]).then(([ae,he])=>{if(he){if(he.success)return _(he);N(he)}else{if(ae.success)return _(ae);N(ae)}})}})})}validateMessage(...v){var w;if(v.length>0)throw new types_1.SiweError(types_1.SiweErrorType.UNABLE_TO_PARSE,"Unexpected argument in the validateMessage function.");if(!this.domain||this.domain.length===0||!/[^#?]*/.test(this.domain))throw new types_1.SiweError(types_1.SiweErrorType.INVALID_DOMAIN,`${this.domain} to be a valid domain.`);if(!(0,siwe_parser_1.isEIP55Address)(this.address))throw new types_1.SiweError(types_1.SiweErrorType.INVALID_ADDRESS,(0,ethersCompat_1.getAddress)(this.address),this.address);if(!uri.isUri(this.uri))throw new types_1.SiweError(types_1.SiweErrorType.INVALID_URI,`${this.uri} to be a valid uri.`);if(this.version!=="1")throw new types_1.SiweError(types_1.SiweErrorType.INVALID_MESSAGE_VERSION,"1",this.version);const _=(w=this===null||this===void 0?void 0:this.nonce)===null||w===void 0?void 0:w.match(/[a-zA-Z0-9]{8,}/);if(!_||this.nonce.length<8||_[0]!==this.nonce)throw new types_1.SiweError(types_1.SiweErrorType.INVALID_NONCE,`Length > 8 (${_.length}). Alphanumeric.`,this.nonce);if(this.issuedAt&&!(0,utils_1.isValidISO8601Date)(this.issuedAt))throw new Error(types_1.SiweErrorType.INVALID_TIME_FORMAT);if(this.expirationTime&&!(0,utils_1.isValidISO8601Date)(this.expirationTime))throw new Error(types_1.SiweErrorType.INVALID_TIME_FORMAT);if(this.notBefore&&!(0,utils_1.isValidISO8601Date)(this.notBefore))throw new Error(types_1.SiweErrorType.INVALID_TIME_FORMAT)}}client.SiweMessage=SiweMessage;(function(b){var v=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(_,A,E,k){k===void 0&&(k=E);var P=Object.getOwnPropertyDescriptor(A,E);(!P||("get"in P?!A.__esModule:P.writable||P.configurable))&&(P={enumerable:!0,get:function(){return A[E]}}),Object.defineProperty(_,k,P)}:function(_,A,E,k){k===void 0&&(k=E),_[k]=A[E]}),w=commonjsGlobal&&commonjsGlobal.__exportStar||function(_,A){for(var E in _)E!=="default"&&!Object.prototype.hasOwnProperty.call(A,E)&&v(A,_,E)};Object.defineProperty(b,"__esModule",{value:!0}),w(client,b),w(types$4,b),w(utils$o,b)})(siwe);class m{constructor(){this.memory=new Map}getItem(v){return this.memory.has(v)?this.memory.get(v):null}setItem(v,w){this.memory.set(v,w)}removeItem(v){this.memory.has(v)&&this.memory.delete(v)}}var t=(b=>(b.AUTH_TOKEN="auth_token",b))(t||{});class M{constructor(v,w,_){this.API="https://api.garden.finance",this.url=new r$1("/",v??this.API),this.walletClient=w,this.domain=_?.domain||"app.garden.finance",this.domain.startsWith("https://")&&(this.domain=this.domain.split("https://")[1]),this.signingStatement=_?.signingStatement??"Garden.fi",this.store=_?.store??new m}verifyToken(v,w){const _=T(v);if(!_)return utils$v.Ok(!1);try{const A=Math.floor(Date.now()/1e3)+120;return utils$v.Ok(_.exp>A&&_.address.toLowerCase()===w.toLowerCase())}catch{return utils$v.Ok(!1)}}async getToken(){var v;if(!((v=this.walletClient.account)!=null&&v.address))return utils$v.Err("Wallet client does not have an account");const w=this.store.getItem(t.AUTH_TOKEN);if(w){const k=this.verifyToken(w,this.walletClient.account.address);if(k.ok&&k.val)return utils$v.Ok(w)}const _=await this.signStatement();if(_.error)return utils$v.Err(_.error);const A=await utils$v.Fetcher.post(this.url.endpoint("verify"),{body:JSON.stringify({..._.val}),headers:{"Content-Type":"application/json"}});if(A.error)return utils$v.Err(A.error);const E=A.result;if(!E)return utils$v.Err("Failed to get token");if(!this.verifyToken(E,this.walletClient.account.address).val)throw new Error("Token verification failed");return this.store.setItem(t.AUTH_TOKEN,E),utils$v.Ok(E)}async signStatement(){var v,w,_;if(!((v=this.walletClient.chain)!=null&&v.id)||!((w=this.walletClient.account)!=null&&w.address))return utils$v.Err("Wallet client does not have a chain");const A=new Date,E=new Date(A.getTime()+300*1e3),k=(await utils$v.Fetcher.get(this.url.endpoint("nonce"))).result;if(!k)return utils$v.Err("Failed to get nonce");const P=(_=this.walletClient.chain)==null?void 0:_.id,N=new siwe.SiweMessage({domain:this.domain,address:this.walletClient.account.address,statement:this.signingStatement,nonce:k,uri:"https://"+this.domain,version:"1",chainId:P,expirationTime:E.toISOString()}).prepareMessage(),q=await this.walletClient.signMessage({account:this.walletClient.account,message:N});return utils$v.Ok({message:N,signature:q,nonce:k})}}const T=b=>{try{if(b.split(".").length<3)return;const v=b.split(".")[1];return v?JSON.parse(Buffer$D.from(v,"base64").toString("latin1")):void 0}catch{return}};var OrderStatus=(b=>(b.Created="Created",b.Matched="Matched",b.InitiateDetected="InitiateDetected",b.Initiated="Initiated",b.CounterPartyInitiateDetected="CounterPartyInitiateDetected",b.CounterPartyInitiated="CounterPartyInitiated",b.RedeemDetected="RedeemDetected",b.Redeemed="Redeemed",b.CounterPartyRedeemDetected="CounterPartyRedeemDetected",b.CounterPartyRedeemed="CounterPartyRedeemed",b.Completed="Completed",b.CounterPartySwapExpired="CounterPartySwapExpired",b.Expired="Expired",b.RefundDetected="RefundDetected",b.Refunded="Refunded",b.CounterPartyRefundDetected="CounterPartyRefundDetected",b.CounterPartyRefunded="CounterPartyRefunded",b.Cancelled="Cancelled",b))(OrderStatus||{}),SwapStatus=(b=>(b.Idle="Idle",b.InitiateDetected="InitiateDetected",b.Initiated="Initiated",b.RedeemDetected="RedeemDetected",b.Redeemed="Redeemed",b.RefundDetected="RefundDetected",b.Refunded="Refunded",b.Expired="Expired",b))(SwapStatus||{}),OrderActions=(b=>(b.Idle="Idle",b.Initiate="Initiate",b.Redeem="Redeem",b.Refund="Refund",b))(OrderActions||{}),OrderCacheAction=(b=>(b.init="init",b.redeem="redeem",b.refund="refund",b))(OrderCacheAction||{});const ParseOrderStatus=(b,v,w)=>{const _=ParseSwapStatus(b.source_swap,v),A=ParseSwapStatus(b.destination_swap,w);return _===SwapStatus.RedeemDetected?OrderStatus.CounterPartyRedeemDetected:_===SwapStatus.Redeemed?OrderStatus.CounterPartyRedeemed:A===SwapStatus.RedeemDetected?OrderStatus.RedeemDetected:A===SwapStatus.Redeemed?OrderStatus.Redeemed:A===SwapStatus.RefundDetected?OrderStatus.CounterPartyRefundDetected:A===SwapStatus.Refunded?OrderStatus.CounterPartyRefunded:_===SwapStatus.RefundDetected?OrderStatus.RefundDetected:_===SwapStatus.Refunded?OrderStatus.Refunded:A===SwapStatus.Expired?OrderStatus.CounterPartySwapExpired:_===SwapStatus.Expired?OrderStatus.Expired:A===SwapStatus.InitiateDetected?OrderStatus.CounterPartyInitiateDetected:A===SwapStatus.Initiated?OrderStatus.CounterPartyInitiated:_===SwapStatus.InitiateDetected?OrderStatus.InitiateDetected:_===SwapStatus.Initiated?OrderStatus.Initiated:OrderStatus.Matched},ParseSwapStatus=(b,v)=>{if(b.redeem_tx_hash)return b.redeem_block_number?SwapStatus.Redeemed:SwapStatus.RedeemDetected;if(b.refund_tx_hash)return b.refund_block_number?SwapStatus.Refunded:SwapStatus.RefundDetected;if(Number(b.initiate_block_number)){const w=Number(b.initiate_block_number)+b.timelock;if(v>w)return SwapStatus.Expired}return b.initiate_tx_hash?b.initiate_block_number?SwapStatus.Initiated:SwapStatus.InitiateDetected:SwapStatus.Idle},parseAction=(b,v,w)=>{const _=ParseOrderStatus(b,v,w);switch(console.log("orderStatus :",_),_){case OrderStatus.Matched:return OrderActions.Initiate;case OrderStatus.CounterPartyInitiated:return OrderActions.Redeem;case OrderStatus.Expired:return OrderActions.Refund;default:return OrderActions.Idle}};function defineChain(b){return{formatters:void 0,fees:void 0,serializers:void 0,...b}}const mainnet=defineChain({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),fetchEVMBlockNumber=async b=>{if(!b.chain)return utils$v.Err("No chain found");try{const w=await viem.createPublicClient({chain:b.chain,transport:viem.http()}).getBlockNumber();return utils$v.Ok(Number(w))}catch(v){return utils$v.Err("Failed to fetch evm block number",v)}},fetchBitcoinBlockNumber=async b=>{try{const v=await b.getLatestTip();return utils$v.Ok(v)}catch(v){return utils$v.Err("Failed to fetch bitcoin block number",v)}},fetchL1BlockNumber=async()=>{const b=viem.createPublicClient({chain:mainnet,transport:viem.http()});try{const v=await b.getBlockNumber();return utils$v.Ok(Number(v))}catch(v){return utils$v.Err("Failed to fetch evm block number",v)}},AtomicSwapABI=[{inputs:[{internalType:"address",name:"token_",type:"address"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"version",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"InvalidShortString",type:"error"},{inputs:[{internalType:"string",name:"str",type:"string"}],name:"StringTooLong",type:"error"},{anonymous:!1,inputs:[],name:"EIP712DomainChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"orderID",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"secretHash",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Initiated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"orderID",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"secretHash",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"secret",type:"bytes"}],name:"Redeemed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"orderID",type:"bytes32"}],name:"Refunded",type:"event"},{inputs:[],name:"eip712Domain",outputs:[{internalType:"bytes1",name:"fields",type:"bytes1"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"version",type:"string"},{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"address",name:"verifyingContract",type:"address"},{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"uint256[]",name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"redeemer",type:"address"},{internalType:"uint256",name:"timelock",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"secretHash",type:"bytes32"}],name:"initiate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"redeemer",type:"address"},{internalType:"uint256",name:"timelock",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"secretHash",type:"bytes32"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"initiateWithSignature",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"orderID",type:"bytes32"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"instantRefund",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"redeemer",type:"address"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"secretHash",type:"bytes32"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct HTLC.InitWithSig[]",name:"inits",type:"tuple[]"},{components:[{internalType:"bytes32",name:"orderID",type:"bytes32"},{internalType:"bytes",name:"secret",type:"bytes"}],internalType:"struct HTLC.Redeem[]",name:"redeems",type:"tuple[]"},{components:[{internalType:"bytes32",name:"orderID",type:"bytes32"}],internalType:"struct HTLC.Refund[]",name:"refunds",type:"tuple[]"}],name:"multicall",outputs:[{internalType:"bool[]",name:"results",type:"bool[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"orders",outputs:[{internalType:"bool",name:"isFulfilled",type:"bool"},{internalType:"address",name:"initiator",type:"address"},{internalType:"address",name:"redeemer",type:"address"},{internalType:"uint256",name:"initiatedAt",type:"uint256"},{internalType:"uint256",name:"timelock",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"orderID",type:"bytes32"},{internalType:"bytes",name:"secret",type:"bytes"}],name:"redeem",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"orderID",type:"bytes32"}],name:"refund",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"contract IERC20",name:"",type:"address"}],stateMutability:"view",type:"function"}];class EvmRelay{constructor(v,w,_){this.walletClient=w,this.url=new r$1("/relayer",v),this.auth=new M(this.url,w,{..._,store:_?.store||new m})}async init(v,w){if(!this.walletClient.account)return utils$v.Err("No account found");if(this.walletClient.account.address.toLowerCase()!==v.source_swap.initiator.toLowerCase())return utils$v.Err("Account and order initiator mismatch");if(ParseSwapStatus(v.source_swap,w)!==SwapStatus.Idle)return utils$v.Err("Invalid swap status");const{create_order:A,source_swap:E}=v;if(!E.amount||!E.redeemer||!A.timelock||!A.secret_hash)return utils$v.Err("Invalid order");const k=o$2(A.secret_hash),P=BigInt(A.timelock),N=o$2(E.redeemer),q=BigInt(E.amount);try{const B=await this.auth.getToken();if(B.error)return utils$v.Err(B.error);const O=viem.getContract({address:o$2(v.source_swap.asset),abi:AtomicSwapABI,client:this.walletClient}),I=await O.read.token(),D=await y(Number(q),I,v.source_swap.asset,this.walletClient);if(D.error)return utils$v.Err(D.error);const V=await O.read.eip712Domain(),ee=await this.walletClient.signTypedData({account:this.walletClient.account,domain:{name:V[1],version:V[2],chainId:Number(V[3]),verifyingContract:V[4]},types:{Initiate:[{name:"redeemer",type:"address"},{name:"timelock",type:"uint256"},{name:"amount",type:"uint256"},{name:"secretHash",type:"bytes32"}]},primaryType:"Initiate",message:{redeemer:N,timelock:P,amount:q,secretHash:k}}),J=await utils$v.Fetcher.post(this.url.endpoint("initiate"),{body:JSON.stringify({order_id:A.create_id,signature:ee,perform_on:"Source"}),headers:{Authorization:r$6(B.val),"Content-Type":"application/json"}});return J.error?utils$v.Err(J.error):J.result?utils$v.Ok(J.result):utils$v.Err("Init: No result found")}catch(B){return console.log("init error :",B),utils$v.Err(String(B))}}async redeem(v,w){try{const _=await this.auth.getToken();if(_.error)return utils$v.Err(_.error);const A=await utils$v.Fetcher.post(this.url.endpoint("redeem"),{body:JSON.stringify({order_id:v,secret:utils$v.trim0x(w),perform_on:"Destination"}),headers:{Authorization:r$6(_.val),"Content-Type":"application/json"}});return A.error?utils$v.Err(A.error):A.result?utils$v.Ok(A.result):utils$v.Err("Redeem: No result found")}catch(_){return utils$v.Err(String(_))}}}function xOnlyPubkey(b){return typeof b=="string"&&(b=Buffer$D.from(b,"hex")),b.length===32?b:b.subarray(1,33)}function assert$1(b,v){if(!b)throw new Error(v)}function serializeScript(b){return Buffer$D.concat([Uint8Array.from([192]),prefixScriptLength(b)])}function prefixScriptLength(b){const v=varuint__namespace.encodingLength(b.length),w=Buffer$D.allocUnsafe(v);return varuint__namespace.encode(b.length,w),Buffer$D.concat([w,b])}function sortLeaves(b,v){if(b.compare(v)>0){const w=b;b=v,v=w}return[b,v]}const toXOnly$1=b=>b.length===64?b:b.slice(2),G_X=Buffer$D.from("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","hex"),G_Y=Buffer$D.from("483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8","hex"),G=Buffer$D.concat([G_X,G_Y]),H=Buffer$D.from("0250929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0","hex"),errors$1={failedToCreateInternalPubkey:"failed to create internal pubkey",failedToTweakPubkey:"failed to tweak pubkey"};function generateInternalkey(){const b=bitcoin.crypto.sha256(Buffer$D.from("GardenHTLC","utf-8")),v=ecc__namespace.pointMultiply(Buffer$D.concat([Buffer$D.from("04","hex"),G]),b);if(!v)throw new Error(errors$1.failedToCreateInternalPubkey);const w=ecc__namespace.pointAdd(H,v);if(!w)throw new Error(errors$1.failedToCreateInternalPubkey);return xOnlyPubkey(Buffer$D.from(w))}const htlcErrors={secretMismatch:"invalid secret",secretHashLenMismatch:"secret hash should be 32 bytes",pubkeyLenMismatch:"pubkey should be 32 bytes",zeroOrNegativeExpiry:"expiry should be greater than 0",htlcAddressGenerationFailed:"failed to generate htlc address",notFunded:"address not funded",noCounterpartySigs:"counterparty signatures are required",counterPartySigNotFound:b=>"counterparty signature not found for utxo "+b,invalidCounterpartySigForUTXO:b=>"invalid counterparty signature for utxo "+b,htlcNotExpired:b=>`HTLC not expired, need more ${b} blocks`,controlBlockGenerationFailed:"failed to generate control block",invalidLeaf:"invalid leaf"},LEAF_VERSION=192;bitcoin__namespace.initEccLib(ecc__namespace);class GardenHTLC{constructor(v,w,_,A,E,k,P){this.secretHash=_,this.redeemerPubkey=A,this.initiatorPubkey=E,this.expiry=k,this.signer=v,this.network=P,this.internalPubkey=generateInternalkey(),this.initiateAmount=w}static async from(v,w,_,A,E,k){_=_.startsWith("0x")?_.slice(2):_,assert$1(_.length===64,htlcErrors.secretHashLenMismatch),assert$1(A.length===64||A.length===66,`initiator ${htlcErrors.pubkeyLenMismatch}`),assert$1(E.length===64||E.length===66,`redeemer ${htlcErrors.pubkeyLenMismatch}`),assert$1(k>0,htlcErrors.zeroOrNegativeExpiry);const P=await v.getNetwork();return new GardenHTLC(v,w,_,xOnlyPubkey(E).toString("hex"),xOnlyPubkey(A).toString("hex"),k,P)}address(){const{address:v}=bitcoin__namespace.payments.p2tr({internalPubkey:this.internalPubkey,network:this.network,scriptTree:this.leaves()});if(!v)throw new Error(htlcErrors.htlcAddressGenerationFailed);return v}id(){return this.address()}async _buildRawTx(v,w){const _=new bitcoin__namespace.Transaction;_.version=2;const A=this.address(),E=await this.signer.getProvider(),k=await E.getUTXOs(A),P=k.reduce((N,q)=>N+q.value,0);if(P===0)throw new Error(`${A} ${htlcErrors.notFunded}`);for(let N=0;N<k.length;N++)_.addInput(Buffer$D.from(k[N].txid,"hex").reverse(),k[N].vout);return w??=await E.suggestFee(A,P,wallets.Urgency.MEDIUM),_.addOutput(bitcoin__namespace.address.toOutputScript(v,this.network),P-w),{tx:_,usedUtxos:k}}async buildRawTx(v){return await this._buildRawTx(await this.signer.getAddress(),v)}getOutputScript(){return bitcoin__namespace.address.toOutputScript(this.address(),this.network)}async init(v){return v??=await(await this.signer.getProvider()).suggestFee(await this.signer.getAddress(),this.initiateAmount,wallets.Urgency.MEDIUM),await this.signer.send(this.address(),this.initiateAmount,v)}async instantRefund(v,w){assert$1(v.length>0,htlcErrors.noCounterpartySigs);const{tx:_,usedUtxos:A}=await this.buildRawTx(w);for(const O of A)if(!v.find(I=>I.utxo===O.txid))throw new Error(htlcErrors.counterPartySigNotFound(O.txid));const E=this.getOutputScript(),k=bitcoin__namespace.Transaction.SIGHASH_DEFAULT,P=this.leafHash(2),N=A.map(O=>O.value),q=generateOutputs(E,A.length);for(let O=0;O<_.ins.length;O++){const I=_.hashForWitnessV1(O,q,N,k,P);if(!ecc__namespace.verifySchnorr(I,Buffer$D.from(this.redeemerPubkey,"hex"),Buffer$D.from(v[O].sig,"hex")))throw new Error(htlcErrors.invalidCounterpartySigForUTXO(v[O].utxo));const D=await this.signer.signSchnorr(I),V=Buffer$D.from(_.ins[O].hash).reverse().toString("hex"),ee=v.find(J=>J.utxo===V);if(!ee)throw new Error(htlcErrors.counterPartySigNotFound(V));_.setWitness(O,[Buffer$D.from(ee.sig,"hex"),D,this.instantRefundLeaf(),this.generateControlBlockFor(2)])}return await(await this.signer.getProvider()).broadcast(_.toHex())}async redeem(v,w,_){assert$1(bitcoin__namespace.crypto.sha256(Buffer$D.from(v,"hex")).toString("hex")===this.secretHash,htlcErrors.secretMismatch);const{tx:A,usedUtxos:E}=await this._buildRawTx(w??await this.signer.getAddress(),_),k=this.leafHash(1),P=E.map(O=>O.value),N=generateOutputs(this.getOutputScript(),E.length),q=bitcoin__namespace.Transaction.SIGHASH_DEFAULT;for(let O=0;O<A.ins.length;O++){const I=A.hashForWitnessV1(O,N,P,q,k),D=await this.signer.signSchnorr(I);A.setWitness(O,[D,Buffer$D.from(v,"hex"),this.redeemLeaf(),this.generateControlBlockFor(1)])}return await(await this.signer.getProvider()).broadcast(A.toHex())}async refund(v,w){const{tx:_,usedUtxos:A}=await this._buildRawTx(v??await this.signer.getAddress(),w),[E,k]=await this.canRefund(A);if(!E)throw new Error(htlcErrors.htlcNotExpired(k));const P=this.leafHash(0),N=A.map(I=>I.value),q=generateOutputs(this.getOutputScript(),A.length),B=bitcoin__namespace.Transaction.SIGHASH_DEFAULT;for(let I=0;I<_.ins.length;I++){_.ins[I].sequence=this.expiry;const D=_.hashForWitnessV1(I,q,N,B,P),V=await this.signer.signSchnorr(D);_.setWitness(I,[V,this.refundLeaf(),this.generateControlBlockFor(0)])}return await(await this.signer.getProvider()).broadcast(_.toHex())}async canRefund(v){const _=await(await this.signer.getProvider()).getLatestTip();for(const A of v){let E=0;if(A.status.confirmed&&A.status.block_height+this.expiry>_?E=A.status.block_height+this.expiry-_+1:A.status.confirmed||(E=this.expiry+1),E>0)return[!1,E]}return[!0,0]}generateControlBlockFor(v){let w;switch(v){case 1:w=this.redeemLeaf();break;case 0:w=this.refundLeaf();break;case 2:w=this.instantRefundLeaf();break;default:throw new Error(htlcErrors.invalidLeaf)}const _=bitcoin__namespace.payments.p2tr({internalPubkey:this.internalPubkey,network:this.network,scriptTree:this.leaves(),redeem:{output:w,redeemVersion:LEAF_VERSION}});if(!_.witness)throw new Error(htlcErrors.controlBlockGenerationFailed);return _.witness[_.witness.length-1]}leafHash(v){let w=this.redeemLeaf();return v===0&&(w=this.refundLeaf()),v===2&&(w=this.instantRefundLeaf()),bitcoin__namespace.crypto.taggedHash("TapLeaf",serializeScript(w))}refundLeaf(){return bitcoin__namespace.script.fromASM(`
789
- ${bitcoin__namespace.script.number.encode(this.expiry).toString("hex")}
1
+ "use strict";var Di=Object.defineProperty;var $i=(e,t,r)=>t in e?Di(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var it=(e,t,r)=>$i(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("@catalogfi/utils"),te=require("@gardenfi/orderbook"),Oe=require("viem"),Hi=require("varuint-bitcoin"),ji=require("tiny-secp256k1"),Jr=require("@catalogfi/wallets"),Ln=require("bitcoinjs-lib");function $r(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Yr=$r(Hi),ct=$r(ji),de=$r(Ln);var Br=(e=>(e[e.evm=14400]="evm",e[e.btc=288]="btc",e))(Br||{}),Re=(e=>(e.Idle="Idle",e.Initiate="Initiate",e.Redeem="Redeem",e.Refund="Refund",e))(Re||{});const We=e=>e.startsWith("0x")?e:`0x${e}`,Qr=e=>`Bearer ${e}`,qi=e=>new Promise(t=>setTimeout(t,e)),Mn="2.21.30";let Nt={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${Mn}`},Ze=class Rr extends Error{constructor(t,r={}){var n;const o=(()=>{var p;return r.cause instanceof Rr?r.cause.details:(p=r.cause)!=null&&p.message?r.cause.message:r.details})(),s=r.cause instanceof Rr&&r.cause.docsPath||r.docsPath,c=(n=Nt.getDocsUrl)==null?void 0:n.call(Nt,{...r,docsPath:s}),u=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...c?[`Docs: ${c}`]:[],...o?[`Details: ${o}`]:[],...Nt.version?[`Version: ${Nt.version}`]:[]].join(`
2
+ `);super(u,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=o,this.docsPath=s,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=t,this.version=Mn}walk(t){return Un(this,t)}};function Un(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e?Un(e.cause,t):t?null:e}let Dn=class extends Ze{constructor({blockHash:t,blockNumber:r}){let n="Block";t&&(n=`Block at hash "${t}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}},$n=class extends Ze{constructor({blockHash:t,blockNumber:r,blockTag:n,hash:o,index:s}){let c="Transaction";n&&s!==void 0&&(c=`Transaction at block time "${n}" at index "${s}"`),t&&s!==void 0&&(c=`Transaction at block hash "${t}" at index "${s}"`),r&&s!==void 0&&(c=`Transaction at block number "${r}" at index "${s}"`),o&&(c=`Transaction with hash "${o}"`),super(`${c} could not be found.`,{name:"TransactionNotFoundError"})}};class Hn extends Ze{constructor({hash:t}){super(`Transaction receipt with hash "${t}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}let Wi=class extends Ze{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}};function st(e,t,r){const n=e[t.name];if(typeof n=="function")return n;const o=e[r];return typeof o=="function"?o:s=>t(e,s)}const sr=new Map,Xr=new Map;let Gi=0;function Sr(e,t,r){const n=++Gi,o=()=>sr.get(e)||[],s=()=>{const g=o();sr.set(e,g.filter(w=>w.id!==n))},c=()=>{const g=Xr.get(e);o().length===1&&g&&g(),s()},u=o();if(sr.set(e,[...u,{id:n,fns:t}]),u&&u.length>0)return c;const p={};for(const g in t)p[g]=(...w)=>{var x,k;const R=o();if(R.length!==0)for(const C of R)(k=(x=C.fns)[g])==null||k.call(x,...w)};const y=r(p);return typeof y=="function"&&Xr.set(e,y),c}async function Ir(e){return new Promise(t=>setTimeout(t,e))}function Zr(e,{delay:t=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((o,s)=>{const c=async({count:u=0}={})=>{const p=async({error:y})=>{const g=typeof t=="function"?t({count:u,error:y}):t;g&&await Ir(g),c({count:u+1})};try{const y=await e();o(y)}catch(y){if(u<r&&await n({count:u,error:y}))return p({error:y});s(y)}};c()})}const kr=(e,t,r)=>JSON.stringify(e,(n,o)=>typeof o=="bigint"?o.toString():o,r);class zi extends Ze{constructor({max:t,min:r,signed:n,size:o,value:s}){super(`Number "${s}" is not in safe ${o?`${o*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${t?`(${r} to ${t})`:`(above ${r})`}`,{name:"IntegerOutOfRangeError"})}}let Ki=class extends Ze{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};class jn extends Ze{constructor({size:t,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}function Vi(e,{dir:t,size:r=32}={}){return typeof e=="string"?Ji(e,{dir:t,size:r}):Yi(e,{dir:t,size:r})}function Ji(e,{dir:t,size:r=32}={}){if(r===null)return e;const n=e.replace("0x","");if(n.length>r*2)throw new jn({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](r*2,"0")}`}function Yi(e,{dir:t,size:r=32}={}){if(r===null)return e;if(e.length>r)throw new jn({size:e.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let o=0;o<r;o++){const s=t==="right";n[s?o:r-o-1]=e[s?o:e.length-o-1]}return n}function Ut(e,t={}){const{signed:r,size:n}=t,o=BigInt(e);let s;n?r?s=(1n<<BigInt(n)*8n-1n)-1n:s=2n**(BigInt(n)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const c=typeof s=="bigint"&&r?-s-1n:0;if(s&&o>s||o<c){const p=typeof e=="bigint"?"n":"";throw new zi({max:s?`${s}${p}`:void 0,min:`${c}${p}`,signed:r,size:n,value:`${e}${p}`})}const u=`0x${(r&&o<0?(1n<<BigInt(n*8))+BigInt(o):o).toString(16)}`;return n?Vi(u,{size:n}):u}function Qi(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function en(e){return Qi(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function Xi(e,{size:t}){if(en(e)>t)throw new Ki({givenSize:en(e),maxSize:t})}function qn(e,t={}){const{signed:r}=t;t.size&&Xi(e,{size:t.size});const n=BigInt(e);if(!r)return n;const o=(e.length-2)/2,s=(1n<<BigInt(o)*8n-1n)-1n;return n<=s?n:n-BigInt(`0x${"f".padStart(o*2,"f")}`)-1n}function Tr(e,t={}){return Number(qn(e,t))}const Wn={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Gn(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Tr(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?Tr(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Wn[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(t.authorizationList=Zi(e.authorizationList)),t.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof t.v=="bigint"){if(t.v===0n||t.v===27n)return 0;if(t.v===1n||t.v===28n)return 1;if(t.v>=35n)return t.v%2n===0n?1:0}})(),t.type==="legacy"&&(delete t.accessList,delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas,delete t.yParity),t.type==="eip2930"&&(delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas),t.type==="eip1559"&&delete t.maxFeePerBlobGas,t}function Zi(e){return e.map(t=>({contractAddress:t.address,chainId:Number(t.chainId),nonce:Number(t.nonce),r:t.r,s:t.s,yParity:Number(t.yParity)}))}function ea(e){var t;const r=(t=e.transactions)==null?void 0:t.map(n=>typeof n=="string"?n:Gn(n));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:r,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}async function ta(e,{blockHash:t,blockNumber:r,blockTag:n,includeTransactions:o}={}){var s,c,u;const p=n??"latest",y=o??!1,g=r!==void 0?Ut(r):void 0;let w=null;if(t?w=await e.request({method:"eth_getBlockByHash",params:[t,y]},{dedupe:!0}):w=await e.request({method:"eth_getBlockByNumber",params:[g||p,y]},{dedupe:!!g}),!w)throw new Dn({blockHash:t,blockNumber:r});return(((u=(c=(s=e.chain)==null?void 0:s.formatters)==null?void 0:c.block)==null?void 0:u.format)||ea)(w)}async function ra(e,{blockHash:t,blockNumber:r,blockTag:n,hash:o,index:s}){var c,u,p;const y=n||"latest",g=r!==void 0?Ut(r):void 0;let w=null;if(o?w=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?w=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,Ut(s)]},{dedupe:!0}):(g||y)&&(w=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[g||y,Ut(s)]},{dedupe:!!g})),!w)throw new $n({blockHash:t,blockNumber:r,blockTag:y,hash:o,index:s});return(((p=(u=(c=e.chain)==null?void 0:c.formatters)==null?void 0:u.transaction)==null?void 0:p.format)||Gn)(w)}function na(e,{args:t,eventName:r}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...r?{args:t,eventName:r}:{}}}const ia={"0x0":"reverted","0x1":"success"};function aa(e){const t={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(r=>na(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Tr(e.transactionIndex):null,status:e.status?ia[e.status]:null,type:e.type?Wn[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}async function tn(e,{hash:t}){var r,n,o;const s=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!s)throw new Hn({hash:t});return(((o=(n=(r=e.chain)==null?void 0:r.formatters)==null?void 0:n.transactionReceipt)==null?void 0:o.format)||aa)(s)}function oa(e,{emitOnBegin:t,initialWaitTime:r,interval:n}){let o=!0;const s=()=>o=!1;return(async()=>{let c;t&&(c=await e({unpoll:s}));const u=await(r==null?void 0:r(c))??n;await Ir(u);const p=async()=>{o&&(await e({unpoll:s}),await Ir(n),p())};p()})(),s}const sa=new Map,fa=new Map;function ua(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:c=>s.set(o,c)}),r=t(e,sa),n=t(e,fa);return{clear:()=>{r.clear(),n.clear()},promise:r,response:n}}async function ca(e,{cacheKey:t,cacheTime:r=Number.POSITIVE_INFINITY}){const n=ua(t),o=n.response.get();if(o&&r>0&&new Date().getTime()-o.created.getTime()<r)return o.data;let s=n.promise.get();s||(s=e(),n.promise.set(s));try{const c=await s;return n.response.set({created:new Date,data:c}),c}finally{n.promise.clear()}}const la=e=>`blockNumber.${e}`;async function ha(e,{cacheTime:t=e.cacheTime}={}){const r=await ca(()=>e.request({method:"eth_blockNumber"}),{cacheKey:la(e.uid),cacheTime:t});return BigInt(r)}function da(e,{emitOnBegin:t=!1,emitMissed:r=!1,onBlockNumber:n,onError:o,poll:s,pollingInterval:c=e.pollingInterval}){const u=typeof s<"u"?s:!(e.transport.type==="webSocket"||e.transport.type==="fallback"&&e.transport.transports[0].config.type==="webSocket");let p;return u?(()=>{const y=kr(["watchBlockNumber",e.uid,t,r,c]);return Sr(y,{onBlockNumber:n,onError:o},g=>oa(async()=>{var w;try{const x=await st(e,ha,"getBlockNumber")({cacheTime:0});if(p){if(x===p)return;if(x-p>1&&r)for(let k=p+1n;k<x;k++)g.onBlockNumber(k,p),p=k}(!p||x>p)&&(g.onBlockNumber(x,p),p=x)}catch(x){(w=g.onError)==null||w.call(g,x)}},{emitOnBegin:t,interval:c}))})():(()=>{const y=kr(["watchBlockNumber",e.uid,t,r]);return Sr(y,{onBlockNumber:n,onError:o},g=>{let w=!0,x=()=>w=!1;return(async()=>{try{const k=(()=>{if(e.transport.type==="fallback"){const C=e.transport.transports.find(E=>E.config.type==="webSocket");return C?C.value:e.transport}return e.transport})(),{unsubscribe:R}=await k.subscribe({params:["newHeads"],onData(C){var E;if(!w)return;const T=qn((E=C.result)==null?void 0:E.number);g.onBlockNumber(T,p),p=T},onError(C){var E;(E=g.onError)==null||E.call(g,C)}});x=R,w||x()}catch(k){o==null||o(k)}})(),()=>x()})})()}async function pa(e,{confirmations:t=1,hash:r,onReplaced:n,pollingInterval:o=e.pollingInterval,retryCount:s=6,retryDelay:c=({count:p})=>~~(1<<p)*200,timeout:u=18e4}){const p=kr(["waitForTransactionReceipt",e.uid,r]);let y,g,w,x=!1;return new Promise((k,R)=>{u&&setTimeout(()=>R(new Wi({hash:r})),u);const C=Sr(p,{onReplaced:n,resolve:k,reject:R},E=>{const T=st(e,da,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:o,async onBlockNumber(O){const F=L=>{T(),L(),C()};let N=O;if(!x)try{if(w){if(t>1&&(!w.blockNumber||N-w.blockNumber+1n<t))return;F(()=>E.resolve(w));return}if(y||(x=!0,await Zr(async()=>{y=await st(e,ra,"getTransaction")({hash:r}),y.blockNumber&&(N=y.blockNumber)},{delay:c,retryCount:s}),x=!1),w=await st(e,tn,"getTransactionReceipt")({hash:r}),t>1&&(!w.blockNumber||N-w.blockNumber+1n<t))return;F(()=>E.resolve(w))}catch(L){if(L instanceof $n||L instanceof Hn){if(!y){x=!1;return}try{g=y,x=!0;const S=await Zr(()=>st(e,ta,"getBlock")({blockNumber:N,includeTransactions:!0}),{delay:c,retryCount:s,shouldRetry:({error:U})=>U instanceof Dn});x=!1;const j=S.transactions.find(({from:U,nonce:ee})=>U===g.from&&ee===g.nonce);if(!j||(w=await st(e,tn,"getTransactionReceipt")({hash:j.hash}),t>1&&(!w.blockNumber||N-w.blockNumber+1n<t)))return;let D="replaced";j.to===g.to&&j.value===g.value?D="repriced":j.from===j.to&&j.value===0n&&(D="cancelled"),F(()=>{var U;(U=E.onReplaced)==null||U.call(E,{reason:D,replacedTransaction:g,transaction:j,transactionReceipt:w}),E.resolve(w)})}catch(S){F(()=>E.reject(S))}}else F(()=>E.reject(L))}}})})})}const ba=async(e,t,r,n)=>{if(!n.account)return P.Err("No account found");console.log("walletClient.chain",n.chain);const o=Oe.getContract({address:We(t),abi:Oe.erc20Abi,client:n}),s=await n.getAddresses();if(!s[0])return P.Err("No account found");try{const c=await o.read.allowance([We(s[0]),We(r)]);if(BigInt(c)<BigInt(e)){const u=await o.write.approve([We(r),Oe.maxUint256],{account:n.account,chain:n.chain});return(await pa(n,{hash:u})).status!=="success"?P.Err("Failed to approve"):P.Ok(u)}return P.Ok("Already approved")}catch(c){return P.Err("Failed to approve: "+c)}};class Rt extends URL{constructor(t,r){super(t,r)}endpoint(t){t.startsWith("/")||(t=`/${t}`);const r=`${this.pathname!=="/"?this.pathname:""}${t}`;return new Rt(r,this)}socket(){if(this.protocol==="https:")return this.origin.replace("https","wss");if(this.protocol==="http:")return this.origin.replace("http","ws");throw new Error("Invalid protocol")}addSearchParams(t){const r=new URLSearchParams(this.search);for(const n in t)r.set(n,t[n]);return new Rt(`${this.pathname}?${r.toString()}`,this)}}class ya{constructor(){this.memory=new Map}getItem(t){return this.memory.has(t)?this.memory.get(t):null}setItem(t,r){this.memory.set(t,r)}removeItem(t){this.memory.has(t)&&this.memory.delete(t)}}function zn(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}const ga=zn({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),_a=zn({id:11155111,name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc2.sepolia.org"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:751532},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",blockCreated:5317080}},testnet:!0}),rn={42161:ga,421614:_a},Ar=async e=>{if(!e.chain)return P.Err("No chain found");const t=Object.keys(rn).includes(e.chain.id.toString())?rn[e.chain.id]:e.chain;return await ma(t)},ma=async e=>{const t=Oe.createPublicClient({chain:e,transport:Oe.http()});try{const r=await t.getBlockNumber();return P.Ok(Number(r))}catch(r){return P.Err("Failed to fetch evm block number",r)}},nn=async e=>{try{const t=await e.getLatestTip();return P.Ok(t)}catch(t){return P.Err("Failed to fetch bitcoin block number",t)}};function Vt(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}const wa=Vt({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),va=Vt({id:421614,name:"Arbitrum Sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://sepolia.arbiscan.io",apiUrl:"https://api-sepolia.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:81930}},testnet:!0}),xa=Vt({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),Ea=Vt({id:11155111,name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc2.sepolia.org"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:751532},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",blockCreated:5317080}},testnet:!0});function Cr(e){return typeof e=="string"&&(e=Buffer.from(e,"hex")),e.length===32?e:e.subarray(1,33)}function at(e,t){if(!e)throw new Error(t)}function Ba(e){return Buffer.concat([Uint8Array.from([192]),Ra(e)])}function Ra(e){const t=Yr.encodingLength(e.length),r=Buffer.allocUnsafe(t);return Yr.encode(e.length,r),Buffer.concat([r,e])}function Sa(e,t){if(e.compare(t)>0){const r=e;e=t,t=r}return[e,t]}const Ft=e=>e.length===64?e:e.slice(2),Ia=e=>{if(!e)return!1;try{const t=Buffer.from(e,"hex");return ct.isPoint(t)}catch{return!1}},ka={ethereum:xa,ethereum_arbitrum:wa,ethereum_sepolia:Ea,arbitrum_sepolia:va,ethereum_localnet:te.EthereumLocalnet,arbitrum_localnet:te.ArbitrumLocalnet},Ta=async(e,t)=>{var n;const r=ka[e];if(r)try{return r.id===((n=t.chain)==null?void 0:n.id)?P.Ok("Already on chain"):(await t.switchChain({id:r.id}),P.Ok("Switched chain"))}catch(o){if(Aa(o))try{return await t.addChain({chain:r}),P.Ok("Added and switched chain")}catch{return P.Err("Failed to add network")}else return P.Err("Failed to switch network")}else return P.Err("Chain not supported")},Aa=e=>typeof e=="object"&&e!==null&&"code"in e&&e.code===4902;var oe=(e=>(e.Created="Created",e.Matched="Matched",e.InitiateDetected="InitiateDetected",e.Initiated="Initiated",e.CounterPartyInitiateDetected="CounterPartyInitiateDetected",e.CounterPartyInitiated="CounterPartyInitiated",e.RedeemDetected="RedeemDetected",e.Redeemed="Redeemed",e.CounterPartyRedeemDetected="CounterPartyRedeemDetected",e.CounterPartyRedeemed="CounterPartyRedeemed",e.Completed="Completed",e.CounterPartySwapExpired="CounterPartySwapExpired",e.Expired="Expired",e.RefundDetected="RefundDetected",e.Refunded="Refunded",e.CounterPartyRefundDetected="CounterPartyRefundDetected",e.CounterPartyRefunded="CounterPartyRefunded",e.Cancelled="Cancelled",e))(oe||{}),Z=(e=>(e.Idle="Idle",e.InitiateDetected="InitiateDetected",e.Initiated="Initiated",e.RedeemDetected="RedeemDetected",e.Redeemed="Redeemed",e.RefundDetected="RefundDetected",e.Refunded="Refunded",e.Expired="Expired",e))(Z||{});const Kn=(e,t,r)=>{const n=Ht(e.source_swap,t),o=Ht(e.destination_swap,r);return n===Z.RedeemDetected?oe.CounterPartyRedeemDetected:n===Z.Redeemed?oe.CounterPartyRedeemed:o===Z.RedeemDetected?oe.RedeemDetected:o===Z.Redeemed?oe.Redeemed:o===Z.RefundDetected?oe.CounterPartyRefundDetected:o===Z.Refunded?oe.CounterPartyRefunded:n===Z.RefundDetected?oe.RefundDetected:n===Z.Refunded?oe.Refunded:o===Z.Expired?oe.CounterPartySwapExpired:n===Z.Expired?oe.Expired:o===Z.InitiateDetected?oe.CounterPartyInitiateDetected:o===Z.Initiated?oe.CounterPartyInitiated:n===Z.InitiateDetected?oe.InitiateDetected:n===Z.Initiated?oe.Initiated:oe.Matched},Ht=(e,t)=>{if(e.redeem_tx_hash)return e.redeem_block_number?Z.Redeemed:Z.RedeemDetected;if(e.refund_tx_hash)return e.refund_block_number?Z.Refunded:Z.RefundDetected;if(Number(e.initiate_block_number)){const r=Number(e.initiate_block_number)+e.timelock;if(t>r)return Z.Expired}return e.initiate_tx_hash?e.initiate_block_number?Z.Initiated:Z.InitiateDetected:Z.Idle},Vn=(e,t,r)=>{switch(Kn(e,t,r)){case oe.Matched:return Re.Initiate;case oe.CounterPartyInitiated:return Re.Redeem;case oe.Expired:return Re.Refund;default:return Re.Idle}},Ca=[{inputs:[{internalType:"address",name:"token_",type:"address"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"version",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"InvalidShortString",type:"error"},{inputs:[{internalType:"string",name:"str",type:"string"}],name:"StringTooLong",type:"error"},{anonymous:!1,inputs:[],name:"EIP712DomainChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"orderID",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"secretHash",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Initiated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"orderID",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"secretHash",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"secret",type:"bytes"}],name:"Redeemed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"orderID",type:"bytes32"}],name:"Refunded",type:"event"},{inputs:[],name:"eip712Domain",outputs:[{internalType:"bytes1",name:"fields",type:"bytes1"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"version",type:"string"},{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"address",name:"verifyingContract",type:"address"},{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"uint256[]",name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"redeemer",type:"address"},{internalType:"uint256",name:"timelock",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"secretHash",type:"bytes32"}],name:"initiate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"redeemer",type:"address"},{internalType:"uint256",name:"timelock",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"secretHash",type:"bytes32"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"initiateWithSignature",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"orderID",type:"bytes32"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"instantRefund",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"redeemer",type:"address"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"secretHash",type:"bytes32"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct HTLC.InitWithSig[]",name:"inits",type:"tuple[]"},{components:[{internalType:"bytes32",name:"orderID",type:"bytes32"},{internalType:"bytes",name:"secret",type:"bytes"}],internalType:"struct HTLC.Redeem[]",name:"redeems",type:"tuple[]"},{components:[{internalType:"bytes32",name:"orderID",type:"bytes32"}],internalType:"struct HTLC.Refund[]",name:"refunds",type:"tuple[]"}],name:"multicall",outputs:[{internalType:"bool[]",name:"results",type:"bool[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"orders",outputs:[{internalType:"bool",name:"isFulfilled",type:"bool"},{internalType:"address",name:"initiator",type:"address"},{internalType:"address",name:"redeemer",type:"address"},{internalType:"uint256",name:"initiatedAt",type:"uint256"},{internalType:"uint256",name:"timelock",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"orderID",type:"bytes32"},{internalType:"bytes",name:"secret",type:"bytes"}],name:"redeem",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"orderID",type:"bytes32"}],name:"refund",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"contract IERC20",name:"",type:"address"}],stateMutability:"view",type:"function"}];class Jn{constructor(t,r,n){this.url=new Rt("/relayer",r),this.auth=n,this.order=t}async init(t,r){if(!t.account)return P.Err("No account found");if(t.account.address.toLowerCase()!==this.order.source_swap.initiator.toLowerCase())return P.Err("Account and order initiator mismatch");if(!r){const g=await Ar(t);if(g.error)return P.Err(g.error);r=g.val}if(Ht(this.order.source_swap,r)!==Z.Idle)return P.Err("Invalid swap status");const{create_order:o,source_swap:s}=this.order;if(!s.amount||!s.redeemer||!o.timelock||!o.secret_hash)return P.Err("Invalid order");const c=We(o.secret_hash),u=BigInt(o.timelock),p=We(s.redeemer),y=BigInt(s.amount);try{const g=await this.auth.getToken();if(g.error)return P.Err(g.error);const w=Oe.getContract({address:We(this.order.source_swap.asset),abi:Ca,client:t}),x=await w.read.token(),k=await ba(Number(y),x,this.order.source_swap.asset,t);if(k.error)return P.Err(k.error);const R=await w.read.eip712Domain(),C=await t.signTypedData({account:t.account,domain:{name:R[1],version:R[2],chainId:Number(R[3]),verifyingContract:R[4]},types:{Initiate:[{name:"redeemer",type:"address"},{name:"timelock",type:"uint256"},{name:"amount",type:"uint256"},{name:"secretHash",type:"bytes32"}]},primaryType:"Initiate",message:{redeemer:p,timelock:u,amount:y,secretHash:c}}),E=await P.Fetcher.post(this.url.endpoint("initiate"),{body:JSON.stringify({order_id:o.create_id,signature:C,perform_on:"Source"}),headers:{Authorization:Qr(g.val),"Content-Type":"application/json"}});return E.error?P.Err(E.error):E.result?P.Ok(E.result):P.Err("Init: No result found")}catch(g){return console.log("init error :",g),P.Err(String(g))}}async redeem(t,r){try{const n=await this.auth.getToken();if(n.error)return P.Err(n.error);const o=await P.Fetcher.post(this.url.endpoint("redeem"),{body:JSON.stringify({order_id:t,secret:P.trim0x(r),perform_on:"Destination"}),headers:{Authorization:Qr(n.val),"Content-Type":"application/json"}});return o.error?P.Err(o.error):o.result?P.Ok(o.result):P.Err("Redeem: No result found")}catch(n){return P.Err(String(n))}}}const Pa=Buffer.from("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","hex"),Oa=Buffer.from("483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8","hex"),Na=Buffer.concat([Pa,Oa]),Fa=Buffer.from("0250929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0","hex"),an={failedToCreateInternalPubkey:"failed to create internal pubkey",failedToTweakPubkey:"failed to tweak pubkey"};function La(){const e=Ln.crypto.sha256(Buffer.from("GardenHTLC","utf-8")),t=ct.pointMultiply(Buffer.concat([Buffer.from("04","hex"),Na]),e);if(!t)throw new Error(an.failedToCreateInternalPubkey);const r=ct.pointAdd(Fa,t);if(!r)throw new Error(an.failedToCreateInternalPubkey);return Cr(Buffer.from(r))}const be={secretMismatch:"invalid secret",secretHashLenMismatch:"secret hash should be 32 bytes",pubkeyLenMismatch:"pubkey should be 32 bytes",zeroOrNegativeExpiry:"expiry should be greater than 0",htlcAddressGenerationFailed:"failed to generate htlc address",notFunded:"address not funded",noCounterpartySigs:"counterparty signatures are required",counterPartySigNotFound:e=>"counterparty signature not found for utxo "+e,invalidCounterpartySigForUTXO:e=>"invalid counterparty signature for utxo "+e,htlcNotExpired:e=>`HTLC not expired, need more ${e} blocks`,controlBlockGenerationFailed:"failed to generate control block",invalidLeaf:"invalid leaf"},Lt=192;de.initEccLib(ct);class jt{constructor(t,r,n,o,s,c,u){this.secretHash=n,this.redeemerPubkey=o,this.initiatorPubkey=s,this.expiry=c,this.signer=t,this.network=u,this.internalPubkey=La(),this.initiateAmount=r}static async from(t,r,n,o,s,c){n=n.startsWith("0x")?n.slice(2):n,at(n.length===64,be.secretHashLenMismatch),at(o.length===64||o.length===66,`initiator ${be.pubkeyLenMismatch}`),at(s.length===64||s.length===66,`redeemer ${be.pubkeyLenMismatch}`),at(c>0,be.zeroOrNegativeExpiry);const u=await t.getNetwork();return new jt(t,r,n,Cr(s).toString("hex"),Cr(o).toString("hex"),c,u)}address(){const{address:t}=de.payments.p2tr({internalPubkey:this.internalPubkey,network:this.network,scriptTree:this.leaves()});if(!t)throw new Error(be.htlcAddressGenerationFailed);return t}id(){return this.address()}async _buildRawTx(t,r){const n=new de.Transaction;n.version=2;const o=this.address(),s=await this.signer.getProvider(),c=await s.getUTXOs(o),u=c.reduce((p,y)=>p+y.value,0);if(u===0)throw new Error(`${o} ${be.notFunded}`);for(let p=0;p<c.length;p++)n.addInput(Buffer.from(c[p].txid,"hex").reverse(),c[p].vout);return r??(r=await s.suggestFee(o,u,Jr.Urgency.MEDIUM)),n.addOutput(de.address.toOutputScript(t,this.network),u-r),{tx:n,usedUtxos:c}}async buildRawTx(t){return await this._buildRawTx(await this.signer.getAddress(),t)}getOutputScript(){return de.address.toOutputScript(this.address(),this.network)}async init(t){return t??(t=await(await this.signer.getProvider()).suggestFee(await this.signer.getAddress(),this.initiateAmount,Jr.Urgency.MEDIUM)),await this.signer.send(this.address(),this.initiateAmount,t)}async instantRefund(t,r){at(t.length>0,be.noCounterpartySigs);const{tx:n,usedUtxos:o}=await this.buildRawTx(r);for(const w of o)if(!t.find(x=>x.utxo===w.txid))throw new Error(be.counterPartySigNotFound(w.txid));const s=this.getOutputScript(),c=de.Transaction.SIGHASH_DEFAULT,u=this.leafHash(2),p=o.map(w=>w.value),y=fr(s,o.length);for(let w=0;w<n.ins.length;w++){const x=n.hashForWitnessV1(w,y,p,c,u);if(!ct.verifySchnorr(x,Buffer.from(this.redeemerPubkey,"hex"),Buffer.from(t[w].sig,"hex")))throw new Error(be.invalidCounterpartySigForUTXO(t[w].utxo));const k=await this.signer.signSchnorr(x),R=Buffer.from(n.ins[w].hash).reverse().toString("hex"),C=t.find(E=>E.utxo===R);if(!C)throw new Error(be.counterPartySigNotFound(R));n.setWitness(w,[Buffer.from(C.sig,"hex"),k,this.instantRefundLeaf(),this.generateControlBlockFor(2)])}return await(await this.signer.getProvider()).broadcast(n.toHex())}async redeem(t,r,n){at(de.crypto.sha256(Buffer.from(t,"hex")).toString("hex")===this.secretHash,be.secretMismatch);const{tx:o,usedUtxos:s}=await this._buildRawTx(r??await this.signer.getAddress(),n),c=this.leafHash(1),u=s.map(w=>w.value),p=fr(this.getOutputScript(),s.length),y=de.Transaction.SIGHASH_DEFAULT;for(let w=0;w<o.ins.length;w++){const x=o.hashForWitnessV1(w,p,u,y,c),k=await this.signer.signSchnorr(x);o.setWitness(w,[k,Buffer.from(t,"hex"),this.redeemLeaf(),this.generateControlBlockFor(1)])}return await(await this.signer.getProvider()).broadcast(o.toHex())}async refund(t,r){const{tx:n,usedUtxos:o}=await this._buildRawTx(t??await this.signer.getAddress(),r),[s,c]=await this.canRefund(o);if(!s)throw new Error(be.htlcNotExpired(c));const u=this.leafHash(0),p=o.map(x=>x.value),y=fr(this.getOutputScript(),o.length),g=de.Transaction.SIGHASH_DEFAULT;for(let x=0;x<n.ins.length;x++){n.ins[x].sequence=this.expiry;const k=n.hashForWitnessV1(x,y,p,g,u),R=await this.signer.signSchnorr(k);n.setWitness(x,[R,this.refundLeaf(),this.generateControlBlockFor(0)])}return await(await this.signer.getProvider()).broadcast(n.toHex())}async canRefund(t){const n=await(await this.signer.getProvider()).getLatestTip();for(const o of t){let s=0;if(o.status.confirmed&&o.status.block_height+this.expiry>n?s=o.status.block_height+this.expiry-n+1:o.status.confirmed||(s=this.expiry+1),s>0)return[!1,s]}return[!0,0]}generateControlBlockFor(t){let r;switch(t){case 1:r=this.redeemLeaf();break;case 0:r=this.refundLeaf();break;case 2:r=this.instantRefundLeaf();break;default:throw new Error(be.invalidLeaf)}const n=de.payments.p2tr({internalPubkey:this.internalPubkey,network:this.network,scriptTree:this.leaves(),redeem:{output:r,redeemVersion:Lt}});if(!n.witness)throw new Error(be.controlBlockGenerationFailed);return n.witness[n.witness.length-1]}leafHash(t){let r=this.redeemLeaf();return t===0&&(r=this.refundLeaf()),t===2&&(r=this.instantRefundLeaf()),de.crypto.taggedHash("TapLeaf",Ba(r))}refundLeaf(){return de.script.fromASM(`
3
+ ${de.script.number.encode(this.expiry).toString("hex")}
790
4
  OP_CHECKSEQUENCEVERIFY
791
5
  OP_DROP
792
6
  ${this.initiatorPubkey}
793
7
  OP_CHECKSIG
794
- `.trim().replace(/\s+/g," "))}redeemLeaf(){return bitcoin__namespace.script.fromASM(`
8
+ `.trim().replace(/\s+/g," "))}redeemLeaf(){return de.script.fromASM(`
795
9
  OP_SHA256
796
10
  ${this.secretHash}
797
11
  OP_EQUALVERIFY
798
12
  ${this.redeemerPubkey}
799
13
  OP_CHECKSIG
800
- `.trim().replace(/\s+/g," "))}instantRefundLeaf(){return bitcoin__namespace.script.fromASM(`
14
+ `.trim().replace(/\s+/g," "))}instantRefundLeaf(){return de.script.fromASM(`
801
15
  ${this.initiatorPubkey}
802
16
  OP_CHECKSIG
803
17
  ${this.redeemerPubkey}
804
18
  OP_CHECKSIGADD
805
19
  OP_2
806
20
  OP_NUMEQUAL
807
- `.trim().replace(/\s+/g," "))}leaves(){return[{version:LEAF_VERSION,output:this.redeemLeaf()},[{version:LEAF_VERSION,output:this.refundLeaf()},{version:LEAF_VERSION,output:this.instantRefundLeaf()}]]}generateMerkleProofFor(v){const w=this.leafHash(1),_=this.leafHash(2),A=this.leafHash(0);switch(v){case 1:{const E=sortLeaves(A,_);return[bitcoin__namespace.crypto.taggedHash("TapBranch",Buffer$D.concat(E))]}case 0:return[_,w];case 2:return[A,w];default:throw new Error(htlcErrors.invalidLeaf)}}}function generateOutputs(b,v){const w=[];for(let _=0;_<v;_++)w.push(b);return w}class OrderCache{constructor(v,w){this.cacheExpirationDuration=1e3*60*5,this.order=v,this.store=w,this.deleteHistory()}getOrder(){return this.order}set(v,w){const _={txHash:w,timeStamp:Date.now()};this.store.setItem(`${v}_${this.order.create_order.create_id}`,_)}get(v){const w=this.store.getItem(`${v}_${this.order.create_order.create_id}`);if(!w)return null;const _=JSON.parse(w);return!_.timeStamp||!_.txHash?null:_}remove(v){this.store.removeItem(`${v}_${this.order.create_order.create_id}`)}deleteHistory(){this.order.source_swap.initiate_tx_hash&&this.store.removeItem(`init_${this.order.create_order.create_id}`),this.order.destination_swap.redeem_tx_hash&&this.store.removeItem(`redeem_${this.order.create_order.create_id}`),this.order.source_swap.refund_tx_hash&&this.store.removeItem(`refund_${this.order.create_order.create_id}`)}}class OrderExecutor{constructor(v,w,_,A){this.order=v,this.relayURL=w,this.secretManager=_,this.opts=A,this.orderCache=new OrderCache(v,A?.store||new m)}getOrder(){return this.order}async init(v,w){const _=this.orderCache.get(OrderCacheAction.init);if(_)return utils$v.Ok(_.txHash);if(orderbook.isBitcoin(this.order.source_swap.chain))return utils$v.Ok("Bitcoin initiation is not automated");const E=await new EvmRelay(this.relayURL,v,this.opts).init(this.order,w);return!E.error&&E.val&&this.orderCache.set(OrderCacheAction.init,E.val),E}async redeem(v,w){const _=this.orderCache.get(OrderCacheAction.redeem);if(_)return utils$v.Ok(_.txHash);if(orderbook.isBitcoin(this.order.destination_swap.chain))try{const P=await(await GardenHTLC.from(v,Number(this.order.destination_swap.amount),this.order.create_order.secret_hash,toXOnly$1(this.order.destination_swap.initiator),toXOnly$1(this.order.destination_swap.redeemer),this.order.destination_swap.timelock)).redeem(utils$v.trim0x(w),this.order.create_order.additional_data?.bitcoin_optional_recipient);return this.orderCache.set(OrderCacheAction.redeem,P),utils$v.Ok(P)}catch(k){return utils$v.Err("Failed btc redeem: "+k)}const E=await new EvmRelay(this.relayURL,v,this.opts).redeem(this.order.create_order.create_id,w);return!E.error&&E.val&&this.orderCache.set(OrderCacheAction.redeem,E.val),E}async refund(v){const w=this.orderCache.get(OrderCacheAction.refund);if(w)return utils$v.Ok(w.txHash);if(!orderbook.isBitcoin(this.order.source_swap.chain))return utils$v.Ok("EVM refund is automatically done by relayer service");try{const A=await(await GardenHTLC.from(v,Number(this.order.source_swap.amount),this.order.create_order.secret_hash,toXOnly$1(this.order.source_swap.initiator),toXOnly$1(this.order.source_swap.redeemer),this.order.source_swap.timelock)).refund(this.order.create_order.additional_data?.bitcoin_optional_recipient);return this.orderCache.set(OrderCacheAction.refund,A),utils$v.Ok(A)}catch(_){return utils$v.Err("Failed btc refund: "+_)}}async execute(v){const{wallets:w}=v;let{blockNumbers:_}=v;if(!_&&!w)return utils$v.Err("Provide wallets or blockNumbers to calculate the order status.");if(!_){const E=await this.fetchCurrentBlockNumber(w);if(E.error)return utils$v.Err(E.error);_=E.val}switch(parseAction(this.order,_.source,_.destination)){case OrderActions.Redeem:{const E=this.secretManager.generateSecret(Number(this.order.create_order.nonce));return E.error?utils$v.Err(E.error):await this.redeem(w.destination,E.val.secret)}case OrderActions.Refund:return orderbook.isBitcoin(this.order.source_swap.chain)?await this.refund(w.source):utils$v.Ok("EVM refund is automatically done by relayer service");default:return utils$v.Ok(utils$v.Void)}}async fetchCurrentBlockNumber(v){if(!v||!v.source||!v.destination)return utils$v.Err("Provide wallets to fetch the current block number");const w=orderbook.isBitcoin(this.order.source_swap.chain)?await fetchBitcoinBlockNumber(await v.source.getProvider()):await fetchEVMBlockNumber(v.source);if(w.error)return utils$v.Err(w.error);const _=orderbook.isBitcoin(this.order.destination_swap.chain)?await fetchBitcoinBlockNumber(await v.destination.getProvider()):await fetchEVMBlockNumber(v.destination);return _.error?utils$v.Err(_.error):utils$v.Ok({source:w.val,destination:_.val})}}class Garden{constructor(v,w,_,A){this.orderBook=v,this.relayURL=new r$1(w),this.secretManager=_,this.opts=A}async swap(v){const w=orderbook.isEVM(v.fromAsset.chain)?v.sendAddress:v.receiveAddress,_=await this.orderBook.getOrdersCount(w);if(_.error)return utils$v.Err(_.error);const A=_.val+1,E=this.secretManager.generateSecret(A);if(E.error)return utils$v.Err(E.error);const k=orderbook.isBitcoin(v.fromAsset.chain)?TimeLocks.btc:orderbook.isEVM(v.fromAsset.chain)?TimeLocks.evm:void 0;if(!k)return utils$v.Err("Unsupported chain");const P=await this.orderBook.createOrder({fromAsset:v.fromAsset,toAsset:v.toAsset,sendAddress:v.sendAddress,receiveAddress:v.receiveAddress,sendAmount:v.sendAmount,receiveAmount:v.receiveAmount,secretHash:E.val.secretHash,timelock:k,nonce:A.toString(),btcInputAddress:v.additionalData?.btcAddress,minDestinationConfirmations:v.minDestinationConfirmations});return P.error?utils$v.Err(P.error):P}async subscribeOrders(v,w=5e3){return await this.orderBook.subscribeToOrders(!0,w,async _=>{for(let A=0;A<_.data.length;A++){const E=new OrderExecutor(_.data[A],this.relayURL.toString(),this.secretManager,this.opts);await v(E)}},!0)}}var src$1={},ecpair={},networks$1={};Object.defineProperty(networks$1,"__esModule",{value:!0});networks$1.testnet=networks$1.bitcoin=void 0;networks$1.bitcoin={messagePrefix:`Bitcoin Signed Message:
808
- `,bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128};networks$1.testnet={messagePrefix:`Bitcoin Signed Message:
809
- `,bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239};var types$2={},types$1={Array:function(b){return b!=null&&b.constructor===Array},Boolean:function(b){return typeof b=="boolean"},Function:function(b){return typeof b=="function"},Nil:function(b){return b==null},Number:function(b){return typeof b=="number"},Object:function(b){return typeof b=="object"},String:function(b){return typeof b=="string"},"":function(){return!0}};types$1.Null=types$1.Nil;for(var typeName$1 in types$1)types$1[typeName$1].toJSON=function(b){return b}.bind(null,typeName$1);var native$1=types$1,native=native$1;function getTypeName(b){return b.name||b.toString().match(/function (.*?)\s*\(/)[1]}function getValueTypeName$1(b){return native.Nil(b)?"":getTypeName(b.constructor)}function getValue(b){return native.Function(b)?"":native.String(b)?JSON.stringify(b):b&&native.Object(b)?"":b}function captureStackTrace(b,v){Error.captureStackTrace&&Error.captureStackTrace(b,v)}function tfJSON$1(b){return native.Function(b)?b.toJSON?b.toJSON():getTypeName(b):native.Array(b)?"Array":b&&native.Object(b)?"Object":b!==void 0?b:""}function tfErrorString(b,v,w){var _=getValue(v);return"Expected "+tfJSON$1(b)+", got"+(w!==""?" "+w:"")+(_!==""?" "+_:"")}function TfTypeError$1(b,v,w){w=w||getValueTypeName$1(v),this.message=tfErrorString(b,v,w),captureStackTrace(this,TfTypeError$1),this.__type=b,this.__value=v,this.__valueTypeName=w}TfTypeError$1.prototype=Object.create(Error.prototype);TfTypeError$1.prototype.constructor=TfTypeError$1;function tfPropertyErrorString(b,v,w,_,A){var E='" of type ';return v==="key"&&(E='" with key type '),tfErrorString('property "'+tfJSON$1(w)+E+tfJSON$1(b),_,A)}function TfPropertyTypeError$1(b,v,w,_,A){b?(A=A||getValueTypeName$1(_),this.message=tfPropertyErrorString(b,w,v,_,A)):this.message='Unexpected property "'+v+'"',captureStackTrace(this,TfTypeError$1),this.__label=w,this.__property=v,this.__type=b,this.__value=_,this.__valueTypeName=A}TfPropertyTypeError$1.prototype=Object.create(Error.prototype);TfPropertyTypeError$1.prototype.constructor=TfTypeError$1;function tfCustomError(b,v){return new TfTypeError$1(b,{},v)}function tfSubError$1(b,v,w){return b instanceof TfPropertyTypeError$1?(v=v+"."+b.__property,b=new TfPropertyTypeError$1(b.__type,v,b.__label,b.__value,b.__valueTypeName)):b instanceof TfTypeError$1&&(b=new TfPropertyTypeError$1(b.__type,v,w,b.__value,b.__valueTypeName)),captureStackTrace(b),b}var errors={TfTypeError:TfTypeError$1,TfPropertyTypeError:TfPropertyTypeError$1,tfCustomError,tfSubError:tfSubError$1,tfJSON:tfJSON$1,getValueTypeName:getValueTypeName$1},extra,hasRequiredExtra;function requireExtra(){if(hasRequiredExtra)return extra;hasRequiredExtra=1;var b=native$1,v=errors;function w(oe){return Buffer$D.isBuffer(oe)}function _(oe){return typeof oe=="string"&&/^([0-9a-f]{2})+$/i.test(oe)}function A(oe,de){var le=oe.toJSON();function be(pe){if(!oe(pe))return!1;if(pe.length===de)return!0;throw v.tfCustomError(le+"(Length: "+de+")",le+"(Length: "+pe.length+")")}return be.toJSON=function(){return le},be}var E=A.bind(null,b.Array),k=A.bind(null,w),P=A.bind(null,_),N=A.bind(null,b.String);function q(oe,de,le){le=le||b.Number;function be(pe,fe){return le(pe,fe)&&pe>oe&&pe<de}return be.toJSON=function(){return`${le.toJSON()} between [${oe}, ${de}]`},be}var B=Math.pow(2,53)-1;function O(oe){return typeof oe=="number"&&isFinite(oe)}function I(oe){return oe<<24>>24===oe}function D(oe){return oe<<16>>16===oe}function V(oe){return(oe|0)===oe}function ee(oe){return typeof oe=="number"&&oe>=-B&&oe<=B&&Math.floor(oe)===oe}function J(oe){return(oe&255)===oe}function te(oe){return(oe&65535)===oe}function se(oe){return oe>>>0===oe}function ce(oe){return typeof oe=="number"&&oe>=0&&oe<=B&&Math.floor(oe)===oe}var ae={ArrayN:E,Buffer:w,BufferN:k,Finite:O,Hex:_,HexN:P,Int8:I,Int16:D,Int32:V,Int53:ee,Range:q,StringN:N,UInt8:J,UInt16:te,UInt32:se,UInt53:ce};for(var he in ae)ae[he].toJSON=function(oe){return oe}.bind(null,he);return extra=ae,extra}var ERRORS=errors,NATIVE=native$1,tfJSON=ERRORS.tfJSON,TfTypeError=ERRORS.TfTypeError,TfPropertyTypeError=ERRORS.TfPropertyTypeError,tfSubError=ERRORS.tfSubError,getValueTypeName=ERRORS.getValueTypeName,TYPES={arrayOf:function b(v,w){v=compile(v),w=w||{};function _(A,E){return!NATIVE.Array(A)||NATIVE.Nil(A)||w.minLength!==void 0&&A.length<w.minLength||w.maxLength!==void 0&&A.length>w.maxLength||w.length!==void 0&&A.length!==w.length?!1:A.every(function(k,P){try{return typeforce(v,k,E)}catch(N){throw tfSubError(N,P)}})}return _.toJSON=function(){var A="["+tfJSON(v)+"]";return w.length!==void 0?A+="{"+w.length+"}":(w.minLength!==void 0||w.maxLength!==void 0)&&(A+="{"+(w.minLength===void 0?0:w.minLength)+","+(w.maxLength===void 0?1/0:w.maxLength)+"}"),A},_},maybe:function b(v){v=compile(v);function w(_,A){return NATIVE.Nil(_)||v(_,A,b)}return w.toJSON=function(){return"?"+tfJSON(v)},w},map:function b(v,w){v=compile(v),w&&(w=compile(w));function _(A,E){if(!NATIVE.Object(A)||NATIVE.Nil(A))return!1;for(var k in A){try{w&&typeforce(w,k,E)}catch(N){throw tfSubError(N,k,"key")}try{var P=A[k];typeforce(v,P,E)}catch(N){throw tfSubError(N,k)}}return!0}return w?_.toJSON=function(){return"{"+tfJSON(w)+": "+tfJSON(v)+"}"}:_.toJSON=function(){return"{"+tfJSON(v)+"}"},_},object:function b(v){var w={};for(var _ in v)w[_]=compile(v[_]);function A(E,k){if(!NATIVE.Object(E)||NATIVE.Nil(E))return!1;var P;try{for(P in w){var N=w[P],q=E[P];typeforce(N,q,k)}}catch(B){throw tfSubError(B,P)}if(k){for(P in E)if(!w[P])throw new TfPropertyTypeError(void 0,P)}return!0}return A.toJSON=function(){return tfJSON(w)},A},anyOf:function b(){var v=[].slice.call(arguments).map(compile);function w(_,A){return v.some(function(E){try{return typeforce(E,_,A)}catch{return!1}})}return w.toJSON=function(){return v.map(tfJSON).join("|")},w},allOf:function b(){var v=[].slice.call(arguments).map(compile);function w(_,A){return v.every(function(E){try{return typeforce(E,_,A)}catch{return!1}})}return w.toJSON=function(){return v.map(tfJSON).join(" & ")},w},quacksLike:function b(v){function w(_){return v===getValueTypeName(_)}return w.toJSON=function(){return v},w},tuple:function b(){var v=[].slice.call(arguments).map(compile);function w(_,A){return NATIVE.Nil(_)||NATIVE.Nil(_.length)||A&&_.length!==v.length?!1:v.every(function(E,k){try{return typeforce(E,_[k],A)}catch(P){throw tfSubError(P,k)}})}return w.toJSON=function(){return"("+v.map(tfJSON).join(", ")+")"},w},value:function b(v){function w(_){return _===v}return w.toJSON=function(){return v},w}};TYPES.oneOf=TYPES.anyOf;function compile(b){if(NATIVE.String(b))return b[0]==="?"?TYPES.maybe(b.slice(1)):NATIVE[b]||TYPES.quacksLike(b);if(b&&NATIVE.Object(b)){if(NATIVE.Array(b)){if(b.length!==1)throw new TypeError("Expected compile() parameter of type Array of length 1");return TYPES.arrayOf(b[0])}return TYPES.object(b)}else if(NATIVE.Function(b))return b;return TYPES.value(b)}function typeforce(b,v,w,_){if(NATIVE.Function(b)){if(b(v,w))return!0;throw new TfTypeError(_||b,v)}return typeforce(compile(b),v,w)}for(var typeName in NATIVE)typeforce[typeName]=NATIVE[typeName];for(typeName in TYPES)typeforce[typeName]=TYPES[typeName];var EXTRA=requireExtra();for(typeName in EXTRA)typeforce[typeName]=EXTRA[typeName];typeforce.compile=compile;typeforce.TfTypeError=TfTypeError;typeforce.TfPropertyTypeError=TfPropertyTypeError;var typeforce_1=typeforce;(function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.maybe=b.Boolean=b.Array=b.Buffer256bit=b.Network=b.typeforce=void 0,b.typeforce=typeforce_1,b.Network=b.typeforce.compile({messagePrefix:b.typeforce.oneOf(b.typeforce.Buffer,b.typeforce.String),bip32:{public:b.typeforce.UInt32,private:b.typeforce.UInt32},pubKeyHash:b.typeforce.UInt8,scriptHash:b.typeforce.UInt8,wif:b.typeforce.UInt8}),b.Buffer256bit=b.typeforce.BufferN(32),b.Array=b.typeforce.Array,b.Boolean=b.typeforce.Boolean,b.maybe=b.typeforce.maybe})(types$2);var _Buffer=safeBufferExports$1.Buffer;function base$1(b){if(b.length>=255)throw new TypeError("Alphabet too long");for(var v=new Uint8Array(256),w=0;w<v.length;w++)v[w]=255;for(var _=0;_<b.length;_++){var A=b.charAt(_),E=A.charCodeAt(0);if(v[E]!==255)throw new TypeError(A+" is ambiguous");v[E]=_}var k=b.length,P=b.charAt(0),N=Math.log(k)/Math.log(256),q=Math.log(256)/Math.log(k);function B(D){if((Array.isArray(D)||D instanceof Uint8Array)&&(D=_Buffer.from(D)),!_Buffer.isBuffer(D))throw new TypeError("Expected Buffer");if(D.length===0)return"";for(var V=0,ee=0,J=0,te=D.length;J!==te&&D[J]===0;)J++,V++;for(var se=(te-J)*q+1>>>0,ce=new Uint8Array(se);J!==te;){for(var ae=D[J],he=0,oe=se-1;(ae!==0||he<ee)&&oe!==-1;oe--,he++)ae+=256*ce[oe]>>>0,ce[oe]=ae%k>>>0,ae=ae/k>>>0;if(ae!==0)throw new Error("Non-zero carry");ee=he,J++}for(var de=se-ee;de!==se&&ce[de]===0;)de++;for(var le=P.repeat(V);de<se;++de)le+=b.charAt(ce[de]);return le}function O(D){if(typeof D!="string")throw new TypeError("Expected String");if(D.length===0)return _Buffer.alloc(0);for(var V=0,ee=0,J=0;D[V]===P;)ee++,V++;for(var te=(D.length-V)*N+1>>>0,se=new Uint8Array(te);V<D.length;){var ce=v[D.charCodeAt(V)];if(ce===255)return;for(var ae=0,he=te-1;(ce!==0||ae<J)&&he!==-1;he--,ae++)ce+=k*se[he]>>>0,se[he]=ce%256>>>0,ce=ce/256>>>0;if(ce!==0)throw new Error("Non-zero carry");J=ae,V++}for(var oe=te-J;oe!==te&&se[oe]===0;)oe++;var de=_Buffer.allocUnsafe(ee+(te-oe));de.fill(0,0,ee);for(var le=ee;oe!==te;)de[le++]=se[oe++];return de}function I(D){var V=O(D);if(V)return V;throw new Error("Non-base"+k+" character")}return{encode:B,decodeUnsafe:O,decode:I}}var src=base$1,basex=src,ALPHABET="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",bs58=basex(ALPHABET),base58=bs58,Buffer=safeBufferExports$1.Buffer,base=function(b){function v(E){var k=b(E);return base58.encode(Buffer.concat([E,k],E.length+4))}function w(E){var k=E.slice(0,-4),P=E.slice(-4),N=b(k);if(!(P[0]^N[0]|P[1]^N[1]|P[2]^N[2]|P[3]^N[3]))return k}function _(E){var k=base58.decodeUnsafe(E);if(k)return w(k)}function A(E){var k=base58.decode(E),P=w(k);if(!P)throw new Error("Invalid checksum");return P}return{encode:v,decode:A,decodeUnsafe:_}},createHash=browser$9,bs58checkBase=base;function sha256x2(b){var v=createHash("sha256").update(b).digest();return createHash("sha256").update(v).digest()}var bs58check$1=bs58checkBase(sha256x2),bs58check=bs58check$1;function decodeRaw(b,v){if(v!==void 0&&b[0]!==v)throw new Error("Invalid network version");if(b.length===33)return{version:b[0],privateKey:b.slice(1,33),compressed:!1};if(b.length!==34)throw new Error("Invalid WIF length");if(b[33]!==1)throw new Error("Invalid compression flag");return{version:b[0],privateKey:b.slice(1,33),compressed:!0}}function encodeRaw(b,v,w){var _=new Buffer$D(w?34:33);return _.writeUInt8(b,0),v.copy(_,1),w&&(_[33]=1),_}function decode(b,v){return decodeRaw(bs58check.decode(b),v)}function encode(b,v,w){return typeof b=="number"?bs58check.encode(encodeRaw(b,v,w)):bs58check.encode(encodeRaw(b.version,b.privateKey,b.compressed))}var wif$1={decode,decodeRaw,encode,encodeRaw},testecc={};Object.defineProperty(testecc,"__esModule",{value:!0});testecc.testEcc=void 0;const h=b=>Buffer$D.from(b,"hex");function testEcc(b){assert(b.isPoint(h("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),assert(!b.isPoint(h("030000000000000000000000000000000000000000000000000000000000000005"))),assert(b.isPrivate(h("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),assert(b.isPrivate(h("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))),assert(!b.isPrivate(h("0000000000000000000000000000000000000000000000000000000000000000"))),assert(!b.isPrivate(h("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"))),assert(!b.isPrivate(h("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364142"))),assert(Buffer$D.from(b.privateAdd(h("0000000000000000000000000000000000000000000000000000000000000001"),h("0000000000000000000000000000000000000000000000000000000000000000"))).equals(h("0000000000000000000000000000000000000000000000000000000000000001"))),assert(b.privateAdd(h("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e"),h("0000000000000000000000000000000000000000000000000000000000000003"))===null),assert(Buffer$D.from(b.privateAdd(h("e211078564db65c3ce7704f08262b1f38f1ef412ad15b5ac2d76657a63b2c500"),h("b51fbb69051255d1becbd683de5848242a89c229348dd72896a87ada94ae8665"))).equals(h("9730c2ee69edbb958d42db7460bafa18fef9d955325aec99044c81c8282b0a24"))),assert(Buffer$D.from(b.privateNegate(h("0000000000000000000000000000000000000000000000000000000000000001"))).equals(h("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))),assert(Buffer$D.from(b.privateNegate(h("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e"))).equals(h("0000000000000000000000000000000000000000000000000000000000000003"))),assert(Buffer$D.from(b.privateNegate(h("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af"))).equals(h("4eede1bf775995d70a494f0a7bb6bc11e0b8cccd41cce8009ab1132c8b0a3792"))),assert(Buffer$D.from(b.pointCompress(h("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"),!0)).equals(h("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),assert(Buffer$D.from(b.pointCompress(h("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"),!1)).equals(h("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"))),assert(Buffer$D.from(b.pointCompress(h("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),!0)).equals(h("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),assert(Buffer$D.from(b.pointCompress(h("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),!1)).equals(h("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"))),assert(Buffer$D.from(b.pointFromScalar(h("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af"))).equals(h("02b07ba9dca9523b7ef4bd97703d43d20399eb698e194704791a25ce77a400df99"))),assert(b.xOnlyPointAddTweak(h("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),h("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))===null);let v=b.xOnlyPointAddTweak(h("1617d38ed8d8657da4d4761e8057bc396ea9e4b9d29776d4be096016dbd2509b"),h("a8397a935f0dfceba6ba9618f6451ef4d80637abf4e6af2669fbc9de6a8fd2ac"));assert(Buffer$D.from(v.xOnlyPubkey).equals(h("e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf"))&&v.parity===1),v=b.xOnlyPointAddTweak(h("2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991"),h("823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47")),assert(Buffer$D.from(v.xOnlyPubkey).equals(h("9534f8dc8c6deda2dc007655981c78b49c5d96c778fbf363462a11ec9dfd948c"))&&v.parity===0),assert(Buffer$D.from(b.sign(h("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),h("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))).equals(h("54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"))),assert(b.verify(h("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),h("0379be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),h("54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"))),b.signSchnorr&&assert(Buffer$D.from(b.signSchnorr(h("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),h("c90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b14e5c9"),h("c87aa53824b4d7ae2eb035a2b5bbbccc080e76cdc6d1692c4b0b62d798e6d906"))).equals(h("5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7"))),b.verifySchnorr&&assert(b.verifySchnorr(h("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),h("dd308afec5777e13121fa72b9cc1b7cc0139715309b086c960e18fd969774eb8"),h("5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7")))}testecc.testEcc=testEcc;function assert(b){if(!b)throw new Error("ecc library invalid")}Object.defineProperty(ecpair,"__esModule",{value:!0});ecpair.ECPairFactory=ecpair.networks=void 0;const networks=networks$1;ecpair.networks=networks;const types=types$2,randomBytes=browserExports,wif=wif$1,testecc_1=testecc,isOptions=types.typeforce.maybe(types.typeforce.compile({compressed:types.maybe(types.Boolean),network:types.maybe(types.Network)})),toXOnly=b=>b.length===32?b:b.slice(1,33);function ECPairFactory(b){(0,testecc_1.testEcc)(b);function v(P){return b.isPoint(P)}function w(P,N){if(types.typeforce(types.Buffer256bit,P),!b.isPrivate(P))throw new TypeError("Private key not in range [1, n)");return types.typeforce(isOptions,N),new k(P,void 0,N)}function _(P,N){return types.typeforce(b.isPoint,P),types.typeforce(isOptions,N),new k(void 0,P,N)}function A(P,N){const q=wif.decode(P),B=q.version;if(types.Array(N)){if(N=N.filter(O=>B===O.wif).pop(),!N)throw new Error("Unknown network version")}else if(N=N||networks.bitcoin,B!==N.wif)throw new Error("Invalid network version");return w(q.privateKey,{compressed:q.compressed,network:N})}function E(P){types.typeforce(isOptions,P),P===void 0&&(P={});const N=P.rng||randomBytes;let q;do q=N(32),types.typeforce(types.Buffer256bit,q);while(!b.isPrivate(q));return w(q,P)}class k{__D;__Q;compressed;network;lowR;constructor(N,q,B){this.__D=N,this.__Q=q,this.lowR=!1,B===void 0&&(B={}),this.compressed=B.compressed===void 0?!0:B.compressed,this.network=B.network||networks.bitcoin,q!==void 0&&(this.__Q=Buffer$D.from(b.pointCompress(q,this.compressed)))}get privateKey(){return this.__D}get publicKey(){if(!this.__Q){const N=b.pointFromScalar(this.__D,this.compressed);this.__Q=Buffer$D.from(N)}return this.__Q}toWIF(){if(!this.__D)throw new Error("Missing private key");return wif.encode(this.network.wif,this.__D,this.compressed)}tweak(N){return this.privateKey?this.tweakFromPrivateKey(N):this.tweakFromPublicKey(N)}sign(N,q){if(!this.__D)throw new Error("Missing private key");if(q===void 0&&(q=this.lowR),q===!1)return Buffer$D.from(b.sign(N,this.__D));{let B=b.sign(N,this.__D);const O=Buffer$D.alloc(32,0);let I=0;for(;B[0]>127;)I++,O.writeUIntLE(I,0,6),B=b.sign(N,this.__D,O);return Buffer$D.from(B)}}signSchnorr(N){if(!this.privateKey)throw new Error("Missing private key");if(!b.signSchnorr)throw new Error("signSchnorr not supported by ecc library");return Buffer$D.from(b.signSchnorr(N,this.privateKey))}verify(N,q){return b.verify(N,this.publicKey,q)}verifySchnorr(N,q){if(!b.verifySchnorr)throw new Error("verifySchnorr not supported by ecc library");return b.verifySchnorr(N,this.publicKey.subarray(1,33),q)}tweakFromPublicKey(N){const q=toXOnly(this.publicKey),B=b.xOnlyPointAddTweak(q,N);if(!B||B.xOnlyPubkey===null)throw new Error("Cannot tweak public key!");const O=Buffer$D.from([B.parity===0?2:3]);return _(Buffer$D.concat([O,B.xOnlyPubkey]),{network:this.network,compressed:this.compressed})}tweakFromPrivateKey(N){const B=this.publicKey[0]===3||this.publicKey[0]===4&&(this.publicKey[64]&1)===1?b.privateNegate(this.privateKey):this.privateKey,O=b.privateAdd(B,N);if(!O)throw new Error("Invalid tweaked private key!");return w(Buffer$D.from(O),{network:this.network,compressed:this.compressed})}}return{isPoint:v,fromPrivateKey:w,fromPublicKey:_,fromWIF:A,makeRandom:E}}ecpair.ECPairFactory=ECPairFactory;(function(b){Object.defineProperty(b,"__esModule",{value:!0}),b.networks=b.ECPairFactory=b.default=void 0;var v=ecpair;Object.defineProperty(b,"default",{enumerable:!0,get:function(){return v.ECPairFactory}}),Object.defineProperty(b,"ECPairFactory",{enumerable:!0,get:function(){return v.ECPairFactory}}),Object.defineProperty(b,"networks",{enumerable:!0,get:function(){return v.networks}})})(src$1);var cryptoBrowserifyExports=requireCryptoBrowserify();class SecretManager{constructor(v){this.privKey=v}static fromPrivKey(v){return new SecretManager(utils$v.trim0x(v))}static async fromWalletClient(v){if(!v.account)return utils$v.Err("No account found");try{const w=await v.signTypedData({account:v.account,types:{EIP712Domain:[{name:"name",type:"string"},{name:"version",type:"string"}],Data:[{name:"Message",type:"string"},{name:"Version",type:"string"},{name:"Nonce",type:"uint256"}]},domain:{name:"WBTC GARDEN",version:"1"},primaryType:"Data",message:{Message:"Initialize your swap",Version:"1.0.0",Nonce:1n}});return utils$v.Ok(new SecretManager(utils$v.trim0x(viem.sha256(w))))}catch(w){return utils$v.Err("Failed to initialize: "+w)}}getMasterPrivKey(){return this.privKey}generateSecret(v){const w=this.signMessage(v),_=viem.sha256(o$2(w)),A=viem.sha256(_);return utils$v.Ok({secret:_,secretHash:A})}signMessage(v){const w=src$1.ECPairFactory(ecc__namespace),_="Garden.fi"+v.toString(),A=Buffer$D.from(_,"utf8"),E=cryptoBrowserifyExports.createHash("sha256").update(A).digest(),k=Buffer$D.from(utils$v.trim0x(this.privKey),"hex");if(k.length!==32)throw new Error("Invalid private key length. Expected 32 bytes.");return w.fromPrivateKey(k).sign(E).toString("hex")}}exports.EvmRelay=EvmRelay;exports.Garden=Garden;exports.OrderExecutor=OrderExecutor;exports.ParseOrderStatus=ParseOrderStatus;exports.ParseSwapStatus=ParseSwapStatus;exports.SecretManager=SecretManager;exports.fetchBitcoinBlockNumber=fetchBitcoinBlockNumber;exports.fetchEVMBlockNumber=fetchEVMBlockNumber;exports.fetchL1BlockNumber=fetchL1BlockNumber;exports.parseAction=parseAction;
21
+ `.trim().replace(/\s+/g," "))}leaves(){return[{version:Lt,output:this.redeemLeaf()},[{version:Lt,output:this.refundLeaf()},{version:Lt,output:this.instantRefundLeaf()}]]}generateMerkleProofFor(t){const r=this.leafHash(1),n=this.leafHash(2),o=this.leafHash(0);switch(t){case 1:{const s=Sa(o,n);return[de.crypto.taggedHash("TapBranch",Buffer.concat(s))]}case 0:return[n,r];case 2:return[o,r];default:throw new Error(be.invalidLeaf)}}}function fr(e,t){const r=[];for(let n=0;n<t;n++)r.push(e);return r}class Ma{constructor(t,r){this.order=t,this.store=r}getOrder(){return this.order}set(t,r){const n={txHash:r,timeStamp:Date.now()};this.store.setItem(`${t}_${this.order.create_order.create_id}`,JSON.stringify(n))}get(t){const r=this.store.getItem(`${t}_${this.order.create_order.create_id}`);if(!r)return null;const n=JSON.parse(r);return!n.timeStamp||!n.txHash?null:n}remove(t){this.store.removeItem(`${t}_${this.order.create_order.create_id}`)}}class Ua{constructor(t){if(this.eventListeners=new Map,this.getOrderThreshold=20,this.pendingOrdersCount=0,this.useRelay=!0,this.orderBook=new te.Orderbook({url:t.orderbookURl,walletClient:t.wallets.evmWallet,auth:t.auth}),this.quote=t.quote,this.secretManager=t.secretManager,this.wallets=t.wallets,this.orderbookUrl=t.orderbookURl,this.auth=t.auth,this.store=new ya,!t.wallets.evmWallet.account)throw new Error("Account not found in evmWallet");this.evmAddress=t.wallets.evmWallet.account.address}getPendingOrderCount(){return this.pendingOrdersCount}setUseRelay(t){this.useRelay=t}async swap(t){const r=await this.validateAndFillParams(t);if(r.error)return P.Err(r.error);const{sendAddress:n,receiveAddress:o,timelock:s}=r.val,c=await this.orderBook.getOrdersCount(this.evmAddress);if(c.error)return P.Err(c.error);const u=c.val+1,p=this.secretManager.generateSecret(u);if(p.error)return P.Err(p.error);const{strategyId:y,btcAddress:g}=t.additionalData,w={strategy_id:y,...g&&{btcAddress:g}},x={source_chain:t.fromAsset.chain,destination_chain:t.toAsset.chain,source_asset:t.fromAsset.atomicSwapAddress,destination_asset:t.toAsset.atomicSwapAddress,initiator_source_address:n,initiator_destination_address:o,source_amount:t.sendAmount,destination_amount:t.receiveAmount,fee:"1",nonce:u.toString(),timelock:s,secret_hash:P.trim0x(p.val.secretHash),min_destination_confirmations:t.minDestinationConfirmations??0,additional_data:w},k=await this.quote.getAttestedQuote(x);if(k.error)return P.Err(k.error);const R=await this.orderBook.createOrder(k.val);if(R.error)return P.Err(R.error);const C=await this.pollOrder(R.val);return C.error?P.Err(C.error):P.Ok(C.val)}async validateAndFillParams(t){if(t.fromAsset.chain===t.toAsset.chain&&t.fromAsset.atomicSwapAddress===t.toAsset.atomicSwapAddress)return P.Err("Source and destination assets cannot be the same");if(te.isMainnet(t.fromAsset.chain)&&!te.isMainnet(t.toAsset.chain)||!te.isMainnet(t.fromAsset.chain)&&te.isMainnet(t.toAsset.chain))return P.Err("Both assets should be on the same network (either mainnet or testnet)");if(te.isBitcoin(t.fromAsset.chain)||te.isBitcoin(t.toAsset.chain)){if(!this.wallets.btcWallet)return P.Err("btcWallet is required for bitcoin chain. Please provide btcWallet in the constructor");if(!t.additionalData.btcAddress)return P.Err("btcAddress in additionalData is required for bitcoin chain")}const r=await this.getAddresses(t.fromAsset.chain);if(r.error)return P.Err(r.error);const n=await this.getAddresses(t.toAsset.chain);if(n.error)return P.Err(n.error);const o=this.validateAmount(t.sendAmount);if(o.error)return P.Err(o.error);const s=this.validateAmount(t.receiveAmount);if(s.error)return P.Err(s.error);if(o<s)return P.Err("Send amount should be greater than receive amount");const c=this.getTimelock(t.fromAsset.chain);return c?P.Ok({sendAddress:r.val,receiveAddress:n.val,timelock:t.timelock??c}):P.Err("Unsupported chain for timelock")}async getAddresses(t){var n;switch(te.getBlockchainType(t)){case te.BlockchainType.EVM:return this.wallets.evmWallet.account?P.Ok(this.wallets.evmWallet.account.address):P.Err("EVM Wallet not found");case te.BlockchainType.Bitcoin:{const o=await((n=this.wallets.btcWallet)==null?void 0:n.getPublicKey());return!o||!Ia(o)?P.Err("Invalid btc public key"):P.Ok(o)}default:return P.Err("Unsupported chain")}}validateAmount(t){const r=BigInt(t);return t==null||r<=0n||t.includes(".")?P.Err("Invalid amount ",t):P.Ok(r)}getTimelock(t){switch(te.getBlockchainType(t)){case te.BlockchainType.EVM:return Br.evm;case te.BlockchainType.Bitcoin:return Br.btc;default:return}}async pollOrder(t){let r=await this.orderBook.getOrder(t,!0),n=0;for(;n<this.getOrderThreshold;){if(await qi(1e3),n++,r.error){if(!r.error.includes("result is undefined"))return P.Err(r.error)}else if(r.val&&r.val.create_order.create_id.toLowerCase()===t.toLowerCase())return P.Ok(r.val);r=await this.orderBook.getOrder(t,!0)}return P.Err(`Order not found, createOrder id: ${t}`)}emit(t,...r){(this.eventListeners.get(t)??[]).forEach(o=>{o(...r)})}async execute(t=5e3){return await this.orderBook.subscribeToOrders(!0,t,async r=>{var n,o;this.pendingOrdersCount=r.data.length,this.emit("onPendingOrdersChanged",r.data);for(let s=0;s<r.data.length;s++){const c=r.data[s],u=c.source_swap.chain,p=c.destination_swap.chain,y=this.getWallet(u),g=this.getWallet(p);if(y.error||g.error||!y.val||!g.val){this.emit("error",c,"Source or Destination Wallet not found while executing order");return}const w=await this.fetchCurrentBlockNumbers(c,{source:y.val,destination:g.val});if(w.error){this.emit("error",c,"Error while fetching CurrentBlockNumbers: "+w.error);return}const x=Vn(c,w.val.source,w.val.destination),k=new Ma(c,this.store);if(k.get(x))continue;switch(te.getBlockchainType(c.destination_swap.chain)){case te.BlockchainType.EVM:switch(x){case Re.Redeem:{console.log("executing evm redeem...");const E=new Jn(c,this.orderbookUrl,this.auth),T=this.secretManager.generateSecret(Number(c.create_order.nonce));if(T.error){this.emit("error",c,T.error);return}const O=await E.redeem(c.create_order.create_id,T.val.secret);if(O.error){this.emit("error",c,O.error);return}this.emit("success",c,Re.Redeem,O.val),k.set(x,O.val);break}case Re.Refund:{this.emit("error",c,"EVM refund is automatically done by relay service");break}}break;case te.BlockchainType.Bitcoin:switch(x){case Re.Redeem:{try{const E=await jt.from(g.val,Number(c.destination_swap.amount),c.create_order.secret_hash,Ft(c.destination_swap.initiator),Ft(c.destination_swap.redeemer),c.destination_swap.timelock),T=this.secretManager.generateSecret(Number(c.create_order.nonce));if(T.error){this.emit("error",c,T.error);return}const O=await E.redeem(P.trim0x(T.val.secret),(n=c.create_order.additional_data)==null?void 0:n.bitcoin_optional_recipient);this.emit("success",c,Re.Redeem,O),k.set(x,O)}catch(E){this.emit("error",c,"Failed btc redeem: "+E)}break}case Re.Refund:{try{const T=await(await jt.from(y.val,Number(c.source_swap.amount),c.create_order.secret_hash,Ft(c.source_swap.initiator),Ft(c.source_swap.redeemer),c.source_swap.timelock)).refund((o=c.create_order.additional_data)==null?void 0:o.bitcoin_optional_recipient);this.emit("success",c,Re.Refund,T),k.set(x,T)}catch(E){this.emit("error",c,"Failed btc refund: "+E)}break}}break;default:this.emit("error",c,"Unsupported chain: "+c.destination_swap.chain)}return}},!0)}getWallet(t){switch(te.getBlockchainType(t)){case te.BlockchainType.EVM:return P.Ok(this.wallets.evmWallet);case te.BlockchainType.Bitcoin:return P.Ok(this.wallets.btcWallet);default:return P.Err("Unsupported chain for wallet")}}on(t,r){const n=this.eventListeners.get(t)??[];n.push(r),this.eventListeners.set(t,n)}off(t,r){const n=this.eventListeners.get(t)??[],o=n.indexOf(r);o!==-1&&n.splice(o,1)}async fetchCurrentBlockNumbers(t,r){if(!r||!r.source||!r.destination)return P.Err("Provide wallets to fetch the current block number");const n=te.isBitcoin(t.source_swap.chain)?await nn(await r.source.getProvider()):await Ar(r.source);if(n.error)return P.Err(n.error);const o=te.isBitcoin(t.destination_swap.chain)?await nn(await r.destination.getProvider()):await Ar(r.destination);return o.error?P.Err(o.error):P.Ok({source:n.val,destination:o.val})}}var ze=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Da(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}),r}var Yn={},lt={},ht={};Object.defineProperty(ht,"__esModule",{value:!0});ht.testnet=ht.bitcoin=void 0;ht.bitcoin={messagePrefix:`Bitcoin Signed Message:
22
+ `,bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128};ht.testnet={messagePrefix:`Bitcoin Signed Message:
23
+ `,bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239};var Qn={},St={Array:function(e){return e!=null&&e.constructor===Array},Boolean:function(e){return typeof e=="boolean"},Function:function(e){return typeof e=="function"},Nil:function(e){return e==null},Number:function(e){return typeof e=="number"},Object:function(e){return typeof e=="object"},String:function(e){return typeof e=="string"},"":function(){return!0}};St.Null=St.Nil;for(var on in St)St[on].toJSON=(function(e){return e}).bind(null,on);var Hr=St,Qe=Hr;function Xn(e){return e.name||e.toString().match(/function (.*?)\s*\(/)[1]}function jr(e){return Qe.Nil(e)?"":Xn(e.constructor)}function $a(e){return Qe.Function(e)?"":Qe.String(e)?JSON.stringify(e):e&&Qe.Object(e)?"":e}function qr(e,t){Error.captureStackTrace&&Error.captureStackTrace(e,t)}function qt(e){return Qe.Function(e)?e.toJSON?e.toJSON():Xn(e):Qe.Array(e)?"Array":e&&Qe.Object(e)?"Object":e!==void 0?e:""}function Zn(e,t,r){var n=$a(t);return"Expected "+qt(e)+", got"+(r!==""?" "+r:"")+(n!==""?" "+n:"")}function Me(e,t,r){r=r||jr(t),this.message=Zn(e,t,r),qr(this,Me),this.__type=e,this.__value=t,this.__valueTypeName=r}Me.prototype=Object.create(Error.prototype);Me.prototype.constructor=Me;function Ha(e,t,r,n,o){var s='" of type ';return t==="key"&&(s='" with key type '),Zn('property "'+qt(r)+s+qt(e),n,o)}function ft(e,t,r,n,o){e?(o=o||jr(n),this.message=Ha(e,r,t,n,o)):this.message='Unexpected property "'+t+'"',qr(this,Me),this.__label=r,this.__property=t,this.__type=e,this.__value=n,this.__valueTypeName=o}ft.prototype=Object.create(Error.prototype);ft.prototype.constructor=Me;function ja(e,t){return new Me(e,{},t)}function qa(e,t,r){return e instanceof ft?(t=t+"."+e.__property,e=new ft(e.__type,t,e.__label,e.__value,e.__valueTypeName)):e instanceof Me&&(e=new ft(e.__type,t,r,e.__value,e.__valueTypeName)),qr(e),e}var ei={TfTypeError:Me,TfPropertyTypeError:ft,tfCustomError:ja,tfSubError:qa,tfJSON:qt,getValueTypeName:jr},ur,sn;function Wa(){if(sn)return ur;sn=1;var e=Hr,t=ei;function r(S){return Buffer.isBuffer(S)}function n(S){return typeof S=="string"&&/^([0-9a-f]{2})+$/i.test(S)}function o(S,j){var D=S.toJSON();function U(ee){if(!S(ee))return!1;if(ee.length===j)return!0;throw t.tfCustomError(D+"(Length: "+j+")",D+"(Length: "+ee.length+")")}return U.toJSON=function(){return D},U}var s=o.bind(null,e.Array),c=o.bind(null,r),u=o.bind(null,n),p=o.bind(null,e.String);function y(S,j,D){D=D||e.Number;function U(ee,Ie){return D(ee,Ie)&&ee>S&&ee<j}return U.toJSON=function(){return`${D.toJSON()} between [${S}, ${j}]`},U}var g=Math.pow(2,53)-1;function w(S){return typeof S=="number"&&isFinite(S)}function x(S){return S<<24>>24===S}function k(S){return S<<16>>16===S}function R(S){return(S|0)===S}function C(S){return typeof S=="number"&&S>=-g&&S<=g&&Math.floor(S)===S}function E(S){return(S&255)===S}function T(S){return(S&65535)===S}function O(S){return S>>>0===S}function F(S){return typeof S=="number"&&S>=0&&S<=g&&Math.floor(S)===S}var N={ArrayN:s,Buffer:r,BufferN:c,Finite:w,Hex:n,HexN:u,Int8:x,Int16:k,Int32:R,Int53:C,Range:y,StringN:p,UInt8:E,UInt16:T,UInt32:O,UInt53:F};for(var L in N)N[L].toJSON=(function(S){return S}).bind(null,L);return ur=N,ur}var kt=ei,fe=Hr,Fe=kt.tfJSON,ti=kt.TfTypeError,ri=kt.TfPropertyTypeError,_t=kt.tfSubError,Ga=kt.getValueTypeName,Le={arrayOf:function(t,r){t=Ce(t),r=r||{};function n(o,s){return!fe.Array(o)||fe.Nil(o)||r.minLength!==void 0&&o.length<r.minLength||r.maxLength!==void 0&&o.length>r.maxLength||r.length!==void 0&&o.length!==r.length?!1:o.every(function(c,u){try{return ge(t,c,s)}catch(p){throw _t(p,u)}})}return n.toJSON=function(){var o="["+Fe(t)+"]";return r.length!==void 0?o+="{"+r.length+"}":(r.minLength!==void 0||r.maxLength!==void 0)&&(o+="{"+(r.minLength===void 0?0:r.minLength)+","+(r.maxLength===void 0?1/0:r.maxLength)+"}"),o},n},maybe:function e(t){t=Ce(t);function r(n,o){return fe.Nil(n)||t(n,o,e)}return r.toJSON=function(){return"?"+Fe(t)},r},map:function(t,r){t=Ce(t),r&&(r=Ce(r));function n(o,s){if(!fe.Object(o)||fe.Nil(o))return!1;for(var c in o){try{r&&ge(r,c,s)}catch(p){throw _t(p,c,"key")}try{var u=o[c];ge(t,u,s)}catch(p){throw _t(p,c)}}return!0}return r?n.toJSON=function(){return"{"+Fe(r)+": "+Fe(t)+"}"}:n.toJSON=function(){return"{"+Fe(t)+"}"},n},object:function(t){var r={};for(var n in t)r[n]=Ce(t[n]);function o(s,c){if(!fe.Object(s)||fe.Nil(s))return!1;var u;try{for(u in r){var p=r[u],y=s[u];ge(p,y,c)}}catch(g){throw _t(g,u)}if(c){for(u in s)if(!r[u])throw new ri(void 0,u)}return!0}return o.toJSON=function(){return Fe(r)},o},anyOf:function(){var t=[].slice.call(arguments).map(Ce);function r(n,o){return t.some(function(s){try{return ge(s,n,o)}catch{return!1}})}return r.toJSON=function(){return t.map(Fe).join("|")},r},allOf:function(){var t=[].slice.call(arguments).map(Ce);function r(n,o){return t.every(function(s){try{return ge(s,n,o)}catch{return!1}})}return r.toJSON=function(){return t.map(Fe).join(" & ")},r},quacksLike:function(t){function r(n){return t===Ga(n)}return r.toJSON=function(){return t},r},tuple:function(){var t=[].slice.call(arguments).map(Ce);function r(n,o){return fe.Nil(n)||fe.Nil(n.length)||o&&n.length!==t.length?!1:t.every(function(s,c){try{return ge(s,n[c],o)}catch(u){throw _t(u,c)}})}return r.toJSON=function(){return"("+t.map(Fe).join(", ")+")"},r},value:function(t){function r(n){return n===t}return r.toJSON=function(){return t},r}};Le.oneOf=Le.anyOf;function Ce(e){if(fe.String(e))return e[0]==="?"?Le.maybe(e.slice(1)):fe[e]||Le.quacksLike(e);if(e&&fe.Object(e)){if(fe.Array(e)){if(e.length!==1)throw new TypeError("Expected compile() parameter of type Array of length 1");return Le.arrayOf(e[0])}return Le.object(e)}else if(fe.Function(e))return e;return Le.value(e)}function ge(e,t,r,n){if(fe.Function(e)){if(e(t,r))return!0;throw new ti(n||e,t)}return ge(Ce(e),t,r)}for(var Ge in fe)ge[Ge]=fe[Ge];for(Ge in Le)ge[Ge]=Le[Ge];var fn=Wa();for(Ge in fn)ge[Ge]=fn[Ge];ge.compile=Ce;ge.TfTypeError=ti;ge.TfPropertyTypeError=ri;var za=ge;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.maybe=e.Boolean=e.Array=e.Buffer256bit=e.Network=e.typeforce=void 0,e.typeforce=za,e.Network=e.typeforce.compile({messagePrefix:e.typeforce.oneOf(e.typeforce.Buffer,e.typeforce.String),bip32:{public:e.typeforce.UInt32,private:e.typeforce.UInt32},pubKeyHash:e.typeforce.UInt8,scriptHash:e.typeforce.UInt8,wif:e.typeforce.UInt8}),e.Buffer256bit=e.typeforce.BufferN(32),e.Array=e.typeforce.Array,e.Boolean=e.typeforce.Boolean,e.maybe=e.typeforce.maybe})(Qn);var Pr={exports:{}},Or={exports:{}},pt={},Jt={};Jt.byteLength=Ja;Jt.toByteArray=Qa;Jt.fromByteArray=eo;var Pe=[],Be=[],Ka=typeof Uint8Array<"u"?Uint8Array:Array,cr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var ot=0,Va=cr.length;ot<Va;++ot)Pe[ot]=cr[ot],Be[cr.charCodeAt(ot)]=ot;Be[45]=62;Be[95]=63;function ni(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function Ja(e){var t=ni(e),r=t[0],n=t[1];return(r+n)*3/4-n}function Ya(e,t,r){return(t+r)*3/4-r}function Qa(e){var t,r=ni(e),n=r[0],o=r[1],s=new Ka(Ya(e,n,o)),c=0,u=o>0?n-4:n,p;for(p=0;p<u;p+=4)t=Be[e.charCodeAt(p)]<<18|Be[e.charCodeAt(p+1)]<<12|Be[e.charCodeAt(p+2)]<<6|Be[e.charCodeAt(p+3)],s[c++]=t>>16&255,s[c++]=t>>8&255,s[c++]=t&255;return o===2&&(t=Be[e.charCodeAt(p)]<<2|Be[e.charCodeAt(p+1)]>>4,s[c++]=t&255),o===1&&(t=Be[e.charCodeAt(p)]<<10|Be[e.charCodeAt(p+1)]<<4|Be[e.charCodeAt(p+2)]>>2,s[c++]=t>>8&255,s[c++]=t&255),s}function Xa(e){return Pe[e>>18&63]+Pe[e>>12&63]+Pe[e>>6&63]+Pe[e&63]}function Za(e,t,r){for(var n,o=[],s=t;s<r;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(e[s+2]&255),o.push(Xa(n));return o.join("")}function eo(e){for(var t,r=e.length,n=r%3,o=[],s=16383,c=0,u=r-n;c<u;c+=s)o.push(Za(e,c,c+s>u?u:c+s));return n===1?(t=e[r-1],o.push(Pe[t>>2]+Pe[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],o.push(Pe[t>>10]+Pe[t>>4&63]+Pe[t<<2&63]+"=")),o.join("")}var Wr={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Wr.read=function(e,t,r,n,o){var s,c,u=o*8-n-1,p=(1<<u)-1,y=p>>1,g=-7,w=r?o-1:0,x=r?-1:1,k=e[t+w];for(w+=x,s=k&(1<<-g)-1,k>>=-g,g+=u;g>0;s=s*256+e[t+w],w+=x,g-=8);for(c=s&(1<<-g)-1,s>>=-g,g+=n;g>0;c=c*256+e[t+w],w+=x,g-=8);if(s===0)s=1-y;else{if(s===p)return c?NaN:(k?-1:1)*(1/0);c=c+Math.pow(2,n),s=s-y}return(k?-1:1)*c*Math.pow(2,s-n)};Wr.write=function(e,t,r,n,o,s){var c,u,p,y=s*8-o-1,g=(1<<y)-1,w=g>>1,x=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,k=n?0:s-1,R=n?1:-1,C=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,c=g):(c=Math.floor(Math.log(t)/Math.LN2),t*(p=Math.pow(2,-c))<1&&(c--,p*=2),c+w>=1?t+=x/p:t+=x*Math.pow(2,1-w),t*p>=2&&(c++,p/=2),c+w>=g?(u=0,c=g):c+w>=1?(u=(t*p-1)*Math.pow(2,o),c=c+w):(u=t*Math.pow(2,w-1)*Math.pow(2,o),c=0));o>=8;e[r+k]=u&255,k+=R,u/=256,o-=8);for(c=c<<o|u,y+=o;y>0;e[r+k]=c&255,k+=R,c/=256,y-=8);e[r+k-R]|=C*128};/*!
24
+ * The buffer module from node.js, for the browser.
25
+ *
26
+ * @author Feross Aboukhadijeh <https://feross.org>
27
+ * @license MIT
28
+ */(function(e){const t=Jt,r=Wr,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=O,e.INSPECT_MAX_BYTES=50;const o=2147483647;e.kMaxLength=o,u.TYPED_ARRAY_SUPPORT=s(),!u.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{const f=new Uint8Array(1),i={foo:function(){return 42}};return Object.setPrototypeOf(i,Uint8Array.prototype),Object.setPrototypeOf(f,i),f.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function c(f){if(f>o)throw new RangeError('The value "'+f+'" is invalid for option "size"');const i=new Uint8Array(f);return Object.setPrototypeOf(i,u.prototype),i}function u(f,i,a){if(typeof f=="number"){if(typeof i=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return w(f)}return p(f,i,a)}u.poolSize=8192;function p(f,i,a){if(typeof f=="string")return x(f,i);if(ArrayBuffer.isView(f))return R(f);if(f==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f);if(xe(f,ArrayBuffer)||f&&xe(f.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(xe(f,SharedArrayBuffer)||f&&xe(f.buffer,SharedArrayBuffer)))return C(f,i,a);if(typeof f=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const l=f.valueOf&&f.valueOf();if(l!=null&&l!==f)return u.from(l,i,a);const b=E(f);if(b)return b;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof f[Symbol.toPrimitive]=="function")return u.from(f[Symbol.toPrimitive]("string"),i,a);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f)}u.from=function(f,i,a){return p(f,i,a)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function y(f){if(typeof f!="number")throw new TypeError('"size" argument must be of type number');if(f<0)throw new RangeError('The value "'+f+'" is invalid for option "size"')}function g(f,i,a){return y(f),f<=0?c(f):i!==void 0?typeof a=="string"?c(f).fill(i,a):c(f).fill(i):c(f)}u.alloc=function(f,i,a){return g(f,i,a)};function w(f){return y(f),c(f<0?0:T(f)|0)}u.allocUnsafe=function(f){return w(f)},u.allocUnsafeSlow=function(f){return w(f)};function x(f,i){if((typeof i!="string"||i==="")&&(i="utf8"),!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i);const a=F(f,i)|0;let l=c(a);const b=l.write(f,i);return b!==a&&(l=l.slice(0,b)),l}function k(f){const i=f.length<0?0:T(f.length)|0,a=c(i);for(let l=0;l<i;l+=1)a[l]=f[l]&255;return a}function R(f){if(xe(f,Uint8Array)){const i=new Uint8Array(f);return C(i.buffer,i.byteOffset,i.byteLength)}return k(f)}function C(f,i,a){if(i<0||f.byteLength<i)throw new RangeError('"offset" is outside of buffer bounds');if(f.byteLength<i+(a||0))throw new RangeError('"length" is outside of buffer bounds');let l;return i===void 0&&a===void 0?l=new Uint8Array(f):a===void 0?l=new Uint8Array(f,i):l=new Uint8Array(f,i,a),Object.setPrototypeOf(l,u.prototype),l}function E(f){if(u.isBuffer(f)){const i=T(f.length)|0,a=c(i);return a.length===0||f.copy(a,0,0,i),a}if(f.length!==void 0)return typeof f.length!="number"||Je(f.length)?c(0):k(f);if(f.type==="Buffer"&&Array.isArray(f.data))return k(f.data)}function T(f){if(f>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return f|0}function O(f){return+f!=f&&(f=0),u.alloc(+f)}u.isBuffer=function(i){return i!=null&&i._isBuffer===!0&&i!==u.prototype},u.compare=function(i,a){if(xe(i,Uint8Array)&&(i=u.from(i,i.offset,i.byteLength)),xe(a,Uint8Array)&&(a=u.from(a,a.offset,a.byteLength)),!u.isBuffer(i)||!u.isBuffer(a))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(i===a)return 0;let l=i.length,b=a.length;for(let v=0,B=Math.min(l,b);v<B;++v)if(i[v]!==a[v]){l=i[v],b=a[v];break}return l<b?-1:b<l?1:0},u.isEncoding=function(i){switch(String(i).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}},u.concat=function(i,a){if(!Array.isArray(i))throw new TypeError('"list" argument must be an Array of Buffers');if(i.length===0)return u.alloc(0);let l;if(a===void 0)for(a=0,l=0;l<i.length;++l)a+=i[l].length;const b=u.allocUnsafe(a);let v=0;for(l=0;l<i.length;++l){let B=i[l];if(xe(B,Uint8Array))v+B.length>b.length?(u.isBuffer(B)||(B=u.from(B)),B.copy(b,v)):Uint8Array.prototype.set.call(b,B,v);else if(u.isBuffer(B))B.copy(b,v);else throw new TypeError('"list" argument must be an Array of Buffers');v+=B.length}return b};function F(f,i){if(u.isBuffer(f))return f.length;if(ArrayBuffer.isView(f)||xe(f,ArrayBuffer))return f.byteLength;if(typeof f!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof f);const a=f.length,l=arguments.length>2&&arguments[2]===!0;if(!l&&a===0)return 0;let b=!1;for(;;)switch(i){case"ascii":case"latin1":case"binary":return a;case"utf8":case"utf-8":return z(f).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a*2;case"hex":return a>>>1;case"base64":return yt(f).length;default:if(b)return l?-1:z(f).length;i=(""+i).toLowerCase(),b=!0}}u.byteLength=F;function N(f,i,a){let l=!1;if((i===void 0||i<0)&&(i=0),i>this.length||((a===void 0||a>this.length)&&(a=this.length),a<=0)||(a>>>=0,i>>>=0,a<=i))return"";for(f||(f="utf8");;)switch(f){case"hex":return Te(this,i,a);case"utf8":case"utf-8":return _e(this,i,a);case"ascii":return ke(this,i,a);case"latin1":case"binary":return $e(this,i,a);case"base64":return ae(this,i,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return He(this,i,a);default:if(l)throw new TypeError("Unknown encoding: "+f);f=(f+"").toLowerCase(),l=!0}}u.prototype._isBuffer=!0;function L(f,i,a){const l=f[i];f[i]=f[a],f[a]=l}u.prototype.swap16=function(){const i=this.length;if(i%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let a=0;a<i;a+=2)L(this,a,a+1);return this},u.prototype.swap32=function(){const i=this.length;if(i%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let a=0;a<i;a+=4)L(this,a,a+3),L(this,a+1,a+2);return this},u.prototype.swap64=function(){const i=this.length;if(i%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let a=0;a<i;a+=8)L(this,a,a+7),L(this,a+1,a+6),L(this,a+2,a+5),L(this,a+3,a+4);return this},u.prototype.toString=function(){const i=this.length;return i===0?"":arguments.length===0?_e(this,0,i):N.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(i){if(!u.isBuffer(i))throw new TypeError("Argument must be a Buffer");return this===i?!0:u.compare(this,i)===0},u.prototype.inspect=function(){let i="";const a=e.INSPECT_MAX_BYTES;return i=this.toString("hex",0,a).replace(/(.{2})/g,"$1 ").trim(),this.length>a&&(i+=" ... "),"<Buffer "+i+">"},n&&(u.prototype[n]=u.prototype.inspect),u.prototype.compare=function(i,a,l,b,v){if(xe(i,Uint8Array)&&(i=u.from(i,i.offset,i.byteLength)),!u.isBuffer(i))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof i);if(a===void 0&&(a=0),l===void 0&&(l=i?i.length:0),b===void 0&&(b=0),v===void 0&&(v=this.length),a<0||l>i.length||b<0||v>this.length)throw new RangeError("out of range index");if(b>=v&&a>=l)return 0;if(b>=v)return-1;if(a>=l)return 1;if(a>>>=0,l>>>=0,b>>>=0,v>>>=0,this===i)return 0;let B=v-b,G=l-a;const re=Math.min(B,G),X=this.slice(b,v),ne=i.slice(a,l);for(let V=0;V<re;++V)if(X[V]!==ne[V]){B=X[V],G=ne[V];break}return B<G?-1:G<B?1:0};function S(f,i,a,l,b){if(f.length===0)return-1;if(typeof a=="string"?(l=a,a=0):a>2147483647?a=2147483647:a<-2147483648&&(a=-2147483648),a=+a,Je(a)&&(a=b?0:f.length-1),a<0&&(a=f.length+a),a>=f.length){if(b)return-1;a=f.length-1}else if(a<0)if(b)a=0;else return-1;if(typeof i=="string"&&(i=u.from(i,l)),u.isBuffer(i))return i.length===0?-1:j(f,i,a,l,b);if(typeof i=="number")return i=i&255,typeof Uint8Array.prototype.indexOf=="function"?b?Uint8Array.prototype.indexOf.call(f,i,a):Uint8Array.prototype.lastIndexOf.call(f,i,a):j(f,[i],a,l,b);throw new TypeError("val must be string, number or Buffer")}function j(f,i,a,l,b){let v=1,B=f.length,G=i.length;if(l!==void 0&&(l=String(l).toLowerCase(),l==="ucs2"||l==="ucs-2"||l==="utf16le"||l==="utf-16le")){if(f.length<2||i.length<2)return-1;v=2,B/=2,G/=2,a/=2}function re(ne,V){return v===1?ne[V]:ne.readUInt16BE(V*v)}let X;if(b){let ne=-1;for(X=a;X<B;X++)if(re(f,X)===re(i,ne===-1?0:X-ne)){if(ne===-1&&(ne=X),X-ne+1===G)return ne*v}else ne!==-1&&(X-=X-ne),ne=-1}else for(a+G>B&&(a=B-G),X=a;X>=0;X--){let ne=!0;for(let V=0;V<G;V++)if(re(f,X+V)!==re(i,V)){ne=!1;break}if(ne)return X}return-1}u.prototype.includes=function(i,a,l){return this.indexOf(i,a,l)!==-1},u.prototype.indexOf=function(i,a,l){return S(this,i,a,l,!0)},u.prototype.lastIndexOf=function(i,a,l){return S(this,i,a,l,!1)};function D(f,i,a,l){a=Number(a)||0;const b=f.length-a;l?(l=Number(l),l>b&&(l=b)):l=b;const v=i.length;l>v/2&&(l=v/2);let B;for(B=0;B<l;++B){const G=parseInt(i.substr(B*2,2),16);if(Je(G))return B;f[a+B]=G}return B}function U(f,i,a,l){return nt(z(i,f.length-a),f,a,l)}function ee(f,i,a,l){return nt(qe(i),f,a,l)}function Ie(f,i,a,l){return nt(yt(i),f,a,l)}function De(f,i,a,l){return nt(rt(i,f.length-a),f,a,l)}u.prototype.write=function(i,a,l,b){if(a===void 0)b="utf8",l=this.length,a=0;else if(l===void 0&&typeof a=="string")b=a,l=this.length,a=0;else if(isFinite(a))a=a>>>0,isFinite(l)?(l=l>>>0,b===void 0&&(b="utf8")):(b=l,l=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const v=this.length-a;if((l===void 0||l>v)&&(l=v),i.length>0&&(l<0||a<0)||a>this.length)throw new RangeError("Attempt to write outside buffer bounds");b||(b="utf8");let B=!1;for(;;)switch(b){case"hex":return D(this,i,a,l);case"utf8":case"utf-8":return U(this,i,a,l);case"ascii":case"latin1":case"binary":return ee(this,i,a,l);case"base64":return Ie(this,i,a,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return De(this,i,a,l);default:if(B)throw new TypeError("Unknown encoding: "+b);b=(""+b).toLowerCase(),B=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ae(f,i,a){return i===0&&a===f.length?t.fromByteArray(f):t.fromByteArray(f.slice(i,a))}function _e(f,i,a){a=Math.min(f.length,a);const l=[];let b=i;for(;b<a;){const v=f[b];let B=null,G=v>239?4:v>223?3:v>191?2:1;if(b+G<=a){let re,X,ne,V;switch(G){case 1:v<128&&(B=v);break;case 2:re=f[b+1],(re&192)===128&&(V=(v&31)<<6|re&63,V>127&&(B=V));break;case 3:re=f[b+1],X=f[b+2],(re&192)===128&&(X&192)===128&&(V=(v&15)<<12|(re&63)<<6|X&63,V>2047&&(V<55296||V>57343)&&(B=V));break;case 4:re=f[b+1],X=f[b+2],ne=f[b+3],(re&192)===128&&(X&192)===128&&(ne&192)===128&&(V=(v&15)<<18|(re&63)<<12|(X&63)<<6|ne&63,V>65535&&V<1114112&&(B=V))}}B===null?(B=65533,G=1):B>65535&&(B-=65536,l.push(B>>>10&1023|55296),B=56320|B&1023),l.push(B),b+=G}return Ve(l)}const me=4096;function Ve(f){const i=f.length;if(i<=me)return String.fromCharCode.apply(String,f);let a="",l=0;for(;l<i;)a+=String.fromCharCode.apply(String,f.slice(l,l+=me));return a}function ke(f,i,a){let l="";a=Math.min(f.length,a);for(let b=i;b<a;++b)l+=String.fromCharCode(f[b]&127);return l}function $e(f,i,a){let l="";a=Math.min(f.length,a);for(let b=i;b<a;++b)l+=String.fromCharCode(f[b]);return l}function Te(f,i,a){const l=f.length;(!i||i<0)&&(i=0),(!a||a<0||a>l)&&(a=l);let b="";for(let v=i;v<a;++v)b+=gt[f[v]];return b}function He(f,i,a){const l=f.slice(i,a);let b="";for(let v=0;v<l.length-1;v+=2)b+=String.fromCharCode(l[v]+l[v+1]*256);return b}u.prototype.slice=function(i,a){const l=this.length;i=~~i,a=a===void 0?l:~~a,i<0?(i+=l,i<0&&(i=0)):i>l&&(i=l),a<0?(a+=l,a<0&&(a=0)):a>l&&(a=l),a<i&&(a=i);const b=this.subarray(i,a);return Object.setPrototypeOf(b,u.prototype),b};function Y(f,i,a){if(f%1!==0||f<0)throw new RangeError("offset is not uint");if(f+i>a)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(i,a,l){i=i>>>0,a=a>>>0,l||Y(i,a,this.length);let b=this[i],v=1,B=0;for(;++B<a&&(v*=256);)b+=this[i+B]*v;return b},u.prototype.readUintBE=u.prototype.readUIntBE=function(i,a,l){i=i>>>0,a=a>>>0,l||Y(i,a,this.length);let b=this[i+--a],v=1;for(;a>0&&(v*=256);)b+=this[i+--a]*v;return b},u.prototype.readUint8=u.prototype.readUInt8=function(i,a){return i=i>>>0,a||Y(i,1,this.length),this[i]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(i,a){return i=i>>>0,a||Y(i,2,this.length),this[i]|this[i+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(i,a){return i=i>>>0,a||Y(i,2,this.length),this[i]<<8|this[i+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(i,a){return i=i>>>0,a||Y(i,4,this.length),(this[i]|this[i+1]<<8|this[i+2]<<16)+this[i+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(i,a){return i=i>>>0,a||Y(i,4,this.length),this[i]*16777216+(this[i+1]<<16|this[i+2]<<8|this[i+3])},u.prototype.readBigUInt64LE=Ee(function(i){i=i>>>0,I(i,"offset");const a=this[i],l=this[i+7];(a===void 0||l===void 0)&&M(i,this.length-8);const b=a+this[++i]*2**8+this[++i]*2**16+this[++i]*2**24,v=this[++i]+this[++i]*2**8+this[++i]*2**16+l*2**24;return BigInt(b)+(BigInt(v)<<BigInt(32))}),u.prototype.readBigUInt64BE=Ee(function(i){i=i>>>0,I(i,"offset");const a=this[i],l=this[i+7];(a===void 0||l===void 0)&&M(i,this.length-8);const b=a*2**24+this[++i]*2**16+this[++i]*2**8+this[++i],v=this[++i]*2**24+this[++i]*2**16+this[++i]*2**8+l;return(BigInt(b)<<BigInt(32))+BigInt(v)}),u.prototype.readIntLE=function(i,a,l){i=i>>>0,a=a>>>0,l||Y(i,a,this.length);let b=this[i],v=1,B=0;for(;++B<a&&(v*=256);)b+=this[i+B]*v;return v*=128,b>=v&&(b-=Math.pow(2,8*a)),b},u.prototype.readIntBE=function(i,a,l){i=i>>>0,a=a>>>0,l||Y(i,a,this.length);let b=a,v=1,B=this[i+--b];for(;b>0&&(v*=256);)B+=this[i+--b]*v;return v*=128,B>=v&&(B-=Math.pow(2,8*a)),B},u.prototype.readInt8=function(i,a){return i=i>>>0,a||Y(i,1,this.length),this[i]&128?(255-this[i]+1)*-1:this[i]},u.prototype.readInt16LE=function(i,a){i=i>>>0,a||Y(i,2,this.length);const l=this[i]|this[i+1]<<8;return l&32768?l|4294901760:l},u.prototype.readInt16BE=function(i,a){i=i>>>0,a||Y(i,2,this.length);const l=this[i+1]|this[i]<<8;return l&32768?l|4294901760:l},u.prototype.readInt32LE=function(i,a){return i=i>>>0,a||Y(i,4,this.length),this[i]|this[i+1]<<8|this[i+2]<<16|this[i+3]<<24},u.prototype.readInt32BE=function(i,a){return i=i>>>0,a||Y(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},u.prototype.readBigInt64LE=Ee(function(i){i=i>>>0,I(i,"offset");const a=this[i],l=this[i+7];(a===void 0||l===void 0)&&M(i,this.length-8);const b=this[i+4]+this[i+5]*2**8+this[i+6]*2**16+(l<<24);return(BigInt(b)<<BigInt(32))+BigInt(a+this[++i]*2**8+this[++i]*2**16+this[++i]*2**24)}),u.prototype.readBigInt64BE=Ee(function(i){i=i>>>0,I(i,"offset");const a=this[i],l=this[i+7];(a===void 0||l===void 0)&&M(i,this.length-8);const b=(a<<24)+this[++i]*2**16+this[++i]*2**8+this[++i];return(BigInt(b)<<BigInt(32))+BigInt(this[++i]*2**24+this[++i]*2**16+this[++i]*2**8+l)}),u.prototype.readFloatLE=function(i,a){return i=i>>>0,a||Y(i,4,this.length),r.read(this,i,!0,23,4)},u.prototype.readFloatBE=function(i,a){return i=i>>>0,a||Y(i,4,this.length),r.read(this,i,!1,23,4)},u.prototype.readDoubleLE=function(i,a){return i=i>>>0,a||Y(i,8,this.length),r.read(this,i,!0,52,8)},u.prototype.readDoubleBE=function(i,a){return i=i>>>0,a||Y(i,8,this.length),r.read(this,i,!1,52,8)};function ie(f,i,a,l,b,v){if(!u.isBuffer(f))throw new TypeError('"buffer" argument must be a Buffer instance');if(i>b||i<v)throw new RangeError('"value" argument is out of bounds');if(a+l>f.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(i,a,l,b){if(i=+i,a=a>>>0,l=l>>>0,!b){const G=Math.pow(2,8*l)-1;ie(this,i,a,l,G,0)}let v=1,B=0;for(this[a]=i&255;++B<l&&(v*=256);)this[a+B]=i/v&255;return a+l},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(i,a,l,b){if(i=+i,a=a>>>0,l=l>>>0,!b){const G=Math.pow(2,8*l)-1;ie(this,i,a,l,G,0)}let v=l-1,B=1;for(this[a+v]=i&255;--v>=0&&(B*=256);)this[a+v]=i/B&255;return a+l},u.prototype.writeUint8=u.prototype.writeUInt8=function(i,a,l){return i=+i,a=a>>>0,l||ie(this,i,a,1,255,0),this[a]=i&255,a+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(i,a,l){return i=+i,a=a>>>0,l||ie(this,i,a,2,65535,0),this[a]=i&255,this[a+1]=i>>>8,a+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(i,a,l){return i=+i,a=a>>>0,l||ie(this,i,a,2,65535,0),this[a]=i>>>8,this[a+1]=i&255,a+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(i,a,l){return i=+i,a=a>>>0,l||ie(this,i,a,4,4294967295,0),this[a+3]=i>>>24,this[a+2]=i>>>16,this[a+1]=i>>>8,this[a]=i&255,a+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(i,a,l){return i=+i,a=a>>>0,l||ie(this,i,a,4,4294967295,0),this[a]=i>>>24,this[a+1]=i>>>16,this[a+2]=i>>>8,this[a+3]=i&255,a+4};function ve(f,i,a,l,b){d(i,l,b,f,a,7);let v=Number(i&BigInt(4294967295));f[a++]=v,v=v>>8,f[a++]=v,v=v>>8,f[a++]=v,v=v>>8,f[a++]=v;let B=Number(i>>BigInt(32)&BigInt(4294967295));return f[a++]=B,B=B>>8,f[a++]=B,B=B>>8,f[a++]=B,B=B>>8,f[a++]=B,a}function je(f,i,a,l,b){d(i,l,b,f,a,7);let v=Number(i&BigInt(4294967295));f[a+7]=v,v=v>>8,f[a+6]=v,v=v>>8,f[a+5]=v,v=v>>8,f[a+4]=v;let B=Number(i>>BigInt(32)&BigInt(4294967295));return f[a+3]=B,B=B>>8,f[a+2]=B,B=B>>8,f[a+1]=B,B=B>>8,f[a]=B,a+8}u.prototype.writeBigUInt64LE=Ee(function(i,a=0){return ve(this,i,a,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Ee(function(i,a=0){return je(this,i,a,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(i,a,l,b){if(i=+i,a=a>>>0,!b){const re=Math.pow(2,8*l-1);ie(this,i,a,l,re-1,-re)}let v=0,B=1,G=0;for(this[a]=i&255;++v<l&&(B*=256);)i<0&&G===0&&this[a+v-1]!==0&&(G=1),this[a+v]=(i/B>>0)-G&255;return a+l},u.prototype.writeIntBE=function(i,a,l,b){if(i=+i,a=a>>>0,!b){const re=Math.pow(2,8*l-1);ie(this,i,a,l,re-1,-re)}let v=l-1,B=1,G=0;for(this[a+v]=i&255;--v>=0&&(B*=256);)i<0&&G===0&&this[a+v+1]!==0&&(G=1),this[a+v]=(i/B>>0)-G&255;return a+l},u.prototype.writeInt8=function(i,a,l){return i=+i,a=a>>>0,l||ie(this,i,a,1,127,-128),i<0&&(i=255+i+1),this[a]=i&255,a+1},u.prototype.writeInt16LE=function(i,a,l){return i=+i,a=a>>>0,l||ie(this,i,a,2,32767,-32768),this[a]=i&255,this[a+1]=i>>>8,a+2},u.prototype.writeInt16BE=function(i,a,l){return i=+i,a=a>>>0,l||ie(this,i,a,2,32767,-32768),this[a]=i>>>8,this[a+1]=i&255,a+2},u.prototype.writeInt32LE=function(i,a,l){return i=+i,a=a>>>0,l||ie(this,i,a,4,2147483647,-2147483648),this[a]=i&255,this[a+1]=i>>>8,this[a+2]=i>>>16,this[a+3]=i>>>24,a+4},u.prototype.writeInt32BE=function(i,a,l){return i=+i,a=a>>>0,l||ie(this,i,a,4,2147483647,-2147483648),i<0&&(i=4294967295+i+1),this[a]=i>>>24,this[a+1]=i>>>16,this[a+2]=i>>>8,this[a+3]=i&255,a+4},u.prototype.writeBigInt64LE=Ee(function(i,a=0){return ve(this,i,a,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Ee(function(i,a=0){return je(this,i,a,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ne(f,i,a,l,b,v){if(a+l>f.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("Index out of range")}function m(f,i,a,l,b){return i=+i,a=a>>>0,b||Ne(f,i,a,4),r.write(f,i,a,l,23,4),a+4}u.prototype.writeFloatLE=function(i,a,l){return m(this,i,a,!0,l)},u.prototype.writeFloatBE=function(i,a,l){return m(this,i,a,!1,l)};function _(f,i,a,l,b){return i=+i,a=a>>>0,b||Ne(f,i,a,8),r.write(f,i,a,l,52,8),a+8}u.prototype.writeDoubleLE=function(i,a,l){return _(this,i,a,!0,l)},u.prototype.writeDoubleBE=function(i,a,l){return _(this,i,a,!1,l)},u.prototype.copy=function(i,a,l,b){if(!u.isBuffer(i))throw new TypeError("argument should be a Buffer");if(l||(l=0),!b&&b!==0&&(b=this.length),a>=i.length&&(a=i.length),a||(a=0),b>0&&b<l&&(b=l),b===l||i.length===0||this.length===0)return 0;if(a<0)throw new RangeError("targetStart out of bounds");if(l<0||l>=this.length)throw new RangeError("Index out of range");if(b<0)throw new RangeError("sourceEnd out of bounds");b>this.length&&(b=this.length),i.length-a<b-l&&(b=i.length-a+l);const v=b-l;return this===i&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(a,l,b):Uint8Array.prototype.set.call(i,this.subarray(l,b),a),v},u.prototype.fill=function(i,a,l,b){if(typeof i=="string"){if(typeof a=="string"?(b=a,a=0,l=this.length):typeof l=="string"&&(b=l,l=this.length),b!==void 0&&typeof b!="string")throw new TypeError("encoding must be a string");if(typeof b=="string"&&!u.isEncoding(b))throw new TypeError("Unknown encoding: "+b);if(i.length===1){const B=i.charCodeAt(0);(b==="utf8"&&B<128||b==="latin1")&&(i=B)}}else typeof i=="number"?i=i&255:typeof i=="boolean"&&(i=Number(i));if(a<0||this.length<a||this.length<l)throw new RangeError("Out of range index");if(l<=a)return this;a=a>>>0,l=l===void 0?this.length:l>>>0,i||(i=0);let v;if(typeof i=="number")for(v=a;v<l;++v)this[v]=i;else{const B=u.isBuffer(i)?i:u.from(i,b),G=B.length;if(G===0)throw new TypeError('The value "'+i+'" is invalid for argument "value"');for(v=0;v<l-a;++v)this[v+a]=B[v%G]}return this};const A={};function $(f,i,a){A[f]=class extends a{constructor(){super(),Object.defineProperty(this,"message",{value:i.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${f}]`,this.stack,delete this.name}get code(){return f}set code(b){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:b,writable:!0})}toString(){return`${this.name} [${f}]: ${this.message}`}}}$("ERR_BUFFER_OUT_OF_BOUNDS",function(f){return f?`${f} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),$("ERR_INVALID_ARG_TYPE",function(f,i){return`The "${f}" argument must be of type number. Received type ${typeof i}`},TypeError),$("ERR_OUT_OF_RANGE",function(f,i,a){let l=`The value of "${f}" is out of range.`,b=a;return Number.isInteger(a)&&Math.abs(a)>2**32?b=q(String(a)):typeof a=="bigint"&&(b=String(a),(a>BigInt(2)**BigInt(32)||a<-(BigInt(2)**BigInt(32)))&&(b=q(b)),b+="n"),l+=` It must be ${i}. Received ${b}`,l},RangeError);function q(f){let i="",a=f.length;const l=f[0]==="-"?1:0;for(;a>=l+4;a-=3)i=`_${f.slice(a-3,a)}${i}`;return`${f.slice(0,a)}${i}`}function h(f,i,a){I(i,"offset"),(f[i]===void 0||f[i+a]===void 0)&&M(i,f.length-(a+1))}function d(f,i,a,l,b,v){if(f>a||f<i){const B=typeof i=="bigint"?"n":"";let G;throw i===0||i===BigInt(0)?G=`>= 0${B} and < 2${B} ** ${(v+1)*8}${B}`:G=`>= -(2${B} ** ${(v+1)*8-1}${B}) and < 2 ** ${(v+1)*8-1}${B}`,new A.ERR_OUT_OF_RANGE("value",G,f)}h(l,b,v)}function I(f,i){if(typeof f!="number")throw new A.ERR_INVALID_ARG_TYPE(i,"number",f)}function M(f,i,a){throw Math.floor(f)!==f?(I(f,a),new A.ERR_OUT_OF_RANGE("offset","an integer",f)):i<0?new A.ERR_BUFFER_OUT_OF_BOUNDS:new A.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${i}`,f)}const Q=/[^+/0-9A-Za-z-_]/g;function W(f){if(f=f.split("=")[0],f=f.trim().replace(Q,""),f.length<2)return"";for(;f.length%4!==0;)f=f+"=";return f}function z(f,i){i=i||1/0;let a;const l=f.length;let b=null;const v=[];for(let B=0;B<l;++B){if(a=f.charCodeAt(B),a>55295&&a<57344){if(!b){if(a>56319){(i-=3)>-1&&v.push(239,191,189);continue}else if(B+1===l){(i-=3)>-1&&v.push(239,191,189);continue}b=a;continue}if(a<56320){(i-=3)>-1&&v.push(239,191,189),b=a;continue}a=(b-55296<<10|a-56320)+65536}else b&&(i-=3)>-1&&v.push(239,191,189);if(b=null,a<128){if((i-=1)<0)break;v.push(a)}else if(a<2048){if((i-=2)<0)break;v.push(a>>6|192,a&63|128)}else if(a<65536){if((i-=3)<0)break;v.push(a>>12|224,a>>6&63|128,a&63|128)}else if(a<1114112){if((i-=4)<0)break;v.push(a>>18|240,a>>12&63|128,a>>6&63|128,a&63|128)}else throw new Error("Invalid code point")}return v}function qe(f){const i=[];for(let a=0;a<f.length;++a)i.push(f.charCodeAt(a)&255);return i}function rt(f,i){let a,l,b;const v=[];for(let B=0;B<f.length&&!((i-=2)<0);++B)a=f.charCodeAt(B),l=a>>8,b=a%256,v.push(b),v.push(l);return v}function yt(f){return t.toByteArray(W(f))}function nt(f,i,a,l){let b;for(b=0;b<l&&!(b+a>=i.length||b>=f.length);++b)i[b+a]=f[b];return b}function xe(f,i){return f instanceof i||f!=null&&f.constructor!=null&&f.constructor.name!=null&&f.constructor.name===i.name}function Je(f){return f!==f}const gt=function(){const f="0123456789abcdef",i=new Array(256);for(let a=0;a<16;++a){const l=a*16;for(let b=0;b<16;++b)i[l+b]=f[a]+f[b]}return i}();function Ee(f){return typeof BigInt>"u"?Ye:f}function Ye(){throw new Error("BigInt not supported")}})(pt);/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(e,t){var r=pt,n=r.Buffer;function o(c,u){for(var p in c)u[p]=c[p]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=s);function s(c,u,p){return n(c,u,p)}s.prototype=Object.create(n.prototype),o(n,s),s.from=function(c,u,p){if(typeof c=="number")throw new TypeError("Argument must not be a number");return n(c,u,p)},s.alloc=function(c,u,p){if(typeof c!="number")throw new TypeError("Argument must be a number");var y=n(c);return u!==void 0?typeof p=="string"?y.fill(u,p):y.fill(u):y.fill(0),y},s.allocUnsafe=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return n(c)},s.allocUnsafeSlow=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(c)}})(Or,Or.exports);var we=Or.exports,lr=65536,to=4294967295;function ro(){throw new Error(`Secure random number generation is not supported by this browser.
29
+ Use Chrome, Firefox or Internet Explorer 11`)}var no=we.Buffer,Wt=ze.crypto||ze.msCrypto;Wt&&Wt.getRandomValues?Pr.exports=io:Pr.exports=ro;function io(e,t){if(e>to)throw new RangeError("requested too many random bytes");var r=no.allocUnsafe(e);if(e>0)if(e>lr)for(var n=0;n<e;n+=lr)Wt.getRandomValues(r.slice(n,n+lr));else Wt.getRandomValues(r);return typeof t=="function"?process.nextTick(function(){t(null,r)}):r}var ao=Pr.exports,Nr={exports:{}};typeof Object.create=="function"?Nr.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Nr.exports=function(t,r){if(r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}};var pe=Nr.exports,Fr={exports:{}},Gr={exports:{}},ut=typeof Reflect=="object"?Reflect:null,un=ut&&typeof ut.apply=="function"?ut.apply:function(t,r,n){return Function.prototype.apply.call(t,r,n)},Dt;ut&&typeof ut.ownKeys=="function"?Dt=ut.ownKeys:Object.getOwnPropertySymbols?Dt=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Dt=function(t){return Object.getOwnPropertyNames(t)};function oo(e){console&&console.warn&&console.warn(e)}var ii=Number.isNaN||function(t){return t!==t};function K(){K.init.call(this)}Gr.exports=K;Gr.exports.once=co;K.EventEmitter=K;K.prototype._events=void 0;K.prototype._eventsCount=0;K.prototype._maxListeners=void 0;var cn=10;function Yt(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(K,"defaultMaxListeners",{enumerable:!0,get:function(){return cn},set:function(e){if(typeof e!="number"||e<0||ii(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");cn=e}});K.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};K.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||ii(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function ai(e){return e._maxListeners===void 0?K.defaultMaxListeners:e._maxListeners}K.prototype.getMaxListeners=function(){return ai(this)};K.prototype.emit=function(t){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var o=t==="error",s=this._events;if(s!==void 0)o=o&&s.error===void 0;else if(!o)return!1;if(o){var c;if(r.length>0&&(c=r[0]),c instanceof Error)throw c;var u=new Error("Unhandled error."+(c?" ("+c.message+")":""));throw u.context=c,u}var p=s[t];if(p===void 0)return!1;if(typeof p=="function")un(p,this,r);else for(var y=p.length,g=ci(p,y),n=0;n<y;++n)un(g[n],this,r);return!0};function oi(e,t,r,n){var o,s,c;if(Yt(r),s=e._events,s===void 0?(s=e._events=Object.create(null),e._eventsCount=0):(s.newListener!==void 0&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),c=s[t]),c===void 0)c=s[t]=r,++e._eventsCount;else if(typeof c=="function"?c=s[t]=n?[r,c]:[c,r]:n?c.unshift(r):c.push(r),o=ai(e),o>0&&c.length>o&&!c.warned){c.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=c.length,oo(u)}return e}K.prototype.addListener=function(t,r){return oi(this,t,r,!1)};K.prototype.on=K.prototype.addListener;K.prototype.prependListener=function(t,r){return oi(this,t,r,!0)};function so(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function si(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=so.bind(n);return o.listener=r,n.wrapFn=o,o}K.prototype.once=function(t,r){return Yt(r),this.on(t,si(this,t,r)),this};K.prototype.prependOnceListener=function(t,r){return Yt(r),this.prependListener(t,si(this,t,r)),this};K.prototype.removeListener=function(t,r){var n,o,s,c,u;if(Yt(r),o=this._events,o===void 0)return this;if(n=o[t],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete o[t],o.removeListener&&this.emit("removeListener",t,n.listener||r));else if(typeof n!="function"){for(s=-1,c=n.length-1;c>=0;c--)if(n[c]===r||n[c].listener===r){u=n[c].listener,s=c;break}if(s<0)return this;s===0?n.shift():fo(n,s),n.length===1&&(o[t]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",t,u||r)}return this};K.prototype.off=K.prototype.removeListener;K.prototype.removeAllListeners=function(t){var r,n,o;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[t]),this;if(arguments.length===0){var s=Object.keys(n),c;for(o=0;o<s.length;++o)c=s[o],c!=="removeListener"&&this.removeAllListeners(c);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[t],typeof r=="function")this.removeListener(t,r);else if(r!==void 0)for(o=r.length-1;o>=0;o--)this.removeListener(t,r[o]);return this};function fi(e,t,r){var n=e._events;if(n===void 0)return[];var o=n[t];return o===void 0?[]:typeof o=="function"?r?[o.listener||o]:[o]:r?uo(o):ci(o,o.length)}K.prototype.listeners=function(t){return fi(this,t,!0)};K.prototype.rawListeners=function(t){return fi(this,t,!1)};K.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):ui.call(e,t)};K.prototype.listenerCount=ui;function ui(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}K.prototype.eventNames=function(){return this._eventsCount>0?Dt(this._events):[]};function ci(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function fo(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function uo(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function co(e,t){return new Promise(function(r,n){function o(c){e.removeListener(t,s),n(c)}function s(){typeof e.removeListener=="function"&&e.removeListener("error",o),r([].slice.call(arguments))}li(e,t,s,{once:!0}),t!=="error"&&lo(e,o,{once:!0})})}function lo(e,t,r){typeof e.on=="function"&&li(e,"error",t,r)}function li(e,t,r,n){if(typeof e.on=="function")n.once?e.once(t,r):e.on(t,r);else if(typeof e.addEventListener=="function")e.addEventListener(t,function o(s){n.once&&e.removeEventListener(t,o),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}var hi=Gr.exports,di=hi.EventEmitter;const ho={},po=Object.freeze(Object.defineProperty({__proto__:null,default:ho},Symbol.toStringTag,{value:"Module"})),zr=Da(po);var hr,ln;function bo(){if(ln)return hr;ln=1;function e(R,C){var E=Object.keys(R);if(Object.getOwnPropertySymbols){var T=Object.getOwnPropertySymbols(R);C&&(T=T.filter(function(O){return Object.getOwnPropertyDescriptor(R,O).enumerable})),E.push.apply(E,T)}return E}function t(R){for(var C=1;C<arguments.length;C++){var E=arguments[C]!=null?arguments[C]:{};C%2?e(Object(E),!0).forEach(function(T){r(R,T,E[T])}):Object.getOwnPropertyDescriptors?Object.defineProperties(R,Object.getOwnPropertyDescriptors(E)):e(Object(E)).forEach(function(T){Object.defineProperty(R,T,Object.getOwnPropertyDescriptor(E,T))})}return R}function r(R,C,E){return C=c(C),C in R?Object.defineProperty(R,C,{value:E,enumerable:!0,configurable:!0,writable:!0}):R[C]=E,R}function n(R,C){if(!(R instanceof C))throw new TypeError("Cannot call a class as a function")}function o(R,C){for(var E=0;E<C.length;E++){var T=C[E];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(R,c(T.key),T)}}function s(R,C,E){return C&&o(R.prototype,C),Object.defineProperty(R,"prototype",{writable:!1}),R}function c(R){var C=u(R,"string");return typeof C=="symbol"?C:String(C)}function u(R,C){if(typeof R!="object"||R===null)return R;var E=R[Symbol.toPrimitive];if(E!==void 0){var T=E.call(R,C||"default");if(typeof T!="object")return T;throw new TypeError("@@toPrimitive must return a primitive value.")}return(C==="string"?String:Number)(R)}var p=pt,y=p.Buffer,g=zr,w=g.inspect,x=w&&w.custom||"inspect";function k(R,C,E){y.prototype.copy.call(R,C,E)}return hr=function(){function R(){n(this,R),this.head=null,this.tail=null,this.length=0}return s(R,[{key:"push",value:function(E){var T={data:E,next:null};this.length>0?this.tail.next=T:this.head=T,this.tail=T,++this.length}},{key:"unshift",value:function(E){var T={data:E,next:this.head};this.length===0&&(this.tail=T),this.head=T,++this.length}},{key:"shift",value:function(){if(this.length!==0){var E=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,E}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(E){if(this.length===0)return"";for(var T=this.head,O=""+T.data;T=T.next;)O+=E+T.data;return O}},{key:"concat",value:function(E){if(this.length===0)return y.alloc(0);for(var T=y.allocUnsafe(E>>>0),O=this.head,F=0;O;)k(O.data,T,F),F+=O.data.length,O=O.next;return T}},{key:"consume",value:function(E,T){var O;return E<this.head.data.length?(O=this.head.data.slice(0,E),this.head.data=this.head.data.slice(E)):E===this.head.data.length?O=this.shift():O=T?this._getString(E):this._getBuffer(E),O}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(E){var T=this.head,O=1,F=T.data;for(E-=F.length;T=T.next;){var N=T.data,L=E>N.length?N.length:E;if(L===N.length?F+=N:F+=N.slice(0,E),E-=L,E===0){L===N.length?(++O,T.next?this.head=T.next:this.head=this.tail=null):(this.head=T,T.data=N.slice(L));break}++O}return this.length-=O,F}},{key:"_getBuffer",value:function(E){var T=y.allocUnsafe(E),O=this.head,F=1;for(O.data.copy(T),E-=O.data.length;O=O.next;){var N=O.data,L=E>N.length?N.length:E;if(N.copy(T,T.length-E,0,L),E-=L,E===0){L===N.length?(++F,O.next?this.head=O.next:this.head=this.tail=null):(this.head=O,O.data=N.slice(L));break}++F}return this.length-=F,T}},{key:x,value:function(E,T){return w(this,t(t({},T),{},{depth:0,customInspect:!1}))}}]),R}(),hr}function yo(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return n||o?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(Lr,this,e)):process.nextTick(Lr,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(s){!t&&s?r._writableState?r._writableState.errorEmitted?process.nextTick($t,r):(r._writableState.errorEmitted=!0,process.nextTick(hn,r,s)):process.nextTick(hn,r,s):t?(process.nextTick($t,r),t(s)):process.nextTick($t,r)}),this)}function hn(e,t){Lr(e,t),$t(e)}function $t(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function go(){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)}function Lr(e,t){e.emit("error",t)}function _o(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}var pi={destroy:yo,undestroy:go,errorOrDestroy:_o},et={};function mo(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var bi={};function Se(e,t,r){r||(r=Error);function n(s,c,u){return typeof t=="string"?t:t(s,c,u)}var o=function(s){mo(c,s);function c(u,p,y){return s.call(this,n(u,p,y))||this}return c}(r);o.prototype.name=r.name,o.prototype.code=e,bi[e]=o}function dn(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(n){return String(n)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:r===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function wo(e,t,r){return e.substr(0,t.length)===t}function vo(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function xo(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}Se("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);Se("ERR_INVALID_ARG_TYPE",function(e,t,r){var n;typeof t=="string"&&wo(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";var o;if(vo(e," argument"))o="The ".concat(e," ").concat(n," ").concat(dn(t,"type"));else{var s=xo(e,".")?"property":"argument";o='The "'.concat(e,'" ').concat(s," ").concat(n," ").concat(dn(t,"type"))}return o+=". Received type ".concat(typeof r),o},TypeError);Se("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Se("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});Se("ERR_STREAM_PREMATURE_CLOSE","Premature close");Se("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});Se("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Se("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Se("ERR_STREAM_WRITE_AFTER_END","write after end");Se("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Se("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);Se("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");et.codes=bi;var Eo=et.codes.ERR_INVALID_OPT_VALUE;function Bo(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function Ro(e,t,r,n){var o=Bo(t,n,r);if(o!=null){if(!(isFinite(o)&&Math.floor(o)===o)||o<0){var s=n?r:"highWaterMark";throw new Eo(s,o)}return Math.floor(o)}return e.objectMode?16:16*1024}var yi={getHighWaterMark:Ro},So=Io;function Io(e,t){if(dr("noDeprecation"))return e;var r=!1;function n(){if(!r){if(dr("throwDeprecation"))throw new Error(t);dr("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return n}function dr(e){try{if(!ze.localStorage)return!1}catch{return!1}var t=ze.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}var pr,pn;function gi(){if(pn)return pr;pn=1,pr=D;function e(m){var _=this;this.next=null,this.entry=null,this.finish=function(){Ne(_,m)}}var t;D.WritableState=S;var r={deprecate:So},n=di,o=pt.Buffer,s=(typeof ze<"u"?ze:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function c(m){return o.from(m)}function u(m){return o.isBuffer(m)||m instanceof s}var p=pi,y=yi,g=y.getHighWaterMark,w=et.codes,x=w.ERR_INVALID_ARG_TYPE,k=w.ERR_METHOD_NOT_IMPLEMENTED,R=w.ERR_MULTIPLE_CALLBACK,C=w.ERR_STREAM_CANNOT_PIPE,E=w.ERR_STREAM_DESTROYED,T=w.ERR_STREAM_NULL_VALUES,O=w.ERR_STREAM_WRITE_AFTER_END,F=w.ERR_UNKNOWN_ENCODING,N=p.errorOrDestroy;pe(D,n);function L(){}function S(m,_,A){t=t||dt(),m=m||{},typeof A!="boolean"&&(A=_ instanceof t),this.objectMode=!!m.objectMode,A&&(this.objectMode=this.objectMode||!!m.writableObjectMode),this.highWaterMark=g(this,m,"writableHighWaterMark",A),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var $=m.decodeStrings===!1;this.decodeStrings=!$,this.defaultEncoding=m.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(q){Ve(_,q)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=m.emitClose!==!1,this.autoDestroy=!!m.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}S.prototype.getBuffer=function(){for(var _=this.bufferedRequest,A=[];_;)A.push(_),_=_.next;return A},function(){try{Object.defineProperty(S.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var j;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(j=Function.prototype[Symbol.hasInstance],Object.defineProperty(D,Symbol.hasInstance,{value:function(_){return j.call(this,_)?!0:this!==D?!1:_&&_._writableState instanceof S}})):j=function(_){return _ instanceof this};function D(m){t=t||dt();var _=this instanceof t;if(!_&&!j.call(D,this))return new D(m);this._writableState=new S(m,this,_),this.writable=!0,m&&(typeof m.write=="function"&&(this._write=m.write),typeof m.writev=="function"&&(this._writev=m.writev),typeof m.destroy=="function"&&(this._destroy=m.destroy),typeof m.final=="function"&&(this._final=m.final)),n.call(this)}D.prototype.pipe=function(){N(this,new C)};function U(m,_){var A=new O;N(m,A),process.nextTick(_,A)}function ee(m,_,A,$){var q;return A===null?q=new T:typeof A!="string"&&!_.objectMode&&(q=new x("chunk",["string","Buffer"],A)),q?(N(m,q),process.nextTick($,q),!1):!0}D.prototype.write=function(m,_,A){var $=this._writableState,q=!1,h=!$.objectMode&&u(m);return h&&!o.isBuffer(m)&&(m=c(m)),typeof _=="function"&&(A=_,_=null),h?_="buffer":_||(_=$.defaultEncoding),typeof A!="function"&&(A=L),$.ending?U(this,A):(h||ee(this,$,m,A))&&($.pendingcb++,q=De(this,$,h,m,_,A)),q},D.prototype.cork=function(){this._writableState.corked++},D.prototype.uncork=function(){var m=this._writableState;m.corked&&(m.corked--,!m.writing&&!m.corked&&!m.bufferProcessing&&m.bufferedRequest&&Te(this,m))},D.prototype.setDefaultEncoding=function(_){if(typeof _=="string"&&(_=_.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((_+"").toLowerCase())>-1))throw new F(_);return this._writableState.defaultEncoding=_,this},Object.defineProperty(D.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Ie(m,_,A){return!m.objectMode&&m.decodeStrings!==!1&&typeof _=="string"&&(_=o.from(_,A)),_}Object.defineProperty(D.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function De(m,_,A,$,q,h){if(!A){var d=Ie(_,$,q);$!==d&&(A=!0,q="buffer",$=d)}var I=_.objectMode?1:$.length;_.length+=I;var M=_.length<_.highWaterMark;if(M||(_.needDrain=!0),_.writing||_.corked){var Q=_.lastBufferedRequest;_.lastBufferedRequest={chunk:$,encoding:q,isBuf:A,callback:h,next:null},Q?Q.next=_.lastBufferedRequest:_.bufferedRequest=_.lastBufferedRequest,_.bufferedRequestCount+=1}else ae(m,_,!1,I,$,q,h);return M}function ae(m,_,A,$,q,h,d){_.writelen=$,_.writecb=d,_.writing=!0,_.sync=!0,_.destroyed?_.onwrite(new E("write")):A?m._writev(q,_.onwrite):m._write(q,h,_.onwrite),_.sync=!1}function _e(m,_,A,$,q){--_.pendingcb,A?(process.nextTick(q,$),process.nextTick(ve,m,_),m._writableState.errorEmitted=!0,N(m,$)):(q($),m._writableState.errorEmitted=!0,N(m,$),ve(m,_))}function me(m){m.writing=!1,m.writecb=null,m.length-=m.writelen,m.writelen=0}function Ve(m,_){var A=m._writableState,$=A.sync,q=A.writecb;if(typeof q!="function")throw new R;if(me(A),_)_e(m,A,$,_,q);else{var h=He(A)||m.destroyed;!h&&!A.corked&&!A.bufferProcessing&&A.bufferedRequest&&Te(m,A),$?process.nextTick(ke,m,A,h,q):ke(m,A,h,q)}}function ke(m,_,A,$){A||$e(m,_),_.pendingcb--,$(),ve(m,_)}function $e(m,_){_.length===0&&_.needDrain&&(_.needDrain=!1,m.emit("drain"))}function Te(m,_){_.bufferProcessing=!0;var A=_.bufferedRequest;if(m._writev&&A&&A.next){var $=_.bufferedRequestCount,q=new Array($),h=_.corkedRequestsFree;h.entry=A;for(var d=0,I=!0;A;)q[d]=A,A.isBuf||(I=!1),A=A.next,d+=1;q.allBuffers=I,ae(m,_,!0,_.length,q,"",h.finish),_.pendingcb++,_.lastBufferedRequest=null,h.next?(_.corkedRequestsFree=h.next,h.next=null):_.corkedRequestsFree=new e(_),_.bufferedRequestCount=0}else{for(;A;){var M=A.chunk,Q=A.encoding,W=A.callback,z=_.objectMode?1:M.length;if(ae(m,_,!1,z,M,Q,W),A=A.next,_.bufferedRequestCount--,_.writing)break}A===null&&(_.lastBufferedRequest=null)}_.bufferedRequest=A,_.bufferProcessing=!1}D.prototype._write=function(m,_,A){A(new k("_write()"))},D.prototype._writev=null,D.prototype.end=function(m,_,A){var $=this._writableState;return typeof m=="function"?(A=m,m=null,_=null):typeof _=="function"&&(A=_,_=null),m!=null&&this.write(m,_),$.corked&&($.corked=1,this.uncork()),$.ending||je(this,$,A),this},Object.defineProperty(D.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function He(m){return m.ending&&m.length===0&&m.bufferedRequest===null&&!m.finished&&!m.writing}function Y(m,_){m._final(function(A){_.pendingcb--,A&&N(m,A),_.prefinished=!0,m.emit("prefinish"),ve(m,_)})}function ie(m,_){!_.prefinished&&!_.finalCalled&&(typeof m._final=="function"&&!_.destroyed?(_.pendingcb++,_.finalCalled=!0,process.nextTick(Y,m,_)):(_.prefinished=!0,m.emit("prefinish")))}function ve(m,_){var A=He(_);if(A&&(ie(m,_),_.pendingcb===0&&(_.finished=!0,m.emit("finish"),_.autoDestroy))){var $=m._readableState;(!$||$.autoDestroy&&$.endEmitted)&&m.destroy()}return A}function je(m,_,A){_.ending=!0,ve(m,_),A&&(_.finished?process.nextTick(A):m.once("finish",A)),_.ended=!0,m.writable=!1}function Ne(m,_,A){var $=m.entry;for(m.entry=null;$;){var q=$.callback;_.pendingcb--,q(A),$=$.next}_.corkedRequestsFree.next=m}return Object.defineProperty(D.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(_){this._writableState&&(this._writableState.destroyed=_)}}),D.prototype.destroy=p.destroy,D.prototype._undestroy=p.undestroy,D.prototype._destroy=function(m,_){_(m)},pr}var br,bn;function dt(){if(bn)return br;bn=1;var e=Object.keys||function(y){var g=[];for(var w in y)g.push(w);return g};br=c;var t=mi(),r=gi();pe(c,t);for(var n=e(r.prototype),o=0;o<n.length;o++){var s=n[o];c.prototype[s]||(c.prototype[s]=r.prototype[s])}function c(y){if(!(this instanceof c))return new c(y);t.call(this,y),r.call(this,y),this.allowHalfOpen=!0,y&&(y.readable===!1&&(this.readable=!1),y.writable===!1&&(this.writable=!1),y.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",u)))}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function u(){this._writableState.ended||process.nextTick(p,this)}function p(y){y.end()}return Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(g){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=g,this._writableState.destroyed=g)}}),br}var Gt={},Kr=we.Buffer,yn=Kr.isEncoding||function(e){switch(e=""+e,e&&e.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 ko(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function To(e){var t=ko(e);if(typeof t!="string"&&(Kr.isEncoding===yn||!yn(e)))throw new Error("Unknown encoding: "+e);return t||e}Gt.StringDecoder=Tt;function Tt(e){this.encoding=To(e);var t;switch(this.encoding){case"utf16le":this.text=Fo,this.end=Lo,t=4;break;case"utf8":this.fillLast=Po,t=4;break;case"base64":this.text=Mo,this.end=Uo,t=3;break;default:this.write=Do,this.end=$o;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Kr.allocUnsafe(t)}Tt.prototype.write=function(e){if(e.length===0)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""};Tt.prototype.end=No;Tt.prototype.text=Oo;Tt.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function yr(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function Ao(e,t,r){var n=t.length-1;if(n<r)return 0;var o=yr(t[n]);return o>=0?(o>0&&(e.lastNeed=o-1),o):--n<r||o===-2?0:(o=yr(t[n]),o>=0?(o>0&&(e.lastNeed=o-2),o):--n<r||o===-2?0:(o=yr(t[n]),o>=0?(o>0&&(o===2?o=0:e.lastNeed=o-3),o):0))}function Co(e,t,r){if((t[0]&192)!==128)return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"�"}}function Po(e){var t=this.lastTotal-this.lastNeed,r=Co(this,e);if(r!==void 0)return r;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function Oo(e,t){var r=Ao(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)}function No(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t}function Fo(e,t){if((e.length-t)%2===0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function Lo(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function Mo(e,t){var r=(e.length-t)%3;return r===0?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function Uo(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function Do(e){return e.toString(this.encoding)}function $o(e){return e&&e.length?this.write(e):""}var gn=et.codes.ERR_STREAM_PREMATURE_CLOSE;function Ho(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];e.apply(this,n)}}}function jo(){}function qo(e){return e.setHeader&&typeof e.abort=="function"}function _i(e,t,r){if(typeof t=="function")return _i(e,null,t);t||(t={}),r=Ho(r||jo);var n=t.readable||t.readable!==!1&&e.readable,o=t.writable||t.writable!==!1&&e.writable,s=function(){e.writable||u()},c=e._writableState&&e._writableState.finished,u=function(){o=!1,c=!0,n||r.call(e)},p=e._readableState&&e._readableState.endEmitted,y=function(){n=!1,p=!0,o||r.call(e)},g=function(R){r.call(e,R)},w=function(){var R;if(n&&!p)return(!e._readableState||!e._readableState.ended)&&(R=new gn),r.call(e,R);if(o&&!c)return(!e._writableState||!e._writableState.ended)&&(R=new gn),r.call(e,R)},x=function(){e.req.on("finish",u)};return qo(e)?(e.on("complete",u),e.on("abort",w),e.req?x():e.on("request",x)):o&&!e._writableState&&(e.on("end",s),e.on("close",s)),e.on("end",y),e.on("finish",u),t.error!==!1&&e.on("error",g),e.on("close",w),function(){e.removeListener("complete",u),e.removeListener("abort",w),e.removeListener("request",x),e.req&&e.req.removeListener("finish",u),e.removeListener("end",s),e.removeListener("close",s),e.removeListener("finish",u),e.removeListener("end",y),e.removeListener("error",g),e.removeListener("close",w)}}var Vr=_i,gr,_n;function Wo(){if(_n)return gr;_n=1;var e;function t(F,N,L){return N=r(N),N in F?Object.defineProperty(F,N,{value:L,enumerable:!0,configurable:!0,writable:!0}):F[N]=L,F}function r(F){var N=n(F,"string");return typeof N=="symbol"?N:String(N)}function n(F,N){if(typeof F!="object"||F===null)return F;var L=F[Symbol.toPrimitive];if(L!==void 0){var S=L.call(F,N||"default");if(typeof S!="object")return S;throw new TypeError("@@toPrimitive must return a primitive value.")}return(N==="string"?String:Number)(F)}var o=Vr,s=Symbol("lastResolve"),c=Symbol("lastReject"),u=Symbol("error"),p=Symbol("ended"),y=Symbol("lastPromise"),g=Symbol("handlePromise"),w=Symbol("stream");function x(F,N){return{value:F,done:N}}function k(F){var N=F[s];if(N!==null){var L=F[w].read();L!==null&&(F[y]=null,F[s]=null,F[c]=null,N(x(L,!1)))}}function R(F){process.nextTick(k,F)}function C(F,N){return function(L,S){F.then(function(){if(N[p]){L(x(void 0,!0));return}N[g](L,S)},S)}}var E=Object.getPrototypeOf(function(){}),T=Object.setPrototypeOf((e={get stream(){return this[w]},next:function(){var N=this,L=this[u];if(L!==null)return Promise.reject(L);if(this[p])return Promise.resolve(x(void 0,!0));if(this[w].destroyed)return new Promise(function(U,ee){process.nextTick(function(){N[u]?ee(N[u]):U(x(void 0,!0))})});var S=this[y],j;if(S)j=new Promise(C(S,this));else{var D=this[w].read();if(D!==null)return Promise.resolve(x(D,!1));j=new Promise(this[g])}return this[y]=j,j}},t(e,Symbol.asyncIterator,function(){return this}),t(e,"return",function(){var N=this;return new Promise(function(L,S){N[w].destroy(null,function(j){if(j){S(j);return}L(x(void 0,!0))})})}),e),E),O=function(N){var L,S=Object.create(T,(L={},t(L,w,{value:N,writable:!0}),t(L,s,{value:null,writable:!0}),t(L,c,{value:null,writable:!0}),t(L,u,{value:null,writable:!0}),t(L,p,{value:N._readableState.endEmitted,writable:!0}),t(L,g,{value:function(D,U){var ee=S[w].read();ee?(S[y]=null,S[s]=null,S[c]=null,D(x(ee,!1))):(S[s]=D,S[c]=U)},writable:!0}),L));return S[y]=null,o(N,function(j){if(j&&j.code!=="ERR_STREAM_PREMATURE_CLOSE"){var D=S[c];D!==null&&(S[y]=null,S[s]=null,S[c]=null,D(j)),S[u]=j;return}var U=S[s];U!==null&&(S[y]=null,S[s]=null,S[c]=null,U(x(void 0,!0))),S[p]=!0}),N.on("readable",R.bind(null,S)),S};return gr=O,gr}var _r,mn;function Go(){return mn||(mn=1,_r=function(){throw new Error("Readable.from is not available in the browser")}),_r}var mr,wn;function mi(){if(wn)return mr;wn=1,mr=U;var e;U.ReadableState=D,hi.EventEmitter;var t=function(d,I){return d.listeners(I).length},r=di,n=pt.Buffer,o=(typeof ze<"u"?ze:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function s(h){return n.from(h)}function c(h){return n.isBuffer(h)||h instanceof o}var u=zr,p;u&&u.debuglog?p=u.debuglog("stream"):p=function(){};var y=bo(),g=pi,w=yi,x=w.getHighWaterMark,k=et.codes,R=k.ERR_INVALID_ARG_TYPE,C=k.ERR_STREAM_PUSH_AFTER_EOF,E=k.ERR_METHOD_NOT_IMPLEMENTED,T=k.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,O,F,N;pe(U,r);var L=g.errorOrDestroy,S=["error","close","destroy","pause","resume"];function j(h,d,I){if(typeof h.prependListener=="function")return h.prependListener(d,I);!h._events||!h._events[d]?h.on(d,I):Array.isArray(h._events[d])?h._events[d].unshift(I):h._events[d]=[I,h._events[d]]}function D(h,d,I){e=e||dt(),h=h||{},typeof I!="boolean"&&(I=d instanceof e),this.objectMode=!!h.objectMode,I&&(this.objectMode=this.objectMode||!!h.readableObjectMode),this.highWaterMark=x(this,h,"readableHighWaterMark",I),this.buffer=new y,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=h.emitClose!==!1,this.autoDestroy=!!h.autoDestroy,this.destroyed=!1,this.defaultEncoding=h.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,h.encoding&&(O||(O=Gt.StringDecoder),this.decoder=new O(h.encoding),this.encoding=h.encoding)}function U(h){if(e=e||dt(),!(this instanceof U))return new U(h);var d=this instanceof e;this._readableState=new D(h,this,d),this.readable=!0,h&&(typeof h.read=="function"&&(this._read=h.read),typeof h.destroy=="function"&&(this._destroy=h.destroy)),r.call(this)}Object.defineProperty(U.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(d){this._readableState&&(this._readableState.destroyed=d)}}),U.prototype.destroy=g.destroy,U.prototype._undestroy=g.undestroy,U.prototype._destroy=function(h,d){d(h)},U.prototype.push=function(h,d){var I=this._readableState,M;return I.objectMode?M=!0:typeof h=="string"&&(d=d||I.defaultEncoding,d!==I.encoding&&(h=n.from(h,d),d=""),M=!0),ee(this,h,d,!1,M)},U.prototype.unshift=function(h){return ee(this,h,null,!0,!1)};function ee(h,d,I,M,Q){p("readableAddChunk",d);var W=h._readableState;if(d===null)W.reading=!1,Ve(h,W);else{var z;if(Q||(z=De(W,d)),z)L(h,z);else if(W.objectMode||d&&d.length>0)if(typeof d!="string"&&!W.objectMode&&Object.getPrototypeOf(d)!==n.prototype&&(d=s(d)),M)W.endEmitted?L(h,new T):Ie(h,W,d,!0);else if(W.ended)L(h,new C);else{if(W.destroyed)return!1;W.reading=!1,W.decoder&&!I?(d=W.decoder.write(d),W.objectMode||d.length!==0?Ie(h,W,d,!1):Te(h,W)):Ie(h,W,d,!1)}else M||(W.reading=!1,Te(h,W))}return!W.ended&&(W.length<W.highWaterMark||W.length===0)}function Ie(h,d,I,M){d.flowing&&d.length===0&&!d.sync?(d.awaitDrain=0,h.emit("data",I)):(d.length+=d.objectMode?1:I.length,M?d.buffer.unshift(I):d.buffer.push(I),d.needReadable&&ke(h)),Te(h,d)}function De(h,d){var I;return!c(d)&&typeof d!="string"&&d!==void 0&&!h.objectMode&&(I=new R("chunk",["string","Buffer","Uint8Array"],d)),I}U.prototype.isPaused=function(){return this._readableState.flowing===!1},U.prototype.setEncoding=function(h){O||(O=Gt.StringDecoder);var d=new O(h);this._readableState.decoder=d,this._readableState.encoding=this._readableState.decoder.encoding;for(var I=this._readableState.buffer.head,M="";I!==null;)M+=d.write(I.data),I=I.next;return this._readableState.buffer.clear(),M!==""&&this._readableState.buffer.push(M),this._readableState.length=M.length,this};var ae=1073741824;function _e(h){return h>=ae?h=ae:(h--,h|=h>>>1,h|=h>>>2,h|=h>>>4,h|=h>>>8,h|=h>>>16,h++),h}function me(h,d){return h<=0||d.length===0&&d.ended?0:d.objectMode?1:h!==h?d.flowing&&d.length?d.buffer.head.data.length:d.length:(h>d.highWaterMark&&(d.highWaterMark=_e(h)),h<=d.length?h:d.ended?d.length:(d.needReadable=!0,0))}U.prototype.read=function(h){p("read",h),h=parseInt(h,10);var d=this._readableState,I=h;if(h!==0&&(d.emittedReadable=!1),h===0&&d.needReadable&&((d.highWaterMark!==0?d.length>=d.highWaterMark:d.length>0)||d.ended))return p("read: emitReadable",d.length,d.ended),d.length===0&&d.ended?A(this):ke(this),null;if(h=me(h,d),h===0&&d.ended)return d.length===0&&A(this),null;var M=d.needReadable;p("need readable",M),(d.length===0||d.length-h<d.highWaterMark)&&(M=!0,p("length less than watermark",M)),d.ended||d.reading?(M=!1,p("reading or ended",M)):M&&(p("do read"),d.reading=!0,d.sync=!0,d.length===0&&(d.needReadable=!0),this._read(d.highWaterMark),d.sync=!1,d.reading||(h=me(I,d)));var Q;return h>0?Q=_(h,d):Q=null,Q===null?(d.needReadable=d.length<=d.highWaterMark,h=0):(d.length-=h,d.awaitDrain=0),d.length===0&&(d.ended||(d.needReadable=!0),I!==h&&d.ended&&A(this)),Q!==null&&this.emit("data",Q),Q};function Ve(h,d){if(p("onEofChunk"),!d.ended){if(d.decoder){var I=d.decoder.end();I&&I.length&&(d.buffer.push(I),d.length+=d.objectMode?1:I.length)}d.ended=!0,d.sync?ke(h):(d.needReadable=!1,d.emittedReadable||(d.emittedReadable=!0,$e(h)))}}function ke(h){var d=h._readableState;p("emitReadable",d.needReadable,d.emittedReadable),d.needReadable=!1,d.emittedReadable||(p("emitReadable",d.flowing),d.emittedReadable=!0,process.nextTick($e,h))}function $e(h){var d=h._readableState;p("emitReadable_",d.destroyed,d.length,d.ended),!d.destroyed&&(d.length||d.ended)&&(h.emit("readable"),d.emittedReadable=!1),d.needReadable=!d.flowing&&!d.ended&&d.length<=d.highWaterMark,m(h)}function Te(h,d){d.readingMore||(d.readingMore=!0,process.nextTick(He,h,d))}function He(h,d){for(;!d.reading&&!d.ended&&(d.length<d.highWaterMark||d.flowing&&d.length===0);){var I=d.length;if(p("maybeReadMore read 0"),h.read(0),I===d.length)break}d.readingMore=!1}U.prototype._read=function(h){L(this,new E("_read()"))},U.prototype.pipe=function(h,d){var I=this,M=this._readableState;switch(M.pipesCount){case 0:M.pipes=h;break;case 1:M.pipes=[M.pipes,h];break;default:M.pipes.push(h);break}M.pipesCount+=1,p("pipe count=%d opts=%j",M.pipesCount,d);var Q=(!d||d.end!==!1)&&h!==process.stdout&&h!==process.stderr,W=Q?qe:Ye;M.endEmitted?process.nextTick(W):I.once("end",W),h.on("unpipe",z);function z(f,i){p("onunpipe"),f===I&&i&&i.hasUnpiped===!1&&(i.hasUnpiped=!0,nt())}function qe(){p("onend"),h.end()}var rt=Y(I);h.on("drain",rt);var yt=!1;function nt(){p("cleanup"),h.removeListener("close",gt),h.removeListener("finish",Ee),h.removeListener("drain",rt),h.removeListener("error",Je),h.removeListener("unpipe",z),I.removeListener("end",qe),I.removeListener("end",Ye),I.removeListener("data",xe),yt=!0,M.awaitDrain&&(!h._writableState||h._writableState.needDrain)&&rt()}I.on("data",xe);function xe(f){p("ondata");var i=h.write(f);p("dest.write",i),i===!1&&((M.pipesCount===1&&M.pipes===h||M.pipesCount>1&&q(M.pipes,h)!==-1)&&!yt&&(p("false write response, pause",M.awaitDrain),M.awaitDrain++),I.pause())}function Je(f){p("onerror",f),Ye(),h.removeListener("error",Je),t(h,"error")===0&&L(h,f)}j(h,"error",Je);function gt(){h.removeListener("finish",Ee),Ye()}h.once("close",gt);function Ee(){p("onfinish"),h.removeListener("close",gt),Ye()}h.once("finish",Ee);function Ye(){p("unpipe"),I.unpipe(h)}return h.emit("pipe",I),M.flowing||(p("pipe resume"),I.resume()),h};function Y(h){return function(){var I=h._readableState;p("pipeOnDrain",I.awaitDrain),I.awaitDrain&&I.awaitDrain--,I.awaitDrain===0&&t(h,"data")&&(I.flowing=!0,m(h))}}U.prototype.unpipe=function(h){var d=this._readableState,I={hasUnpiped:!1};if(d.pipesCount===0)return this;if(d.pipesCount===1)return h&&h!==d.pipes?this:(h||(h=d.pipes),d.pipes=null,d.pipesCount=0,d.flowing=!1,h&&h.emit("unpipe",this,I),this);if(!h){var M=d.pipes,Q=d.pipesCount;d.pipes=null,d.pipesCount=0,d.flowing=!1;for(var W=0;W<Q;W++)M[W].emit("unpipe",this,{hasUnpiped:!1});return this}var z=q(d.pipes,h);return z===-1?this:(d.pipes.splice(z,1),d.pipesCount-=1,d.pipesCount===1&&(d.pipes=d.pipes[0]),h.emit("unpipe",this,I),this)},U.prototype.on=function(h,d){var I=r.prototype.on.call(this,h,d),M=this._readableState;return h==="data"?(M.readableListening=this.listenerCount("readable")>0,M.flowing!==!1&&this.resume()):h==="readable"&&!M.endEmitted&&!M.readableListening&&(M.readableListening=M.needReadable=!0,M.flowing=!1,M.emittedReadable=!1,p("on readable",M.length,M.reading),M.length?ke(this):M.reading||process.nextTick(ve,this)),I},U.prototype.addListener=U.prototype.on,U.prototype.removeListener=function(h,d){var I=r.prototype.removeListener.call(this,h,d);return h==="readable"&&process.nextTick(ie,this),I},U.prototype.removeAllListeners=function(h){var d=r.prototype.removeAllListeners.apply(this,arguments);return(h==="readable"||h===void 0)&&process.nextTick(ie,this),d};function ie(h){var d=h._readableState;d.readableListening=h.listenerCount("readable")>0,d.resumeScheduled&&!d.paused?d.flowing=!0:h.listenerCount("data")>0&&h.resume()}function ve(h){p("readable nexttick read 0"),h.read(0)}U.prototype.resume=function(){var h=this._readableState;return h.flowing||(p("resume"),h.flowing=!h.readableListening,je(this,h)),h.paused=!1,this};function je(h,d){d.resumeScheduled||(d.resumeScheduled=!0,process.nextTick(Ne,h,d))}function Ne(h,d){p("resume",d.reading),d.reading||h.read(0),d.resumeScheduled=!1,h.emit("resume"),m(h),d.flowing&&!d.reading&&h.read(0)}U.prototype.pause=function(){return p("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(p("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function m(h){var d=h._readableState;for(p("flow",d.flowing);d.flowing&&h.read()!==null;);}U.prototype.wrap=function(h){var d=this,I=this._readableState,M=!1;h.on("end",function(){if(p("wrapped end"),I.decoder&&!I.ended){var z=I.decoder.end();z&&z.length&&d.push(z)}d.push(null)}),h.on("data",function(z){if(p("wrapped data"),I.decoder&&(z=I.decoder.write(z)),!(I.objectMode&&z==null)&&!(!I.objectMode&&(!z||!z.length))){var qe=d.push(z);qe||(M=!0,h.pause())}});for(var Q in h)this[Q]===void 0&&typeof h[Q]=="function"&&(this[Q]=function(qe){return function(){return h[qe].apply(h,arguments)}}(Q));for(var W=0;W<S.length;W++)h.on(S[W],this.emit.bind(this,S[W]));return this._read=function(z){p("wrapped _read",z),M&&(M=!1,h.resume())},this},typeof Symbol=="function"&&(U.prototype[Symbol.asyncIterator]=function(){return F===void 0&&(F=Wo()),F(this)}),Object.defineProperty(U.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(U.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(U.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(d){this._readableState&&(this._readableState.flowing=d)}}),U._fromList=_,Object.defineProperty(U.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function _(h,d){if(d.length===0)return null;var I;return d.objectMode?I=d.buffer.shift():!h||h>=d.length?(d.decoder?I=d.buffer.join(""):d.buffer.length===1?I=d.buffer.first():I=d.buffer.concat(d.length),d.buffer.clear()):I=d.buffer.consume(h,d.decoder),I}function A(h){var d=h._readableState;p("endReadable",d.endEmitted),d.endEmitted||(d.ended=!0,process.nextTick($,d,h))}function $(h,d){if(p("endReadableNT",h.endEmitted,h.length),!h.endEmitted&&h.length===0&&(h.endEmitted=!0,d.readable=!1,d.emit("end"),h.autoDestroy)){var I=d._writableState;(!I||I.autoDestroy&&I.finished)&&d.destroy()}}typeof Symbol=="function"&&(U.from=function(h,d){return N===void 0&&(N=Go()),N(U,h,d)});function q(h,d){for(var I=0,M=h.length;I<M;I++)if(h[I]===d)return I;return-1}return mr}var wi=Ue,Qt=et.codes,zo=Qt.ERR_METHOD_NOT_IMPLEMENTED,Ko=Qt.ERR_MULTIPLE_CALLBACK,Vo=Qt.ERR_TRANSFORM_ALREADY_TRANSFORMING,Jo=Qt.ERR_TRANSFORM_WITH_LENGTH_0,Xt=dt();pe(Ue,Xt);function Yo(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new Ko);r.writechunk=null,r.writecb=null,t!=null&&this.push(t),n(e);var o=this._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}function Ue(e){if(!(this instanceof Ue))return new Ue(e);Xt.call(this,e),this._transformState={afterTransform:Yo.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",Qo)}function Qo(){var e=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(t,r){vn(e,t,r)}):vn(this,null,null)}Ue.prototype.push=function(e,t){return this._transformState.needTransform=!1,Xt.prototype.push.call(this,e,t)};Ue.prototype._transform=function(e,t,r){r(new zo("_transform()"))};Ue.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var o=this._readableState;(n.needTransform||o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}};Ue.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};Ue.prototype._destroy=function(e,t){Xt.prototype._destroy.call(this,e,function(r){t(r)})};function vn(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new Jo;if(e._transformState.transforming)throw new Vo;return e.push(null)}var Xo=It,vi=wi;pe(It,vi);function It(e){if(!(this instanceof It))return new It(e);vi.call(this,e)}It.prototype._transform=function(e,t,r){r(null,e)};var wr;function Zo(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}var xi=et.codes,es=xi.ERR_MISSING_ARGS,ts=xi.ERR_STREAM_DESTROYED;function xn(e){if(e)throw e}function rs(e){return e.setHeader&&typeof e.abort=="function"}function ns(e,t,r,n){n=Zo(n);var o=!1;e.on("close",function(){o=!0}),wr===void 0&&(wr=Vr),wr(e,{readable:t,writable:r},function(c){if(c)return n(c);o=!0,n()});var s=!1;return function(c){if(!o&&!s){if(s=!0,rs(e))return e.abort();if(typeof e.destroy=="function")return e.destroy();n(c||new ts("pipe"))}}}function En(e){e()}function is(e,t){return e.pipe(t)}function as(e){return!e.length||typeof e[e.length-1]!="function"?xn:e.pop()}function os(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=as(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new es("streams");var o,s=t.map(function(c,u){var p=u<t.length-1,y=u>0;return ns(c,p,y,function(g){o||(o=g),g&&s.forEach(En),!p&&(s.forEach(En),n(o))})});return t.reduce(is)}var ss=os;(function(e,t){t=e.exports=mi(),t.Stream=t,t.Readable=t,t.Writable=gi(),t.Duplex=dt(),t.Transform=wi,t.PassThrough=Xo,t.finished=Vr,t.pipeline=ss})(Fr,Fr.exports);var fs=Fr.exports,zt=we.Buffer,Ei=fs.Transform,us=pe;function cs(e,t){if(!zt.isBuffer(e)&&typeof e!="string")throw new TypeError(t+" must be a string or a buffer")}function Ke(e){Ei.call(this),this._block=zt.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}us(Ke,Ei);Ke.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(o){n=o}r(n)};Ke.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(r){t=r}e(t)};Ke.prototype.update=function(e,t){if(cs(e,"Data"),this._finalized)throw new Error("Digest already called");zt.isBuffer(e)||(e=zt.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)r[o++]=e[n++];this._update(),this._blockOffset=0}for(;n<e.length;)r[this._blockOffset++]=e[n++];for(var s=0,c=e.length*8;c>0;++s)this._length[s]+=c,c=this._length[s]/4294967296|0,c>0&&(this._length[s]-=4294967296*c);return this};Ke.prototype._update=function(){throw new Error("_update is not implemented")};Ke.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();e!==void 0&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t};Ke.prototype._digest=function(){throw new Error("_digest is not implemented")};var Bi=Ke,ls=pe,Ri=Bi,hs=we.Buffer,ds=new Array(16);function Zt(){Ri.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}ls(Zt,Ri);Zt.prototype._update=function(){for(var e=ds,t=0;t<16;++t)e[t]=this._block.readInt32LE(t*4);var r=this._a,n=this._b,o=this._c,s=this._d;r=ue(r,n,o,s,e[0],3614090360,7),s=ue(s,r,n,o,e[1],3905402710,12),o=ue(o,s,r,n,e[2],606105819,17),n=ue(n,o,s,r,e[3],3250441966,22),r=ue(r,n,o,s,e[4],4118548399,7),s=ue(s,r,n,o,e[5],1200080426,12),o=ue(o,s,r,n,e[6],2821735955,17),n=ue(n,o,s,r,e[7],4249261313,22),r=ue(r,n,o,s,e[8],1770035416,7),s=ue(s,r,n,o,e[9],2336552879,12),o=ue(o,s,r,n,e[10],4294925233,17),n=ue(n,o,s,r,e[11],2304563134,22),r=ue(r,n,o,s,e[12],1804603682,7),s=ue(s,r,n,o,e[13],4254626195,12),o=ue(o,s,r,n,e[14],2792965006,17),n=ue(n,o,s,r,e[15],1236535329,22),r=ce(r,n,o,s,e[1],4129170786,5),s=ce(s,r,n,o,e[6],3225465664,9),o=ce(o,s,r,n,e[11],643717713,14),n=ce(n,o,s,r,e[0],3921069994,20),r=ce(r,n,o,s,e[5],3593408605,5),s=ce(s,r,n,o,e[10],38016083,9),o=ce(o,s,r,n,e[15],3634488961,14),n=ce(n,o,s,r,e[4],3889429448,20),r=ce(r,n,o,s,e[9],568446438,5),s=ce(s,r,n,o,e[14],3275163606,9),o=ce(o,s,r,n,e[3],4107603335,14),n=ce(n,o,s,r,e[8],1163531501,20),r=ce(r,n,o,s,e[13],2850285829,5),s=ce(s,r,n,o,e[2],4243563512,9),o=ce(o,s,r,n,e[7],1735328473,14),n=ce(n,o,s,r,e[12],2368359562,20),r=le(r,n,o,s,e[5],4294588738,4),s=le(s,r,n,o,e[8],2272392833,11),o=le(o,s,r,n,e[11],1839030562,16),n=le(n,o,s,r,e[14],4259657740,23),r=le(r,n,o,s,e[1],2763975236,4),s=le(s,r,n,o,e[4],1272893353,11),o=le(o,s,r,n,e[7],4139469664,16),n=le(n,o,s,r,e[10],3200236656,23),r=le(r,n,o,s,e[13],681279174,4),s=le(s,r,n,o,e[0],3936430074,11),o=le(o,s,r,n,e[3],3572445317,16),n=le(n,o,s,r,e[6],76029189,23),r=le(r,n,o,s,e[9],3654602809,4),s=le(s,r,n,o,e[12],3873151461,11),o=le(o,s,r,n,e[15],530742520,16),n=le(n,o,s,r,e[2],3299628645,23),r=he(r,n,o,s,e[0],4096336452,6),s=he(s,r,n,o,e[7],1126891415,10),o=he(o,s,r,n,e[14],2878612391,15),n=he(n,o,s,r,e[5],4237533241,21),r=he(r,n,o,s,e[12],1700485571,6),s=he(s,r,n,o,e[3],2399980690,10),o=he(o,s,r,n,e[10],4293915773,15),n=he(n,o,s,r,e[1],2240044497,21),r=he(r,n,o,s,e[8],1873313359,6),s=he(s,r,n,o,e[15],4264355552,10),o=he(o,s,r,n,e[6],2734768916,15),n=he(n,o,s,r,e[13],1309151649,21),r=he(r,n,o,s,e[4],4149444226,6),s=he(s,r,n,o,e[11],3174756917,10),o=he(o,s,r,n,e[2],718787259,15),n=he(n,o,s,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+o|0,this._d=this._d+s|0};Zt.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=hs.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};function er(e,t){return e<<t|e>>>32-t}function ue(e,t,r,n,o,s,c){return er(e+(t&r|~t&n)+o+s|0,c)+t|0}function ce(e,t,r,n,o,s,c){return er(e+(t&n|r&~n)+o+s|0,c)+t|0}function le(e,t,r,n,o,s,c){return er(e+(t^r^n)+o+s|0,c)+t|0}function he(e,t,r,n,o,s,c){return er(e+(r^(t|~n))+o+s|0,c)+t|0}var ps=Zt,vr=pt.Buffer,bs=pe,Si=Bi,ys=new Array(16),mt=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],wt=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],vt=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],xt=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Et=[0,1518500249,1859775393,2400959708,2840853838],Bt=[1352829926,1548603684,1836072691,2053994217,0];function tr(){Si.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}bs(tr,Si);tr.prototype._update=function(){for(var e=ys,t=0;t<16;++t)e[t]=this._block.readInt32LE(t*4);for(var r=this._a|0,n=this._b|0,o=this._c|0,s=this._d|0,c=this._e|0,u=this._a|0,p=this._b|0,y=this._c|0,g=this._d|0,w=this._e|0,x=0;x<80;x+=1){var k,R;x<16?(k=Bn(r,n,o,s,c,e[mt[x]],Et[0],vt[x]),R=kn(u,p,y,g,w,e[wt[x]],Bt[0],xt[x])):x<32?(k=Rn(r,n,o,s,c,e[mt[x]],Et[1],vt[x]),R=In(u,p,y,g,w,e[wt[x]],Bt[1],xt[x])):x<48?(k=Sn(r,n,o,s,c,e[mt[x]],Et[2],vt[x]),R=Sn(u,p,y,g,w,e[wt[x]],Bt[2],xt[x])):x<64?(k=In(r,n,o,s,c,e[mt[x]],Et[3],vt[x]),R=Rn(u,p,y,g,w,e[wt[x]],Bt[3],xt[x])):(k=kn(r,n,o,s,c,e[mt[x]],Et[4],vt[x]),R=Bn(u,p,y,g,w,e[wt[x]],Bt[4],xt[x])),r=c,c=s,s=Xe(o,10),o=n,n=k,u=w,w=g,g=Xe(y,10),y=p,p=R}var C=this._b+o+g|0;this._b=this._c+s+w|0,this._c=this._d+c+u|0,this._d=this._e+r+p|0,this._e=this._a+n+y|0,this._a=C};tr.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=vr.alloc?vr.alloc(20):new vr(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e};function Xe(e,t){return e<<t|e>>>32-t}function Bn(e,t,r,n,o,s,c,u){return Xe(e+(t^r^n)+s+c|0,u)+o|0}function Rn(e,t,r,n,o,s,c,u){return Xe(e+(t&r|~t&n)+s+c|0,u)+o|0}function Sn(e,t,r,n,o,s,c,u){return Xe(e+((t|~r)^n)+s+c|0,u)+o|0}function In(e,t,r,n,o,s,c,u){return Xe(e+(t&n|r&~n)+s+c|0,u)+o|0}function kn(e,t,r,n,o,s,c,u){return Xe(e+(t^(r|~n))+s+c|0,u)+o|0}var gs=tr,Ii={exports:{}},ki=we.Buffer;function rr(e,t){this._block=ki.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}rr.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=ki.from(e,t));for(var r=this._block,n=this._blockSize,o=e.length,s=this._len,c=0;c<o;){for(var u=s%n,p=Math.min(o-c,n-u),y=0;y<p;y++)r[u+y]=e[c+y];s+=p,c+=p,s%n===0&&this._update(r)}return this._len+=o,this};rr.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,o=(r-n)/4294967296;this._block.writeUInt32BE(o,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return e?s.toString(e):s};rr.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var bt=rr,_s=pe,Ti=bt,ms=we.Buffer,ws=[1518500249,1859775393,-1894007588,-899497514],vs=new Array(80);function At(){this.init(),this._w=vs,Ti.call(this,64,56)}_s(At,Ti);At.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function xs(e){return e<<5|e>>>27}function Es(e){return e<<30|e>>>2}function Bs(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}At.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,o=this._c|0,s=this._d|0,c=this._e|0,u=0;u<16;++u)t[u]=e.readInt32BE(u*4);for(;u<80;++u)t[u]=t[u-3]^t[u-8]^t[u-14]^t[u-16];for(var p=0;p<80;++p){var y=~~(p/20),g=xs(r)+Bs(y,n,o,s)+c+t[p]+ws[y]|0;c=s,s=o,o=Es(n),n=r,r=g}this._a=r+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=c+this._e|0};At.prototype._hash=function(){var e=ms.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var Rs=At,Ss=pe,Ai=bt,Is=we.Buffer,ks=[1518500249,1859775393,-1894007588,-899497514],Ts=new Array(80);function Ct(){this.init(),this._w=Ts,Ai.call(this,64,56)}Ss(Ct,Ai);Ct.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function As(e){return e<<1|e>>>31}function Cs(e){return e<<5|e>>>27}function Ps(e){return e<<30|e>>>2}function Os(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}Ct.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,o=this._c|0,s=this._d|0,c=this._e|0,u=0;u<16;++u)t[u]=e.readInt32BE(u*4);for(;u<80;++u)t[u]=As(t[u-3]^t[u-8]^t[u-14]^t[u-16]);for(var p=0;p<80;++p){var y=~~(p/20),g=Cs(r)+Os(y,n,o,s)+c+t[p]+ks[y]|0;c=s,s=o,o=Ps(n),n=r,r=g}this._a=r+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=c+this._e|0};Ct.prototype._hash=function(){var e=Is.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var Ns=Ct,Fs=pe,Ci=bt,Ls=we.Buffer,Ms=[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],Us=new Array(64);function Pt(){this.init(),this._w=Us,Ci.call(this,64,56)}Fs(Pt,Ci);Pt.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function Ds(e,t,r){return r^e&(t^r)}function $s(e,t,r){return e&t|r&(e|t)}function Hs(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function js(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function qs(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function Ws(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Pt.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,o=this._c|0,s=this._d|0,c=this._e|0,u=this._f|0,p=this._g|0,y=this._h|0,g=0;g<16;++g)t[g]=e.readInt32BE(g*4);for(;g<64;++g)t[g]=Ws(t[g-2])+t[g-7]+qs(t[g-15])+t[g-16]|0;for(var w=0;w<64;++w){var x=y+js(c)+Ds(c,u,p)+Ms[w]+t[w]|0,k=Hs(r)+$s(r,n,o)|0;y=p,p=u,u=c,c=s+x|0,s=o,o=n,n=r,r=x+k|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=c+this._e|0,this._f=u+this._f|0,this._g=p+this._g|0,this._h=y+this._h|0};Pt.prototype._hash=function(){var e=Ls.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var Pi=Pt,Gs=pe,zs=Pi,Ks=bt,Vs=we.Buffer,Js=new Array(64);function nr(){this.init(),this._w=Js,Ks.call(this,64,56)}Gs(nr,zs);nr.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};nr.prototype._hash=function(){var e=Vs.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var Ys=nr,Qs=pe,Oi=bt,Xs=we.Buffer,Tn=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],Zs=new Array(160);function Ot(){this.init(),this._w=Zs,Oi.call(this,128,112)}Qs(Ot,Oi);Ot.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function An(e,t,r){return r^e&(t^r)}function Cn(e,t,r){return e&t|r&(e|t)}function Pn(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function On(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function ef(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function tf(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function rf(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function nf(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function se(e,t){return e>>>0<t>>>0?1:0}Ot.prototype._update=function(e){for(var t=this._w,r=this._ah|0,n=this._bh|0,o=this._ch|0,s=this._dh|0,c=this._eh|0,u=this._fh|0,p=this._gh|0,y=this._hh|0,g=this._al|0,w=this._bl|0,x=this._cl|0,k=this._dl|0,R=this._el|0,C=this._fl|0,E=this._gl|0,T=this._hl|0,O=0;O<32;O+=2)t[O]=e.readInt32BE(O*4),t[O+1]=e.readInt32BE(O*4+4);for(;O<160;O+=2){var F=t[O-30],N=t[O-15*2+1],L=ef(F,N),S=tf(N,F);F=t[O-2*2],N=t[O-2*2+1];var j=rf(F,N),D=nf(N,F),U=t[O-7*2],ee=t[O-7*2+1],Ie=t[O-16*2],De=t[O-16*2+1],ae=S+ee|0,_e=L+U+se(ae,S)|0;ae=ae+D|0,_e=_e+j+se(ae,D)|0,ae=ae+De|0,_e=_e+Ie+se(ae,De)|0,t[O]=_e,t[O+1]=ae}for(var me=0;me<160;me+=2){_e=t[me],ae=t[me+1];var Ve=Cn(r,n,o),ke=Cn(g,w,x),$e=Pn(r,g),Te=Pn(g,r),He=On(c,R),Y=On(R,c),ie=Tn[me],ve=Tn[me+1],je=An(c,u,p),Ne=An(R,C,E),m=T+Y|0,_=y+He+se(m,T)|0;m=m+Ne|0,_=_+je+se(m,Ne)|0,m=m+ve|0,_=_+ie+se(m,ve)|0,m=m+ae|0,_=_+_e+se(m,ae)|0;var A=Te+ke|0,$=$e+Ve+se(A,Te)|0;y=p,T=E,p=u,E=C,u=c,C=R,R=k+m|0,c=s+_+se(R,k)|0,s=o,k=x,o=n,x=w,n=r,w=g,g=m+A|0,r=_+$+se(g,m)|0}this._al=this._al+g|0,this._bl=this._bl+w|0,this._cl=this._cl+x|0,this._dl=this._dl+k|0,this._el=this._el+R|0,this._fl=this._fl+C|0,this._gl=this._gl+E|0,this._hl=this._hl+T|0,this._ah=this._ah+r+se(this._al,g)|0,this._bh=this._bh+n+se(this._bl,w)|0,this._ch=this._ch+o+se(this._cl,x)|0,this._dh=this._dh+s+se(this._dl,k)|0,this._eh=this._eh+c+se(this._el,R)|0,this._fh=this._fh+u+se(this._fl,C)|0,this._gh=this._gh+p+se(this._gl,E)|0,this._hh=this._hh+y+se(this._hl,T)|0};Ot.prototype._hash=function(){var e=Xs.allocUnsafe(64);function t(r,n,o){e.writeInt32BE(r,o),e.writeInt32BE(n,o+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Ni=Ot,af=pe,of=Ni,sf=bt,ff=we.Buffer,uf=new Array(160);function ir(){this.init(),this._w=uf,sf.call(this,128,112)}af(ir,of);ir.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};ir.prototype._hash=function(){var e=ff.allocUnsafe(48);function t(r,n,o){e.writeInt32BE(r,o),e.writeInt32BE(n,o+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var cf=ir,tt=Ii.exports=function(t){t=t.toLowerCase();var r=tt[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r};tt.sha=Rs;tt.sha1=Ns;tt.sha224=Ys;tt.sha256=Pi;tt.sha384=cf;tt.sha512=Ni;var lf=Ii.exports,Fi=we.Buffer,Li=zr.Transform,hf=Gt.StringDecoder,df=pe;function Ae(e){Li.call(this),this.hashMode=typeof e=="string",this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}df(Ae,Li);Ae.prototype.update=function(e,t,r){typeof e=="string"&&(e=Fi.from(e,t));var n=this._update(e);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)};Ae.prototype.setAutoPadding=function(){};Ae.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")};Ae.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")};Ae.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")};Ae.prototype._transform=function(e,t,r){var n;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(o){n=o}finally{r(n)}};Ae.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(r){t=r}e(t)};Ae.prototype._finalOrDigest=function(e){var t=this.__final()||Fi.alloc(0);return e&&(t=this._toString(t,e,!0)),t};Ae.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new hf(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var n=this._decoder.write(e);return r&&(n+=this._decoder.end()),n};var pf=Ae,bf=pe,yf=ps,gf=gs,_f=lf,Mi=pf;function ar(e){Mi.call(this,"digest"),this._hash=e}bf(ar,Mi);ar.prototype._update=function(e){this._hash.update(e)};ar.prototype._final=function(){return this._hash.digest()};var mf=function(t){return t=t.toLowerCase(),t==="md5"?new yf:t==="rmd160"||t==="ripemd160"?new gf:new ar(_f(t))},Mt=we.Buffer;function wf(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var o=e.charAt(n),s=o.charCodeAt(0);if(t[s]!==255)throw new TypeError(o+" is ambiguous");t[s]=n}var c=e.length,u=e.charAt(0),p=Math.log(c)/Math.log(256),y=Math.log(256)/Math.log(c);function g(k){if((Array.isArray(k)||k instanceof Uint8Array)&&(k=Mt.from(k)),!Mt.isBuffer(k))throw new TypeError("Expected Buffer");if(k.length===0)return"";for(var R=0,C=0,E=0,T=k.length;E!==T&&k[E]===0;)E++,R++;for(var O=(T-E)*y+1>>>0,F=new Uint8Array(O);E!==T;){for(var N=k[E],L=0,S=O-1;(N!==0||L<C)&&S!==-1;S--,L++)N+=256*F[S]>>>0,F[S]=N%c>>>0,N=N/c>>>0;if(N!==0)throw new Error("Non-zero carry");C=L,E++}for(var j=O-C;j!==O&&F[j]===0;)j++;for(var D=u.repeat(R);j<O;++j)D+=e.charAt(F[j]);return D}function w(k){if(typeof k!="string")throw new TypeError("Expected String");if(k.length===0)return Mt.alloc(0);for(var R=0,C=0,E=0;k[R]===u;)C++,R++;for(var T=(k.length-R)*p+1>>>0,O=new Uint8Array(T);R<k.length;){var F=t[k.charCodeAt(R)];if(F===255)return;for(var N=0,L=T-1;(F!==0||N<E)&&L!==-1;L--,N++)F+=c*O[L]>>>0,O[L]=F%256>>>0,F=F/256>>>0;if(F!==0)throw new Error("Non-zero carry");E=N,R++}for(var S=T-E;S!==T&&O[S]===0;)S++;var j=Mt.allocUnsafe(C+(T-S));j.fill(0,0,C);for(var D=C;S!==T;)j[D++]=O[S++];return j}function x(k){var R=w(k);if(R)return R;throw new Error("Non-base"+c+" character")}return{encode:g,decodeUnsafe:w,decode:x}}var vf=wf,xf=vf,Ef="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Bf=xf(Ef),xr=Bf,Rf=we.Buffer,Sf=function(e){function t(s){var c=e(s);return xr.encode(Rf.concat([s,c],s.length+4))}function r(s){var c=s.slice(0,-4),u=s.slice(-4),p=e(c);if(!(u[0]^p[0]|u[1]^p[1]|u[2]^p[2]|u[3]^p[3]))return c}function n(s){var c=xr.decodeUnsafe(s);if(c)return r(c)}function o(s){var c=xr.decode(s),u=r(c);if(!u)throw new Error("Invalid checksum");return u}return{encode:t,decode:o,decodeUnsafe:n}},Nn=mf,If=Sf;function kf(e){var t=Nn("sha256").update(e).digest();return Nn("sha256").update(t).digest()}var Tf=If(kf),Mr=Tf;function Ui(e,t){if(t!==void 0&&e[0]!==t)throw new Error("Invalid network version");if(e.length===33)return{version:e[0],privateKey:e.slice(1,33),compressed:!1};if(e.length!==34)throw new Error("Invalid WIF length");if(e[33]!==1)throw new Error("Invalid compression flag");return{version:e[0],privateKey:e.slice(1,33),compressed:!0}}function Ur(e,t,r){var n=new Buffer(r?34:33);return n.writeUInt8(e,0),t.copy(n,1),r&&(n[33]=1),n}function Af(e,t){return Ui(Mr.decode(e),t)}function Cf(e,t,r){return typeof e=="number"?Mr.encode(Ur(e,t,r)):Mr.encode(Ur(e.version,e.privateKey,e.compressed))}var Pf={decode:Af,decodeRaw:Ui,encode:Cf,encodeRaw:Ur},or={};Object.defineProperty(or,"__esModule",{value:!0});or.testEcc=void 0;const H=e=>Buffer.from(e,"hex");function Of(e){J(e.isPoint(H("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),J(!e.isPoint(H("030000000000000000000000000000000000000000000000000000000000000005"))),J(e.isPrivate(H("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),J(e.isPrivate(H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))),J(!e.isPrivate(H("0000000000000000000000000000000000000000000000000000000000000000"))),J(!e.isPrivate(H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"))),J(!e.isPrivate(H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364142"))),J(Buffer.from(e.privateAdd(H("0000000000000000000000000000000000000000000000000000000000000001"),H("0000000000000000000000000000000000000000000000000000000000000000"))).equals(H("0000000000000000000000000000000000000000000000000000000000000001"))),J(e.privateAdd(H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e"),H("0000000000000000000000000000000000000000000000000000000000000003"))===null),J(Buffer.from(e.privateAdd(H("e211078564db65c3ce7704f08262b1f38f1ef412ad15b5ac2d76657a63b2c500"),H("b51fbb69051255d1becbd683de5848242a89c229348dd72896a87ada94ae8665"))).equals(H("9730c2ee69edbb958d42db7460bafa18fef9d955325aec99044c81c8282b0a24"))),J(Buffer.from(e.privateNegate(H("0000000000000000000000000000000000000000000000000000000000000001"))).equals(H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))),J(Buffer.from(e.privateNegate(H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e"))).equals(H("0000000000000000000000000000000000000000000000000000000000000003"))),J(Buffer.from(e.privateNegate(H("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af"))).equals(H("4eede1bf775995d70a494f0a7bb6bc11e0b8cccd41cce8009ab1132c8b0a3792"))),J(Buffer.from(e.pointCompress(H("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"),!0)).equals(H("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),J(Buffer.from(e.pointCompress(H("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"),!1)).equals(H("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"))),J(Buffer.from(e.pointCompress(H("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),!0)).equals(H("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),J(Buffer.from(e.pointCompress(H("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),!1)).equals(H("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"))),J(Buffer.from(e.pointFromScalar(H("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af"))).equals(H("02b07ba9dca9523b7ef4bd97703d43d20399eb698e194704791a25ce77a400df99"))),J(e.xOnlyPointAddTweak(H("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))===null);let t=e.xOnlyPointAddTweak(H("1617d38ed8d8657da4d4761e8057bc396ea9e4b9d29776d4be096016dbd2509b"),H("a8397a935f0dfceba6ba9618f6451ef4d80637abf4e6af2669fbc9de6a8fd2ac"));J(Buffer.from(t.xOnlyPubkey).equals(H("e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf"))&&t.parity===1),t=e.xOnlyPointAddTweak(H("2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991"),H("823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47")),J(Buffer.from(t.xOnlyPubkey).equals(H("9534f8dc8c6deda2dc007655981c78b49c5d96c778fbf363462a11ec9dfd948c"))&&t.parity===0),J(Buffer.from(e.sign(H("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))).equals(H("54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"))),J(e.verify(H("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),H("0379be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),H("54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"))),e.signSchnorr&&J(Buffer.from(e.signSchnorr(H("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),H("c90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b14e5c9"),H("c87aa53824b4d7ae2eb035a2b5bbbccc080e76cdc6d1692c4b0b62d798e6d906"))).equals(H("5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7"))),e.verifySchnorr&&J(e.verifySchnorr(H("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),H("dd308afec5777e13121fa72b9cc1b7cc0139715309b086c960e18fd969774eb8"),H("5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7")))}or.testEcc=Of;function J(e){if(!e)throw new Error("ecc library invalid")}Object.defineProperty(lt,"__esModule",{value:!0});lt.ECPairFactory=lt.networks=void 0;const Dr=ht;lt.networks=Dr;const ye=Qn,Nf=ao,Fn=Pf,Ff=or,Er=ye.typeforce.maybe(ye.typeforce.compile({compressed:ye.maybe(ye.Boolean),network:ye.maybe(ye.Network)})),Lf=e=>e.length===32?e:e.slice(1,33);function Mf(e){(0,Ff.testEcc)(e);function t(u){return e.isPoint(u)}function r(u,p){if(ye.typeforce(ye.Buffer256bit,u),!e.isPrivate(u))throw new TypeError("Private key not in range [1, n)");return ye.typeforce(Er,p),new c(u,void 0,p)}function n(u,p){return ye.typeforce(e.isPoint,u),ye.typeforce(Er,p),new c(void 0,u,p)}function o(u,p){const y=Fn.decode(u),g=y.version;if(ye.Array(p)){if(p=p.filter(w=>g===w.wif).pop(),!p)throw new Error("Unknown network version")}else if(p=p||Dr.bitcoin,g!==p.wif)throw new Error("Invalid network version");return r(y.privateKey,{compressed:y.compressed,network:p})}function s(u){ye.typeforce(Er,u),u===void 0&&(u={});const p=u.rng||Nf;let y;do y=p(32),ye.typeforce(ye.Buffer256bit,y);while(!e.isPrivate(y));return r(y,u)}class c{constructor(p,y,g){it(this,"__D");it(this,"__Q");it(this,"compressed");it(this,"network");it(this,"lowR");this.__D=p,this.__Q=y,this.lowR=!1,g===void 0&&(g={}),this.compressed=g.compressed===void 0?!0:g.compressed,this.network=g.network||Dr.bitcoin,y!==void 0&&(this.__Q=Buffer.from(e.pointCompress(y,this.compressed)))}get privateKey(){return this.__D}get publicKey(){if(!this.__Q){const p=e.pointFromScalar(this.__D,this.compressed);this.__Q=Buffer.from(p)}return this.__Q}toWIF(){if(!this.__D)throw new Error("Missing private key");return Fn.encode(this.network.wif,this.__D,this.compressed)}tweak(p){return this.privateKey?this.tweakFromPrivateKey(p):this.tweakFromPublicKey(p)}sign(p,y){if(!this.__D)throw new Error("Missing private key");if(y===void 0&&(y=this.lowR),y===!1)return Buffer.from(e.sign(p,this.__D));{let g=e.sign(p,this.__D);const w=Buffer.alloc(32,0);let x=0;for(;g[0]>127;)x++,w.writeUIntLE(x,0,6),g=e.sign(p,this.__D,w);return Buffer.from(g)}}signSchnorr(p){if(!this.privateKey)throw new Error("Missing private key");if(!e.signSchnorr)throw new Error("signSchnorr not supported by ecc library");return Buffer.from(e.signSchnorr(p,this.privateKey))}verify(p,y){return e.verify(p,this.publicKey,y)}verifySchnorr(p,y){if(!e.verifySchnorr)throw new Error("verifySchnorr not supported by ecc library");return e.verifySchnorr(p,this.publicKey.subarray(1,33),y)}tweakFromPublicKey(p){const y=Lf(this.publicKey),g=e.xOnlyPointAddTweak(y,p);if(!g||g.xOnlyPubkey===null)throw new Error("Cannot tweak public key!");const w=Buffer.from([g.parity===0?2:3]);return n(Buffer.concat([w,g.xOnlyPubkey]),{network:this.network,compressed:this.compressed})}tweakFromPrivateKey(p){const g=this.publicKey[0]===3||this.publicKey[0]===4&&(this.publicKey[64]&1)===1?e.privateNegate(this.privateKey):this.privateKey,w=e.privateAdd(g,p);if(!w)throw new Error("Invalid tweaked private key!");return r(Buffer.from(w),{network:this.network,compressed:this.compressed})}}return{isPoint:t,fromPrivateKey:r,fromPublicKey:n,fromWIF:o,makeRandom:s}}lt.ECPairFactory=Mf;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.networks=e.ECPairFactory=e.default=void 0;var t=lt;Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.ECPairFactory}}),Object.defineProperty(e,"ECPairFactory",{enumerable:!0,get:function(){return t.ECPairFactory}}),Object.defineProperty(e,"networks",{enumerable:!0,get:function(){return t.networks}})})(Yn);class Kt{constructor(t){this.privKey=t}static fromPrivKey(t){return new Kt(P.trim0x(t))}static async fromWalletClient(t){if(!t.account)return P.Err("No account found");try{const r=await t.signTypedData({account:t.account,types:{EIP712Domain:[{name:"name",type:"string"},{name:"version",type:"string"}],Data:[{name:"Message",type:"string"},{name:"Version",type:"string"},{name:"Nonce",type:"uint256"}]},domain:{name:"WBTC GARDEN",version:"1"},primaryType:"Data",message:{Message:"Initialize your swap",Version:"1.0.0",Nonce:1n}});return P.Ok(new Kt(P.trim0x(Oe.sha256(r))))}catch(r){return P.Err("Failed to initialize: "+r)}}getMasterPrivKey(){return this.privKey}generateSecret(t){const r=this.signMessage(t),n=Oe.sha256(We(r)),o=Oe.sha256(n);return P.Ok({secret:n,secretHash:o})}signMessage(t){const r=Yn.ECPairFactory(ct),n="Garden.fi"+t.toString(),o=Buffer.from(n,"utf8"),s=Oe.sha256(o),c=Buffer.from(P.trim0x(this.privKey),"hex");if(c.length!==32)throw new Error("Invalid private key length. Expected 32 bytes.");return r.fromPrivateKey(c).sign(Buffer.from(P.trim0x(s),"hex")).toString("hex")}}class Uf{constructor(t){this.quoteUrl=new Rt("/quote",t)}async getQuote(t,r,n=!1){try{const o=this.quoteUrl.addSearchParams({order_pair:t,amount:r.toString(),exact_out:n.toString()}),s=await P.Fetcher.get(o);return s.error?P.Err(s.error):s.result?P.Ok(s.result):P.Err("GetQuote: Unexpected error, result is undefined")}catch(o){return P.Err("GetQuote:",String(o))}}async getAttestedQuote(t){try{const r=await P.Fetcher.post(this.quoteUrl.endpoint("/attested").toString(),{body:JSON.stringify(t),headers:{"Content-Type":"application/json"}});return r.error?P.Err(r.error):r.result?P.Ok(r.result):P.Err("GetAttestedQuote: Unexpected error, result is undefined")}catch(r){return console.log("error :",r),P.Err("GetAttestedQuote:",String(r))}}}exports.EvmRelay=Jn;exports.Garden=Ua;exports.ParseOrderStatus=Kn;exports.ParseSwapStatus=Ht;exports.Quote=Uf;exports.SecretManager=Kt;exports.parseAction=Vn;exports.switchOrAddNetwork=Ta;