@gardenfi/core 0.2.0-beta.4 → 0.2.0-beta.5
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 +14 -780
- package/dist/index.js +4569 -30608
- package/dist/src/index.d.ts +6 -7
- package/dist/src/lib/evm/htlc/evmHTLC.d.ts +20404 -0
- package/dist/src/lib/evm/htlc/evmHTLC.types.d.ts +29 -0
- package/dist/src/lib/{evmRelay → evm/relay}/evmRelay.d.ts +5 -4
- package/dist/src/lib/{evmRelay → evm/relay}/evmRelay.types.d.ts +3 -3
- package/dist/src/lib/garden/garden.d.ts +36 -11
- package/dist/src/lib/garden/garden.types.d.ts +28 -14
- package/dist/src/lib/garden/orderCache.d.ts +13 -0
- package/dist/src/lib/{orderExecutor → garden}/orderStatusParser.d.ts +2 -1
- package/dist/src/lib/{orderExecutor/orderExecutor.types.d.ts → status.d.ts} +0 -67
- package/dist/src/lib/utils.d.ts +11 -1
- package/package.json +2 -2
- package/dist/src/lib/orderExecutor/blockNumber.d.ts +0 -17
- package/dist/src/lib/orderExecutor/orderCache.d.ts +0 -13
- package/dist/src/lib/orderExecutor/orderExecutor.d.ts +0 -25
- /package/dist/src/lib/{evmRelay/abi.d.ts → evm/abi/atomicSwap.d.ts} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1,795 +1,29 @@
|
|
|
1
|
-
"use strict";var
|
|
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=i,this.docsPath=s,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=t,this.version=Zd}walk(t){return Xd(this,t)}};function Xd(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e?Xd(e.cause,t):t?null:e}let e0=class extends pn{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"})}},t0=class extends pn{constructor({blockHash:t,blockNumber:r,blockTag:n,hash:i,index:s}){let o="Transaction";n&&s!==void 0&&(o=`Transaction at block time "${n}" at index "${s}"`),t&&s!==void 0&&(o=`Transaction at block hash "${t}" at index "${s}"`),r&&s!==void 0&&(o=`Transaction at block number "${r}" at index "${s}"`),i&&(o=`Transaction with hash "${i}"`),super(`${o} could not be found.`,{name:"TransactionNotFoundError"})}};class r0 extends pn{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 zp=class extends pn{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}};function Pn(e,t,r){const n=e[t.name];if(typeof n=="function")return n;const i=e[r];return typeof i=="function"?i:s=>t(e,s)}const Ro=new Map,pu=new Map;let Wp=0;function Ra(e,t,r){const n=++Wp,i=()=>Ro.get(e)||[],s=()=>{const f=i();Ro.set(e,f.filter(d=>d.id!==n))},o=()=>{const f=pu.get(e);i().length===1&&f&&f(),s()},u=i();if(Ro.set(e,[...u,{id:n,fns:t}]),u&&u.length>0)return o;const l={};for(const f in t)l[f]=(...d)=>{var c,g;const h=i();if(h.length!==0)for(const b of h)(g=(c=b.fns)[f])==null||g.call(c,...d)};const a=r(l);return typeof a=="function"&&pu.set(e,a),o}async function Na(e){return new Promise(t=>setTimeout(t,e))}function bu(e,{delay:t=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:u=0}={})=>{const l=async({error:a})=>{const f=typeof t=="function"?t({count:u,error:a}):t;f&&await Na(f),o({count:u+1})};try{const a=await e();i(a)}catch(a){if(u<r&&await n({count:u,error:a}))return l({error:a});s(a)}};o()})}const Ia=(e,t,r)=>JSON.stringify(e,(n,i)=>typeof i=="bigint"?i.toString():i,r);class Jp extends pn{constructor({max:t,min:r,signed:n,size:i,value:s}){super(`Number "${s}" is not in safe ${i?`${i*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${t?`(${r} to ${t})`:`(above ${r})`}`,{name:"IntegerOutOfRangeError"})}}let Qp=class extends pn{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};class n0 extends pn{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 Yp(e,{dir:t,size:r=32}={}){return typeof e=="string"?Zp(e,{dir:t,size:r}):Xp(e,{dir:t,size:r})}function Zp(e,{dir:t,size:r=32}={}){if(r===null)return e;const n=e.replace("0x","");if(n.length>r*2)throw new n0({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](r*2,"0")}`}function Xp(e,{dir:t,size:r=32}={}){if(r===null)return e;if(e.length>r)throw new n0({size:e.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;i<r;i++){const s=t==="right";n[s?i:r-i-1]=e[s?i:e.length-i-1]}return n}function Cs(e,t={}){const{signed:r,size:n}=t,i=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 o=typeof s=="bigint"&&r?-s-1n:0;if(s&&i>s||i<o){const l=typeof e=="bigint"?"n":"";throw new Jp({max:s?`${s}${l}`:void 0,min:`${o}${l}`,signed:r,size:n,value:`${e}${l}`})}const u=`0x${(r&&i<0?(1n<<BigInt(n*8))+BigInt(i):i).toString(16)}`;return n?Yp(u,{size:n}):u}function eb(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function gu(e){return eb(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function tb(e,{size:t}){if(gu(e)>t)throw new Qp({givenSize:gu(e),maxSize:t})}function i0(e,t={}){const{signed:r}=t;t.size&&tb(e,{size:t.size});const n=BigInt(e);if(!r)return n;const i=(e.length-2)/2,s=(1n<<BigInt(i)*8n-1n)-1n;return n<=s?n:n-BigInt(`0x${"f".padStart(i*2,"f")}`)-1n}function Ma(e,t={}){return Number(i0(e,t))}const s0={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function o0(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Ma(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?Ma(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?s0[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=rb(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 rb(e){return e.map(t=>({contractAddress:t.address,r:t.r,s:t.s,chainId:Number(t.chainId),nonce:Number(t.nonce),...typeof t.yParity<"u"?{yParity:Number(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:Number(t.v)}:{}}))}function nb(e){var t;const r=(t=e.transactions)==null?void 0:t.map(n=>typeof n=="string"?n:o0(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 ib(e,{blockHash:t,blockNumber:r,blockTag:n,includeTransactions:i}={}){var s,o,u;const l=n??"latest",a=i??!1,f=r!==void 0?Cs(r):void 0;let d=null;if(t?d=await e.request({method:"eth_getBlockByHash",params:[t,a]},{dedupe:!0}):d=await e.request({method:"eth_getBlockByNumber",params:[f||l,a]},{dedupe:!!f}),!d)throw new e0({blockHash:t,blockNumber:r});return(((u=(o=(s=e.chain)==null?void 0:s.formatters)==null?void 0:o.block)==null?void 0:u.format)||nb)(d)}async function sb(e,{blockHash:t,blockNumber:r,blockTag:n,hash:i,index:s}){var o,u,l;const a=n||"latest",f=r!==void 0?Cs(r):void 0;let d=null;if(i?d=await e.request({method:"eth_getTransactionByHash",params:[i]},{dedupe:!0}):t?d=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,Cs(s)]},{dedupe:!0}):(f||a)&&(d=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[f||a,Cs(s)]},{dedupe:!!f})),!d)throw new t0({blockHash:t,blockNumber:r,blockTag:a,hash:i,index:s});return(((l=(u=(o=e.chain)==null?void 0:o.formatters)==null?void 0:u.transaction)==null?void 0:l.format)||o0)(d)}function ob(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 ab={"0x0":"reverted","0x1":"success"};function cb(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=>ob(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Ma(e.transactionIndex):null,status:e.status?ab[e.status]:null,type:e.type?s0[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}async function mu(e,{hash:t}){var r,n,i;const s=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!s)throw new r0({hash:t});return(((i=(n=(r=e.chain)==null?void 0:r.formatters)==null?void 0:n.transactionReceipt)==null?void 0:i.format)||cb)(s)}function ub(e,{emitOnBegin:t,initialWaitTime:r,interval:n}){let i=!0;const s=()=>i=!1;return(async()=>{let o;t&&(o=await e({unpoll:s}));const u=await(r==null?void 0:r(o))??n;await Na(u);const l=async()=>{i&&(await e({unpoll:s}),await Na(n),l())};l()})(),s}const lb=new Map,fb=new Map;function db(e){const t=(i,s)=>({clear:()=>s.delete(i),get:()=>s.get(i),set:o=>s.set(i,o)}),r=t(e,lb),n=t(e,fb);return{clear:()=>{r.clear(),n.clear()},promise:r,response:n}}async function hb(e,{cacheKey:t,cacheTime:r=Number.POSITIVE_INFINITY}){const n=db(t),i=n.response.get();if(i&&r>0&&new Date().getTime()-i.created.getTime()<r)return i.data;let s=n.promise.get();s||(s=e(),n.promise.set(s));try{const o=await s;return n.response.set({created:new Date,data:o}),o}finally{n.promise.clear()}}const pb=e=>`blockNumber.${e}`;async function bb(e,{cacheTime:t=e.cacheTime}={}){const r=await hb(()=>e.request({method:"eth_blockNumber"}),{cacheKey:pb(e.uid),cacheTime:t});return BigInt(r)}function gb(e,{emitOnBegin:t=!1,emitMissed:r=!1,onBlockNumber:n,onError:i,poll:s,pollingInterval:o=e.pollingInterval}){const u=typeof s<"u"?s:!(e.transport.type==="webSocket"||e.transport.type==="fallback"&&e.transport.transports[0].config.type==="webSocket");let l;return u?(()=>{const a=Ia(["watchBlockNumber",e.uid,t,r,o]);return Ra(a,{onBlockNumber:n,onError:i},f=>ub(async()=>{var d;try{const c=await Pn(e,bb,"getBlockNumber")({cacheTime:0});if(l){if(c===l)return;if(c-l>1&&r)for(let g=l+1n;g<c;g++)f.onBlockNumber(g,l),l=g}(!l||c>l)&&(f.onBlockNumber(c,l),l=c)}catch(c){(d=f.onError)==null||d.call(f,c)}},{emitOnBegin:t,interval:o}))})():(()=>{const a=Ia(["watchBlockNumber",e.uid,t,r]);return Ra(a,{onBlockNumber:n,onError:i},f=>{let d=!0,c=()=>d=!1;return(async()=>{try{const g=(()=>{if(e.transport.type==="fallback"){const b=e.transport.transports.find(P=>P.config.type==="webSocket");return b?b.value:e.transport}return e.transport})(),{unsubscribe:h}=await g.subscribe({params:["newHeads"],onData(b){var P;if(!d)return;const w=i0((P=b.result)==null?void 0:P.number);f.onBlockNumber(w,l),l=w},onError(b){var P;(P=f.onError)==null||P.call(f,b)}});c=h,d||c()}catch(g){i==null||i(g)}})(),()=>c()})})()}async function mb(e,{confirmations:t=1,hash:r,onReplaced:n,pollingInterval:i=e.pollingInterval,retryCount:s=6,retryDelay:o=({count:l})=>~~(1<<l)*200,timeout:u=18e4}){const l=Ia(["waitForTransactionReceipt",e.uid,r]);let a,f,d,c=!1;return new Promise((g,h)=>{u&&setTimeout(()=>h(new zp({hash:r})),u);const b=Ra(l,{onReplaced:n,resolve:g,reject:h},P=>{const w=Pn(e,gb,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:i,async onBlockNumber(y){const v=B=>{w(),B(),b()};let p=y;if(!c)try{if(d){if(t>1&&(!d.blockNumber||p-d.blockNumber+1n<t))return;v(()=>P.resolve(d));return}if(a||(c=!0,await bu(async()=>{a=await Pn(e,sb,"getTransaction")({hash:r}),a.blockNumber&&(p=a.blockNumber)},{delay:o,retryCount:s}),c=!1),d=await Pn(e,mu,"getTransactionReceipt")({hash:r}),t>1&&(!d.blockNumber||p-d.blockNumber+1n<t))return;v(()=>P.resolve(d))}catch(B){if(B instanceof t0||B instanceof r0){if(!a){c=!1;return}try{f=a,c=!0;const k=await bu(()=>Pn(e,ib,"getBlock")({blockNumber:p,includeTransactions:!0}),{delay:o,retryCount:s,shouldRetry:({error:N})=>N instanceof e0});c=!1;const R=k.transactions.find(({from:N,nonce:S})=>N===f.from&&S===f.nonce);if(!R||(d=await Pn(e,mu,"getTransactionReceipt")({hash:R.hash}),t>1&&(!d.blockNumber||p-d.blockNumber+1n<t)))return;let T="replaced";R.to===f.to&&R.value===f.value?T="repriced":R.from===R.to&&R.value===0n&&(T="cancelled"),v(()=>{var N;(N=P.onReplaced)==null||N.call(P,{reason:T,replacedTransaction:f,transaction:R,transactionReceipt:d}),P.resolve(d)})}catch(k){v(()=>P.reject(k))}}else v(()=>P.reject(B))}}})})})}const yb=async(e,t,r,n)=>{if(!n.account)return Te.Err("No account found");const i=nr.getContract({address:Sr(t),abi:nr.erc20Abi,client:n}),s=await n.getAddresses();if(!s[0])return Te.Err("No account found");try{const o=await i.read.allowance([Sr(s[0]),Sr(r)]);if(BigInt(o)<BigInt(e)){const u=await i.write.approve([Sr(r),nr.maxUint256],{account:n.account,chain:n.chain});return(await mb(n,{hash:u})).status!=="success"?Te.Err("Failed to approve"):Te.Ok(u)}return Te.Ok("Already approved")}catch(o){return Te.Err("Failed to approve: "+o)}};class fn extends URL{constructor(t,r){super(t,r)}endpoint(t){t.startsWith("/")||(t=`/${t}`);const r=`${this.pathname!=="/"?this.pathname:""}${t}`;return new fn(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 fn(`${this.pathname}?${r.toString()}`,this)}}var Me=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function a0(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 i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var c0={},Zs={},u0={},Xs={},Ar={},eo={};eo.byteLength=Ab;eo.toByteArray=vb;eo.fromByteArray=Pb;var rr=[],Dt=[],xb=typeof Uint8Array<"u"?Uint8Array:Array,No="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var En=0,wb=No.length;En<wb;++En)rr[En]=No[En],Dt[No.charCodeAt(En)]=En;Dt[45]=62;Dt[95]=63;function l0(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 Ab(e){var t=l0(e),r=t[0],n=t[1];return(r+n)*3/4-n}function Eb(e,t,r){return(t+r)*3/4-r}function vb(e){var t,r=l0(e),n=r[0],i=r[1],s=new xb(Eb(e,n,i)),o=0,u=i>0?n-4:n,l;for(l=0;l<u;l+=4)t=Dt[e.charCodeAt(l)]<<18|Dt[e.charCodeAt(l+1)]<<12|Dt[e.charCodeAt(l+2)]<<6|Dt[e.charCodeAt(l+3)],s[o++]=t>>16&255,s[o++]=t>>8&255,s[o++]=t&255;return i===2&&(t=Dt[e.charCodeAt(l)]<<2|Dt[e.charCodeAt(l+1)]>>4,s[o++]=t&255),i===1&&(t=Dt[e.charCodeAt(l)]<<10|Dt[e.charCodeAt(l+1)]<<4|Dt[e.charCodeAt(l+2)]>>2,s[o++]=t>>8&255,s[o++]=t&255),s}function _b(e){return rr[e>>18&63]+rr[e>>12&63]+rr[e>>6&63]+rr[e&63]}function kb(e,t,r){for(var n,i=[],s=t;s<r;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(e[s+2]&255),i.push(_b(n));return i.join("")}function Pb(e){for(var t,r=e.length,n=r%3,i=[],s=16383,o=0,u=r-n;o<u;o+=s)i.push(kb(e,o,o+s>u?u:o+s));return n===1?(t=e[r-1],i.push(rr[t>>2]+rr[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(rr[t>>10]+rr[t>>4&63]+rr[t<<2&63]+"=")),i.join("")}var vc={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */vc.read=function(e,t,r,n,i){var s,o,u=i*8-n-1,l=(1<<u)-1,a=l>>1,f=-7,d=r?i-1:0,c=r?-1:1,g=e[t+d];for(d+=c,s=g&(1<<-f)-1,g>>=-f,f+=u;f>0;s=s*256+e[t+d],d+=c,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+e[t+d],d+=c,f-=8);if(s===0)s=1-a;else{if(s===l)return o?NaN:(g?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-a}return(g?-1:1)*o*Math.pow(2,s-n)};vc.write=function(e,t,r,n,i,s){var o,u,l,a=s*8-i-1,f=(1<<a)-1,d=f>>1,c=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:s-1,h=n?1:-1,b=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+d>=1?t+=c/l:t+=c*Math.pow(2,1-d),t*l>=2&&(o++,l/=2),o+d>=f?(u=0,o=f):o+d>=1?(u=(t*l-1)*Math.pow(2,i),o=o+d):(u=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[r+g]=u&255,g+=h,u/=256,i-=8);for(o=o<<i|u,a+=i;a>0;e[r+g]=o&255,g+=h,o/=256,a-=8);e[r+g-h]|=b*128};/*!
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
6
|
-
* @license MIT
|
|
7
|
-
*/(function(e){const t=eo,r=vc,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=y,e.INSPECT_MAX_BYTES=50;const i=2147483647;e.kMaxLength=i,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 C=new Uint8Array(1),m={foo:function(){return 42}};return Object.setPrototypeOf(m,Uint8Array.prototype),Object.setPrototypeOf(C,m),C.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 o(C){if(C>i)throw new RangeError('The value "'+C+'" is invalid for option "size"');const m=new Uint8Array(C);return Object.setPrototypeOf(m,u.prototype),m}function u(C,m,_){if(typeof C=="number"){if(typeof m=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(C)}return l(C,m,_)}u.poolSize=8192;function l(C,m,_){if(typeof C=="string")return c(C,m);if(ArrayBuffer.isView(C))return h(C);if(C==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof C);if(ye(C,ArrayBuffer)||C&&ye(C.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ye(C,SharedArrayBuffer)||C&&ye(C.buffer,SharedArrayBuffer)))return b(C,m,_);if(typeof C=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const G=C.valueOf&&C.valueOf();if(G!=null&&G!==C)return u.from(G,m,_);const X=P(C);if(X)return X;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof C[Symbol.toPrimitive]=="function")return u.from(C[Symbol.toPrimitive]("string"),m,_);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof C)}u.from=function(C,m,_){return l(C,m,_)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function a(C){if(typeof C!="number")throw new TypeError('"size" argument must be of type number');if(C<0)throw new RangeError('The value "'+C+'" is invalid for option "size"')}function f(C,m,_){return a(C),C<=0?o(C):m!==void 0?typeof _=="string"?o(C).fill(m,_):o(C).fill(m):o(C)}u.alloc=function(C,m,_){return f(C,m,_)};function d(C){return a(C),o(C<0?0:w(C)|0)}u.allocUnsafe=function(C){return d(C)},u.allocUnsafeSlow=function(C){return d(C)};function c(C,m){if((typeof m!="string"||m==="")&&(m="utf8"),!u.isEncoding(m))throw new TypeError("Unknown encoding: "+m);const _=v(C,m)|0;let G=o(_);const X=G.write(C,m);return X!==_&&(G=G.slice(0,X)),G}function g(C){const m=C.length<0?0:w(C.length)|0,_=o(m);for(let G=0;G<m;G+=1)_[G]=C[G]&255;return _}function h(C){if(ye(C,Uint8Array)){const m=new Uint8Array(C);return b(m.buffer,m.byteOffset,m.byteLength)}return g(C)}function b(C,m,_){if(m<0||C.byteLength<m)throw new RangeError('"offset" is outside of buffer bounds');if(C.byteLength<m+(_||0))throw new RangeError('"length" is outside of buffer bounds');let G;return m===void 0&&_===void 0?G=new Uint8Array(C):_===void 0?G=new Uint8Array(C,m):G=new Uint8Array(C,m,_),Object.setPrototypeOf(G,u.prototype),G}function P(C){if(u.isBuffer(C)){const m=w(C.length)|0,_=o(m);return _.length===0||C.copy(_,0,0,m),_}if(C.length!==void 0)return typeof C.length!="number"||ie(C.length)?o(0):g(C);if(C.type==="Buffer"&&Array.isArray(C.data))return g(C.data)}function w(C){if(C>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return C|0}function y(C){return+C!=C&&(C=0),u.alloc(+C)}u.isBuffer=function(m){return m!=null&&m._isBuffer===!0&&m!==u.prototype},u.compare=function(m,_){if(ye(m,Uint8Array)&&(m=u.from(m,m.offset,m.byteLength)),ye(_,Uint8Array)&&(_=u.from(_,_.offset,_.byteLength)),!u.isBuffer(m)||!u.isBuffer(_))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(m===_)return 0;let G=m.length,X=_.length;for(let le=0,ge=Math.min(G,X);le<ge;++le)if(m[le]!==_[le]){G=m[le],X=_[le];break}return G<X?-1:X<G?1:0},u.isEncoding=function(m){switch(String(m).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(m,_){if(!Array.isArray(m))throw new TypeError('"list" argument must be an Array of Buffers');if(m.length===0)return u.alloc(0);let G;if(_===void 0)for(_=0,G=0;G<m.length;++G)_+=m[G].length;const X=u.allocUnsafe(_);let le=0;for(G=0;G<m.length;++G){let ge=m[G];if(ye(ge,Uint8Array))le+ge.length>X.length?(u.isBuffer(ge)||(ge=u.from(ge)),ge.copy(X,le)):Uint8Array.prototype.set.call(X,ge,le);else if(u.isBuffer(ge))ge.copy(X,le);else throw new TypeError('"list" argument must be an Array of Buffers');le+=ge.length}return X};function v(C,m){if(u.isBuffer(C))return C.length;if(ArrayBuffer.isView(C)||ye(C,ArrayBuffer))return C.byteLength;if(typeof C!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof C);const _=C.length,G=arguments.length>2&&arguments[2]===!0;if(!G&&_===0)return 0;let X=!1;for(;;)switch(m){case"ascii":case"latin1":case"binary":return _;case"utf8":case"utf-8":return z(C).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _*2;case"hex":return _>>>1;case"base64":return he(C).length;default:if(X)return G?-1:z(C).length;m=(""+m).toLowerCase(),X=!0}}u.byteLength=v;function p(C,m,_){let G=!1;if((m===void 0||m<0)&&(m=0),m>this.length||((_===void 0||_>this.length)&&(_=this.length),_<=0)||(_>>>=0,m>>>=0,_<=m))return"";for(C||(C="utf8");;)switch(C){case"hex":return D(this,m,_);case"utf8":case"utf-8":return O(this,m,_);case"ascii":return H(this,m,_);case"latin1":case"binary":return V(this,m,_);case"base64":return A(this,m,_);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,m,_);default:if(G)throw new TypeError("Unknown encoding: "+C);C=(C+"").toLowerCase(),G=!0}}u.prototype._isBuffer=!0;function B(C,m,_){const G=C[m];C[m]=C[_],C[_]=G}u.prototype.swap16=function(){const m=this.length;if(m%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let _=0;_<m;_+=2)B(this,_,_+1);return this},u.prototype.swap32=function(){const m=this.length;if(m%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let _=0;_<m;_+=4)B(this,_,_+3),B(this,_+1,_+2);return this},u.prototype.swap64=function(){const m=this.length;if(m%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let _=0;_<m;_+=8)B(this,_,_+7),B(this,_+1,_+6),B(this,_+2,_+5),B(this,_+3,_+4);return this},u.prototype.toString=function(){const m=this.length;return m===0?"":arguments.length===0?O(this,0,m):p.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(m){if(!u.isBuffer(m))throw new TypeError("Argument must be a Buffer");return this===m?!0:u.compare(this,m)===0},u.prototype.inspect=function(){let m="";const _=e.INSPECT_MAX_BYTES;return m=this.toString("hex",0,_).replace(/(.{2})/g,"$1 ").trim(),this.length>_&&(m+=" ... "),"<Buffer "+m+">"},n&&(u.prototype[n]=u.prototype.inspect),u.prototype.compare=function(m,_,G,X,le){if(ye(m,Uint8Array)&&(m=u.from(m,m.offset,m.byteLength)),!u.isBuffer(m))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof m);if(_===void 0&&(_=0),G===void 0&&(G=m?m.length:0),X===void 0&&(X=0),le===void 0&&(le=this.length),_<0||G>m.length||X<0||le>this.length)throw new RangeError("out of range index");if(X>=le&&_>=G)return 0;if(X>=le)return-1;if(_>=G)return 1;if(_>>>=0,G>>>=0,X>>>=0,le>>>=0,this===m)return 0;let ge=le-X,Oe=G-_;const Le=Math.min(ge,Oe),Re=this.slice(X,le),Ne=m.slice(_,G);for(let $e=0;$e<Le;++$e)if(Re[$e]!==Ne[$e]){ge=Re[$e],Oe=Ne[$e];break}return ge<Oe?-1:Oe<ge?1:0};function k(C,m,_,G,X){if(C.length===0)return-1;if(typeof _=="string"?(G=_,_=0):_>2147483647?_=2147483647:_<-2147483648&&(_=-2147483648),_=+_,ie(_)&&(_=X?0:C.length-1),_<0&&(_=C.length+_),_>=C.length){if(X)return-1;_=C.length-1}else if(_<0)if(X)_=0;else return-1;if(typeof m=="string"&&(m=u.from(m,G)),u.isBuffer(m))return m.length===0?-1:R(C,m,_,G,X);if(typeof m=="number")return m=m&255,typeof Uint8Array.prototype.indexOf=="function"?X?Uint8Array.prototype.indexOf.call(C,m,_):Uint8Array.prototype.lastIndexOf.call(C,m,_):R(C,[m],_,G,X);throw new TypeError("val must be string, number or Buffer")}function R(C,m,_,G,X){let le=1,ge=C.length,Oe=m.length;if(G!==void 0&&(G=String(G).toLowerCase(),G==="ucs2"||G==="ucs-2"||G==="utf16le"||G==="utf-16le")){if(C.length<2||m.length<2)return-1;le=2,ge/=2,Oe/=2,_/=2}function Le(Ne,$e){return le===1?Ne[$e]:Ne.readUInt16BE($e*le)}let Re;if(X){let Ne=-1;for(Re=_;Re<ge;Re++)if(Le(C,Re)===Le(m,Ne===-1?0:Re-Ne)){if(Ne===-1&&(Ne=Re),Re-Ne+1===Oe)return Ne*le}else Ne!==-1&&(Re-=Re-Ne),Ne=-1}else for(_+Oe>ge&&(_=ge-Oe),Re=_;Re>=0;Re--){let Ne=!0;for(let $e=0;$e<Oe;$e++)if(Le(C,Re+$e)!==Le(m,$e)){Ne=!1;break}if(Ne)return Re}return-1}u.prototype.includes=function(m,_,G){return this.indexOf(m,_,G)!==-1},u.prototype.indexOf=function(m,_,G){return k(this,m,_,G,!0)},u.prototype.lastIndexOf=function(m,_,G){return k(this,m,_,G,!1)};function T(C,m,_,G){_=Number(_)||0;const X=C.length-_;G?(G=Number(G),G>X&&(G=X)):G=X;const le=m.length;G>le/2&&(G=le/2);let ge;for(ge=0;ge<G;++ge){const Oe=parseInt(m.substr(ge*2,2),16);if(ie(Oe))return ge;C[_+ge]=Oe}return ge}function N(C,m,_,G){return we(z(m,C.length-_),C,_,G)}function S(C,m,_,G){return we(oe(m),C,_,G)}function E(C,m,_,G){return we(he(m),C,_,G)}function x(C,m,_,G){return we(Y(m,C.length-_),C,_,G)}u.prototype.write=function(m,_,G,X){if(_===void 0)X="utf8",G=this.length,_=0;else if(G===void 0&&typeof _=="string")X=_,G=this.length,_=0;else if(isFinite(_))_=_>>>0,isFinite(G)?(G=G>>>0,X===void 0&&(X="utf8")):(X=G,G=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const le=this.length-_;if((G===void 0||G>le)&&(G=le),m.length>0&&(G<0||_<0)||_>this.length)throw new RangeError("Attempt to write outside buffer bounds");X||(X="utf8");let ge=!1;for(;;)switch(X){case"hex":return T(this,m,_,G);case"utf8":case"utf-8":return N(this,m,_,G);case"ascii":case"latin1":case"binary":return S(this,m,_,G);case"base64":return E(this,m,_,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,m,_,G);default:if(ge)throw new TypeError("Unknown encoding: "+X);X=(""+X).toLowerCase(),ge=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(C,m,_){return m===0&&_===C.length?t.fromByteArray(C):t.fromByteArray(C.slice(m,_))}function O(C,m,_){_=Math.min(C.length,_);const G=[];let X=m;for(;X<_;){const le=C[X];let ge=null,Oe=le>239?4:le>223?3:le>191?2:1;if(X+Oe<=_){let Le,Re,Ne,$e;switch(Oe){case 1:le<128&&(ge=le);break;case 2:Le=C[X+1],(Le&192)===128&&($e=(le&31)<<6|Le&63,$e>127&&(ge=$e));break;case 3:Le=C[X+1],Re=C[X+2],(Le&192)===128&&(Re&192)===128&&($e=(le&15)<<12|(Le&63)<<6|Re&63,$e>2047&&($e<55296||$e>57343)&&(ge=$e));break;case 4:Le=C[X+1],Re=C[X+2],Ne=C[X+3],(Le&192)===128&&(Re&192)===128&&(Ne&192)===128&&($e=(le&15)<<18|(Le&63)<<12|(Re&63)<<6|Ne&63,$e>65535&&$e<1114112&&(ge=$e))}}ge===null?(ge=65533,Oe=1):ge>65535&&(ge-=65536,G.push(ge>>>10&1023|55296),ge=56320|ge&1023),G.push(ge),X+=Oe}return L(G)}const I=4096;function L(C){const m=C.length;if(m<=I)return String.fromCharCode.apply(String,C);let _="",G=0;for(;G<m;)_+=String.fromCharCode.apply(String,C.slice(G,G+=I));return _}function H(C,m,_){let G="";_=Math.min(C.length,_);for(let X=m;X<_;++X)G+=String.fromCharCode(C[X]&127);return G}function V(C,m,_){let G="";_=Math.min(C.length,_);for(let X=m;X<_;++X)G+=String.fromCharCode(C[X]);return G}function D(C,m,_){const G=C.length;(!m||m<0)&&(m=0),(!_||_<0||_>G)&&(_=G);let X="";for(let le=m;le<_;++le)X+=ce[C[le]];return X}function j(C,m,_){const G=C.slice(m,_);let X="";for(let le=0;le<G.length-1;le+=2)X+=String.fromCharCode(G[le]+G[le+1]*256);return X}u.prototype.slice=function(m,_){const G=this.length;m=~~m,_=_===void 0?G:~~_,m<0?(m+=G,m<0&&(m=0)):m>G&&(m=G),_<0?(_+=G,_<0&&(_=0)):_>G&&(_=G),_<m&&(_=m);const X=this.subarray(m,_);return Object.setPrototypeOf(X,u.prototype),X};function $(C,m,_){if(C%1!==0||C<0)throw new RangeError("offset is not uint");if(C+m>_)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(m,_,G){m=m>>>0,_=_>>>0,G||$(m,_,this.length);let X=this[m],le=1,ge=0;for(;++ge<_&&(le*=256);)X+=this[m+ge]*le;return X},u.prototype.readUintBE=u.prototype.readUIntBE=function(m,_,G){m=m>>>0,_=_>>>0,G||$(m,_,this.length);let X=this[m+--_],le=1;for(;_>0&&(le*=256);)X+=this[m+--_]*le;return X},u.prototype.readUint8=u.prototype.readUInt8=function(m,_){return m=m>>>0,_||$(m,1,this.length),this[m]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(m,_){return m=m>>>0,_||$(m,2,this.length),this[m]|this[m+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(m,_){return m=m>>>0,_||$(m,2,this.length),this[m]<<8|this[m+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(m,_){return m=m>>>0,_||$(m,4,this.length),(this[m]|this[m+1]<<8|this[m+2]<<16)+this[m+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(m,_){return m=m>>>0,_||$(m,4,this.length),this[m]*16777216+(this[m+1]<<16|this[m+2]<<8|this[m+3])},u.prototype.readBigUInt64LE=me(function(m){m=m>>>0,ne(m,"offset");const _=this[m],G=this[m+7];(_===void 0||G===void 0)&&se(m,this.length-8);const X=_+this[++m]*2**8+this[++m]*2**16+this[++m]*2**24,le=this[++m]+this[++m]*2**8+this[++m]*2**16+G*2**24;return BigInt(X)+(BigInt(le)<<BigInt(32))}),u.prototype.readBigUInt64BE=me(function(m){m=m>>>0,ne(m,"offset");const _=this[m],G=this[m+7];(_===void 0||G===void 0)&&se(m,this.length-8);const X=_*2**24+this[++m]*2**16+this[++m]*2**8+this[++m],le=this[++m]*2**24+this[++m]*2**16+this[++m]*2**8+G;return(BigInt(X)<<BigInt(32))+BigInt(le)}),u.prototype.readIntLE=function(m,_,G){m=m>>>0,_=_>>>0,G||$(m,_,this.length);let X=this[m],le=1,ge=0;for(;++ge<_&&(le*=256);)X+=this[m+ge]*le;return le*=128,X>=le&&(X-=Math.pow(2,8*_)),X},u.prototype.readIntBE=function(m,_,G){m=m>>>0,_=_>>>0,G||$(m,_,this.length);let X=_,le=1,ge=this[m+--X];for(;X>0&&(le*=256);)ge+=this[m+--X]*le;return le*=128,ge>=le&&(ge-=Math.pow(2,8*_)),ge},u.prototype.readInt8=function(m,_){return m=m>>>0,_||$(m,1,this.length),this[m]&128?(255-this[m]+1)*-1:this[m]},u.prototype.readInt16LE=function(m,_){m=m>>>0,_||$(m,2,this.length);const G=this[m]|this[m+1]<<8;return G&32768?G|4294901760:G},u.prototype.readInt16BE=function(m,_){m=m>>>0,_||$(m,2,this.length);const G=this[m+1]|this[m]<<8;return G&32768?G|4294901760:G},u.prototype.readInt32LE=function(m,_){return m=m>>>0,_||$(m,4,this.length),this[m]|this[m+1]<<8|this[m+2]<<16|this[m+3]<<24},u.prototype.readInt32BE=function(m,_){return m=m>>>0,_||$(m,4,this.length),this[m]<<24|this[m+1]<<16|this[m+2]<<8|this[m+3]},u.prototype.readBigInt64LE=me(function(m){m=m>>>0,ne(m,"offset");const _=this[m],G=this[m+7];(_===void 0||G===void 0)&&se(m,this.length-8);const X=this[m+4]+this[m+5]*2**8+this[m+6]*2**16+(G<<24);return(BigInt(X)<<BigInt(32))+BigInt(_+this[++m]*2**8+this[++m]*2**16+this[++m]*2**24)}),u.prototype.readBigInt64BE=me(function(m){m=m>>>0,ne(m,"offset");const _=this[m],G=this[m+7];(_===void 0||G===void 0)&&se(m,this.length-8);const X=(_<<24)+this[++m]*2**16+this[++m]*2**8+this[++m];return(BigInt(X)<<BigInt(32))+BigInt(this[++m]*2**24+this[++m]*2**16+this[++m]*2**8+G)}),u.prototype.readFloatLE=function(m,_){return m=m>>>0,_||$(m,4,this.length),r.read(this,m,!0,23,4)},u.prototype.readFloatBE=function(m,_){return m=m>>>0,_||$(m,4,this.length),r.read(this,m,!1,23,4)},u.prototype.readDoubleLE=function(m,_){return m=m>>>0,_||$(m,8,this.length),r.read(this,m,!0,52,8)},u.prototype.readDoubleBE=function(m,_){return m=m>>>0,_||$(m,8,this.length),r.read(this,m,!1,52,8)};function F(C,m,_,G,X,le){if(!u.isBuffer(C))throw new TypeError('"buffer" argument must be a Buffer instance');if(m>X||m<le)throw new RangeError('"value" argument is out of bounds');if(_+G>C.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(m,_,G,X){if(m=+m,_=_>>>0,G=G>>>0,!X){const Oe=Math.pow(2,8*G)-1;F(this,m,_,G,Oe,0)}let le=1,ge=0;for(this[_]=m&255;++ge<G&&(le*=256);)this[_+ge]=m/le&255;return _+G},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(m,_,G,X){if(m=+m,_=_>>>0,G=G>>>0,!X){const Oe=Math.pow(2,8*G)-1;F(this,m,_,G,Oe,0)}let le=G-1,ge=1;for(this[_+le]=m&255;--le>=0&&(ge*=256);)this[_+le]=m/ge&255;return _+G},u.prototype.writeUint8=u.prototype.writeUInt8=function(m,_,G){return m=+m,_=_>>>0,G||F(this,m,_,1,255,0),this[_]=m&255,_+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(m,_,G){return m=+m,_=_>>>0,G||F(this,m,_,2,65535,0),this[_]=m&255,this[_+1]=m>>>8,_+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(m,_,G){return m=+m,_=_>>>0,G||F(this,m,_,2,65535,0),this[_]=m>>>8,this[_+1]=m&255,_+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(m,_,G){return m=+m,_=_>>>0,G||F(this,m,_,4,4294967295,0),this[_+3]=m>>>24,this[_+2]=m>>>16,this[_+1]=m>>>8,this[_]=m&255,_+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(m,_,G){return m=+m,_=_>>>0,G||F(this,m,_,4,4294967295,0),this[_]=m>>>24,this[_+1]=m>>>16,this[_+2]=m>>>8,this[_+3]=m&255,_+4};function M(C,m,_,G,X){W(m,G,X,C,_,7);let le=Number(m&BigInt(4294967295));C[_++]=le,le=le>>8,C[_++]=le,le=le>>8,C[_++]=le,le=le>>8,C[_++]=le;let ge=Number(m>>BigInt(32)&BigInt(4294967295));return C[_++]=ge,ge=ge>>8,C[_++]=ge,ge=ge>>8,C[_++]=ge,ge=ge>>8,C[_++]=ge,_}function ee(C,m,_,G,X){W(m,G,X,C,_,7);let le=Number(m&BigInt(4294967295));C[_+7]=le,le=le>>8,C[_+6]=le,le=le>>8,C[_+5]=le,le=le>>8,C[_+4]=le;let ge=Number(m>>BigInt(32)&BigInt(4294967295));return C[_+3]=ge,ge=ge>>8,C[_+2]=ge,ge=ge>>8,C[_+1]=ge,ge=ge>>8,C[_]=ge,_+8}u.prototype.writeBigUInt64LE=me(function(m,_=0){return M(this,m,_,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=me(function(m,_=0){return ee(this,m,_,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(m,_,G,X){if(m=+m,_=_>>>0,!X){const Le=Math.pow(2,8*G-1);F(this,m,_,G,Le-1,-Le)}let le=0,ge=1,Oe=0;for(this[_]=m&255;++le<G&&(ge*=256);)m<0&&Oe===0&&this[_+le-1]!==0&&(Oe=1),this[_+le]=(m/ge>>0)-Oe&255;return _+G},u.prototype.writeIntBE=function(m,_,G,X){if(m=+m,_=_>>>0,!X){const Le=Math.pow(2,8*G-1);F(this,m,_,G,Le-1,-Le)}let le=G-1,ge=1,Oe=0;for(this[_+le]=m&255;--le>=0&&(ge*=256);)m<0&&Oe===0&&this[_+le+1]!==0&&(Oe=1),this[_+le]=(m/ge>>0)-Oe&255;return _+G},u.prototype.writeInt8=function(m,_,G){return m=+m,_=_>>>0,G||F(this,m,_,1,127,-128),m<0&&(m=255+m+1),this[_]=m&255,_+1},u.prototype.writeInt16LE=function(m,_,G){return m=+m,_=_>>>0,G||F(this,m,_,2,32767,-32768),this[_]=m&255,this[_+1]=m>>>8,_+2},u.prototype.writeInt16BE=function(m,_,G){return m=+m,_=_>>>0,G||F(this,m,_,2,32767,-32768),this[_]=m>>>8,this[_+1]=m&255,_+2},u.prototype.writeInt32LE=function(m,_,G){return m=+m,_=_>>>0,G||F(this,m,_,4,2147483647,-2147483648),this[_]=m&255,this[_+1]=m>>>8,this[_+2]=m>>>16,this[_+3]=m>>>24,_+4},u.prototype.writeInt32BE=function(m,_,G){return m=+m,_=_>>>0,G||F(this,m,_,4,2147483647,-2147483648),m<0&&(m=4294967295+m+1),this[_]=m>>>24,this[_+1]=m>>>16,this[_+2]=m>>>8,this[_+3]=m&255,_+4},u.prototype.writeBigInt64LE=me(function(m,_=0){return M(this,m,_,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=me(function(m,_=0){return ee(this,m,_,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function de(C,m,_,G,X,le){if(_+G>C.length)throw new RangeError("Index out of range");if(_<0)throw new RangeError("Index out of range")}function Q(C,m,_,G,X){return m=+m,_=_>>>0,X||de(C,m,_,4),r.write(C,m,_,G,23,4),_+4}u.prototype.writeFloatLE=function(m,_,G){return Q(this,m,_,!0,G)},u.prototype.writeFloatBE=function(m,_,G){return Q(this,m,_,!1,G)};function ae(C,m,_,G,X){return m=+m,_=_>>>0,X||de(C,m,_,8),r.write(C,m,_,G,52,8),_+8}u.prototype.writeDoubleLE=function(m,_,G){return ae(this,m,_,!0,G)},u.prototype.writeDoubleBE=function(m,_,G){return ae(this,m,_,!1,G)},u.prototype.copy=function(m,_,G,X){if(!u.isBuffer(m))throw new TypeError("argument should be a Buffer");if(G||(G=0),!X&&X!==0&&(X=this.length),_>=m.length&&(_=m.length),_||(_=0),X>0&&X<G&&(X=G),X===G||m.length===0||this.length===0)return 0;if(_<0)throw new RangeError("targetStart out of bounds");if(G<0||G>=this.length)throw new RangeError("Index out of range");if(X<0)throw new RangeError("sourceEnd out of bounds");X>this.length&&(X=this.length),m.length-_<X-G&&(X=m.length-_+G);const le=X-G;return this===m&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(_,G,X):Uint8Array.prototype.set.call(m,this.subarray(G,X),_),le},u.prototype.fill=function(m,_,G,X){if(typeof m=="string"){if(typeof _=="string"?(X=_,_=0,G=this.length):typeof G=="string"&&(X=G,G=this.length),X!==void 0&&typeof X!="string")throw new TypeError("encoding must be a string");if(typeof X=="string"&&!u.isEncoding(X))throw new TypeError("Unknown encoding: "+X);if(m.length===1){const ge=m.charCodeAt(0);(X==="utf8"&&ge<128||X==="latin1")&&(m=ge)}}else typeof m=="number"?m=m&255:typeof m=="boolean"&&(m=Number(m));if(_<0||this.length<_||this.length<G)throw new RangeError("Out of range index");if(G<=_)return this;_=_>>>0,G=G===void 0?this.length:G>>>0,m||(m=0);let le;if(typeof m=="number")for(le=_;le<G;++le)this[le]=m;else{const ge=u.isBuffer(m)?m:u.from(m,X),Oe=ge.length;if(Oe===0)throw new TypeError('The value "'+m+'" is invalid for argument "value"');for(le=0;le<G-_;++le)this[le+_]=ge[le%Oe]}return this};const Z={};function te(C,m,_){Z[C]=class extends _{constructor(){super(),Object.defineProperty(this,"message",{value:m.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${C}]`,this.stack,delete this.name}get code(){return C}set code(X){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:X,writable:!0})}toString(){return`${this.name} [${C}]: ${this.message}`}}}te("ERR_BUFFER_OUT_OF_BOUNDS",function(C){return C?`${C} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),te("ERR_INVALID_ARG_TYPE",function(C,m){return`The "${C}" argument must be of type number. Received type ${typeof m}`},TypeError),te("ERR_OUT_OF_RANGE",function(C,m,_){let G=`The value of "${C}" is out of range.`,X=_;return Number.isInteger(_)&&Math.abs(_)>2**32?X=re(String(_)):typeof _=="bigint"&&(X=String(_),(_>BigInt(2)**BigInt(32)||_<-(BigInt(2)**BigInt(32)))&&(X=re(X)),X+="n"),G+=` It must be ${m}. Received ${X}`,G},RangeError);function re(C){let m="",_=C.length;const G=C[0]==="-"?1:0;for(;_>=G+4;_-=3)m=`_${C.slice(_-3,_)}${m}`;return`${C.slice(0,_)}${m}`}function K(C,m,_){ne(m,"offset"),(C[m]===void 0||C[m+_]===void 0)&&se(m,C.length-(_+1))}function W(C,m,_,G,X,le){if(C>_||C<m){const ge=typeof m=="bigint"?"n":"";let Oe;throw m===0||m===BigInt(0)?Oe=`>= 0${ge} and < 2${ge} ** ${(le+1)*8}${ge}`:Oe=`>= -(2${ge} ** ${(le+1)*8-1}${ge}) and < 2 ** ${(le+1)*8-1}${ge}`,new Z.ERR_OUT_OF_RANGE("value",Oe,C)}K(G,X,le)}function ne(C,m){if(typeof C!="number")throw new Z.ERR_INVALID_ARG_TYPE(m,"number",C)}function se(C,m,_){throw Math.floor(C)!==C?(ne(C,_),new Z.ERR_OUT_OF_RANGE("offset","an integer",C)):m<0?new Z.ERR_BUFFER_OUT_OF_BOUNDS:new Z.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${m}`,C)}const U=/[^+/0-9A-Za-z-_]/g;function J(C){if(C=C.split("=")[0],C=C.trim().replace(U,""),C.length<2)return"";for(;C.length%4!==0;)C=C+"=";return C}function z(C,m){m=m||1/0;let _;const G=C.length;let X=null;const le=[];for(let ge=0;ge<G;++ge){if(_=C.charCodeAt(ge),_>55295&&_<57344){if(!X){if(_>56319){(m-=3)>-1&&le.push(239,191,189);continue}else if(ge+1===G){(m-=3)>-1&&le.push(239,191,189);continue}X=_;continue}if(_<56320){(m-=3)>-1&&le.push(239,191,189),X=_;continue}_=(X-55296<<10|_-56320)+65536}else X&&(m-=3)>-1&&le.push(239,191,189);if(X=null,_<128){if((m-=1)<0)break;le.push(_)}else if(_<2048){if((m-=2)<0)break;le.push(_>>6|192,_&63|128)}else if(_<65536){if((m-=3)<0)break;le.push(_>>12|224,_>>6&63|128,_&63|128)}else if(_<1114112){if((m-=4)<0)break;le.push(_>>18|240,_>>12&63|128,_>>6&63|128,_&63|128)}else throw new Error("Invalid code point")}return le}function oe(C){const m=[];for(let _=0;_<C.length;++_)m.push(C.charCodeAt(_)&255);return m}function Y(C,m){let _,G,X;const le=[];for(let ge=0;ge<C.length&&!((m-=2)<0);++ge)_=C.charCodeAt(ge),G=_>>8,X=_%256,le.push(X),le.push(G);return le}function he(C){return t.toByteArray(J(C))}function we(C,m,_,G){let X;for(X=0;X<G&&!(X+_>=m.length||X>=C.length);++X)m[X+_]=C[X];return X}function ye(C,m){return C instanceof m||C!=null&&C.constructor!=null&&C.constructor.name!=null&&C.constructor.name===m.name}function ie(C){return C!==C}const ce=function(){const C="0123456789abcdef",m=new Array(256);for(let _=0;_<16;++_){const G=_*16;for(let X=0;X<16;++X)m[G+X]=C[_]+C[X]}return m}();function me(C){return typeof BigInt>"u"?fe:C}function fe(){throw new Error("BigInt not supported")}})(Ar);var ir={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},bn={},to={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"},Io={},Mo={},yu;function Tb(){return yu||(yu=1,function(e){"use strict;";const{Buffer:t}=Ar,r=4294967292,n=4294967293,i=4294967294,s=4294967295,o=[0,1,3,7,15,31,63,127,255,511,1023],u=["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"],l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split(""),a=[];l.forEach(c=>{a.push(c.charCodeAt(0))}),e.utf8={encode(c){const g=[];return c.forEach(h=>{if(h>=0&&h<=127)g.push(h);else if(h<=2047)g.push(192+(h>>6&o[5])),g.push(128+(h&o[6]));else if(h<55296||h>57343&&h<=65535)g.push(224+(h>>12&o[4])),g.push(128+(h>>6&o[6])),g.push(128+(h&o[6]));else if(h>=65536&&h<=1114111){const b=h>>16&o[5];g.push(240+(b>>2)),g.push(128+((b&o[2])<<4)+(h>>12&o[4])),g.push(128+(h>>6&o[6])),g.push(128+(h&o[6]))}else throw new RangeError(`utf8.encode: character out of range: char: ${h}`)}),t.from(g)},decode(c,g){function h(S,E){if((E&192)!==128)return n;const x=((S&o[5])<<6)+(E&o[6]);return x<128?r:x}function b(S,E,x){if((x&192)!==128||(E&192)!==128)return n;const A=((S&o[4])<<12)+((E&o[6])<<6)+(x&o[6]);return A<2048?r:A>=55296&&A<=57343?i:A}function P(S,E,x,A){if((A&192)!==128||(x&192)!==128||(E&192)!==128)return n;const O=(((S&o[3])<<2)+(E>>4&o[2])<<16)+((E&o[4])<<12)+((x&o[6])<<6)+(A&o[6]);return O<65536?r:O>1114111?i:O}let w,y,v,p,B,k;const R=c.length;let T=g?3:0;const N=[];for(;T<R;){y=c[T],w=s;const S=!0;for(;S;){if(y>=0&&y<=127){w=y,k=1;break}if(v=T+1,v<R&&y>=194&&y<=223){w=h(y,c[v]),k=2;break}if(p=T+2,p<R&&y>=224&&y<=239){w=b(y,c[v],c[p]),k=3;break}if(B=T+3,B<R&&y>=240&&y<=244){w=P(y,c[v],c[p],c[B]),k=4;break}break}if(w>1114111){const E=`byte[${T}]`;throw w===s?new RangeError(`utf8.decode: ill-formed UTF8 byte sequence found at: ${E}`):w===n?new RangeError(`utf8.decode: illegal trailing byte found at: ${E}`):w===i?new RangeError(`utf8.decode: code point out of range found at: ${E}`):w===r?new RangeError(`utf8.decode: non-shortest form found at: ${E}`):new RangeError(`utf8.decode: unrecognized error found at: ${E}`)}N.push(w),T+=k}return N}},e.utf16be={encode(c){const g=[];let h,b,P;for(let w=0;w<c.length;w+=1)if(h=c[w],h>=0&&h<=55295||h>=57344&&h<=65535)g.push(h>>8&o[8]),g.push(h&o[8]);else if(h>=65536&&h<=1114111)P=h-65536,b=55296+(P>>10),P=56320+(P&o[10]),g.push(b>>8&o[8]),g.push(b&o[8]),g.push(P>>8&o[8]),g.push(P&o[8]);else throw new RangeError(`utf16be.encode: UTF16BE value out of range: char[${w}]: ${h}`);return t.from(g)},decode(c,g){if(c.length%2>0)throw new RangeError(`utf16be.decode: data length must be even multiple of 2: length: ${c.length}`);const h=[],b=c.length;let P=g?2:0,w=0,y,v,p,B,k,R;for(;P<b;){for(;;){if(p=P+1,p<b){if(k=(c[P]<<8)+c[p],k<55296||k>57343){y=k,v=2;break}if(B=P+3,B<b&&(R=(c[P+2]<<8)+c[B],k<=56319&&R>=56320&&R<=57343)){y=65536+(k-55296<<10)+(R-56320),v=4;break}}throw new RangeError(`utf16be.decode: ill-formed UTF16BE byte sequence found: byte[${P}]`)}h[w++]=y,P+=v}return h}},e.utf16le={encode(c){const g=[];let h,b,P;for(let w=0;w<c.length;w+=1)if(h=c[w],h>=0&&h<=55295||h>=57344&&h<=65535)g.push(h&o[8]),g.push(h>>8&o[8]);else if(h>=65536&&h<=1114111)P=h-65536,b=55296+(P>>10),P=56320+(P&o[10]),g.push(b&o[8]),g.push(b>>8&o[8]),g.push(P&o[8]),g.push(P>>8&o[8]);else throw new RangeError(`utf16le.encode: UTF16LE value out of range: char[${w}]: ${h}`);return t.from(g)},decode(c,g){if(c.length%2>0)throw new RangeError(`utf16le.decode: data length must be even multiple of 2: length: ${c.length}`);const h=[],b=c.length;let P=g?2:0,w=0,y,v,p,B,k,R;for(;P<b;){for(;;){if(p=P+1,p<b){if(k=(c[p]<<8)+c[P],k<55296||k>57343){y=k,v=2;break}if(B=P+3,B<b&&(R=(c[B]<<8)+c[P+2],k<=56319&&R>=56320&&R<=57343)){y=65536+(k-55296<<10)+(R-56320),v=4;break}}throw new RangeError(`utf16le.decode: ill-formed UTF16LE byte sequence found: byte[${P}]`)}h[w++]=y,P+=v}return h}},e.utf32be={encode(c){const g=t.alloc(c.length*4);let h=0;return c.forEach(b=>{if(b>=55296&&b<=57343||b>1114111)throw new RangeError(`utf32be.encode: UTF32BE character code out of range: char[${h/4}]: ${b}`);g[h++]=b>>24&o[8],g[h++]=b>>16&o[8],g[h++]=b>>8&o[8],g[h++]=b&o[8]}),g},decode(c,g){if(c.length%4>0)throw new RangeError(`utf32be.decode: UTF32BE byte length must be even multiple of 4: length: ${c.length}`);const h=[];let b=g?4:0;for(;b<c.length;b+=4){const P=(c[b]<<24)+(c[b+1]<<16)+(c[b+2]<<8)+c[b+3];if(P>=55296&&P<=57343||P>1114111)throw new RangeError(`utf32be.decode: UTF32BE character code out of range: char[${b/4}]: ${P}`);h.push(P)}return h}},e.utf32le={encode(c){const g=t.alloc(c.length*4);let h=0;return c.forEach(b=>{if(b>=55296&&b<=57343||b>1114111)throw new RangeError(`utf32le.encode: UTF32LE character code out of range: char[${h/4}]: ${b}`);g[h++]=b&o[8],g[h++]=b>>8&o[8],g[h++]=b>>16&o[8],g[h++]=b>>24&o[8]}),g},decode(c,g){if(c.length%4>0)throw new RangeError(`utf32be.decode: UTF32LE byte length must be even multiple of 4: length: ${c.length}`);const h=[];let b=g?4:0;for(;b<c.length;b+=4){const P=(c[b+3]<<24)+(c[b+2]<<16)+(c[b+1]<<8)+c[b];if(P>=55296&&P<=57343||P>1114111)throw new RangeError(`utf32le.encode: UTF32LE character code out of range: char[${b/4}]: ${P}`);h.push(P)}return h}},e.uint7={encode(c){const g=t.alloc(c.length);for(let h=0;h<c.length;h+=1){if(c[h]>127)throw new RangeError(`uint7.encode: UINT7 character code out of range: char[${h}]: ${c[h]}`);g[h]=c[h]}return g},decode(c){const g=[];for(let h=0;h<c.length;h+=1){if(c[h]>127)throw new RangeError(`uint7.decode: UINT7 character code out of range: byte[${h}]: ${c[h]}`);g[h]=c[h]}return g}},e.uint8={encode(c){const g=t.alloc(c.length);for(let h=0;h<c.length;h+=1){if(c[h]>255)throw new RangeError(`uint8.encode: UINT8 character code out of range: char[${h}]: ${c[h]}`);g[h]=c[h]}return g},decode(c){const g=[];for(let h=0;h<c.length;h+=1)g[h]=c[h];return g}},e.uint16be={encode(c){const g=t.alloc(c.length*2);let h=0;return c.forEach(b=>{if(b>65535)throw new RangeError(`uint16be.encode: UINT16BE character code out of range: char[${h/2}]: ${b}`);g[h++]=b>>8&o[8],g[h++]=b&o[8]}),g},decode(c){if(c.length%2>0)throw new RangeError(`uint16be.decode: UINT16BE byte length must be even multiple of 2: length: ${c.length}`);const g=[];for(let h=0;h<c.length;h+=2)g.push((c[h]<<8)+c[h+1]);return g}},e.uint16le={encode(c){const g=t.alloc(c.length*2);let h=0;return c.forEach(b=>{if(b>65535)throw new RangeError(`uint16le.encode: UINT16LE character code out of range: char[${h/2}]: ${b}`);g[h++]=b&o[8],g[h++]=b>>8&o[8]}),g},decode(c){if(c.length%2>0)throw new RangeError(`uint16le.decode: UINT16LE byte length must be even multiple of 2: length: ${c.length}`);const g=[];for(let h=0;h<c.length;h+=2)g.push((c[h+1]<<8)+c[h]);return g}},e.uint32be={encode(c){const g=t.alloc(c.length*4);let h=0;return c.forEach(b=>{g[h++]=b>>24&o[8],g[h++]=b>>16&o[8],g[h++]=b>>8&o[8],g[h++]=b&o[8]}),g},decode(c){if(c.length%4>0)throw new RangeError(`uint32be.decode: UINT32BE byte length must be even multiple of 4: length: ${c.length}`);const g=[];for(let h=0;h<c.length;h+=4)g.push((c[h]<<24)+(c[h+1]<<16)+(c[h+2]<<8)+c[h+3]);return g}},e.uint32le={encode(c){const g=t.alloc(c.length*4);let h=0;return c.forEach(b=>{g[h++]=b&o[8],g[h++]=b>>8&o[8],g[h++]=b>>16&o[8],g[h++]=b>>24&o[8]}),g},decode(c){if(c.length%4>0)throw new RangeError(`uint32le.decode: UINT32LE byte length must be even multiple of 4: length: ${c.length}`);const g=[];for(let h=0;h<c.length;h+=4)g.push((c[h+3]<<24)+(c[h+2]<<16)+(c[h+1]<<8)+c[h]);return g}},e.string={encode(c){return e.utf16le.encode(c).toString("utf16le")},decode(c){return e.utf16le.decode(t.from(c,"utf16le"),0)}},e.escaped={encode(c){const g=[];for(let h=0;h<c.length;h+=1){const b=c[h];if(b===96)g.push(b),g.push(b);else if(b===10)g.push(b);else if(b>=32&&b<=126)g.push(b);else{let P="";if(b>=0&&b<=31)P+=`\`x${u[b]}`;else if(b>=127&&b<=255)P+=`\`x${u[b]}`;else if(b>=256&&b<=65535)P+=`\`u${u[b>>8&o[8]]}${u[b&o[8]]}`;else if(b>=65536&&b<=4294967295){P+="`u{";const y=b>>24&o[8];y>0&&(P+=u[y]),P+=`${u[b>>16&o[8]]+u[b>>8&o[8]]+u[b&o[8]]}}`}else throw new Error("escape.encode(char): char > 0xffffffff not allowed");t.from(P).forEach(y=>{g.push(y)})}}return t.from(g)},decode(c){function g(R){return R>=48&&R<=57||R>=65&&R<=70||R>=97&&R<=102}function h(R,T,N){const S={char:null,nexti:R+2,error:!0};if(R+1<T&&g(N[R])&&g(N[R+1])){const E=String.fromCodePoint(N[R],N[R+1]);S.char=parseInt(E,16),Number.isNaN(S.char)||(S.error=!1)}return S}function b(R,T,N){const S={char:null,nexti:R+4,error:!0};if(R+3<T&&g(N[R])&&g(N[R+1])&&g(N[R+2])&&g(N[R+3])){const E=String.fromCodePoint(N[R],N[R+1],N[R+2],N[R+3]);S.char=parseInt(E,16),Number.isNaN(S.char)||(S.error=!1)}return S}function P(R,T,N){const S={char:null,nexti:R+4,error:!0};let E="";for(;R<T&&g(N[R]);)E+=String.fromCodePoint(N[R]),R+=1;return S.char=parseInt(E,16),N[R]===125&&!Number.isNaN(S.char)&&(S.error=!1),S.nexti=R+1,S}const w=[],y=c.length;let v,p,B,k=0;for(;k<y;){for(;;){if(B=!0,c[k]!==96){w.push(c[k]),k+=1,B=!1;break}if(v=k+1,v>=y)break;if(c[v]===96){w.push(96),k+=2,B=!1;break}if(c[v]===120){if(p=h(v+1,y,c),p.error)break;w.push(p.char),k=p.nexti,B=!1;break}if(c[v]===117){if(c[v+1]===123){if(p=P(v+2,y,c),p.error)break;w.push(p.char),k=p.nexti,B=!1;break}if(p=b(v+1,y,c),p.error)break;w.push(p.char),k=p.nexti,B=!1;break}break}if(B)throw new Error(`escaped.decode: ill-formed escape sequence at buf[${k}]`)}return w}};const f=13,d=10;e.lineEnds={crlf(c){const g=[];let h=0;for(;h<c.length;)switch(c[h]){case f:h+1<c.length&&c[h+1]===d?h+=2:h+=1,g.push(f),g.push(d);break;case d:g.push(f),g.push(d),h+=1;break;default:g.push(c[h]),h+=1;break}return g.length>0&&g[g.length-1]!==d&&(g.push(f),g.push(d)),g},lf(c){const g=[];let h=0;for(;h<c.length;)switch(c[h]){case f:h+1<c.length&&c[h+1]===d?h+=2:h+=1,g.push(d);break;case d:g.push(d),h+=1;break;default:g.push(c[h]),h+=1;break}return g.length>0&&g[g.length-1]!==d&&g.push(d),g}},e.base64={encode(c){if(c.length===0)return t.alloc(0);let g,h,b,P=c.length%3;P=P>0?3-P:0;let w=(c.length+P)/3;const y=t.alloc(w*4);P>0&&(w-=1),g=0,h=0;for(let v=0;v<w;v+=1)b=c[g++]<<16,b+=c[g++]<<8,b+=c[g++],y[h++]=a[b>>18&o[6]],y[h++]=a[b>>12&o[6]],y[h++]=a[b>>6&o[6]],y[h++]=a[b&o[6]];if(P===0)return y;if(P===1)return b=c[g++]<<16,b+=c[g]<<8,y[h++]=a[b>>18&o[6]],y[h++]=a[b>>12&o[6]],y[h++]=a[b>>6&o[6]],y[h]=a[64],y;if(P===2)return b=c[g]<<16,y[h++]=a[b>>18&o[6]],y[h++]=a[b>>12&o[6]],y[h++]=a[64],y[h]=a[64],y},decode(c){function g(k){const R=[];let T=0;for(let N=0;N<k.length;N+=1){const S=k[N],E=!0;for(;E&&!(S===32||S===9||S===10||S===13);){if(S>=65&&S<=90){R.push(S-65);break}if(S>=97&&S<=122){R.push(S-71);break}if(S>=48&&S<=57){R.push(S+4);break}if(S===43){R.push(62);break}if(S===47){R.push(63);break}if(S===61){R.push(64),T+=1;break}throw new RangeError(`base64.decode: invalid character buf[${N}]: ${S}`)}}if(R.length%4>0)throw new RangeError(`base64.decode: string length not integral multiple of 4: ${R.length}`);switch(T){case 0:break;case 1:if(R[R.length-1]!==64)throw new RangeError("base64.decode: one tail character found: not last character");break;case 2:if(R[R.length-1]!==64||R[R.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: ${T}`)}return{tail:T,buf:t.from(R)}}if(c.length===0)return t.alloc(0);const h=g(c),{tail:b}=h,P=h.buf;let w,y,v,p=P.length/4;const B=t.alloc(p*3-b);b>0&&(p-=1),y=0,w=0;for(let k=0;k<p;k+=1)v=P[w++]<<18,v+=P[w++]<<12,v+=P[w++]<<6,v+=P[w++],B[y++]=v>>16&o[8],B[y++]=v>>8&o[8],B[y++]=v&o[8];return b===1&&(v=P[w++]<<18,v+=P[w++]<<12,v+=P[w]<<6,B[y++]=v>>16&o[8],B[y]=v>>8&o[8]),b===2&&(v=P[w++]<<18,v+=P[w++]<<12,B[y]=v>>16&o[8]),B},toString(c){if(c.length%4>0)throw new RangeError(`base64.toString: input buffer length not multiple of 4: ${c.length}`);let g="",h=0;function b(w,y,v,p){switch(h){case 76:g+=`\r
|
|
8
|
-
${w}${y}${v}${p}`,h=4;break;case 75:g+=`${w}\r
|
|
9
|
-
${y}${v}${p}`,h=3;break;case 74:g+=`${w+y}\r
|
|
10
|
-
${v}${p}`,h=2;break;case 73:g+=`${w+y+v}\r
|
|
11
|
-
${p}`,h=1;break;default:g+=w+y+v+p,h+=4;break}}function P(w){return w>=65&&w<=90||w>=97&&w<=122||w>=48&&w<=57||w===43||w===47||w===61}for(let w=0;w<c.length;w+=4){for(let y=w;y<w+4;y+=1)if(!P(c[y]))throw new RangeError(`base64.toString: buf[${y}]: ${c[y]} : not valid base64 character code`);b(String.fromCharCode(c[w]),String.fromCharCode(c[w+1]),String.fromCharCode(c[w+2]),String.fromCharCode(c[w+3]))}return g}}}(Mo)),Mo}var xu;function f0(){return xu||(xu=1,function(e){"use strict;";const{Buffer:t}=Ar,r=Tb(),n="UTF8",i="UTF16",s="UTF16BE",o="UTF16LE",u="UTF32",l="UTF32BE",a="UTF32LE",f="UINT7",d="ASCII",c="BINARY",g="UINT8",h="UINT16",b="UINT16LE",P="UINT16BE",w="UINT32",y="UINT32LE",v="UINT32BE",p="ESCAPED",B="STRING",k=function(I){I.type=n;const L=I.data;I.bom=0,L.length>=3&&L[0]===239&&L[1]===187&&L[2]===191&&(I.bom=3)},R=function(I){const L=I.data;switch(I.bom=0,I.type){case i:I.type=s,L.length>=2&&(L[0]===254&&L[1]===255?I.bom=2:L[0]===255&&L[1]===254&&(I.type=o,I.bom=2));break;case s:if(I.type=s,L.length>=2){if(L[0]===254&&L[1]===255)I.bom=2;else if(L[0]===255&&L[1]===254)throw new TypeError(`src type: "${s}" specified but BOM is for "${o}"`)}break;case o:if(I.type=o,L.length>=0){if(L[0]===254&&L[1]===255)throw new TypeError(`src type: "${o}" specified but BOM is for "${s}"`);L[0]===255&&L[1]===254&&(I.bom=2)}break;default:throw new TypeError(`UTF16 BOM: src type "${I.type}" unrecognized`)}},T=function(I){const L=I.data;switch(I.bom=0,I.type){case u:I.type=l,L.length>=4&&(L[0]===0&&L[1]===0&&L[2]===254&&L[3]===255&&(I.bom=4),L[0]===255&&L[1]===254&&L[2]===0&&L[3]===0&&(I.type=a,I.bom=4));break;case l:if(I.type=l,L.length>=4&&(L[0]===0&&L[1]===0&&L[2]===254&&L[3]===255&&(I.bom=4),L[0]===255&&L[1]===254&&L[2]===0&&L[3]===0))throw new TypeError(`src type: ${l} specified but BOM is for ${a}"`);break;case a:if(I.type=a,L.length>=4){if(L[0]===0&&L[1]===0&&L[2]===254&&L[3]===255)throw new TypeError(`src type: "${a}" specified but BOM is for "${l}"`);L[0]===255&&L[1]===254&&L[2]===0&&L[3]===0&&(I.bom=4)}break;default:throw new TypeError(`UTF32 BOM: src type "${I.type}" unrecognized`)}},N=function(I,L){function H(D){const j={type:"",base64:!1},F=/^(base64:)?([a-zA-Z0-9]+)$/i.exec(D);return F&&(F[2]&&(j.type=F[2].toUpperCase()),F[1]&&(j.base64=!0)),j}const V=H(I.toUpperCase());if(V.base64){if(V.type===B)throw new TypeError(`type: "${I} "BASE64:" prefix not allowed with type ${B}`);if(t.isBuffer(L))V.data=r.base64.decode(L);else if(typeof L=="string"){const D=t.from(L,"ascii");V.data=r.base64.decode(D)}else throw new TypeError(`type: "${I} unrecognized data type: typeof(data): ${typeof L}`)}else V.data=L;switch(V.type){case n:k(V);break;case i:case s:case o:R(V);break;case u:case l:case a:T(V);break;case h:V.type=P;break;case w:V.type=v;break;case d:V.type=f;break;case c:V.type=g;break;case f:case g:case b:case P:case y:case v:case B:case p:break;default:throw new TypeError(`type: "${I}" not recognized`)}if(V.type===B){if(typeof V.data!="string")throw new TypeError(`type: "${I}" but data is not a string`)}else if(!t.isBuffer(V.data))throw new TypeError(`type: "${I}" but data is not a Buffer`);return V},S=function(I,L){function H(D){let j,$;const F={crlf:!1,lf:!1,base64:!1,type:""},M=!0;for(;M;){if($=D,j=D.slice(0,5),j==="CRLF:"){F.crlf=!0,$=D.slice(5);break}if(j=D.slice(0,3),j==="LF:"){F.lf=!0,$=D.slice(3);break}break}return j=$.split(":"),j.length===1?F.type=j[0]:j.length===2&&j[1]==="BASE64"&&(F.base64=!0,F.type=j[0]),F}if(!Array.isArray(L))throw new TypeError(`dst chars: not array: "${typeof L}`);if(typeof I!="string")throw new TypeError(`dst type: not string: "${typeof I}`);const V=H(I.toUpperCase());switch(V.type){case n:case s:case o:case l:case a:case f:case g:case b:case P:case y:case v:case p:break;case B:if(V.base64)throw new TypeError(`":BASE64" suffix not allowed with type ${B}`);break;case d:V.type=f;break;case c:V.type=g;break;case i:V.type=s;break;case u:V.type=l;break;case h:V.type=P;break;case w:V.type=v;break;default:throw new TypeError(`dst type unrecognized: "${I}" : must have form [crlf:|lf:]type[:base64]`)}return V},E=function(I,L){switch(I){case n:return r.utf8.encode(L);case s:return r.utf16be.encode(L);case o:return r.utf16le.encode(L);case l:return r.utf32be.encode(L);case a:return r.utf32le.encode(L);case f:return r.uint7.encode(L);case g:return r.uint8.encode(L);case P:return r.uint16be.encode(L);case b:return r.uint16le.encode(L);case v:return r.uint32be.encode(L);case y:return r.uint32le.encode(L);case B:return r.string.encode(L);case p:return r.escaped.encode(L);default:throw new TypeError(`encode type "${I}" not recognized`)}},x=function(I){switch(I.type){case n:return r.utf8.decode(I.data,I.bom);case o:return r.utf16le.decode(I.data,I.bom);case s:return r.utf16be.decode(I.data,I.bom);case l:return r.utf32be.decode(I.data,I.bom);case a:return r.utf32le.decode(I.data,I.bom);case f:return r.uint7.decode(I.data);case g:return r.uint8.decode(I.data);case P:return r.uint16be.decode(I.data);case b:return r.uint16le.decode(I.data);case v:return r.uint32be.decode(I.data);case y:return r.uint32le.decode(I.data);case B:return r.string.decode(I.data);case p:return r.escaped.decode(I.data);default:throw new TypeError(`decode type "${I.type}" not recognized`)}};e.decode=function(I,L){const H=N(I,L);return x(H)},e.encode=function(I,L){let H,V;const D=S(I,L);return D.crlf?(H=r.lineEnds.crlf(L),V=E(D.type,H)):D.lf?(H=r.lineEnds.lf(L),V=E(D.type,H)):V=E(D.type,L),D.base64&&(V=r.base64.encode(V)),V};const A=function(I,L,H){return e.encode(H,e.decode(I,L))};e.convert=A}(Io)),Io}var d0=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(e){const t=to,r=f0(),n=d0,i=ir,s="utilities.js: ",o=function(l,a,f){let d,c=a;const g=!0;for(;g;){if(l<=0){c=0,d=0;break}if(typeof c!="number"){c=0,d=l;break}if(c>=l){c=l,d=l;break}if(typeof f!="number"){d=l;break}if(d=c+f,d>l){d=l;break}break}return{beg:c,end:d}};e.htmlToPage=function(l,a){let f;if(typeof l!="string")throw new Error(`${s}htmlToPage: input HTML is not a string`);typeof a!="string"?f="htmlToPage":f=a;let d="";return d+=`<!DOCTYPE html>
|
|
226
|
-
`,d+=`<html lang="en">
|
|
227
|
-
`,d+=`<head>
|
|
228
|
-
`,d+=`<meta charset="utf-8">
|
|
229
|
-
`,d+=`<title>${f}</title>
|
|
230
|
-
`,d+=`<style>
|
|
231
|
-
`,d+=n(),d+=`</style>
|
|
232
|
-
`,d+=`</head>
|
|
233
|
-
<body>
|
|
234
|
-
`,d+=`<p>${new Date}</p>
|
|
235
|
-
`,d+=l,d+=`</body>
|
|
236
|
-
</html>
|
|
237
|
-
`,d},e.parserResultToHtml=function(l,a){let f=null;typeof a=="string"&&a!==""&&(f=a);let d,c;l.success===!0?d=`<span class="${t.CLASS_MATCH}">true</span>`:d=`<span class="${t.CLASS_NOMATCH}">false</span>`,l.state===i.EMPTY?c=`<span class="${t.CLASS_EMPTY}">EMPTY</span>`:l.state===i.MATCH?c=`<span class="${t.CLASS_MATCH}">MATCH</span>`:l.state===i.NOMATCH?c=`<span class="${t.CLASS_NOMATCH}">NOMATCH</span>`:c=`<span class="${t.CLASS_NOMATCH}">unrecognized</span>`;let g="";return g+=`<table class="${t.CLASS_STATE}">
|
|
238
|
-
`,f&&(g+=`<caption>${f}</caption>
|
|
239
|
-
`),g+=`<tr><th>state item</th><th>value</th><th>description</th></tr>
|
|
240
|
-
`,g+=`<tr><td>parser success</td><td>${d}</td>
|
|
241
|
-
`,g+=`<td><span class="${t.CLASS_MATCH}">true</span> if the parse succeeded,
|
|
242
|
-
`,g+=` <span class="${t.CLASS_NOMATCH}">false</span> otherwise`,g+=`<br><i>NOTE: for success, entire string must be matched</i></td></tr>
|
|
243
|
-
`,g+=`<tr><td>parser state</td><td>${c}</td>
|
|
244
|
-
`,g+=`<td><span class="${t.CLASS_EMPTY}">EMPTY</span>, `,g+=`<span class="${t.CLASS_MATCH}">MATCH</span> or
|
|
245
|
-
`,g+=`<span class="${t.CLASS_NOMATCH}">NOMATCH</span></td></tr>
|
|
246
|
-
`,g+=`<tr><td>string length</td><td>${l.length}</td><td>length of the input (sub)string</td></tr>
|
|
247
|
-
`,g+=`<tr><td>matched length</td><td>${l.matched}</td><td>number of input string characters matched</td></tr>
|
|
248
|
-
`,g+=`<tr><td>max matched</td><td>${l.maxMatched}</td><td>maximum number of input string characters matched</td></tr>
|
|
249
|
-
`,g+=`<tr><td>max tree depth</td><td>${l.maxTreeDepth}</td><td>maximum depth of the parse tree reached</td></tr>
|
|
250
|
-
`,g+=`<tr><td>node hits</td><td>${l.nodeHits}</td><td>number of parse tree node hits (opcode function calls)</td></tr>
|
|
251
|
-
`,g+=`<tr><td>input length</td><td>${l.inputLength}</td><td>length of full input string</td></tr>
|
|
252
|
-
`,g+=`<tr><td>sub-string begin</td><td>${l.subBegin}</td><td>sub-string first character index</td></tr>
|
|
253
|
-
`,g+=`<tr><td>sub-string end</td><td>${l.subEnd}</td><td>sub-string end-of-string index</td></tr>
|
|
254
|
-
`,g+=`<tr><td>sub-string length</td><td>${l.subLength}</td><td>sub-string length</td></tr>
|
|
255
|
-
`,g+=`</table>
|
|
256
|
-
`,g},e.charsToString=function(l,a,f){let d,c;if(typeof a=="number"){if(a>=l.length)return"";d=a<0?0:a}else d=0;if(typeof f=="number"){if(f<=0)return"";c=f>l.length-d?l.length:d+f}else c=l.length;return d<c?r.encode("UTF16LE",l.slice(d,c)).toString("utf16le"):""},e.stringToChars=function(l){return r.decode("STRING",l)},e.opcodeToString=function(l){let a="unknown";switch(l){case i.ALT:a="ALT";break;case i.CAT:a="CAT";break;case i.RNM:a="RNM";break;case i.UDT:a="UDT";break;case i.AND:a="AND";break;case i.NOT:a="NOT";break;case i.REP:a="REP";break;case i.TRG:a="TRG";break;case i.TBS:a="TBS";break;case i.TLS:a="TLS";break;case i.BKR:a="BKR";break;case i.BKA:a="BKA";break;case i.BKN:a="BKN";break;case i.ABG:a="ABG";break;case i.AEN:a="AEN";break;default:throw new Error("unrecognized opcode")}return a},e.stateToString=function(l){let a="unknown";switch(l){case i.ACTIVE:a="ACTIVE";break;case i.MATCH:a="MATCH";break;case i.EMPTY:a="EMPTY";break;case i.NOMATCH:a="NOMATCH";break;default:throw new Error("unrecognized state")}return a},e.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"," ","!",""","#","$","%","&","'","(",")","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\","]","^","_","`","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"],e.charToHex=function(l){let a=l.toString(16).toUpperCase();switch(a.length){case 1:case 3:case 7:a=`0${a}`;break;case 2:case 6:a=`00${a}`;break;case 4:break;case 5:a=`000${a}`;break;default:throw new Error("unrecognized option")}return a},e.charsToDec=function(l,a,f){let d="";if(!Array.isArray(l))throw new Error(`${s}charsToDec: input must be an array of integers`);const c=o(l.length,a,f);if(c.end>c.beg){d+=l[c.beg];for(let g=c.beg+1;g<c.end;g+=1)d+=`,${l[g]}`}return d},e.charsToHex=function(l,a,f){let d="";if(!Array.isArray(l))throw new Error(`${s}charsToHex: input must be an array of integers`);const c=o(l.length,a,f);if(c.end>c.beg){d+=`\\x${e.charToHex(l[c.beg])}`;for(let g=c.beg+1;g<c.end;g+=1)d+=`,\\x${e.charToHex(l[g])}`}return d},e.charsToHtmlEntities=function(l,a,f){let d="";if(!Array.isArray(l))throw new Error(`${s}charsToHex: input must be an array of integers`);const c=o(l.length,a,f);if(c.end>c.beg)for(let g=c.beg;g<c.end;g+=1)d+=`&#x${l[g].toString(16)};`;return d};function u(l){return!(l>=55296&&l<=57343||l>1114111)}e.charsToUnicode=function(l,a,f){let d="";if(!Array.isArray(l))throw new Error(`${s}charsToUnicode: input must be an array of integers`);const c=o(l.length,a,f);if(c.end>c.beg)for(let g=c.beg;g<c.end;g+=1)u(l[g])?d+=`&#${l[g]};`:d+=` U+${e.charToHex(l[g])}`;return d},e.charsToJsUnicode=function(l,a,f){let d="";if(!Array.isArray(l))throw new Error(`${s}charsToJsUnicode: input must be an array of integers`);const c=o(l.length,a,f);if(c.end>c.beg){d+=`\\u${e.charToHex(l[c.beg])}`;for(let g=c.beg+1;g<c.end;g+=1)d+=`,\\u${e.charToHex(l[g])}`}return d},e.charsToAscii=function(l,a,f){let d="";if(!Array.isArray(l))throw new Error(`${s}charsToAscii: input must be an array of integers`);const c=o(l.length,a,f);for(let g=c.beg;g<c.end;g+=1){const h=l[g];h>=32&&h<=126?d+=String.fromCharCode(h):d+=`\\x${e.charToHex(h)}`}return d},e.charsToAsciiHtml=function(l,a,f){if(!Array.isArray(l))throw new Error(`${s}charsToAsciiHtml: input must be an array of integers`);let d="",c;const g=o(l.length,a,f);for(let h=g.beg;h<g.end;h+=1)c=l[h],c<32||c===127?d+=`<span class="${t.CLASS_CTRLCHAR}">${e.asciiChars[c]}</span>`:c>127?d+=`<span class="${t.CLASS_CTRLCHAR}">U+${e.charToHex(c)}</span>`:d+=e.asciiChars[c];return d},e.stringToAsciiHtml=function(l){const a=r.decode("STRING",l);return this.charsToAsciiHtml(a)}})(bn);var Sb=function(){const t=ir,r=bn,n="ast.js: ",i=this;let s=null,o=null,u=null,l=0;const a=[],f=[],d=[],c=[];this.callbacks=[],this.astObject="astObject",this.init=function(b,P,w){d.length=0,c.length=0,a.length=0,l=0,s=b,o=P,u=w;let y;const v=[];for(y=0;y<s.length;y+=1)v.push(s[y].lower);for(y=0;y<o.length;y+=1)v.push(o[y].lower);for(l=s.length+o.length,y=0;y<l;y+=1)a[y]=!1,f[y]=null;for(const p in i.callbacks){const B=p.toLowerCase();if(y=v.indexOf(B),y<0)throw new Error(`${n}init: node '${p}' not a rule or udt name`);typeof i.callbacks[p]=="function"&&(a[y]=!0,f[y]=i.callbacks[p]),i.callbacks[p]===!0&&(a[y]=!0)}},this.ruleDefined=function(b){return a[b]!==!1},this.udtDefined=function(b){return a[s.length+b]!==!1},this.down=function(b,P){const w=c.length;return d.push(w),c.push({name:P,thisIndex:w,thatIndex:null,state:t.SEM_PRE,callbackIndex:b,phraseIndex:null,phraseLength:null,stack:d.length}),w},this.up=function(b,P,w,y){const v=c.length,p=d.pop();return c.push({name:P,thisIndex:v,thatIndex:p,state:t.SEM_POST,callbackIndex:b,phraseIndex:w,phraseLength:y,stack:d.length}),c[p].thatIndex=v,c[p].phraseIndex=w,c[p].phraseLength=y,v},this.translate=function(b){let P,w,y;for(let v=0;v<c.length;v+=1)y=c[v],w=f[y.callbackIndex],y.state===t.SEM_PRE?w!==null&&(P=w(t.SEM_PRE,u,y.phraseIndex,y.phraseLength,b),P===t.SEM_SKIP&&(v=y.thatIndex)):w!==null&&w(t.SEM_POST,u,y.phraseIndex,y.phraseLength,b)},this.setLength=function(b){c.length=b,b>0?d.length=c[b-1].stack:d.length=0},this.getLength=function(){return c.length};function g(h){let b="";for(let P=0;P<h;P+=1)b+=" ";return b}this.toXml=function(b){let P=r.charsToDec,w="decimal integer character codes";if(typeof b=="string"&&b.length>=3){const p=b.slice(0,3).toLowerCase();p==="asc"?(P=r.charsToAscii,w="ASCII for printing characters, hex for non-printing"):p==="hex"?(P=r.charsToHex,w="hexadecimal integer character codes"):p==="uni"&&(P=r.charsToUnicode,w="Unicode UTF-32 integer character codes")}let y="",v=0;return y+=`<?xml version="1.0" encoding="utf-8"?>
|
|
257
|
-
`,y+=`<root nodes="${c.length/2}" characters="${u.length}">
|
|
258
|
-
`,y+=`<!-- input string, ${w} -->
|
|
259
|
-
`,y+=g(v+2),y+=P(u),y+=`
|
|
260
|
-
`,c.forEach(p=>{p.state===t.SEM_PRE?(v+=1,y+=g(v),y+=`<node name="${p.name}" index="${p.phraseIndex}" length="${p.phraseLength}">
|
|
261
|
-
`,y+=g(v+2),y+=P(u,p.phraseIndex,p.phraseLength),y+=`
|
|
262
|
-
`):(y+=g(v),y+=`</node><!-- name="${p.name}" -->
|
|
263
|
-
`,v-=1)}),y+=`</root>
|
|
264
|
-
`,y},this.phrases=function(){const b={};let P,w;for(P=0;P<c.length;P+=1)w=c[P],w.state===t.SEM_PRE&&(Array.isArray(b[w.name])||(b[w.name]=[]),b[w.name].push({index:w.phraseIndex,length:w.phraseLength}));return b}},h0=function(){"use strict;";const t="circular-buffer.js: ";let r=-1,n=0;this.init=function(s){if(typeof s!="number"||s<=0)throw new Error(`${t}init: circular buffer size must an integer > 0`);n=Math.ceil(s),r=-1},this.increment=function(){return r+=1,(r+n)%n},this.maxSize=function(){return n},this.items=function(){return r+1},this.getListIndex=function(s){return r===-1||s<0||s>r||r-s>=n?-1:(s+n)%n},this.forEach=function(s){if(r!==-1){if(r<n){for(let o=0;o<=r;o+=1)s(o,o);return}for(let o=r-n+1;o<=r;o+=1){const u=(o+n)%n;s(u,o)}}}},Ob=function(){const t=ir,r=bn,n="parser.js: ",i=this;let s;this.ast=null,this.stats=null,this.trace=null,this.callbacks=[];let o=null,u=null,l,a,f,d,c=0,g=0,h=0,b=null,P=null,w=null,y=null,v=null,p=0,B=1/0,k=1/0;const R=function(C,m,_){const G=`${n}evaluateRule(): `;if(C>=w.length)throw new Error(`${G}rule index: ${C} out of range`);if(m>=f)throw new Error(`${G}phrase index: ${m} out of range`);const{length:X}=o;o.push({type:t.RNM,index:C}),s(X,m,_),o.pop()},T=function(fe,C,m){const _=`${n}evaluateUdt(): `;if(fe>=y.length)throw new Error(`${_}udt index: ${fe} out of range`);if(C>=f)throw new Error(`${_}phrase index: ${C} out of range`);const{length:G}=o;o.push({type:t.UDT,empty:y[fe].empty,index:fe}),s(G,C,m),o.pop()},N=function(){c=0,g=0,h=0,p=0,d=[{lookAround:t.LOOKAROUND_NONE,anchor:0,charsEnd:0,charsLength:0}],w=null,y=null,u=null,l=0,a=0,f=0,b=null,P=null,v=null,o=null},S=function(){const fe=[],C=function(){const _={};w.forEach(G=>{G.isBkr&&(_[G.lower]=null)}),y.length>0&&y.forEach(G=>{G.isBkr&&(_[G.lower]=null)}),fe.push(_)},m=function(){const _=fe[fe.length-1],G={};for(const X in _)G[X]=_[X];return G};this.push=function(){fe.push(m())},this.pop=function(G){let X=G;if(X||(X=fe.length-1),X<1||X>fe.length)throw new Error(`${n}backRef.pop(): bad length: ${X}`);return fe.length=X,fe[fe.length-1]},this.length=function(){return fe.length},this.savePhrase=function(G,X,le){fe[fe.length-1][G]={phraseIndex:X,phraseLength:le}},this.getPhrase=function(_){return fe[fe.length-1][_]},C()},E=function(){const C=this;this.state=t.ACTIVE,this.phraseLength=0,this.ruleIndex=0,this.udtIndex=0,this.lookAround=d[d.length-1],this.uFrame=new S,this.pFrame=new S,this.evaluateRule=R,this.evaluateUdt=T,this.refresh=function(){C.state=t.ACTIVE,C.phraseLength=0,C.lookAround=d[d.length-1]}},x=function(){return d[d.length-1]},A=function(){return d.length>1},O=function(){return d[d.length-1].lookAround===t.LOOKAROUND_BEHIND},I=function(){const fe=`${n}initializeAst(): `,C=!0;for(;C;){if(i.ast===void 0){i.ast=null;break}if(i.ast===null)break;if(i.ast.astObject!=="astObject")throw new Error(`${fe}ast object not recognized`);break}i.ast!==null&&i.ast.init(w,y,u)},L=function(){const fe=`${n}initializeTrace(): `,C=!0;for(;C;){if(i.trace===void 0){i.trace=null;break}if(i.trace===null)break;if(i.trace.traceObject!=="traceObject")throw new Error(`${fe}trace object not recognized`);break}i.trace!==null&&i.trace.init(w,y,u)},H=function(){const fe=`${n}initializeStats(): `,C=!0;for(;C;){if(i.stats===void 0){i.stats=null;break}if(i.stats===null)break;if(i.stats.statsObject!=="statsObject")throw new Error(`${fe}stats object not recognized`);break}i.stats!==null&&i.stats.init(w,y)},V=function(fe){const C=`${n}initializeGrammar(): `;if(!fe)throw new Error(`${C}grammar object undefined`);if(fe.grammarObject!=="grammarObject")throw new Error(`${C}bad grammar object`);w=fe.rules,y=fe.udts},D=function(fe){const C=`${n}initializeStartRule(): `;let m=null;if(typeof fe=="number"){if(fe>=w.length)throw new Error(`${C}start rule index too large: max: ${w.length}: index: ${fe}`);m=fe}else if(typeof fe=="string"){const _=fe.toLowerCase();for(let G=0;G<w.length;G+=1)if(_===w[G].lower){m=w[G].index;break}if(m===null)throw new Error(`${C}start rule name '${fe}' not recognized`)}else throw new Error(`${C}type of start rule '${typeof fe}' not recognized`);return m},j=function(C,m,_){const G=`${n}initializeInputChars(): `;let X=C,le=m,ge=_;if(X===void 0)throw new Error(`${G}input string is undefined`);if(X===null)throw new Error(`${G}input string is null`);if(typeof X=="string")X=r.stringToChars(X);else if(!Array.isArray(X))throw new Error(`${G}input string is not a string or array`);if(X.length>0&&typeof X[0]!="number")throw new Error(`${G}input string not an array of integers`);if(typeof le!="number")le=0;else if(le=Math.floor(le),le<0||le>X.length)throw new Error(`${G}input beginning index out of range: ${le}`);if(typeof ge!="number")ge=X.length-le;else if(ge=Math.floor(ge),ge<0||ge>X.length-le)throw new Error(`${G}input length out of range: ${ge}`);u=X,l=le,a=ge,f=l+a},$=function(){const fe=`${n}initializeCallbacks(): `;let C;for(b=[],P=[],C=0;C<w.length;C+=1)b[C]=null;for(C=0;C<y.length;C+=1)P[C]=null;let m;const _=[];for(C=0;C<w.length;C+=1)_.push(w[C].lower);for(C=0;C<y.length;C+=1)_.push(y[C].lower);for(const G in i.callbacks){if(C=_.indexOf(G.toLowerCase()),C<0)throw new Error(`${fe}syntax callback '${G}' not a rule or udt name`);if(m=i.callbacks[G],m||(m=null),typeof m=="function"||m===null)C<w.length?b[C]=m:P[C-w.length]=m;else throw new Error(`${fe}syntax callback[${G}] must be function reference or 'false' (false/null/undefined/etc.)`)}for(C=0;C<y.length;C+=1)if(P[C]===null)throw new Error(`${fe}all UDT callbacks must be defined. UDT callback[${y[C].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(B=Math.floor(fe),B<=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(k=Math.floor(fe),k<=0)throw new Error(`parser: max node hits must be integer > 0: ${fe}`)};const F=function(fe,C,m){let _;const G=`${n}parse(): `;V(fe);const X=D(C);$(),L(),H(),I();const le=new E;switch(m!=null&&(v=m),o=[{type:t.RNM,index:X}],s(0,l,le),o=null,le.state){case t.ACTIVE:throw new Error(`${G}final state should never be 'ACTIVE'`);case t.NOMATCH:_=!1;break;case t.EMPTY:case t.MATCH:le.phraseLength===a?_=!0:_=!1;break;default:throw new Error("unrecognized state")}return{success:_,state:le.state,length:a,matched:le.phraseLength,maxMatched:p,maxTreeDepth:g,nodeHits:h,inputLength:u.length,subBegin:l,subEnd:f,subLength:a}};this.parseSubstring=function(C,m,_,G,X,le){return N(),j(_,G,X),F(C,m,le)},this.parse=function(C,m,_,G){return N(),j(_,0,_.length),F(C,m,G)};const M=function(fe,C,m){const _=o[fe];for(let G=0;G<_.children.length&&(s(_.children[G],C,m),m.state===t.NOMATCH);G+=1);},ee=function(fe,C,m){let _,G,X,le;const ge=o[fe],Oe=m.uFrame.length(),Le=m.pFrame.length();i.ast&&(G=i.ast.getLength()),_=!0,X=C,le=0;for(let Re=0;Re<ge.children.length;Re+=1)if(s(ge.children[Re],X,m),m.state===t.NOMATCH){_=!1;break}else X+=m.phraseLength,le+=m.phraseLength;_?(m.state=le===0?t.EMPTY:t.MATCH,m.phraseLength=le):(m.state=t.NOMATCH,m.phraseLength=0,m.uFrame.pop(Oe),m.pFrame.pop(Le),i.ast&&i.ast.setLength(G))},de=function(fe,C,m){let _,G,X,le;const ge=o[fe];if(ge.max===0){m.state=t.EMPTY,m.phraseLength=0;return}G=C,X=0,le=0;const Oe=m.uFrame.length(),Le=m.pFrame.length();i.ast&&(_=i.ast.getLength());const Re=!0;for(;Re&&!(G>=f||(s(fe+1,G,m),m.state===t.NOMATCH)||m.state===t.EMPTY||(le+=1,X+=m.phraseLength,G+=m.phraseLength,le===ge.max)););m.state===t.EMPTY||le>=ge.min?(m.state=X===0?t.EMPTY:t.MATCH,m.phraseLength=X):(m.state=t.NOMATCH,m.phraseLength=0,m.uFrame.pop(Oe),m.pFrame.pop(Le),i.ast&&i.ast.setLength(_))},Q=function(fe,C,m,_){if(C.phraseLength>m){let G=`${n}opRNM(${fe.name}): callback function error: `;throw G+=`sysData.phraseLength: ${C.phraseLength}`,G+=` must be <= remaining chars: ${m}`,new Error(G)}switch(C.state){case t.ACTIVE:if(_!==!0)throw new Error(`${n}opRNM(${fe.name}): callback function return error. ACTIVE state not allowed.`);break;case t.EMPTY:C.phraseLength=0;break;case t.MATCH:C.phraseLength===0&&(C.state=t.EMPTY);break;case t.NOMATCH:C.phraseLength=0;break;default:throw new Error(`${n}opRNM(${fe.name}): callback function return error. Unrecognized return state: ${C.state}`)}},ae=function(fe,C,m){let _,G,X,le,ge,Oe;const Le=o[fe],Re=w[Le.index],Ne=b[Re.index],$e=!A();if($e&&(G=i.ast&&i.ast.ruleDefined(Le.index),G&&(_=i.ast.getLength(),i.ast.down(Le.index,w[Le.index].name)),le=m.uFrame.length(),ge=m.pFrame.length(),m.uFrame.push(),m.pFrame.push(),Oe=m.pFrame,m.pFrame=new S),Ne===null)X=o,o=Re.opcodes,s(0,C,m),o=X;else{const _r=f-C;m.ruleIndex=Re.index,Ne(m,u,C,v),Q(Re,m,_r,!0),m.state===t.ACTIVE&&(X=o,o=Re.opcodes,s(0,C,m),o=X,m.ruleIndex=Re.index,Ne(m,u,C,v),Q(Re,m,_r,!1))}$e&&(G&&(m.state===t.NOMATCH?i.ast.setLength(_):i.ast.up(Le.index,Re.name,C,m.phraseLength)),m.pFrame=Oe,m.state===t.NOMATCH?(m.uFrame.pop(le),m.pFrame.pop(ge)):Re.isBkr&&(m.pFrame.savePhrase(Re.lower,C,m.phraseLength),m.uFrame.savePhrase(Re.lower,C,m.phraseLength)))},Z=function(fe,C,m){if(C.phraseLength>m){let _=`${n}opUDT(${fe.name}): callback function error: `;throw _+=`sysData.phraseLength: ${C.phraseLength}`,_+=` must be <= remaining chars: ${m}`,new Error(_)}switch(C.state){case t.ACTIVE:throw new Error(`${n}opUDT(${fe.name}): callback function return error. ACTIVE state not allowed.`);case t.EMPTY:if(fe.empty===!1)throw new Error(`${n}opUDT(${fe.name}): callback function return error. May not return EMPTY.`);C.phraseLength=0;break;case t.MATCH:if(C.phraseLength===0){if(fe.empty===!1)throw new Error(`${n}opUDT(${fe.name}): callback function return error. May not return EMPTY.`);C.state=t.EMPTY}break;case t.NOMATCH:C.phraseLength=0;break;default:throw new Error(`${n}opUDT(${fe.name}): callback function return error. Unrecognized return state: ${C.state}`)}},te=function(fe,C,m){let _,G,X,le,ge,Oe;const Le=o[fe],Re=y[Le.index];m.UdtIndex=Re.index;const Ne=!A();Ne&&(X=i.ast&&i.ast.udtDefined(Le.index),X&&(G=w.length+Le.index,_=i.ast.getLength(),i.ast.down(G,Re.name)),le=m.uFrame.length(),ge=m.pFrame.length(),m.uFrame.push(),m.pFrame.push(),Oe=m.pFrame,m.pFrame=new S);const $e=f-C;P[Le.index](m,u,C,v),Z(Re,m,$e),Ne&&(X&&(m.state===t.NOMATCH?i.ast.setLength(_):i.ast.up(G,Re.name,C,m.phraseLength)),m.pFrame=Oe,m.state===t.NOMATCH?(m.uFrame.pop(le),m.pFrame.pop(ge)):Re.isBkr&&(m.pFrame.savePhrase(Re.lower,C,m.phraseLength),m.uFrame.savePhrase(Re.lower,C,m.phraseLength)))},re=function(fe,C,m){d.push({lookAround:t.LOOKAROUND_AHEAD,anchor:C,charsEnd:f,charsLength:a}),f=u.length,a=u.length-l,s(fe+1,C,m);const _=d.pop();switch(f=_.charsEnd,a=_.charsLength,m.phraseLength=0,m.state){case t.EMPTY:m.state=t.EMPTY;break;case t.MATCH:m.state=t.EMPTY;break;case t.NOMATCH:m.state=t.NOMATCH;break;default:throw new Error(`opAND: invalid state ${m.state}`)}},K=function(fe,C,m){d.push({lookAround:t.LOOKAROUND_AHEAD,anchor:C,charsEnd:f,charsLength:a}),f=u.length,a=u.length-l,s(fe+1,C,m);const _=d.pop();switch(f=_.charsEnd,a=_.charsLength,m.phraseLength=0,m.state){case t.EMPTY:case t.MATCH:m.state=t.NOMATCH;break;case t.NOMATCH:m.state=t.EMPTY;break;default:throw new Error(`opNOT: invalid state ${m.state}`)}},W=function(fe,C,m){const _=o[fe];m.state=t.NOMATCH,C<f&&_.min<=u[C]&&u[C]<=_.max&&(m.state=t.MATCH,m.phraseLength=1)},ne=function(fe,C,m){let _;const G=o[fe],X=G.string.length;if(m.state=t.NOMATCH,C+X<=f){for(_=0;_<X;_+=1)if(u[C+_]!==G.string[_])return;m.state=t.MATCH,m.phraseLength=X}},se=function(fe,C,m){let _,G;const X=o[fe];m.state=t.NOMATCH;const le=X.string.length;if(le===0){m.state=t.EMPTY;return}if(C+le<=f){for(_=0;_<le;_+=1)if(G=u[C+_],G>=65&&G<=90&&(G+=32),G!==X.string[_])return;m.state=t.MATCH,m.phraseLength=le}},U=function(fe,C,m){m.state=t.NOMATCH,m.phraseLength=0,m.state=C===0?t.EMPTY:t.NOMATCH},J=function(fe,C,m){m.state=t.NOMATCH,m.phraseLength=0,m.state=C===u.length?t.EMPTY:t.NOMATCH},z=function(fe,C,m){let _,G,X,le;const ge=o[fe];m.state=t.NOMATCH,ge.index<w.length?le=w[ge.index].lower:le=y[ge.index-w.length].lower;const Oe=ge.bkrMode===t.BKR_MODE_PM?m.pFrame.getPhrase(le):m.uFrame.getPhrase(le),Le=ge.bkrCase===t.BKR_MODE_CI;if(Oe===null)return;const Re=Oe.phraseIndex,Ne=Oe.phraseLength;if(Ne===0){m.state=t.EMPTY;return}if(C+Ne<=f){if(Le){for(_=0;_<Ne;_+=1)if(G=u[C+_],X=u[Re+_],G>=65&&G<=90&&(G+=32),X>=65&&X<=90&&(X+=32),G!==X)return;m.state=t.MATCH,m.phraseLength=Ne}else for(_=0;_<Ne;_+=1)if(G=u[C+_],X=u[Re+_],G!==X)return;m.state=t.MATCH,m.phraseLength=Ne}},oe=function(fe,C,m){switch(d.push({lookAround:t.LOOKAROUND_BEHIND,anchor:C}),s(fe+1,C,m),d.pop(),m.phraseLength=0,m.state){case t.EMPTY:m.state=t.EMPTY;break;case t.MATCH:m.state=t.EMPTY;break;case t.NOMATCH:m.state=t.NOMATCH;break;default:throw new Error(`opBKA: invalid state ${m.state}`)}},Y=function(fe,C,m){switch(d.push({lookAround:t.LOOKAROUND_BEHIND,anchor:C}),s(fe+1,C,m),d.pop(),m.phraseLength=0,m.state){case t.EMPTY:case t.MATCH:m.state=t.NOMATCH;break;case t.NOMATCH:m.state=t.EMPTY;break;default:throw new Error(`opBKN: invalid state ${m.state}`)}},he=function(fe,C,m){let _,G,X,le;const ge=o[fe],Oe=m.uFrame.length(),Le=m.pFrame.length();i.ast&&(G=i.ast.getLength()),_=!0,X=C,le=0;for(let Re=ge.children.length-1;Re>=0;Re-=1)if(s(ge.children[Re],X,m),X-=m.phraseLength,le+=m.phraseLength,m.state===t.NOMATCH){_=!1;break}_?(m.state=le===0?t.EMPTY:t.MATCH,m.phraseLength=le):(m.state=t.NOMATCH,m.phraseLength=0,m.uFrame.pop(Oe),m.pFrame.pop(Le),i.ast&&i.ast.setLength(G))},we=function(fe,C,m){let _,G,X,le;const ge=o[fe];G=C,X=0,le=0;const Oe=m.uFrame.length(),Le=m.pFrame.length();i.ast&&(_=i.ast.getLength());const Re=!0;for(;Re&&!(G<=0||(s(fe+1,G,m),m.state===t.NOMATCH)||m.state===t.EMPTY||(le+=1,X+=m.phraseLength,G-=m.phraseLength,le===ge.max)););m.state===t.EMPTY||le>=ge.min?(m.state=X===0?t.EMPTY:t.MATCH,m.phraseLength=X):(m.state=t.NOMATCH,m.phraseLength=0,m.uFrame.pop(Oe),m.pFrame.pop(Le),i.ast&&i.ast.setLength(_))},ye=function(fe,C,m){const _=o[fe];if(m.state=t.NOMATCH,m.phraseLength=0,C>0){const G=u[C-1];_.min<=G&&G<=_.max&&(m.state=t.MATCH,m.phraseLength=1)}},ie=function(fe,C,m){let _;const G=o[fe];m.state=t.NOMATCH;const X=G.string.length,le=C-X;if(le>=0){for(_=0;_<X;_+=1)if(u[le+_]!==G.string[_])return;m.state=t.MATCH,m.phraseLength=X}},ce=function(fe,C,m){let _;const G=o[fe];m.state=t.NOMATCH;const X=G.string.length;if(X===0){m.state=t.EMPTY;return}const le=C-X;if(le>=0){for(let ge=0;ge<X;ge+=1)if(_=u[le+ge],_>=65&&_<=90&&(_+=32),_!==G.string[ge])return;m.state=t.MATCH,m.phraseLength=X}},me=function(fe,C,m){let _,G,X,le;const ge=o[fe];m.state=t.NOMATCH,m.phraseLength=0,ge.index<w.length?le=w[ge.index].lower:le=y[ge.index-w.length].lower;const Oe=ge.bkrMode===t.BKR_MODE_PM?m.pFrame.getPhrase(le):m.uFrame.getPhrase(le),Le=ge.bkrCase===t.BKR_MODE_CI;if(Oe===null)return;const Re=Oe.phraseIndex,Ne=Oe.phraseLength;if(Ne===0){m.state=t.EMPTY,m.phraseLength=0;return}const $e=C-Ne;if($e>=0){if(Le){for(_=0;_<Ne;_+=1)if(G=u[$e+_],X=u[Re+_],G>=65&&G<=90&&(G+=32),X>=65&&X<=90&&(X+=32),G!==X)return;m.state=t.MATCH,m.phraseLength=Ne}else for(_=0;_<Ne;_+=1)if(G=u[$e+_],X=u[Re+_],G!==X)return;m.state=t.MATCH,m.phraseLength=Ne}};s=function(C,m,_){let G=!0;const X=o[C];if(h+=1,h>k)throw new Error(`parser: maximum number of node hits exceeded: ${k}`);if(c+=1,c>g&&(g=c,g>B))throw new Error(`parser: maximum parse tree depth exceeded: ${B}`);if(_.refresh(),i.trace!==null){const le=x();i.trace.down(X,_.state,m,_.phraseLength,le.anchor,le.lookAround)}if(O())switch(X.type){case t.ALT:M(C,m,_);break;case t.CAT:he(C,m,_);break;case t.REP:we(C,m,_);break;case t.RNM:ae(C,m,_);break;case t.UDT:te(C,m,_);break;case t.AND:re(C,m,_);break;case t.NOT:K(C,m,_);break;case t.TRG:ye(C,m,_);break;case t.TBS:ie(C,m,_);break;case t.TLS:ce(C,m,_);break;case t.BKR:me(C,m,_);break;case t.BKA:oe(C,m,_);break;case t.BKN:Y(C,m,_);break;case t.ABG:U(C,m,_);break;case t.AEN:J(C,m,_);break;default:G=!1;break}else switch(X.type){case t.ALT:M(C,m,_);break;case t.CAT:ee(C,m,_);break;case t.REP:de(C,m,_);break;case t.RNM:ae(C,m,_);break;case t.UDT:te(C,m,_);break;case t.AND:re(C,m,_);break;case t.NOT:K(C,m,_);break;case t.TRG:W(C,m,_);break;case t.TBS:ne(C,m,_);break;case t.TLS:se(C,m,_);break;case t.BKR:z(C,m,_);break;case t.BKA:oe(C,m,_);break;case t.BKN:Y(C,m,_);break;case t.ABG:U(C,m,_);break;case t.AEN:J(C,m,_);break;default:G=!1;break}if(!A()&&m+_.phraseLength>p&&(p=m+_.phraseLength),i.stats!==null&&i.stats.collect(X,_),i.trace!==null){const le=x();i.trace.up(X,_.state,m,_.phraseLength,le.anchor,le.lookAround)}return c-=1,G}},Bb=function(){const t=ir,r=bn,n=to,i="stats.js: ";let s=[],o=[];const u=[];let l;const a=[],f=[];this.statsObject="statsObject";const d="stats",c=function(k,R){return k.lower<R.lower?-1:k.lower>R.lower?1:0},g=function(k,R){return k.total<R.total?1:k.total>R.total?-1:c(k,R)},h=function(k,R){return k.index<R.index?-1:k.index>R.index?1:0},b=function(){this.empty=0,this.match=0,this.nomatch=0,this.total=0},P=function(){u.length=0,l=new b,u[t.ALT]=new b,u[t.CAT]=new b,u[t.REP]=new b,u[t.RNM]=new b,u[t.TRG]=new b,u[t.TBS]=new b,u[t.TLS]=new b,u[t.UDT]=new b,u[t.AND]=new b,u[t.NOT]=new b,u[t.BKR]=new b,u[t.BKA]=new b,u[t.BKN]=new b,u[t.ABG]=new b,u[t.AEN]=new b,a.length=0;for(let k=0;k<s.length;k+=1)a.push({empty:0,match:0,nomatch:0,total:0,name:s[k].name,lower:s[k].lower,index:s[k].index});if(o.length>0){f.length=0;for(let k=0;k<o.length;k+=1)f.push({empty:0,match:0,nomatch:0,total:0,name:o[k].name,lower:o[k].lower,index:o[k].index})}},w=function(k,R){switch(k.total+=1,R){case t.EMPTY:k.empty+=1;break;case t.MATCH:k.match+=1;break;case t.NOMATCH:k.nomatch+=1;break;default:throw new Error(`${i}collect(): incStat(): unrecognized state: ${R}`)}},y=function(k,R){let T="";return T+="<tr>",T+=`<td class="${n.CLASS_ACTIVE}">${k}</td>`,T+=`<td class="${n.CLASS_EMPTY}">${R.empty}</td>`,T+=`<td class="${n.CLASS_MATCH}">${R.match}</td>`,T+=`<td class="${n.CLASS_NOMATCH}">${R.nomatch}</td>`,T+=`<td class="${n.CLASS_ACTIVE}">${R.total}</td>`,T+=`</tr>
|
|
265
|
-
`,T},v=function(){let k="";return k+=y("ALT",u[t.ALT]),k+=y("CAT",u[t.CAT]),k+=y("REP",u[t.REP]),k+=y("RNM",u[t.RNM]),k+=y("TRG",u[t.TRG]),k+=y("TBS",u[t.TBS]),k+=y("TLS",u[t.TLS]),k+=y("UDT",u[t.UDT]),k+=y("AND",u[t.AND]),k+=y("NOT",u[t.NOT]),k+=y("BKR",u[t.BKR]),k+=y("BKA",u[t.BKA]),k+=y("BKN",u[t.BKN]),k+=y("ABG",u[t.ABG]),k+=y("AEN",u[t.AEN]),k+=y("totals",l),k},p=function(){let k="";k+=`<tr><th></th><th></th><th></th><th></th><th></th></tr>
|
|
266
|
-
`,k+=`<tr><th>rules</th><th></th><th></th><th></th><th></th></tr>
|
|
267
|
-
`;for(let R=0;R<s.length;R+=1)a[R].total>0&&(k+="<tr>",k+=`<td class="${n.CLASS_ACTIVE}">${a[R].name}</td>`,k+=`<td class="${n.CLASS_EMPTY}">${a[R].empty}</td>`,k+=`<td class="${n.CLASS_MATCH}">${a[R].match}</td>`,k+=`<td class="${n.CLASS_NOMATCH}">${a[R].nomatch}</td>`,k+=`<td class="${n.CLASS_ACTIVE}">${a[R].total}</td>`,k+=`</tr>
|
|
268
|
-
`);if(o.length>0){k+=`<tr><th></th><th></th><th></th><th></th><th></th></tr>
|
|
269
|
-
`,k+=`<tr><th>udts</th><th></th><th></th><th></th><th></th></tr>
|
|
270
|
-
`;for(let R=0;R<o.length;R+=1)f[R].total>0&&(k+="<tr>",k+=`<td class="${n.CLASS_ACTIVE}">${f[R].name}</td>`,k+=`<td class="${n.CLASS_EMPTY}">${f[R].empty}</td>`,k+=`<td class="${n.CLASS_MATCH}">${f[R].match}</td>`,k+=`<td class="${n.CLASS_NOMATCH}">${f[R].nomatch}</td>`,k+=`<td class="${n.CLASS_ACTIVE}">${f[R].total}</td>`,k+=`</tr>
|
|
271
|
-
`)}return k};this.validate=function(k){let R=!1;return typeof k=="string"&&d===k&&(R=!0),R},this.init=function(k,R){s=k,o=R,P()},this.collect=function(k,R){w(l,R.state,R.phraseLength),w(u[k.type],R.state,R.phraseLength),k.type===t.RNM&&w(a[k.index],R.state,R.phraseLength),k.type===t.UDT&&w(f[k.index],R.state,R.phraseLength)},this.toHtml=function(k,R){let T="";T+=`<table class="${n.CLASS_STATS}">
|
|
272
|
-
`,typeof R=="string"&&(T+=`<caption>${R}</caption>
|
|
273
|
-
`),T+=`<tr><th class="${n.CLASS_ACTIVE}">ops</th>
|
|
274
|
-
`,T+=`<th class="${n.CLASS_EMPTY}">EMPTY</th>
|
|
275
|
-
`,T+=`<th class="${n.CLASS_MATCH}">MATCH</th>
|
|
276
|
-
`,T+=`<th class="${n.CLASS_NOMATCH}">NOMATCH</th>
|
|
277
|
-
`,T+=`<th class="${n.CLASS_ACTIVE}">totals</th></tr>
|
|
278
|
-
`;const N=!0;for(;N;){if(k===void 0){T+=v();break}if(k===null){T+=v();break}if(k==="ops"){T+=v();break}if(k==="index"){a.sort(h),f.length>0&&f.sort(h),T+=v(),T+=p();break}if(k==="hits"){a.sort(g),f.length>0&&f.sort(h),T+=v(),T+=p();break}if(k==="alpha"){a.sort(c),f.length>0&&f.sort(c),T+=v(),T+=p();break}break}return T+=`</table>
|
|
279
|
-
`,T},this.toHtmlPage=function(k,R,T){return r.htmlToPage(this.toHtml(k,R),T)}},Cb=function(){const t=bn,r=to,n=new h0,i=ir,s="trace.js: ",o=this,u=16,l=10,a=8,f=32,d=80,c=5,g=[];let h=5e3,b=-1,P=0,w=0;const y=[];let v=null,p=null,B=null;const k=[],R=[],T=`<span class="${r.CLASS_LINEEND}">•</span>`,N=`<span class="${r.CLASS_LINEEND}">…</span>`,S=`<span class="${r.CLASS_EMPTY}">𝜺</span>`,E=function(){const Z=function(re){k[i.ALT]=re,k[i.CAT]=re,k[i.REP]=re,k[i.TLS]=re,k[i.TBS]=re,k[i.TRG]=re,k[i.AND]=re,k[i.NOT]=re,k[i.BKR]=re,k[i.BKA]=re,k[i.BKN]=re,k[i.ABG]=re,k[i.AEN]=re};let te=0;for(const re in o.filter.operators)te+=1;if(te===0){Z(!1);return}for(const re in o.filter.operators){const K=re.toUpperCase();if(K==="<ALL>"){Z(!0);return}if(K==="<NONE>"){Z(!1);return}}Z(!1);for(const re in o.filter.operators){const K=re.toUpperCase();if(K==="ALT")k[i.ALT]=o.filter.operators[re]===!0;else if(K==="CAT")k[i.CAT]=o.filter.operators[re]===!0;else if(K==="REP")k[i.REP]=o.filter.operators[re]===!0;else if(K==="AND")k[i.AND]=o.filter.operators[re]===!0;else if(K==="NOT")k[i.NOT]=o.filter.operators[re]===!0;else if(K==="TLS")k[i.TLS]=o.filter.operators[re]===!0;else if(K==="TBS")k[i.TBS]=o.filter.operators[re]===!0;else if(K==="TRG")k[i.TRG]=o.filter.operators[re]===!0;else if(K==="BKR")k[i.BKR]=o.filter.operators[re]===!0;else if(K==="BKA")k[i.BKA]=o.filter.operators[re]===!0;else if(K==="BKN")k[i.BKN]=o.filter.operators[re]===!0;else if(K==="ABG")k[i.ABG]=o.filter.operators[re]===!0;else if(K==="AEN")k[i.AEN]=o.filter.operators[re]===!0;else throw new Error(`${s}initOpratorFilter: '${re}' not a valid operator name. Must be <all>, <none>, alt, cat, rep, tls, tbs, trg, and, not, bkr, bka or bkn`)}},x=function(){const Z=function(W){k[i.RNM]=W,k[i.UDT]=W;const ne=p.length+B.length;R.length=0;for(let se=0;se<ne;se+=1)R.push(W)};let te,re;const K=[];for(re=0;re<p.length;re+=1)K.push(p[re].lower);for(re=0;re<B.length;re+=1)K.push(B[re].lower);R.length=0,te=0;for(const W in o.filter.rules)te+=1;if(te===0){Z(!0);return}for(const W in o.filter.rules){const ne=W.toLowerCase();if(ne==="<all>"){Z(!0);return}if(ne==="<none>"){Z(!1);return}}Z(!1),k[i.RNM]=!0,k[i.UDT]=!0;for(const W in o.filter.rules){const ne=W.toLowerCase();if(re=K.indexOf(ne),re<0)throw new Error(`${s}initRuleFilter: '${W}' not a valid rule or udt name`);R[re]=o.filter.rules[W]===!0}};this.traceObject="traceObject",this.filter={operators:[],rules:[]},this.setMaxRecords=function(Z,te){if(b=-1,typeof Z=="number"&&Z>0)h=Math.ceil(Z);else{h=0;return}typeof te=="number"&&(b=Math.floor(te),b<0&&(b=-1))},this.getMaxRecords=function(){return h},this.getLastRecord=function(){return b},this.init=function(Z,te,re){g.length=0,y.length=0,P=0,w=0,v=re,p=Z,B=te,E(),x(),n.init(h)};const A=function(Z){let te=!1;return Z.type===i.RNM?k[Z.type]&&R[Z.index]?te=!0:te=!1:Z.type===i.UDT?k[Z.type]&&R[p.length+Z.index]?te=!0:te=!1:te=k[Z.type],te},O=function(Z){return b===-1||Z<=b};this.down=function(Z,te,re,K,W,ne){O(P)&&A(Z)&&(y.push(P),g[n.increment()]={dirUp:!1,depth:w,thisLine:P,thatLine:void 0,opcode:Z,state:te,phraseIndex:re,phraseLength:K,lookAnchor:W,lookAround:ne},P+=1,w+=1)},this.up=function(Z,te,re,K,W,ne){if(O(P)&&A(Z)){const se=P,U=y.pop(),J=n.getListIndex(U);J!==-1&&(g[J].thatLine=se),w-=1,g[n.increment()]={dirUp:!0,depth:w,thisLine:se,thatLine:U,opcode:Z,state:te,phraseIndex:re,phraseLength:K,lookAnchor:W,lookAround:ne},P+=1}};const I=function(){function Z(m,_){let G,X,le;if(_)switch(m.op={id:_.type,name:t.opcodeToString(_.type)},m.opData=void 0,_.type){case i.RNM:m.opData=p[_.index].name;break;case i.UDT:m.opData=B[_.index].name;break;case i.BKR:_.index<p.length?G=p[_.index].name:G=B[_.index-p.length].name,X=_.bkrCase===i.BKR_MODE_CI?"%i":"%s",le=_.bkrMode===i.BKR_MODE_UM?"%u":"%p",m.opData=`\\\\${X}${le}${G}`;break;case i.TLS:m.opData=[];for(let ge=0;ge<_.string.length;ge+=1)m.opData.push(_.string[ge]);break;case i.TBS:m.opData=[];for(let ge=0;ge<_.string.length;ge+=1)m.opData.push(_.string[ge]);break;case i.TRG:m.opData=[_.min,_.max];break;case i.REP:m.opData=[_.min,_.max];break;default:throw new Error("unrecognized opcode")}else m.op={id:void 0,name:void 0},m.opData=void 0}function te(m,_,G){return m===i.MATCH?{index:_,length:G}:m===i.NOMATCH?{index:_,length:0}:m===i.EMPTY?{index:_,length:0}:null}let re=-1;function K(m,_,G){const X={id:re++,branch:-1,parent:m,up:!1,down:!1,depth:G,children:[]};return _?(X.down=!0,X.state={id:_.state,name:t.stateToString(_.state)},X.phrase=null,Z(X,_.opcode)):(X.state={id:void 0,name:void 0},X.phrase=te(),Z(X,void 0)),X}function W(m,_){_&&(m.up=!0,m.state={id:_.state,name:t.stateToString(_.state)},m.phrase=te(_.state,_.phraseIndex,_.phraseLength),m.down||Z(m,_.opcode))}let ne=0,se=-1,U=1;function J(m){if(se+=1,m.branch=U,se>w&&(w=se),m.children.length===0)ne+=1;else for(let _=0;_<m.children.length;_+=1)_>0&&(U+=1),m.children[_].leftMost=!1,m.children[_].rightMost=!1,m.leftMost&&(m.children[_].leftMost=_===0),m.rightMost&&(m.children[_].rightMost=_===m.children.length-1),J(m.children[_]);se-=1}function z(m,_){let G;const X={};if(X.id=m.id,X.branch=m.branch,X.leftMost=m.leftMost,X.rightMost=m.rightMost,G=m.state.name?m.state.name:"ACTIVE",X.state={id:m.state.id,name:G},G=m.op.name?m.op.name:"?",X.op={id:m.op.id,name:G},typeof m.opData=="string")X.opData=m.opData;else if(Array.isArray(m.opData)){X.opData=[];for(let le=0;le<m.opData.length;le+=1)X.opData[le]=m.opData[le]}else X.opData=void 0;m.phrase?X.phrase={index:m.phrase.index,length:m.phrase.length}:X.phrase=null,X.depth=m.depth,X.children=[];for(let le=0;le<m.children.length;le+=1)m.children.length-1,X.children[le]=z(m.children[le]);return X}const oe=[];let Y,he,we,ye,ie=!0;const ce=K(null,null,-1);for(oe.push(ce),he=ce,n.forEach(m=>{if(ye=g[m],ie&&(ie=!1,ye.depth>0)){const _=ye.dirUp?ye.depth+1:ye.depth;for(let G=0;G<_;G+=1)we=he,he=K(he,null,G),oe.push(he),we.children.push(he)}ye.dirUp?(he=oe.pop(),W(he,ye),he=oe[oe.length-1]):(we=he,he=K(he,ye,ye.depth),oe.push(he),we.children.push(he))});oe.length>1;)he=oe.pop(),W(he,null);if(ce.children.length===0)throw new Error("trace.toTree(): parse tree has no nodes");if(oe.length===0)throw new Error("trace.toTree(): integrity check: dummy root node disappeared?");Y=ce.children[0];let me=Y;for(;Y&&!Y.down&&!Y.up;)me=Y,Y=Y.children[0];Y=me,Y.leftMost=!0,Y.rightMost=!0,J(Y),Y.branch=0;const fe={};fe.string=[];for(let m=0;m<v.length;m+=1)fe.string[m]=v[m];fe.rules=[];for(let m=0;m<p.length;m+=1)fe.rules[m]=p[m].name;fe.udts=[];for(let m=0;m<B.length;m+=1)fe.udts[m]=B[m].name;fe.id={},fe.id.ALT={id:i.ALT,name:"ALT"},fe.id.CAT={id:i.CAT,name:"CAT"},fe.id.REP={id:i.REP,name:"REP"},fe.id.RNM={id:i.RNM,name:"RNM"},fe.id.TLS={id:i.TLS,name:"TLS"},fe.id.TBS={id:i.TBS,name:"TBS"},fe.id.TRG={id:i.TRG,name:"TRG"},fe.id.UDT={id:i.UDT,name:"UDT"},fe.id.AND={id:i.AND,name:"AND"},fe.id.NOT={id:i.NOT,name:"NOT"},fe.id.BKR={id:i.BKR,name:"BKR"},fe.id.BKA={id:i.BKA,name:"BKA"},fe.id.BKN={id:i.BKN,name:"BKN"},fe.id.ABG={id:i.ABG,name:"ABG"},fe.id.AEN={id:i.AEN,name:"AEN"},fe.id.ACTIVE={id:i.ACTIVE,name:"ACTIVE"},fe.id.MATCH={id:i.MATCH,name:"MATCH"},fe.id.EMPTY={id:i.EMPTY,name:"EMPTY"},fe.id.NOMATCH={id:i.NOMATCH,name:"NOMATCH"},fe.treeDepth=w,fe.leafNodes=ne;let C;return Y.down?Y.up?C="none":C="right":Y.up?C="left":C="both",fe.branchesIncomplete=C,fe.tree=z(Y,Y.depth),fe};this.toTree=function(Z){const te=I();return Z?JSON.stringify(te):te},this.toHtmlPage=function(Z,te,re){return t.htmlToPage(this.toHtml(Z,te),re)};const L=function(Z,te){let re;switch(Z){case u:re="hexadecimal";break;case l:re="decimal";break;case a:re="ASCII";break;case f:re="UNICODE";break;default:throw new Error(`${s}htmlHeader: unrecognized mode: ${Z}`)}let K="";return K+=`<p>display mode: ${re}</p>
|
|
280
|
-
`,K+=`<table class="${r.CLASS_TRACE}">
|
|
281
|
-
`,typeof te=="string"&&(K+=`<caption>${te}</caption>`),K},H=function(){let Z="";return Z+=`</table>
|
|
282
|
-
`,Z+=`<p class="${r.CLASS_MONOSPACE}">legend:<br>
|
|
283
|
-
`,Z+=`(a) - line number<br>
|
|
284
|
-
`,Z+=`(b) - matching line number<br>
|
|
285
|
-
`,Z+=`(c) - phrase offset<br>
|
|
286
|
-
`,Z+=`(d) - phrase length<br>
|
|
287
|
-
`,Z+=`(e) - tree depth<br>
|
|
288
|
-
`,Z+=`(f) - operator state<br>
|
|
289
|
-
`,Z+=` - <span class="${r.CLASS_ACTIVE}">↓</span> phrase opened<br>
|
|
290
|
-
`,Z+=` - <span class="${r.CLASS_MATCH}">↑M</span> phrase matched<br>
|
|
291
|
-
`,Z+=` - <span class="${r.CLASS_EMPTY}">↑E</span> empty phrase matched<br>
|
|
292
|
-
`,Z+=` - <span class="${r.CLASS_NOMATCH}">↑N</span> phrase not matched<br>
|
|
293
|
-
`,Z+=`operator - ALT, CAT, REP, RNM, TRG, TLS, TBS<sup>†</sup>, UDT, AND, NOT, BKA, BKN, BKR, ABG, AEN<sup>‡</sup><br>
|
|
294
|
-
`,Z+=`phrase - up to ${d} characters of the phrase being matched<br>
|
|
295
|
-
`,Z+=` - <span class="${r.CLASS_MATCH}">matched characters</span><br>
|
|
296
|
-
`,Z+=` - <span class="${r.CLASS_LOOKAHEAD}">matched characters in look ahead mode</span><br>
|
|
297
|
-
`,Z+=` - <span class="${r.CLASS_LOOKBEHIND}">matched characters in look behind mode</span><br>
|
|
298
|
-
`,Z+=` - <span class="${r.CLASS_REMAINDER}">remainder characters(not yet examined by parser)</span><br>
|
|
299
|
-
`,Z+=` - <span class="${r.CLASS_CTRLCHAR}">control characters, TAB, LF, CR, etc. (ASCII mode only)</span><br>
|
|
300
|
-
`,Z+=` - ${S} empty string<br>
|
|
301
|
-
`,Z+=` - ${T} end of input string<br>
|
|
302
|
-
`,Z+=` - ${N} input string display truncated<br>
|
|
303
|
-
`,Z+=`</p>
|
|
304
|
-
`,Z+=`<p class="${r.CLASS_MONOSPACE}">
|
|
305
|
-
`,Z+=`<sup>†</sup>original ABNF operators:<br>
|
|
306
|
-
`,Z+=`ALT - alternation<br>
|
|
307
|
-
`,Z+=`CAT - concatenation<br>
|
|
308
|
-
`,Z+=`REP - repetition<br>
|
|
309
|
-
`,Z+=`RNM - rule name<br>
|
|
310
|
-
`,Z+=`TRG - terminal range<br>
|
|
311
|
-
`,Z+=`TLS - terminal literal string (case insensitive)<br>
|
|
312
|
-
`,Z+=`TBS - terminal binary string (case sensitive)<br>
|
|
313
|
-
`,Z+=`<br>
|
|
314
|
-
`,Z+=`<sup>‡</sup>super set SABNF operators:<br>
|
|
315
|
-
`,Z+=`UDT - user-defined terminal<br>
|
|
316
|
-
`,Z+=`AND - positive look ahead<br>
|
|
317
|
-
`,Z+=`NOT - negative look ahead<br>
|
|
318
|
-
`,Z+=`BKA - positive look behind<br>
|
|
319
|
-
`,Z+=`BKN - negative look behind<br>
|
|
320
|
-
`,Z+=`BKR - back reference<br>
|
|
321
|
-
`,Z+=`ABG - anchor - begin of input string<br>
|
|
322
|
-
`,Z+=`AEN - anchor - end of input string<br>
|
|
323
|
-
`,Z+=`</p>
|
|
324
|
-
`,Z};this.indent=function(Z){let te="";for(let re=0;re<Z;re+=1)te+=".";return te};const V=function(Z,te){let re="";if(te.type===i.TRG)if(Z===u||Z===f){let K=te.min.toString(16).toUpperCase();K.length%2!==0&&(K=`0${K}`),re+=Z===u?"%x":"U+",re+=K,K=te.max.toString(16).toUpperCase(),K.length%2!==0&&(K=`0${K}`),re+=`–${K}`}else re=`%d${te.min.toString(10)}–${te.max.toString(10)}`;return re},D=function(Z,te){let re="";if(te.type===i.REP)if(Z===u){let K=te.min.toString(16).toUpperCase();K.length%2!==0&&(K=`0${K}`),re=`x${K}`,te.max<1/0?(K=te.max.toString(16).toUpperCase(),K.length%2!==0&&(K=`0${K}`)):K="inf",re+=`–${K}`}else te.max<1/0?re=`${te.min.toString(10)}–${te.max.toString(10)}`:re=`${te.min.toString(10)}–inf`;return re},j=function(Z,te){let re="";if(te.type===i.TBS){const K=Math.min(te.string.length,c*2);if(Z===u||Z===f){re+=Z===u?"%x":"U+";for(let W=0;W<K;W+=1){let ne;W>0&&(re+="."),ne=te.string[W].toString(16).toUpperCase(),ne.length%2!==0&&(ne=`0${ne}`),re+=ne}}else{re="%d";for(let W=0;W<K;W+=1)W>0&&(re+="."),re+=te.string[W].toString(10)}K<te.string.length&&(re+=N)}return re},$=function(Z,te){let re="";if(te.type===i.TLS){const K=Math.min(te.string.length,c);if(Z===u||Z===l){let W,ne,se;Z===u?(re="%x",se=16):(re="%d",se=10);for(let U=0;U<K;U+=1)U>0&&(re+="."),ne=te.string[U],ne>=97&&ne<=122?(W=ne-32,re+=`${W.toString(se)}/${ne.toString(se)}`.toUpperCase()):ne>=65&&ne<=90?(W=ne,ne+=32,re+=`${W.toString(se)}/${ne.toString(se)}`.toUpperCase()):re+=ne.toString(se).toUpperCase();K<te.string.length&&(re+=N)}else{re='"';for(let W=0;W<K;W+=1)re+=t.asciiChars[te.string[W]];K<te.string.length&&(re+=N),re+='"'}}return re},F=function(Z,te,re,K,W){if(K===0)return"";let ne="";const se=W?",":"";switch(Z){case u:ne=se+t.charsToHex(te,re,K);break;case l:if(W)return`,${t.charsToDec(te,re,K)}`;ne=se+t.charsToDec(te,re,K);break;case f:ne=t.charsToUnicode(te,re,K);break;case a:default:ne=t.charsToAsciiHtml(te,re,K);break}return ne},M=function(Z,te,re,K,W,ne){let se="",U,J,z,oe,Y=T;const he=`<span class="${r.CLASS_LOOKBEHIND}">`,we=`<span class="${r.CLASS_REMAINDER}">`,ye="</span>";let ie=!1;switch(re){case i.EMPTY:se+=S;case i.NOMATCH:case i.MATCH:case i.ACTIVE:U=K-W,J=ne-U,z=ne,oe=te.length-z;break;default:throw new Error("unrecognized state")}return Y=T,J>d?(J=d,Y=N,oe=0):J+oe>d&&(Y=N,oe=d-J),J>0&&(se+=he,se+=F(Z,te,U,J,ie),se+=ye,ie=!0),oe>0&&(se+=we,se+=F(Z,te,z,oe,ie),se+=ye),se+Y},ee=function(Z,te,re,K,W,ne){let se="",U,J,z,oe,Y=T;const he=`<span class="${r.CLASS_REMAINDER}">`,we="</span>";let ye=!1;switch(re){case i.EMPTY:se+=S;case i.NOMATCH:case i.ACTIVE:U=K,J=0,z=K,oe=te.length-z;break;case i.MATCH:U=K,J=W,z=K+J,oe=te.length-z;break;default:throw new Error("unrecognized state")}return Y=T,J>d?(J=d,Y=N,oe=0):J+oe>d&&(Y=N,oe=d-J),J>0&&(se+=ne,se+=F(Z,te,U,J,ye),se+=we,ye=!0),oe>0&&(se+=he,se+=F(Z,te,z,oe,ye),se+=we),se+Y},de=function(Z,te,re,K,W){const ne=`<span class="${r.CLASS_LOOKAHEAD}">`;return ee(Z,te,re,K,W,ne)},Q=function(Z,te,re,K,W){const ne=`<span class="${r.CLASS_MATCH}">`;return ee(Z,te,re,K,W,ne)},ae=function(Z){if(p===null)return"";let te="",re,K,W,ne,se,U;return te+="<tr><th>(a)</th><th>(b)</th><th>(c)</th><th>(d)</th><th>(e)</th><th>(f)</th>",te+=`<th>operator</th><th>phrase</th></tr>
|
|
325
|
-
`,n.forEach(J=>{const z=g[J];switch(re=z.thisLine,K=z.thatLine!==void 0?z.thatLine:"--",W=!1,ne=!1,se=!1,z.lookAround===i.LOOKAROUND_AHEAD&&(W=!0,se=!0,U=z.lookAnchor),(z.opcode.type===i.AND||z.opcode.type===i.NOT)&&(W=!0,se=!0,U=z.phraseIndex),z.lookAround===i.LOOKAROUND_BEHIND&&(ne=!0,se=!0,U=z.lookAnchor),(z.opcode.type===i.BKA||z.opcode.type===i.BKN)&&(ne=!0,se=!0,U=z.phraseIndex),te+="<tr>",te+=`<td>${re}</td><td>${K}</td>`,te+=`<td>${z.phraseIndex}</td>`,te+=`<td>${z.phraseLength}</td>`,te+=`<td>${z.depth}</td>`,te+="<td>",z.state){case i.ACTIVE:te+=`<span class="${r.CLASS_ACTIVE}">↓ </span>`;break;case i.MATCH:te+=`<span class="${r.CLASS_MATCH}">↑M</span>`;break;case i.NOMATCH:te+=`<span class="${r.CLASS_NOMATCH}">↑N</span>`;break;case i.EMPTY:te+=`<span class="${r.CLASS_EMPTY}">↑E</span>`;break;default:te+=`<span class="${r.CLASS_ACTIVE}">--</span>`;break}if(te+="</td>",te+="<td>",te+=o.indent(z.depth),W?te+=`<span class="${r.CLASS_LOOKAHEAD}">`:ne&&(te+=`<span class="${r.CLASS_LOOKBEHIND}">`),te+=t.opcodeToString(z.opcode.type),z.opcode.type===i.RNM&&(te+=`(${p[z.opcode.index].name}) `),z.opcode.type===i.BKR){const oe=z.opcode.bkrCase===i.BKR_MODE_CI?"%i":"%s",Y=z.opcode.bkrMode===i.BKR_MODE_UM?"%u":"%p";te+=`(\\${oe}${Y}${p[z.opcode.index].name}) `}z.opcode.type===i.UDT&&(te+=`(${B[z.opcode.index].name}) `),z.opcode.type===i.TRG&&(te+=`(${V(Z,z.opcode)}) `),z.opcode.type===i.TBS&&(te+=`(${j(Z,z.opcode)}) `),z.opcode.type===i.TLS&&(te+=`(${$(Z,z.opcode)}) `),z.opcode.type===i.REP&&(te+=`(${D(Z,z.opcode)}) `),se&&(te+="</span>"),te+="</td>",te+="<td>",ne?te+=M(Z,v,z.state,z.phraseIndex,z.phraseLength,U):W?te+=de(Z,v,z.state,z.phraseIndex,z.phraseLength):te+=Q(Z,v,z.state,z.phraseIndex,z.phraseLength),te+=`</td></tr>
|
|
326
|
-
`}),te+="<tr><th>(a)</th><th>(b)</th><th>(c)</th><th>(d)</th><th>(e)</th><th>(f)</th>",te+=`<th>operator</th><th>phrase</th></tr>
|
|
327
|
-
`,te+=`</table>
|
|
328
|
-
`,te};this.toHtml=function(Z,te){let re=a;if(typeof Z=="string"&&Z.length>=3){const W=Z.toLowerCase().slice(0,3);W==="hex"?re=u:W==="dec"?re=l:W==="uni"&&(re=f)}let K="";return K+=L(re,te),K+=ae(re),K+=H(),K}},Ln={ast:Sb,circular:h0,ids:ir,parser:Ob,stats:Bb,trace:Cb,utils:bn,emitcss:d0,style:to},Lo,wu;function Rb(){return wu||(wu=1,Lo=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 r="";return r+=`file = *line [last-line]
|
|
329
|
-
`,r+=`line = line-text end
|
|
330
|
-
`,r+=`line-text = *(valid/invalid)
|
|
331
|
-
`,r+=`last-line = 1*(valid/invalid)
|
|
332
|
-
`,r+=`valid = %d32-126 / %d9
|
|
333
|
-
`,r+=`invalid = %d0-8 / %d11-12 /%d14-31 / %x7f-ffffffff
|
|
334
|
-
`,r+=`end = CRLF / LF / CR
|
|
335
|
-
`,r+=`CRLF = %d13.10
|
|
336
|
-
`,r+=`LF = %d10
|
|
337
|
-
`,r+=`CR = %d13
|
|
338
|
-
`,r}}),Lo}var Uo={},Au;function Nb(){if(Au)return Uo;Au=1;const e=ir,t=bn;function r(d,c,g,h,b){return d===e.SEM_PRE?(b.endLength=0,b.textLength=0,b.invalidCount=0):b.lines.push({lineNo:b.lines.length,beginChar:g,length:h,textLength:b.textLength,endType:b.endType,invalidChars:b.invalidCount}),e.SEM_OK}function n(d,c,g,h,b){return d===e.SEM_PRE&&(b.textLength=h),e.SEM_OK}function i(d,c,g,h,b){return d===e.SEM_PRE?(b.endLength=0,b.textLength=0,b.invalidCount=0):b.strict?(b.lines.push({lineNo:b.lines.length,beginChar:g,length:h,textLength:h,endType:"none",invalidChars:b.invalidCount}),b.errors.push({line:b.lineNo,char:g+h,msg:"no line end on last line - strict ABNF specifies CRLF(\\r\\n, \\x0D\\x0A)"})):(c.push(10),b.lines.push({lineNo:b.lines.length,beginChar:g,length:h+1,textLength:h,endType:"LF",invalidChars:b.invalidCount})),e.SEM_OK}function s(d,c,g,h,b){return d===e.SEM_PRE&&b.errors.push({line:b.lineNo,char:g,msg:`invalid character found '\\x${t.charToHex(c[g])}'`}),e.SEM_OK}function o(d,c,g,h,b){return d===e.SEM_POST&&(b.lineNo+=1),e.SEM_OK}function u(d,c,g,h,b){return d===e.SEM_PRE&&(b.endType="LF",b.strict&&b.errors.push({line:b.lineNo,char:g,msg:"line end character LF(\\n, \\x0A) - strict ABNF specifies CRLF(\\r\\n, \\x0D\\x0A)"})),e.SEM_OK}function l(d,c,g,h,b){return d===e.SEM_PRE&&(b.endType="CR",b.strict&&b.errors.push({line:b.lineNo,char:g,msg:"line end character CR(\\r, \\x0D) - strict ABNF specifies CRLF(\\r\\n, \\x0D\\x0A)"})),e.SEM_OK}function a(d,c,g,h,b){return d===e.SEM_PRE&&(b.endType="CRLF"),e.SEM_OK}const f=[];return f.line=r,f["line-text"]=n,f["last-line"]=i,f.invalid=s,f.end=o,f.lf=u,f.cr=l,f.crlf=a,Uo.callbacks=f,Uo}var Fo,Eu;function Ib(){return Eu||(Eu=1,Fo=function(t,r,n,i){const s="scanner.js: ",o=Ln,u=new(Rb()),{callbacks:l}=Nb(),a=[],f=new o.parser;if(f.ast=new o.ast,f.ast.callbacks=l,i){if(i.traceObject!=="traceObject")throw new TypeError(`${s}trace argument is not a trace object`);f.trace=i}if(f.parse(u,"file",t).success!==!0){r.push({line:0,char:0,msg:"syntax analysis error analyzing input SABNF grammar"});return}const c={lines:a,lineNo:0,errors:r,strict:!!n};return f.ast.translate(c),a}),Fo}var jo,vu;function Mb(){return vu||(vu=1,jo=function(){const t="syntax-callbacks.js: ",r=Ln,n=r.ids;let i;const s=function($,F,M,ee){switch($.state){case n.ACTIVE:ee.altStack=[],ee.repCount=0;break;case n.EMPTY:ee.errors.push({line:0,char:0,msg:"grammar file is empty"});break;case n.MATCH:ee.ruleCount===0&&ee.errors.push({line:0,char:0,msg:"no rules defined"});break;case n.NOMATCH:throw new Error(`${t}synFile: grammar file NOMATCH: design error: should never happen.`);default:throw new Error(`${t}synFile: unrecognized case.`)}},o=function(j,$,F,M){switch(j.state){case n.ACTIVE:M.altStack.length=0,i={groupOpen:null,groupError:!1,optionOpen:null,optionError:!1,tlsOpen:null,clsOpen:null,prosValOpen:null,basicError:!1},M.altStack.push(i);break;case n.EMPTY:throw new Error(`${t}synRule: EMPTY: rule cannot be empty`);case n.NOMATCH:break;case n.MATCH:M.ruleCount+=1;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},u=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:M.errors.push({line:M.findLine(M.lines,F,M.charsLength),char:F,msg:"Unrecognized SABNF line. Invalid rule, comment or blank line."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},l=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:M.errors.push({line:M.findLine(M.lines,F,M.charsLength),char:F,msg:"Rule names must be alphanum and begin with alphabetic character."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},a=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:M.errors.push({line:M.findLine(M.lines,F,M.charsLength),char:F,msg:"Expected '=' or '=/'. Not found."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},f=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:M.strict&&M.errors.push({line:M.findLine(M.lines,F,M.charsLength),char:F,msg:"AND operator(&) found - strict ABNF specified."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},d=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:M.strict&&M.errors.push({line:M.findLine(M.lines,F,M.charsLength),char:F,msg:"NOT operator(!) found - strict ABNF specified."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},c=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:M.strict?M.errors.push({line:M.findLine(M.lines,F,M.charsLength),char:F,msg:"Positive look-behind operator(&&) found - strict ABNF specified."}):M.lite&&M.errors.push({line:M.findLine(M.lines,F,M.charsLength),char:F,msg:"Positive look-behind operator(&&) found - apg-lite specified."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},g=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:M.strict?M.errors.push({line:M.findLine(M.lines,F,M.charsLength),char:F,msg:"Negative look-behind operator(!!) found - strict ABNF specified."}):M.lite&&M.errors.push({line:M.findLine(M.lines,F,M.charsLength),char:F,msg:"Negative look-behind operator(!!) found - apg-lite specified."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},h=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:M.strict?M.errors.push({line:M.findLine(M.lines,F,M.charsLength),char:F,msg:"Beginning of string anchor(%^) found - strict ABNF specified."}):M.lite&&M.errors.push({line:M.findLine(M.lines,F,M.charsLength),char:F,msg:"Beginning of string anchor(%^) found - apg-lite specified."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},b=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:M.strict?M.errors.push({line:M.findLine(M.lines,F,M.charsLength),char:F,msg:"End of string anchor(%$) found - strict ABNF specified."}):M.lite&&M.errors.push({line:M.findLine(M.lines,F,M.charsLength),char:F,msg:"End of string anchor(%$) found - apg-lite specified."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},P=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:if(M.strict){const ee=r.utils.charsToString($,F,j.phraseLength);M.errors.push({line:M.findLine(M.lines,F,M.charsLength),char:F,msg:`Back reference operator(${ee}) found - strict ABNF specified.`})}else if(M.lite){const ee=r.utils.charsToString($,F,j.phraseLength);M.errors.push({line:M.findLine(M.lines,F,M.charsLength),char:F,msg:`Back reference operator(${ee}) found - apg-lite specified.`})}break;default:throw new Error(`${t}synFile: unrecognized case.`)}},w=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:if(M.strict){const ee=r.utils.charsToString($,F,j.phraseLength);M.errors.push({line:M.findLine(M.lines,F,M.charsLength),char:F,msg:`UDT operator found(${ee}) - strict ABNF specified.`})}break;default:throw new Error(`${t}synFile: unrecognized case.`)}},y=function(j,$,F){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i.tlsOpen=F;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},v=function(j,$,F,M){switch(j.state){case n.ACTIVE:M.stringTabChar=!1;break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:M.stringTabChar!==!1&&M.errors.push({line:M.findLine(M.lines,M.stringTabChar),char:M.stringTabChar,msg:"Tab character (\\t, x09) not allowed in literal string (see 'quoted-string' definition, RFC 7405.)"});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},p=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:M.stringTabChar=F;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},B=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:M.errors.push({line:M.findLine(M.lines,i.tlsOpen),char:i.tlsOpen,msg:'Case-insensitive literal string("...") opened but not closed.'}),i.basicError=!0,i.tlsOpen=null;break;case n.MATCH:i.tlsOpen=null;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},k=function(j,$,F){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i.clsOpen=F;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},R=function(j,$,F,M){switch(j.state){case n.ACTIVE:M.stringTabChar=!1;break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:M.stringTabChar!==!1&&M.errors.push({line:M.findLine(M.lines,M.stringTabChar),char:M.stringTabChar,msg:"Tab character (\\t, x09) not allowed in literal string."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},T=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:M.errors.push({line:M.findLine(M.lines,i.clsOpen),char:i.clsOpen,msg:"Case-sensitive literal string('...') opened but not closed."}),i.clsOpen=null,i.basicError=!0;break;case n.MATCH:M.strict&&M.errors.push({line:M.findLine(M.lines,i.clsOpen),char:i.clsOpen,msg:"Case-sensitive string operator('...') found - strict ABNF specified."}),i.clsOpen=null;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},N=function(j,$,F){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i.prosValOpen=F;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},S=function(j,$,F,M){switch(j.state){case n.ACTIVE:M.stringTabChar=!1;break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:M.stringTabChar!==!1&&M.errors.push({line:M.findLine(M.lines,M.stringTabChar),char:M.stringTabChar,msg:"Tab character (\\t, x09) not allowed in prose value string."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},E=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:M.errors.push({line:M.findLine(M.lines,i.prosValOpen),char:i.prosValOpen,msg:"Prose value operator(<...>) opened but not closed."}),i.basicError=!0,i.prosValOpen=null;break;case n.MATCH:M.errors.push({line:M.findLine(M.lines,i.prosValOpen),char:i.prosValOpen,msg:"Prose value operator(<...>) found. The ABNF syntax is valid, but a parser cannot be generated from this grammar."}),i.prosValOpen=null;break;default:throw new Error(`${t}synFile: unrecognized case.`)}},x=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i={groupOpen:F,groupError:!1,optionOpen:null,optionError:!1,tlsOpen:null,clsOpen:null,prosValOpen:null,basicError:!1},M.altStack.push(i);break;default:throw new Error(`${t}synFile: unrecognized case.`)}},A=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:M.errors.push({line:M.findLine(M.lines,i.groupOpen),char:i.groupOpen,msg:'Group "(...)" opened but not closed.'}),i=M.altStack.pop(),i.groupError=!0;break;case n.MATCH:i=M.altStack.pop();break;default:throw new Error(`${t}synFile: unrecognized case.`)}},O=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i={groupOpen:null,groupError:!1,optionOpen:F,optionError:!1,tlsOpen:null,clsOpen:null,prosValOpen:null,basicError:!1},M.altStack.push(i);break;default:throw new Error(`${t}synFile: unrecognized case.`)}},I=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:M.errors.push({line:M.findLine(M.lines,i.optionOpen),char:i.optionOpen,msg:'Option "[...]" opened but not closed.'}),i=M.altStack.pop(),i.optionError=!0;break;case n.MATCH:i=M.altStack.pop();break;default:throw new Error(`${t}synFile: unrecognized case.`)}},L=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i.basicError===!1&&M.errors.push({line:M.findLine(M.lines,F,M.charsLength),char:F,msg:"Unrecognized SABNF element."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},H=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:if(j.phraseLength===1&&M.strict){const ee=$[F]===13?"CR":"LF";M.errors.push({line:M.findLine(M.lines,F,M.charsLength),char:F,msg:`Line end '${ee}' found - strict ABNF specified, only CRLF allowed.`})}break;default:throw new Error(`${t}synFile: unrecognized case.`)}},V=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:M.errors.push({line:M.findLine(M.lines,F,M.charsLength),char:F,msg:"Unrecognized grammar element or characters."});break;default:throw new Error(`${t}synFile: unrecognized case.`)}},D=function(j,$,F,M){switch(j.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:M.repCount+=1;break;case n.MATCH:M.repCount+=1;break;default:throw new Error(`${t}synFile: unrecognized case.`)}};this.callbacks=[],this.callbacks.andop=f,this.callbacks.basicelementerr=L,this.callbacks.clsclose=T,this.callbacks.clsopen=k,this.callbacks.clsstring=R,this.callbacks.definedaserror=a,this.callbacks.file=s,this.callbacks.groupclose=A,this.callbacks.groupopen=x,this.callbacks.lineenderror=V,this.callbacks.lineend=H,this.callbacks.notop=d,this.callbacks.optionclose=I,this.callbacks.optionopen=O,this.callbacks.prosvalclose=E,this.callbacks.prosvalopen=N,this.callbacks.prosvalstring=S,this.callbacks.repetition=D,this.callbacks.rule=o,this.callbacks.ruleerror=u,this.callbacks.rulenameerror=l,this.callbacks.stringtab=p,this.callbacks.tlsclose=B,this.callbacks.tlsopen=y,this.callbacks.tlsstring=v,this.callbacks.udtop=w,this.callbacks.bkaop=c,this.callbacks.bknop=g,this.callbacks.bkrop=P,this.callbacks.abgop=h,this.callbacks.aenop=b}),jo}var Do,_u;function Lb(){return _u||(_u=1,Do=function(){const t=Ln,r=t.ids,n=function(){this.names=[],this.add=function(z){let oe=-1;return this.get(z)===-1&&(oe={name:z,lower:z.toLowerCase(),index:this.names.length},this.names.push(oe)),oe},this.get=function(z){let oe=-1;const Y=z.toLowerCase();for(let he=0;he<this.names.length;he+=1)if(this.names[he].lower===Y){oe=this.names[he];break}return oe}},i=function(J,z,oe){let Y=0;for(let he=z;he<z+oe;he+=1)Y=10*Y+J[he]-48;return Y},s=function(J,z,oe){let Y=0;for(let he=z;he<z+oe;he+=1)Y=2*Y+J[he]-48;return Y},o=function(J,z,oe){let Y=0;for(let he=z;he<z+oe;he+=1){let we=J[he];if(we>=48&&we<=57)we-=48;else if(we>=65&&we<=70)we-=55;else if(we>=97&&we<=102)we-=87;else throw new Error("hexnum out of range");Y=16*Y+we}return Y};function u(U,J,z,oe,Y){const he=r.SEM_OK;if(U===r.SEM_PRE)Y.ruleNames=new n,Y.udtNames=new n,Y.rules=[],Y.udts=[],Y.rulesLineMap=[],Y.opcodes=[],Y.altStack=[],Y.topStack=null,Y.topRule=null;else if(U===r.SEM_POST){let we;Y.rules.forEach(ye=>{ye.isBkr=!1,ye.opcodes.forEach(ie=>{ie.type===r.RNM&&(we=Y.ruleNames.get(ie.index.name),we===-1?(Y.errors.push({line:Y.findLine(Y.lines,ie.index.phraseIndex,Y.charsLength),char:ie.index.phraseIndex,msg:`Rule name '${ie.index.name}' used but not defined.`}),ie.index=-1):ie.index=we.index)})}),Y.udts.forEach(ye=>{ye.isBkr=!1}),Y.rules.forEach(ye=>{ye.opcodes.forEach(ie=>{ie.type===r.BKR&&(ye.hasBkr=!0,we=Y.ruleNames.get(ie.index.name),we!==-1?(Y.rules[we.index].isBkr=!0,ie.index=we.index):(we=Y.udtNames.get(ie.index.name),we!==-1?(Y.udts[we.index].isBkr=!0,ie.index=Y.rules.length+we.index):(Y.errors.push({line:Y.findLine(Y.lines,ie.index.phraseIndex,Y.charsLength),char:ie.index.phraseIndex,msg:`Back reference name '${ie.index.name}' refers to undefined rule or unamed UDT.`}),ie.index=-1)))})})}return he}function l(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_PRE&&(Y.altStack.length=0,Y.topStack=null,Y.rulesLineMap.push({line:Y.findLine(Y.lines,z,Y.charsLength),char:z})),he}function a(U,J,z,oe,Y){const he=r.SEM_OK;if(U===r.SEM_PRE)Y.ruleName="",Y.definedas="";else if(U===r.SEM_POST){let we;Y.definedas==="="?(we=Y.ruleNames.add(Y.ruleName),we===-1?(Y.definedas=null,Y.errors.push({line:Y.findLine(Y.lines,z,Y.charsLength),char:z,msg:`Rule name '${Y.ruleName}' previously defined.`})):(Y.topRule={name:we.name,lower:we.lower,opcodes:[],index:we.index},Y.rules.push(Y.topRule),Y.opcodes=Y.topRule.opcodes)):(we=Y.ruleNames.get(Y.ruleName),we===-1?(Y.definedas=null,Y.errors.push({line:Y.findLine(Y.lines,z,Y.charsLength),char:z,msg:`Rule name '${Y.ruleName}' for incremental alternate not previously defined.`})):(Y.topRule=Y.rules[we.index],Y.opcodes=Y.topRule.opcodes))}return he}function f(U,J,z,oe,Y){let he=r.SEM_OK;if(U===r.SEM_PRE)for(;;){if(Y.definedas===null){he=r.SEM_SKIP;break}if(Y.topStack===null){if(Y.definedas==="="){Y.topStack={alt:{type:r.ALT,children:[]},cat:null},Y.altStack.push(Y.topStack),Y.opcodes.push(Y.topStack.alt);break}Y.topStack={alt:Y.opcodes[0],cat:null},Y.altStack.push(Y.topStack);break}Y.topStack={alt:{type:r.ALT,children:[]},cat:null},Y.altStack.push(Y.topStack),Y.opcodes.push(Y.topStack.alt);break}else U===r.SEM_POST&&(Y.altStack.pop(),Y.altStack.length>0?Y.topStack=Y.altStack[Y.altStack.length-1]:Y.topStack=null);return he}function d(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_PRE?(Y.topStack.alt.children.push(Y.opcodes.length),Y.topStack.cat={type:r.CAT,children:[]},Y.opcodes.push(Y.topStack.cat)):U===r.SEM_POST&&(Y.topStack.cat=null),he}function c(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_PRE&&Y.topStack.cat.children.push(Y.opcodes.length),he}function g(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&Y.opcodes.push({type:r.REP,min:0,max:1,char:z}),he}function h(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_PRE&&(Y.ruleName=t.utils.charsToString(J,z,oe)),he}function b(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&(Y.definedas="="),he}function P(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&(Y.definedas="=/"),he}function w(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_PRE?(Y.min=0,Y.max=1/0,Y.topRep={type:r.REP,min:0,max:1/0},Y.opcodes.push(Y.topRep)):U===r.SEM_POST&&(Y.min>Y.max&&Y.errors.push({line:Y.findLine(Y.lines,z,Y.charsLength),char:z,msg:`repetition min cannot be greater than max: min: ${Y.min}: max: ${Y.max}`}),Y.topRep.min=Y.min,Y.topRep.max=Y.max),he}function y(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&(Y.min=i(J,z,oe)),he}function v(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&(Y.max=i(J,z,oe)),he}function p(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&(Y.max=i(J,z,oe),Y.min=Y.max),he}function B(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&Y.opcodes.push({type:r.AND}),he}function k(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&Y.opcodes.push({type:r.NOT}),he}function R(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&Y.opcodes.push({type:r.RNM,index:{phraseIndex:z,name:t.utils.charsToString(J,z,oe)}}),he}function T(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&Y.opcodes.push({type:r.ABG}),he}function N(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&Y.opcodes.push({type:r.AEN}),he}function S(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&Y.opcodes.push({type:r.BKA}),he}function E(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&Y.opcodes.push({type:r.BKN}),he}function x(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_PRE?(Y.ci=!0,Y.cs=!1,Y.um=!0,Y.pm=!1):U===r.SEM_POST&&Y.opcodes.push({type:r.BKR,bkrCase:Y.cs===!0?r.BKR_MODE_CS:r.BKR_MODE_CI,bkrMode:Y.pm===!0?r.BKR_MODE_PM:r.BKR_MODE_UM,index:{phraseIndex:Y.bkrname.phraseIndex,name:t.utils.charsToString(J,Y.bkrname.phraseIndex,Y.bkrname.phraseLength)}}),he}function A(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&(Y.ci=!0),he}function O(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&(Y.cs=!0),he}function I(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&(Y.um=!0),he}function L(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&(Y.pm=!0),he}function H(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&(Y.bkrname={phraseIndex:z,phraseLength:oe}),he}function V(U,J,z,oe,Y){const he=r.SEM_OK;if(U===r.SEM_POST){const we=t.utils.charsToString(J,z,oe);let ye=Y.udtNames.add(we);if(ye===-1){if(ye=Y.udtNames.get(we),ye===-1)throw new Error("semUdtEmpty: name look up error")}else Y.udts.push({name:ye.name,lower:ye.lower,index:ye.index,empty:!0});Y.opcodes.push({type:r.UDT,empty:!0,index:ye.index})}return he}function D(U,J,z,oe,Y){const he=r.SEM_OK;if(U===r.SEM_POST){const we=t.utils.charsToString(J,z,oe);let ye=Y.udtNames.add(we);if(ye===-1){if(ye=Y.udtNames.get(we),ye===-1)throw new Error("semUdtNonEmpty: name look up error")}else Y.udts.push({name:ye.name,lower:ye.lower,index:ye.index,empty:!1});Y.opcodes.push({type:r.UDT,empty:!1,index:ye.index,syntax:null,semantic:null})}return he}function j(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_PRE&&(Y.tlscase=!0),he}function $(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&oe>0&&(J[z+1]===83||J[z+1]===115)&&(Y.tlscase=!1),he}function F(U,J,z,oe,Y){const he=r.SEM_OK;if(U===r.SEM_POST)if(Y.tlscase){const we=J.slice(z,z+oe);for(let ye=0;ye<we.length;ye+=1)we[ye]>=65&&we[ye]<=90&&(we[ye]+=32);Y.opcodes.push({type:r.TLS,string:we})}else Y.opcodes.push({type:r.TBS,string:J.slice(z,z+oe)});return he}function M(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&(oe<=2?Y.opcodes.push({type:r.TLS,string:[]}):Y.opcodes.push({type:r.TBS,string:J.slice(z+1,z+oe-1)})),he}function ee(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_PRE?Y.tbsstr=[]:U===r.SEM_POST&&Y.opcodes.push({type:r.TBS,string:Y.tbsstr}),he}function de(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_PRE?(Y.min=0,Y.max=0):U===r.SEM_POST&&(Y.min>Y.max&&Y.errors.push({line:Y.findLine(Y.lines,z,Y.charsLength),char:z,msg:`TRG, (%dmin-max), min cannot be greater than max: min: ${Y.min}: max: ${Y.max}`}),Y.opcodes.push({type:r.TRG,min:Y.min,max:Y.max})),he}function Q(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&(Y.min=i(J,z,oe)),he}function ae(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&(Y.max=i(J,z,oe)),he}function Z(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&(Y.min=s(J,z,oe)),he}function te(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&(Y.max=s(J,z,oe)),he}function re(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&(Y.min=o(J,z,oe)),he}function K(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&(Y.max=o(J,z,oe)),he}function W(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&Y.tbsstr.push(i(J,z,oe)),he}function ne(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&Y.tbsstr.push(s(J,z,oe)),he}function se(U,J,z,oe,Y){const he=r.SEM_OK;return U===r.SEM_POST&&Y.tbsstr.push(o(J,z,oe)),he}this.callbacks=[],this.callbacks.abgop=T,this.callbacks.aenop=N,this.callbacks.alternation=f,this.callbacks.andop=B,this.callbacks.bmax=te,this.callbacks.bmin=Z,this.callbacks.bkaop=S,this.callbacks.bknop=E,this.callbacks.bkrop=x,this.callbacks["bkr-name"]=H,this.callbacks.bstring=ne,this.callbacks.clsop=M,this.callbacks.ci=A,this.callbacks.cs=O,this.callbacks.um=I,this.callbacks.pm=L,this.callbacks.concatenation=d,this.callbacks.defined=b,this.callbacks.dmax=ae,this.callbacks.dmin=Q,this.callbacks.dstring=W,this.callbacks.file=u,this.callbacks.incalt=P,this.callbacks.notop=k,this.callbacks.optionopen=g,this.callbacks["rep-max"]=v,this.callbacks["rep-min"]=y,this.callbacks["rep-min-max"]=p,this.callbacks.repetition=c,this.callbacks.repop=w,this.callbacks.rnmop=R,this.callbacks.rule=l,this.callbacks.rulelookup=a,this.callbacks.rulename=h,this.callbacks.tbsop=ee,this.callbacks.tlscase=$,this.callbacks.tlsstring=F,this.callbacks.tlsop=j,this.callbacks.trgop=de,this.callbacks["udt-empty"]=V,this.callbacks["udt-non-empty"]=D,this.callbacks.xmax=K,this.callbacks.xmin=re,this.callbacks.xstring=se}),Do}var Ho,ku;function Ub(){return ku||(ku=1,Ho=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 r="";return r+=`;
|
|
339
|
-
`,r+=`; ABNF for JavaScript APG 2.0 SABNF
|
|
340
|
-
`,r+=`; RFC 5234 with some restrictions and additions.
|
|
341
|
-
`,r+=`; Updated 11/24/2015 for RFC 7405 case-sensitive literal string notation
|
|
342
|
-
`,r+=`; - accepts %s"string" as a case-sensitive string
|
|
343
|
-
`,r+=`; - accepts %i"string" as a case-insensitive string
|
|
344
|
-
`,r+=`; - accepts "string" as a case-insensitive string
|
|
345
|
-
`,r+=`;
|
|
346
|
-
`,r+=`; Some restrictions:
|
|
347
|
-
`,r+=`; 1. Rules must begin at first character of each line.
|
|
348
|
-
`,r+=`; Indentations on first rule and rules thereafter are not allowed.
|
|
349
|
-
`,r+=`; 2. Relaxed line endings. CRLF, LF or CR are accepted as valid line ending.
|
|
350
|
-
`,r+=`; 3. Prose values, i.e. <prose value>, are accepted as valid grammar syntax.
|
|
351
|
-
`,r+=`; However, a working parser cannot be generated from them.
|
|
352
|
-
`,r+=`;
|
|
353
|
-
`,r+=`; Super set (SABNF) additions:
|
|
354
|
-
`,r+=`; 1. Look-ahead (syntactic predicate) operators are accepted as element prefixes.
|
|
355
|
-
`,r+=`; & is the positive look-ahead operator, succeeds and backtracks if the look-ahead phrase is found
|
|
356
|
-
`,r+=`; ! is the negative look-ahead operator, succeeds and backtracks if the look-ahead phrase is NOT found
|
|
357
|
-
`,r+=`; e.g. &%d13 or &rule or !(A / B)
|
|
358
|
-
`,r+=`; 2. User-Defined Terminals (UDT) of the form, u_name and e_name are accepted.
|
|
359
|
-
`,r+=`; 'name' is alpha followed by alpha/num/hyphen just like a rule name.
|
|
360
|
-
`,r+=`; u_name may be used as an element but no rule definition is given.
|
|
361
|
-
`,r+=`; e.g. rule = A / u_myUdt
|
|
362
|
-
`,r+=`; A = "a"
|
|
363
|
-
`,r+=`; would be a valid grammar.
|
|
364
|
-
`,r+=`; 3. Case-sensitive, single-quoted strings are accepted.
|
|
365
|
-
`,r+=`; e.g. 'abc' would be equivalent to %d97.98.99
|
|
366
|
-
`,r+=`; (kept for backward compatibility, but superseded by %s"abc")
|
|
367
|
-
`,r+=`; New 12/26/2015
|
|
368
|
-
`,r+=`; 4. Look-behind operators are accepted as element prefixes.
|
|
369
|
-
`,r+=`; && is the positive look-behind operator, succeeds and backtracks if the look-behind phrase is found
|
|
370
|
-
`,r+=`; !! is the negative look-behind operator, succeeds and backtracks if the look-behind phrase is NOT found
|
|
371
|
-
`,r+=`; e.g. &&%d13 or &&rule or !!(A / B)
|
|
372
|
-
`,r+=`; 5. Back reference operators, i.e. \\rulename, are accepted.
|
|
373
|
-
`,r+=`; A back reference operator acts like a TLS or TBS terminal except that the phrase it attempts
|
|
374
|
-
`,r+=`; to match is a phrase previously matched by the rule 'rulename'.
|
|
375
|
-
`,r+=`; There are two modes of previous phrase matching - the parent-frame mode and the universal mode.
|
|
376
|
-
`,r+=`; In universal mode, \\rulename matches the last match to 'rulename' regardless of where it was found.
|
|
377
|
-
`,r+=`; In parent-frame mode, \\rulename matches only the last match found on the parent's frame or parse tree level.
|
|
378
|
-
`,r+=`; Back reference modifiers can be used to specify case and mode.
|
|
379
|
-
`,r+=`; \\A defaults to case-insensitive and universal mode, e.g. \\A === \\%i%uA
|
|
380
|
-
`,r+=`; Modifiers %i and %s determine case-insensitive and case-sensitive mode, respectively.
|
|
381
|
-
`,r+=`; Modifiers %u and %p determine universal mode and parent frame mode, respectively.
|
|
382
|
-
`,r+=`; Case and mode modifiers can appear in any order, e.g. \\%s%pA === \\%p%sA.
|
|
383
|
-
`,r+=`; 7. String begin anchor, ABG(%^) matches the beginning of the input string location.
|
|
384
|
-
`,r+=`; Returns EMPTY or NOMATCH. Never consumes any characters.
|
|
385
|
-
`,r+=`; 8. String end anchor, AEN(%$) matches the end of the input string location.
|
|
386
|
-
`,r+=`; Returns EMPTY or NOMATCH. Never consumes any characters.
|
|
387
|
-
`,r+=`;
|
|
388
|
-
`,r+=`File = *(BlankLine / Rule / RuleError)
|
|
389
|
-
`,r+=`BlankLine = *(%d32/%d9) [comment] LineEnd
|
|
390
|
-
`,r+=`Rule = RuleLookup owsp Alternation ((owsp LineEnd)
|
|
391
|
-
`,r+=` / (LineEndError LineEnd))
|
|
392
|
-
`,r+=`RuleLookup = RuleNameTest owsp DefinedAsTest
|
|
393
|
-
`,r+=`RuleNameTest = RuleName/RuleNameError
|
|
394
|
-
`,r+=`RuleName = alphanum
|
|
395
|
-
`,r+=`RuleNameError = 1*(%d33-60/%d62-126)
|
|
396
|
-
`,r+=`DefinedAsTest = DefinedAs / DefinedAsError
|
|
397
|
-
`,r+=`DefinedAsError = 1*2%d33-126
|
|
398
|
-
`,r+=`DefinedAs = IncAlt / Defined
|
|
399
|
-
`,r+=`Defined = %d61
|
|
400
|
-
`,r+=`IncAlt = %d61.47
|
|
401
|
-
`,r+=`RuleError = 1*(%d32-126 / %d9 / LineContinue) LineEnd
|
|
402
|
-
`,r+=`LineEndError = 1*(%d32-126 / %d9 / LineContinue)
|
|
403
|
-
`,r+=`Alternation = Concatenation *(owsp AltOp Concatenation)
|
|
404
|
-
`,r+=`Concatenation = Repetition *(CatOp Repetition)
|
|
405
|
-
`,r+=`Repetition = [Modifier] (Group / Option / BasicElement / BasicElementErr)
|
|
406
|
-
`,r+=`Modifier = (Predicate [RepOp])
|
|
407
|
-
`,r+=` / RepOp
|
|
408
|
-
`,r+=`Predicate = BkaOp
|
|
409
|
-
`,r+=` / BknOp
|
|
410
|
-
`,r+=` / AndOp
|
|
411
|
-
`,r+=` / NotOp
|
|
412
|
-
`,r+=`BasicElement = UdtOp
|
|
413
|
-
`,r+=` / RnmOp
|
|
414
|
-
`,r+=` / TrgOp
|
|
415
|
-
`,r+=` / TbsOp
|
|
416
|
-
`,r+=` / TlsOp
|
|
417
|
-
`,r+=` / ClsOp
|
|
418
|
-
`,r+=` / BkrOp
|
|
419
|
-
`,r+=` / AbgOp
|
|
420
|
-
`,r+=` / AenOp
|
|
421
|
-
`,r+=` / ProsVal
|
|
422
|
-
`,r+=`BasicElementErr = 1*(%d33-40/%d42-46/%d48-92/%d94-126)
|
|
423
|
-
`,r+=`Group = GroupOpen Alternation (GroupClose / GroupError)
|
|
424
|
-
`,r+=`GroupError = 1*(%d33-40/%d42-46/%d48-92/%d94-126) ; same as BasicElementErr
|
|
425
|
-
`,r+=`GroupOpen = %d40 owsp
|
|
426
|
-
`,r+=`GroupClose = owsp %d41
|
|
427
|
-
`,r+=`Option = OptionOpen Alternation (OptionClose / OptionError)
|
|
428
|
-
`,r+=`OptionError = 1*(%d33-40/%d42-46/%d48-92/%d94-126) ; same as BasicElementErr
|
|
429
|
-
`,r+=`OptionOpen = %d91 owsp
|
|
430
|
-
`,r+=`OptionClose = owsp %d93
|
|
431
|
-
`,r+=`RnmOp = alphanum
|
|
432
|
-
`,r+=`BkrOp = %d92 [bkrModifier] bkr-name
|
|
433
|
-
`,r+=`bkrModifier = (cs [um / pm]) / (ci [um / pm]) / (um [cs /ci]) / (pm [cs / ci])
|
|
434
|
-
`,r+=`cs = '%s'
|
|
435
|
-
`,r+=`ci = '%i'
|
|
436
|
-
`,r+=`um = '%u'
|
|
437
|
-
`,r+=`pm = '%p'
|
|
438
|
-
`,r+=`bkr-name = uname / ename / rname
|
|
439
|
-
`,r+=`rname = alphanum
|
|
440
|
-
`,r+=`uname = %d117.95 alphanum
|
|
441
|
-
`,r+=`ename = %d101.95 alphanum
|
|
442
|
-
`,r+=`UdtOp = udt-empty
|
|
443
|
-
`,r+=` / udt-non-empty
|
|
444
|
-
`,r+=`udt-non-empty = %d117.95 alphanum
|
|
445
|
-
`,r+=`udt-empty = %d101.95 alphanum
|
|
446
|
-
`,r+=`RepOp = (rep-min StarOp rep-max)
|
|
447
|
-
`,r+=` / (rep-min StarOp)
|
|
448
|
-
`,r+=` / (StarOp rep-max)
|
|
449
|
-
`,r+=` / StarOp
|
|
450
|
-
`,r+=` / rep-min-max
|
|
451
|
-
`,r+=`AltOp = %d47 owsp
|
|
452
|
-
`,r+=`CatOp = wsp
|
|
453
|
-
`,r+=`StarOp = %d42
|
|
454
|
-
`,r+=`AndOp = %d38
|
|
455
|
-
`,r+=`NotOp = %d33
|
|
456
|
-
`,r+=`BkaOp = %d38.38
|
|
457
|
-
`,r+=`BknOp = %d33.33
|
|
458
|
-
`,r+=`AbgOp = %d37.94
|
|
459
|
-
`,r+=`AenOp = %d37.36
|
|
460
|
-
`,r+=`TrgOp = %d37 ((Dec dmin %d45 dmax) / (Hex xmin %d45 xmax) / (Bin bmin %d45 bmax))
|
|
461
|
-
`,r+=`TbsOp = %d37 ((Dec dString *(%d46 dString)) / (Hex xString *(%d46 xString)) / (Bin bString *(%d46 bString)))
|
|
462
|
-
`,r+=`TlsOp = TlsCase TlsOpen TlsString TlsClose
|
|
463
|
-
`,r+=`TlsCase = ["%i" / "%s"]
|
|
464
|
-
`,r+=`TlsOpen = %d34
|
|
465
|
-
`,r+=`TlsClose = %d34
|
|
466
|
-
`,r+=`TlsString = *(%d32-33/%d35-126/StringTab)
|
|
467
|
-
`,r+=`StringTab = %d9
|
|
468
|
-
`,r+=`ClsOp = ClsOpen ClsString ClsClose
|
|
469
|
-
`,r+=`ClsOpen = %d39
|
|
470
|
-
`,r+=`ClsClose = %d39
|
|
471
|
-
`,r+=`ClsString = *(%d32-38/%d40-126/StringTab)
|
|
472
|
-
`,r+=`ProsVal = ProsValOpen ProsValString ProsValClose
|
|
473
|
-
`,r+=`ProsValOpen = %d60
|
|
474
|
-
`,r+=`ProsValString = *(%d32-61/%d63-126/StringTab)
|
|
475
|
-
`,r+=`ProsValClose = %d62
|
|
476
|
-
`,r+=`rep-min = rep-num
|
|
477
|
-
`,r+=`rep-min-max = rep-num
|
|
478
|
-
`,r+=`rep-max = rep-num
|
|
479
|
-
`,r+=`rep-num = 1*(%d48-57)
|
|
480
|
-
`,r+=`dString = dnum
|
|
481
|
-
`,r+=`xString = xnum
|
|
482
|
-
`,r+=`bString = bnum
|
|
483
|
-
`,r+=`Dec = (%d68/%d100)
|
|
484
|
-
`,r+=`Hex = (%d88/%d120)
|
|
485
|
-
`,r+=`Bin = (%d66/%d98)
|
|
486
|
-
`,r+=`dmin = dnum
|
|
487
|
-
`,r+=`dmax = dnum
|
|
488
|
-
`,r+=`bmin = bnum
|
|
489
|
-
`,r+=`bmax = bnum
|
|
490
|
-
`,r+=`xmin = xnum
|
|
491
|
-
`,r+=`xmax = xnum
|
|
492
|
-
`,r+=`dnum = 1*(%d48-57)
|
|
493
|
-
`,r+=`bnum = 1*%d48-49
|
|
494
|
-
`,r+=`xnum = 1*(%d48-57 / %d65-70 / %d97-102)
|
|
495
|
-
`,r+=`;
|
|
496
|
-
`,r+=`; Basics
|
|
497
|
-
`,r+=`alphanum = (%d97-122/%d65-90) *(%d97-122/%d65-90/%d48-57/%d45)
|
|
498
|
-
`,r+=`owsp = *space
|
|
499
|
-
`,r+=`wsp = 1*space
|
|
500
|
-
`,r+=`space = %d32
|
|
501
|
-
`,r+=` / %d9
|
|
502
|
-
`,r+=` / comment
|
|
503
|
-
`,r+=` / LineContinue
|
|
504
|
-
`,r+=`comment = %d59 *(%d32-126 / %d9)
|
|
505
|
-
`,r+=`LineEnd = %d13.10
|
|
506
|
-
`,r+=` / %d10
|
|
507
|
-
`,r+=` / %d13
|
|
508
|
-
`,r+=`LineContinue = (%d13.10 / %d10 / %d13) (%d32 / %d9)
|
|
509
|
-
`,r}}),Ho}var $o,Pu;function Fb(){return Pu||(Pu=1,$o=function(){const t="parser: ",r=Ln,n=r.ids,i=new(Mb()),s=new(Lb()),o=new(Ub()),u=new r.parser;u.ast=new r.ast,u.callbacks=i.callbacks,u.ast.callbacks=s.callbacks;const l=function(c,g,h){if(g<0||g>=h)return-1;for(let b=0;b<c.length;b+=1)if(g>=c[b].beginChar&&g<c[b].beginChar+c[b].length)return b;return-1},a=function(c,g){let h=-1;if(g<c.length){for(let b=g;b<c.length;b+=1)if(c[b]!==null){h=c[b];break}}return h},f=function(c){c.forEach(g=>{const h=[],b=[];let P=0;g.opcodes.forEach(w=>{w.type===n.ALT&&w.children.length===1||w.type===n.CAT&&w.children.length===1||w.type===n.REP&&w.min===1&&w.max===1?b.push(null):(b.push(P),h.push(w),P+=1)}),b.push(P),h.forEach(w=>{if(w.type===n.ALT||w.type===n.CAT)for(let y=0;y<w.children.length;y+=1)w.children[y]=a(b,w.children[y])}),g.opcodes=h})};this.syntax=function(c,g,h,b,P,w){if(w){if(w.traceObject!=="traceObject")throw new TypeError(`${t}trace argument is not a trace object`);u.trace=w}const y={};y.errors=h,y.strict=!!b,y.lite=!!P,y.lines=g,y.findLine=l,y.charsLength=c.length,y.ruleCount=0,u.parse(o,"file",c,y).success||h.push({line:0,char:0,msg:"syntax analysis of input grammar failed"})},this.semantic=function(c,g,h){const b={};return b.errors=h,b.lines=g,b.findLine=l,b.charsLength=c.length,u.ast.translate(b),h.length?null:(f(b.rules),{rules:b.rules,udts:b.udts,lineMap:b.rulesLineMap})},this.generateSource=function(c,g,h,b,P){let w="",y=!1,v=!1;P&&(P.typescript?(y=!0,v=!1):P.lite&&(y=!1,v=!0));let p,B,k,R=0,T=1/0,N=0;const S=[],E=[];let x=0,A=0,O=0,I=0,L=0,H=0,V=0,D=0,j=0,$=0,F=0,M=0,ee=0,de=0,Q=0;h.forEach(Z=>{S.push(Z.lower),R+=Z.opcodes.length,Z.opcodes.forEach(te=>{switch(te.type){case n.ALT:x+=1;break;case n.CAT:A+=1;break;case n.RNM:O+=1;break;case n.UDT:I+=1;break;case n.REP:L+=1;break;case n.AND:H+=1;break;case n.NOT:V+=1;break;case n.BKA:M+=1;break;case n.BKN:ee+=1;break;case n.BKR:F+=1;break;case n.ABG:de+=1;break;case n.AEN:Q+=1;break;case n.TLS:for(D+=1,p=0;p<te.string.length;p+=1)te.string[p]<T&&(T=te.string[p]),te.string[p]>N&&(N=te.string[p]);break;case n.TBS:for(j+=1,p=0;p<te.string.length;p+=1)te.string[p]<T&&(T=te.string[p]),te.string[p]>N&&(N=te.string[p]);break;case n.TRG:$+=1,te.min<T&&(T=te.min),te.max>N&&(N=te.max);break;default:throw new Error("generateSource: unrecognized opcode")}})}),S.sort(),b.length>0&&(b.forEach(Z=>{E.push(Z.lower)}),E.sort()),w+=`// copyright: Copyright (c) 2024 Lowell D. Thomas, all rights reserved<br>
|
|
510
|
-
`,w+=`// license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)<br>
|
|
511
|
-
`,w+=`//
|
|
512
|
-
`,w+=`// Generated by apg-js, Version 4.4.0 [apg-js](https://github.com/ldthomas/apg-js)
|
|
513
|
-
`,P?P.funcName?w+=`const ${P.funcName} = function grammar(){
|
|
514
|
-
`:y?w+=`export function grammar(){
|
|
515
|
-
`:v?w+=`export default function grammar(){
|
|
516
|
-
`:w+=`module.exports = function grammar(){
|
|
517
|
-
`:w+=`module.exports = function grammar(){
|
|
518
|
-
`,w+=" // ```\n",w+=` // SUMMARY
|
|
519
|
-
`,w+=` // rules = ${h.length}
|
|
520
|
-
`,w+=` // udts = ${b.length}
|
|
521
|
-
`,w+=` // opcodes = ${R}
|
|
522
|
-
`,w+=` // --- ABNF original opcodes
|
|
523
|
-
`,w+=` // ALT = ${x}
|
|
524
|
-
`,w+=` // CAT = ${A}
|
|
525
|
-
`,w+=` // REP = ${L}
|
|
526
|
-
`,w+=` // RNM = ${O}
|
|
527
|
-
`,w+=` // TLS = ${D}
|
|
528
|
-
`,w+=` // TBS = ${j}
|
|
529
|
-
`,w+=` // TRG = ${$}
|
|
530
|
-
`,w+=` // --- SABNF superset opcodes
|
|
531
|
-
`,w+=` // UDT = ${I}
|
|
532
|
-
`,w+=` // AND = ${H}
|
|
533
|
-
`,w+=` // NOT = ${V}
|
|
534
|
-
`,v||(w+=` // BKA = ${M}
|
|
535
|
-
`,w+=` // BKN = ${ee}
|
|
536
|
-
`,w+=` // BKR = ${F}
|
|
537
|
-
`,w+=` // ABG = ${de}
|
|
538
|
-
`,w+=` // AEN = ${Q}
|
|
539
|
-
`),w+=" // characters = [",D+j+$===0?w+=" none defined ]":w+=`${T} - ${N}]`,I>0&&(w+=" + user defined"),w+=`
|
|
540
|
-
`,w+=" // ```\n",w+=` /* OBJECT IDENTIFIER (for internal parser use) */
|
|
541
|
-
`,w+=` this.grammarObject = 'grammarObject';
|
|
542
|
-
`,w+=`
|
|
543
|
-
`,w+=` /* RULES */
|
|
544
|
-
`,w+=` this.rules = [];
|
|
545
|
-
`,h.forEach((Z,te)=>{let re=" this.rules[";re+=te,re+="] = { name: '",re+=Z.name,re+="', lower: '",re+=Z.lower,re+="', index: ",re+=Z.index,re+=", isBkr: ",re+=Z.isBkr,re+=` };
|
|
546
|
-
`,w+=re}),w+=`
|
|
547
|
-
`,w+=` /* UDTS */
|
|
548
|
-
`,w+=` this.udts = [];
|
|
549
|
-
`,b.length>0&&b.forEach((Z,te)=>{let re=" this.udts[";re+=te,re+="] = { name: '",re+=Z.name,re+="', lower: '",re+=Z.lower,re+="', index: ",re+=Z.index,re+=", empty: ",re+=Z.empty,re+=", isBkr: ",re+=Z.isBkr,re+=` };
|
|
550
|
-
`,w+=re}),w+=`
|
|
551
|
-
`,w+=` /* OPCODES */
|
|
552
|
-
`,h.forEach((Z,te)=>{te>0&&(w+=`
|
|
553
|
-
`),w+=` /* ${Z.name} */
|
|
554
|
-
`,w+=` this.rules[${te}].opcodes = [];
|
|
555
|
-
`,Z.opcodes.forEach((re,K)=>{let W;switch(re.type){case n.ALT:w+=` this.rules[${te}].opcodes[${K}] = { type: ${re.type}, children: [${re.children.toString()}] };// ALT
|
|
556
|
-
`;break;case n.CAT:w+=` this.rules[${te}].opcodes[${K}] = { type: ${re.type}, children: [${re.children.toString()}] };// CAT
|
|
557
|
-
`;break;case n.RNM:w+=` this.rules[${te}].opcodes[${K}] = { type: ${re.type}, index: ${re.index} };// RNM(${h[re.index].name})
|
|
558
|
-
`;break;case n.BKR:re.index>=h.length?(B=b[re.index-h.length].name,k=b[re.index-h.length].lower):(B=h[re.index].name,k=h[re.index].lower),W="%i",re.bkrCase===n.BKR_MODE_CS&&(W="%s"),re.bkrMode===n.BKR_MODE_UM?W+="%u":W+="%p",B=W+B,w+=` this.rules[${te}].opcodes[${K}] = { type: ${re.type}, index: ${re.index}, lower: '${k}', bkrCase: ${re.bkrCase}, bkrMode: ${re.bkrMode} };// BKR(\\${B})
|
|
559
|
-
`;break;case n.UDT:w+=` this.rules[${te}].opcodes[${K}] = { type: ${re.type}, empty: ${re.empty}, index: ${re.index} };// UDT(${b[re.index].name})
|
|
560
|
-
`;break;case n.REP:w+=` this.rules[${te}].opcodes[${K}] = { type: ${re.type}, min: ${re.min}, max: ${re.max} };// REP
|
|
561
|
-
`;break;case n.AND:w+=` this.rules[${te}].opcodes[${K}] = { type: ${re.type} };// AND
|
|
562
|
-
`;break;case n.NOT:w+=` this.rules[${te}].opcodes[${K}] = { type: ${re.type} };// NOT
|
|
563
|
-
`;break;case n.ABG:w+=` this.rules[${te}].opcodes[${K}] = { type: ${re.type} };// ABG(%^)
|
|
564
|
-
`;break;case n.AEN:w+=` this.rules[${te}].opcodes[${K}] = { type: ${re.type} };// AEN(%$)
|
|
565
|
-
`;break;case n.BKA:w+=` this.rules[${te}].opcodes[${K}] = { type: ${re.type} };// BKA
|
|
566
|
-
`;break;case n.BKN:w+=` this.rules[${te}].opcodes[${K}] = { type: ${re.type} };// BKN
|
|
567
|
-
`;break;case n.TLS:w+=` this.rules[${te}].opcodes[${K}] = { type: ${re.type}, string: [${re.string.toString()}] };// TLS
|
|
568
|
-
`;break;case n.TBS:w+=` this.rules[${te}].opcodes[${K}] = { type: ${re.type}, string: [${re.string.toString()}] };// TBS
|
|
569
|
-
`;break;case n.TRG:w+=` this.rules[${te}].opcodes[${K}] = { type: ${re.type}, min: ${re.min}, max: ${re.max} };// TRG
|
|
570
|
-
`;break;default:throw new Error("parser.js: ~143: unrecognized opcode")}})}),w+=`
|
|
571
|
-
`,w+=" // The `toString()` function will display the original grammar file(s) that produced these opcodes.\n",w+=` this.toString = function toString(){
|
|
572
|
-
`,w+=` let str = "";
|
|
573
|
-
`;let ae;return g.forEach(Z=>{const te=Z.beginChar+Z.length;ae="",w+=' str += "';for(let re=Z.beginChar;re<te;re+=1){switch(c[re]){case 9:ae=" ";break;case 10:ae="\\n";break;case 13:ae="\\r";break;case 34:ae='\\"';break;case 92:ae="\\\\";break;default:ae=String.fromCharCode(c[re]);break}w+=ae}w+=`";
|
|
574
|
-
`}),w+=` return str;
|
|
575
|
-
`,w+=` }
|
|
576
|
-
`,w+=`}
|
|
577
|
-
`,w},this.generateObject=function(c,g,h){const b={},P=[],w=[],y=c.slice(0);return b.grammarObject="grammarObject",g.forEach(v=>{P.push(v.lower)}),P.sort(),h.length>0&&(h.forEach(v=>{w.push(v.lower)}),w.sort()),b.callbacks=[],P.forEach(v=>{b.callbacks[v]=!1}),h.length>0&&w.forEach(v=>{b.callbacks[v]=!1}),b.rules=g,b.udts=h,b.toString=function(){return y},b}}),$o}var Go,Tu;function jb(){return Tu||(Tu=1,Go=function(){const t=ir,r="rule-attributes.js";let n=null;function i(S){return S.left||S.nested||S.right||S.cyclic?!1:S.empty}function s(S){return!!(S.left||S.nested||S.right||S.cyclic)}function o(S,E){let x=0,A=0,O=0;for(x=0;x<E;x+=1)if(S[x].nested)return!0;for(x=0;x<E;x+=1)if(S[x].right&&!S[x].leaf){for(A=x+1;A<E;A+=1)if(!i(S[A]))return!0}for(x=E-1;x>=0;x-=1)if(S[x].left&&!S[x].leaf){for(A=x-1;A>=0;A-=1)if(!i(S[A]))return!0}for(x=0;x<E;x+=1)if(!S[x].empty&&!s(S[x])){for(A=x+1;A<E;A+=1)if(s(S[A])){for(O=A+1;O<E;O+=1)if(!S[O].empty&&!s(S[O]))return!0}}return!1}function u(S,E){for(let x=0;x<E;x+=1)if(!S[x].cyclic)return!1;return!0}function l(S,E){for(let x=0;x<E;x+=1){if(S[x].left)return!0;if(!S[x].empty)return!1}return!1}function a(S,E){for(let x=E-1;x>=0;x-=1){if(S[x].right)return!0;if(!S[x].empty)return!1}return!1}function f(S,E){for(let x=0;x<E;x+=1)if(!S[x].empty)return!1;return!0}function d(S,E){for(let x=0;x<E;x+=1)if(!S[x].finite)return!1;return!0}function c(S,E,x,A){let O=0;const I=E[x],L=I.children.length,H=[];for(O=0;O<L;O+=1)H.push(S.attrGen());for(O=0;O<L;O+=1)b(S,E,I.children[O],H[O]);A.left=l(H,L),A.right=a(H,L),A.nested=o(H,L),A.empty=f(H,L),A.finite=d(H,L),A.cyclic=u(H,L)}function g(S,E,x,A){let O=0;const I=E[x],L=I.children.length,H=[];for(O=0;O<L;O+=1)H.push(S.attrGen());for(O=0;O<L;O+=1)b(S,E,I.children[O],H[O]);for(A.left=!1,A.right=!1,A.nested=!1,A.empty=!1,A.finite=!1,A.cyclic=!1,O=0;O<L;O+=1)H[O].left&&(A.left=!0),H[O].nested&&(A.nested=!0),H[O].right&&(A.right=!0),H[O].empty&&(A.empty=!0),H[O].finite&&(A.finite=!0),H[O].cyclic&&(A.cyclic=!0)}function h(S,E,x,A){const O=E[x];O.index>=S.ruleCount?(A.empty=S.udts[O.index-S.ruleCount].empty,A.finite=!0):(P(S,O.index,A),A.left=!1,A.nested=!1,A.right=!1,A.cyclic=!1)}function b(S,E,x,A){S.attrInit(A);const O=E[x];switch(O.type){case t.ALT:g(S,E,x,A);break;case t.CAT:c(S,E,x,A);break;case t.REP:b(S,E,x+1,A),O.min===0&&(A.empty=!0,A.finite=!0);break;case t.RNM:P(S,E[x].index,A);break;case t.BKR:h(S,E,x,A);break;case t.AND:case t.NOT:case t.BKA:case t.BKN:b(S,E,x+1,A),A.empty=!0;break;case t.TLS:A.empty=!E[x].string.length,A.finite=!0,A.cyclic=!1;break;case t.TBS:case t.TRG:A.empty=!1,A.finite=!0,A.cyclic=!1;break;case t.UDT:A.empty=O.empty,A.finite=!0,A.cyclic=!1;break;case t.ABG:case t.AEN:A.empty=!0,A.finite=!0,A.cyclic=!1;break;default:throw new Error(`unknown opcode type: ${O}`)}}function P(S,E,x){const A=S.attrsWorking[E];A.isComplete?S.attrCopy(x,A):A.isOpen?E===S.startRule?E===S.startRule&&(x.left=!0,x.right=!0,x.cyclic=!0,x.leaf=!0):x.finite=!0:(A.isOpen=!0,b(S,A.rule.opcodes,0,x),A.left=x.left,A.right=x.right,A.nested=x.nested,A.empty=x.empty,A.finite=x.finite,A.cyclic=x.cyclic,A.leaf=!1,A.isOpen=!1,A.isComplete=!0)}const w=S=>{n=S;let E=0,x=0;const A=n.attrGen();for(E=0;E<n.ruleCount;E+=1){for(x=0;x<n.ruleCount;x+=1)n.attrInit(n.attrsWorking[x]);n.startRule=E,P(n,E,A),n.attrCopy(n.attrs[E],n.attrsWorking[E])}n.attributesComplete=!0;let O=null;for(E=0;E<n.ruleCount;E+=1)if(O=n.attrs[E],O.left||!O.finite||O.cyclic){const I=n.attrGen(O.rule);n.attrCopy(I,O),n.attrsErrors.push(I),n.attrsErrorCount+=1}},y=S=>S?"t":"f",v=S=>S?"e":"f",p=S=>S?"t":"e",B=(S,E,x,A)=>{let O=`${S}:${E}:`;return O+=`${v(x.left)} `,O+=`${y(x.nested)} `,O+=`${y(x.right)} `,O+=`${v(x.cyclic)} `,O+=`${p(x.finite)} `,O+=`${y(x.empty)}:`,O+=`${n.typeToString(A.recursiveType)}:`,O+=A.recursiveType===t.ATTR_MR?A.groupNumber:"-",O+=`:${x.rule.name}
|
|
578
|
-
`,O},k=()=>{let S=`LEGEND - t=true, f=false, e=error
|
|
579
|
-
`;return S+=`sequence:rule index:left nested right cyclic finite empty:type:group number:rule name
|
|
580
|
-
`,S},R=()=>{let S=null,E=null,x="";if(x+=`RULE ATTRIBUTES WITH ERRORS
|
|
581
|
-
`,x+=k(),n.attrsErrorCount)for(let A=0;A<n.attrsErrorCount;A+=1)S=n.attrsErrors[A],E=n.ruleDeps[S.rule.index],x+=B(A,S.rule.index,S,E);else x+=`<none>
|
|
582
|
-
`;return x},T=S=>{let E=0,x=0,A=null,O=null,I="",{ruleIndexes:L}=n;for(S===97?L=n.ruleAlphaIndexes:S===116&&(L=n.ruleTypeIndexes),E=0;E<n.ruleCount;E+=1)x=L[E],A=n.attrs[x],O=n.ruleDeps[x],I+=B(E,x,A,O);return I};return{ruleAttributes:w,showAttributes:(S="index")=>{if(!n.attributesComplete)throw new Error(`${r}:showAttributes: attributes not available`);let E="";const x=`RULE ATTRIBUTES
|
|
583
|
-
`;return S.charCodeAt(0)===97?(E+=`alphabetical by rule name
|
|
584
|
-
`,E+=x,E+=k(),E+=T(97)):S.charCodeAt(0)===116?(E+=`ordered by rule type
|
|
585
|
-
`,E+=x,E+=k(),E+=T(116)):(E+=`ordered by rule index
|
|
586
|
-
`,E+=x,E+=k(),E+=T()),E},showAttributeErrors:R}}()),Go}var Ko,Su;function Db(){return Su||(Su=1,Ko=(()=>{const e=ir;let t=null;const r=(o,u,l,a)=>{let f=0,d=0;const c=u[l];a[l]=!0;const g=c.rule.opcodes;for(f=0;f<g.length;f+=1){const h=g[f];if(h.type===e.RNM)for(c.refersTo[h.index]=!0,a[h.index]||r(o,u,h.index,a),d=0;d<o;d+=1)u[h.index].refersTo[d]&&(c.refersTo[d]=!0);else h.type===e.UDT?c.refersToUdt[h.index]=!0:h.type===e.BKR&&(h.index<o?(c.refersTo[h.index]=!0,a[h.index]||r(o,u,h.index,a)):c.refersToUdt[o-h.index]=!0)}},n=o=>{t=o;let u=0,l=0,a=0,f=null,d=null,c=!1;t.dependenciesComplete=!1;const g=t.falseArray(t.ruleCount);for(u=0;u<t.ruleCount;u+=1)t.falsifyArray(g),r(t.ruleCount,t.ruleDeps,u,g);for(u=0;u<t.ruleCount;u+=1)for(l=0;l<t.ruleCount;l+=1)u!==l&&t.ruleDeps[l].refersTo[u]&&(t.ruleDeps[u].referencedBy[l]=!0);for(u=0;u<t.ruleCount;u+=1)t.ruleDeps[u].recursiveType=e.ATTR_N,t.ruleDeps[u].refersTo[u]&&(t.ruleDeps[u].recursiveType=e.ATTR_R);for(a=-1,u=0;u<t.ruleCount;u+=1)if(f=t.ruleDeps[u],f.recursiveType===e.ATTR_R)for(c=!0,l=0;l<t.ruleCount;l+=1)u!==l&&(d=t.ruleDeps[l],d.recursiveType===e.ATTR_R&&f.refersTo[l]&&d.refersTo[u]&&(c&&(a+=1,f.recursiveType=e.ATTR_MR,f.groupNumber=a,c=!1),d.recursiveType=e.ATTR_MR,d.groupNumber=a));t.isMutuallyRecursive=a>-1,t.ruleAlphaIndexes.sort(t.compRulesAlpha),t.ruleTypeIndexes.sort(t.compRulesAlpha),t.ruleTypeIndexes.sort(t.compRulesType),t.isMutuallyRecursive&&t.ruleTypeIndexes.sort(t.compRulesGroup),t.udtCount&&t.udtAlphaIndexes.sort(t.compUdtsAlpha),t.dependenciesComplete=!0},i=(o=null)=>{let u=0,l=0,a=0,f=0;const d=t.ruleCount-1,c=t.udtCount-1,g=100;let h="",b="";const P="=> ",w="<= ";let y=!1,v=null,{ruleIndexes:p}=t,{udtIndexes:B}=t;for(o===97?(p=t.ruleAlphaIndexes,B=t.udtAlphaIndexes):o===116&&(p=t.ruleTypeIndexes,B=t.udtAlphaIndexes),u=0;u<t.ruleCount;u+=1){for(v=t.ruleDeps[p[u]],b=`${p[u]}:${t.typeToString(v.recursiveType)}:`,t.isMutuallyRecursive&&(b+=v.groupNumber>-1?v.groupNumber:"-",b+=":"),b+=" ",h+=`${b+t.rules[p[u]].name}
|
|
587
|
-
`,y=!0,a=0,f=h.length,h+=b,l=0;l<t.ruleCount;l+=1)v.refersTo[p[l]]&&(y?(h+=P,y=!1,h+=t.ruleDeps[p[l]].rule.name):h+=`, ${t.ruleDeps[p[l]].rule.name}`,a+=1),h.length-f>g&&l!==d&&(h+=`
|
|
588
|
-
${b}${P}`,f=h.length);if(t.udtCount)for(l=0;l<t.udtCount;l+=1)v.refersToUdt[B[l]]&&(y?(h+=P,y=!1,h+=t.udts[B[l]].name):h+=`, ${t.udts[B[l]].name}`,a+=1),h.length-f>g&&l!==c&&(h+=`
|
|
589
|
-
${b}${P}`,f=h.length);for(a===0&&(h+=`=> <none>
|
|
590
|
-
`),y===!1&&(h+=`
|
|
591
|
-
`),y=!0,a=0,f=h.length,h+=b,l=0;l<t.ruleCount;l+=1)v.referencedBy[p[l]]&&(y?(h+=w,y=!1,h+=t.ruleDeps[p[l]].rule.name):h+=`, ${t.ruleDeps[p[l]].rule.name}`,a+=1),h.length-f>g&&l!==d&&(h+=`
|
|
592
|
-
${b}${P}`,f=h.length);a===0&&(h+=`<= <none>
|
|
593
|
-
`),y===!1&&(h+=`
|
|
594
|
-
`),h+=`
|
|
595
|
-
`}return h};return{ruleDependencies:n,showRuleDependencies:(o="index")=>{let u=`RULE DEPENDENCIES(index:type:[group number:])
|
|
596
|
-
`;return u+=`=> refers to rule names
|
|
597
|
-
`,u+=`<= referenced by rule names
|
|
598
|
-
`,t.dependenciesComplete&&(o.charCodeAt(0)===97?(u+=`alphabetical by rule name
|
|
599
|
-
`,u+=i(97)):o.charCodeAt(0)===116?(u+=`ordered by rule type
|
|
600
|
-
`,u+=i(116)):(u+=`ordered by rule index
|
|
601
|
-
`,u+=i(null))),u}}})()),Ko}var qo,Ou;function Hb(){return Ou||(Ou=1,qo=function(){const t=ir,{ruleAttributes:r,showAttributes:n,showAttributeErrors:i}=jb(),{ruleDependencies:s,showRuleDependencies:o}=Db();class u{constructor(f,d){this.rules=f,this.udts=d,this.ruleCount=f.length,this.udtCount=d.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 c=0;c<this.ruleCount;c+=1)this.attrs.push(this.attrGen(this.rules[c])),this.attrsWorking.push(this.attrGen(this.rules[c])),this.ruleDeps.push(this.rdGen(f[c],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(f){return{left:!1,nested:!1,right:!1,empty:!1,finite:!1,cyclic:!1,leaf:!1,isOpen:!1,isComplete:!1,rule:f}}attrInit(f){f.left=!1,f.nested=!1,f.right=!1,f.empty=!1,f.finite=!1,f.cyclic=!1,f.leaf=!1,f.isOpen=!1,f.isComplete=!1}attrCopy(f,d){f.left=d.left,f.nested=d.nested,f.right=d.right,f.empty=d.empty,f.finite=d.finite,f.cyclic=d.cyclic,f.leaf=d.leaf,f.isOpen=d.isOpen,f.isComplete=d.isComplete,f.rule=d.rule}rdGen(f,d,c){return{rule:f,recursiveType:t.ATTR_N,groupNumber:-1,refersTo:this.falseArray(d),refersToUdt:this.falseArray(c),referencedBy:this.falseArray(d)}}typeToString(f){switch(f){case t.ATTR_N:return" N";case t.ATTR_R:return" R";case t.ATTR_MR:return"MR";default:return"UNKNOWN"}}falseArray(f){const d=[];if(f>0)for(let c=0;c<f;c+=1)d.push(!1);return d}falsifyArray(f){for(let d=0;d<f.length;d+=1)f[d]=!1}indexArray(f){const d=[];if(f>0)for(let c=0;c<f;c+=1)d.push(c);return d}compRulesAlpha(f,d){return this.rules[f].lower<this.rules[d].lower?-1:this.rules[f].lower>this.rules[d].lower?1:0}compUdtsAlpha(f,d){return this.udts[f].lower<this.udts[d].lower?-1:this.udts[f].lower>this.udts[d].lower?1:0}compRulesType(f,d){return this.ruleDeps[f].recursiveType<this.ruleDeps[d].recursiveType?-1:this.ruleDeps[f].recursiveType>this.ruleDeps[d].recursiveType?1:0}compRulesGroup(f,d){if(this.ruleDeps[f].recursiveType===t.ATTR_MR&&this.ruleDeps[d].recursiveType===t.ATTR_MR){if(this.ruleDeps[f].groupNumber<this.ruleDeps[d].groupNumber)return-1;if(this.ruleDeps[f].groupNumber>this.ruleDeps[d].groupNumber)return 1}return 0}}return{attributes:function(f=[],d=[],c=[],g=[]){const h=new u(f,d);return s(h),r(h),h.attrsErrorCount&&g.push({line:0,char:0,msg:`${h.attrsErrorCount} attribute errors`}),h.attrsErrorCount},showAttributes:n,showAttributeErrors:i,showRuleDependencies:o}}()),qo}var Vo,Bu;function $b(){return Bu||(Bu=1,Vo=function(){const t="show-rules.js";return function(i=[],s=[],o="index"){const u="showRules";let l=[],a=[];const f=[],d=[],c=i,g=s,h=i.length,b=s.length;let P="RULE/UDT NAMES",w;function y(p,B){return c[p].lower<c[B].lower?-1:c[p].lower>c[B].lower?1:0}function v(p,B){return g[p].lower<g[B].lower?-1:g[p].lower>g[B].lower?1:0}if(!(Array.isArray(i)&&i.length))throw new Error(`${t}:${u}: rules arg must be array with length > 0`);if(!Array.isArray(s))throw new Error(`${t}:${u}: udts arg must be array`);for(w=0;w<h;w+=1)f.push(w);if(l=f.slice(0),l.sort(y),b){for(w=0;w<b;w+=1)d.push(w);a=d.slice(0),a.sort(v)}if(o.charCodeAt(0)===97){for(P+=` - alphabetical by rule/UDT name
|
|
602
|
-
`,w=0;w<h;w+=1)P+=`${w}: ${l[w]}: ${c[l[w]].name}
|
|
603
|
-
`;if(b)for(w=0;w<b;w+=1)P+=`${w}: ${a[w]}: ${g[a[w]].name}
|
|
604
|
-
`}else{for(P+=` - ordered by rule/UDT index
|
|
605
|
-
`,w=0;w<h;w+=1)P+=`${w}: ${c[w].name}
|
|
606
|
-
`;if(b)for(w=0;w<b;w+=1)P+=`${w}: ${g[w].name}
|
|
607
|
-
`}return P}}()),Vo}var Gb=function(t){const{Buffer:r}=Ar,n="api.js: ",i=this,s=Ln,o=f0(),u=Ib(),l=new(Fb()),{attributes:a,showAttributes:f,showAttributeErrors:d,showRuleDependencies:c}=Hb(),g=$b(),h=function(E,x,A){const H=`<span class="${s.style.CLASS_CTRLCHAR}">`,V="</span>",D=`<span class="${s.style.CLASS_NOMATCH}">`,j="</span>";let $,F="";const M=!0;for(;M&&!(!Array.isArray(E)||E.length===0);){if(typeof x!="number")throw new Error("abnfToHtml: beg must be type number");if(x>=E.length)break;typeof A!="number"||x+A>=E.length?$=E.length:$=x+A;let ee=0;for(let de=x;de<$;de+=1){const Q=E[de];if(Q>=32&&Q<=126)switch(ee===1?(F+=V,ee=0):ee===2&&(F+=j,ee=0),Q){case 32:F+=" ";break;case 60:F+="<";break;case 62:F+=">";break;case 38:F+="&";break;case 34:F+=""";break;case 39:F+="'";break;case 92:F+="\";break;default:F+=String.fromCharCode(Q);break}else Q===9||Q===10||Q===13?(ee===0?(F+=H,ee=1):ee===2&&(F+=j+H,ee=1),Q===9&&(F+="TAB"),Q===10&&(F+="LF"),Q===13&&(F+="CR")):(ee===0?(F+=D,ee=2):ee===1&&(F+=V+D,ee=2),F+=`\\x${s.utils.charToHex(Q)}`)}ee===2&&(F+=j),ee===1&&(F+=V);break}return F},b=function(E,x,A){let O="";for(let I=x;I<x+A;I+=1){const L=E[I];if(L>=32&&L<=126)O+=String.fromCharCode(L);else switch(L){case 9:O+="\\t";break;case 10:O+="\\n";break;case 13:O+="\\r";break;default:O+="\\unknown";break}}return O},P=function(E){let x="Annotated Input Grammar";return E.forEach(A=>{x+=`
|
|
608
|
-
`,x+=`line no: ${A.lineNo}`,x+=` : char index: ${A.beginChar}`,x+=` : length: ${A.length}`,x+=` : abnf: ${b(i.chars,A.beginChar,A.length)}`}),x+=`
|
|
609
|
-
`,x},w=function(E){let x="";return x+=`<table class="${s.style.CLASS_GRAMMAR}">
|
|
610
|
-
`,x+=`<caption>Annotated Input Grammar</caption>
|
|
611
|
-
`,x+="<tr>",x+="<th>line<br>no.</th><th>first<br>char</th><th><br>length</th><th><br>text</th>",x+=`</tr>
|
|
612
|
-
`,E.forEach(O=>{x+="<tr>",x+=`<td>${O.lineNo}`,x+=`</td><td>${O.beginChar}`,x+=`</td><td>${O.length}`,x+=`</td><td>${h(i.chars,O.beginChar,O.length)}`,x+="</td>",x+=`</tr>
|
|
613
|
-
`}),x+=`</table>
|
|
614
|
-
`,x},y=function(E,x,A,O){const[I]=s;let L="";const H=`<span class="${I.CLASS_NOMATCH}">»</span>`;return L+=`<p><table class="${I.CLASS_GRAMMAR}">
|
|
615
|
-
`,O&&typeof O=="string"&&(L+=`<caption>${O}</caption>
|
|
616
|
-
`),L+=`<tr><th>line<br>no.</th><th>line<br>offset</th><th>error<br>offset</th><th><br>text</th></tr>
|
|
617
|
-
`,E.forEach(V=>{let D,j,$,F,M,ee="",de="";x.length===0?(M=H,j=0):(D=x[V.line],$=D.beginChar,V.char>$&&(ee=h(A,$,V.char-$)),$=V.char,F=D.beginChar+D.length,$<F&&(de=h(A,$,F-$)),M=ee+H+de,j=V.char-D.beginChar,L+="<tr>",L+=`<td>${V.line}</td><td>${D.beginChar}</td><td>${j}</td><td>${M}</td>`,L+=`</tr>
|
|
618
|
-
`,L+="<tr>",L+=`<td colspan="3"></td><td>↑: ${s.utils.stringToAsciiHtml(V.msg)}</td>`,L+=`</tr>
|
|
619
|
-
`)}),L+=`</table></p>
|
|
620
|
-
`,L},v=function(E,x,A){let O,I,L,H;return O="",E.forEach(V=>{I=x[V.line],O+=`${I.lineNo}: `,O+=`${I.beginChar}: `,O+=`${V.char-I.beginChar}: `,L=I.beginChar,H=V.char-I.beginChar,O+=b(A,L,H),O+=" >> ",L=V.char,H=I.beginChar+I.length-V.char,O+=b(A,L,H),O+=`
|
|
621
|
-
`,O+=`${I.lineNo}: `,O+=`${I.beginChar}: `,O+=`${V.char-I.beginChar}: `,O+="error: ",O+=V.msg,O+=`
|
|
622
|
-
`}),O};let p=!1,B=!1,k=!1,R=!1,T=0,N;if(this.errors=[],r.isBuffer(t))this.chars=o.decode("BINARY",t);else if(Array.isArray(t))this.chars=t.slice();else if(typeof t=="string")this.chars=o.decode("STRING",t);else throw new Error(`${n}input source is not a string, byte Buffer or character array`);this.sabnf=o.encode("STRING",this.chars),this.scan=function(E,x){this.lines=u(this.chars,this.errors,E,x),p=!0},this.parse=function(E,x,A){if(!p)throw new Error(`${n}grammar not scanned`);l.syntax(this.chars,this.lines,this.errors,E,x,A),B=!0},this.translate=function(){if(!B)throw new Error(`${n}grammar not scanned and parsed`);const E=l.semantic(this.chars,this.lines,this.errors);this.errors.length===0&&(this.rules=E.rules,this.udts=E.udts,N=E.lineMap,k=!0)},this.attributes=function(){if(!k)throw new Error(`${n}grammar not scanned, parsed and translated`);return T=a(this.rules,this.udts,N,this.errors),R=!0,T},this.generate=function(E){if(this.lines=u(this.chars,this.errors,E),this.errors.length||(l.syntax(this.chars,this.lines,this.errors,E),this.errors.length))return;const x=l.semantic(this.chars,this.lines,this.errors);this.errors.length||(this.rules=x.rules,this.udts=x.udts,N=x.lineMap,T=a(this.rules,this.udts,N,this.errors),R=!0)},this.displayRules=function(E="index"){if(!k)throw new Error(`${n}grammar not scanned, parsed and translated`);return g(this.rules,this.udts,E)},this.displayRuleDependencies=function(E="index"){if(!R)throw new Error(`${n}no attributes - must be preceeded by call to attributes()`);return c(E)},this.displayAttributes=function(E="index"){if(!R)throw new Error(`${n}no attributes - must be preceeded by call to attributes()`);return T&&d(E),f(E)},this.displayAttributeErrors=function(){if(!R)throw new Error(`${n}no attributes - must be preceeded by call to attributes()`);return d()},this.toSource=function(E=void 0){if(!R)throw new Error(`${n}can't generate parser source - must be preceeded by call to attributes()`);if(T)throw new Error(`${n}can't generate parser source - attributes have ${T} errors`);return l.generateSource(this.chars,this.lines,this.rules,this.udts,E)},this.toObject=function(){if(!R)throw new Error(`${n}can't generate parser source - must be preceeded by call to attributes()`);if(T)throw new Error(`${n}can't generate parser source - attributes have ${T} errors`);return l.generateObject(this.sabnf,this.rules,this.udts)},this.errorsToAscii=function(){return v(this.errors,this.lines,this.chars)},this.errorsToHtml=function(E){return y(this.errors,this.lines,this.chars,E)},this.linesToAscii=function(){return P(this.lines)},this.linesToHtml=function(){return w(this.lines)}},dn={},rt={},Yt={};Object.defineProperty(Yt,"__esModule",{value:!0});Yt.isBytes=b0;Yt.number=$s;Yt.bool=p0;Yt.bytes=_c;Yt.hash=g0;Yt.exists=m0;Yt.output=y0;function $s(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function p0(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}function b0(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function _c(e,...t){if(!b0(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function g0(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");$s(e.outputLen),$s(e.blockLen)}function m0(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function y0(e,t){_c(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}const Kb={number:$s,bool:p0,bytes:_c,hash:g0,exists:m0,output:y0};Yt.default=Kb;var je={};Object.defineProperty(je,"__esModule",{value:!0});je.add5L=je.add5H=je.add4H=je.add4L=je.add3H=je.add3L=je.rotlBL=je.rotlBH=je.rotlSL=je.rotlSH=je.rotr32L=je.rotr32H=je.rotrBL=je.rotrBH=je.rotrSL=je.rotrSH=je.shrSL=je.shrSH=je.toBig=void 0;je.fromBig=kc;je.split=x0;je.add=N0;const Ts=BigInt(2**32-1),La=BigInt(32);function kc(e,t=!1){return t?{h:Number(e&Ts),l:Number(e>>La&Ts)}:{h:Number(e>>La&Ts)|0,l:Number(e&Ts)|0}}function x0(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:s,l:o}=kc(e[i],t);[r[i],n[i]]=[s,o]}return[r,n]}const w0=(e,t)=>BigInt(e>>>0)<<La|BigInt(t>>>0);je.toBig=w0;const A0=(e,t,r)=>e>>>r;je.shrSH=A0;const E0=(e,t,r)=>e<<32-r|t>>>r;je.shrSL=E0;const v0=(e,t,r)=>e>>>r|t<<32-r;je.rotrSH=v0;const _0=(e,t,r)=>e<<32-r|t>>>r;je.rotrSL=_0;const k0=(e,t,r)=>e<<64-r|t>>>r-32;je.rotrBH=k0;const P0=(e,t,r)=>e>>>r-32|t<<64-r;je.rotrBL=P0;const T0=(e,t)=>t;je.rotr32H=T0;const S0=(e,t)=>e;je.rotr32L=S0;const O0=(e,t,r)=>e<<r|t>>>32-r;je.rotlSH=O0;const B0=(e,t,r)=>t<<r|e>>>32-r;je.rotlSL=B0;const C0=(e,t,r)=>t<<r-32|e>>>64-r;je.rotlBH=C0;const R0=(e,t,r)=>e<<r-32|t>>>64-r;je.rotlBL=R0;function N0(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}const I0=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);je.add3L=I0;const M0=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;je.add3H=M0;const L0=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);je.add4L=L0;const U0=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;je.add4H=U0;const F0=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);je.add5L=F0;const j0=(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0;je.add5H=j0;const qb={fromBig:kc,split:x0,toBig:w0,shrSH:A0,shrSL:E0,rotrSH:v0,rotrSL:_0,rotrBH:k0,rotrBL:P0,rotr32H:T0,rotr32L:S0,rotlSH:O0,rotlSL:B0,rotlBH:C0,rotlBL:R0,add:N0,add3L:I0,add3H:M0,add4L:L0,add4H:U0,add5H:j0,add5L:F0};je.default=qb;var Pc={},ro={};Object.defineProperty(ro,"__esModule",{value:!0});ro.crypto=void 0;ro.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;(function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.nextTick=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=void 0,e.isBytes=n,e.byteSwap32=f,e.bytesToHex=c,e.hexToBytes=b,e.asyncLoop=w,e.utf8ToBytes=y,e.toBytes=v,e.concatBytes=p,e.checkOpts=R,e.wrapConstructor=T,e.wrapConstructorWithOpts=N,e.wrapXOFConstructorWithOpts=S,e.randomBytes=E;const t=ro,r=Yt;function n(x){return x instanceof Uint8Array||x!=null&&typeof x=="object"&&x.constructor.name==="Uint8Array"}const i=x=>new Uint8Array(x.buffer,x.byteOffset,x.byteLength);e.u8=i;const s=x=>new Uint32Array(x.buffer,x.byteOffset,Math.floor(x.byteLength/4));e.u32=s;const o=x=>new DataView(x.buffer,x.byteOffset,x.byteLength);e.createView=o;const u=(x,A)=>x<<32-A|x>>>A;e.rotr=u;const l=(x,A)=>x<<A|x>>>32-A>>>0;e.rotl=l,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const a=x=>x<<24&4278190080|x<<8&16711680|x>>>8&65280|x>>>24&255;e.byteSwap=a,e.byteSwapIfBE=e.isLE?x=>x:x=>(0,e.byteSwap)(x);function f(x){for(let A=0;A<x.length;A++)x[A]=(0,e.byteSwap)(x[A])}const d=Array.from({length:256},(x,A)=>A.toString(16).padStart(2,"0"));function c(x){(0,r.bytes)(x);let A="";for(let O=0;O<x.length;O++)A+=d[x[O]];return A}const g={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function h(x){if(x>=g._0&&x<=g._9)return x-g._0;if(x>=g._A&&x<=g._F)return x-(g._A-10);if(x>=g._a&&x<=g._f)return x-(g._a-10)}function b(x){if(typeof x!="string")throw new Error("hex string expected, got "+typeof x);const A=x.length,O=A/2;if(A%2)throw new Error("padded hex string expected, got unpadded hex of length "+A);const I=new Uint8Array(O);for(let L=0,H=0;L<O;L++,H+=2){const V=h(x.charCodeAt(H)),D=h(x.charCodeAt(H+1));if(V===void 0||D===void 0){const j=x[H]+x[H+1];throw new Error('hex string expected, got non-hex character "'+j+'" at index '+H)}I[L]=V*16+D}return I}const P=async()=>{};e.nextTick=P;async function w(x,A,O){let I=Date.now();for(let L=0;L<x;L++){O(L);const H=Date.now()-I;H>=0&&H<A||(await(0,e.nextTick)(),I+=H)}}function y(x){if(typeof x!="string")throw new Error(`utf8ToBytes expected string, got ${typeof x}`);return new Uint8Array(new TextEncoder().encode(x))}function v(x){return typeof x=="string"&&(x=y(x)),(0,r.bytes)(x),x}function p(...x){let A=0;for(let I=0;I<x.length;I++){const L=x[I];(0,r.bytes)(L),A+=L.length}const O=new Uint8Array(A);for(let I=0,L=0;I<x.length;I++){const H=x[I];O.set(H,L),L+=H.length}return O}class B{clone(){return this._cloneInto()}}e.Hash=B;const k={}.toString;function R(x,A){if(A!==void 0&&k.call(A)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(x,A)}function T(x){const A=I=>x().update(v(I)).digest(),O=x();return A.outputLen=O.outputLen,A.blockLen=O.blockLen,A.create=()=>x(),A}function N(x){const A=(I,L)=>x(L).update(v(I)).digest(),O=x({});return A.outputLen=O.outputLen,A.blockLen=O.blockLen,A.create=I=>x(I),A}function S(x){const A=(I,L)=>x(L).update(v(I)).digest(),O=x({});return A.outputLen=O.outputLen,A.blockLen=O.blockLen,A.create=I=>x(I),A}function E(x=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(x));if(t.crypto&&typeof t.crypto.randomBytes=="function")return t.crypto.randomBytes(x);throw new Error("crypto.getRandomValues must be defined")}})(Pc);Object.defineProperty(rt,"__esModule",{value:!0});rt.shake256=rt.shake128=rt.keccak_512=rt.keccak_384=rt.keccak_256=rt.keccak_224=rt.sha3_512=rt.sha3_384=rt.sha3_256=rt.sha3_224=rt.Keccak=void 0;rt.keccakP=G0;const vn=Yt,as=je,gr=Pc,D0=[],H0=[],$0=[],Vb=BigInt(0),Hn=BigInt(1),zb=BigInt(2),Wb=BigInt(7),Jb=BigInt(256),Qb=BigInt(113);for(let e=0,t=Hn,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],D0.push(2*(5*n+r)),H0.push((e+1)*(e+2)/2%64);let i=Vb;for(let s=0;s<7;s++)t=(t<<Hn^(t>>Wb)*Qb)%Jb,t&zb&&(i^=Hn<<(Hn<<BigInt(s))-Hn);$0.push(i)}const[Yb,Zb]=(0,as.split)($0,!0),Cu=(e,t,r)=>r>32?(0,as.rotlBH)(e,t,r):(0,as.rotlSH)(e,t,r),Ru=(e,t,r)=>r>32?(0,as.rotlBL)(e,t,r):(0,as.rotlSL)(e,t,r);function G0(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)r[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const u=(o+8)%10,l=(o+2)%10,a=r[l],f=r[l+1],d=Cu(a,f,1)^r[u],c=Ru(a,f,1)^r[u+1];for(let g=0;g<50;g+=10)e[o+g]^=d,e[o+g+1]^=c}let i=e[2],s=e[3];for(let o=0;o<24;o++){const u=H0[o],l=Cu(i,s,u),a=Ru(i,s,u),f=D0[o];i=e[f],s=e[f+1],e[f]=l,e[f+1]=a}for(let o=0;o<50;o+=10){for(let u=0;u<10;u++)r[u]=e[o+u];for(let u=0;u<10;u++)e[o+u]^=~r[(u+2)%10]&r[(u+4)%10]}e[0]^=Yb[n],e[1]^=Zb[n]}r.fill(0)}class fs extends gr.Hash{constructor(t,r,n,i=!1,s=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,vn.number)(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,gr.u32)(this.state)}keccak(){gr.isLE||(0,gr.byteSwap32)(this.state32),G0(this.state32,this.rounds),gr.isLE||(0,gr.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(t){(0,vn.exists)(this);const{blockLen:r,state:n}=this;t=(0,gr.toBytes)(t);const i=t.length;for(let s=0;s<i;){const o=Math.min(r-this.pos,i-s);for(let u=0;u<o;u++)n[this.pos++]^=t[s++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:r,pos:n,blockLen:i}=this;t[n]^=r,r&128&&n===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){(0,vn.exists)(this,!1),(0,vn.bytes)(t),this.finish();const r=this.state,{blockLen:n}=this;for(let i=0,s=t.length;i<s;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);t.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return(0,vn.number)(t),this.xofInto(new Uint8Array(t))}digestInto(t){if((0,vn.output)(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new fs(r,n,i,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}}rt.Keccak=fs;const Br=(e,t,r)=>(0,gr.wrapConstructor)(()=>new fs(t,e,r));rt.sha3_224=Br(6,144,224/8);rt.sha3_256=Br(6,136,256/8);rt.sha3_384=Br(6,104,384/8);rt.sha3_512=Br(6,72,512/8);rt.keccak_224=Br(1,144,224/8);rt.keccak_256=Br(1,136,256/8);rt.keccak_384=Br(1,104,384/8);rt.keccak_512=Br(1,72,512/8);const K0=(e,t,r)=>(0,gr.wrapXOFConstructorWithOpts)((n={})=>new fs(t,e,n.dkLen===void 0?r:n.dkLen,!0));rt.shake128=K0(31,168,128/8);rt.shake256=K0(31,136,256/8);Object.defineProperty(dn,"__esModule",{value:!0});dn.parseIntegerNumber=dn.isEIP55Address=void 0;const Xb=rt,eg=Pc,tg=e=>{if(e.length!=42)return!1;const t=`${e}`.toLowerCase().replace("0x",""),r=(0,eg.bytesToHex)((0,Xb.keccak_256)(t));let n="0x";for(let i=0;i<t.length;i++)parseInt(r[i],16)>=8?n+=t[i].toUpperCase():n+=t[i];return e===n};dn.isEIP55Address=tg;const rg=e=>{const t=parseInt(e);if(isNaN(t))throw new Error("Invalid number.");if(t===1/0)throw new Error("Invalid number.");return t};dn.parseIntegerNumber=rg;var q0=Me&&Me.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},V0;Object.defineProperty(Xs,"__esModule",{value:!0});Xs.ParsedMessage=void 0;const ng=q0(Gb),pt=q0(Ln),Nu=dn,ig=`
|
|
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 Tc{static generateApi(){const t=new ng.default(ig);if(t.generate(),t.errors.length)throw console.error(t.errorsToAscii()),console.error(t.linesToAscii()),console.log(t.displayAttributeErrors()),new Error("ABNF grammar has errors");return t.toObject()}}V0=Tc;Tc.grammarObj=V0.generateApi();class sg{constructor(t){const r=new pt.default.parser;r.ast=new pt.default.ast;const n=pt.default.ids,i=function(v,p,B,k,R){const T=n.SEM_OK;return v===n.SEM_PRE&&B===0&&(R.scheme=pt.default.utils.charsToString(p,B,k)),T};r.ast.callbacks.scheme=i;const s=function(v,p,B,k,R){const T=n.SEM_OK;return v===n.SEM_PRE&&(R.domain=pt.default.utils.charsToString(p,B,k)),T};r.ast.callbacks.domain=s;const o=function(v,p,B,k,R){const T=n.SEM_OK;return v===n.SEM_PRE&&(R.address=pt.default.utils.charsToString(p,B,k)),T};r.ast.callbacks.address=o;const u=function(v,p,B,k,R){const T=n.SEM_OK;return v===n.SEM_PRE&&(R.statement=pt.default.utils.charsToString(p,B,k)),T};r.ast.callbacks.statement=u;const l=function(v,p,B,k,R){const T=n.SEM_OK;return v===n.SEM_PRE&&(R.uri||(R.uri=pt.default.utils.charsToString(p,B,k))),T};r.ast.callbacks.uri=l;const a=function(v,p,B,k,R){const T=n.SEM_OK;return v===n.SEM_PRE&&(R.version=pt.default.utils.charsToString(p,B,k)),T};r.ast.callbacks.version=a;const f=function(v,p,B,k,R){const T=n.SEM_OK;return v===n.SEM_PRE&&(R.chainId=(0,Nu.parseIntegerNumber)(pt.default.utils.charsToString(p,B,k))),T};r.ast.callbacks["chain-id"]=f;const d=function(v,p,B,k,R){const T=n.SEM_OK;return v===n.SEM_PRE&&(R.nonce=pt.default.utils.charsToString(p,B,k)),T};r.ast.callbacks.nonce=d;const c=function(v,p,B,k,R){const T=n.SEM_OK;return v===n.SEM_PRE&&(R.issuedAt=pt.default.utils.charsToString(p,B,k)),T};r.ast.callbacks["issued-at"]=c;const g=function(v,p,B,k,R){const T=n.SEM_OK;return v===n.SEM_PRE&&(R.expirationTime=pt.default.utils.charsToString(p,B,k)),T};r.ast.callbacks["expiration-time"]=g;const h=function(v,p,B,k,R){const T=n.SEM_OK;return v===n.SEM_PRE&&(R.notBefore=pt.default.utils.charsToString(p,B,k)),T};r.ast.callbacks["not-before"]=h;const b=function(v,p,B,k,R){const T=n.SEM_OK;return v===n.SEM_PRE&&(R.requestId=pt.default.utils.charsToString(p,B,k)),T};r.ast.callbacks["request-id"]=b;const P=function(v,p,B,k,R){const T=n.SEM_OK;return v===n.SEM_PRE&&(R.resources=pt.default.utils.charsToString(p,B,k).slice(3).split(`
|
|
763
|
-
- `)),T};r.ast.callbacks.resources=P;const w=r.parse(Tc.grammarObj,"sign-in-with-ethereum",t);if(!w.success)throw new Error(`Invalid message: ${JSON.stringify(w)}`);const y={};r.ast.translate(y);for(const[v,p]of Object.entries(y))this[v]=p;if(this.domain.length===0)throw new Error("Domain cannot be empty.");if(!(0,Nu.isEIP55Address)(this.address))throw new Error("Address not conformant to EIP-55.")}}Xs.ParsedMessage=sg;(function(e){var t=Me&&Me.__createBinding||(Object.create?function(i,s,o,u){u===void 0&&(u=o);var l=Object.getOwnPropertyDescriptor(s,o);(!l||("get"in l?!s.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return s[o]}}),Object.defineProperty(i,u,l)}:function(i,s,o,u){u===void 0&&(u=o),i[u]=s[o]}),r=Me&&Me.__exportStar||function(i,s){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(s,o)&&t(s,i,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.ParsedMessage=void 0;const n=Xs;Object.defineProperty(e,"ParsedMessage",{enumerable:!0,get:function(){return n.ParsedMessage}}),r(dn,e)})(u0);var z0={exports:{}};(function(e){(function(t){t.exports.is_uri=n,t.exports.is_http_uri=i,t.exports.is_https_uri=s,t.exports.is_web_uri=o,t.exports.isUri=n,t.exports.isHttpUri=i,t.exports.isHttpsUri=s,t.exports.isWebUri=o;var r=function(u){var l=u.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/);return l};function n(u){if(u&&!/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(u)&&!/%[^0-9a-f]/i.test(u)&&!/%[0-9a-f](:?[^0-9a-f]|$)/i.test(u)){var l=[],a="",f="",d="",c="",g="",h="";if(l=r(u),a=l[1],f=l[2],d=l[3],c=l[4],g=l[5],!!(a&&a.length&&d.length>=0)){if(f&&f.length){if(!(d.length===0||/^\//.test(d)))return}else if(/^\/\//.test(d))return;if(/^[a-z][a-z0-9\+\-\.]*$/.test(a.toLowerCase()))return h+=a+":",f&&f.length&&(h+="//"+f),h+=d,c&&c.length&&(h+="?"+c),g&&g.length&&(h+="#"+g),h}}}function i(u,l){if(n(u)){var a=[],f="",d="",c="",g="",h="",b="",P="";if(a=r(u),f=a[1],d=a[2],c=a[3],h=a[4],b=a[5],!!f){if(l){if(f.toLowerCase()!="https")return}else if(f.toLowerCase()!="http")return;if(d)return/:(\d+)$/.test(d)&&(g=d.match(/:(\d+)$/)[0],d=d.replace(/:\d+$/,"")),P+=f+":",P+="//"+d,g&&(P+=g),P+=c,h&&h.length&&(P+="?"+h),b&&b.length&&(P+="#"+b),P}}}function s(u){return i(u,!0)}function o(u){return i(u)||s(u)}})(e)})(z0);var og=z0.exports,yr={},Sc={},Ua=function(e,t){return Ua=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Ua(e,t)};function ag(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Ua(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var Fa=function(){return Fa=Object.assign||function(t){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},Fa.apply(this,arguments)};function cg(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function ug(e,t,r,n){var i=arguments.length,s=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var u=e.length-1;u>=0;u--)(o=e[u])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s}function lg(e,t){return function(r,n){t(r,n,e)}}function fg(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function dg(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(f){try{a(n.next(f))}catch(d){o(d)}}function l(f){try{a(n.throw(f))}catch(d){o(d)}}function a(f){f.done?s(f.value):i(f.value).then(u,l)}a((n=n.apply(e,t||[])).next())})}function hg(e,t){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(a){return function(f){return l([a,f])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=a[0]&2?i.return:a[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,a[1])).done)return s;switch(i=0,s&&(a=[a[0]&2,s.value]),a[0]){case 0:case 1:s=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){r.label=a[1];break}if(a[0]===6&&r.label<s[1]){r.label=s[1],s=a;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(a);break}s[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(f){a=[6,f],i=0}finally{n=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}var Oc=Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]};function pg(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Oc(t,e,r)}function ja(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function W0(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,s=[],o;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(u){o={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function bg(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(W0(arguments[t]));return e}function gg(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),i=0,t=0;t<r;t++)for(var s=arguments[t],o=0,u=s.length;o<u;o++,i++)n[i]=s[o];return n}function mg(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,s;n<i;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}function cs(e){return this instanceof cs?(this.v=e,this):new cs(e)}function yg(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(c){n[c]&&(i[c]=function(g){return new Promise(function(h,b){s.push([c,g,h,b])>1||u(c,g)})})}function u(c,g){try{l(n[c](g))}catch(h){d(s[0][3],h)}}function l(c){c.value instanceof cs?Promise.resolve(c.value.v).then(a,f):d(s[0][2],c)}function a(c){u("next",c)}function f(c){u("throw",c)}function d(c,g){c(g),s.shift(),s.length&&u(s[0][0],s[0][1])}}function xg(e){var t,r;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,s){t[i]=e[i]?function(o){return(r=!r)?{value:cs(e[i](o)),done:i==="return"}:s?s(o):o}:s}}function wg(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof ja=="function"?ja(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=e[s]&&function(o){return new Promise(function(u,l){o=e[s](o),i(u,l,o.done,o.value)})}}function i(s,o,u,l){Promise.resolve(l).then(function(a){s({value:a,done:u})},o)}}function Ag(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var Eg=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function vg(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Oc(t,e,r);return Eg(t,e),t}function _g(e){return e&&e.__esModule?e:{default:e}}function kg(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)}function Pg(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r}function Tg(e,t){if(t===null||typeof t!="object"&&typeof t!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof e=="function"?t===e:e.has(t)}const Sg=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Fa},__asyncDelegator:xg,__asyncGenerator:yg,__asyncValues:wg,__await:cs,__awaiter:dg,__classPrivateFieldGet:kg,__classPrivateFieldIn:Tg,__classPrivateFieldSet:Pg,__createBinding:Oc,__decorate:ug,__exportStar:pg,__extends:ag,__generator:hg,__importDefault:_g,__importStar:vg,__makeTemplateObject:Ag,__metadata:fg,__param:lg,__read:W0,__rest:cg,__spread:bg,__spreadArray:mg,__spreadArrays:gg,__values:ja},Symbol.toStringTag,{value:"Module"})),Og=a0(Sg);var zo={},$n={},Iu;function Bc(){return Iu||(Iu=1,Object.defineProperty($n,"__esModule",{value:!0}),$n.version=void 0,$n.version="6.8.0"),$n}var Wo={},Gn={},Jo={},Ir={},Xe={},ct={},Mr={},Mu;function gn(){if(Mu)return Mr;Mu=1,Object.defineProperty(Mr,"__esModule",{value:!0}),Mr.defineProperties=Mr.resolveProperties=void 0;function e(n,i,s){const o=i.split("|").map(l=>l.trim());for(let l=0;l<o.length;l++)switch(i){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof n===i)return}const u=new Error(`invalid value for type ${i}`);throw u.code="INVALID_ARGUMENT",u.argument=`value.${s}`,u.value=n,u}async function t(n){const i=Object.keys(n);return(await Promise.all(i.map(o=>Promise.resolve(n[o])))).reduce((o,u,l)=>(o[i[l]]=u,o),{})}Mr.resolveProperties=t;function r(n,i,s){for(let o in i){let u=i[o];const l=s?s[o]:null;l&&e(u,l,o),Object.defineProperty(n,o,{enumerable:!0,value:u,writable:!1})}}return Mr.defineProperties=r,Mr}var Lu;function sr(){if(Lu)return ct;Lu=1,Object.defineProperty(ct,"__esModule",{value:!0}),ct.assertPrivate=ct.assertNormalize=ct.assertArgumentCount=ct.assertArgument=ct.assert=ct.makeError=ct.isCallException=ct.isError=void 0;const e=Bc(),t=gn();function r(c){if(c==null)return"null";if(Array.isArray(c))return"[ "+c.map(r).join(", ")+" ]";if(c instanceof Uint8Array){const g="0123456789abcdef";let h="0x";for(let b=0;b<c.length;b++)h+=g[c[b]>>4],h+=g[c[b]&15];return h}if(typeof c=="object"&&typeof c.toJSON=="function")return r(c.toJSON());switch(typeof c){case"boolean":case"symbol":return c.toString();case"bigint":return BigInt(c).toString();case"number":return c.toString();case"string":return JSON.stringify(c);case"object":{const g=Object.keys(c);return g.sort(),"{ "+g.map(h=>`${r(h)}: ${r(c[h])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function n(c,g){return c&&c.code===g}ct.isError=n;function i(c){return n(c,"CALL_EXCEPTION")}ct.isCallException=i;function s(c,g,h){let b=c;{const w=[];if(h){if("message"in h||"code"in h||"name"in h)throw new Error(`value will overwrite populated values: ${r(h)}`);for(const y in h){if(y==="shortMessage")continue;const v=h[y];w.push(y+"="+r(v))}}w.push(`code=${g}`),w.push(`version=${e.version}`),w.length&&(c+=" ("+w.join(", ")+")")}let P;switch(g){case"INVALID_ARGUMENT":P=new TypeError(c);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":P=new RangeError(c);break;default:P=new Error(c)}return(0,t.defineProperties)(P,{code:g}),h&&Object.assign(P,h),P.shortMessage==null&&(0,t.defineProperties)(P,{shortMessage:b}),P}ct.makeError=s;function o(c,g,h,b){if(!c)throw s(g,h,b)}ct.assert=o;function u(c,g,h,b){o(c,g,"INVALID_ARGUMENT",{argument:h,value:b})}ct.assertArgument=u;function l(c,g,h){h==null&&(h=""),h&&(h=": "+h),o(c>=g,"missing arguemnt"+h,"MISSING_ARGUMENT",{count:c,expectedCount:g}),o(c<=g,"too many arguemnts"+h,"UNEXPECTED_ARGUMENT",{count:c,expectedCount:g})}ct.assertArgumentCount=l;const a=["NFD","NFC","NFKD","NFKC"].reduce((c,g)=>{try{if("test".normalize(g)!=="test")throw new Error("bad");if(g==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");c.push(g)}catch{}return c},[]);function f(c){o(a.indexOf(c)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:c}})}ct.assertNormalize=f;function d(c,g,h){if(h==null&&(h=""),c!==g){let b=h,P="new";h&&(b+=".",P+=" "+h),o(!1,`private constructor; use ${b}from* methods`,"UNSUPPORTED_OPERATION",{operation:P})}}return ct.assertPrivate=d,ct}var Uu;function Qt(){if(Uu)return Xe;Uu=1,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.zeroPadBytes=Xe.zeroPadValue=Xe.stripZerosLeft=Xe.dataSlice=Xe.dataLength=Xe.concat=Xe.hexlify=Xe.isBytesLike=Xe.isHexString=Xe.getBytesCopy=Xe.getBytes=void 0;const e=sr();function t(b,P,w){if(b instanceof Uint8Array)return w?new Uint8Array(b):b;if(typeof b=="string"&&b.match(/^0x([0-9a-f][0-9a-f])*$/i)){const y=new Uint8Array((b.length-2)/2);let v=2;for(let p=0;p<y.length;p++)y[p]=parseInt(b.substring(v,v+2),16),v+=2;return y}(0,e.assertArgument)(!1,"invalid BytesLike value",P||"value",b)}function r(b,P){return t(b,P,!1)}Xe.getBytes=r;function n(b,P){return t(b,P,!0)}Xe.getBytesCopy=n;function i(b,P){return!(typeof b!="string"||!b.match(/^0x[0-9A-Fa-f]*$/)||typeof P=="number"&&b.length!==2+2*P||P===!0&&b.length%2!==0)}Xe.isHexString=i;function s(b){return i(b,!0)||b instanceof Uint8Array}Xe.isBytesLike=s;const o="0123456789abcdef";function u(b){const P=r(b);let w="0x";for(let y=0;y<P.length;y++){const v=P[y];w+=o[(v&240)>>4]+o[v&15]}return w}Xe.hexlify=u;function l(b){return"0x"+b.map(P=>u(P).substring(2)).join("")}Xe.concat=l;function a(b){return i(b,!0)?(b.length-2)/2:r(b).length}Xe.dataLength=a;function f(b,P,w){const y=r(b);return w!=null&&w>y.length&&(0,e.assert)(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:y,length:y.length,offset:w}),u(y.slice(P??0,w??y.length))}Xe.dataSlice=f;function d(b){let P=u(b).substring(2);for(;P.startsWith("00");)P=P.substring(2);return"0x"+P}Xe.stripZerosLeft=d;function c(b,P,w){const y=r(b);(0,e.assert)(P>=y.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(y),length:P,offset:P+1});const v=new Uint8Array(P);return v.fill(0),w?v.set(y,P-y.length):v.set(y,0),u(v)}function g(b,P){return c(b,P,!0)}Xe.zeroPadValue=g;function h(b,P){return c(b,P,!1)}return Xe.zeroPadBytes=h,Xe}var et={},Fu;function ds(){if(Fu)return et;Fu=1,Object.defineProperty(et,"__esModule",{value:!0}),et.toQuantity=et.toBeArray=et.toBeHex=et.toNumber=et.getNumber=et.toBigInt=et.getUint=et.getBigInt=et.mask=et.toTwos=et.fromTwos=void 0;const e=Qt(),t=sr(),r=BigInt(0),n=BigInt(1),i=9007199254740991;function s(w,y){const v=a(w,"value"),p=BigInt(c(y,"width"));if((0,t.assert)(v>>p===r,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:w}),v>>p-n){const B=(n<<p)-n;return-((~v&B)+n)}return v}et.fromTwos=s;function o(w,y){let v=l(w,"value");const p=BigInt(c(y,"width")),B=n<<p-n;if(v<r){v=-v,(0,t.assert)(v<=B,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:w});const k=(n<<p)-n;return(~v&k)+n}else(0,t.assert)(v<B,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:w});return v}et.toTwos=o;function u(w,y){const v=a(w,"value"),p=BigInt(c(y,"bits"));return v&(n<<p)-n}et.mask=u;function l(w,y){switch(typeof w){case"bigint":return w;case"number":return(0,t.assertArgument)(Number.isInteger(w),"underflow",y||"value",w),(0,t.assertArgument)(w>=-i&&w<=i,"overflow",y||"value",w),BigInt(w);case"string":try{if(w==="")throw new Error("empty string");return w[0]==="-"&&w[1]!=="-"?-BigInt(w.substring(1)):BigInt(w)}catch(v){(0,t.assertArgument)(!1,`invalid BigNumberish string: ${v.message}`,y||"value",w)}}(0,t.assertArgument)(!1,"invalid BigNumberish value",y||"value",w)}et.getBigInt=l;function a(w,y){const v=l(w,y);return(0,t.assert)(v>=r,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:w}),v}et.getUint=a;const f="0123456789abcdef";function d(w){if(w instanceof Uint8Array){let y="0x0";for(const v of w)y+=f[v>>4],y+=f[v&15];return BigInt(y)}return l(w)}et.toBigInt=d;function c(w,y){switch(typeof w){case"bigint":return(0,t.assertArgument)(w>=-i&&w<=i,"overflow",y||"value",w),Number(w);case"number":return(0,t.assertArgument)(Number.isInteger(w),"underflow",y||"value",w),(0,t.assertArgument)(w>=-i&&w<=i,"overflow",y||"value",w),w;case"string":try{if(w==="")throw new Error("empty string");return c(BigInt(w),y)}catch(v){(0,t.assertArgument)(!1,`invalid numeric string: ${v.message}`,y||"value",w)}}(0,t.assertArgument)(!1,"invalid numeric value",y||"value",w)}et.getNumber=c;function g(w){return c(d(w))}et.toNumber=g;function h(w,y){let p=a(w,"value").toString(16);if(y==null)p.length%2&&(p="0"+p);else{const B=c(y,"width");for((0,t.assert)(B*2>=p.length,`value exceeds width (${B} bits)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:w});p.length<B*2;)p="0"+p}return"0x"+p}et.toBeHex=h;function b(w){const y=a(w,"value");if(y===r)return new Uint8Array([]);let v=y.toString(16);v.length%2&&(v="0"+v);const p=new Uint8Array(v.length/2);for(let B=0;B<p.length;B++){const k=B*2;p[B]=parseInt(v.substring(k,k+2),16)}return p}et.toBeArray=b;function P(w){let y=(0,e.hexlify)((0,e.isBytesLike)(w)?w:b(w)).substring(2);for(;y.startsWith("0");)y=y.substring(1);return y===""&&(y="0"),"0x"+y}return et.toQuantity=P,et}var ju;function Bg(){if(ju)return Ir;ju=1,Object.defineProperty(Ir,"__esModule",{value:!0}),Ir.decodeBase58=Ir.encodeBase58=void 0;const e=Qt(),t=sr(),r=ds(),n="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";let i=null;function s(f){if(i==null){i={};for(let c=0;c<n.length;c++)i[n[c]]=BigInt(c)}const d=i[f];return(0,t.assertArgument)(d!=null,"invalid base58 value","letter",f),d}const o=BigInt(0),u=BigInt(58);function l(f){let d=(0,r.toBigInt)((0,e.getBytes)(f)),c="";for(;d;)c=n[Number(d%u)]+c,d/=u;return c}Ir.encodeBase58=l;function a(f){let d=o;for(let c=0;c<f.length;c++)d*=u,d+=s(f[c]);return d}return Ir.decodeBase58=a,Ir}var Lr={},Du;function J0(){if(Du)return Lr;Du=1,Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.encodeBase64=Lr.decodeBase64=void 0;const e=Qt();function t(n){n=atob(n);const i=new Uint8Array(n.length);for(let s=0;s<n.length;s++)i[s]=n.charCodeAt(s);return(0,e.getBytes)(i)}Lr.decodeBase64=t;function r(n){const i=(0,e.getBytes)(n);let s="";for(let o=0;o<i.length;o++)s+=String.fromCharCode(i[o]);return btoa(s)}return Lr.encodeBase64=r,Lr}var Kn={},Hu;function Cg(){var r;if(Hu)return Kn;Hu=1,Object.defineProperty(Kn,"__esModule",{value:!0}),Kn.EventPayload=void 0;const e=gn();class t{constructor(i,s,o){pe(this,"filter");pe(this,"emitter");xe(this,r);ue(this,r,s),(0,e.defineProperties)(this,{emitter:i,filter:o})}async removeListener(){q(this,r)!=null&&await this.emitter.off(this.filter,q(this,r))}}return r=new WeakMap,Kn.EventPayload=t,Kn}var cr={},Qo={},$u;function Cc(){return $u||($u=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.toUtf8CodePoints=e.toUtf8String=e.toUtf8Bytes=e.Utf8ErrorFuncs=void 0;const t=Qt(),r=sr();function n(d,c,g,h,b){(0,r.assertArgument)(!1,`invalid codepoint at offset ${c}; ${d}`,"bytes",g)}function i(d,c,g,h,b){if(d==="BAD_PREFIX"||d==="UNEXPECTED_CONTINUE"){let P=0;for(let w=c+1;w<g.length&&g[w]>>6===2;w++)P++;return P}return d==="OVERRUN"?g.length-c-1:0}function s(d,c,g,h,b){return d==="OVERLONG"?((0,r.assertArgument)(typeof b=="number","invalid bad code point for replacement","badCodepoint",b),h.push(b),0):(h.push(65533),i(d,c,g))}e.Utf8ErrorFuncs=Object.freeze({error:n,ignore:i,replace:s});function o(d,c){c==null&&(c=e.Utf8ErrorFuncs.error);const g=(0,t.getBytes)(d,"bytes"),h=[];let b=0;for(;b<g.length;){const P=g[b++];if(!(P>>7)){h.push(P);continue}let w=null,y=null;if((P&224)===192)w=1,y=127;else if((P&240)===224)w=2,y=2047;else if((P&248)===240)w=3,y=65535;else{(P&192)===128?b+=c("UNEXPECTED_CONTINUE",b-1,g,h):b+=c("BAD_PREFIX",b-1,g,h);continue}if(b-1+w>=g.length){b+=c("OVERRUN",b-1,g,h);continue}let v=P&(1<<8-w-1)-1;for(let p=0;p<w;p++){let B=g[b];if((B&192)!=128){b+=c("MISSING_CONTINUE",b,g,h),v=null;break}v=v<<6|B&63,b++}if(v!==null){if(v>1114111){b+=c("OUT_OF_RANGE",b-1-w,g,h,v);continue}if(v>=55296&&v<=57343){b+=c("UTF16_SURROGATE",b-1-w,g,h,v);continue}if(v<=y){b+=c("OVERLONG",b-1-w,g,h,v);continue}h.push(v)}}return h}function u(d,c){c!=null&&((0,r.assertNormalize)(c),d=d.normalize(c));let g=[];for(let h=0;h<d.length;h++){const b=d.charCodeAt(h);if(b<128)g.push(b);else if(b<2048)g.push(b>>6|192),g.push(b&63|128);else if((b&64512)==55296){h++;const P=d.charCodeAt(h);(0,r.assertArgument)(h<d.length&&(P&64512)===56320,"invalid surrogate pair","str",d);const w=65536+((b&1023)<<10)+(P&1023);g.push(w>>18|240),g.push(w>>12&63|128),g.push(w>>6&63|128),g.push(w&63|128)}else g.push(b>>12|224),g.push(b>>6&63|128),g.push(b&63|128)}return new Uint8Array(g)}e.toUtf8Bytes=u;function l(d){return d.map(c=>c<=65535?String.fromCharCode(c):(c-=65536,String.fromCharCode((c>>10&1023)+55296,(c&1023)+56320))).join("")}function a(d,c){return l(o(d,c))}e.toUtf8String=a;function f(d,c){return o(u(d,c))}e.toUtf8CodePoints=f}(Qo)),Qo}var Ur={},Gu;function Rg(){if(Gu)return Ur;Gu=1,Object.defineProperty(Ur,"__esModule",{value:!0}),Ur.getUrl=Ur.createGetUrl=void 0;const e=sr();function t(i){async function s(o,u){const l=o.url.split(":")[0].toLowerCase();(0,e.assert)(l==="http"||l==="https",`unsupported protocol ${l}`,"UNSUPPORTED_OPERATION",{info:{protocol:l},operation:"request"}),(0,e.assert)(l==="https"||!o.credentials||o.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let a;if(u){const b=new AbortController;a=b.signal,u.addListener(()=>{b.abort()})}const f={method:o.method,headers:new Headers(Array.from(o)),body:o.body||void 0,signal:a},d=await fetch(o.url,f),c={};d.headers.forEach((b,P)=>{c[P.toLowerCase()]=b});const g=await d.arrayBuffer(),h=g==null?null:new Uint8Array(g);return{statusCode:d.status,statusMessage:d.statusText,headers:c,body:h}}return s}Ur.createGetUrl=t;const r=t();async function n(i,s){return r(i,s)}return Ur.getUrl=n,Ur}var Ku;function Ng(){var R,T,N,S,E,x,A,O,I,L,H,V,D,j,$,F,M,ee,ns,ae,Z,te,re,K,W;if(Ku)return cr;Ku=1,Object.defineProperty(cr,"__esModule",{value:!0}),cr.FetchResponse=cr.FetchRequest=cr.FetchCancelSignal=void 0;const e=J0(),t=Qt(),r=sr(),n=gn(),i=Cc(),s=Rg(),o=12,u=250;let l=(0,s.createGetUrl)();const a=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),f=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let d=!1;async function c(se,U){try{const J=se.match(a);if(!J)throw new Error("invalid data");return new v(200,"OK",{"content-type":J[1]||"text/plain"},J[2]?(0,e.decodeBase64)(J[3]):B(J[3]))}catch{return new v(599,"BAD REQUEST (invalid data: URI)",{},null,new y(se))}}function g(se){async function U(J,z){try{const oe=J.match(f);if(!oe)throw new Error("invalid link");return new y(`${se}${oe[2]}`)}catch{return new v(599,"BAD REQUEST (invalid IPFS URI)",{},null,new y(J))}}return U}const h={data:c,ipfs:g("https://gateway.ipfs.io/ipfs/")},b=new WeakMap;class P{constructor(U){xe(this,R);xe(this,T);ue(this,R,[]),ue(this,T,!1),b.set(U,()=>{if(!q(this,T)){ue(this,T,!0);for(const J of q(this,R))setTimeout(()=>{J()},0);ue(this,R,[])}})}addListener(U){(0,r.assert)(!q(this,T),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),q(this,R).push(U)}get cancelled(){return q(this,T)}checkSignal(){(0,r.assert)(!this.cancelled,"cancelled","CANCELLED",{})}}R=new WeakMap,T=new WeakMap,cr.FetchCancelSignal=P;function w(se){if(se==null)throw new Error("missing signal; should not happen");return se.checkSignal(),se}const Q=class Q{constructor(U){xe(this,ee);xe(this,N);xe(this,S);xe(this,E);xe(this,x);xe(this,A);xe(this,O);xe(this,I);xe(this,L);xe(this,H);xe(this,V);xe(this,D);xe(this,j);xe(this,$);xe(this,F);xe(this,M);ue(this,O,String(U)),ue(this,N,!1),ue(this,S,!0),ue(this,E,{}),ue(this,x,""),ue(this,A,3e5),ue(this,F,{slotInterval:u,maxAttempts:o}),ue(this,M,null)}get url(){return q(this,O)}set url(U){ue(this,O,String(U))}get body(){return q(this,I)==null?null:new Uint8Array(q(this,I))}set body(U){if(U==null)ue(this,I,void 0),ue(this,L,void 0);else if(typeof U=="string")ue(this,I,(0,i.toUtf8Bytes)(U)),ue(this,L,"text/plain");else if(U instanceof Uint8Array)ue(this,I,U),ue(this,L,"application/octet-stream");else if(typeof U=="object")ue(this,I,(0,i.toUtf8Bytes)(JSON.stringify(U))),ue(this,L,"application/json");else throw new Error("invalid body")}hasBody(){return q(this,I)!=null}get method(){return q(this,x)?q(this,x):this.hasBody()?"POST":"GET"}set method(U){U==null&&(U=""),ue(this,x,String(U).toUpperCase())}get headers(){const U=Object.assign({},q(this,E));return q(this,H)&&(U.authorization=`Basic ${(0,e.encodeBase64)((0,i.toUtf8Bytes)(q(this,H)))}`),this.allowGzip&&(U["accept-encoding"]="gzip"),U["content-type"]==null&&q(this,L)&&(U["content-type"]=q(this,L)),this.body&&(U["content-length"]=String(this.body.length)),U}getHeader(U){return this.headers[U.toLowerCase()]}setHeader(U,J){q(this,E)[String(U).toLowerCase()]=String(J)}clearHeaders(){ue(this,E,{})}[Symbol.iterator](){const U=this.headers,J=Object.keys(U);let z=0;return{next:()=>{if(z<J.length){const oe=J[z++];return{value:[oe,U[oe]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return q(this,H)||null}setCredentials(U,J){(0,r.assertArgument)(!U.match(/:/),"invalid basic authentication username","username","[REDACTED]"),ue(this,H,`${U}:${J}`)}get allowGzip(){return q(this,S)}set allowGzip(U){ue(this,S,!!U)}get allowInsecureAuthentication(){return!!q(this,N)}set allowInsecureAuthentication(U){ue(this,N,!!U)}get timeout(){return q(this,A)}set timeout(U){(0,r.assertArgument)(U>=0,"timeout must be non-zero","timeout",U),ue(this,A,U)}get preflightFunc(){return q(this,V)||null}set preflightFunc(U){ue(this,V,U)}get processFunc(){return q(this,D)||null}set processFunc(U){ue(this,D,U)}get retryFunc(){return q(this,j)||null}set retryFunc(U){ue(this,j,U)}get getUrlFunc(){return q(this,M)||l}set getUrlFunc(U){ue(this,M,U)}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${q(this,I)?(0,t.hexlify)(q(this,I)):"null"}>`}setThrottleParams(U){U.slotInterval!=null&&(q(this,F).slotInterval=U.slotInterval),U.maxAttempts!=null&&(q(this,F).maxAttempts=U.maxAttempts)}send(){return(0,r.assert)(q(this,$)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),ue(this,$,new P(this)),_e(this,ee,ns).call(this,0,p()+this.timeout,0,this,new v(0,"",{},null,this))}cancel(){(0,r.assert)(q(this,$)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const U=b.get(this);if(!U)throw new Error("missing signal; should not happen");U()}redirect(U){const J=this.url.split(":")[0].toLowerCase(),z=U.split(":")[0].toLowerCase();(0,r.assert)(this.method==="GET"&&(J!=="https"||z!=="http")&&U.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(U)})`});const oe=new Q(U);return oe.method="GET",oe.allowGzip=this.allowGzip,oe.timeout=this.timeout,ue(oe,E,Object.assign({},q(this,E))),q(this,I)&&ue(oe,I,new Uint8Array(q(this,I))),ue(oe,L,q(this,L)),oe}clone(){const U=new Q(this.url);return ue(U,x,q(this,x)),q(this,I)&&ue(U,I,q(this,I)),ue(U,L,q(this,L)),ue(U,E,Object.assign({},q(this,E))),ue(U,H,q(this,H)),this.allowGzip&&(U.allowGzip=!0),U.timeout=this.timeout,this.allowInsecureAuthentication&&(U.allowInsecureAuthentication=!0),ue(U,V,q(this,V)),ue(U,D,q(this,D)),ue(U,j,q(this,j)),ue(U,M,q(this,M)),U}static lockConfig(){d=!0}static getGateway(U){return h[U.toLowerCase()]||null}static registerGateway(U,J){if(U=U.toLowerCase(),U==="http"||U==="https")throw new Error(`cannot intercept ${U}; use registerGetUrl`);if(d)throw new Error("gateways locked");h[U]=J}static registerGetUrl(U){if(d)throw new Error("gateways locked");l=U}static createGetUrlFunc(U){return(0,s.createGetUrl)(U)}static createDataGateway(){return c}static createIpfsGatewayFunc(U){return g(U)}};N=new WeakMap,S=new WeakMap,E=new WeakMap,x=new WeakMap,A=new WeakMap,O=new WeakMap,I=new WeakMap,L=new WeakMap,H=new WeakMap,V=new WeakMap,D=new WeakMap,j=new WeakMap,$=new WeakMap,F=new WeakMap,M=new WeakMap,ee=new WeakSet,ns=async function(U,J,z,oe,Y){var ce,me,fe;if(U>=q(this,F).maxAttempts)return Y.makeServerError("exceeded maximum retry limit");(0,r.assert)(p()<=J,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:oe}),z>0&&await k(z);let he=this.clone();const we=(he.url.split(":")[0]||"").toLowerCase();if(we in h){const C=await h[we](he.url,w(q(oe,$)));if(C instanceof v){let m=C;if(this.processFunc){w(q(oe,$));try{m=await this.processFunc(he,m)}catch(_){(_.throttle==null||typeof _.stall!="number")&&m.makeServerError("error in post-processing function",_).assertOk()}}return m}he=C}this.preflightFunc&&(he=await this.preflightFunc(he));const ye=await this.getUrlFunc(he,w(q(oe,$)));let ie=new v(ye.statusCode,ye.statusMessage,ye.headers,ye.body,oe);if(ie.statusCode===301||ie.statusCode===302){try{const C=ie.headers.location||"";return _e(ce=he.redirect(C),ee,ns).call(ce,U+1,J,0,oe,ie)}catch{}return ie}else if(ie.statusCode===429&&(this.retryFunc==null||await this.retryFunc(he,ie,U))){const C=ie.headers["retry-after"];let m=q(this,F).slotInterval*Math.trunc(Math.random()*Math.pow(2,U));return typeof C=="string"&&C.match(/^[1-9][0-9]*$/)&&(m=parseInt(C)),_e(me=he.clone(),ee,ns).call(me,U+1,J,m,oe,ie)}if(this.processFunc){w(q(oe,$));try{ie=await this.processFunc(he,ie)}catch(C){(C.throttle==null||typeof C.stall!="number")&&ie.makeServerError("error in post-processing function",C).assertOk();let m=q(this,F).slotInterval*Math.trunc(Math.random()*Math.pow(2,U));return C.stall>=0&&(m=C.stall),_e(fe=he.clone(),ee,ns).call(fe,U+1,J,m,oe,ie)}}return ie};let y=Q;cr.FetchRequest=y;const ne=class ne{constructor(U,J,z,oe,Y){xe(this,ae);xe(this,Z);xe(this,te);xe(this,re);xe(this,K);xe(this,W);ue(this,ae,U),ue(this,Z,J),ue(this,te,Object.keys(z).reduce((he,we)=>(he[we.toLowerCase()]=String(z[we]),he),{})),ue(this,re,oe==null?null:new Uint8Array(oe)),ue(this,K,Y||null),ue(this,W,{message:""})}toString(){return`<FetchResponse status=${this.statusCode} body=${q(this,re)?(0,t.hexlify)(q(this,re)):"null"}>`}get statusCode(){return q(this,ae)}get statusMessage(){return q(this,Z)}get headers(){return Object.assign({},q(this,te))}get body(){return q(this,re)==null?null:new Uint8Array(q(this,re))}get bodyText(){try{return q(this,re)==null?"":(0,i.toUtf8String)(q(this,re))}catch{(0,r.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,r.assert)(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const U=this.headers,J=Object.keys(U);let z=0;return{next:()=>{if(z<J.length){const oe=J[z++];return{value:[oe,U[oe]],done:!1}}return{value:void 0,done:!0}}}}makeServerError(U,J){let z;U?z=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${U})`:(U=`${this.statusCode} ${this.statusMessage}`,z=`CLIENT ESCALATED SERVER ERROR (${U})`);const oe=new ne(599,z,this.headers,this.body,q(this,K)||void 0);return ue(oe,W,{message:U,error:J}),oe}throwThrottleError(U,J){J==null?J=-1:(0,r.assertArgument)(Number.isInteger(J)&&J>=0,"invalid stall timeout","stall",J);const z=new Error(U||"throttling requests");throw(0,n.defineProperties)(z,{stall:J,throttle:!0}),z}getHeader(U){return this.headers[U.toLowerCase()]}hasBody(){return q(this,re)!=null}get request(){return q(this,K)}ok(){return q(this,W).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:U,error:J}=q(this,W);U===""&&(U=`server response ${this.statusCode} ${this.statusMessage}`),(0,r.assert)(!1,U,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:J})}};ae=new WeakMap,Z=new WeakMap,te=new WeakMap,re=new WeakMap,K=new WeakMap,W=new WeakMap;let v=ne;cr.FetchResponse=v;function p(){return new Date().getTime()}function B(se){return(0,i.toUtf8Bytes)(se.replace(/%([0-9a-f][0-9a-f])/gi,(U,J)=>String.fromCharCode(parseInt(J,16))))}function k(se){return new Promise(U=>setTimeout(U,se))}return cr}var qn={},qu;function Q0(){var b,P,w,y,cn,br,Da,Ha,$a,Ga;if(qu)return qn;qu=1,Object.defineProperty(qn,"__esModule",{value:!0}),qn.FixedNumber=void 0;const e=Qt(),t=sr(),r=ds(),n=gn(),i=BigInt(-1),s=BigInt(0),o=BigInt(1),u=BigInt(5),l={};let a="0000";for(;a.length<80;)a+=a;function f(S){let E=a;for(;E.length<S;)E+=E;return BigInt("1"+E.substring(0,S))}function d(S,E,x){const A=BigInt(E.width);if(E.signed){const O=o<<A-o;(0,t.assert)(x==null||S>=-O&&S<O,"overflow","NUMERIC_FAULT",{operation:x,fault:"overflow",value:S}),S>s?S=(0,r.fromTwos)((0,r.mask)(S,A),A):S=-(0,r.fromTwos)((0,r.mask)(-S,A),A)}else{const O=o<<A;(0,t.assert)(x==null||S>=0&&S<O,"overflow","NUMERIC_FAULT",{operation:x,fault:"overflow",value:S}),S=(S%O+O)%O&O-o}return S}function c(S){typeof S=="number"&&(S=`fixed128x${S}`);let E=!0,x=128,A=18;if(typeof S=="string"){if(S!=="fixed")if(S==="ufixed")E=!1;else{const I=S.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);(0,t.assertArgument)(I,"invalid fixed format","format",S),E=I[1]!=="u",x=parseInt(I[2]),A=parseInt(I[3])}}else if(S){const I=S,L=(H,V,D)=>I[H]==null?D:((0,t.assertArgument)(typeof I[H]===V,"invalid fixed format ("+H+" not "+V+")","format."+H,I[H]),I[H]);E=L("signed","boolean",E),x=L("width","number",x),A=L("decimals","number",A)}(0,t.assertArgument)(x%8===0,"invalid FixedNumber width (not byte aligned)","format.width",x),(0,t.assertArgument)(A<=80,"invalid FixedNumber decimals (too large)","format.decimals",A);const O=(E?"":"u")+"fixed"+String(x)+"x"+String(A);return{signed:E,width:x,decimals:A,name:O}}function g(S,E){let x="";S<s&&(x="-",S*=i);let A=S.toString();if(E===0)return x+A;for(;A.length<=E;)A=a+A;const O=A.length-E;for(A=A.substring(0,O)+"."+A.substring(O);A[0]==="0"&&A[1]!==".";)A=A.substring(1);for(;A[A.length-1]==="0"&&A[A.length-2]!==".";)A=A.substring(0,A.length-1);return x+A}const N=class N{constructor(E,x,A){xe(this,y);pe(this,"format");xe(this,b);xe(this,P);xe(this,w);pe(this,"_value");(0,t.assertPrivate)(E,l,"FixedNumber"),ue(this,P,x),ue(this,b,A);const O=g(x,A.decimals);(0,n.defineProperties)(this,{format:A.name,_value:O}),ue(this,w,f(A.decimals))}get signed(){return q(this,b).signed}get width(){return q(this,b).width}get decimals(){return q(this,b).decimals}get value(){return q(this,P)}addUnsafe(E){return _e(this,y,Da).call(this,E)}add(E){return _e(this,y,Da).call(this,E,"add")}subUnsafe(E){return _e(this,y,Ha).call(this,E)}sub(E){return _e(this,y,Ha).call(this,E,"sub")}mulUnsafe(E){return _e(this,y,$a).call(this,E)}mul(E){return _e(this,y,$a).call(this,E,"mul")}mulSignal(E){_e(this,y,cn).call(this,E);const x=q(this,P)*q(E,P);return(0,t.assert)(x%q(this,w)===s,"precision lost during signalling mul","NUMERIC_FAULT",{operation:"mulSignal",fault:"underflow",value:this}),_e(this,y,br).call(this,x/q(this,w),"mulSignal")}divUnsafe(E){return _e(this,y,Ga).call(this,E)}div(E){return _e(this,y,Ga).call(this,E,"div")}divSignal(E){(0,t.assert)(q(E,P)!==s,"division by zero","NUMERIC_FAULT",{operation:"div",fault:"divide-by-zero",value:this}),_e(this,y,cn).call(this,E);const x=q(this,P)*q(this,w);return(0,t.assert)(x%q(E,P)===s,"precision lost during signalling div","NUMERIC_FAULT",{operation:"divSignal",fault:"underflow",value:this}),_e(this,y,br).call(this,x/q(E,P),"divSignal")}cmp(E){let x=this.value,A=E.value;const O=this.decimals-E.decimals;return O>0?A*=f(O):O<0&&(x*=f(-O)),x<A?-1:x>A?1:0}eq(E){return this.cmp(E)===0}lt(E){return this.cmp(E)<0}lte(E){return this.cmp(E)<=0}gt(E){return this.cmp(E)>0}gte(E){return this.cmp(E)>=0}floor(){let E=q(this,P);return q(this,P)<s&&(E-=q(this,w)-o),E=q(this,P)/q(this,w)*q(this,w),_e(this,y,br).call(this,E,"floor")}ceiling(){let E=q(this,P);return q(this,P)>s&&(E+=q(this,w)-o),E=q(this,P)/q(this,w)*q(this,w),_e(this,y,br).call(this,E,"ceiling")}round(E){if(E==null&&(E=0),E>=this.decimals)return this;const x=this.decimals-E,A=u*f(x-1);let O=this.value+A;const I=f(x);return O=O/I*I,d(O,q(this,b),"round"),new N(l,O,q(this,b))}isZero(){return q(this,P)===s}isNegative(){return q(this,P)<s}toString(){return this._value}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(E){return N.fromString(this.toString(),E)}static fromValue(E,x,A){const O=x==null?0:(0,r.getNumber)(x),I=c(A);let L=(0,r.getBigInt)(E,"value");const H=O-I.decimals;if(H>0){const V=f(H);(0,t.assert)(L%V===s,"value loses precision for format","NUMERIC_FAULT",{operation:"fromValue",fault:"underflow",value:E}),L/=V}else H<0&&(L*=f(-H));return d(L,I,"fromValue"),new N(l,L,I)}static fromString(E,x){const A=E.match(/^(-?)([0-9]*)\.?([0-9]*)$/);(0,t.assertArgument)(A&&A[2].length+A[3].length>0,"invalid FixedNumber string value","value",E);const O=c(x);let I=A[2]||"0",L=A[3]||"";for(;L.length<O.decimals;)L+=a;(0,t.assert)(L.substring(O.decimals).match(/^0*$/),"too many decimals for format","NUMERIC_FAULT",{operation:"fromString",fault:"underflow",value:E}),L=L.substring(0,O.decimals);const H=BigInt(A[1]+I+L);return d(H,O,"fromString"),new N(l,H,O)}static fromBytes(E,x){let A=(0,r.toBigInt)((0,e.getBytes)(E,"value"));const O=c(x);return O.signed&&(A=(0,r.fromTwos)(A,O.width)),d(A,O,"fromBytes"),new N(l,A,O)}};b=new WeakMap,P=new WeakMap,w=new WeakMap,y=new WeakSet,cn=function(E){(0,t.assertArgument)(this.format===E.format,"incompatible format; use fixedNumber.toFormat","other",E)},br=function(E,x){return E=d(E,q(this,b),x),new N(l,E,q(this,b))},Da=function(E,x){return _e(this,y,cn).call(this,E),_e(this,y,br).call(this,q(this,P)+q(E,P),x)},Ha=function(E,x){return _e(this,y,cn).call(this,E),_e(this,y,br).call(this,q(this,P)-q(E,P),x)},$a=function(E,x){return _e(this,y,cn).call(this,E),_e(this,y,br).call(this,q(this,P)*q(E,P)/q(this,w),x)},Ga=function(E,x){return(0,t.assert)(q(E,P)!==s,"division by zero","NUMERIC_FAULT",{operation:"div",fault:"divide-by-zero",value:this}),_e(this,y,cn).call(this,E),_e(this,y,br).call(this,q(this,P)*q(this,w)/q(E,P),x)};let h=N;return qn.FixedNumber=h,qn}var Vn={},Vu;function Ig(){if(Vu)return Vn;Vu=1,Object.defineProperty(Vn,"__esModule",{value:!0}),Vn.decodeRlp=void 0;const e=Qt(),t=sr(),r=Qt();function n(l){let a=l.toString(16);for(;a.length<2;)a="0"+a;return"0x"+a}function i(l,a,f){let d=0;for(let c=0;c<f;c++)d=d*256+l[a+c];return d}function s(l,a,f,d){const c=[];for(;f<a+1+d;){const g=o(l,f);c.push(g.result),f+=g.consumed,(0,t.assert)(f<=a+1+d,"child data too short","BUFFER_OVERRUN",{buffer:l,length:d,offset:a})}return{consumed:1+d,result:c}}function o(l,a){(0,t.assert)(l.length!==0,"data too short","BUFFER_OVERRUN",{buffer:l,length:0,offset:1});const f=d=>{(0,t.assert)(d<=l.length,"data short segment too short","BUFFER_OVERRUN",{buffer:l,length:l.length,offset:d})};if(l[a]>=248){const d=l[a]-247;f(a+1+d);const c=i(l,a+1,d);return f(a+1+d+c),s(l,a,a+1+d,d+c)}else if(l[a]>=192){const d=l[a]-192;return f(a+1+d),s(l,a,a+1,d)}else if(l[a]>=184){const d=l[a]-183;f(a+1+d);const c=i(l,a+1,d);f(a+1+d+c);const g=(0,e.hexlify)(l.slice(a+1+d,a+1+d+c));return{consumed:1+d+c,result:g}}else if(l[a]>=128){const d=l[a]-128;f(a+1+d);const c=(0,e.hexlify)(l.slice(a+1,a+1+d));return{consumed:1+d,result:c}}return{consumed:1,result:n(l[a])}}function u(l){const a=(0,r.getBytes)(l,"data"),f=o(a,0);return(0,t.assertArgument)(f.consumed===a.length,"unexpected junk after rlp payload","data",l),f.result}return Vn.decodeRlp=u,Vn}var zn={},zu;function Mg(){if(zu)return zn;zu=1,Object.defineProperty(zn,"__esModule",{value:!0}),zn.encodeRlp=void 0;const e=Qt();function t(s){const o=[];for(;s;)o.unshift(s&255),s>>=8;return o}function r(s){if(Array.isArray(s)){let l=[];if(s.forEach(function(f){l=l.concat(r(f))}),l.length<=55)return l.unshift(192+l.length),l;const a=t(l.length);return a.unshift(247+a.length),a.concat(l)}const o=Array.prototype.slice.call((0,e.getBytes)(s,"object"));if(o.length===1&&o[0]<=127)return o;if(o.length<=55)return o.unshift(128+o.length),o;const u=t(o.length);return u.unshift(183+u.length),u.concat(o)}const n="0123456789abcdef";function i(s){let o="0x";for(const u of r(s))o+=n[u>>4],o+=n[u&15];return o}return zn.encodeRlp=i,zn}var Gt={},Wu;function Lg(){if(Wu)return Gt;Wu=1,Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.parseEther=Gt.formatEther=Gt.parseUnits=Gt.formatUnits=void 0;const e=sr(),t=Q0(),r=ds(),n=["wei","kwei","mwei","gwei","szabo","finney","ether"];function i(l,a){let f=18;if(typeof a=="string"){const d=n.indexOf(a);(0,e.assertArgument)(d>=0,"invalid unit","unit",a),f=3*d}else a!=null&&(f=(0,r.getNumber)(a,"unit"));return t.FixedNumber.fromValue(l,f,{decimals:f,width:512}).toString()}Gt.formatUnits=i;function s(l,a){(0,e.assertArgument)(typeof l=="string","value must be a string","value",l);let f=18;if(typeof a=="string"){const d=n.indexOf(a);(0,e.assertArgument)(d>=0,"invalid unit","unit",a),f=3*d}else a!=null&&(f=(0,r.getNumber)(a,"unit"));return t.FixedNumber.fromString(l,{decimals:f,width:512}).value}Gt.parseUnits=s;function o(l){return i(l,18)}Gt.formatEther=o;function u(l){return s(l,18)}return Gt.parseEther=u,Gt}var Wn={},Ju;function Ug(){if(Ju)return Wn;Ju=1,Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.uuidV4=void 0;const e=Qt();function t(r){const n=(0,e.getBytes)(r,"randomBytes");n[6]=n[6]&15|64,n[8]=n[8]&63|128;const i=(0,e.hexlify)(n);return[i.substring(2,10),i.substring(10,14),i.substring(14,18),i.substring(18,22),i.substring(22,34)].join("-")}return Wn.uuidV4=t,Wn}var Qu;function Ce(){return Qu||(Qu=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.toUtf8String=e.toUtf8CodePoints=e.toUtf8Bytes=e.parseUnits=e.formatUnits=e.parseEther=e.formatEther=e.encodeRlp=e.decodeRlp=e.defineProperties=e.resolveProperties=e.toQuantity=e.toBeArray=e.toBeHex=e.toNumber=e.toBigInt=e.getUint=e.getNumber=e.getBigInt=e.mask=e.toTwos=e.fromTwos=e.FixedNumber=e.FetchCancelSignal=e.FetchResponse=e.FetchRequest=e.EventPayload=e.makeError=e.assertNormalize=e.assertPrivate=e.assertArgumentCount=e.assertArgument=e.assert=e.isError=e.isCallException=e.zeroPadBytes=e.zeroPadValue=e.stripZerosLeft=e.dataSlice=e.dataLength=e.concat=e.hexlify=e.isBytesLike=e.isHexString=e.getBytesCopy=e.getBytes=e.encodeBase64=e.decodeBase64=e.encodeBase58=e.decodeBase58=void 0,e.uuidV4=e.Utf8ErrorFuncs=void 0;var t=Bg();Object.defineProperty(e,"decodeBase58",{enumerable:!0,get:function(){return t.decodeBase58}}),Object.defineProperty(e,"encodeBase58",{enumerable:!0,get:function(){return t.encodeBase58}});var r=J0();Object.defineProperty(e,"decodeBase64",{enumerable:!0,get:function(){return r.decodeBase64}}),Object.defineProperty(e,"encodeBase64",{enumerable:!0,get:function(){return r.encodeBase64}});var n=Qt();Object.defineProperty(e,"getBytes",{enumerable:!0,get:function(){return n.getBytes}}),Object.defineProperty(e,"getBytesCopy",{enumerable:!0,get:function(){return n.getBytesCopy}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return n.isHexString}}),Object.defineProperty(e,"isBytesLike",{enumerable:!0,get:function(){return n.isBytesLike}}),Object.defineProperty(e,"hexlify",{enumerable:!0,get:function(){return n.hexlify}}),Object.defineProperty(e,"concat",{enumerable:!0,get:function(){return n.concat}}),Object.defineProperty(e,"dataLength",{enumerable:!0,get:function(){return n.dataLength}}),Object.defineProperty(e,"dataSlice",{enumerable:!0,get:function(){return n.dataSlice}}),Object.defineProperty(e,"stripZerosLeft",{enumerable:!0,get:function(){return n.stripZerosLeft}}),Object.defineProperty(e,"zeroPadValue",{enumerable:!0,get:function(){return n.zeroPadValue}}),Object.defineProperty(e,"zeroPadBytes",{enumerable:!0,get:function(){return n.zeroPadBytes}});var i=sr();Object.defineProperty(e,"isCallException",{enumerable:!0,get:function(){return i.isCallException}}),Object.defineProperty(e,"isError",{enumerable:!0,get:function(){return i.isError}}),Object.defineProperty(e,"assert",{enumerable:!0,get:function(){return i.assert}}),Object.defineProperty(e,"assertArgument",{enumerable:!0,get:function(){return i.assertArgument}}),Object.defineProperty(e,"assertArgumentCount",{enumerable:!0,get:function(){return i.assertArgumentCount}}),Object.defineProperty(e,"assertPrivate",{enumerable:!0,get:function(){return i.assertPrivate}}),Object.defineProperty(e,"assertNormalize",{enumerable:!0,get:function(){return i.assertNormalize}}),Object.defineProperty(e,"makeError",{enumerable:!0,get:function(){return i.makeError}});var s=Cg();Object.defineProperty(e,"EventPayload",{enumerable:!0,get:function(){return s.EventPayload}});var o=Ng();Object.defineProperty(e,"FetchRequest",{enumerable:!0,get:function(){return o.FetchRequest}}),Object.defineProperty(e,"FetchResponse",{enumerable:!0,get:function(){return o.FetchResponse}}),Object.defineProperty(e,"FetchCancelSignal",{enumerable:!0,get:function(){return o.FetchCancelSignal}});var u=Q0();Object.defineProperty(e,"FixedNumber",{enumerable:!0,get:function(){return u.FixedNumber}});var l=ds();Object.defineProperty(e,"fromTwos",{enumerable:!0,get:function(){return l.fromTwos}}),Object.defineProperty(e,"toTwos",{enumerable:!0,get:function(){return l.toTwos}}),Object.defineProperty(e,"mask",{enumerable:!0,get:function(){return l.mask}}),Object.defineProperty(e,"getBigInt",{enumerable:!0,get:function(){return l.getBigInt}}),Object.defineProperty(e,"getNumber",{enumerable:!0,get:function(){return l.getNumber}}),Object.defineProperty(e,"getUint",{enumerable:!0,get:function(){return l.getUint}}),Object.defineProperty(e,"toBigInt",{enumerable:!0,get:function(){return l.toBigInt}}),Object.defineProperty(e,"toNumber",{enumerable:!0,get:function(){return l.toNumber}}),Object.defineProperty(e,"toBeHex",{enumerable:!0,get:function(){return l.toBeHex}}),Object.defineProperty(e,"toBeArray",{enumerable:!0,get:function(){return l.toBeArray}}),Object.defineProperty(e,"toQuantity",{enumerable:!0,get:function(){return l.toQuantity}});var a=gn();Object.defineProperty(e,"resolveProperties",{enumerable:!0,get:function(){return a.resolveProperties}}),Object.defineProperty(e,"defineProperties",{enumerable:!0,get:function(){return a.defineProperties}});var f=Ig();Object.defineProperty(e,"decodeRlp",{enumerable:!0,get:function(){return f.decodeRlp}});var d=Mg();Object.defineProperty(e,"encodeRlp",{enumerable:!0,get:function(){return d.encodeRlp}});var c=Lg();Object.defineProperty(e,"formatEther",{enumerable:!0,get:function(){return c.formatEther}}),Object.defineProperty(e,"parseEther",{enumerable:!0,get:function(){return c.parseEther}}),Object.defineProperty(e,"formatUnits",{enumerable:!0,get:function(){return c.formatUnits}}),Object.defineProperty(e,"parseUnits",{enumerable:!0,get:function(){return c.parseUnits}});var g=Cc();Object.defineProperty(e,"toUtf8Bytes",{enumerable:!0,get:function(){return g.toUtf8Bytes}}),Object.defineProperty(e,"toUtf8CodePoints",{enumerable:!0,get:function(){return g.toUtf8CodePoints}}),Object.defineProperty(e,"toUtf8String",{enumerable:!0,get:function(){return g.toUtf8String}}),Object.defineProperty(e,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return g.Utf8ErrorFuncs}});var h=Ug();Object.defineProperty(e,"uuidV4",{enumerable:!0,get:function(){return h.uuidV4}})}(Jo)),Jo}var Yo={},Yu;function Zt(){return Yu||(Yu=1,function(e){var c,h,b,P,Rs,y,v,p,Y0;Object.defineProperty(e,"__esModule",{value:!0}),e.Reader=e.Writer=e.Coder=e.checkResultErrors=e.Result=e.WordSize=void 0;const t=Ce();e.WordSize=32;const r=new Uint8Array(e.WordSize),n=["then"],i={};function s(R,T){const N=new Error(`deferred error during ABI decoding triggered accessing ${R}`);throw N.error=T,N}const g=class g extends Array{constructor(...N){const S=N[0];let E=N[1],x=(N[2]||[]).slice(),A=!0;S!==i&&(E=N,x=[],A=!1);super(E.length);xe(this,c);E.forEach((I,L)=>{this[L]=I});const O=x.reduce((I,L)=>(typeof L=="string"&&I.set(L,(I.get(L)||0)+1),I),new Map);if(ue(this,c,Object.freeze(E.map((I,L)=>{const H=x[L];return H!=null&&O.get(H)===1?H:null}))),!!A)return Object.freeze(this),new Proxy(this,{get:(I,L,H)=>{if(typeof L=="string"){if(L.match(/^[0-9]+$/)){const D=(0,t.getNumber)(L,"%index");if(D<0||D>=this.length)throw new RangeError("out of result range");const j=I[D];return j instanceof Error&&s(`index ${D}`,j),j}if(n.indexOf(L)>=0)return Reflect.get(I,L,H);const V=I[L];if(V instanceof Function)return function(...D){return V.apply(this===H?I:this,D)};if(!(L in I))return I.getValue.apply(this===H?I:this,[L])}return Reflect.get(I,L,H)}})}toArray(){const N=[];return this.forEach((S,E)=>{S instanceof Error&&s(`index ${E}`,S),N.push(S)}),N}toObject(){return q(this,c).reduce((N,S,E)=>((0,t.assert)(S!=null,"value at index ${ index } unnamed","UNSUPPORTED_OPERATION",{operation:"toObject()"}),S in N||(N[S]=this.getValue(S)),N),{})}slice(N,S){N==null&&(N=0),N<0&&(N+=this.length,N<0&&(N=0)),S==null&&(S=this.length),S<0&&(S+=this.length,S<0&&(S=0)),S>this.length&&(S=this.length);const E=[],x=[];for(let A=N;A<S;A++)E.push(this[A]),x.push(q(this,c)[A]);return new g(i,E,x)}filter(N,S){const E=[],x=[];for(let A=0;A<this.length;A++){const O=this[A];O instanceof Error&&s(`index ${A}`,O),N.call(S,O,A,this)&&(E.push(O),x.push(q(this,c)[A]))}return new g(i,E,x)}map(N,S){const E=[];for(let x=0;x<this.length;x++){const A=this[x];A instanceof Error&&s(`index ${x}`,A),E.push(N.call(S,A,x,this))}return E}getValue(N){const S=q(this,c).indexOf(N);if(S===-1)return;const E=this[S];return E instanceof Error&&s(`property ${JSON.stringify(N)}`,E.error),E}static fromItems(N,S){return new g(i,N,S)}};c=new WeakMap;let o=g;e.Result=o;function u(R){const T=[],N=function(S,E){if(Array.isArray(E))for(let x in E){const A=S.slice();A.push(x);try{N(A,E[x])}catch(O){T.push({path:A,error:O})}}};return N([],R),T}e.checkResultErrors=u;function l(R){let T=(0,t.toBeArray)(R);return(0,t.assert)(T.length<=e.WordSize,"value out-of-bounds","BUFFER_OVERRUN",{buffer:T,length:e.WordSize,offset:T.length}),T.length!==e.WordSize&&(T=(0,t.getBytesCopy)((0,t.concat)([r.slice(T.length%e.WordSize),T]))),T}class a{constructor(T,N,S,E){pe(this,"name");pe(this,"type");pe(this,"localName");pe(this,"dynamic");(0,t.defineProperties)(this,{name:T,type:N,localName:S,dynamic:E},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(T,N){(0,t.assertArgument)(!1,T,this.localName,N)}}e.Coder=a;class f{constructor(){xe(this,P);xe(this,h);xe(this,b);ue(this,h,[]),ue(this,b,0)}get data(){return(0,t.concat)(q(this,h))}get length(){return q(this,b)}appendWriter(T){return _e(this,P,Rs).call(this,(0,t.getBytesCopy)(T.data))}writeBytes(T){let N=(0,t.getBytesCopy)(T);const S=N.length%e.WordSize;return S&&(N=(0,t.getBytesCopy)((0,t.concat)([N,r.slice(S)]))),_e(this,P,Rs).call(this,N)}writeValue(T){return _e(this,P,Rs).call(this,l(T))}writeUpdatableValue(){const T=q(this,h).length;return q(this,h).push(r),ue(this,b,q(this,b)+e.WordSize),N=>{q(this,h)[T]=l(N)}}}h=new WeakMap,b=new WeakMap,P=new WeakSet,Rs=function(T){return q(this,h).push(T),ue(this,b,q(this,b)+T.length),T.length},e.Writer=f;const k=class k{constructor(T,N){xe(this,p);pe(this,"allowLoose");xe(this,y);xe(this,v);(0,t.defineProperties)(this,{allowLoose:!!N}),ue(this,y,(0,t.getBytesCopy)(T)),ue(this,v,0)}get data(){return(0,t.hexlify)(q(this,y))}get dataLength(){return q(this,y).length}get consumed(){return q(this,v)}get bytes(){return new Uint8Array(q(this,y))}subReader(T){return new k(q(this,y).slice(q(this,v)+T),this.allowLoose)}readBytes(T,N){let S=_e(this,p,Y0).call(this,0,T,!!N);return ue(this,v,q(this,v)+S.length),S.slice(0,T)}readValue(){return(0,t.toBigInt)(this.readBytes(e.WordSize))}readIndex(){return(0,t.toNumber)(this.readBytes(e.WordSize))}};y=new WeakMap,v=new WeakMap,p=new WeakSet,Y0=function(T,N,S){let E=Math.ceil(N/e.WordSize)*e.WordSize;return q(this,v)+E>q(this,y).length&&(this.allowLoose&&S&&q(this,v)+N<=q(this,y).length?E=N:(0,t.assert)(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:(0,t.getBytesCopy)(q(this,y)),length:q(this,y).length,offset:q(this,v)+E})),q(this,y).slice(q(this,v),q(this,v)+E)};let d=k;e.Reader=d}(Yo)),Yo}var Jn={},Zo={},Fr={},Xo={},Qn={},Kt={},ea={},bt={},Zu;function hs(){if(Zu)return bt;Zu=1,Object.defineProperty(bt,"__esModule",{value:!0}),bt.output=bt.exists=bt.hash=bt.bytes=bt.bool=bt.number=void 0;function e(u){if(!Number.isSafeInteger(u)||u<0)throw new Error(`Wrong positive integer: ${u}`)}bt.number=e;function t(u){if(typeof u!="boolean")throw new Error(`Expected boolean, not ${u}`)}bt.bool=t;function r(u,...l){if(!(u instanceof Uint8Array))throw new Error("Expected Uint8Array");if(l.length>0&&!l.includes(u.length))throw new Error(`Expected Uint8Array of length ${l}, not of length=${u.length}`)}bt.bytes=r;function n(u){if(typeof u!="function"||typeof u.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");e(u.outputLen),e(u.blockLen)}bt.hash=n;function i(u,l=!0){if(u.destroyed)throw new Error("Hash instance has been destroyed");if(l&&u.finished)throw new Error("Hash#digest() has already been called")}bt.exists=i;function s(u,l){r(u);const a=l.outputLen;if(u.length<a)throw new Error(`digestInto() expects output buffer of length at least ${a}`)}bt.output=s;const o={number:e,bool:t,bytes:r,hash:n,exists:i,output:s};return bt.default=o,bt}var ta={},Yn={},Xu;function Fg(){return Xu||(Xu=1,Object.defineProperty(Yn,"__esModule",{value:!0}),Yn.crypto=void 0,Yn.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),Yn}var el;function or(){return el||(el=1,function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.isLE=e.rotr=e.createView=e.u32=e.u8=void 0;const t=Fg(),r=k=>k instanceof Uint8Array,n=k=>new Uint8Array(k.buffer,k.byteOffset,k.byteLength);e.u8=n;const i=k=>new Uint32Array(k.buffer,k.byteOffset,Math.floor(k.byteLength/4));e.u32=i;const s=k=>new DataView(k.buffer,k.byteOffset,k.byteLength);e.createView=s;const o=(k,R)=>k<<32-R|k>>>R;if(e.rotr=o,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!e.isLE)throw new Error("Non little-endian hardware is not supported");const u=Array.from({length:256},(k,R)=>R.toString(16).padStart(2,"0"));function l(k){if(!r(k))throw new Error("Uint8Array expected");let R="";for(let T=0;T<k.length;T++)R+=u[k[T]];return R}e.bytesToHex=l;function a(k){if(typeof k!="string")throw new Error("hex string expected, got "+typeof k);const R=k.length;if(R%2)throw new Error("padded hex string expected, got unpadded hex of length "+R);const T=new Uint8Array(R/2);for(let N=0;N<T.length;N++){const S=N*2,E=k.slice(S,S+2),x=Number.parseInt(E,16);if(Number.isNaN(x)||x<0)throw new Error("Invalid byte sequence");T[N]=x}return T}e.hexToBytes=a;const f=async()=>{};e.nextTick=f;async function d(k,R,T){let N=Date.now();for(let S=0;S<k;S++){T(S);const E=Date.now()-N;E>=0&&E<R||(await(0,e.nextTick)(),N+=E)}}e.asyncLoop=d;function c(k){if(typeof k!="string")throw new Error(`utf8ToBytes expected string, got ${typeof k}`);return new Uint8Array(new TextEncoder().encode(k))}e.utf8ToBytes=c;function g(k){if(typeof k=="string"&&(k=c(k)),!r(k))throw new Error(`expected Uint8Array, got ${typeof k}`);return k}e.toBytes=g;function h(...k){const R=new Uint8Array(k.reduce((N,S)=>N+S.length,0));let T=0;return k.forEach(N=>{if(!r(N))throw new Error("Uint8Array expected");R.set(N,T),T+=N.length}),R}e.concatBytes=h;class b{clone(){return this._cloneInto()}}e.Hash=b;const P={}.toString;function w(k,R){if(R!==void 0&&P.call(R)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(k,R)}e.checkOpts=w;function y(k){const R=N=>k().update(g(N)).digest(),T=k();return R.outputLen=T.outputLen,R.blockLen=T.blockLen,R.create=()=>k(),R}e.wrapConstructor=y;function v(k){const R=(N,S)=>k(S).update(g(N)).digest(),T=k({});return R.outputLen=T.outputLen,R.blockLen=T.blockLen,R.create=N=>k(N),R}e.wrapConstructorWithOpts=v;function p(k){const R=(N,S)=>k(S).update(g(N)).digest(),T=k({});return R.outputLen=T.outputLen,R.blockLen=T.blockLen,R.create=N=>k(N),R}e.wrapXOFConstructorWithOpts=p;function B(k=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(k));throw new Error("crypto.getRandomValues must be defined")}e.randomBytes=B}(ta)),ta}var tl;function Rc(){return tl||(tl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const t=hs(),r=or();class n extends r.Hash{constructor(o,u){super(),this.finished=!1,this.destroyed=!1,(0,t.hash)(o);const l=(0,r.toBytes)(u);if(this.iHash=o.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 a=this.blockLen,f=new Uint8Array(a);f.set(l.length>a?o.create().update(l).digest():l);for(let d=0;d<f.length;d++)f[d]^=54;this.iHash.update(f),this.oHash=o.create();for(let d=0;d<f.length;d++)f[d]^=106;this.oHash.update(f),f.fill(0)}update(o){return(0,t.exists)(this),this.iHash.update(o),this}digestInto(o){(0,t.exists)(this),(0,t.bytes)(o,this.outputLen),this.finished=!0,this.iHash.digestInto(o),this.oHash.update(o),this.oHash.digestInto(o),this.destroy()}digest(){const o=new Uint8Array(this.oHash.outputLen);return this.digestInto(o),o}_cloneInto(o){o||(o=Object.create(Object.getPrototypeOf(this),{}));const{oHash:u,iHash:l,finished:a,destroyed:f,blockLen:d,outputLen:c}=this;return o=o,o.finished=a,o.destroyed=f,o.blockLen=d,o.outputLen=c,o.oHash=u._cloneInto(o.oHash),o.iHash=l._cloneInto(o.iHash),o}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=n;const i=(s,o,u)=>new n(s,o).update(u).digest();e.hmac=i,e.hmac.create=(s,o)=>new n(s,o)}(ea)),ea}var jr={},rl;function Z0(){if(rl)return jr;rl=1,Object.defineProperty(jr,"__esModule",{value:!0}),jr.pbkdf2Async=jr.pbkdf2=void 0;const e=hs(),t=Rc(),r=or();function n(u,l,a,f){(0,e.hash)(u);const d=(0,r.checkOpts)({dkLen:32,asyncTick:10},f),{c,dkLen:g,asyncTick:h}=d;if((0,e.number)(c),(0,e.number)(g),(0,e.number)(h),c<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const b=(0,r.toBytes)(l),P=(0,r.toBytes)(a),w=new Uint8Array(g),y=t.hmac.create(u,b),v=y._cloneInto().update(P);return{c,dkLen:g,asyncTick:h,DK:w,PRF:y,PRFSalt:v}}function i(u,l,a,f,d){return u.destroy(),l.destroy(),f&&f.destroy(),d.fill(0),a}function s(u,l,a,f){const{c:d,dkLen:c,DK:g,PRF:h,PRFSalt:b}=n(u,l,a,f);let P;const w=new Uint8Array(4),y=(0,r.createView)(w),v=new Uint8Array(h.outputLen);for(let p=1,B=0;B<c;p++,B+=h.outputLen){const k=g.subarray(B,B+h.outputLen);y.setInt32(0,p,!1),(P=b._cloneInto(P)).update(w).digestInto(v),k.set(v.subarray(0,k.length));for(let R=1;R<d;R++){h._cloneInto(P).update(v).digestInto(v);for(let T=0;T<k.length;T++)k[T]^=v[T]}}return i(h,b,g,P,v)}jr.pbkdf2=s;async function o(u,l,a,f){const{c:d,dkLen:c,asyncTick:g,DK:h,PRF:b,PRFSalt:P}=n(u,l,a,f);let w;const y=new Uint8Array(4),v=(0,r.createView)(y),p=new Uint8Array(b.outputLen);for(let B=1,k=0;k<c;B++,k+=b.outputLen){const R=h.subarray(k,k+b.outputLen);v.setInt32(0,B,!1),(w=P._cloneInto(w)).update(y).digestInto(p),R.set(p.subarray(0,R.length)),await(0,r.asyncLoop)(d-1,g,()=>{b._cloneInto(w).update(p).digestInto(p);for(let T=0;T<R.length;T++)R[T]^=p[T]})}return i(b,P,h,w,p)}return jr.pbkdf2Async=o,jr}var Dr={},Zn={},nl;function Nc(){if(nl)return Zn;nl=1,Object.defineProperty(Zn,"__esModule",{value:!0}),Zn.SHA2=void 0;const e=hs(),t=or();function r(i,s,o,u){if(typeof i.setBigUint64=="function")return i.setBigUint64(s,o,u);const l=BigInt(32),a=BigInt(4294967295),f=Number(o>>l&a),d=Number(o&a),c=u?4:0,g=u?0:4;i.setUint32(s+c,f,u),i.setUint32(s+g,d,u)}class n extends t.Hash{constructor(s,o,u,l){super(),this.blockLen=s,this.outputLen=o,this.padOffset=u,this.isLE=l,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(s),this.view=(0,t.createView)(this.buffer)}update(s){(0,e.exists)(this);const{view:o,buffer:u,blockLen:l}=this;s=(0,t.toBytes)(s);const a=s.length;for(let f=0;f<a;){const d=Math.min(l-this.pos,a-f);if(d===l){const c=(0,t.createView)(s);for(;l<=a-f;f+=l)this.process(c,f);continue}u.set(s.subarray(f,f+d),this.pos),this.pos+=d,f+=d,this.pos===l&&(this.process(o,0),this.pos=0)}return this.length+=s.length,this.roundClean(),this}digestInto(s){(0,e.exists)(this),(0,e.output)(s,this),this.finished=!0;const{buffer:o,view:u,blockLen:l,isLE:a}=this;let{pos:f}=this;o[f++]=128,this.buffer.subarray(f).fill(0),this.padOffset>l-f&&(this.process(u,0),f=0);for(let b=f;b<l;b++)o[b]=0;r(u,l-8,BigInt(this.length*8),a),this.process(u,0);const d=(0,t.createView)(s),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const g=c/4,h=this.get();if(g>h.length)throw new Error("_sha2: outputLen bigger than state");for(let b=0;b<g;b++)d.setUint32(4*b,h[b],a)}digest(){const{buffer:s,outputLen:o}=this;this.digestInto(s);const u=s.slice(0,o);return this.destroy(),u}_cloneInto(s){s||(s=new this.constructor),s.set(...this.get());const{blockLen:o,buffer:u,length:l,finished:a,destroyed:f,pos:d}=this;return s.length=l,s.pos=d,s.finished=a,s.destroyed=f,l%o&&s.buffer.set(u),s}}return Zn.SHA2=n,Zn}var il;function Ic(){if(il)return Dr;il=1,Object.defineProperty(Dr,"__esModule",{value:!0}),Dr.sha224=Dr.sha256=void 0;const e=Nc(),t=or(),r=(a,f,d)=>a&f^~a&d,n=(a,f,d)=>a&f^a&d^f&d,i=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]),s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),o=new Uint32Array(64);class u extends e.SHA2{constructor(){super(64,32,8,!1),this.A=s[0]|0,this.B=s[1]|0,this.C=s[2]|0,this.D=s[3]|0,this.E=s[4]|0,this.F=s[5]|0,this.G=s[6]|0,this.H=s[7]|0}get(){const{A:f,B:d,C:c,D:g,E:h,F:b,G:P,H:w}=this;return[f,d,c,g,h,b,P,w]}set(f,d,c,g,h,b,P,w){this.A=f|0,this.B=d|0,this.C=c|0,this.D=g|0,this.E=h|0,this.F=b|0,this.G=P|0,this.H=w|0}process(f,d){for(let p=0;p<16;p++,d+=4)o[p]=f.getUint32(d,!1);for(let p=16;p<64;p++){const B=o[p-15],k=o[p-2],R=(0,t.rotr)(B,7)^(0,t.rotr)(B,18)^B>>>3,T=(0,t.rotr)(k,17)^(0,t.rotr)(k,19)^k>>>10;o[p]=T+o[p-7]+R+o[p-16]|0}let{A:c,B:g,C:h,D:b,E:P,F:w,G:y,H:v}=this;for(let p=0;p<64;p++){const B=(0,t.rotr)(P,6)^(0,t.rotr)(P,11)^(0,t.rotr)(P,25),k=v+B+r(P,w,y)+i[p]+o[p]|0,T=((0,t.rotr)(c,2)^(0,t.rotr)(c,13)^(0,t.rotr)(c,22))+n(c,g,h)|0;v=y,y=w,w=P,P=b+k|0,b=h,h=g,g=c,c=k+T|0}c=c+this.A|0,g=g+this.B|0,h=h+this.C|0,b=b+this.D|0,P=P+this.E|0,w=w+this.F|0,y=y+this.G|0,v=v+this.H|0,this.set(c,g,h,b,P,w,y,v)}roundClean(){o.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class l extends u{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 Dr.sha256=(0,t.wrapConstructor)(()=>new u),Dr.sha224=(0,t.wrapConstructor)(()=>new l),Dr}var Ot={},Ue={},sl;function X0(){if(sl)return Ue;sl=1,Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.add5L=Ue.add5H=Ue.add4H=Ue.add4L=Ue.add3H=Ue.add3L=Ue.add=Ue.rotlBL=Ue.rotlBH=Ue.rotlSL=Ue.rotlSH=Ue.rotr32L=Ue.rotr32H=Ue.rotrBL=Ue.rotrBH=Ue.rotrSL=Ue.rotrSH=Ue.shrSL=Ue.shrSH=Ue.toBig=Ue.split=Ue.fromBig=void 0;const e=BigInt(2**32-1),t=BigInt(32);function r(N,S=!1){return S?{h:Number(N&e),l:Number(N>>t&e)}:{h:Number(N>>t&e)|0,l:Number(N&e)|0}}Ue.fromBig=r;function n(N,S=!1){let E=new Uint32Array(N.length),x=new Uint32Array(N.length);for(let A=0;A<N.length;A++){const{h:O,l:I}=r(N[A],S);[E[A],x[A]]=[O,I]}return[E,x]}Ue.split=n;const i=(N,S)=>BigInt(N>>>0)<<t|BigInt(S>>>0);Ue.toBig=i;const s=(N,S,E)=>N>>>E;Ue.shrSH=s;const o=(N,S,E)=>N<<32-E|S>>>E;Ue.shrSL=o;const u=(N,S,E)=>N>>>E|S<<32-E;Ue.rotrSH=u;const l=(N,S,E)=>N<<32-E|S>>>E;Ue.rotrSL=l;const a=(N,S,E)=>N<<64-E|S>>>E-32;Ue.rotrBH=a;const f=(N,S,E)=>N>>>E-32|S<<64-E;Ue.rotrBL=f;const d=(N,S)=>S;Ue.rotr32H=d;const c=(N,S)=>N;Ue.rotr32L=c;const g=(N,S,E)=>N<<E|S>>>32-E;Ue.rotlSH=g;const h=(N,S,E)=>S<<E|N>>>32-E;Ue.rotlSL=h;const b=(N,S,E)=>S<<E-32|N>>>64-E;Ue.rotlBH=b;const P=(N,S,E)=>N<<E-32|S>>>64-E;Ue.rotlBL=P;function w(N,S,E,x){const A=(S>>>0)+(x>>>0);return{h:N+E+(A/2**32|0)|0,l:A|0}}Ue.add=w;const y=(N,S,E)=>(N>>>0)+(S>>>0)+(E>>>0);Ue.add3L=y;const v=(N,S,E,x)=>S+E+x+(N/2**32|0)|0;Ue.add3H=v;const p=(N,S,E,x)=>(N>>>0)+(S>>>0)+(E>>>0)+(x>>>0);Ue.add4L=p;const B=(N,S,E,x,A)=>S+E+x+A+(N/2**32|0)|0;Ue.add4H=B;const k=(N,S,E,x,A)=>(N>>>0)+(S>>>0)+(E>>>0)+(x>>>0)+(A>>>0);Ue.add5L=k;const R=(N,S,E,x,A,O)=>S+E+x+A+O+(N/2**32|0)|0;Ue.add5H=R;const T={fromBig:r,split:n,toBig:i,shrSH:s,shrSL:o,rotrSH:u,rotrSL:l,rotrBH:a,rotrBL:f,rotr32H:d,rotr32L:c,rotlSH:g,rotlSL:h,rotlBH:b,rotlBL:P,add:w,add3L:y,add3H:v,add4L:p,add4H:B,add5H:R,add5L:k};return Ue.default=T,Ue}var ol;function jg(){if(ol)return Ot;ol=1,Object.defineProperty(Ot,"__esModule",{value:!0}),Ot.sha384=Ot.sha512_256=Ot.sha512_224=Ot.sha512=Ot.SHA512=void 0;const e=Nc(),t=X0(),r=or(),[n,i]=t.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(d=>BigInt(d))),s=new Uint32Array(80),o=new Uint32Array(80);class u extends e.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:c,Al:g,Bh:h,Bl:b,Ch:P,Cl:w,Dh:y,Dl:v,Eh:p,El:B,Fh:k,Fl:R,Gh:T,Gl:N,Hh:S,Hl:E}=this;return[c,g,h,b,P,w,y,v,p,B,k,R,T,N,S,E]}set(c,g,h,b,P,w,y,v,p,B,k,R,T,N,S,E){this.Ah=c|0,this.Al=g|0,this.Bh=h|0,this.Bl=b|0,this.Ch=P|0,this.Cl=w|0,this.Dh=y|0,this.Dl=v|0,this.Eh=p|0,this.El=B|0,this.Fh=k|0,this.Fl=R|0,this.Gh=T|0,this.Gl=N|0,this.Hh=S|0,this.Hl=E|0}process(c,g){for(let O=0;O<16;O++,g+=4)s[O]=c.getUint32(g),o[O]=c.getUint32(g+=4);for(let O=16;O<80;O++){const I=s[O-15]|0,L=o[O-15]|0,H=t.default.rotrSH(I,L,1)^t.default.rotrSH(I,L,8)^t.default.shrSH(I,L,7),V=t.default.rotrSL(I,L,1)^t.default.rotrSL(I,L,8)^t.default.shrSL(I,L,7),D=s[O-2]|0,j=o[O-2]|0,$=t.default.rotrSH(D,j,19)^t.default.rotrBH(D,j,61)^t.default.shrSH(D,j,6),F=t.default.rotrSL(D,j,19)^t.default.rotrBL(D,j,61)^t.default.shrSL(D,j,6),M=t.default.add4L(V,F,o[O-7],o[O-16]),ee=t.default.add4H(M,H,$,s[O-7],s[O-16]);s[O]=ee|0,o[O]=M|0}let{Ah:h,Al:b,Bh:P,Bl:w,Ch:y,Cl:v,Dh:p,Dl:B,Eh:k,El:R,Fh:T,Fl:N,Gh:S,Gl:E,Hh:x,Hl:A}=this;for(let O=0;O<80;O++){const I=t.default.rotrSH(k,R,14)^t.default.rotrSH(k,R,18)^t.default.rotrBH(k,R,41),L=t.default.rotrSL(k,R,14)^t.default.rotrSL(k,R,18)^t.default.rotrBL(k,R,41),H=k&T^~k&S,V=R&N^~R&E,D=t.default.add5L(A,L,V,i[O],o[O]),j=t.default.add5H(D,x,I,H,n[O],s[O]),$=D|0,F=t.default.rotrSH(h,b,28)^t.default.rotrBH(h,b,34)^t.default.rotrBH(h,b,39),M=t.default.rotrSL(h,b,28)^t.default.rotrBL(h,b,34)^t.default.rotrBL(h,b,39),ee=h&P^h&y^P&y,de=b&w^b&v^w&v;x=S|0,A=E|0,S=T|0,E=N|0,T=k|0,N=R|0,{h:k,l:R}=t.default.add(p|0,B|0,j|0,$|0),p=y|0,B=v|0,y=P|0,v=w|0,P=h|0,w=b|0;const Q=t.default.add3L($,M,de);h=t.default.add3H(Q,j,F,ee),b=Q|0}({h,l:b}=t.default.add(this.Ah|0,this.Al|0,h|0,b|0)),{h:P,l:w}=t.default.add(this.Bh|0,this.Bl|0,P|0,w|0),{h:y,l:v}=t.default.add(this.Ch|0,this.Cl|0,y|0,v|0),{h:p,l:B}=t.default.add(this.Dh|0,this.Dl|0,p|0,B|0),{h:k,l:R}=t.default.add(this.Eh|0,this.El|0,k|0,R|0),{h:T,l:N}=t.default.add(this.Fh|0,this.Fl|0,T|0,N|0),{h:S,l:E}=t.default.add(this.Gh|0,this.Gl|0,S|0,E|0),{h:x,l:A}=t.default.add(this.Hh|0,this.Hl|0,x|0,A|0),this.set(h,b,P,w,y,v,p,B,k,R,T,N,S,E,x,A)}roundClean(){s.fill(0),o.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)}}Ot.SHA512=u;class l extends u{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 a extends u{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 f extends u{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 Ot.sha512=(0,r.wrapConstructor)(()=>new u),Ot.sha512_224=(0,r.wrapConstructor)(()=>new l),Ot.sha512_256=(0,r.wrapConstructor)(()=>new a),Ot.sha384=(0,r.wrapConstructor)(()=>new f),Ot}var al;function no(){if(al)return Kt;al=1,Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.randomBytes=Kt.pbkdf2Sync=Kt.createHmac=Kt.createHash=void 0;const e=Rc(),t=Z0(),r=Ic(),n=jg(),i=Ce();function s(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof Me<"u")return Me;throw new Error("unable to locate global object")}const o=s(),u=o.crypto||o.msCrypto;function l(c){switch(c){case"sha256":return r.sha256.create();case"sha512":return n.sha512.create()}(0,i.assertArgument)(!1,"invalid hashing algorithm name","algorithm",c)}Kt.createHash=l;function a(c,g){const h={sha256:r.sha256,sha512:n.sha512}[c];return(0,i.assertArgument)(h!=null,"invalid hmac algorithm","algorithm",c),e.hmac.create(h,g)}Kt.createHmac=a;function f(c,g,h,b,P){const w={sha256:r.sha256,sha512:n.sha512}[P];return(0,i.assertArgument)(w!=null,"invalid pbkdf2 algorithm","algorithm",P),(0,t.pbkdf2)(w,c,g,{c:h,dkLen:b})}Kt.pbkdf2Sync=f;function d(c){(0,i.assert)(u!=null,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"}),(0,i.assertArgument)(Number.isInteger(c)&&c>0&&c<=1024,"invalid length","length",c);const g=new Uint8Array(c);return u.getRandomValues(g),g}return Kt.randomBytes=d,Kt}var cl;function Dg(){if(cl)return Qn;cl=1,Object.defineProperty(Qn,"__esModule",{value:!0}),Qn.computeHmac=void 0;const e=no(),t=Ce();let r=!1;const n=function(o,u,l){return(0,e.createHmac)(o,u).update(l).digest()};let i=n;function s(o,u,l){const a=(0,t.getBytes)(u,"key"),f=(0,t.getBytes)(l,"data");return(0,t.hexlify)(i(o,a,f))}return Qn.computeHmac=s,s._=n,s.lock=function(){r=!0},s.register=function(o){if(r)throw new Error("computeHmac is locked");i=o},Object.freeze(s),Qn}var Xn={},Qe={},ul;function Hg(){if(ul)return Qe;ul=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.shake256=Qe.shake128=Qe.keccak_512=Qe.keccak_384=Qe.keccak_256=Qe.keccak_224=Qe.sha3_512=Qe.sha3_384=Qe.sha3_256=Qe.sha3_224=Qe.Keccak=Qe.keccakP=void 0;const e=hs(),t=X0(),r=or(),[n,i,s]=[[],[],[]],o=BigInt(0),u=BigInt(1),l=BigInt(2),a=BigInt(7),f=BigInt(256),d=BigInt(113);for(let p=0,B=u,k=1,R=0;p<24;p++){[k,R]=[R,(2*k+3*R)%5],n.push(2*(5*R+k)),i.push((p+1)*(p+2)/2%64);let T=o;for(let N=0;N<7;N++)B=(B<<u^(B>>a)*d)%f,B&l&&(T^=u<<(u<<BigInt(N))-u);s.push(T)}const[c,g]=(0,t.split)(s,!0),h=(p,B,k)=>k>32?(0,t.rotlBH)(p,B,k):(0,t.rotlSH)(p,B,k),b=(p,B,k)=>k>32?(0,t.rotlBL)(p,B,k):(0,t.rotlSL)(p,B,k);function P(p,B=24){const k=new Uint32Array(10);for(let R=24-B;R<24;R++){for(let S=0;S<10;S++)k[S]=p[S]^p[S+10]^p[S+20]^p[S+30]^p[S+40];for(let S=0;S<10;S+=2){const E=(S+8)%10,x=(S+2)%10,A=k[x],O=k[x+1],I=h(A,O,1)^k[E],L=b(A,O,1)^k[E+1];for(let H=0;H<50;H+=10)p[S+H]^=I,p[S+H+1]^=L}let T=p[2],N=p[3];for(let S=0;S<24;S++){const E=i[S],x=h(T,N,E),A=b(T,N,E),O=n[S];T=p[O],N=p[O+1],p[O]=x,p[O+1]=A}for(let S=0;S<50;S+=10){for(let E=0;E<10;E++)k[E]=p[S+E];for(let E=0;E<10;E++)p[S+E]^=~k[(E+2)%10]&k[(E+4)%10]}p[0]^=c[R],p[1]^=g[R]}k.fill(0)}Qe.keccakP=P;class w extends r.Hash{constructor(B,k,R,T=!1,N=24){if(super(),this.blockLen=B,this.suffix=k,this.outputLen=R,this.enableXOF=T,this.rounds=N,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,e.number)(R),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,r.u32)(this.state)}keccak(){P(this.state32,this.rounds),this.posOut=0,this.pos=0}update(B){(0,e.exists)(this);const{blockLen:k,state:R}=this;B=(0,r.toBytes)(B);const T=B.length;for(let N=0;N<T;){const S=Math.min(k-this.pos,T-N);for(let E=0;E<S;E++)R[this.pos++]^=B[N++];this.pos===k&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:B,suffix:k,pos:R,blockLen:T}=this;B[R]^=k,k&128&&R===T-1&&this.keccak(),B[T-1]^=128,this.keccak()}writeInto(B){(0,e.exists)(this,!1),(0,e.bytes)(B),this.finish();const k=this.state,{blockLen:R}=this;for(let T=0,N=B.length;T<N;){this.posOut>=R&&this.keccak();const S=Math.min(R-this.posOut,N-T);B.set(k.subarray(this.posOut,this.posOut+S),T),this.posOut+=S,T+=S}return B}xofInto(B){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(B)}xof(B){return(0,e.number)(B),this.xofInto(new Uint8Array(B))}digestInto(B){if((0,e.output)(B,this),this.finished)throw new Error("digest() was already called");return this.writeInto(B),this.destroy(),B}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(B){const{blockLen:k,suffix:R,outputLen:T,rounds:N,enableXOF:S}=this;return B||(B=new w(k,R,T,S,N)),B.state32.set(this.state32),B.pos=this.pos,B.posOut=this.posOut,B.finished=this.finished,B.rounds=N,B.suffix=R,B.outputLen=T,B.enableXOF=S,B.destroyed=this.destroyed,B}}Qe.Keccak=w;const y=(p,B,k)=>(0,r.wrapConstructor)(()=>new w(B,p,k));Qe.sha3_224=y(6,144,224/8),Qe.sha3_256=y(6,136,256/8),Qe.sha3_384=y(6,104,384/8),Qe.sha3_512=y(6,72,512/8),Qe.keccak_224=y(1,144,224/8),Qe.keccak_256=y(1,136,256/8),Qe.keccak_384=y(1,104,384/8),Qe.keccak_512=y(1,72,512/8);const v=(p,B,k)=>(0,r.wrapXOFConstructorWithOpts)((R={})=>new w(B,p,R.dkLen===void 0?k:R.dkLen,!0));return Qe.shake128=v(31,168,128/8),Qe.shake256=v(31,136,256/8),Qe}var ll;function $g(){if(ll)return Xn;ll=1,Object.defineProperty(Xn,"__esModule",{value:!0}),Xn.keccak256=void 0;const e=Hg(),t=Ce();let r=!1;const n=function(o){return(0,e.keccak_256)(o)};let i=n;function s(o){const u=(0,t.getBytes)(o,"data");return(0,t.hexlify)(i(u))}return Xn.keccak256=s,s._=n,s.lock=function(){r=!0},s.register=function(o){if(r)throw new TypeError("keccak256 is locked");i=o},Object.freeze(s),Xn}var ei={},Hr={},fl;function Gg(){if(fl)return Hr;fl=1,Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.ripemd160=Hr.RIPEMD160=void 0;const e=Nc(),t=or(),r=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),n=Uint8Array.from({length:16},(P,w)=>w),i=n.map(P=>(9*P+5)%16);let s=[n],o=[i];for(let P=0;P<4;P++)for(let w of[s,o])w.push(w[P].map(y=>r[y]));const u=[[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(P=>new Uint8Array(P)),l=s.map((P,w)=>P.map(y=>u[w][y])),a=o.map((P,w)=>P.map(y=>u[w][y])),f=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),d=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),c=(P,w)=>P<<w|P>>>32-w;function g(P,w,y,v){return P===0?w^y^v:P===1?w&y|~w&v:P===2?(w|~y)^v:P===3?w&v|y&~v:w^(y|~v)}const h=new Uint32Array(16);class b extends e.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:w,h1:y,h2:v,h3:p,h4:B}=this;return[w,y,v,p,B]}set(w,y,v,p,B){this.h0=w|0,this.h1=y|0,this.h2=v|0,this.h3=p|0,this.h4=B|0}process(w,y){for(let A=0;A<16;A++,y+=4)h[A]=w.getUint32(y,!0);let v=this.h0|0,p=v,B=this.h1|0,k=B,R=this.h2|0,T=R,N=this.h3|0,S=N,E=this.h4|0,x=E;for(let A=0;A<5;A++){const O=4-A,I=f[A],L=d[A],H=s[A],V=o[A],D=l[A],j=a[A];for(let $=0;$<16;$++){const F=c(v+g(A,B,R,N)+h[H[$]]+I,D[$])+E|0;v=E,E=N,N=c(R,10)|0,R=B,B=F}for(let $=0;$<16;$++){const F=c(p+g(O,k,T,S)+h[V[$]]+L,j[$])+x|0;p=x,x=S,S=c(T,10)|0,T=k,k=F}}this.set(this.h1+R+S|0,this.h2+N+x|0,this.h3+E+p|0,this.h4+v+k|0,this.h0+B+T|0)}roundClean(){h.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}return Hr.RIPEMD160=b,Hr.ripemd160=(0,t.wrapConstructor)(()=>new b),Hr}var dl;function Kg(){if(dl)return ei;dl=1,Object.defineProperty(ei,"__esModule",{value:!0}),ei.ripemd160=void 0;const e=Gg(),t=Ce();let r=!1;const n=function(o){return(0,e.ripemd160)(o)};let i=n;function s(o){const u=(0,t.getBytes)(o,"data");return(0,t.hexlify)(i(u))}return ei.ripemd160=s,s._=n,s.lock=function(){r=!0},s.register=function(o){if(r)throw new TypeError("ripemd160 is locked");i=o},Object.freeze(s),ei}var ti={},hl;function qg(){if(hl)return ti;hl=1,Object.defineProperty(ti,"__esModule",{value:!0}),ti.pbkdf2=void 0;const e=no(),t=Ce();let r=!1;const n=function(o,u,l,a,f){return(0,e.pbkdf2Sync)(o,u,l,a,f)};let i=n;function s(o,u,l,a,f){const d=(0,t.getBytes)(o,"password"),c=(0,t.getBytes)(u,"salt");return(0,t.hexlify)(i(d,c,l,a,f))}return ti.pbkdf2=s,s._=n,s.lock=function(){r=!0},s.register=function(o){if(r)throw new Error("pbkdf2 is locked");i=o},Object.freeze(s),ti}var ri={},pl;function Vg(){if(pl)return ri;pl=1,Object.defineProperty(ri,"__esModule",{value:!0}),ri.randomBytes=void 0;const e=no();let t=!1;const r=function(s){return new Uint8Array((0,e.randomBytes)(s))};let n=r;function i(s){return n(s)}return ri.randomBytes=i,i._=r,i.lock=function(){t=!0},i.register=function(s){if(t)throw new Error("randomBytes is locked");n=s},Object.freeze(i),ri}var $r={},Gr={},bl;function zg(){if(bl)return Gr;bl=1,Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.scryptAsync=Gr.scrypt=void 0;const e=hs(),t=Ic(),r=Z0(),n=or(),i=(d,c)=>d<<c|d>>>32-c;function s(d,c,g,h,b,P){let w=d[c++]^g[h++],y=d[c++]^g[h++],v=d[c++]^g[h++],p=d[c++]^g[h++],B=d[c++]^g[h++],k=d[c++]^g[h++],R=d[c++]^g[h++],T=d[c++]^g[h++],N=d[c++]^g[h++],S=d[c++]^g[h++],E=d[c++]^g[h++],x=d[c++]^g[h++],A=d[c++]^g[h++],O=d[c++]^g[h++],I=d[c++]^g[h++],L=d[c++]^g[h++],H=w,V=y,D=v,j=p,$=B,F=k,M=R,ee=T,de=N,Q=S,ae=E,Z=x,te=A,re=O,K=I,W=L;for(let ne=0;ne<8;ne+=2)$^=i(H+te|0,7),de^=i($+H|0,9),te^=i(de+$|0,13),H^=i(te+de|0,18),Q^=i(F+V|0,7),re^=i(Q+F|0,9),V^=i(re+Q|0,13),F^=i(V+re|0,18),K^=i(ae+M|0,7),D^=i(K+ae|0,9),M^=i(D+K|0,13),ae^=i(M+D|0,18),j^=i(W+Z|0,7),ee^=i(j+W|0,9),Z^=i(ee+j|0,13),W^=i(Z+ee|0,18),V^=i(H+j|0,7),D^=i(V+H|0,9),j^=i(D+V|0,13),H^=i(j+D|0,18),M^=i(F+$|0,7),ee^=i(M+F|0,9),$^=i(ee+M|0,13),F^=i($+ee|0,18),Z^=i(ae+Q|0,7),de^=i(Z+ae|0,9),Q^=i(de+Z|0,13),ae^=i(Q+de|0,18),te^=i(W+K|0,7),re^=i(te+W|0,9),K^=i(re+te|0,13),W^=i(K+re|0,18);b[P++]=w+H|0,b[P++]=y+V|0,b[P++]=v+D|0,b[P++]=p+j|0,b[P++]=B+$|0,b[P++]=k+F|0,b[P++]=R+M|0,b[P++]=T+ee|0,b[P++]=N+de|0,b[P++]=S+Q|0,b[P++]=E+ae|0,b[P++]=x+Z|0,b[P++]=A+te|0,b[P++]=O+re|0,b[P++]=I+K|0,b[P++]=L+W|0}function o(d,c,g,h,b){let P=h+0,w=h+16*b;for(let y=0;y<16;y++)g[w+y]=d[c+(2*b-1)*16+y];for(let y=0;y<b;y++,P+=16,c+=16)s(g,w,d,c,g,P),y>0&&(w+=16),s(g,P,d,c+=16,g,w)}function u(d,c,g){const h=(0,n.checkOpts)({dkLen:32,asyncTick:10,maxmem:1073742848},g),{N:b,r:P,p:w,dkLen:y,asyncTick:v,maxmem:p,onProgress:B}=h;if((0,e.number)(b),(0,e.number)(P),(0,e.number)(w),(0,e.number)(y),(0,e.number)(v),(0,e.number)(p),B!==void 0&&typeof B!="function")throw new Error("progressCb should be function");const k=128*P,R=k/4;if(b<=1||b&b-1||b>=2**(k/8)||b>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(w<0||w>(2**32-1)*32/k)throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");if(y<0||y>(2**32-1)*32)throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");const T=k*(b+w);if(T>p)throw new Error(`Scrypt: parameters too large, ${T} (128 * r * (N + p)) > ${p} (maxmem)`);const N=(0,r.pbkdf2)(t.sha256,d,c,{c:1,dkLen:k*w}),S=(0,n.u32)(N),E=(0,n.u32)(new Uint8Array(k*b)),x=(0,n.u32)(new Uint8Array(k));let A=()=>{};if(B){const O=2*b*w,I=Math.max(Math.floor(O/1e4),1);let L=0;A=()=>{L++,B&&(!(L%I)||L===O)&&B(L/O)}}return{N:b,r:P,p:w,dkLen:y,blockSize32:R,V:E,B32:S,B:N,tmp:x,blockMixCb:A,asyncTick:v}}function l(d,c,g,h,b){const P=(0,r.pbkdf2)(t.sha256,d,g,{c:1,dkLen:c});return g.fill(0),h.fill(0),b.fill(0),P}function a(d,c,g){const{N:h,r:b,p:P,dkLen:w,blockSize32:y,V:v,B32:p,B,tmp:k,blockMixCb:R}=u(d,c,g);for(let T=0;T<P;T++){const N=y*T;for(let S=0;S<y;S++)v[S]=p[N+S];for(let S=0,E=0;S<h-1;S++)o(v,E,v,E+=y,b),R();o(v,(h-1)*y,p,N,b),R();for(let S=0;S<h;S++){const E=p[N+y-16]%h;for(let x=0;x<y;x++)k[x]=p[N+x]^v[E*y+x];o(k,0,p,N,b),R()}}return l(d,w,B,v,k)}Gr.scrypt=a;async function f(d,c,g){const{N:h,r:b,p:P,dkLen:w,blockSize32:y,V:v,B32:p,B,tmp:k,blockMixCb:R,asyncTick:T}=u(d,c,g);for(let N=0;N<P;N++){const S=y*N;for(let x=0;x<y;x++)v[x]=p[S+x];let E=0;await(0,n.asyncLoop)(h-1,T,()=>{o(v,E,v,E+=y,b),R()}),o(v,(h-1)*y,p,S,b),R(),await(0,n.asyncLoop)(h,T,()=>{const x=p[S+y-16]%h;for(let A=0;A<y;A++)k[A]=p[S+A]^v[x*y+A];o(k,0,p,S,b),R()})}return l(d,w,B,v,k)}return Gr.scryptAsync=f,Gr}var gl;function Wg(){if(gl)return $r;gl=1,Object.defineProperty($r,"__esModule",{value:!0}),$r.scryptSync=$r.scrypt=void 0;const e=zg(),t=Ce();let r=!1,n=!1;const i=async function(f,d,c,g,h,b,P){return await(0,e.scryptAsync)(f,d,{N:c,r:g,p:h,dkLen:b,onProgress:P})},s=function(f,d,c,g,h,b){return(0,e.scrypt)(f,d,{N:c,r:g,p:h,dkLen:b})};let o=i,u=s;async function l(f,d,c,g,h,b,P){const w=(0,t.getBytes)(f,"passwd"),y=(0,t.getBytes)(d,"salt");return(0,t.hexlify)(await o(w,y,c,g,h,b,P))}$r.scrypt=l,l._=i,l.lock=function(){n=!0},l.register=function(f){if(n)throw new Error("scrypt is locked");o=f},Object.freeze(l);function a(f,d,c,g,h,b){const P=(0,t.getBytes)(f,"passwd"),w=(0,t.getBytes)(d,"salt");return(0,t.hexlify)(u(P,w,c,g,h,b))}return $r.scryptSync=a,a._=s,a.lock=function(){r=!0},a.register=function(f){if(r)throw new Error("scryptSync is locked");u=f},Object.freeze(a),$r}var Kr={},ml;function Jg(){if(ml)return Kr;ml=1,Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.sha512=Kr.sha256=void 0;const e=no(),t=Ce(),r=function(f){return(0,e.createHash)("sha256").update(f).digest()},n=function(f){return(0,e.createHash)("sha512").update(f).digest()};let i=r,s=n,o=!1,u=!1;function l(f){const d=(0,t.getBytes)(f,"data");return(0,t.hexlify)(i(d))}Kr.sha256=l,l._=r,l.lock=function(){o=!0},l.register=function(f){if(o)throw new Error("sha256 is locked");i=f},Object.freeze(l);function a(f){const d=(0,t.getBytes)(f,"data");return(0,t.hexlify)(s(d))}return Kr.sha512=a,a._=n,a.lock=function(){u=!0},a.register=function(f){if(u)throw new Error("sha512 is locked");s=f},Object.freeze(l),Kr}var ni={},ra={},De={},He={},yl;function Rn(){if(yl)return He;yl=1,Object.defineProperty(He,"__esModule",{value:!0}),He.validateObject=He.createHmacDrbg=He.bitMask=He.bitSet=He.bitGet=He.bitLen=He.utf8ToBytes=He.equalBytes=He.concatBytes=He.ensureBytes=He.numberToVarBytesBE=He.numberToBytesLE=He.numberToBytesBE=He.bytesToNumberLE=He.bytesToNumberBE=He.hexToBytes=He.hexToNumber=He.numberToHexUnpadded=He.bytesToHex=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=BigInt(0),t=BigInt(1),r=BigInt(2),n=E=>E instanceof Uint8Array,i=Array.from({length:256},(E,x)=>x.toString(16).padStart(2,"0"));function s(E){if(!n(E))throw new Error("Uint8Array expected");let x="";for(let A=0;A<E.length;A++)x+=i[E[A]];return x}He.bytesToHex=s;function o(E){const x=E.toString(16);return x.length&1?`0${x}`:x}He.numberToHexUnpadded=o;function u(E){if(typeof E!="string")throw new Error("hex string expected, got "+typeof E);return BigInt(E===""?"0":`0x${E}`)}He.hexToNumber=u;function l(E){if(typeof E!="string")throw new Error("hex string expected, got "+typeof E);const x=E.length;if(x%2)throw new Error("padded hex string expected, got unpadded hex of length "+x);const A=new Uint8Array(x/2);for(let O=0;O<A.length;O++){const I=O*2,L=E.slice(I,I+2),H=Number.parseInt(L,16);if(Number.isNaN(H)||H<0)throw new Error("Invalid byte sequence");A[O]=H}return A}He.hexToBytes=l;function a(E){return u(s(E))}He.bytesToNumberBE=a;function f(E){if(!n(E))throw new Error("Uint8Array expected");return u(s(Uint8Array.from(E).reverse()))}He.bytesToNumberLE=f;function d(E,x){return l(E.toString(16).padStart(x*2,"0"))}He.numberToBytesBE=d;function c(E,x){return d(E,x).reverse()}He.numberToBytesLE=c;function g(E){return l(o(E))}He.numberToVarBytesBE=g;function h(E,x,A){let O;if(typeof x=="string")try{O=l(x)}catch(L){throw new Error(`${E} must be valid hex string, got "${x}". Cause: ${L}`)}else if(n(x))O=Uint8Array.from(x);else throw new Error(`${E} must be hex string or Uint8Array`);const I=O.length;if(typeof A=="number"&&I!==A)throw new Error(`${E} expected ${A} bytes, got ${I}`);return O}He.ensureBytes=h;function b(...E){const x=new Uint8Array(E.reduce((O,I)=>O+I.length,0));let A=0;return E.forEach(O=>{if(!n(O))throw new Error("Uint8Array expected");x.set(O,A),A+=O.length}),x}He.concatBytes=b;function P(E,x){if(E.length!==x.length)return!1;for(let A=0;A<E.length;A++)if(E[A]!==x[A])return!1;return!0}He.equalBytes=P;function w(E){if(typeof E!="string")throw new Error(`utf8ToBytes expected string, got ${typeof E}`);return new Uint8Array(new TextEncoder().encode(E))}He.utf8ToBytes=w;function y(E){let x;for(x=0;E>e;E>>=t,x+=1);return x}He.bitLen=y;function v(E,x){return E>>BigInt(x)&t}He.bitGet=v;const p=(E,x,A)=>E|(A?t:e)<<BigInt(x);He.bitSet=p;const B=E=>(r<<BigInt(E-1))-t;He.bitMask=B;const k=E=>new Uint8Array(E),R=E=>Uint8Array.from(E);function T(E,x,A){if(typeof E!="number"||E<2)throw new Error("hashLen must be a number");if(typeof x!="number"||x<2)throw new Error("qByteLen must be a number");if(typeof A!="function")throw new Error("hmacFn must be a function");let O=k(E),I=k(E),L=0;const H=()=>{O.fill(1),I.fill(0),L=0},V=(...F)=>A(I,O,...F),D=(F=k())=>{I=V(R([0]),F),O=V(),F.length!==0&&(I=V(R([1]),F),O=V())},j=()=>{if(L++>=1e3)throw new Error("drbg: tried 1000 values");let F=0;const M=[];for(;F<x;){O=V();const ee=O.slice();M.push(ee),F+=O.length}return b(...M)};return(F,M)=>{H(),D(F);let ee;for(;!(ee=M(j()));)D();return H(),ee}}He.createHmacDrbg=T;const N={bigint:E=>typeof E=="bigint",function:E=>typeof E=="function",boolean:E=>typeof E=="boolean",string:E=>typeof E=="string",stringOrUint8Array:E=>typeof E=="string"||E instanceof Uint8Array,isSafeInteger:E=>Number.isSafeInteger(E),array:E=>Array.isArray(E),field:(E,x)=>x.Fp.isValid(E),hash:E=>typeof E=="function"&&Number.isSafeInteger(E.outputLen)};function S(E,x,A={}){const O=(I,L,H)=>{const V=N[L];if(typeof V!="function")throw new Error(`Invalid validator "${L}", expected function`);const D=E[I];if(!(H&&D===void 0)&&!V(D,E))throw new Error(`Invalid param ${String(I)}=${D} (${typeof D}), expected ${L}`)};for(const[I,L]of Object.entries(x))O(I,L,!1);for(const[I,L]of Object.entries(A))O(I,L,!0);return E}return He.validateObject=S,He}var xl;function io(){if(xl)return De;xl=1,Object.defineProperty(De,"__esModule",{value:!0}),De.mapHashToField=De.getMinHashLength=De.getFieldBytesLength=De.hashToPrivateScalar=De.FpSqrtEven=De.FpSqrtOdd=De.Field=De.nLength=De.FpIsSquare=De.FpDiv=De.FpInvertBatch=De.FpPow=De.validateField=De.isNegativeLE=De.FpSqrt=De.tonelliShanks=De.invert=De.pow2=De.pow=De.mod=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=Rn(),t=BigInt(0),r=BigInt(1),n=BigInt(2),i=BigInt(3),s=BigInt(4),o=BigInt(5),u=BigInt(8);BigInt(9),BigInt(16);function l(A,O){const I=A%O;return I>=t?I:O+I}De.mod=l;function a(A,O,I){if(I<=t||O<t)throw new Error("Expected power/modulo > 0");if(I===r)return t;let L=r;for(;O>t;)O&r&&(L=L*A%I),A=A*A%I,O>>=r;return L}De.pow=a;function f(A,O,I){let L=A;for(;O-- >t;)L*=L,L%=I;return L}De.pow2=f;function d(A,O){if(A===t||O<=t)throw new Error(`invert: expected positive integers, got n=${A} mod=${O}`);let I=l(A,O),L=O,H=t,V=r;for(;I!==t;){const j=L/I,$=L%I,F=H-V*j;L=I,I=$,H=V,V=F}if(L!==r)throw new Error("invert: does not exist");return l(H,O)}De.invert=d;function c(A){const O=(A-r)/n;let I,L,H;for(I=A-r,L=0;I%n===t;I/=n,L++);for(H=n;H<A&&a(H,O,A)!==A-r;H++);if(L===1){const D=(A+r)/s;return function($,F){const M=$.pow(F,D);if(!$.eql($.sqr(M),F))throw new Error("Cannot find square root");return M}}const V=(I+r)/n;return function(j,$){if(j.pow($,O)===j.neg(j.ONE))throw new Error("Cannot find square root");let F=L,M=j.pow(j.mul(j.ONE,H),I),ee=j.pow($,V),de=j.pow($,I);for(;!j.eql(de,j.ONE);){if(j.eql(de,j.ZERO))return j.ZERO;let Q=1;for(let Z=j.sqr(de);Q<F&&!j.eql(Z,j.ONE);Q++)Z=j.sqr(Z);const ae=j.pow(M,r<<BigInt(F-Q-1));M=j.sqr(ae),ee=j.mul(ee,ae),de=j.mul(de,M),F=Q}return ee}}De.tonelliShanks=c;function g(A){if(A%s===i){const O=(A+r)/s;return function(L,H){const V=L.pow(H,O);if(!L.eql(L.sqr(V),H))throw new Error("Cannot find square root");return V}}if(A%u===o){const O=(A-o)/u;return function(L,H){const V=L.mul(H,n),D=L.pow(V,O),j=L.mul(H,D),$=L.mul(L.mul(j,n),D),F=L.mul(j,L.sub($,L.ONE));if(!L.eql(L.sqr(F),H))throw new Error("Cannot find square root");return F}}return c(A)}De.FpSqrt=g;const h=(A,O)=>(l(A,O)&r)===r;De.isNegativeLE=h;const b=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function P(A){const O={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},I=b.reduce((L,H)=>(L[H]="function",L),O);return(0,e.validateObject)(A,I)}De.validateField=P;function w(A,O,I){if(I<t)throw new Error("Expected power > 0");if(I===t)return A.ONE;if(I===r)return O;let L=A.ONE,H=O;for(;I>t;)I&r&&(L=A.mul(L,H)),H=A.sqr(H),I>>=r;return L}De.FpPow=w;function y(A,O){const I=new Array(O.length),L=O.reduce((V,D,j)=>A.is0(D)?V:(I[j]=V,A.mul(V,D)),A.ONE),H=A.inv(L);return O.reduceRight((V,D,j)=>A.is0(D)?V:(I[j]=A.mul(V,I[j]),A.mul(V,D)),H),I}De.FpInvertBatch=y;function v(A,O,I){return A.mul(O,typeof I=="bigint"?d(I,A.ORDER):A.inv(I))}De.FpDiv=v;function p(A){const O=(A.ORDER-r)/n;return I=>{const L=A.pow(I,O);return A.eql(L,A.ZERO)||A.eql(L,A.ONE)}}De.FpIsSquare=p;function B(A,O){const I=O!==void 0?O:A.toString(2).length,L=Math.ceil(I/8);return{nBitLength:I,nByteLength:L}}De.nLength=B;function k(A,O,I=!1,L={}){if(A<=t)throw new Error(`Expected Field ORDER > 0, got ${A}`);const{nBitLength:H,nByteLength:V}=B(A,O);if(V>2048)throw new Error("Field lengths over 2048 bytes are not supported");const D=g(A),j=Object.freeze({ORDER:A,BITS:H,BYTES:V,MASK:(0,e.bitMask)(H),ZERO:t,ONE:r,create:$=>l($,A),isValid:$=>{if(typeof $!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof $}`);return t<=$&&$<A},is0:$=>$===t,isOdd:$=>($&r)===r,neg:$=>l(-$,A),eql:($,F)=>$===F,sqr:$=>l($*$,A),add:($,F)=>l($+F,A),sub:($,F)=>l($-F,A),mul:($,F)=>l($*F,A),pow:($,F)=>w(j,$,F),div:($,F)=>l($*d(F,A),A),sqrN:$=>$*$,addN:($,F)=>$+F,subN:($,F)=>$-F,mulN:($,F)=>$*F,inv:$=>d($,A),sqrt:L.sqrt||($=>D(j,$)),invertBatch:$=>y(j,$),cmov:($,F,M)=>M?F:$,toBytes:$=>I?(0,e.numberToBytesLE)($,V):(0,e.numberToBytesBE)($,V),fromBytes:$=>{if($.length!==V)throw new Error(`Fp.fromBytes: expected ${V}, got ${$.length}`);return I?(0,e.bytesToNumberLE)($):(0,e.bytesToNumberBE)($)}});return Object.freeze(j)}De.Field=k;function R(A,O){if(!A.isOdd)throw new Error("Field doesn't have isOdd");const I=A.sqrt(O);return A.isOdd(I)?I:A.neg(I)}De.FpSqrtOdd=R;function T(A,O){if(!A.isOdd)throw new Error("Field doesn't have isOdd");const I=A.sqrt(O);return A.isOdd(I)?A.neg(I):I}De.FpSqrtEven=T;function N(A,O,I=!1){A=(0,e.ensureBytes)("privateHash",A);const L=A.length,H=B(O).nByteLength+8;if(H<24||L<H||L>1024)throw new Error(`hashToPrivateScalar: expected ${H}-1024 bytes of input, got ${L}`);const V=I?(0,e.bytesToNumberLE)(A):(0,e.bytesToNumberBE)(A);return l(V,O-r)+r}De.hashToPrivateScalar=N;function S(A){if(typeof A!="bigint")throw new Error("field order must be bigint");const O=A.toString(2).length;return Math.ceil(O/8)}De.getFieldBytesLength=S;function E(A){const O=S(A);return O+Math.ceil(O/2)}De.getMinHashLength=E;function x(A,O,I=!1){const L=A.length,H=S(O),V=E(O);if(L<16||L<V||L>1024)throw new Error(`expected ${V}-1024 bytes of input, got ${L}`);const D=I?(0,e.bytesToNumberBE)(A):(0,e.bytesToNumberLE)(A),j=l(D,O-r)+r;return I?(0,e.numberToBytesLE)(j,H):(0,e.numberToBytesBE)(j,H)}return De.mapHashToField=x,De}var na={},qr={},wl;function Qg(){if(wl)return qr;wl=1,Object.defineProperty(qr,"__esModule",{value:!0}),qr.validateBasic=qr.wNAF=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=io(),t=Rn(),r=BigInt(0),n=BigInt(1);function i(o,u){const l=(f,d)=>{const c=d.negate();return f?c:d},a=f=>{const d=Math.ceil(u/f)+1,c=2**(f-1);return{windows:d,windowSize:c}};return{constTimeNegate:l,unsafeLadder(f,d){let c=o.ZERO,g=f;for(;d>r;)d&n&&(c=c.add(g)),g=g.double(),d>>=n;return c},precomputeWindow(f,d){const{windows:c,windowSize:g}=a(d),h=[];let b=f,P=b;for(let w=0;w<c;w++){P=b,h.push(P);for(let y=1;y<g;y++)P=P.add(b),h.push(P);b=P.double()}return h},wNAF(f,d,c){const{windows:g,windowSize:h}=a(f);let b=o.ZERO,P=o.BASE;const w=BigInt(2**f-1),y=2**f,v=BigInt(f);for(let p=0;p<g;p++){const B=p*h;let k=Number(c&w);c>>=v,k>h&&(k-=y,c+=n);const R=B,T=B+Math.abs(k)-1,N=p%2!==0,S=k<0;k===0?P=P.add(l(N,d[R])):b=b.add(l(S,d[T]))}return{p:b,f:P}},wNAFCached(f,d,c,g){const h=f._WINDOW_SIZE||1;let b=d.get(f);return b||(b=this.precomputeWindow(f,h),h!==1&&d.set(f,g(b))),this.wNAF(h,b,c)}}}qr.wNAF=i;function s(o){return(0,e.validateField)(o.Fp),(0,t.validateObject)(o,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,e.nLength)(o.n,o.nBitLength),...o,p:o.Fp.ORDER})}return qr.validateBasic=s,qr}var Al;function eh(){return Al||(Al=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mapToCurveSimpleSWU=e.SWUFpSqrtRatio=e.weierstrass=e.weierstrassPoints=e.DER=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=io(),r=Rn(),n=Rn(),i=Qg();function s(y){const v=(0,i.validateBasic)(y);r.validateObject(v,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:p,Fp:B,a:k}=v;if(p){if(!B.eql(k,B.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof p!="object"||typeof p.beta!="bigint"||typeof p.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...v})}const{bytesToNumberBE:o,hexToBytes:u}=r;e.DER={Err:class extends Error{constructor(v=""){super(v)}},_parseInt(y){const{Err:v}=e.DER;if(y.length<2||y[0]!==2)throw new v("Invalid signature integer tag");const p=y[1],B=y.subarray(2,p+2);if(!p||B.length!==p)throw new v("Invalid signature integer: wrong length");if(B[0]&128)throw new v("Invalid signature integer: negative");if(B[0]===0&&!(B[1]&128))throw new v("Invalid signature integer: unnecessary leading zero");return{d:o(B),l:y.subarray(p+2)}},toSig(y){const{Err:v}=e.DER,p=typeof y=="string"?u(y):y;if(!(p instanceof Uint8Array))throw new Error("ui8a expected");let B=p.length;if(B<2||p[0]!=48)throw new v("Invalid signature tag");if(p[1]!==B-2)throw new v("Invalid signature: incorrect length");const{d:k,l:R}=e.DER._parseInt(p.subarray(2)),{d:T,l:N}=e.DER._parseInt(R);if(N.length)throw new v("Invalid signature: left bytes after parsing");return{r:k,s:T}},hexFromSig(y){const v=E=>Number.parseInt(E[0],16)&8?"00"+E:E,p=E=>{const x=E.toString(16);return x.length&1?`0${x}`:x},B=v(p(y.s)),k=v(p(y.r)),R=B.length/2,T=k.length/2,N=p(R),S=p(T);return`30${p(T+R+4)}02${S}${k}02${N}${B}`}};const l=BigInt(0),a=BigInt(1),f=BigInt(2),d=BigInt(3),c=BigInt(4);function g(y){const v=s(y),{Fp:p}=v,B=v.toBytes||((L,H,V)=>{const D=H.toAffine();return r.concatBytes(Uint8Array.from([4]),p.toBytes(D.x),p.toBytes(D.y))}),k=v.fromBytes||(L=>{const H=L.subarray(1),V=p.fromBytes(H.subarray(0,p.BYTES)),D=p.fromBytes(H.subarray(p.BYTES,2*p.BYTES));return{x:V,y:D}});function R(L){const{a:H,b:V}=v,D=p.sqr(L),j=p.mul(D,L);return p.add(p.add(j,p.mul(L,H)),V)}if(!p.eql(p.sqr(v.Gy),R(v.Gx)))throw new Error("bad generator point: equation left != right");function T(L){return typeof L=="bigint"&&l<L&&L<v.n}function N(L){if(!T(L))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function S(L){const{allowedPrivateKeyLengths:H,nByteLength:V,wrapPrivateKey:D,n:j}=v;if(H&&typeof L!="bigint"){if(L instanceof Uint8Array&&(L=r.bytesToHex(L)),typeof L!="string"||!H.includes(L.length))throw new Error("Invalid key");L=L.padStart(V*2,"0")}let $;try{$=typeof L=="bigint"?L:r.bytesToNumberBE((0,n.ensureBytes)("private key",L,V))}catch{throw new Error(`private key must be ${V} bytes, hex or bigint, not ${typeof L}`)}return D&&($=t.mod($,j)),N($),$}const E=new Map;function x(L){if(!(L instanceof A))throw new Error("ProjectivePoint expected")}class A{constructor(H,V,D){if(this.px=H,this.py=V,this.pz=D,H==null||!p.isValid(H))throw new Error("x required");if(V==null||!p.isValid(V))throw new Error("y required");if(D==null||!p.isValid(D))throw new Error("z required")}static fromAffine(H){const{x:V,y:D}=H||{};if(!H||!p.isValid(V)||!p.isValid(D))throw new Error("invalid affine point");if(H instanceof A)throw new Error("projective point not allowed");const j=$=>p.eql($,p.ZERO);return j(V)&&j(D)?A.ZERO:new A(V,D,p.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(H){const V=p.invertBatch(H.map(D=>D.pz));return H.map((D,j)=>D.toAffine(V[j])).map(A.fromAffine)}static fromHex(H){const V=A.fromAffine(k((0,n.ensureBytes)("pointHex",H)));return V.assertValidity(),V}static fromPrivateKey(H){return A.BASE.multiply(S(H))}_setWindowSize(H){this._WINDOW_SIZE=H,E.delete(this)}assertValidity(){if(this.is0()){if(v.allowInfinityPoint&&!p.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:H,y:V}=this.toAffine();if(!p.isValid(H)||!p.isValid(V))throw new Error("bad point: x or y not FE");const D=p.sqr(V),j=R(H);if(!p.eql(D,j))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:H}=this.toAffine();if(p.isOdd)return!p.isOdd(H);throw new Error("Field doesn't support isOdd")}equals(H){x(H);const{px:V,py:D,pz:j}=this,{px:$,py:F,pz:M}=H,ee=p.eql(p.mul(V,M),p.mul($,j)),de=p.eql(p.mul(D,M),p.mul(F,j));return ee&&de}negate(){return new A(this.px,p.neg(this.py),this.pz)}double(){const{a:H,b:V}=v,D=p.mul(V,d),{px:j,py:$,pz:F}=this;let M=p.ZERO,ee=p.ZERO,de=p.ZERO,Q=p.mul(j,j),ae=p.mul($,$),Z=p.mul(F,F),te=p.mul(j,$);return te=p.add(te,te),de=p.mul(j,F),de=p.add(de,de),M=p.mul(H,de),ee=p.mul(D,Z),ee=p.add(M,ee),M=p.sub(ae,ee),ee=p.add(ae,ee),ee=p.mul(M,ee),M=p.mul(te,M),de=p.mul(D,de),Z=p.mul(H,Z),te=p.sub(Q,Z),te=p.mul(H,te),te=p.add(te,de),de=p.add(Q,Q),Q=p.add(de,Q),Q=p.add(Q,Z),Q=p.mul(Q,te),ee=p.add(ee,Q),Z=p.mul($,F),Z=p.add(Z,Z),Q=p.mul(Z,te),M=p.sub(M,Q),de=p.mul(Z,ae),de=p.add(de,de),de=p.add(de,de),new A(M,ee,de)}add(H){x(H);const{px:V,py:D,pz:j}=this,{px:$,py:F,pz:M}=H;let ee=p.ZERO,de=p.ZERO,Q=p.ZERO;const ae=v.a,Z=p.mul(v.b,d);let te=p.mul(V,$),re=p.mul(D,F),K=p.mul(j,M),W=p.add(V,D),ne=p.add($,F);W=p.mul(W,ne),ne=p.add(te,re),W=p.sub(W,ne),ne=p.add(V,j);let se=p.add($,M);return ne=p.mul(ne,se),se=p.add(te,K),ne=p.sub(ne,se),se=p.add(D,j),ee=p.add(F,M),se=p.mul(se,ee),ee=p.add(re,K),se=p.sub(se,ee),Q=p.mul(ae,ne),ee=p.mul(Z,K),Q=p.add(ee,Q),ee=p.sub(re,Q),Q=p.add(re,Q),de=p.mul(ee,Q),re=p.add(te,te),re=p.add(re,te),K=p.mul(ae,K),ne=p.mul(Z,ne),re=p.add(re,K),K=p.sub(te,K),K=p.mul(ae,K),ne=p.add(ne,K),te=p.mul(re,ne),de=p.add(de,te),te=p.mul(se,ne),ee=p.mul(W,ee),ee=p.sub(ee,te),te=p.mul(W,re),Q=p.mul(se,Q),Q=p.add(Q,te),new A(ee,de,Q)}subtract(H){return this.add(H.negate())}is0(){return this.equals(A.ZERO)}wNAF(H){return I.wNAFCached(this,E,H,V=>{const D=p.invertBatch(V.map(j=>j.pz));return V.map((j,$)=>j.toAffine(D[$])).map(A.fromAffine)})}multiplyUnsafe(H){const V=A.ZERO;if(H===l)return V;if(N(H),H===a)return this;const{endo:D}=v;if(!D)return I.unsafeLadder(this,H);let{k1neg:j,k1:$,k2neg:F,k2:M}=D.splitScalar(H),ee=V,de=V,Q=this;for(;$>l||M>l;)$&a&&(ee=ee.add(Q)),M&a&&(de=de.add(Q)),Q=Q.double(),$>>=a,M>>=a;return j&&(ee=ee.negate()),F&&(de=de.negate()),de=new A(p.mul(de.px,D.beta),de.py,de.pz),ee.add(de)}multiply(H){N(H);let V=H,D,j;const{endo:$}=v;if($){const{k1neg:F,k1:M,k2neg:ee,k2:de}=$.splitScalar(V);let{p:Q,f:ae}=this.wNAF(M),{p:Z,f:te}=this.wNAF(de);Q=I.constTimeNegate(F,Q),Z=I.constTimeNegate(ee,Z),Z=new A(p.mul(Z.px,$.beta),Z.py,Z.pz),D=Q.add(Z),j=ae.add(te)}else{const{p:F,f:M}=this.wNAF(V);D=F,j=M}return A.normalizeZ([D,j])[0]}multiplyAndAddUnsafe(H,V,D){const j=A.BASE,$=(M,ee)=>ee===l||ee===a||!M.equals(j)?M.multiplyUnsafe(ee):M.multiply(ee),F=$(this,V).add($(H,D));return F.is0()?void 0:F}toAffine(H){const{px:V,py:D,pz:j}=this,$=this.is0();H==null&&(H=$?p.ONE:p.inv(j));const F=p.mul(V,H),M=p.mul(D,H),ee=p.mul(j,H);if($)return{x:p.ZERO,y:p.ZERO};if(!p.eql(ee,p.ONE))throw new Error("invZ was invalid");return{x:F,y:M}}isTorsionFree(){const{h:H,isTorsionFree:V}=v;if(H===a)return!0;if(V)return V(A,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:H,clearCofactor:V}=v;return H===a?this:V?V(A,this):this.multiplyUnsafe(v.h)}toRawBytes(H=!0){return this.assertValidity(),B(A,this,H)}toHex(H=!0){return r.bytesToHex(this.toRawBytes(H))}}A.BASE=new A(v.Gx,v.Gy,p.ONE),A.ZERO=new A(p.ZERO,p.ONE,p.ZERO);const O=v.nBitLength,I=(0,i.wNAF)(A,v.endo?Math.ceil(O/2):O);return{CURVE:v,ProjectivePoint:A,normPrivateKeyToScalar:S,weierstrassEquation:R,isWithinCurveOrder:T}}e.weierstrassPoints=g;function h(y){const v=(0,i.validateBasic)(y);return r.validateObject(v,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...v})}function b(y){const v=h(y),{Fp:p,n:B}=v,k=p.BYTES+1,R=2*p.BYTES+1;function T(ne){return l<ne&&ne<p.ORDER}function N(ne){return t.mod(ne,B)}function S(ne){return t.invert(ne,B)}const{ProjectivePoint:E,normPrivateKeyToScalar:x,weierstrassEquation:A,isWithinCurveOrder:O}=g({...v,toBytes(ne,se,U){const J=se.toAffine(),z=p.toBytes(J.x),oe=r.concatBytes;return U?oe(Uint8Array.from([se.hasEvenY()?2:3]),z):oe(Uint8Array.from([4]),z,p.toBytes(J.y))},fromBytes(ne){const se=ne.length,U=ne[0],J=ne.subarray(1);if(se===k&&(U===2||U===3)){const z=r.bytesToNumberBE(J);if(!T(z))throw new Error("Point is not on curve");const oe=A(z);let Y=p.sqrt(oe);const he=(Y&a)===a;return(U&1)===1!==he&&(Y=p.neg(Y)),{x:z,y:Y}}else if(se===R&&U===4){const z=p.fromBytes(J.subarray(0,p.BYTES)),oe=p.fromBytes(J.subarray(p.BYTES,2*p.BYTES));return{x:z,y:oe}}else throw new Error(`Point of length ${se} was invalid. Expected ${k} compressed bytes or ${R} uncompressed bytes`)}}),I=ne=>r.bytesToHex(r.numberToBytesBE(ne,v.nByteLength));function L(ne){const se=B>>a;return ne>se}function H(ne){return L(ne)?N(-ne):ne}const V=(ne,se,U)=>r.bytesToNumberBE(ne.slice(se,U));class D{constructor(se,U,J){this.r=se,this.s=U,this.recovery=J,this.assertValidity()}static fromCompact(se){const U=v.nByteLength;return se=(0,n.ensureBytes)("compactSignature",se,U*2),new D(V(se,0,U),V(se,U,2*U))}static fromDER(se){const{r:U,s:J}=e.DER.toSig((0,n.ensureBytes)("DER",se));return new D(U,J)}assertValidity(){if(!O(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!O(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(se){return new D(this.r,this.s,se)}recoverPublicKey(se){const{r:U,s:J,recovery:z}=this,oe=de((0,n.ensureBytes)("msgHash",se));if(z==null||![0,1,2,3].includes(z))throw new Error("recovery id invalid");const Y=z===2||z===3?U+v.n:U;if(Y>=p.ORDER)throw new Error("recovery id 2 or 3 invalid");const he=z&1?"03":"02",we=E.fromHex(he+I(Y)),ye=S(Y),ie=N(-oe*ye),ce=N(J*ye),me=E.BASE.multiplyAndAddUnsafe(we,ie,ce);if(!me)throw new Error("point at infinify");return me.assertValidity(),me}hasHighS(){return L(this.s)}normalizeS(){return this.hasHighS()?new D(this.r,N(-this.s),this.recovery):this}toDERRawBytes(){return r.hexToBytes(this.toDERHex())}toDERHex(){return e.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return r.hexToBytes(this.toCompactHex())}toCompactHex(){return I(this.r)+I(this.s)}}const j={isValidPrivateKey(ne){try{return x(ne),!0}catch{return!1}},normPrivateKeyToScalar:x,randomPrivateKey:()=>{const ne=t.getMinHashLength(v.n);return t.mapHashToField(v.randomBytes(ne),v.n)},precompute(ne=8,se=E.BASE){return se._setWindowSize(ne),se.multiply(BigInt(3)),se}};function $(ne,se=!0){return E.fromPrivateKey(ne).toRawBytes(se)}function F(ne){const se=ne instanceof Uint8Array,U=typeof ne=="string",J=(se||U)&&ne.length;return se?J===k||J===R:U?J===2*k||J===2*R:ne instanceof E}function M(ne,se,U=!0){if(F(ne))throw new Error("first arg must be private key");if(!F(se))throw new Error("second arg must be public key");return E.fromHex(se).multiply(x(ne)).toRawBytes(U)}const ee=v.bits2int||function(ne){const se=r.bytesToNumberBE(ne),U=ne.length*8-v.nBitLength;return U>0?se>>BigInt(U):se},de=v.bits2int_modN||function(ne){return N(ee(ne))},Q=r.bitMask(v.nBitLength);function ae(ne){if(typeof ne!="bigint")throw new Error("bigint expected");if(!(l<=ne&&ne<Q))throw new Error(`bigint expected < 2^${v.nBitLength}`);return r.numberToBytesBE(ne,v.nByteLength)}function Z(ne,se,U=te){if(["recovered","canonical"].some(C=>C in U))throw new Error("sign() legacy options not supported");const{hash:J,randomBytes:z}=v;let{lowS:oe,prehash:Y,extraEntropy:he}=U;oe==null&&(oe=!0),ne=(0,n.ensureBytes)("msgHash",ne),Y&&(ne=(0,n.ensureBytes)("prehashed msgHash",J(ne)));const we=de(ne),ye=x(se),ie=[ae(ye),ae(we)];if(he!=null){const C=he===!0?z(p.BYTES):he;ie.push((0,n.ensureBytes)("extraEntropy",C))}const ce=r.concatBytes(...ie),me=we;function fe(C){const m=ee(C);if(!O(m))return;const _=S(m),G=E.BASE.multiply(m).toAffine(),X=N(G.x);if(X===l)return;const le=N(_*N(me+X*ye));if(le===l)return;let ge=(G.x===X?0:2)|Number(G.y&a),Oe=le;return oe&&L(le)&&(Oe=H(le),ge^=1),new D(X,Oe,ge)}return{seed:ce,k2sig:fe}}const te={lowS:v.lowS,prehash:!1},re={lowS:v.lowS,prehash:!1};function K(ne,se,U=te){const{seed:J,k2sig:z}=Z(ne,se,U),oe=v;return r.createHmacDrbg(oe.hash.outputLen,oe.nByteLength,oe.hmac)(J,z)}E.BASE._setWindowSize(8);function W(ne,se,U,J=re){var G;const z=ne;if(se=(0,n.ensureBytes)("msgHash",se),U=(0,n.ensureBytes)("publicKey",U),"strict"in J)throw new Error("options.strict was renamed to lowS");const{lowS:oe,prehash:Y}=J;let he,we;try{if(typeof z=="string"||z instanceof Uint8Array)try{he=D.fromDER(z)}catch(X){if(!(X instanceof e.DER.Err))throw X;he=D.fromCompact(z)}else if(typeof z=="object"&&typeof z.r=="bigint"&&typeof z.s=="bigint"){const{r:X,s:le}=z;he=new D(X,le)}else throw new Error("PARSE");we=E.fromHex(U)}catch(X){if(X.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(oe&&he.hasHighS())return!1;Y&&(se=v.hash(se));const{r:ye,s:ie}=he,ce=de(se),me=S(ie),fe=N(ce*me),C=N(ye*me),m=(G=E.BASE.multiplyAndAddUnsafe(we,fe,C))==null?void 0:G.toAffine();return m?N(m.x)===ye:!1}return{CURVE:v,getPublicKey:$,getSharedSecret:M,sign:K,verify:W,ProjectivePoint:E,Signature:D,utils:j}}e.weierstrass=b;function P(y,v){const p=y.ORDER;let B=l;for(let L=p-a;L%f===l;L/=f)B+=a;const k=B,R=f<<k-a-a,T=R*f,N=(p-a)/T,S=(N-a)/f,E=T-a,x=R,A=y.pow(v,N),O=y.pow(v,(N+a)/f);let I=(L,H)=>{let V=A,D=y.pow(H,E),j=y.sqr(D);j=y.mul(j,H);let $=y.mul(L,j);$=y.pow($,S),$=y.mul($,D),D=y.mul($,H),j=y.mul($,L);let F=y.mul(j,D);$=y.pow(F,x);let M=y.eql($,y.ONE);D=y.mul(j,O),$=y.mul(F,V),j=y.cmov(D,j,M),F=y.cmov($,F,M);for(let ee=k;ee>a;ee--){let de=ee-f;de=f<<de-a;let Q=y.pow(F,de);const ae=y.eql(Q,y.ONE);D=y.mul(j,V),V=y.mul(V,V),Q=y.mul(F,V),j=y.cmov(D,j,ae),F=y.cmov(Q,F,ae)}return{isValid:M,value:j}};if(y.ORDER%c===d){const L=(y.ORDER-d)/c,H=y.sqrt(y.neg(v));I=(V,D)=>{let j=y.sqr(D);const $=y.mul(V,D);j=y.mul(j,$);let F=y.pow(j,L);F=y.mul(F,$);const M=y.mul(F,H),ee=y.mul(y.sqr(F),D),de=y.eql(ee,V);let Q=y.cmov(M,F,de);return{isValid:de,value:Q}}}return I}e.SWUFpSqrtRatio=P;function w(y,v){if(t.validateField(y),!y.isValid(v.A)||!y.isValid(v.B)||!y.isValid(v.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const p=P(y,v.Z);if(!y.isOdd)throw new Error("Fp.isOdd is not implemented!");return B=>{let k,R,T,N,S,E,x,A;k=y.sqr(B),k=y.mul(k,v.Z),R=y.sqr(k),R=y.add(R,k),T=y.add(R,y.ONE),T=y.mul(T,v.B),N=y.cmov(v.Z,y.neg(R),!y.eql(R,y.ZERO)),N=y.mul(N,v.A),R=y.sqr(T),E=y.sqr(N),S=y.mul(E,v.A),R=y.add(R,S),R=y.mul(R,T),E=y.mul(E,N),S=y.mul(E,v.B),R=y.add(R,S),x=y.mul(k,T);const{isValid:O,value:I}=p(R,E);A=y.mul(k,B),A=y.mul(A,I),x=y.cmov(x,T,O),A=y.cmov(A,I,O);const L=y.isOdd(B)===y.isOdd(A);return A=y.cmov(y.neg(A),A,L),x=y.div(x,N),{x,y:A}}}e.mapToCurveSimpleSWU=w}(na)),na}var Bt={},El;function Yg(){if(El)return Bt;El=1,Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.createHasher=Bt.isogenyMap=Bt.hash_to_field=Bt.expand_message_xof=Bt.expand_message_xmd=void 0;const e=io(),t=Rn();function r(g){if(g instanceof Uint8Array)return g;if(typeof g=="string")return(0,t.utf8ToBytes)(g);throw new Error("DST must be Uint8Array or string")}const n=t.bytesToNumberBE;function i(g,h){if(g<0||g>=1<<8*h)throw new Error(`bad I2OSP call: value=${g} length=${h}`);const b=Array.from({length:h}).fill(0);for(let P=h-1;P>=0;P--)b[P]=g&255,g>>>=8;return new Uint8Array(b)}function s(g,h){const b=new Uint8Array(g.length);for(let P=0;P<g.length;P++)b[P]=g[P]^h[P];return b}function o(g){if(!(g instanceof Uint8Array))throw new Error("Uint8Array expected")}function u(g){if(!Number.isSafeInteger(g))throw new Error("number expected")}function l(g,h,b,P){o(g),o(h),u(b),h.length>255&&(h=P((0,t.concatBytes)((0,t.utf8ToBytes)("H2C-OVERSIZE-DST-"),h)));const{outputLen:w,blockLen:y}=P,v=Math.ceil(b/w);if(v>255)throw new Error("Invalid xmd length");const p=(0,t.concatBytes)(h,i(h.length,1)),B=i(0,y),k=i(b,2),R=new Array(v),T=P((0,t.concatBytes)(B,g,k,i(0,1),p));R[0]=P((0,t.concatBytes)(T,i(1,1),p));for(let S=1;S<=v;S++){const E=[s(T,R[S-1]),i(S+1,1),p];R[S]=P((0,t.concatBytes)(...E))}return(0,t.concatBytes)(...R).slice(0,b)}Bt.expand_message_xmd=l;function a(g,h,b,P,w){if(o(g),o(h),u(b),h.length>255){const y=Math.ceil(2*P/8);h=w.create({dkLen:y}).update((0,t.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(h).digest()}if(b>65535||h.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return w.create({dkLen:b}).update(g).update(i(b,2)).update(h).update(i(h.length,1)).digest()}Bt.expand_message_xof=a;function f(g,h,b){(0,t.validateObject)(b,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:P,k:w,m:y,hash:v,expand:p,DST:B}=b;o(g),u(h);const k=r(B),R=P.toString(2).length,T=Math.ceil((R+w)/8),N=h*y*T;let S;if(p==="xmd")S=l(g,k,N,v);else if(p==="xof")S=a(g,k,N,w,v);else if(p==="_internal_pass")S=g;else throw new Error('expand must be "xmd" or "xof"');const E=new Array(h);for(let x=0;x<h;x++){const A=new Array(y);for(let O=0;O<y;O++){const I=T*(O+x*y),L=S.subarray(I,I+T);A[O]=(0,e.mod)(n(L),P)}E[x]=A}return E}Bt.hash_to_field=f;function d(g,h){const b=h.map(P=>Array.from(P).reverse());return(P,w)=>{const[y,v,p,B]=b.map(k=>k.reduce((R,T)=>g.add(g.mul(R,P),T)));return P=g.div(y,v),w=g.mul(w,g.div(p,B)),{x:P,y:w}}}Bt.isogenyMap=d;function c(g,h,b){if(typeof h!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(P,w){const y=f(P,2,{...b,DST:b.DST,...w}),v=g.fromAffine(h(y[0])),p=g.fromAffine(h(y[1])),B=v.add(p).clearCofactor();return B.assertValidity(),B},encodeToCurve(P,w){const y=f(P,1,{...b,DST:b.encodeDST,...w}),v=g.fromAffine(h(y[0])).clearCofactor();return v.assertValidity(),v}}}return Bt.createHasher=c,Bt}var Vr={},vl;function Zg(){if(vl)return Vr;vl=1,Object.defineProperty(Vr,"__esModule",{value:!0}),Vr.createCurve=Vr.getHash=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=Rc(),t=or(),r=eh();function n(s){return{hash:s,hmac:(o,...u)=>(0,e.hmac)(s,o,(0,t.concatBytes)(...u)),randomBytes:t.randomBytes}}Vr.getHash=n;function i(s,o){const u=l=>(0,r.weierstrass)({...s,...n(l)});return Object.freeze({...u(o),create:u})}return Vr.createCurve=i,Vr}var _l;function Xg(){return _l||(_l=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.schnorr=e.secp256k1=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=Ic(),r=or(),n=io(),i=eh(),s=Rn(),o=Yg(),u=Zg(),l=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),a=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),f=BigInt(1),d=BigInt(2),c=(D,j)=>(D+j/d)/j;function g(D){const j=l,$=BigInt(3),F=BigInt(6),M=BigInt(11),ee=BigInt(22),de=BigInt(23),Q=BigInt(44),ae=BigInt(88),Z=D*D*D%j,te=Z*Z*D%j,re=(0,n.pow2)(te,$,j)*te%j,K=(0,n.pow2)(re,$,j)*te%j,W=(0,n.pow2)(K,d,j)*Z%j,ne=(0,n.pow2)(W,M,j)*W%j,se=(0,n.pow2)(ne,ee,j)*ne%j,U=(0,n.pow2)(se,Q,j)*se%j,J=(0,n.pow2)(U,ae,j)*U%j,z=(0,n.pow2)(J,Q,j)*se%j,oe=(0,n.pow2)(z,$,j)*te%j,Y=(0,n.pow2)(oe,de,j)*ne%j,he=(0,n.pow2)(Y,F,j)*Z%j,we=(0,n.pow2)(he,d,j);if(!h.eql(h.sqr(we),D))throw new Error("Cannot find square root");return we}const h=(0,n.Field)(l,void 0,void 0,{sqrt:g});e.secp256k1=(0,u.createCurve)({a:BigInt(0),b:BigInt(7),Fp:h,n:a,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:D=>{const j=a,$=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),F=-f*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),M=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),ee=$,de=BigInt("0x100000000000000000000000000000000"),Q=c(ee*D,j),ae=c(-F*D,j);let Z=(0,n.mod)(D-Q*$-ae*M,j),te=(0,n.mod)(-Q*F-ae*ee,j);const re=Z>de,K=te>de;if(re&&(Z=j-Z),K&&(te=j-te),Z>de||te>de)throw new Error("splitScalar: Endomorphism failed, k="+D);return{k1neg:re,k1:Z,k2neg:K,k2:te}}}},t.sha256);const b=BigInt(0),P=D=>typeof D=="bigint"&&b<D&&D<l,w=D=>typeof D=="bigint"&&b<D&&D<a,y={};function v(D,...j){let $=y[D];if($===void 0){const F=(0,t.sha256)(Uint8Array.from(D,M=>M.charCodeAt(0)));$=(0,s.concatBytes)(F,F),y[D]=$}return(0,t.sha256)((0,s.concatBytes)($,...j))}const p=D=>D.toRawBytes(!0).slice(1),B=D=>(0,s.numberToBytesBE)(D,32),k=D=>(0,n.mod)(D,l),R=D=>(0,n.mod)(D,a),T=e.secp256k1.ProjectivePoint,N=(D,j,$)=>T.BASE.multiplyAndAddUnsafe(D,j,$);function S(D){let j=e.secp256k1.utils.normPrivateKeyToScalar(D),$=T.fromPrivateKey(j);return{scalar:$.hasEvenY()?j:R(-j),bytes:p($)}}function E(D){if(!P(D))throw new Error("bad x: need 0 < x < p");const j=k(D*D),$=k(j*D+BigInt(7));let F=g($);F%d!==b&&(F=k(-F));const M=new T(D,F,f);return M.assertValidity(),M}function x(...D){return R((0,s.bytesToNumberBE)(v("BIP0340/challenge",...D)))}function A(D){return S(D).bytes}function O(D,j,$=(0,r.randomBytes)(32)){const F=(0,s.ensureBytes)("message",D),{bytes:M,scalar:ee}=S(j),de=(0,s.ensureBytes)("auxRand",$,32),Q=B(ee^(0,s.bytesToNumberBE)(v("BIP0340/aux",de))),ae=v("BIP0340/nonce",Q,M,F),Z=R((0,s.bytesToNumberBE)(ae));if(Z===b)throw new Error("sign failed: k is zero");const{bytes:te,scalar:re}=S(Z),K=x(te,M,F),W=new Uint8Array(64);if(W.set(te,0),W.set(B(R(re+K*ee)),32),!I(W,F,M))throw new Error("sign: Invalid signature produced");return W}function I(D,j,$){const F=(0,s.ensureBytes)("signature",D,64),M=(0,s.ensureBytes)("message",j),ee=(0,s.ensureBytes)("publicKey",$,32);try{const de=E((0,s.bytesToNumberBE)(ee)),Q=(0,s.bytesToNumberBE)(F.subarray(0,32));if(!P(Q))return!1;const ae=(0,s.bytesToNumberBE)(F.subarray(32,64));if(!w(ae))return!1;const Z=x(B(Q),p(de),M),te=N(de,ae,R(-Z));return!(!te||!te.hasEvenY()||te.toAffine().x!==Q)}catch{return!1}}e.schnorr={getPublicKey:A,sign:O,verify:I,utils:{randomPrivateKey:e.secp256k1.utils.randomPrivateKey,lift_x:E,pointToBytes:p,numberToBytesBE:s.numberToBytesBE,bytesToNumberBE:s.bytesToNumberBE,taggedHash:v,mod:n.mod}};const L=(0,o.isogenyMap)(h,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(D=>D.map(j=>BigInt(j)))),H=(0,i.mapToCurveSimpleSWU)(h,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:h.create(BigInt("-11"))}),V=(0,o.createHasher)(e.secp256k1.ProjectivePoint,D=>{const{x:j,y:$}=H(h.create(D[0]));return L(j,$)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:h.ORDER,m:1,k:128,expand:"xmd",hash:t.sha256});e.hashToCurve=V.hashToCurve,e.encodeToCurve=V.encodeToCurve}(ra)),ra}var ii={},ia={},si={},kl;function em(){return kl||(kl=1,Object.defineProperty(si,"__esModule",{value:!0}),si.ZeroAddress=void 0,si.ZeroAddress="0x0000000000000000000000000000000000000000"),si}var oi={},Pl;function tm(){return Pl||(Pl=1,Object.defineProperty(oi,"__esModule",{value:!0}),oi.ZeroHash=void 0,oi.ZeroHash="0x0000000000000000000000000000000000000000000000000000000000000000"),oi}var Ct={},Tl;function rm(){return Tl||(Tl=1,Object.defineProperty(Ct,"__esModule",{value:!0}),Ct.MaxInt256=Ct.MinInt256=Ct.MaxUint256=Ct.WeiPerEther=Ct.N=void 0,Ct.N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Ct.WeiPerEther=BigInt("1000000000000000000"),Ct.MaxUint256=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Ct.MinInt256=BigInt("0x8000000000000000000000000000000000000000000000000000000000000000")*BigInt(-1),Ct.MaxInt256=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")),Ct}var zr={},Sl;function nm(){return Sl||(Sl=1,Object.defineProperty(zr,"__esModule",{value:!0}),zr.MessagePrefix=zr.EtherSymbol=void 0,zr.EtherSymbol="Ξ",zr.MessagePrefix=`Ethereum Signed Message:
|
|
764
|
-
`),zr}var Ol;function ps(){return Ol||(Ol=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MessagePrefix=e.EtherSymbol=e.MaxInt256=e.MinInt256=e.MaxUint256=e.WeiPerEther=e.N=e.ZeroHash=e.ZeroAddress=void 0;var t=em();Object.defineProperty(e,"ZeroAddress",{enumerable:!0,get:function(){return t.ZeroAddress}});var r=tm();Object.defineProperty(e,"ZeroHash",{enumerable:!0,get:function(){return r.ZeroHash}});var n=rm();Object.defineProperty(e,"N",{enumerable:!0,get:function(){return n.N}}),Object.defineProperty(e,"WeiPerEther",{enumerable:!0,get:function(){return n.WeiPerEther}}),Object.defineProperty(e,"MaxUint256",{enumerable:!0,get:function(){return n.MaxUint256}}),Object.defineProperty(e,"MinInt256",{enumerable:!0,get:function(){return n.MinInt256}}),Object.defineProperty(e,"MaxInt256",{enumerable:!0,get:function(){return n.MaxInt256}});var i=nm();Object.defineProperty(e,"EtherSymbol",{enumerable:!0,get:function(){return i.EtherSymbol}}),Object.defineProperty(e,"MessagePrefix",{enumerable:!0,get:function(){return i.MessagePrefix}})}(ia)),ia}var Bl;function th(){var d,c,g,h;if(Bl)return ii;Bl=1,Object.defineProperty(ii,"__esModule",{value:!0}),ii.Signature=void 0;const e=ps(),t=Ce(),r=BigInt(0),n=BigInt(1),i=BigInt(2),s=BigInt(27),o=BigInt(28),u=BigInt(35),l={};function a(P){return(0,t.zeroPadValue)((0,t.toBeArray)(P),32)}const b=class b{constructor(w,y,v,p){xe(this,d);xe(this,c);xe(this,g);xe(this,h);(0,t.assertPrivate)(w,l,"Signature"),ue(this,d,y),ue(this,c,v),ue(this,g,p),ue(this,h,null)}get r(){return q(this,d)}set r(w){(0,t.assertArgument)((0,t.dataLength)(w)===32,"invalid r","value",w),ue(this,d,(0,t.hexlify)(w))}get s(){return q(this,c)}set s(w){(0,t.assertArgument)((0,t.dataLength)(w)===32,"invalid s","value",w);const y=(0,t.hexlify)(w);(0,t.assertArgument)(parseInt(y.substring(0,3))<8,"non-canonical s","value",y),ue(this,c,y)}get v(){return q(this,g)}set v(w){const y=(0,t.getNumber)(w,"value");(0,t.assertArgument)(y===27||y===28,"invalid v","v",w),ue(this,g,y)}get networkV(){return q(this,h)}get legacyChainId(){const w=this.networkV;return w==null?null:b.getChainId(w)}get yParity(){return this.v===27?0:1}get yParityAndS(){const w=(0,t.getBytes)(this.s);return this.yParity&&(w[0]|=128),(0,t.hexlify)(w)}get compactSerialized(){return(0,t.concat)([this.r,this.yParityAndS])}get serialized(){return(0,t.concat)([this.r,this.s,this.yParity?"0x1c":"0x1b"])}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const w=new b(l,this.r,this.s,this.v);return this.networkV&&ue(w,h,this.networkV),w}toJSON(){const w=this.networkV;return{_type:"signature",networkV:w!=null?w.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(w){const y=(0,t.getBigInt)(w,"v");return y==s||y==o?r:((0,t.assertArgument)(y>=u,"invalid EIP-155 v","v",w),(y-u)/i)}static getChainIdV(w,y){return(0,t.getBigInt)(w)*i+BigInt(35+y-27)}static getNormalizedV(w){const y=(0,t.getBigInt)(w);return y===r||y===s?27:y===n||y===o?28:((0,t.assertArgument)(y>=u,"invalid v","v",w),y&n?27:28)}static from(w){function y(N,S){(0,t.assertArgument)(N,S,"signature",w)}if(w==null)return new b(l,e.ZeroHash,e.ZeroHash,27);if(typeof w=="string"){const N=(0,t.getBytes)(w,"signature");if(N.length===64){const S=(0,t.hexlify)(N.slice(0,32)),E=N.slice(32,64),x=E[0]&128?28:27;return E[0]&=127,new b(l,S,(0,t.hexlify)(E),x)}if(N.length===65){const S=(0,t.hexlify)(N.slice(0,32)),E=N.slice(32,64);y((E[0]&128)===0,"non-canonical s");const x=b.getNormalizedV(N[64]);return new b(l,S,(0,t.hexlify)(E),x)}y(!1,"invalid raw signature length")}if(w instanceof b)return w.clone();const v=w.r;y(v!=null,"missing r");const p=a(v),B=function(N,S){if(N!=null)return a(N);if(S!=null){y((0,t.isHexString)(S,32),"invalid yParityAndS");const E=(0,t.getBytes)(S);return E[0]&=127,(0,t.hexlify)(E)}y(!1,"missing s")}(w.s,w.yParityAndS);y(((0,t.getBytes)(B)[0]&128)==0,"non-canonical s");const{networkV:k,v:R}=function(N,S,E){if(N!=null){const x=(0,t.getBigInt)(N);return{networkV:x>=u?x:void 0,v:b.getNormalizedV(x)}}if(S!=null)return y((0,t.isHexString)(S,32),"invalid yParityAndS"),{v:(0,t.getBytes)(S)[0]&128?28:27};if(E!=null){switch((0,t.getNumber)(E,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}y(!1,"invalid yParity")}y(!1,"missing v")}(w.v,w.yParityAndS,w.yParity),T=new b(l,p,B,R);return k&&ue(T,h,k),y(w.yParity==null||(0,t.getNumber)(w.yParity,"sig.yParity")===T.yParity,"yParity mismatch"),y(w.yParityAndS==null||w.yParityAndS===T.yParityAndS,"yParityAndS mismatch"),T}};d=new WeakMap,c=new WeakMap,g=new WeakMap,h=new WeakMap;let f=b;return ii.Signature=f,ii}var Cl;function im(){var i;if(Cl)return ni;Cl=1,Object.defineProperty(ni,"__esModule",{value:!0}),ni.SigningKey=void 0;const e=Xg(),t=Ce(),r=th(),s=class s{constructor(u){xe(this,i);(0,t.assertArgument)((0,t.dataLength)(u)===32,"invalid private key","privateKey","[REDACTED]"),ue(this,i,(0,t.hexlify)(u))}get privateKey(){return q(this,i)}get publicKey(){return s.computePublicKey(q(this,i))}get compressedPublicKey(){return s.computePublicKey(q(this,i),!0)}sign(u){(0,t.assertArgument)((0,t.dataLength)(u)===32,"invalid digest length","digest",u);const l=e.secp256k1.sign((0,t.getBytesCopy)(u),(0,t.getBytesCopy)(q(this,i)),{lowS:!0});return r.Signature.from({r:(0,t.toBeHex)(l.r,32),s:(0,t.toBeHex)(l.s,32),v:l.recovery?28:27})}computeSharedSecret(u){const l=s.computePublicKey(u);return(0,t.hexlify)(e.secp256k1.getSharedSecret((0,t.getBytesCopy)(q(this,i)),(0,t.getBytes)(l),!1))}static computePublicKey(u,l){let a=(0,t.getBytes)(u,"key");if(a.length===32){const d=e.secp256k1.getPublicKey(a,!!l);return(0,t.hexlify)(d)}if(a.length===64){const d=new Uint8Array(65);d[0]=4,d.set(a,1),a=d}const f=e.secp256k1.ProjectivePoint.fromHex(a);return(0,t.hexlify)(f.toRawBytes(l))}static recoverPublicKey(u,l){(0,t.assertArgument)((0,t.dataLength)(u)===32,"invalid digest length","digest",u);const a=r.Signature.from(l);let f=e.secp256k1.Signature.fromCompact((0,t.getBytesCopy)((0,t.concat)([a.r,a.s])));f=f.addRecoveryBit(a.yParity);const d=f.recoverPublicKey((0,t.getBytesCopy)(u));return(0,t.assertArgument)(d!=null,"invalid signautre for digest","signature",l),"0x"+d.toHex(!1)}static addPoints(u,l,a){const f=e.secp256k1.ProjectivePoint.fromHex(s.computePublicKey(u).substring(2)),d=e.secp256k1.ProjectivePoint.fromHex(s.computePublicKey(l).substring(2));return"0x"+f.add(d).toHex(!!a)}};i=new WeakMap;let n=s;return ni.SigningKey=n,ni}var Rl;function ht(){return Rl||(Rl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.lock=e.Signature=e.SigningKey=e.scryptSync=e.scrypt=e.pbkdf2=e.sha512=e.sha256=e.ripemd160=e.keccak256=e.randomBytes=e.computeHmac=void 0;const t=Dg();Object.defineProperty(e,"computeHmac",{enumerable:!0,get:function(){return t.computeHmac}});const r=$g();Object.defineProperty(e,"keccak256",{enumerable:!0,get:function(){return r.keccak256}});const n=Kg();Object.defineProperty(e,"ripemd160",{enumerable:!0,get:function(){return n.ripemd160}});const i=qg();Object.defineProperty(e,"pbkdf2",{enumerable:!0,get:function(){return i.pbkdf2}});const s=Vg();Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return s.randomBytes}});const o=Wg();Object.defineProperty(e,"scrypt",{enumerable:!0,get:function(){return o.scrypt}}),Object.defineProperty(e,"scryptSync",{enumerable:!0,get:function(){return o.scryptSync}});const u=Jg();Object.defineProperty(e,"sha256",{enumerable:!0,get:function(){return u.sha256}}),Object.defineProperty(e,"sha512",{enumerable:!0,get:function(){return u.sha512}});var l=im();Object.defineProperty(e,"SigningKey",{enumerable:!0,get:function(){return l.SigningKey}});var a=th();Object.defineProperty(e,"Signature",{enumerable:!0,get:function(){return a.Signature}});function f(){t.computeHmac.lock(),r.keccak256.lock(),i.pbkdf2.lock(),s.randomBytes.lock(),n.ripemd160.lock(),o.scrypt.lock(),o.scryptSync.lock(),u.sha256.lock(),u.sha512.lock(),s.randomBytes.lock()}e.lock=f}(Xo)),Xo}var Nl;function Mc(){if(Nl)return Fr;Nl=1,Object.defineProperty(Fr,"__esModule",{value:!0}),Fr.getIcapAddress=Fr.getAddress=void 0;const e=ht(),t=Ce(),r=BigInt(0),n=BigInt(36);function i(c){c=c.toLowerCase();const g=c.substring(2).split(""),h=new Uint8Array(40);for(let P=0;P<40;P++)h[P]=g[P].charCodeAt(0);const b=(0,t.getBytes)((0,e.keccak256)(h));for(let P=0;P<40;P+=2)b[P>>1]>>4>=8&&(g[P]=g[P].toUpperCase()),(b[P>>1]&15)>=8&&(g[P+1]=g[P+1].toUpperCase());return"0x"+g.join("")}const s={};for(let c=0;c<10;c++)s[String(c)]=String(c);for(let c=0;c<26;c++)s[String.fromCharCode(65+c)]=String(10+c);const o=15;function u(c){c=c.toUpperCase(),c=c.substring(4)+c.substring(0,2)+"00";let g=c.split("").map(b=>s[b]).join("");for(;g.length>=o;){let b=g.substring(0,o);g=parseInt(b,10)%97+g.substring(b.length)}let h=String(98-parseInt(g,10)%97);for(;h.length<2;)h="0"+h;return h}const l=function(){const c={};for(let g=0;g<36;g++){const h="0123456789abcdefghijklmnopqrstuvwxyz"[g];c[h]=BigInt(g)}return c}();function a(c){c=c.toLowerCase();let g=r;for(let h=0;h<c.length;h++)g=g*n+l[c[h]];return g}function f(c){if((0,t.assertArgument)(typeof c=="string","invalid address","address",c),c.match(/^(0x)?[0-9a-fA-F]{40}$/)){c.startsWith("0x")||(c="0x"+c);const g=i(c);return(0,t.assertArgument)(!c.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||g===c,"bad address checksum","address",c),g}if(c.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){(0,t.assertArgument)(c.substring(2,4)===u(c),"bad icap checksum","address",c);let g=a(c.substring(4)).toString(16);for(;g.length<40;)g="0"+g;return i("0x"+g)}(0,t.assertArgument)(!1,"invalid address","address",c)}Fr.getAddress=f;function d(c){let g=BigInt(f(c)).toString(36).toUpperCase();for(;g.length<30;)g="0"+g;return"XE"+u("XE00"+g)+g}return Fr.getIcapAddress=d,Fr}var Wr={},Il;function sm(){if(Il)return Wr;Il=1,Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.getCreate2Address=Wr.getCreateAddress=void 0;const e=ht(),t=Ce(),r=Mc();function n(s){const o=(0,r.getAddress)(s.from);let l=(0,t.getBigInt)(s.nonce,"tx.nonce").toString(16);return l==="0"?l="0x":l.length%2?l="0x0"+l:l="0x"+l,(0,r.getAddress)((0,t.dataSlice)((0,e.keccak256)((0,t.encodeRlp)([o,l])),12))}Wr.getCreateAddress=n;function i(s,o,u){const l=(0,r.getAddress)(s),a=(0,t.getBytes)(o,"salt"),f=(0,t.getBytes)(u,"initCodeHash");return(0,t.assertArgument)(a.length===32,"salt must be 32 bytes","salt",o),(0,t.assertArgument)(f.length===32,"initCodeHash must be 32 bytes","initCodeHash",u),(0,r.getAddress)((0,t.dataSlice)((0,e.keccak256)((0,t.concat)(["0xff",l,a,f])),12))}return Wr.getCreate2Address=i,Wr}var ur={},Ml;function om(){if(Ml)return ur;Ml=1,Object.defineProperty(ur,"__esModule",{value:!0}),ur.resolveAddress=ur.isAddress=ur.isAddressable=void 0;const e=Ce(),t=Mc();function r(o){return o&&typeof o.getAddress=="function"}ur.isAddressable=r;function n(o){try{return(0,t.getAddress)(o),!0}catch{}return!1}ur.isAddress=n;async function i(o,u){const l=await u;return(l==null||l==="0x0000000000000000000000000000000000000000")&&((0,e.assert)(typeof o!="string","unconfigured name","UNCONFIGURED_NAME",{value:o}),(0,e.assertArgument)(!1,"invalid AddressLike value; did not resolve to a value address","target",o)),(0,t.getAddress)(l)}function s(o,u){if(typeof o=="string")return o.match(/^0x[0-9a-f]{40}$/i)?(0,t.getAddress)(o):((0,e.assert)(u!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),i(o,u.resolveName(o)));if(r(o))return i(o,o.getAddress());if(o&&typeof o.then=="function")return i(o,o);(0,e.assertArgument)(!1,"unsupported addressable value","target",o)}return ur.resolveAddress=s,ur}var Ll;function ft(){return Ll||(Ll=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.resolveAddress=e.isAddress=e.isAddressable=e.getCreate2Address=e.getCreateAddress=e.getIcapAddress=e.getAddress=void 0;var t=Mc();Object.defineProperty(e,"getAddress",{enumerable:!0,get:function(){return t.getAddress}}),Object.defineProperty(e,"getIcapAddress",{enumerable:!0,get:function(){return t.getIcapAddress}});var r=sm();Object.defineProperty(e,"getCreateAddress",{enumerable:!0,get:function(){return r.getCreateAddress}}),Object.defineProperty(e,"getCreate2Address",{enumerable:!0,get:function(){return r.getCreate2Address}});var n=om();Object.defineProperty(e,"isAddressable",{enumerable:!0,get:function(){return n.isAddressable}}),Object.defineProperty(e,"isAddress",{enumerable:!0,get:function(){return n.isAddress}}),Object.defineProperty(e,"resolveAddress",{enumerable:!0,get:function(){return n.resolveAddress}})}(Zo)),Zo}var ai={},Ul;function Er(){var o;if(Ul)return ai;Ul=1,Object.defineProperty(ai,"__esModule",{value:!0}),ai.Typed=void 0;const e=Ce(),t={};function r(l,a){let f=!1;return a<0&&(f=!0,a*=-1),new s(t,`${f?"":"u"}int${a}`,l,{signed:f,width:a})}function n(l,a){return new s(t,`bytes${a||""}`,l,{size:a})}const i=Symbol.for("_ethers_typed"),u=class u{constructor(a,f,d,c){pe(this,"type");pe(this,"value");xe(this,o);pe(this,"_typedSymbol");c==null&&(c=null),(0,e.assertPrivate)(t,a,"Typed"),(0,e.defineProperties)(this,{_typedSymbol:i,type:f,value:d}),ue(this,o,c),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(a=>a.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 q(this,o)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return q(this,o)===!0?-1:q(this,o)===!1?this.value.length:null}static from(a,f){return new u(t,a,f)}static uint8(a){return r(a,8)}static uint16(a){return r(a,16)}static uint24(a){return r(a,24)}static uint32(a){return r(a,32)}static uint40(a){return r(a,40)}static uint48(a){return r(a,48)}static uint56(a){return r(a,56)}static uint64(a){return r(a,64)}static uint72(a){return r(a,72)}static uint80(a){return r(a,80)}static uint88(a){return r(a,88)}static uint96(a){return r(a,96)}static uint104(a){return r(a,104)}static uint112(a){return r(a,112)}static uint120(a){return r(a,120)}static uint128(a){return r(a,128)}static uint136(a){return r(a,136)}static uint144(a){return r(a,144)}static uint152(a){return r(a,152)}static uint160(a){return r(a,160)}static uint168(a){return r(a,168)}static uint176(a){return r(a,176)}static uint184(a){return r(a,184)}static uint192(a){return r(a,192)}static uint200(a){return r(a,200)}static uint208(a){return r(a,208)}static uint216(a){return r(a,216)}static uint224(a){return r(a,224)}static uint232(a){return r(a,232)}static uint240(a){return r(a,240)}static uint248(a){return r(a,248)}static uint256(a){return r(a,256)}static uint(a){return r(a,256)}static int8(a){return r(a,-8)}static int16(a){return r(a,-16)}static int24(a){return r(a,-24)}static int32(a){return r(a,-32)}static int40(a){return r(a,-40)}static int48(a){return r(a,-48)}static int56(a){return r(a,-56)}static int64(a){return r(a,-64)}static int72(a){return r(a,-72)}static int80(a){return r(a,-80)}static int88(a){return r(a,-88)}static int96(a){return r(a,-96)}static int104(a){return r(a,-104)}static int112(a){return r(a,-112)}static int120(a){return r(a,-120)}static int128(a){return r(a,-128)}static int136(a){return r(a,-136)}static int144(a){return r(a,-144)}static int152(a){return r(a,-152)}static int160(a){return r(a,-160)}static int168(a){return r(a,-168)}static int176(a){return r(a,-176)}static int184(a){return r(a,-184)}static int192(a){return r(a,-192)}static int200(a){return r(a,-200)}static int208(a){return r(a,-208)}static int216(a){return r(a,-216)}static int224(a){return r(a,-224)}static int232(a){return r(a,-232)}static int240(a){return r(a,-240)}static int248(a){return r(a,-248)}static int256(a){return r(a,-256)}static int(a){return r(a,-256)}static bytes1(a){return n(a,1)}static bytes2(a){return n(a,2)}static bytes3(a){return n(a,3)}static bytes4(a){return n(a,4)}static bytes5(a){return n(a,5)}static bytes6(a){return n(a,6)}static bytes7(a){return n(a,7)}static bytes8(a){return n(a,8)}static bytes9(a){return n(a,9)}static bytes10(a){return n(a,10)}static bytes11(a){return n(a,11)}static bytes12(a){return n(a,12)}static bytes13(a){return n(a,13)}static bytes14(a){return n(a,14)}static bytes15(a){return n(a,15)}static bytes16(a){return n(a,16)}static bytes17(a){return n(a,17)}static bytes18(a){return n(a,18)}static bytes19(a){return n(a,19)}static bytes20(a){return n(a,20)}static bytes21(a){return n(a,21)}static bytes22(a){return n(a,22)}static bytes23(a){return n(a,23)}static bytes24(a){return n(a,24)}static bytes25(a){return n(a,25)}static bytes26(a){return n(a,26)}static bytes27(a){return n(a,27)}static bytes28(a){return n(a,28)}static bytes29(a){return n(a,29)}static bytes30(a){return n(a,30)}static bytes31(a){return n(a,31)}static bytes32(a){return n(a,32)}static address(a){return new u(t,"address",a)}static bool(a){return new u(t,"bool",!!a)}static bytes(a){return new u(t,"bytes",a)}static string(a){return new u(t,"string",a)}static array(a,f){throw new Error("not implemented yet")}static tuple(a,f){throw new Error("not implemented yet")}static overrides(a){return new u(t,"overrides",Object.assign({},a))}static isTyped(a){return a&&typeof a=="object"&&"_typedSymbol"in a&&a._typedSymbol===i}static dereference(a,f){if(u.isTyped(a)){if(a.type!==f)throw new Error(`invalid type: expecetd ${f}, got ${a.type}`);return a.value}return a}};o=new WeakMap;let s=u;return ai.Typed=s,ai}var Fl;function am(){if(Fl)return Jn;Fl=1,Object.defineProperty(Jn,"__esModule",{value:!0}),Jn.AddressCoder=void 0;const e=ft(),t=ds(),r=Er(),n=Zt();class i extends n.Coder{constructor(o){super("address","address",o,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(o,u){let l=r.Typed.dereference(u,"string");try{l=(0,e.getAddress)(l)}catch(a){return this._throwError(a.message,u)}return o.writeValue(l)}decode(o){return(0,e.getAddress)((0,t.toBeHex)(o.readValue(),20))}}return Jn.AddressCoder=i,Jn}var lr={},ci={},jl;function cm(){if(jl)return ci;jl=1,Object.defineProperty(ci,"__esModule",{value:!0}),ci.AnonymousCoder=void 0;const e=Zt();class t extends e.Coder{constructor(i){super(i.name,i.type,"_",i.dynamic);pe(this,"coder");this.coder=i}defaultValue(){return this.coder.defaultValue()}encode(i,s){return this.coder.encode(i,s)}decode(i){return this.coder.decode(i)}}return ci.AnonymousCoder=t,ci}var Dl;function rh(){if(Dl)return lr;Dl=1,Object.defineProperty(lr,"__esModule",{value:!0}),lr.ArrayCoder=lr.unpack=lr.pack=void 0;const e=Ce(),t=Er(),r=Zt(),n=cm();function i(u,l,a){let f=[];if(Array.isArray(a))f=a;else if(a&&typeof a=="object"){let b={};f=l.map(P=>{const w=P.localName;return(0,e.assert)(w,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:P},value:a}),(0,e.assert)(!b[w],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:P},value:a}),b[w]=!0,a[w]})}else(0,e.assertArgument)(!1,"invalid tuple value","tuple",a);(0,e.assertArgument)(l.length===f.length,"types/value length mismatch","tuple",a);let d=new r.Writer,c=new r.Writer,g=[];l.forEach((b,P)=>{let w=f[P];if(b.dynamic){let y=c.length;b.encode(c,w);let v=d.writeUpdatableValue();g.push(p=>{v(p+y)})}else b.encode(d,w)}),g.forEach(b=>{b(d.length)});let h=u.appendWriter(d);return h+=u.appendWriter(c),h}lr.pack=i;function s(u,l){let a=[],f=[],d=u.subReader(0);return l.forEach(c=>{let g=null;if(c.dynamic){let h=u.readIndex(),b=d.subReader(h);try{g=c.decode(b)}catch(P){if((0,e.isError)(P,"BUFFER_OVERRUN"))throw P;g=P,g.baseType=c.name,g.name=c.localName,g.type=c.type}}else try{g=c.decode(u)}catch(h){if((0,e.isError)(h,"BUFFER_OVERRUN"))throw h;g=h,g.baseType=c.name,g.name=c.localName,g.type=c.type}if(g==null)throw new Error("investigate");a.push(g),f.push(c.localName||null)}),r.Result.fromItems(a,f)}lr.unpack=s;class o extends r.Coder{constructor(a,f,d){const c=a.type+"["+(f>=0?f:"")+"]",g=f===-1||a.dynamic;super("array",c,d,g);pe(this,"coder");pe(this,"length");(0,e.defineProperties)(this,{coder:a,length:f})}defaultValue(){const a=this.coder.defaultValue(),f=[];for(let d=0;d<this.length;d++)f.push(a);return f}encode(a,f){const d=t.Typed.dereference(f,"array");Array.isArray(d)||this._throwError("expected array value",d);let c=this.length;c===-1&&(c=d.length,a.writeValue(d.length)),(0,e.assertArgumentCount)(d.length,c,"coder array"+(this.localName?" "+this.localName:""));let g=[];for(let h=0;h<d.length;h++)g.push(this.coder);return i(a,g,d)}decode(a){let f=this.length;f===-1&&(f=a.readIndex(),(0,e.assert)(f*r.WordSize<=a.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:a.bytes,offset:f*r.WordSize,length:a.dataLength}));let d=[];for(let c=0;c<f;c++)d.push(new n.AnonymousCoder(this.coder));return s(a,d)}}return lr.ArrayCoder=o,lr}var ui={},Hl;function um(){if(Hl)return ui;Hl=1,Object.defineProperty(ui,"__esModule",{value:!0}),ui.BooleanCoder=void 0;const e=Er(),t=Zt();class r extends t.Coder{constructor(i){super("bool","bool",i,!1)}defaultValue(){return!1}encode(i,s){const o=e.Typed.dereference(s,"bool");return i.writeValue(o?1:0)}decode(i){return!!i.readValue()}}return ui.BooleanCoder=r,ui}var Jr={},$l;function nh(){if($l)return Jr;$l=1,Object.defineProperty(Jr,"__esModule",{value:!0}),Jr.BytesCoder=Jr.DynamicBytesCoder=void 0;const e=Ce(),t=Zt();class r extends t.Coder{constructor(s,o){super(s,s,o,!0)}defaultValue(){return"0x"}encode(s,o){o=(0,e.getBytesCopy)(o);let u=s.writeValue(o.length);return u+=s.writeBytes(o),u}decode(s){return s.readBytes(s.readIndex(),!0)}}Jr.DynamicBytesCoder=r;class n extends r{constructor(s){super("bytes",s)}decode(s){return(0,e.hexlify)(super.decode(s))}}return Jr.BytesCoder=n,Jr}var li={},Gl;function lm(){if(Gl)return li;Gl=1,Object.defineProperty(li,"__esModule",{value:!0}),li.FixedBytesCoder=void 0;const e=Ce(),t=Er(),r=Zt();class n extends r.Coder{constructor(o,u){let l="bytes"+String(o);super(l,l,u,!1);pe(this,"size");(0,e.defineProperties)(this,{size:o},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(o,u){let l=(0,e.getBytesCopy)(t.Typed.dereference(u,this.type));return l.length!==this.size&&this._throwError("incorrect data length",u),o.writeBytes(l)}decode(o){return(0,e.hexlify)(o.readBytes(this.size))}}return li.FixedBytesCoder=n,li}var fi={},Kl;function fm(){if(Kl)return fi;Kl=1,Object.defineProperty(fi,"__esModule",{value:!0}),fi.NullCoder=void 0;const e=Zt(),t=new Uint8Array([]);class r extends e.Coder{constructor(i){super("null","",i,!1)}defaultValue(){return null}encode(i,s){return s!=null&&this._throwError("not null",s),i.writeBytes(t)}decode(i){return i.readBytes(0),null}}return fi.NullCoder=r,fi}var di={},ql;function dm(){if(ql)return di;ql=1,Object.defineProperty(di,"__esModule",{value:!0}),di.NumberCoder=void 0;const e=Ce(),t=Er(),r=Zt(),n=BigInt(0),i=BigInt(1),s=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class o extends r.Coder{constructor(a,f,d){const c=(f?"int":"uint")+a*8;super(c,c,d,!1);pe(this,"size");pe(this,"signed");(0,e.defineProperties)(this,{size:a,signed:f},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(a,f){let d=(0,e.getBigInt)(t.Typed.dereference(f,this.type)),c=(0,e.mask)(s,r.WordSize*8);if(this.signed){let g=(0,e.mask)(c,this.size*8-1);(d>g||d<-(g+i))&&this._throwError("value out-of-bounds",f),d=(0,e.toTwos)(d,8*r.WordSize)}else(d<n||d>(0,e.mask)(c,this.size*8))&&this._throwError("value out-of-bounds",f);return a.writeValue(d)}decode(a){let f=(0,e.mask)(a.readValue(),this.size*8);return this.signed&&(f=(0,e.fromTwos)(f,this.size*8)),f}}return di.NumberCoder=o,di}var hi={},Vl;function hm(){if(Vl)return hi;Vl=1,Object.defineProperty(hi,"__esModule",{value:!0}),hi.StringCoder=void 0;const e=Cc(),t=Er(),r=nh();class n extends r.DynamicBytesCoder{constructor(s){super("string",s)}defaultValue(){return""}encode(s,o){return super.encode(s,(0,e.toUtf8Bytes)(t.Typed.dereference(o,"string")))}decode(s){return(0,e.toUtf8String)(super.decode(s))}}return hi.StringCoder=n,hi}var pi={},zl;function pm(){if(zl)return pi;zl=1,Object.defineProperty(pi,"__esModule",{value:!0}),pi.TupleCoder=void 0;const e=gn(),t=Er(),r=Zt(),n=rh();class i extends r.Coder{constructor(u,l){let a=!1;const f=[];u.forEach(c=>{c.dynamic&&(a=!0),f.push(c.type)});const d="tuple("+f.join(",")+")";super("tuple",d,l,a);pe(this,"coders");(0,e.defineProperties)(this,{coders:Object.freeze(u.slice())})}defaultValue(){const u=[];this.coders.forEach(a=>{u.push(a.defaultValue())});const l=this.coders.reduce((a,f)=>{const d=f.localName;return d&&(a[d]||(a[d]=0),a[d]++),a},{});return this.coders.forEach((a,f)=>{let d=a.localName;!d||l[d]!==1||(d==="length"&&(d="_length"),u[d]==null&&(u[d]=u[f]))}),Object.freeze(u)}encode(u,l){const a=t.Typed.dereference(l,"tuple");return(0,n.pack)(u,this.coders,a)}decode(u){return(0,n.unpack)(u,this.coders)}}return pi.TupleCoder=i,pi}var st={},sa={},bi={},Wl;function ih(){if(Wl)return bi;Wl=1,Object.defineProperty(bi,"__esModule",{value:!0}),bi.id=void 0;const e=ht(),t=Ce();function r(n){return(0,e.keccak256)((0,t.toUtf8Bytes)(n))}return bi.id=r,bi}var qt={},Rt={},Jl;function bm(){if(Jl)return Rt;Jl=1;var e="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 t=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),r=4;function n(be){let Ae=0;function Ee(){return be[Ae++]<<8|be[Ae++]}let Pe=Ee(),ve=1,ke=[0,1];for(let er=1;er<Pe;er++)ke.push(ve+=Ee());let Se=Ee(),Be=Ae;Ae+=Se;let qe=0,Ze=0;function Fe(){return qe==0&&(Ze=Ze<<8|be[Ae++],qe=8),Ze>>--qe&1}const Ve=31,Ge=2**Ve,Je=Ge>>>1,at=Je>>1,it=Ge-1;let ot=0;for(let er=0;er<Ve;er++)ot=ot<<1|Fe();let Ft=[],wn=0,ks=Ge;for(;;){let er=Math.floor(((ot-wn+1)*ve-1)/ks),Rr=0,So=Pe;for(;So-Rr>1;){let Oo=Rr+So>>>1;er<ke[Oo]?So=Oo:Rr=Oo}if(Rr==0)break;Ft.push(Rr);let kr=wn+Math.floor(ks*ke[Rr]/ve),Nr=wn+Math.floor(ks*ke[Rr+1]/ve)-1;for(;!((kr^Nr)&Je);)ot=ot<<1&it|Fe(),kr=kr<<1&it,Nr=Nr<<1&it|1;for(;kr&~Nr&at;)ot=ot&Je|ot<<1&it>>>1|Fe(),kr=kr<<1^Je,Nr=(Nr^Je)<<1|Je|1;wn=kr,ks=1+Nr-kr}let Ps=Pe-4;return Ft.map(er=>{switch(er-Ps){case 3:return Ps+65792+(be[Be++]<<16|be[Be++]<<8|be[Be++]);case 2:return Ps+256+(be[Be++]<<8|be[Be++]);case 1:return Ps+be[Be++];default:return er-1}})}function i(be){let Ae=0;return()=>be[Ae++]}function s(be){return i(n(o(be)))}function o(be){let Ae=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((ve,ke)=>Ae[ve.charCodeAt(0)]=ke);let Ee=be.length,Pe=new Uint8Array(6*Ee>>3);for(let ve=0,ke=0,Se=0,Be=0;ve<Ee;ve++)Be=Be<<6|Ae[be.charCodeAt(ve)],Se+=6,Se>=8&&(Pe[ke++]=Be>>(Se-=8));return Pe}function u(be){return be&1?~be>>1:be>>1}function l(be,Ae){let Ee=Array(be);for(let Pe=0,ve=0;Pe<be;Pe++)Ee[Pe]=ve+=u(Ae());return Ee}function a(be,Ae=0){let Ee=[];for(;;){let Pe=be(),ve=be();if(!ve)break;Ae+=Pe;for(let ke=0;ke<ve;ke++)Ee.push(Ae+ke);Ae+=ve+1}return Ee}function f(be){return c(()=>{let Ae=a(be);if(Ae.length)return Ae})}function d(be){let Ae=[];for(;;){let Ee=be();if(Ee==0)break;Ae.push(h(Ee,be))}for(;;){let Ee=be()-1;if(Ee<0)break;Ae.push(b(Ee,be))}return Ae.flat()}function c(be){let Ae=[];for(;;){let Ee=be(Ae.length);if(!Ee)break;Ae.push(Ee)}return Ae}function g(be,Ae,Ee){let Pe=Array(be).fill().map(()=>[]);for(let ve=0;ve<Ae;ve++)l(be,Ee).forEach((ke,Se)=>Pe[Se].push(ke));return Pe}function h(be,Ae){let Ee=1+Ae(),Pe=Ae(),ve=c(Ae);return g(ve.length,1+be,Ae).flatMap((Se,Be)=>{let[qe,...Ze]=Se;return Array(ve[Be]).fill().map((Fe,Ve)=>{let Ge=Ve*Pe;return[qe+Ve*Ee,Ze.map(Je=>Je+Ge)]})})}function b(be,Ae){let Ee=1+Ae();return g(Ee,1+be,Ae).map(ve=>[ve[0],ve.slice(1)])}function P(be){let Ae=[],Ee=a(be);return ve(Pe([]),[]),Ae;function Pe(ke){let Se=be(),Be=c(()=>{let qe=a(be).map(Ze=>Ee[Ze]);if(qe.length)return Pe(qe)});return{S:Se,B:Be,Q:ke}}function ve({S:ke,B:Se},Be,qe){if(!(ke&4&&qe===Be[Be.length-1])){ke&2&&(qe=Be[Be.length-1]),ke&1&&Ae.push(Be);for(let Ze of Se)for(let Fe of Ze.Q)ve(Ze,[...Be,Fe],qe)}}}function w(be){return be.toString(16).toUpperCase().padStart(2,"0")}function y(be){return`{${w(be)}}`}function v(be){let Ae=[];for(let Ee=0,Pe=be.length;Ee<Pe;){let ve=be.codePointAt(Ee);Ee+=ve<65536?1:2,Ae.push(ve)}return Ae}function p(be){let Ee=be.length;if(Ee<4096)return String.fromCodePoint(...be);let Pe=[];for(let ve=0;ve<Ee;)Pe.push(String.fromCodePoint(...be.slice(ve,ve+=4096)));return Pe.join("")}function B(be,Ae){let Ee=be.length,Pe=Ee-Ae.length;for(let ve=0;Pe==0&&ve<Ee;ve++)Pe=be[ve]-Ae[ve];return Pe}var k="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 R=44032,T=4352,N=4449,S=4519,E=19,x=21,A=28,O=x*A,I=E*O,L=R+I,H=T+E,V=N+x,D=S+A;function j(be){return be>>24&255}function $(be){return be&16777215}let F,M,ee,de;function Q(){let be=s(k);F=new Map(f(be).flatMap((Ae,Ee)=>Ae.map(Pe=>[Pe,Ee+1<<24]))),M=new Set(a(be)),ee=new Map,de=new Map;for(let[Ae,Ee]of d(be)){if(!M.has(Ae)&&Ee.length==2){let[Pe,ve]=Ee,ke=de.get(Pe);ke||(ke=new Map,de.set(Pe,ke)),ke.set(ve,Ae)}ee.set(Ae,Ee.reverse())}}function ae(be){return be>=R&&be<L}function Z(be,Ae){if(be>=T&&be<H&&Ae>=N&&Ae<V)return R+(be-T)*O+(Ae-N)*A;if(ae(be)&&Ae>S&&Ae<D&&(be-R)%A==0)return be+(Ae-S);{let Ee=de.get(be);return Ee&&(Ee=Ee.get(Ae),Ee)?Ee:-1}}function te(be){F||Q();let Ae=[],Ee=[],Pe=!1;function ve(ke){let Se=F.get(ke);Se&&(Pe=!0,ke|=Se),Ae.push(ke)}for(let ke of be)for(;;){if(ke<128)Ae.push(ke);else if(ae(ke)){let Se=ke-R,Be=Se/O|0,qe=Se%O/A|0,Ze=Se%A;ve(T+Be),ve(N+qe),Ze>0&&ve(S+Ze)}else{let Se=ee.get(ke);Se?Ee.push(...Se):ve(ke)}if(!Ee.length)break;ke=Ee.pop()}if(Pe&&Ae.length>1){let ke=j(Ae[0]);for(let Se=1;Se<Ae.length;Se++){let Be=j(Ae[Se]);if(Be==0||ke<=Be){ke=Be;continue}let qe=Se-1;for(;;){let Ze=Ae[qe+1];if(Ae[qe+1]=Ae[qe],Ae[qe]=Ze,!qe||(ke=j(Ae[--qe]),ke<=Be))break}ke=j(Ae[Se])}}return Ae}function re(be){let Ae=[],Ee=[],Pe=-1,ve=0;for(let ke of be){let Se=j(ke),Be=$(ke);if(Pe==-1)Se==0?Pe=Be:Ae.push(Be);else if(ve>0&&ve>=Se)Se==0?(Ae.push(Pe,...Ee),Ee.length=0,Pe=Be):Ee.push(Be),ve=Se;else{let qe=Z(Pe,Be);qe>=0?Pe=qe:ve==0&&Se==0?(Ae.push(Pe),Pe=Be):(Ee.push(Be),ve=Se)}}return Pe>=0&&Ae.push(Pe,...Ee),Ae}function K(be){return te(be).map($)}function W(be){return re(te(be))}const ne=45,se=46,U=".",J=65039,z=1,oe=be=>Array.from(be);function Y(be,Ae){return be.P.has(Ae)||be.Q.has(Ae)}class he extends Array{get is_emoji(){return!0}}let we,ye,ie,ce,me,fe,C,m,_,G,X,le;function ge(){if(we)return;let be=s(e);const Ae=()=>a(be),Ee=()=>new Set(Ae());we=new Map(d(be)),ye=Ee(),ie=Ae(),ce=new Set(Ae().map(Fe=>ie[Fe])),ie=new Set(ie),me=Ee(),fe=Ee();let Pe=f(be),ve=be();const ke=()=>new Set(Ae().flatMap(Fe=>Pe[Fe]).concat(Ae()));C=c(Fe=>{let Ve=c(be).map(Ge=>Ge+96);if(Ve.length){let Ge=Fe>=ve;Ve[0]-=32,Ve=p(Ve),Ge&&(Ve=`Restricted[${Ve}]`);let Je=ke(),at=ke(),it=!be();return{N:Ve,P:Je,Q:at,M:it,R:Ge}}}),m=Ee(),_=new Map;let Se=Ae().concat(oe(m)).sort((Fe,Ve)=>Fe-Ve);Se.forEach((Fe,Ve)=>{let Ge=be(),Je=Se[Ve]=Ge?Se[Ve-Ge]:{V:[],M:new Map};Je.V.push(Fe),m.has(Fe)||_.set(Fe,Je)});for(let{V:Fe,M:Ve}of new Set(_.values())){let Ge=[];for(let at of Fe){let it=C.filter(Ft=>Y(Ft,at)),ot=Ge.find(({G:Ft})=>it.some(wn=>Ft.has(wn)));ot||(ot={G:new Set,V:[]},Ge.push(ot)),ot.V.push(at),it.forEach(Ft=>ot.G.add(Ft))}let Je=Ge.flatMap(at=>oe(at.G));for(let{G:at,V:it}of Ge){let ot=new Set(Je.filter(Ft=>!at.has(Ft)));for(let Ft of it)Ve.set(Ft,ot)}}let Be=new Set,qe=new Set;const Ze=Fe=>Be.has(Fe)?qe.add(Fe):Be.add(Fe);for(let Fe of C){for(let Ve of Fe.P)Ze(Ve);for(let Ve of Fe.Q)Ze(Ve)}for(let Fe of Be)!_.has(Fe)&&!qe.has(Fe)&&_.set(Fe,z);G=new Set(oe(Be).concat(oe(K(Be)))),X=P(be).map(Fe=>he.from(Fe)).sort(B),le=new Map;for(let Fe of X){let Ve=[le];for(let Ge of Fe){let Je=Ve.map(at=>{let it=at.get(Ge);return it||(it=new Map,at.set(Ge,it)),it});Ge===J?Ve.push(...Je):Ve=Je}for(let Ge of Ve)Ge.V=Fe}}function Oe(be){return(_o(be)?"":`${Le(_r([be]))} `)+y(be)}function Le(be){return`"${be}"`}function Re(be){if(be.length>=4&&be[2]==ne&&be[3]==ne)throw new Error(`invalid label extension: "${p(be.slice(0,4))}"`)}function Ne(be){for(let Ee=be.lastIndexOf(95);Ee>0;)if(be[--Ee]!==95)throw new Error("underscore allowed only at start")}function $e(be){let Ae=be[0],Ee=t.get(Ae);if(Ee)throw jn(`leading ${Ee}`);let Pe=be.length,ve=-1;for(let ke=1;ke<Pe;ke++){Ae=be[ke];let Se=t.get(Ae);if(Se){if(ve==ke)throw jn(`${Ee} + ${Se}`);ve=ke+1,Ee=Se}}if(ve==Pe)throw jn(`trailing ${Ee}`)}function _r(be,Ae=y){let Ee=[];eu(be[0])&&Ee.push("◌");let Pe=0,ve=be.length;for(let ke=0;ke<ve;ke++){let Se=be[ke];_o(Se)&&(Ee.push(p(be.slice(Pe,ke))),Ee.push(Ae(Se)),Pe=ke+1)}return Ee.push(p(be.slice(Pe,ve))),Ee.join("")}function eu(be){return ge(),ie.has(be)}function _o(be){return ge(),me.has(be)}function Bp(){return ge(),X.map(be=>be.slice())}function Cp(be,Ae){ge();let Ee=Ae?K:W;return be.split(U).map(Pe=>p(iu(v(Pe),Ee,_s).flat())).join(U)}function Rp(be){return tu(ko(be,W,_s))}function Np(be){let Ae=ko(be,W,Ee=>Ee);for(let{type:Ee,output:Pe,error:ve}of Ae){if(ve)break;if(Ee!=="Greek"){let ke=0;for(;;){let Se=Pe.indexOf(958,ke);if(Se<0)break;Pe[Se]=926,ke=Se+1}}}return tu(Ae)}function Ip(be,Ae){return ko(be,W,Ae?Ee=>Ee.slice():_s)}function ko(be,Ae,Ee){if(!be)return[];ge();let Pe=0;return be.split(U).map(ve=>{let ke=v(ve),Se={input:ke,offset:Pe};Pe+=ke.length+1;try{let Be=Se.tokens=iu(ke,Ae,Ee),qe=Be.length,Ze;if(!qe)throw new Error("empty label");let Fe=Se.output=Be.flat();if(Ne(Fe),!(Se.emoji=qe>1||Be[0].is_emoji)&&Fe.every(Ge=>Ge<128))Re(Fe),Ze="ASCII";else{let Ge=Be.flatMap(Je=>Je.is_emoji?[]:Je);if(!Ge.length)Ze="Emoji";else{if(ie.has(Fe[0]))throw jn("leading combining mark");for(let it=1;it<qe;it++){let ot=Be[it];if(!ot.is_emoji&&ie.has(ot[0]))throw jn(`emoji + combining mark: "${p(Be[it-1])} + ${_r([ot[0]])}"`)}$e(Fe);let Je=oe(new Set(Ge)),[at]=Lp(Je);Up(at,Ge),Mp(at,Je),Ze=at.N}}Se.type=Ze}catch(Be){Se.error=Be}return Se})}function Mp(be,Ae){let Ee,Pe=[];for(let ve of Ae){let ke=_.get(ve);if(ke===z)return;if(ke){let Se=ke.M.get(ve);if(Ee=Ee?Ee.filter(Be=>Se.has(Be)):oe(Se),!Ee.length)return}else Pe.push(ve)}if(Ee){for(let ve of Ee)if(Pe.every(ke=>Y(ve,ke)))throw new Error(`whole-script confusable: ${be.N}/${ve.N}`)}}function Lp(be){let Ae=C;for(let Ee of be){let Pe=Ae.filter(ve=>Y(ve,Ee));if(!Pe.length)throw C.some(ve=>Y(ve,Ee))?nu(Ae[0],Ee):ru(Ee);if(Ae=Pe,Pe.length==1)break}return Ae}function tu(be){return be.map(({input:Ae,error:Ee,output:Pe})=>{if(Ee){let ve=Ee.message;throw new Error(be.length==1?ve:`Invalid label ${Le(_r(Ae))}: ${ve}`)}return p(Pe)}).join(U)}function ru(be){return new Error(`disallowed character: ${Oe(be)}`)}function nu(be,Ae){let Ee=Oe(Ae),Pe=C.find(ve=>ve.P.has(Ae));return Pe&&(Ee=`${Pe.N} ${Ee}`),new Error(`illegal mixture: ${be.N} + ${Ee}`)}function jn(be){return new Error(`illegal placement: ${be}`)}function Up(be,Ae){for(let Ee of Ae)if(!Y(be,Ee))throw nu(be,Ee);if(be.M){let Ee=K(Ae);for(let Pe=1,ve=Ee.length;Pe<ve;Pe++)if(ce.has(Ee[Pe])){let ke=Pe+1;for(let Se;ke<ve&&ce.has(Se=Ee[ke]);ke++)for(let Be=Pe;Be<ke;Be++)if(Ee[Be]==Se)throw new Error(`duplicate non-spacing marks: ${Oe(Se)}`);if(ke-Pe>r)throw new Error(`excessive non-spacing marks: ${Le(_r(Ee.slice(Pe-1,ke)))} (${ke-Pe}/${r})`);Pe=ke}}}function iu(be,Ae,Ee){let Pe=[],ve=[];for(be=be.slice().reverse();be.length;){let ke=su(be);if(ke)ve.length&&(Pe.push(Ae(ve)),ve=[]),Pe.push(Ee(ke));else{let Se=be.pop();if(G.has(Se))ve.push(Se);else{let Be=we.get(Se);if(Be)ve.push(...Be);else if(!ye.has(Se))throw ru(Se)}}}return ve.length&&Pe.push(Ae(ve)),Pe}function _s(be){return be.filter(Ae=>Ae!=J)}function su(be,Ae){let Ee=le,Pe,ve=be.length;for(;ve&&(Ee=Ee.get(be[--ve]),!!Ee);){let{V:ke}=Ee;ke&&(Pe=ke,Ae&&Ae.push(...be.slice(ve).reverse()),be.length=ve)}return Pe}const Dn="valid",ou="mapped",Po="ignored",Fp="disallowed",jp="emoji",Dp="nfc",Hp="stop";function au(be,{nf:Ae=!0}={}){ge();let Ee=v(be).reverse(),Pe=[],ve=[];for(;Ee.length;){let ke=su(Ee,Pe);if(ke)ve.push({type:jp,emoji:ke.slice(),input:Pe,cps:_s(ke)}),Pe=[];else{let Se=Ee.pop();if(Se==se)ve.push({type:Hp,cp:Se});else if(G.has(Se))ve.push({type:Dn,cps:[Se]});else if(ye.has(Se))ve.push({type:Po,cp:Se});else{let Be=we.get(Se);Be?ve.push({type:ou,cp:Se,cps:Be.slice()}):ve.push({type:Fp,cp:Se})}}}if(Ae)for(let ke=0,Se=-1;ke<ve.length;ke++){let Be=ve[ke];if(To(Be.type))if(cu(Be.cps)){let qe=ke+1;for(let Ge=qe;Ge<ve.length;Ge++){let{type:Je,cps:at}=ve[Ge];if(To(Je)){if(!cu(at))break;qe=Ge+1}else if(Je!==Po)break}Se<0&&(Se=ke);let Ze=ve.slice(Se,qe),Fe=Ze.flatMap(Ge=>To(Ge.type)?Ge.cps:[]),Ve=W(Fe);B(Ve,Fe)?(ve.splice(Se,qe-Se,{type:Dp,input:Fe,cps:Ve,tokens0:uu(Ze),tokens:au(p(Ve),{nf:!1})}),ke=Se):ke=qe-1,Se=-1}else Se=ke;else Be.type!==Po&&(Se=-1)}return uu(ve)}function To(be){return be==Dn||be==ou}function cu(be){return be.some(Ae=>fe.has(Ae))}function uu(be){for(let Ae=0;Ae<be.length;Ae++)if(be[Ae].type==Dn){let Ee=Ae+1;for(;Ee<be.length&&be[Ee].type==Dn;)Ee++;be.splice(Ae,Ee-Ae,{type:Dn,cps:be.slice(Ae,Ee).flatMap(Pe=>Pe.cps)})}return be}return Rt.ens_beautify=Np,Rt.ens_emoji=Bp,Rt.ens_normalize=Rp,Rt.ens_normalize_fragment=Cp,Rt.ens_split=Ip,Rt.ens_tokenize=au,Rt.is_combining_mark=eu,Rt.nfc=W,Rt.nfd=K,Rt.safe_str_from_cps=_r,Rt.should_escape=_o,Rt}var Ql;function gm(){if(Ql)return qt;Ql=1,Object.defineProperty(qt,"__esModule",{value:!0}),qt.dnsEncode=qt.namehash=qt.isValidName=qt.ensNormalize=void 0;const e=ht(),t=Ce(),r=bm(),n=new Uint8Array(32);n.fill(0);function i(f){return(0,t.assertArgument)(f.length!==0,"invalid ENS name; empty component","comp",f),f}function s(f){const d=(0,t.toUtf8Bytes)(o(f)),c=[];if(f.length===0)return c;let g=0;for(let h=0;h<d.length;h++)d[h]===46&&(c.push(i(d.slice(g,h))),g=h+1);return(0,t.assertArgument)(g<d.length,"invalid ENS name; empty component","name",f),c.push(i(d.slice(g))),c}function o(f){try{if(f.length===0)throw new Error("empty label");return(0,r.ens_normalize)(f)}catch(d){(0,t.assertArgument)(!1,`invalid ENS name (${d.message})`,"name",f)}}qt.ensNormalize=o;function u(f){try{return s(f).length!==0}catch{}return!1}qt.isValidName=u;function l(f){(0,t.assertArgument)(typeof f=="string","invalid ENS name; not a string","name",f),(0,t.assertArgument)(f.length,"invalid ENS name (empty label)","name",f);let d=n;const c=s(f);for(;c.length;)d=(0,e.keccak256)((0,t.concat)([d,(0,e.keccak256)(c.pop())]));return(0,t.hexlify)(d)}qt.namehash=l;function a(f){return(0,t.hexlify)((0,t.concat)(s(f).map(d=>{if(d.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const c=new Uint8Array(d.length+1);return c.set(d,1),c[0]=c.length-1,c})))+"00"}return qt.dnsEncode=a,qt}var Qr={},oa={},gi={},Yl;function sh(){if(Yl)return gi;Yl=1,Object.defineProperty(gi,"__esModule",{value:!0}),gi.accessListify=void 0;const e=ft(),t=Ce();function r(i,s){return{address:(0,e.getAddress)(i),storageKeys:s.map((o,u)=>((0,t.assertArgument)((0,t.isHexString)(o,32),"invalid slot",`storageKeys[${u}]`,o),o.toLowerCase()))}}function n(i){if(Array.isArray(i))return i.map((o,u)=>Array.isArray(o)?((0,t.assertArgument)(o.length===2,"invalid slot set",`value[${u}]`,o),r(o[0],o[1])):((0,t.assertArgument)(o!=null&&typeof o=="object","invalid address-slot set","value",i),r(o.address,o.storageKeys)));(0,t.assertArgument)(i!=null&&typeof i=="object","invalid access list","value",i);const s=Object.keys(i).map(o=>{const u=i[o].reduce((l,a)=>(l[a]=!0,l),{});return r(o,Object.keys(u).sort())});return s.sort((o,u)=>o.address.localeCompare(u.address)),s}return gi.accessListify=n,gi}var Yr={},Zl;function oh(){if(Zl)return Yr;Zl=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.recoverAddress=Yr.computeAddress=void 0;const e=ft(),t=ht();function r(i){let s;return typeof i=="string"?s=t.SigningKey.computePublicKey(i,!1):s=i.publicKey,(0,e.getAddress)((0,t.keccak256)("0x"+s.substring(4)).substring(26))}Yr.computeAddress=r;function n(i,s){return r(t.SigningKey.recoverPublicKey(i,s))}return Yr.recoverAddress=n,Yr}var mi={},Xl;function mm(){var N,S,E,x,A,O,I,L,H,V,D,j;if(Xl)return mi;Xl=1,Object.defineProperty(mi,"__esModule",{value:!0}),mi.Transaction=void 0;const e=ft(),t=ht(),r=Ce(),n=sh(),i=oh(),s=BigInt(0),o=BigInt(2),u=BigInt(27),l=BigInt(28),a=BigInt(35),f=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function d(F){return F==="0x"?null:(0,e.getAddress)(F)}function c(F,M){try{return(0,n.accessListify)(F)}catch(ee){(0,r.assertArgument)(!1,ee.message,M,F)}}function g(F,M){return F==="0x"?0:(0,r.getNumber)(F,M)}function h(F,M){if(F==="0x")return s;const ee=(0,r.getBigInt)(F,M);return(0,r.assertArgument)(ee<=f,"value exceeds uint size",M,ee),ee}function b(F,M){const ee=(0,r.getBigInt)(F,"value"),de=(0,r.toBeArray)(ee);return(0,r.assertArgument)(de.length<=32,"value too large",`tx.${M}`,ee),de}function P(F){return(0,n.accessListify)(F).map(M=>[M.address,M.storageKeys])}function w(F){const M=(0,r.decodeRlp)(F);(0,r.assertArgument)(Array.isArray(M)&&(M.length===9||M.length===6),"invalid field count for legacy transaction","data",F);const ee={type:0,nonce:g(M[0],"nonce"),gasPrice:h(M[1],"gasPrice"),gasLimit:h(M[2],"gasLimit"),to:d(M[3]),value:h(M[4],"value"),data:(0,r.hexlify)(M[5]),chainId:s};if(M.length===6)return ee;const de=h(M[6],"v"),Q=h(M[7],"r"),ae=h(M[8],"s");if(Q===s&&ae===s)ee.chainId=de;else{let Z=(de-a)/o;Z<s&&(Z=s),ee.chainId=Z,(0,r.assertArgument)(Z!==s||de===u||de===l,"non-canonical legacy v","v",M[6]),ee.signature=t.Signature.from({r:(0,r.zeroPadValue)(M[7],32),s:(0,r.zeroPadValue)(M[8],32),v:de}),ee.hash=(0,t.keccak256)(F)}return ee}function y(F,M){const ee=[b(F.nonce||0,"nonce"),b(F.gasPrice||0,"gasPrice"),b(F.gasLimit||0,"gasLimit"),F.to!=null?(0,e.getAddress)(F.to):"0x",b(F.value||0,"value"),F.data||"0x"];let de=s;if(F.chainId!=s)de=(0,r.getBigInt)(F.chainId,"tx.chainId"),(0,r.assertArgument)(!M||M.networkV==null||M.legacyChainId===de,"tx.chainId/sig.v mismatch","sig",M);else if(F.signature){const ae=F.signature.legacyChainId;ae!=null&&(de=ae)}if(!M)return de!==s&&(ee.push((0,r.toBeArray)(de)),ee.push("0x"),ee.push("0x")),(0,r.encodeRlp)(ee);let Q=BigInt(27+M.yParity);return de!==s?Q=t.Signature.getChainIdV(de,M.v):BigInt(M.v)!==Q&&(0,r.assertArgument)(!1,"tx.chainId/sig.v mismatch","sig",M),ee.push((0,r.toBeArray)(Q)),ee.push((0,r.toBeArray)(M.r)),ee.push((0,r.toBeArray)(M.s)),(0,r.encodeRlp)(ee)}function v(F,M){let ee;try{if(ee=g(M[0],"yParity"),ee!==0&&ee!==1)throw new Error("bad yParity")}catch{(0,r.assertArgument)(!1,"invalid yParity","yParity",M[0])}const de=(0,r.zeroPadValue)(M[1],32),Q=(0,r.zeroPadValue)(M[2],32),ae=t.Signature.from({r:de,s:Q,yParity:ee});F.signature=ae}function p(F){const M=(0,r.decodeRlp)((0,r.getBytes)(F).slice(1));(0,r.assertArgument)(Array.isArray(M)&&(M.length===9||M.length===12),"invalid field count for transaction type: 2","data",(0,r.hexlify)(F));const ee=h(M[2],"maxPriorityFeePerGas"),de=h(M[3],"maxFeePerGas"),Q={type:2,chainId:h(M[0],"chainId"),nonce:g(M[1],"nonce"),maxPriorityFeePerGas:ee,maxFeePerGas:de,gasPrice:null,gasLimit:h(M[4],"gasLimit"),to:d(M[5]),value:h(M[6],"value"),data:(0,r.hexlify)(M[7]),accessList:c(M[8],"accessList")};return M.length===9||(Q.hash=(0,t.keccak256)(F),v(Q,M.slice(9))),Q}function B(F,M){const ee=[b(F.chainId||0,"chainId"),b(F.nonce||0,"nonce"),b(F.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),b(F.maxFeePerGas||0,"maxFeePerGas"),b(F.gasLimit||0,"gasLimit"),F.to!=null?(0,e.getAddress)(F.to):"0x",b(F.value||0,"value"),F.data||"0x",P(F.accessList||[])];return M&&(ee.push(b(M.yParity,"yParity")),ee.push((0,r.toBeArray)(M.r)),ee.push((0,r.toBeArray)(M.s))),(0,r.concat)(["0x02",(0,r.encodeRlp)(ee)])}function k(F){const M=(0,r.decodeRlp)((0,r.getBytes)(F).slice(1));(0,r.assertArgument)(Array.isArray(M)&&(M.length===8||M.length===11),"invalid field count for transaction type: 1","data",(0,r.hexlify)(F));const ee={type:1,chainId:h(M[0],"chainId"),nonce:g(M[1],"nonce"),gasPrice:h(M[2],"gasPrice"),gasLimit:h(M[3],"gasLimit"),to:d(M[4]),value:h(M[5],"value"),data:(0,r.hexlify)(M[6]),accessList:c(M[7],"accessList")};return M.length===8||(ee.hash=(0,t.keccak256)(F),v(ee,M.slice(8))),ee}function R(F,M){const ee=[b(F.chainId||0,"chainId"),b(F.nonce||0,"nonce"),b(F.gasPrice||0,"gasPrice"),b(F.gasLimit||0,"gasLimit"),F.to!=null?(0,e.getAddress)(F.to):"0x",b(F.value||0,"value"),F.data||"0x",P(F.accessList||[])];return M&&(ee.push(b(M.yParity,"recoveryParam")),ee.push((0,r.toBeArray)(M.r)),ee.push((0,r.toBeArray)(M.s))),(0,r.concat)(["0x01",(0,r.encodeRlp)(ee)])}const $=class ${constructor(){xe(this,N);xe(this,S);xe(this,E);xe(this,x);xe(this,A);xe(this,O);xe(this,I);xe(this,L);xe(this,H);xe(this,V);xe(this,D);xe(this,j);ue(this,N,null),ue(this,S,null),ue(this,x,0),ue(this,A,BigInt(0)),ue(this,O,null),ue(this,I,null),ue(this,L,null),ue(this,E,"0x"),ue(this,H,BigInt(0)),ue(this,V,BigInt(0)),ue(this,D,null),ue(this,j,null)}get type(){return q(this,N)}set type(M){switch(M){case null:ue(this,N,null);break;case 0:case"legacy":ue(this,N,0);break;case 1:case"berlin":case"eip-2930":ue(this,N,1);break;case 2:case"london":case"eip-1559":ue(this,N,2);break;default:(0,r.assertArgument)(!1,"unsupported transaction type","type",M)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559"}return null}get to(){return q(this,S)}set to(M){ue(this,S,M==null?null:(0,e.getAddress)(M))}get nonce(){return q(this,x)}set nonce(M){ue(this,x,(0,r.getNumber)(M,"value"))}get gasLimit(){return q(this,A)}set gasLimit(M){ue(this,A,(0,r.getBigInt)(M))}get gasPrice(){const M=q(this,O);return M==null&&(this.type===0||this.type===1)?s:M}set gasPrice(M){ue(this,O,M==null?null:(0,r.getBigInt)(M,"gasPrice"))}get maxPriorityFeePerGas(){const M=q(this,I);return M??(this.type===2?s:null)}set maxPriorityFeePerGas(M){ue(this,I,M==null?null:(0,r.getBigInt)(M,"maxPriorityFeePerGas"))}get maxFeePerGas(){const M=q(this,L);return M??(this.type===2?s:null)}set maxFeePerGas(M){ue(this,L,M==null?null:(0,r.getBigInt)(M,"maxFeePerGas"))}get data(){return q(this,E)}set data(M){ue(this,E,(0,r.hexlify)(M))}get value(){return q(this,H)}set value(M){ue(this,H,(0,r.getBigInt)(M,"value"))}get chainId(){return q(this,V)}set chainId(M){ue(this,V,(0,r.getBigInt)(M))}get signature(){return q(this,D)||null}set signature(M){ue(this,D,M==null?null:t.Signature.from(M))}get accessList(){const M=q(this,j)||null;return M??(this.type===1||this.type===2?[]:null)}set accessList(M){ue(this,j,M==null?null:(0,n.accessListify)(M))}get hash(){return this.signature==null?null:(0,t.keccak256)(this.serialized)}get unsignedHash(){return(0,t.keccak256)(this.unsignedSerialized)}get from(){return this.signature==null?null:(0,i.recoverAddress)(this.unsignedHash,this.signature)}get fromPublicKey(){return this.signature==null?null:t.SigningKey.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}get serialized(){switch((0,r.assert)(this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"}),this.inferType()){case 0:return y(this,this.signature);case 1:return R(this,this.signature);case 2:return B(this,this.signature)}(0,r.assert)(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})}get unsignedSerialized(){switch(this.inferType()){case 0:return y(this);case 1:return R(this);case 2:return B(this)}(0,r.assert)(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".unsignedSerialized"})}inferType(){return this.inferTypes().pop()}inferTypes(){const M=this.gasPrice!=null,ee=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,de=this.accessList!=null;this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&(0,r.assert)(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),(0,r.assert)(!ee||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),(0,r.assert)(this.type!==0||!de,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const Q=[];return this.type!=null?Q.push(this.type):ee?Q.push(2):M?(Q.push(1),de||Q.push(0)):de?(Q.push(1),Q.push(2)):(Q.push(0),Q.push(1),Q.push(2)),Q.sort(),Q}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}clone(){return $.from(this)}toJSON(){const M=ee=>ee==null?null:ee.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:M(this.gasLimit),gasPrice:M(this.gasPrice),maxPriorityFeePerGas:M(this.maxPriorityFeePerGas),maxFeePerGas:M(this.maxFeePerGas),value:M(this.value),chainId:M(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(M){if(M==null)return new $;if(typeof M=="string"){const de=(0,r.getBytes)(M);if(de[0]>=127)return $.from(w(de));switch(de[0]){case 1:return $.from(k(de));case 2:return $.from(p(de))}(0,r.assert)(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const ee=new $;return M.type!=null&&(ee.type=M.type),M.to!=null&&(ee.to=M.to),M.nonce!=null&&(ee.nonce=M.nonce),M.gasLimit!=null&&(ee.gasLimit=M.gasLimit),M.gasPrice!=null&&(ee.gasPrice=M.gasPrice),M.maxPriorityFeePerGas!=null&&(ee.maxPriorityFeePerGas=M.maxPriorityFeePerGas),M.maxFeePerGas!=null&&(ee.maxFeePerGas=M.maxFeePerGas),M.data!=null&&(ee.data=M.data),M.value!=null&&(ee.value=M.value),M.chainId!=null&&(ee.chainId=M.chainId),M.signature!=null&&(ee.signature=t.Signature.from(M.signature)),M.accessList!=null&&(ee.accessList=M.accessList),M.hash!=null&&((0,r.assertArgument)(ee.isSigned(),"unsigned transaction cannot define hash","tx",M),(0,r.assertArgument)(ee.hash===M.hash,"hash mismatch","tx",M)),M.from!=null&&((0,r.assertArgument)(ee.isSigned(),"unsigned transaction cannot define from","tx",M),(0,r.assertArgument)(ee.from.toLowerCase()===(M.from||"").toLowerCase(),"from mismatch","tx",M)),ee}};N=new WeakMap,S=new WeakMap,E=new WeakMap,x=new WeakMap,A=new WeakMap,O=new WeakMap,I=new WeakMap,L=new WeakMap,H=new WeakMap,V=new WeakMap,D=new WeakMap,j=new WeakMap;let T=$;return mi.Transaction=T,mi}var ef;function Ut(){return ef||(ef=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Transaction=e.recoverAddress=e.computeAddress=e.accessListify=void 0;var t=sh();Object.defineProperty(e,"accessListify",{enumerable:!0,get:function(){return t.accessListify}});var r=oh();Object.defineProperty(e,"computeAddress",{enumerable:!0,get:function(){return r.computeAddress}}),Object.defineProperty(e,"recoverAddress",{enumerable:!0,get:function(){return r.recoverAddress}});var n=mm();Object.defineProperty(e,"Transaction",{enumerable:!0,get:function(){return n.Transaction}})}(oa)),oa}var tf;function ym(){if(tf)return Qr;tf=1,Object.defineProperty(Qr,"__esModule",{value:!0}),Qr.verifyMessage=Qr.hashMessage=void 0;const e=ht(),t=ps(),r=Ut(),n=Ce();function i(o){return typeof o=="string"&&(o=(0,n.toUtf8Bytes)(o)),(0,e.keccak256)((0,n.concat)([(0,n.toUtf8Bytes)(t.MessagePrefix),(0,n.toUtf8Bytes)(String(o.length)),o]))}Qr.hashMessage=i;function s(o,u){const l=i(o);return(0,r.recoverAddress)(l,u)}return Qr.verifyMessage=s,Qr}var fr={},rf;function xm(){if(rf)return fr;rf=1,Object.defineProperty(fr,"__esModule",{value:!0}),fr.solidityPackedSha256=fr.solidityPackedKeccak256=fr.solidityPacked=void 0;const e=ft(),t=ht(),r=Ce(),n=new RegExp("^bytes([0-9]+)$"),i=new RegExp("^(u?int)([0-9]*)$"),s=new RegExp("^(.*)\\[([0-9]*)\\]$");function o(f,d,c){switch(f){case"address":return c?(0,r.getBytes)((0,r.zeroPadValue)(d,32)):(0,r.getBytes)((0,e.getAddress)(d));case"string":return(0,r.toUtf8Bytes)(d);case"bytes":return(0,r.getBytes)(d);case"bool":return d=d?"0x01":"0x00",c?(0,r.getBytes)((0,r.zeroPadValue)(d,32)):(0,r.getBytes)(d)}let g=f.match(i);if(g){let h=g[1]==="int",b=parseInt(g[2]||"256");return(0,r.assertArgument)((!g[2]||g[2]===String(b))&&b%8===0&&b!==0&&b<=256,"invalid number type","type",f),c&&(b=256),h&&(d=(0,r.toTwos)(d,b)),(0,r.getBytes)((0,r.zeroPadValue)((0,r.toBeArray)(d),b/8))}if(g=f.match(n),g){const h=parseInt(g[1]);return(0,r.assertArgument)(String(h)===g[1]&&h!==0&&h<=32,"invalid bytes type","type",f),(0,r.assertArgument)((0,r.dataLength)(d)===h,`invalid value for ${f}`,"value",d),c?(0,r.getBytes)((0,r.zeroPadBytes)(d,32)):d}if(g=f.match(s),g&&Array.isArray(d)){const h=g[1],b=parseInt(g[2]||String(d.length));(0,r.assertArgument)(b===d.length,`invalid array length for ${f}`,"value",d);const P=[];return d.forEach(function(w){P.push(o(h,w,!0))}),(0,r.getBytes)((0,r.concat)(P))}(0,r.assertArgument)(!1,"invalid type","type",f)}function u(f,d){(0,r.assertArgument)(f.length===d.length,"wrong number of values; expected ${ types.length }","values",d);const c=[];return f.forEach(function(g,h){c.push(o(g,d[h]))}),(0,r.hexlify)((0,r.concat)(c))}fr.solidityPacked=u;function l(f,d){return(0,t.keccak256)(u(f,d))}fr.solidityPackedKeccak256=l;function a(f,d){return(0,t.sha256)(u(f,d))}return fr.solidityPackedSha256=a,fr}var Zr={},nf;function wm(){var B,k,R,T,ah;if(nf)return Zr;nf=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.verifyTypedData=Zr.TypedDataEncoder=void 0;const e=ft(),t=ht(),r=Ut(),n=Ce(),i=ih(),s=new Uint8Array(32);s.fill(0);const o=BigInt(-1),u=BigInt(0),l=BigInt(1),a=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function f(E){const x=(0,n.getBytes)(E),A=x.length%32;return A?(0,n.concat)([x,s.slice(A)]):(0,n.hexlify)(x)}const d=(0,n.toBeHex)(l,32),c=(0,n.toBeHex)(u,32),g={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},h=["name","version","chainId","verifyingContract","salt"];function b(E){return function(x){return(0,n.assertArgument)(typeof x=="string",`invalid domain value for ${JSON.stringify(E)}`,`domain.${E}`,x),x}}const P={name:b("name"),version:b("version"),chainId:function(E){const x=(0,n.getBigInt)(E,"domain.chainId");return(0,n.assertArgument)(x>=0,"invalid chain ID","domain.chainId",E),Number.isSafeInteger(x)?Number(x):(0,n.toQuantity)(x)},verifyingContract:function(E){try{return(0,e.getAddress)(E).toLowerCase()}catch{}(0,n.assertArgument)(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",E)},salt:function(E){const x=(0,n.getBytes)(E,"domain.salt");return(0,n.assertArgument)(x.length===32,'invalid domain value "salt"',"domain.salt",E),(0,n.hexlify)(x)}};function w(E){{const x=E.match(/^(u?)int(\d*)$/);if(x){const A=x[1]==="",O=parseInt(x[2]||"256");(0,n.assertArgument)(O%8===0&&O!==0&&O<=256&&(x[2]==null||x[2]===String(O)),"invalid numeric width","type",E);const I=(0,n.mask)(a,A?O-1:O),L=A?(I+l)*o:u;return function(H){const V=(0,n.getBigInt)(H,"value");return(0,n.assertArgument)(V>=L&&V<=I,`value out-of-bounds for ${E}`,"value",V),(0,n.toBeHex)(A?(0,n.toTwos)(V,256):V,32)}}}{const x=E.match(/^bytes(\d+)$/);if(x){const A=parseInt(x[1]);return(0,n.assertArgument)(A!==0&&A<=32&&x[1]===String(A),"invalid bytes width","type",E),function(O){const I=(0,n.getBytes)(O);return(0,n.assertArgument)(I.length===A,`invalid length for ${E}`,"value",O),f(O)}}}switch(E){case"address":return function(x){return(0,n.zeroPadValue)((0,e.getAddress)(x),32)};case"bool":return function(x){return x?d:c};case"bytes":return function(x){return(0,t.keccak256)(x)};case"string":return function(x){return(0,i.id)(x)}}return null}function y(E,x){return`${E}(${x.map(({name:A,type:O})=>O+" "+A).join(",")})`}const S=class S{constructor(x){xe(this,T);pe(this,"primaryType");xe(this,B);xe(this,k);xe(this,R);ue(this,B,JSON.stringify(x)),ue(this,k,new Map),ue(this,R,new Map);const A=new Map,O=new Map,I=new Map;Object.keys(x).forEach(V=>{A.set(V,new Set),O.set(V,[]),I.set(V,new Set)});for(const V in x){const D=new Set;for(const j of x[V]){(0,n.assertArgument)(!D.has(j.name),`duplicate variable name ${JSON.stringify(j.name)} in ${JSON.stringify(V)}`,"types",x),D.add(j.name);const $=j.type.match(/^([^\x5b]*)(\x5b|$)/)[1]||null;(0,n.assertArgument)($!==V,`circular type reference to ${JSON.stringify($)}`,"types",x),!w($)&&((0,n.assertArgument)(O.has($),`unknown type ${JSON.stringify($)}`,"types",x),O.get($).push(V),A.get(V).add($))}}const L=Array.from(O.keys()).filter(V=>O.get(V).length===0);(0,n.assertArgument)(L.length!==0,"missing primary type","types",x),(0,n.assertArgument)(L.length===1,`ambiguous primary types or unused types: ${L.map(V=>JSON.stringify(V)).join(", ")}`,"types",x),(0,n.defineProperties)(this,{primaryType:L[0]});function H(V,D){(0,n.assertArgument)(!D.has(V),`circular type reference to ${JSON.stringify(V)}`,"types",x),D.add(V);for(const j of A.get(V))if(O.has(j)){H(j,D);for(const $ of D)I.get($).add(j)}D.delete(V)}H(this.primaryType,new Set);for(const[V,D]of I){const j=Array.from(D);j.sort(),q(this,k).set(V,y(V,x[V])+j.map($=>y($,x[$])).join(""))}}get types(){return JSON.parse(q(this,B))}getEncoder(x){let A=q(this,R).get(x);return A||(A=_e(this,T,ah).call(this,x),q(this,R).set(x,A)),A}encodeType(x){const A=q(this,k).get(x);return(0,n.assertArgument)(A,`unknown type: ${JSON.stringify(x)}`,"name",x),A}encodeData(x,A){return this.getEncoder(x)(A)}hashStruct(x,A){return(0,t.keccak256)(this.encodeData(x,A))}encode(x){return this.encodeData(this.primaryType,x)}hash(x){return this.hashStruct(this.primaryType,x)}_visit(x,A,O){if(w(x))return O(x,A);const I=x.match(/^(.*)(\x5b(\d*)\x5d)$/);if(I)return(0,n.assertArgument)(!I[3]||parseInt(I[3])===A.length,`array length mismatch; expected length ${parseInt(I[3])}`,"value",A),A.map(H=>this._visit(I[1],H,O));const L=this.types[x];if(L)return L.reduce((H,{name:V,type:D})=>(H[V]=this._visit(D,A[V],O),H),{});(0,n.assertArgument)(!1,`unknown type: ${x}`,"type",x)}visit(x,A){return this._visit(this.primaryType,x,A)}static from(x){return new S(x)}static getPrimaryType(x){return S.from(x).primaryType}static hashStruct(x,A,O){return S.from(A).hashStruct(x,O)}static hashDomain(x){const A=[];for(const O in x){if(x[O]==null)continue;const I=g[O];(0,n.assertArgument)(I,`invalid typed-data domain key: ${JSON.stringify(O)}`,"domain",x),A.push({name:O,type:I})}return A.sort((O,I)=>h.indexOf(O.name)-h.indexOf(I.name)),S.hashStruct("EIP712Domain",{EIP712Domain:A},x)}static encode(x,A,O){return(0,n.concat)(["0x1901",S.hashDomain(x),S.from(A).hash(O)])}static hash(x,A,O){return(0,t.keccak256)(S.encode(x,A,O))}static async resolveNames(x,A,O,I){x=Object.assign({},x);for(const V in x)x[V]==null&&delete x[V];const L={};x.verifyingContract&&!(0,n.isHexString)(x.verifyingContract,20)&&(L[x.verifyingContract]="0x");const H=S.from(A);H.visit(O,(V,D)=>(V==="address"&&!(0,n.isHexString)(D,20)&&(L[D]="0x"),D));for(const V in L)L[V]=await I(V);return x.verifyingContract&&L[x.verifyingContract]&&(x.verifyingContract=L[x.verifyingContract]),O=H.visit(O,(V,D)=>V==="address"&&L[D]?L[D]:D),{domain:x,value:O}}static getPayload(x,A,O){S.hashDomain(x);const I={},L=[];h.forEach(D=>{const j=x[D];j!=null&&(I[D]=P[D](j),L.push({name:D,type:g[D]}))});const H=S.from(A),V=Object.assign({},A);return(0,n.assertArgument)(V.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",A),V.EIP712Domain=L,H.encode(O),{types:V,domain:I,primaryType:H.primaryType,message:H.visit(O,(D,j)=>{if(D.match(/^bytes(\d*)/))return(0,n.hexlify)((0,n.getBytes)(j));if(D.match(/^u?int/))return(0,n.getBigInt)(j).toString();switch(D){case"address":return j.toLowerCase();case"bool":return!!j;case"string":return(0,n.assertArgument)(typeof j=="string","invalid string","value",j),j}(0,n.assertArgument)(!1,"unsupported type","type",D)})}}};B=new WeakMap,k=new WeakMap,R=new WeakMap,T=new WeakSet,ah=function(x){{const I=w(x);if(I)return I}const A=x.match(/^(.*)(\x5b(\d*)\x5d)$/);if(A){const I=A[1],L=this.getEncoder(I);return H=>{(0,n.assertArgument)(!A[3]||parseInt(A[3])===H.length,`array length mismatch; expected length ${parseInt(A[3])}`,"value",H);let V=H.map(L);return q(this,k).has(I)&&(V=V.map(t.keccak256)),(0,t.keccak256)((0,n.concat)(V))}}const O=this.types[x];if(O){const I=(0,i.id)(q(this,k).get(x));return L=>{const H=O.map(({name:V,type:D})=>{const j=this.getEncoder(D)(L[V]);return q(this,k).has(D)?(0,t.keccak256)(j):j});return H.unshift(I),(0,n.concat)(H)}}(0,n.assertArgument)(!1,`unknown type: ${x}`,"type",x)};let v=S;Zr.TypedDataEncoder=v;function p(E,x,A,O){return(0,r.recoverAddress)(v.hash(E,x,A),O)}return Zr.verifyTypedData=p,Zr}var sf;function vr(){return sf||(sf=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.verifyTypedData=e.TypedDataEncoder=e.solidityPackedSha256=e.solidityPackedKeccak256=e.solidityPacked=e.verifyMessage=e.hashMessage=e.dnsEncode=e.namehash=e.isValidName=e.ensNormalize=e.id=void 0;var t=ih();Object.defineProperty(e,"id",{enumerable:!0,get:function(){return t.id}});var r=gm();Object.defineProperty(e,"ensNormalize",{enumerable:!0,get:function(){return r.ensNormalize}}),Object.defineProperty(e,"isValidName",{enumerable:!0,get:function(){return r.isValidName}}),Object.defineProperty(e,"namehash",{enumerable:!0,get:function(){return r.namehash}}),Object.defineProperty(e,"dnsEncode",{enumerable:!0,get:function(){return r.dnsEncode}});var n=ym();Object.defineProperty(e,"hashMessage",{enumerable:!0,get:function(){return n.hashMessage}}),Object.defineProperty(e,"verifyMessage",{enumerable:!0,get:function(){return n.verifyMessage}});var i=xm();Object.defineProperty(e,"solidityPacked",{enumerable:!0,get:function(){return i.solidityPacked}}),Object.defineProperty(e,"solidityPackedKeccak256",{enumerable:!0,get:function(){return i.solidityPackedKeccak256}}),Object.defineProperty(e,"solidityPackedSha256",{enumerable:!0,get:function(){return i.solidityPackedSha256}});var s=wm();Object.defineProperty(e,"TypedDataEncoder",{enumerable:!0,get:function(){return s.TypedDataEncoder}}),Object.defineProperty(e,"verifyTypedData",{enumerable:!0,get:function(){return s.verifyTypedData}})}(sa)),sa}var of;function Lc(){var se,U,J,Ka,Y,Ns;if(of)return st;of=1,Object.defineProperty(st,"__esModule",{value:!0}),st.StructFragment=st.FunctionFragment=st.FallbackFragment=st.ConstructorFragment=st.EventFragment=st.ErrorFragment=st.NamedFragment=st.Fragment=st.ParamType=void 0;const e=Ce(),t=vr();function r(ye){const ie=new Set;return ye.forEach(ce=>ie.add(ce)),Object.freeze(ie)}const i=r("external public payable".split(" ")),s="constant external internal payable private public pure view",o=r(s.split(" ")),u="constructor error event fallback function receive struct",l=r(u.split(" ")),a="calldata memory storage payable indexed",f=r(a.split(" ")),c=[u,a,"tuple returns",s].join(" "),g=r(c.split(" ")),h={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},b=new RegExp("^(\\s*)"),P=new RegExp("^([0-9]+)"),w=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),y=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),v=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"),oe=class oe{constructor(ie){xe(this,J);xe(this,se);xe(this,U);ue(this,se,0),ue(this,U,ie.slice())}get offset(){return q(this,se)}get length(){return q(this,U).length-q(this,se)}clone(){return new oe(q(this,U))}reset(){ue(this,se,0)}popKeyword(ie){const ce=this.peek();if(ce.type!=="KEYWORD"||!ie.has(ce.text))throw new Error(`expected keyword ${ce.text}`);return this.pop().text}popType(ie){if(this.peek().type!==ie)throw new Error(`expected ${ie}; got ${JSON.stringify(this.peek())}`);return this.pop().text}popParen(){const ie=this.peek();if(ie.type!=="OPEN_PAREN")throw new Error("bad start");const ce=_e(this,J,Ka).call(this,q(this,se)+1,ie.match+1);return ue(this,se,ie.match+1),ce}popParams(){const ie=this.peek();if(ie.type!=="OPEN_PAREN")throw new Error("bad start");const ce=[];for(;q(this,se)<ie.match-1;){const me=this.peek().linkNext;ce.push(_e(this,J,Ka).call(this,q(this,se)+1,me)),ue(this,se,me)}return ue(this,se,ie.match+1),ce}peek(){if(q(this,se)>=q(this,U).length)throw new Error("out-of-bounds");return q(this,U)[q(this,se)]}peekKeyword(ie){const ce=this.peekType("KEYWORD");return ce!=null&&ie.has(ce)?ce:null}peekType(ie){if(this.length===0)return null;const ce=this.peek();return ce.type===ie?ce.text:null}pop(){const ie=this.peek();return An(this,se)._++,ie}toString(){const ie=[];for(let ce=q(this,se);ce<q(this,U).length;ce++){const me=q(this,U)[ce];ie.push(`${me.type}:${me.text}`)}return`<TokenString ${ie.join(" ")}>`}};se=new WeakMap,U=new WeakMap,J=new WeakSet,Ka=function(ie=0,ce=0){return new oe(q(this,U).slice(ie,ce).map(me=>Object.freeze(Object.assign({},me,{match:me.match-ie,linkBack:me.linkBack-ie,linkNext:me.linkNext-ie}))))};let p=oe;function B(ye){const ie=[],ce=m=>{const _=C<ye.length?JSON.stringify(ye[C]):"$EOI";throw new Error(`invalid token ${_} at ${C}: ${m}`)};let me=[],fe=[],C=0;for(;C<ye.length;){let m=ye.substring(C),_=m.match(b);_&&(C+=_[1].length,m=ye.substring(C));const G={depth:me.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:C,value:-1};ie.push(G);let X=h[m[0]]||"";if(X){if(G.type=X,G.text=m[0],C++,X==="OPEN_PAREN")me.push(ie.length-1),fe.push(ie.length-1);else if(X=="CLOSE_PAREN")me.length===0&&ce("no matching open bracket"),G.match=me.pop(),ie[G.match].match=ie.length-1,G.depth--,G.linkBack=fe.pop(),ie[G.linkBack].linkNext=ie.length-1;else if(X==="COMMA")G.linkBack=fe.pop(),ie[G.linkBack].linkNext=ie.length-1,fe.push(ie.length-1);else if(X==="OPEN_BRACKET")G.type="BRACKET";else if(X==="CLOSE_BRACKET"){let le=ie.pop().text;if(ie.length>0&&ie[ie.length-1].type==="NUMBER"){const ge=ie.pop().text;le=ge+le,ie[ie.length-1].value=(0,e.getNumber)(ge)}if(ie.length===0||ie[ie.length-1].type!=="BRACKET")throw new Error("missing opening bracket");ie[ie.length-1].text+=le}continue}if(_=m.match(w),_){if(G.text=_[1],C+=G.text.length,g.has(G.text)){G.type="KEYWORD";continue}if(G.text.match(v)){G.type="TYPE";continue}G.type="ID";continue}if(_=m.match(P),_){G.text=_[1],G.type="NUMBER",C+=G.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(m[0])} at position ${C}`)}return new p(ie.map(m=>Object.freeze(m)))}function k(ye,ie){let ce=[];for(const me in ie.keys())ye.has(me)&&ce.push(me);if(ce.length>1)throw new Error(`conflicting types: ${ce.join(", ")}`)}function R(ye,ie){if(ie.peekKeyword(l)){const ce=ie.pop().text;if(ce!==ye)throw new Error(`expected ${ye}, got ${ce}`)}return ie.popType("ID")}function T(ye,ie){const ce=new Set;for(;;){const me=ye.peekType("KEYWORD");if(me==null||ie&&!ie.has(me))break;if(ye.pop(),ce.has(me))throw new Error(`duplicate keywords: ${JSON.stringify(me)}`);ce.add(me)}return Object.freeze(ce)}function N(ye){let ie=T(ye,o);return k(ie,r("constant payable nonpayable".split(" "))),k(ie,r("pure view payable nonpayable".split(" "))),ie.has("view")?"view":ie.has("pure")?"pure":ie.has("payable")?"payable":ie.has("nonpayable")?"nonpayable":ie.has("constant")?"view":"nonpayable"}function S(ye,ie){return ye.popParams().map(ce=>ee.from(ce,ie))}function E(ye){if(ye.peekType("AT")){if(ye.pop(),ye.peekType("NUMBER"))return(0,e.getBigInt)(ye.pop().text);throw new Error("invalid gas")}return null}function x(ye){if(ye.length)throw new Error(`unexpected tokens: ${ye.toString()}`)}const A=new RegExp(/^(.*)\[([0-9]*)\]$/);function O(ye){const ie=ye.match(v);if((0,e.assertArgument)(ie,"invalid type","type",ye),ye==="uint")return"uint256";if(ye==="int")return"int256";if(ie[2]){const ce=parseInt(ie[2]);(0,e.assertArgument)(ce!==0&&ce<=32,"invalid bytes length","type",ye)}else if(ie[3]){const ce=parseInt(ie[3]);(0,e.assertArgument)(ce!==0&&ce<=256&&ce%8===0,"invalid numeric width","type",ye)}return ye}const I={},L=Symbol.for("_ethers_internal"),H="_ParamTypeInternal",V="_ErrorInternal",D="_EventInternal",j="_ConstructorInternal",$="_FallbackInternal",F="_FunctionInternal",M="_StructInternal",we=class we{constructor(ie,ce,me,fe,C,m,_,G){xe(this,Y);pe(this,"name");pe(this,"type");pe(this,"baseType");pe(this,"indexed");pe(this,"components");pe(this,"arrayLength");pe(this,"arrayChildren");if((0,e.assertPrivate)(ie,I,"ParamType"),Object.defineProperty(this,L,{value:H}),m&&(m=Object.freeze(m.slice())),fe==="array"){if(_==null||G==null)throw new Error("")}else if(_!=null||G!=null)throw new Error("");if(fe==="tuple"){if(m==null)throw new Error("")}else if(m!=null)throw new Error("");(0,e.defineProperties)(this,{name:ce,type:me,baseType:fe,indexed:C,components:m,arrayLength:_,arrayChildren:G})}format(ie){if(ie==null&&(ie="sighash"),ie==="json"){const me=this.name||"";if(this.isArray()){const C=JSON.parse(this.arrayChildren.format("json"));return C.name=me,C.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(C)}const fe={type:this.baseType==="tuple"?"tuple":this.type,name:me};return typeof this.indexed=="boolean"&&(fe.indexed=this.indexed),this.isTuple()&&(fe.components=this.components.map(C=>JSON.parse(C.format(ie)))),JSON.stringify(fe)}let ce="";return this.isArray()?(ce+=this.arrayChildren.format(ie),ce+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?(ie!=="sighash"&&(ce+=this.type),ce+="("+this.components.map(me=>me.format(ie)).join(ie==="full"?", ":",")+")"):ce+=this.type,ie!=="sighash"&&(this.indexed===!0&&(ce+=" indexed"),ie==="full"&&this.name&&(ce+=" "+this.name)),ce}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(ie,ce){if(this.isArray()){if(!Array.isArray(ie))throw new Error("invalid array value");if(this.arrayLength!==-1&&ie.length!==this.arrayLength)throw new Error("array is wrong length");const me=this;return ie.map(fe=>me.arrayChildren.walk(fe,ce))}if(this.isTuple()){if(!Array.isArray(ie))throw new Error("invalid tuple value");if(ie.length!==this.components.length)throw new Error("array is wrong length");const me=this;return ie.map((fe,C)=>me.components[C].walk(fe,ce))}return ce(this.type,ie)}async walkAsync(ie,ce){const me=[],fe=[ie];return _e(this,Y,Ns).call(this,me,ie,ce,C=>{fe[0]=C}),me.length&&await Promise.all(me),fe[0]}static from(ie,ce){if(we.isParamType(ie))return ie;if(typeof ie=="string")try{return we.from(B(ie),ce)}catch{(0,e.assertArgument)(!1,"invalid param type","obj",ie)}else if(ie instanceof p){let _="",G="",X=null;T(ie,r(["tuple"])).has("tuple")||ie.peekType("OPEN_PAREN")?(G="tuple",X=ie.popParams().map(Ne=>we.from(Ne)),_=`tuple(${X.map(Ne=>Ne.format()).join(",")})`):(_=O(ie.popType("TYPE")),G=_);let le=null,ge=null;for(;ie.length&&ie.peekType("BRACKET");){const Ne=ie.pop();le=new we(I,"",_,G,null,X,ge,le),ge=Ne.value,_+=Ne.text,G="array",X=null}let Oe=null;if(T(ie,f).has("indexed")){if(!ce)throw new Error("");Oe=!0}const Re=ie.peekType("ID")?ie.pop().text:"";if(ie.length)throw new Error("leftover tokens");return new we(I,Re,_,G,Oe,X,ge,le)}const me=ie.name;(0,e.assertArgument)(!me||typeof me=="string"&&me.match(y),"invalid name","obj.name",me);let fe=ie.indexed;fe!=null&&((0,e.assertArgument)(ce,"parameter cannot be indexed","obj.indexed",ie.indexed),fe=!!fe);let C=ie.type,m=C.match(A);if(m){const _=parseInt(m[2]||"-1"),G=we.from({type:m[1],components:ie.components});return new we(I,me||"",C,"array",fe,null,_,G)}if(C==="tuple"||C.startsWith("tuple(")||C.startsWith("(")){const _=ie.components!=null?ie.components.map(X=>we.from(X)):null;return new we(I,me||"",C,"tuple",fe,_,null,null)}return C=O(ie.type),new we(I,me||"",C,C,fe,null,null,null)}static isParamType(ie){return ie&&ie[L]===H}};Y=new WeakSet,Ns=function(ie,ce,me,fe){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 m=this.arrayChildren,_=ce.slice();_.forEach((G,X)=>{var le;_e(le=m,Y,Ns).call(le,ie,G,me,ge=>{_[X]=ge})}),fe(_);return}if(this.isTuple()){const m=this.components;let _;if(Array.isArray(ce))_=ce.slice();else{if(ce==null||typeof ce!="object")throw new Error("invalid tuple value");_=m.map(G=>{if(!G.name)throw new Error("cannot use object value with unnamed components");if(!(G.name in ce))throw new Error(`missing value for component ${G.name}`);return ce[G.name]})}if(_.length!==this.components.length)throw new Error("array is wrong length");_.forEach((G,X)=>{var le;_e(le=m[X],Y,Ns).call(le,ie,G,me,ge=>{_[X]=ge})}),fe(_);return}const C=me(this.type,ce);C.then?ie.push(async function(){fe(await C)}()):fe(C)};let ee=we;st.ParamType=ee;class de{constructor(ie,ce,me){pe(this,"type");pe(this,"inputs");(0,e.assertPrivate)(ie,I,"Fragment"),me=Object.freeze(me.slice()),(0,e.defineProperties)(this,{type:ce,inputs:me})}static from(ie){if(typeof ie=="string"){try{de.from(JSON.parse(ie))}catch{}return de.from(B(ie))}if(ie instanceof p)switch(ie.peekKeyword(l)){case"constructor":return re.from(ie);case"error":return Z.from(ie);case"event":return te.from(ie);case"fallback":case"receive":return K.from(ie);case"function":return W.from(ie);case"struct":return ne.from(ie)}else if(typeof ie=="object"){switch(ie.type){case"constructor":return re.from(ie);case"error":return Z.from(ie);case"event":return te.from(ie);case"fallback":case"receive":return K.from(ie);case"function":return W.from(ie);case"struct":return ne.from(ie)}(0,e.assert)(!1,`unsupported type: ${ie.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}(0,e.assertArgument)(!1,"unsupported frgament object","obj",ie)}static isConstructor(ie){return re.isFragment(ie)}static isError(ie){return Z.isFragment(ie)}static isEvent(ie){return te.isFragment(ie)}static isFunction(ie){return W.isFragment(ie)}static isStruct(ie){return ne.isFragment(ie)}}st.Fragment=de;class Q extends de{constructor(ce,me,fe,C){super(ce,me,C);pe(this,"name");(0,e.assertArgument)(typeof fe=="string"&&fe.match(y),"invalid identifier","name",fe),C=Object.freeze(C.slice()),(0,e.defineProperties)(this,{name:fe})}}st.NamedFragment=Q;function ae(ye,ie){return"("+ie.map(ce=>ce.format(ye)).join(ye==="full"?", ":",")+")"}class Z extends Q{constructor(ie,ce,me){super(ie,"error",ce,me),Object.defineProperty(this,L,{value:V})}get selector(){return(0,t.id)(this.format("sighash")).substring(0,10)}format(ie){if(ie==null&&(ie="sighash"),ie==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(me=>JSON.parse(me.format(ie)))});const ce=[];return ie!=="sighash"&&ce.push("error"),ce.push(this.name+ae(ie,this.inputs)),ce.join(" ")}static from(ie){if(Z.isFragment(ie))return ie;if(typeof ie=="string")return Z.from(B(ie));if(ie instanceof p){const ce=R("error",ie),me=S(ie);return x(ie),new Z(I,ce,me)}return new Z(I,ie.name,ie.inputs?ie.inputs.map(ee.from):[])}static isFragment(ie){return ie&&ie[L]===V}}st.ErrorFragment=Z;class te extends Q{constructor(ce,me,fe,C){super(ce,"event",me,fe);pe(this,"anonymous");Object.defineProperty(this,L,{value:D}),(0,e.defineProperties)(this,{anonymous:C})}get topicHash(){return(0,t.id)(this.format("sighash"))}format(ce){if(ce==null&&(ce="sighash"),ce==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(fe=>JSON.parse(fe.format(ce)))});const me=[];return ce!=="sighash"&&me.push("event"),me.push(this.name+ae(ce,this.inputs)),ce!=="sighash"&&this.anonymous&&me.push("anonymous"),me.join(" ")}static getTopicHash(ce,me){return me=(me||[]).map(C=>ee.from(C)),new te(I,ce,me,!1).topicHash}static from(ce){if(te.isFragment(ce))return ce;if(typeof ce=="string")try{return te.from(B(ce))}catch{(0,e.assertArgument)(!1,"invalid event fragment","obj",ce)}else if(ce instanceof p){const me=R("event",ce),fe=S(ce,!0),C=!!T(ce,r(["anonymous"])).has("anonymous");return x(ce),new te(I,me,fe,C)}return new te(I,ce.name,ce.inputs?ce.inputs.map(me=>ee.from(me,!0)):[],!!ce.anonymous)}static isFragment(ce){return ce&&ce[L]===D}}st.EventFragment=te;class re extends de{constructor(ce,me,fe,C,m){super(ce,me,fe);pe(this,"payable");pe(this,"gas");Object.defineProperty(this,L,{value:j}),(0,e.defineProperties)(this,{payable:C,gas:m})}format(ce){if((0,e.assert)(ce!=null&&ce!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),ce==="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(fe=>JSON.parse(fe.format(ce)))});const me=[`constructor${ae(ce,this.inputs)}`];return me.push(this.payable?"payable":"nonpayable"),this.gas!=null&&me.push(`@${this.gas.toString()}`),me.join(" ")}static from(ce){if(re.isFragment(ce))return ce;if(typeof ce=="string")try{return re.from(B(ce))}catch{(0,e.assertArgument)(!1,"invalid constuctor fragment","obj",ce)}else if(ce instanceof p){T(ce,r(["constructor"]));const me=S(ce),fe=!!T(ce,i).has("payable"),C=E(ce);return x(ce),new re(I,"constructor",me,fe,C)}return new re(I,"constructor",ce.inputs?ce.inputs.map(ee.from):[],!!ce.payable,ce.gas!=null?ce.gas:null)}static isFragment(ce){return ce&&ce[L]===j}}st.ConstructorFragment=re;class K extends de{constructor(ce,me,fe){super(ce,"fallback",me);pe(this,"payable");Object.defineProperty(this,L,{value:$}),(0,e.defineProperties)(this,{payable:fe})}format(ce){const me=this.inputs.length===0?"receive":"fallback";if(ce==="json"){const fe=this.payable?"payable":"nonpayable";return JSON.stringify({type:me,stateMutability:fe})}return`${me}()${this.payable?" payable":""}`}static from(ce){if(K.isFragment(ce))return ce;if(typeof ce=="string")try{return K.from(B(ce))}catch{(0,e.assertArgument)(!1,"invalid fallback fragment","obj",ce)}else if(ce instanceof p){const me=ce.toString(),fe=ce.peekKeyword(r(["fallback","receive"]));if((0,e.assertArgument)(fe,"type must be fallback or receive","obj",me),ce.popKeyword(r(["fallback","receive"]))==="receive"){const G=S(ce);return(0,e.assertArgument)(G.length===0,"receive cannot have arguments","obj.inputs",G),T(ce,r(["payable"])),x(ce),new K(I,[],!0)}let m=S(ce);m.length?(0,e.assertArgument)(m.length===1&&m[0].type==="bytes","invalid fallback inputs","obj.inputs",m.map(G=>G.format("minimal")).join(", ")):m=[ee.from("bytes")];const _=N(ce);if((0,e.assertArgument)(_==="nonpayable"||_==="payable","fallback cannot be constants","obj.stateMutability",_),T(ce,r(["returns"])).has("returns")){const G=S(ce);(0,e.assertArgument)(G.length===1&&G[0].type==="bytes","invalid fallback outputs","obj.outputs",G.map(X=>X.format("minimal")).join(", "))}return x(ce),new K(I,m,_==="payable")}if(ce.type==="receive")return new K(I,[],!0);if(ce.type==="fallback"){const me=[ee.from("bytes")],fe=ce.stateMutability==="payable";return new K(I,me,fe)}(0,e.assertArgument)(!1,"invalid fallback description","obj",ce)}static isFragment(ce){return ce&&ce[L]===$}}st.FallbackFragment=K;class W extends Q{constructor(ce,me,fe,C,m,_){super(ce,"function",me,C);pe(this,"constant");pe(this,"outputs");pe(this,"stateMutability");pe(this,"payable");pe(this,"gas");Object.defineProperty(this,L,{value:F}),m=Object.freeze(m.slice());const G=fe==="view"||fe==="pure",X=fe==="payable";(0,e.defineProperties)(this,{constant:G,gas:_,outputs:m,payable:X,stateMutability:fe})}get selector(){return(0,t.id)(this.format("sighash")).substring(0,10)}format(ce){if(ce==null&&(ce="sighash"),ce==="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(fe=>JSON.parse(fe.format(ce))),outputs:this.outputs.map(fe=>JSON.parse(fe.format(ce)))});const me=[];return ce!=="sighash"&&me.push("function"),me.push(this.name+ae(ce,this.inputs)),ce!=="sighash"&&(this.stateMutability!=="nonpayable"&&me.push(this.stateMutability),this.outputs&&this.outputs.length&&(me.push("returns"),me.push(ae(ce,this.outputs))),this.gas!=null&&me.push(`@${this.gas.toString()}`)),me.join(" ")}static getSelector(ce,me){return me=(me||[]).map(C=>ee.from(C)),new W(I,ce,"view",me,[],null).selector}static from(ce){if(W.isFragment(ce))return ce;if(typeof ce=="string")try{return W.from(B(ce))}catch{(0,e.assertArgument)(!1,"invalid function fragment","obj",ce)}else if(ce instanceof p){const fe=R("function",ce),C=S(ce),m=N(ce);let _=[];T(ce,r(["returns"])).has("returns")&&(_=S(ce));const G=E(ce);return x(ce),new W(I,fe,m,C,_,G)}let me=ce.stateMutability;return me==null&&(me="payable",typeof ce.constant=="boolean"?(me="view",ce.constant||(me="payable",typeof ce.payable=="boolean"&&!ce.payable&&(me="nonpayable"))):typeof ce.payable=="boolean"&&!ce.payable&&(me="nonpayable")),new W(I,ce.name,me,ce.inputs?ce.inputs.map(ee.from):[],ce.outputs?ce.outputs.map(ee.from):[],ce.gas!=null?ce.gas:null)}static isFragment(ce){return ce&&ce[L]===F}}st.FunctionFragment=W;class ne extends Q{constructor(ie,ce,me){super(ie,"struct",ce,me),Object.defineProperty(this,L,{value:M})}format(){throw new Error("@TODO")}static from(ie){if(typeof ie=="string")try{return ne.from(B(ie))}catch{(0,e.assertArgument)(!1,"invalid struct fragment","obj",ie)}else if(ie instanceof p){const ce=R("struct",ie),me=S(ie);return x(ie),new ne(I,ce,me)}return new ne(I,ie.name,ie.inputs?ie.inputs.map(ee.from):[])}static isFragment(ie){return ie&&ie[L]===M}}return st.StructFragment=ne,st}var af;function ch(){var p,Tn;if(af)return Gn;af=1,Object.defineProperty(Gn,"__esModule",{value:!0}),Gn.AbiCoder=void 0;const e=Ce(),t=Zt(),r=am(),n=rh(),i=um(),s=nh(),o=lm(),u=fm(),l=dm(),a=hm(),f=pm(),d=Lc(),c=ft(),g=Ce(),h=new Map;h.set(0,"GENERIC_PANIC"),h.set(1,"ASSERT_FALSE"),h.set(17,"OVERFLOW"),h.set(18,"DIVIDE_BY_ZERO"),h.set(33,"ENUM_RANGE_ERROR"),h.set(34,"BAD_STORAGE_DATA"),h.set(49,"STACK_UNDERFLOW"),h.set(50,"ARRAY_RANGE_ERROR"),h.set(65,"OUT_OF_MEMORY"),h.set(81,"UNINITIALIZED_FUNCTION_CALL");const b=new RegExp(/^bytes([0-9]*)$/),P=new RegExp(/^(u?int)([0-9]*)$/);let w=null;function y(R,T,N,S){let E="missing revert data",x=null;const A=null;let O=null;if(N){E="execution reverted";const L=(0,g.getBytes)(N);if(N=(0,g.hexlify)(N),L.length===0)E+=" (no data present; likely require(false) occurred",x="require(false)";else if(L.length%32!==4)E+=" (could not decode reason; invalid data length)";else if((0,g.hexlify)(L.slice(0,4))==="0x08c379a0")try{x=S.decode(["string"],L.slice(4))[0],O={signature:"Error(string)",name:"Error",args:[x]},E+=`: ${JSON.stringify(x)}`}catch{E+=" (could not decode reason; invalid string data)"}else if((0,g.hexlify)(L.slice(0,4))==="0x4e487b71")try{const H=Number(S.decode(["uint256"],L.slice(4))[0]);O={signature:"Panic(uint256)",name:"Panic",args:[H]},x=`Panic due to ${h.get(H)||"UNKNOWN"}(${H})`,E+=`: ${x}`}catch{E+=" (could not decode panic code)"}else E+=" (unknown custom error)"}const I={to:T.to?(0,c.getAddress)(T.to):null,data:T.data||"0x"};return T.from&&(I.from=(0,c.getAddress)(T.from)),(0,g.makeError)(E,"CALL_EXCEPTION",{action:R,data:N,reason:x,transaction:I,invocation:A,revert:O})}const k=class k{constructor(){xe(this,p)}getDefaultValue(T){const N=T.map(E=>_e(this,p,Tn).call(this,d.ParamType.from(E)));return new f.TupleCoder(N,"_").defaultValue()}encode(T,N){(0,e.assertArgumentCount)(N.length,T.length,"types/values length mismatch");const S=T.map(A=>_e(this,p,Tn).call(this,d.ParamType.from(A))),E=new f.TupleCoder(S,"_"),x=new t.Writer;return E.encode(x,N),x.data}decode(T,N,S){const E=T.map(A=>_e(this,p,Tn).call(this,d.ParamType.from(A)));return new f.TupleCoder(E,"_").decode(new t.Reader(N,S))}static defaultAbiCoder(){return w==null&&(w=new k),w}static getBuiltinCallException(T,N,S){return y(T,N,S,k.defaultAbiCoder())}};p=new WeakSet,Tn=function(T){if(T.isArray())return new n.ArrayCoder(_e(this,p,Tn).call(this,T.arrayChildren),T.arrayLength,T.name);if(T.isTuple())return new f.TupleCoder(T.components.map(S=>_e(this,p,Tn).call(this,S)),T.name);switch(T.baseType){case"address":return new r.AddressCoder(T.name);case"bool":return new i.BooleanCoder(T.name);case"string":return new a.StringCoder(T.name);case"bytes":return new s.BytesCoder(T.name);case"":return new u.NullCoder(T.name)}let N=T.type.match(P);if(N){let S=parseInt(N[2]||"256");return(0,e.assertArgument)(S!==0&&S<=256&&S%8===0,"invalid "+N[1]+" bit length","param",T),new l.NumberCoder(S/8,N[1]==="int",T.name)}if(N=T.type.match(b),N){let S=parseInt(N[1]);return(0,e.assertArgument)(S!==0&&S<=32,"invalid bytes length","param",T),new o.FixedBytesCoder(S,T.name)}(0,e.assertArgument)(!1,"invalid type","type",T.type)};let v=k;return Gn.AbiCoder=v,Gn}var Xr={},cf;function Am(){if(cf)return Xr;cf=1,Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.decodeBytes32String=Xr.encodeBytes32String=void 0;const e=Ce();function t(n){const i=(0,e.toUtf8Bytes)(n);if(i.length>31)throw new Error("bytes32 string must be less than 32 bytes");return(0,e.zeroPadBytes)(i,32)}Xr.encodeBytes32String=t;function r(n){const i=(0,e.getBytes)(n,"bytes");if(i.length!==32)throw new Error("invalid bytes32 - not 32 bytes long");if(i[31]!==0)throw new Error("invalid bytes32 string - no null terminator");let s=31;for(;i[s-1]===0;)s--;return(0,e.toUtf8String)(i.slice(0,s))}return Xr.decodeBytes32String=r,Xr}var aa={},uf;function Em(){return uf||(uf=1,function(e){var b,P,w,y,v,Is,Ms;Object.defineProperty(e,"__esModule",{value:!0}),e.Interface=e.Indexed=e.ErrorDescription=e.TransactionDescription=e.LogDescription=e.Result=e.checkResultErrors=void 0;const t=ht(),r=vr(),n=Ce(),i=ch(),s=Zt();Object.defineProperty(e,"checkResultErrors",{enumerable:!0,get:function(){return s.checkResultErrors}}),Object.defineProperty(e,"Result",{enumerable:!0,get:function(){return s.Result}});const o=Lc(),u=Er();class l{constructor(T,N,S){pe(this,"fragment");pe(this,"name");pe(this,"signature");pe(this,"topic");pe(this,"args");const E=T.name,x=T.format();(0,n.defineProperties)(this,{fragment:T,name:E,signature:x,topic:N,args:S})}}e.LogDescription=l;class a{constructor(T,N,S,E){pe(this,"fragment");pe(this,"name");pe(this,"args");pe(this,"signature");pe(this,"selector");pe(this,"value");const x=T.name,A=T.format();(0,n.defineProperties)(this,{fragment:T,name:x,args:S,signature:A,selector:N,value:E})}}e.TransactionDescription=a;class f{constructor(T,N,S){pe(this,"fragment");pe(this,"name");pe(this,"args");pe(this,"signature");pe(this,"selector");const E=T.name,x=T.format();(0,n.defineProperties)(this,{fragment:T,name:E,args:S,signature:x,selector:N})}}e.ErrorDescription=f;class d{constructor(T){pe(this,"hash");pe(this,"_isIndexed");(0,n.defineProperties)(this,{hash:T,_isIndexed:!0})}static isIndexed(T){return!!(T&&T._isIndexed)}}e.Indexed=d;const c={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"},g={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:R=>`reverted with reason string ${JSON.stringify(R)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:R=>{let T="unknown panic code";return R>=0&&R<=255&&c[R.toString()]&&(T=c[R.toString()]),`reverted with panic code 0x${R.toString(16)} (${T})`}}},k=class k{constructor(T){xe(this,v);pe(this,"fragments");pe(this,"deploy");pe(this,"fallback");pe(this,"receive");xe(this,b);xe(this,P);xe(this,w);xe(this,y);let N=[];typeof T=="string"?N=JSON.parse(T):N=T,ue(this,w,new Map),ue(this,b,new Map),ue(this,P,new Map);const S=[];for(const A of N)try{S.push(o.Fragment.from(A))}catch(O){console.log("EE",O)}(0,n.defineProperties)(this,{fragments:Object.freeze(S)});let E=null,x=!1;ue(this,y,this.getAbiCoder()),this.fragments.forEach((A,O)=>{let I;switch(A.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}(0,n.defineProperties)(this,{deploy:A});return;case"fallback":A.inputs.length===0?x=!0:((0,n.assertArgument)(!E||A.payable!==E.payable,"conflicting fallback fragments",`fragments[${O}]`,A),E=A,x=E.payable);return;case"function":I=q(this,w);break;case"event":I=q(this,P);break;case"error":I=q(this,b);break;default:return}const L=A.format();I.has(L)||I.set(L,A)}),this.deploy||(0,n.defineProperties)(this,{deploy:o.ConstructorFragment.from("constructor()")}),(0,n.defineProperties)(this,{fallback:E,receive:x})}format(T){const N=T?"minimal":"full";return this.fragments.map(E=>E.format(N))}formatJson(){const T=this.fragments.map(N=>N.format("json"));return JSON.stringify(T.map(N=>JSON.parse(N)))}getAbiCoder(){return i.AbiCoder.defaultAbiCoder()}getFunctionName(T){const N=_e(this,v,Is).call(this,T,null,!1);return(0,n.assertArgument)(N,"no matching function","key",T),N.name}hasFunction(T){return!!_e(this,v,Is).call(this,T,null,!1)}getFunction(T,N){return _e(this,v,Is).call(this,T,N||null,!0)}forEachFunction(T){const N=Array.from(q(this,w).keys());N.sort((S,E)=>S.localeCompare(E));for(let S=0;S<N.length;S++){const E=N[S];T(q(this,w).get(E),S)}}getEventName(T){const N=_e(this,v,Ms).call(this,T,null,!1);return(0,n.assertArgument)(N,"no matching event","key",T),N.name}hasEvent(T){return!!_e(this,v,Ms).call(this,T,null,!1)}getEvent(T,N){return _e(this,v,Ms).call(this,T,N||null,!0)}forEachEvent(T){const N=Array.from(q(this,P).keys());N.sort((S,E)=>S.localeCompare(E));for(let S=0;S<N.length;S++){const E=N[S];T(q(this,P).get(E),S)}}getError(T,N){if((0,n.isHexString)(T)){const E=T.toLowerCase();if(g[E])return o.ErrorFragment.from(g[E].signature);for(const x of q(this,b).values())if(E===x.selector)return x;return null}if(T.indexOf("(")===-1){const E=[];for(const[x,A]of q(this,b))x.split("(")[0]===T&&E.push(A);if(E.length===0)return T==="Error"?o.ErrorFragment.from("error Error(string)"):T==="Panic"?o.ErrorFragment.from("error Panic(uint256)"):null;if(E.length>1){const x=E.map(A=>JSON.stringify(A.format())).join(", ");(0,n.assertArgument)(!1,`ambiguous error description (i.e. ${x})`,"name",T)}return E[0]}if(T=o.ErrorFragment.from(T).format(),T==="Error(string)")return o.ErrorFragment.from("error Error(string)");if(T==="Panic(uint256)")return o.ErrorFragment.from("error Panic(uint256)");const S=q(this,b).get(T);return S||null}forEachError(T){const N=Array.from(q(this,b).keys());N.sort((S,E)=>S.localeCompare(E));for(let S=0;S<N.length;S++){const E=N[S];T(q(this,b).get(E),S)}}_decodeParams(T,N){return q(this,y).decode(T,N)}_encodeParams(T,N){return q(this,y).encode(T,N)}encodeDeploy(T){return this._encodeParams(this.deploy.inputs,T||[])}decodeErrorResult(T,N){if(typeof T=="string"){const S=this.getError(T);(0,n.assertArgument)(S,"unknown error","fragment",T),T=S}return(0,n.assertArgument)((0,n.dataSlice)(N,0,4)===T.selector,`data signature does not match error ${T.name}.`,"data",N),this._decodeParams(T.inputs,(0,n.dataSlice)(N,4))}encodeErrorResult(T,N){if(typeof T=="string"){const S=this.getError(T);(0,n.assertArgument)(S,"unknown error","fragment",T),T=S}return(0,n.concat)([T.selector,this._encodeParams(T.inputs,N||[])])}decodeFunctionData(T,N){if(typeof T=="string"){const S=this.getFunction(T);(0,n.assertArgument)(S,"unknown function","fragment",T),T=S}return(0,n.assertArgument)((0,n.dataSlice)(N,0,4)===T.selector,`data signature does not match function ${T.name}.`,"data",N),this._decodeParams(T.inputs,(0,n.dataSlice)(N,4))}encodeFunctionData(T,N){if(typeof T=="string"){const S=this.getFunction(T);(0,n.assertArgument)(S,"unknown function","fragment",T),T=S}return(0,n.concat)([T.selector,this._encodeParams(T.inputs,N||[])])}decodeFunctionResult(T,N){if(typeof T=="string"){const x=this.getFunction(T);(0,n.assertArgument)(x,"unknown function","fragment",T),T=x}let S="invalid length for result data";const E=(0,n.getBytesCopy)(N);if(E.length%32===0)try{return q(this,y).decode(T.outputs,E)}catch{S="could not decode result data"}(0,n.assert)(!1,S,"BAD_DATA",{value:(0,n.hexlify)(E),info:{method:T.name,signature:T.format()}})}makeError(T,N){const S=(0,n.getBytes)(T,"data"),E=i.AbiCoder.getBuiltinCallException("call",N,S);if(E.message.startsWith("execution reverted (unknown custom error)")){const O=(0,n.hexlify)(S.slice(0,4)),I=this.getError(O);if(I)try{const L=q(this,y).decode(I.inputs,S.slice(4));E.revert={name:I.name,signature:I.format(),args:L},E.reason=E.revert.signature,E.message=`execution reverted: ${E.reason}`}catch{E.message="execution reverted (coult not decode custom error)"}}const A=this.parseTransaction(N);return A&&(E.invocation={method:A.name,signature:A.signature,args:A.args}),E}encodeFunctionResult(T,N){if(typeof T=="string"){const S=this.getFunction(T);(0,n.assertArgument)(S,"unknown function","fragment",T),T=S}return(0,n.hexlify)(q(this,y).encode(T.outputs,N||[]))}encodeFilterTopics(T,N){if(typeof T=="string"){const x=this.getEvent(T);(0,n.assertArgument)(x,"unknown event","eventFragment",T),T=x}(0,n.assert)(N.length<=T.inputs.length,`too many arguments for ${T.format()}`,"UNEXPECTED_ARGUMENT",{count:N.length,expectedCount:T.inputs.length});const S=[];T.anonymous||S.push(T.topicHash);const E=(x,A)=>x.type==="string"?(0,r.id)(A):x.type==="bytes"?(0,t.keccak256)((0,n.hexlify)(A)):(x.type==="bool"&&typeof A=="boolean"?A=A?"0x01":"0x00":x.type.match(/^u?int/)?A=(0,n.toBeHex)(A):x.type.match(/^bytes/)?A=(0,n.zeroPadBytes)(A,32):x.type==="address"&&q(this,y).encode(["address"],[A]),(0,n.zeroPadValue)((0,n.hexlify)(A),32));for(N.forEach((x,A)=>{const O=T.inputs[A];if(!O.indexed){(0,n.assertArgument)(x==null,"cannot filter non-indexed parameters; must be null","contract."+O.name,x);return}x==null?S.push(null):O.baseType==="array"||O.baseType==="tuple"?(0,n.assertArgument)(!1,"filtering with tuples or arrays not supported","contract."+O.name,x):Array.isArray(x)?S.push(x.map(I=>E(O,I))):S.push(E(O,x))});S.length&&S[S.length-1]===null;)S.pop();return S}encodeEventLog(T,N){if(typeof T=="string"){const A=this.getEvent(T);(0,n.assertArgument)(A,"unknown event","eventFragment",T),T=A}const S=[],E=[],x=[];return T.anonymous||S.push(T.topicHash),(0,n.assertArgument)(N.length===T.inputs.length,"event arguments/values mismatch","values",N),T.inputs.forEach((A,O)=>{const I=N[O];if(A.indexed)if(A.type==="string")S.push((0,r.id)(I));else if(A.type==="bytes")S.push((0,t.keccak256)(I));else{if(A.baseType==="tuple"||A.baseType==="array")throw new Error("not implemented");S.push(q(this,y).encode([A.type],[I]))}else E.push(A),x.push(I)}),{data:q(this,y).encode(E,x),topics:S}}decodeEventLog(T,N,S){if(typeof T=="string"){const j=this.getEvent(T);(0,n.assertArgument)(j,"unknown event","eventFragment",T),T=j}if(S!=null&&!T.anonymous){const j=T.topicHash;(0,n.assertArgument)((0,n.isHexString)(S[0],32)&&S[0].toLowerCase()===j,"fragment/topic mismatch","topics[0]",S[0]),S=S.slice(1)}const E=[],x=[],A=[];T.inputs.forEach((j,$)=>{j.indexed?j.type==="string"||j.type==="bytes"||j.baseType==="tuple"||j.baseType==="array"?(E.push(o.ParamType.from({type:"bytes32",name:j.name})),A.push(!0)):(E.push(j),A.push(!1)):(x.push(j),A.push(!1))});const O=S!=null?q(this,y).decode(E,(0,n.concat)(S)):null,I=q(this,y).decode(x,N,!0),L=[],H=[];let V=0,D=0;return T.inputs.forEach((j,$)=>{let F=null;if(j.indexed)if(O==null)F=new d(null);else if(A[$])F=new d(O[D++]);else try{F=O[D++]}catch(M){F=M}else try{F=I[V++]}catch(M){F=M}L.push(F),H.push(j.name||null)}),s.Result.fromItems(L,H)}parseTransaction(T){const N=(0,n.getBytes)(T.data,"tx.data"),S=(0,n.getBigInt)(T.value!=null?T.value:0,"tx.value"),E=this.getFunction((0,n.hexlify)(N.slice(0,4)));if(!E)return null;const x=q(this,y).decode(E.inputs,N.slice(4));return new a(E,E.selector,x,S)}parseCallResult(T){throw new Error("@TODO")}parseLog(T){const N=this.getEvent(T.topics[0]);return!N||N.anonymous?null:new l(N,N.topicHash,this.decodeEventLog(N,T.data,T.topics))}parseError(T){const N=(0,n.hexlify)(T),S=this.getError((0,n.dataSlice)(N,0,4));if(!S)return null;const E=q(this,y).decode(S.inputs,(0,n.dataSlice)(N,4));return new f(S,S.selector,E)}static from(T){return T instanceof k?T:typeof T=="string"?new k(JSON.parse(T)):typeof T.format=="function"?new k(T.format("json")):new k(T)}};b=new WeakMap,P=new WeakMap,w=new WeakMap,y=new WeakMap,v=new WeakSet,Is=function(T,N,S){if((0,n.isHexString)(T)){const x=T.toLowerCase();for(const A of q(this,w).values())if(x===A.selector)return A;return null}if(T.indexOf("(")===-1){const x=[];for(const[A,O]of q(this,w))A.split("(")[0]===T&&x.push(O);if(N){const A=N.length>0?N[N.length-1]:null;let O=N.length,I=!0;u.Typed.isTyped(A)&&A.type==="overrides"&&(I=!1,O--);for(let L=x.length-1;L>=0;L--){const H=x[L].inputs.length;H!==O&&(!I||H!==O-1)&&x.splice(L,1)}for(let L=x.length-1;L>=0;L--){const H=x[L].inputs;for(let V=0;V<N.length;V++)if(u.Typed.isTyped(N[V])){if(V>=H.length){if(N[V].type==="overrides")continue;x.splice(L,1);break}if(N[V].type!==H[V].baseType){x.splice(L,1);break}}}}if(x.length===1&&N&&N.length!==x[0].inputs.length){const A=N[N.length-1];(A==null||Array.isArray(A)||typeof A!="object")&&x.splice(0,1)}if(x.length===0)return null;if(x.length>1&&S){const A=x.map(O=>JSON.stringify(O.format())).join(", ");(0,n.assertArgument)(!1,`ambiguous function description (i.e. matches ${A})`,"key",T)}return x[0]}const E=q(this,w).get(o.FunctionFragment.from(T).format());return E||null},Ms=function(T,N,S){if((0,n.isHexString)(T)){const x=T.toLowerCase();for(const A of q(this,P).values())if(x===A.topicHash)return A;return null}if(T.indexOf("(")===-1){const x=[];for(const[A,O]of q(this,P))A.split("(")[0]===T&&x.push(O);if(N){for(let A=x.length-1;A>=0;A--)x[A].inputs.length<N.length&&x.splice(A,1);for(let A=x.length-1;A>=0;A--){const O=x[A].inputs;for(let I=0;I<N.length;I++)if(u.Typed.isTyped(N[I])&&N[I].type!==O[I].baseType){x.splice(A,1);break}}}if(x.length===0)return null;if(x.length>1&&S){const A=x.map(O=>JSON.stringify(O.format())).join(", ");(0,n.assertArgument)(!1,`ambiguous event description (i.e. matches ${A})`,"key",T)}return x[0]}const E=q(this,P).get(o.EventFragment.from(T).format());return E||null};let h=k;e.Interface=h}(aa)),aa}var lf;function bs(){return lf||(lf=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Typed=e.Result=e.TransactionDescription=e.LogDescription=e.ErrorDescription=e.Interface=e.Indexed=e.checkResultErrors=e.StructFragment=e.ParamType=e.NamedFragment=e.FunctionFragment=e.Fragment=e.FallbackFragment=e.EventFragment=e.ErrorFragment=e.ConstructorFragment=e.encodeBytes32String=e.decodeBytes32String=e.AbiCoder=void 0;var t=ch();Object.defineProperty(e,"AbiCoder",{enumerable:!0,get:function(){return t.AbiCoder}});var r=Am();Object.defineProperty(e,"decodeBytes32String",{enumerable:!0,get:function(){return r.decodeBytes32String}}),Object.defineProperty(e,"encodeBytes32String",{enumerable:!0,get:function(){return r.encodeBytes32String}});var n=Lc();Object.defineProperty(e,"ConstructorFragment",{enumerable:!0,get:function(){return n.ConstructorFragment}}),Object.defineProperty(e,"ErrorFragment",{enumerable:!0,get:function(){return n.ErrorFragment}}),Object.defineProperty(e,"EventFragment",{enumerable:!0,get:function(){return n.EventFragment}}),Object.defineProperty(e,"FallbackFragment",{enumerable:!0,get:function(){return n.FallbackFragment}}),Object.defineProperty(e,"Fragment",{enumerable:!0,get:function(){return n.Fragment}}),Object.defineProperty(e,"FunctionFragment",{enumerable:!0,get:function(){return n.FunctionFragment}}),Object.defineProperty(e,"NamedFragment",{enumerable:!0,get:function(){return n.NamedFragment}}),Object.defineProperty(e,"ParamType",{enumerable:!0,get:function(){return n.ParamType}}),Object.defineProperty(e,"StructFragment",{enumerable:!0,get:function(){return n.StructFragment}});var i=Em();Object.defineProperty(e,"checkResultErrors",{enumerable:!0,get:function(){return i.checkResultErrors}}),Object.defineProperty(e,"Indexed",{enumerable:!0,get:function(){return i.Indexed}}),Object.defineProperty(e,"Interface",{enumerable:!0,get:function(){return i.Interface}}),Object.defineProperty(e,"ErrorDescription",{enumerable:!0,get:function(){return i.ErrorDescription}}),Object.defineProperty(e,"LogDescription",{enumerable:!0,get:function(){return i.LogDescription}}),Object.defineProperty(e,"TransactionDescription",{enumerable:!0,get:function(){return i.TransactionDescription}}),Object.defineProperty(e,"Result",{enumerable:!0,get:function(){return i.Result}});var s=Er();Object.defineProperty(e,"Typed",{enumerable:!0,get:function(){return s.Typed}})}(Wo)),Wo}var ca={},Vt={},Et={},ff;function gs(){var b,P,w;if(ff)return Et;ff=1,Object.defineProperty(Et,"__esModule",{value:!0}),Et.TransactionResponse=Et.TransactionReceipt=Et.Log=Et.Block=Et.copyRequest=Et.FeeData=void 0;const e=Ce(),t=Ut(),r=BigInt(0);function n(v){return v??null}function i(v){return v==null?null:v.toString()}class s{constructor(p,B,k){pe(this,"gasPrice");pe(this,"maxFeePerGas");pe(this,"maxPriorityFeePerGas");(0,e.defineProperties)(this,{gasPrice:n(p),maxFeePerGas:n(B),maxPriorityFeePerGas:n(k)})}toJSON(){const{gasPrice:p,maxFeePerGas:B,maxPriorityFeePerGas:k}=this;return{_type:"FeeData",gasPrice:i(p),maxFeePerGas:i(B),maxPriorityFeePerGas:i(k)}}}Et.FeeData=s;function o(v){const p={};v.to&&(p.to=v.to),v.from&&(p.from=v.from),v.data&&(p.data=(0,e.hexlify)(v.data));const B="chainId,gasLimit,gasPrice,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const R of B)!(R in v)||v[R]==null||(p[R]=(0,e.getBigInt)(v[R],`request.${R}`));const k="type,nonce".split(/,/);for(const R of k)!(R in v)||v[R]==null||(p[R]=(0,e.getNumber)(v[R],`request.${R}`));return v.accessList&&(p.accessList=(0,t.accessListify)(v.accessList)),"blockTag"in v&&(p.blockTag=v.blockTag),"enableCcipRead"in v&&(p.enableCcipRead=!!v.enableCcipRead),"customData"in v&&(p.customData=v.customData),p}Et.copyRequest=o;class u{constructor(p,B){pe(this,"provider");pe(this,"number");pe(this,"hash");pe(this,"timestamp");pe(this,"parentHash");pe(this,"nonce");pe(this,"difficulty");pe(this,"gasLimit");pe(this,"gasUsed");pe(this,"miner");pe(this,"extraData");pe(this,"baseFeePerGas");xe(this,b);ue(this,b,p.transactions.map(k=>typeof k!="string"?new f(k,B):k)),(0,e.defineProperties)(this,{provider:B,hash:n(p.hash),number:p.number,timestamp:p.timestamp,parentHash:p.parentHash,nonce:p.nonce,difficulty:p.difficulty,gasLimit:p.gasLimit,gasUsed:p.gasUsed,miner:p.miner,extraData:p.extraData,baseFeePerGas:n(p.baseFeePerGas)})}get transactions(){return q(this,b).map(p=>typeof p=="string"?p:p.hash)}get prefetchedTransactions(){const p=q(this,b).slice();return p.length===0?[]:((0,e.assert)(typeof p[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),p)}toJSON(){const{baseFeePerGas:p,difficulty:B,extraData:k,gasLimit:R,gasUsed:T,hash:N,miner:S,nonce:E,number:x,parentHash:A,timestamp:O,transactions:I}=this;return{_type:"Block",baseFeePerGas:i(p),difficulty:i(B),extraData:k,gasLimit:i(R),gasUsed:i(T),hash:N,miner:S,nonce:E,number:x,parentHash:A,timestamp:O,transactions:I}}[Symbol.iterator](){let p=0;const B=this.transactions;return{next:()=>p<this.length?{value:B[p++],done:!1}:{value:void 0,done:!0}}}get length(){return q(this,b).length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(p){let B;if(typeof p=="number")B=q(this,b)[p];else{const k=p.toLowerCase();for(const R of q(this,b))if(typeof R=="string"){if(R!==k)continue;B=R;break}else{if(R.hash===k)continue;B=R;break}}if(B==null)throw new Error("no such tx");return typeof B=="string"?await this.provider.getTransaction(B):B}getPrefetchedTransaction(p){const B=this.prefetchedTransactions;if(typeof p=="number")return B[p];p=p.toLowerCase();for(const k of B)if(k.hash===p)return k;(0,e.assertArgument)(!1,"no matching transaction","indexOrHash",p)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return d(this)}}b=new WeakMap,Et.Block=u;class l{constructor(p,B){pe(this,"provider");pe(this,"transactionHash");pe(this,"blockHash");pe(this,"blockNumber");pe(this,"removed");pe(this,"address");pe(this,"data");pe(this,"topics");pe(this,"index");pe(this,"transactionIndex");this.provider=B;const k=Object.freeze(p.topics.slice());(0,e.defineProperties)(this,{transactionHash:p.transactionHash,blockHash:p.blockHash,blockNumber:p.blockNumber,removed:p.removed,address:p.address,data:p.data,topics:k,index:p.index,transactionIndex:p.transactionIndex})}toJSON(){const{address:p,blockHash:B,blockNumber:k,data:R,index:T,removed:N,topics:S,transactionHash:E,transactionIndex:x}=this;return{_type:"log",address:p,blockHash:B,blockNumber:k,data:R,index:T,removed:N,topics:S,transactionHash:E,transactionIndex:x}}async getBlock(){const p=await this.provider.getBlock(this.blockHash);return(0,e.assert)(!!p,"failed to find transaction","UNKNOWN_ERROR",{}),p}async getTransaction(){const p=await this.provider.getTransaction(this.transactionHash);return(0,e.assert)(!!p,"failed to find transaction","UNKNOWN_ERROR",{}),p}async getTransactionReceipt(){const p=await this.provider.getTransactionReceipt(this.transactionHash);return(0,e.assert)(!!p,"failed to find transaction receipt","UNKNOWN_ERROR",{}),p}removedEvent(){return h(this)}}Et.Log=l;class a{constructor(p,B){pe(this,"provider");pe(this,"to");pe(this,"from");pe(this,"contractAddress");pe(this,"hash");pe(this,"index");pe(this,"blockHash");pe(this,"blockNumber");pe(this,"logsBloom");pe(this,"gasUsed");pe(this,"cumulativeGasUsed");pe(this,"gasPrice");pe(this,"type");pe(this,"status");pe(this,"root");xe(this,P);ue(this,P,Object.freeze(p.logs.map(R=>new l(R,B))));let k=r;p.effectiveGasPrice!=null?k=p.effectiveGasPrice:p.gasPrice!=null&&(k=p.gasPrice),(0,e.defineProperties)(this,{provider:B,to:p.to,from:p.from,contractAddress:p.contractAddress,hash:p.hash,index:p.index,blockHash:p.blockHash,blockNumber:p.blockNumber,logsBloom:p.logsBloom,gasUsed:p.gasUsed,cumulativeGasUsed:p.cumulativeGasUsed,gasPrice:k,type:p.type,status:p.status,root:p.root})}get logs(){return q(this,P)}toJSON(){const{to:p,from:B,contractAddress:k,hash:R,index:T,blockHash:N,blockNumber:S,logsBloom:E,logs:x,status:A,root:O}=this;return{_type:"TransactionReceipt",blockHash:N,blockNumber:S,contractAddress:k,cumulativeGasUsed:i(this.cumulativeGasUsed),from:B,gasPrice:i(this.gasPrice),gasUsed:i(this.gasUsed),hash:R,index:T,logs:x,logsBloom:E,root:O,status:A,to:p}}get length(){return this.logs.length}[Symbol.iterator](){let p=0;return{next:()=>p<this.length?{value:this.logs[p++],done:!1}:{value:void 0,done:!0}}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){const p=await this.provider.getBlock(this.blockHash);if(p==null)throw new Error("TODO");return p}async getTransaction(){const p=await this.provider.getTransaction(this.hash);if(p==null)throw new Error("TODO");return p}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return g(this)}reorderedEvent(p){return(0,e.assert)(!p||p.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),c(this,p)}}P=new WeakMap,Et.TransactionReceipt=a;const y=class y{constructor(p,B){pe(this,"provider");pe(this,"blockNumber");pe(this,"blockHash");pe(this,"index");pe(this,"hash");pe(this,"type");pe(this,"to");pe(this,"from");pe(this,"nonce");pe(this,"gasLimit");pe(this,"gasPrice");pe(this,"maxPriorityFeePerGas");pe(this,"maxFeePerGas");pe(this,"data");pe(this,"value");pe(this,"chainId");pe(this,"signature");pe(this,"accessList");xe(this,w);this.provider=B,this.blockNumber=p.blockNumber!=null?p.blockNumber:null,this.blockHash=p.blockHash!=null?p.blockHash:null,this.hash=p.hash,this.index=p.index,this.type=p.type,this.from=p.from,this.to=p.to||null,this.gasLimit=p.gasLimit,this.nonce=p.nonce,this.data=p.data,this.value=p.value,this.gasPrice=p.gasPrice,this.maxPriorityFeePerGas=p.maxPriorityFeePerGas!=null?p.maxPriorityFeePerGas:null,this.maxFeePerGas=p.maxFeePerGas!=null?p.maxFeePerGas:null,this.chainId=p.chainId,this.signature=p.signature,this.accessList=p.accessList!=null?p.accessList:null,ue(this,w,-1)}toJSON(){const{blockNumber:p,blockHash:B,index:k,hash:R,type:T,to:N,from:S,nonce:E,data:x,signature:A,accessList:O}=this;return{_type:"TransactionReceipt",accessList:O,blockNumber:p,blockHash:B,chainId:i(this.chainId),data:x,from:S,gasLimit:i(this.gasLimit),gasPrice:i(this.gasPrice),hash:R,maxFeePerGas:i(this.maxFeePerGas),maxPriorityFeePerGas:i(this.maxPriorityFeePerGas),nonce:E,signature:A,to:N,index:k,type:T,value:i(this.value)}}async getBlock(){let p=this.blockNumber;if(p==null){const k=await this.getTransaction();k&&(p=k.blockNumber)}if(p==null)return null;const B=this.provider.getBlock(p);if(B==null)throw new Error("TODO");return B}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:B,blockNumber:k}=await(0,e.resolveProperties)({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return B==null||B.blockNumber==null?0:k-B.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(p,B){const k=p??1,R=B??0;let T=q(this,w),N=-1,S=T===-1;const E=async()=>{if(S)return null;const{blockNumber:I,nonce:L}=await(0,e.resolveProperties)({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(L<this.nonce){T=I;return}if(S)return null;const H=await this.getTransaction();if(!(H&&H.blockNumber!=null))for(N===-1&&(N=T-3,N<q(this,w)&&(N=q(this,w)));N<=I;){if(S)return null;const V=await this.provider.getBlock(N,!0);if(V==null)return;for(const D of V)if(D===this.hash)return;for(let D=0;D<V.length;D++){const j=await V.getTransaction(D);if(j.from===this.from&&j.nonce===this.nonce){if(S)return null;const $=await this.provider.getTransactionReceipt(j.hash);if($==null||I-$.blockNumber+1<k)return;let F="replaced";j.data===this.data&&j.to===this.to&&j.value===this.value?F="repriced":j.data==="0x"&&j.from===j.to&&j.value===r&&(F="cancelled"),(0,e.assert)(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:F==="replaced"||F==="cancelled",reason:F,replacement:j.replaceableTransaction(T),hash:j.hash,receipt:$})}}N++}},x=I=>{if(I==null||I.status!==0)return I;(0,e.assert)(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:I.to,from:I.from,data:""},receipt:I})},A=await this.provider.getTransactionReceipt(this.hash);if(k===0)return x(A);if(A){if(await A.confirmations()>=k)return x(A)}else if(await E(),k===0)return null;return await new Promise((I,L)=>{const H=[],V=()=>{H.forEach(j=>j())};if(H.push(()=>{S=!0}),R>0){const j=setTimeout(()=>{V(),L((0,e.makeError)("wait for transaction timeout","TIMEOUT"))},R);H.push(()=>{clearTimeout(j)})}const D=async j=>{if(await j.confirmations()>=k){V();try{I(x(j))}catch($){L($)}}};if(H.push(()=>{this.provider.off(this.hash,D)}),this.provider.on(this.hash,D),T>=0){const j=async()=>{try{await E()}catch($){if((0,e.isError)($,"TRANSACTION_REPLACED")){V(),L($);return}}S||this.provider.once("block",j)};H.push(()=>{this.provider.off("block",j)}),this.provider.once("block",j)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}removedEvent(){return(0,e.assert)(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),g(this)}reorderedEvent(p){return(0,e.assert)(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),(0,e.assert)(!p||p.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),c(this,p)}replaceableTransaction(p){(0,e.assertArgument)(Number.isInteger(p)&&p>=0,"invalid startBlock","startBlock",p);const B=new y(this,this.provider);return ue(B,w,p),B}};w=new WeakMap;let f=y;Et.TransactionResponse=f;function d(v){return{orphan:"drop-block",hash:v.hash,number:v.number}}function c(v,p){return{orphan:"reorder-transaction",tx:v,other:p}}function g(v){return{orphan:"drop-transaction",tx:v}}function h(v){return{orphan:"drop-log",log:{transactionHash:v.transactionHash,blockHash:v.blockHash,blockNumber:v.blockNumber,address:v.address,data:v.data,topics:Object.freeze(v.topics.slice()),index:v.index}}}return Et}var vt={},df;function uh(){var l,a;if(df)return vt;df=1,Object.defineProperty(vt,"__esModule",{value:!0}),vt.ContractEventPayload=vt.ContractUnknownEventPayload=vt.ContractTransactionResponse=vt.ContractTransactionReceipt=vt.UndecodedEventLog=vt.EventLog=void 0;const e=gs(),t=Ce();class r extends e.Log{constructor(c,g,h){super(c,c.provider);pe(this,"interface");pe(this,"fragment");pe(this,"args");const b=g.decodeEventLog(h,c.data,c.topics);(0,t.defineProperties)(this,{args:b,fragment:h,interface:g})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}vt.EventLog=r;class n extends e.Log{constructor(c,g){super(c,c.provider);pe(this,"error");(0,t.defineProperties)(this,{error:g})}}vt.UndecodedEventLog=n;class i extends e.TransactionReceipt{constructor(c,g,h){super(h,g);xe(this,l);ue(this,l,c)}get logs(){return super.logs.map(c=>{const g=c.topics.length?q(this,l).getEvent(c.topics[0]):null;if(g)try{return new r(c,q(this,l),g)}catch(h){return new n(c,h)}return c})}}l=new WeakMap,vt.ContractTransactionReceipt=i;class s extends e.TransactionResponse{constructor(c,g,h){super(h,g);xe(this,a);ue(this,a,c)}async wait(c){const g=await super.wait(c);return g==null?null:new i(q(this,a),this.provider,g)}}a=new WeakMap,vt.ContractTransactionResponse=s;class o extends t.EventPayload{constructor(c,g,h,b){super(c,g,h);pe(this,"log");(0,t.defineProperties)(this,{log:b})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}vt.ContractUnknownEventPayload=o;class u extends o{constructor(d,c,g,h,b){super(d,c,g,new r(b,d.interface,h));const P=d.interface.decodeEventLog(h,this.log.data,this.log.topics);(0,t.defineProperties)(this,{args:P,fragment:h})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}return vt.ContractEventPayload=u,vt}var hf;function lh(){var V,D;if(hf)return Vt;hf=1,Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.Contract=Vt.BaseContract=Vt.resolveArgs=Vt.copyOverrides=void 0;const e=bs(),t=ft(),r=gs(),n=Ce(),i=uh(),s=BigInt(0);function o($){return $&&typeof $.call=="function"}function u($){return $&&typeof $.estimateGas=="function"}function l($){return $&&typeof $.resolveName=="function"}function a($){return $&&typeof $.sendTransaction=="function"}function f($){if($!=null){if(l($))return $;if($.provider)return $.provider}}class d{constructor(F,M,ee){xe(this,V);pe(this,"fragment");if((0,n.defineProperties)(this,{fragment:M}),M.inputs.length<ee.length)throw new Error("too many arguments");const de=c(F.runner,"resolveName"),Q=l(de)?de:null;ue(this,V,async function(){const ae=await Promise.all(M.inputs.map((Z,te)=>ee[te]==null?null:Z.walkAsync(ee[te],(K,W)=>K==="address"?Array.isArray(W)?Promise.all(W.map(ne=>(0,t.resolveAddress)(ne,Q))):(0,t.resolveAddress)(W,Q):W)));return F.interface.encodeFilterTopics(M,ae)}())}getTopicFilter(){return q(this,V)}}V=new WeakMap;function c($,F){return $==null?null:typeof $[F]=="function"?$:$.provider&&typeof $.provider[F]=="function"?$.provider:null}function g($){return $==null?null:$.provider||null}async function h($,F){const M=e.Typed.dereference($,"overrides");(0,n.assertArgument)(typeof M=="object","invalid overrides parameter","overrides",$);const ee=(0,r.copyRequest)(M);return(0,n.assertArgument)(ee.to==null||(F||[]).indexOf("to")>=0,"cannot override to","overrides.to",ee.to),(0,n.assertArgument)(ee.data==null||(F||[]).indexOf("data")>=0,"cannot override data","overrides.data",ee.data),ee.from&&(ee.from=ee.from),ee}Vt.copyOverrides=h;async function b($,F,M){const ee=c($,"resolveName"),de=l(ee)?ee:null;return await Promise.all(F.map((Q,ae)=>Q.walkAsync(M[ae],(Z,te)=>(te=e.Typed.dereference(te,Z),Z==="address"?(0,t.resolveAddress)(te,de):te))))}Vt.resolveArgs=b;function P($){const F=async function(ae){const Z=await h(ae,["data"]);Z.to=await $.getAddress(),Z.from&&(Z.from=await(0,t.resolveAddress)(Z.from,f($.runner)));const te=$.interface,re=(0,n.getBigInt)(Z.value||s,"overrides.value")===s,K=(Z.data||"0x")==="0x";te.fallback&&!te.fallback.payable&&te.receive&&!K&&!re&&(0,n.assertArgument)(!1,"cannot send data to receive or send value to non-payable fallback","overrides",ae),(0,n.assertArgument)(te.fallback||K,"cannot send data to receive-only contract","overrides.data",Z.data);const W=te.receive||te.fallback&&te.fallback.payable;return(0,n.assertArgument)(W||re,"cannot send value to non-payable fallback","overrides.value",Z.value),(0,n.assertArgument)(te.fallback||K,"cannot send data to receive-only contract","overrides.data",Z.data),Z},M=async function(ae){const Z=c($.runner,"call");(0,n.assert)(o(Z),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const te=await F(ae);try{return await Z.call(te)}catch(re){throw(0,n.isCallException)(re)&&re.data?$.interface.makeError(re.data,te):re}},ee=async function(ae){const Z=$.runner;(0,n.assert)(a(Z),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const te=await Z.sendTransaction(await F(ae)),re=g($.runner);return new i.ContractTransactionResponse($.interface,re,te)},de=async function(ae){const Z=c($.runner,"estimateGas");return(0,n.assert)(u(Z),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await Z.estimateGas(await F(ae))},Q=async ae=>await ee(ae);return(0,n.defineProperties)(Q,{_contract:$,estimateGas:de,populateTransaction:F,send:ee,staticCall:M}),Q}function w($,F){const M=function(...re){const K=$.interface.getFunction(F,re);return(0,n.assert)(K,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:F,args:re}}),K},ee=async function(...re){const K=M(...re);let W={};if(K.inputs.length+1===re.length&&(W=await h(re.pop()),W.from&&(W.from=await(0,t.resolveAddress)(W.from,f($.runner)))),K.inputs.length!==re.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const ne=await b($.runner,K.inputs,re);return Object.assign({},W,await(0,n.resolveProperties)({to:$.getAddress(),data:$.interface.encodeFunctionData(K,ne)}))},de=async function(...re){const K=await Z(...re);return K.length===1?K[0]:K},Q=async function(...re){const K=$.runner;(0,n.assert)(a(K),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const W=await K.sendTransaction(await ee(...re)),ne=g($.runner);return new i.ContractTransactionResponse($.interface,ne,W)},ae=async function(...re){const K=c($.runner,"estimateGas");return(0,n.assert)(u(K),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await K.estimateGas(await ee(...re))},Z=async function(...re){const K=c($.runner,"call");(0,n.assert)(o(K),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const W=await ee(...re);let ne="0x";try{ne=await K.call(W)}catch(U){throw(0,n.isCallException)(U)&&U.data?$.interface.makeError(U.data,W):U}const se=M(...re);return $.interface.decodeFunctionResult(se,ne)},te=async(...re)=>M(...re).constant?await de(...re):await Q(...re);return(0,n.defineProperties)(te,{name:$.interface.getFunctionName(F),_contract:$,_key:F,getFragment:M,estimateGas:ae,populateTransaction:ee,send:Q,staticCall:de,staticCallResult:Z}),Object.defineProperty(te,"fragment",{configurable:!1,enumerable:!0,get:()=>{const re=$.interface.getFunction(F);return(0,n.assert)(re,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:F}}),re}}),te}function y($,F){const M=function(...de){const Q=$.interface.getEvent(F,de);return(0,n.assert)(Q,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:F,args:de}}),Q},ee=function(...de){return new d($,M(...de),de)};return(0,n.defineProperties)(ee,{name:$.interface.getEventName(F),_contract:$,_key:F,getFragment:M}),Object.defineProperty(ee,"fragment",{configurable:!1,enumerable:!0,get:()=>{const de=$.interface.getEvent(F);return(0,n.assert)(de,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:F}}),de}}),ee}const v=Symbol.for("_ethersInternal_contract"),p=new WeakMap;function B($,F){p.set($[v],F)}function k($){return p.get($[v])}function R($){return $&&typeof $=="object"&&"getTopicFilter"in $&&typeof $.getTopicFilter=="function"&&$.fragment}async function T($,F){let M,ee=null;if(Array.isArray(F)){const Q=function(ae){if((0,n.isHexString)(ae,32))return ae;const Z=$.interface.getEvent(ae);return(0,n.assertArgument)(Z,"unknown fragment","name",ae),Z.topicHash};M=F.map(ae=>ae==null?null:Array.isArray(ae)?ae.map(Q):Q(ae))}else F==="*"?M=[null]:typeof F=="string"?(0,n.isHexString)(F,32)?M=[F]:(ee=$.interface.getEvent(F),(0,n.assertArgument)(ee,"unknown fragment","event",F),M=[ee.topicHash]):R(F)?M=await F.getTopicFilter():"fragment"in F?(ee=F.fragment,M=[ee.topicHash]):(0,n.assertArgument)(!1,"unknown event name","event",F);M=M.map(Q=>{if(Q==null)return null;if(Array.isArray(Q)){const ae=Array.from(new Set(Q.map(Z=>Z.toLowerCase())).values());return ae.length===1?ae[0]:(ae.sort(),ae)}return Q.toLowerCase()});const de=M.map(Q=>Q==null?"null":Array.isArray(Q)?Q.join("|"):Q).join("&");return{fragment:ee,tag:de,topics:M}}async function N($,F){const{subs:M}=k($);return M.get((await T($,F)).tag)||null}async function S($,F,M){const ee=g($.runner);(0,n.assert)(ee,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:F});const{fragment:de,tag:Q,topics:ae}=await T($,M),{addr:Z,subs:te}=k($);let re=te.get(Q);if(!re){const W={address:Z||$,topics:ae},ne=z=>{let oe=de;if(oe==null)try{oe=$.interface.getEvent(z.topics[0])}catch{}if(oe){const Y=oe,he=de?$.interface.decodeEventLog(de,z.data,z.topics):[];A($,M,he,we=>new i.ContractEventPayload($,we,M,Y,z))}else A($,M,[],Y=>new i.ContractUnknownEventPayload($,Y,M,z))};let se=[];re={tag:Q,listeners:[],start:()=>{se.length||se.push(ee.on(W,ne))},stop:async()=>{if(se.length==0)return;let z=se;se=[],await Promise.all(z),ee.off(W,ne)}},te.set(Q,re)}return re}let E=Promise.resolve();async function x($,F,M,ee){await E;const de=await N($,F);if(!de)return!1;const Q=de.listeners.length;return de.listeners=de.listeners.filter(({listener:ae,once:Z})=>{const te=Array.from(M);ee&&te.push(ee(Z?null:ae));try{ae.call($,...te)}catch{}return!Z}),de.listeners.length===0&&(de.stop(),k($).subs.delete(de.tag)),Q>0}async function A($,F,M,ee){try{await E}catch{}const de=x($,F,M,ee);return E=de,await de}const O=["then"];D=v;const j=class j{constructor(F,M,ee,de){pe(this,"target");pe(this,"interface");pe(this,"runner");pe(this,"filters");pe(this,D);pe(this,"fallback");(0,n.assertArgument)(typeof F=="string"||(0,t.isAddressable)(F),"invalid value for Contract target","target",F),ee==null&&(ee=null);const Q=e.Interface.from(M);(0,n.defineProperties)(this,{target:F,runner:ee,interface:Q}),Object.defineProperty(this,v,{value:{}});let ae,Z=null,te=null;if(de){const W=g(ee);te=new i.ContractTransactionResponse(this.interface,W,de)}let re=new Map;if(typeof F=="string")if((0,n.isHexString)(F))Z=F,ae=Promise.resolve(F);else{const W=c(ee,"resolveName");if(!l(W))throw(0,n.makeError)("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});ae=W.resolveName(F).then(ne=>{if(ne==null)throw(0,n.makeError)("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:F});return k(this).addr=ne,ne})}else ae=F.getAddress().then(W=>{if(W==null)throw new Error("TODO");return k(this).addr=W,W});B(this,{addrPromise:ae,addr:Z,deployTx:te,subs:re});const K=new Proxy({},{get:(W,ne,se)=>{if(typeof ne=="symbol"||O.indexOf(ne)>=0)return Reflect.get(W,ne,se);try{return this.getEvent(ne)}catch(U){if(!(0,n.isError)(U,"INVALID_ARGUMENT")||U.argument!=="key")throw U}},has:(W,ne)=>O.indexOf(ne)>=0?Reflect.has(W,ne):Reflect.has(W,ne)||this.interface.hasEvent(String(ne))});return(0,n.defineProperties)(this,{filters:K}),(0,n.defineProperties)(this,{fallback:Q.receive||Q.fallback?P(this):null}),new Proxy(this,{get:(W,ne,se)=>{if(typeof ne=="symbol"||ne in W||O.indexOf(ne)>=0)return Reflect.get(W,ne,se);try{return W.getFunction(ne)}catch(U){if(!(0,n.isError)(U,"INVALID_ARGUMENT")||U.argument!=="key")throw U}},has:(W,ne)=>typeof ne=="symbol"||ne in W||O.indexOf(ne)>=0?Reflect.has(W,ne):W.interface.hasFunction(ne)})}connect(F){return new j(this.target,this.interface,F)}attach(F){return new j(F,this.interface,this.runner)}async getAddress(){return await k(this).addrPromise}async getDeployedCode(){const F=g(this.runner);(0,n.assert)(F,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const M=await F.getCode(await this.getAddress());return M==="0x"?null:M}async waitForDeployment(){const F=this.deploymentTransaction();if(F)return await F.wait(),this;if(await this.getDeployedCode()!=null)return this;const ee=g(this.runner);return(0,n.assert)(ee!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((de,Q)=>{const ae=async()=>{try{if(await this.getDeployedCode()!=null)return de(this);ee.once("block",ae)}catch(Z){Q(Z)}};ae()})}deploymentTransaction(){return k(this).deployTx}getFunction(F){return typeof F!="string"&&(F=F.format()),w(this,F)}getEvent(F){return typeof F!="string"&&(F=F.format()),y(this,F)}async queryTransaction(F){throw new Error("@TODO")}async queryFilter(F,M,ee){M==null&&(M=0),ee==null&&(ee="latest");const{addr:de,addrPromise:Q}=k(this),ae=de||await Q,{fragment:Z,topics:te}=await T(this,F),re={address:ae,topics:te,fromBlock:M,toBlock:ee},K=g(this.runner);return(0,n.assert)(K,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await K.getLogs(re)).map(W=>{let ne=Z;if(ne==null)try{ne=this.interface.getEvent(W.topics[0])}catch{}if(ne)try{return new i.EventLog(W,this.interface,ne)}catch(se){return new i.UndecodedEventLog(W,se)}return new r.Log(W,K)})}async on(F,M){const ee=await S(this,"on",F);return ee.listeners.push({listener:M,once:!1}),ee.start(),this}async once(F,M){const ee=await S(this,"once",F);return ee.listeners.push({listener:M,once:!0}),ee.start(),this}async emit(F,...M){return await A(this,F,M,null)}async listenerCount(F){if(F){const de=await N(this,F);return de?de.listeners.length:0}const{subs:M}=k(this);let ee=0;for(const{listeners:de}of M.values())ee+=de.length;return ee}async listeners(F){if(F){const de=await N(this,F);return de?de.listeners.map(({listener:Q})=>Q):[]}const{subs:M}=k(this);let ee=[];for(const{listeners:de}of M.values())ee=ee.concat(de.map(({listener:Q})=>Q));return ee}async off(F,M){const ee=await N(this,F);if(!ee)return this;if(M){const de=ee.listeners.map(({listener:Q})=>Q).indexOf(M);de>=0&&ee.listeners.splice(de,1)}return(M==null||ee.listeners.length===0)&&(ee.stop(),k(this).subs.delete(ee.tag)),this}async removeAllListeners(F){if(F){const M=await N(this,F);if(!M)return this;M.stop(),k(this).subs.delete(M.tag)}else{const{subs:M}=k(this);for(const{tag:ee,stop:de}of M.values())de(),M.delete(ee)}return this}async addListener(F,M){return await this.on(F,M)}async removeListener(F,M){return await this.off(F,M)}static buildClass(F){class M extends j{constructor(de,Q=null){super(de,F,Q)}}return M}static from(F,M,ee){return ee==null&&(ee=null),new this(F,M,ee)}};let I=j;Vt.BaseContract=I;function L(){return I}class H extends L(){}return Vt.Contract=H,Vt}var yi={},pf;function vm(){if(pf)return yi;pf=1,Object.defineProperty(yi,"__esModule",{value:!0}),yi.ContractFactory=void 0;const e=bs(),t=ft(),r=Ce(),n=lh();class i{constructor(o,u,l){pe(this,"interface");pe(this,"bytecode");pe(this,"runner");const a=e.Interface.from(o);u instanceof Uint8Array||(typeof u=="object"&&(u=u.object),u.startsWith("0x")||(u="0x"+u)),u=(0,r.hexlify)((0,r.getBytes)(u)),(0,r.defineProperties)(this,{bytecode:u,interface:a,runner:l||null})}attach(o){return new n.BaseContract(o,this.interface,this.runner)}async getDeployTransaction(...o){let u={};const l=this.interface.deploy;if(l.inputs.length+1===o.length&&(u=await(0,n.copyOverrides)(o.pop())),l.inputs.length!==o.length)throw new Error("incorrect number of arguments to constructor");const a=await(0,n.resolveArgs)(this.runner,l.inputs,o),f=(0,r.concat)([this.bytecode,this.interface.encodeDeploy(a)]);return Object.assign({},u,{data:f})}async deploy(...o){const u=await this.getDeployTransaction(...o);(0,r.assert)(this.runner&&typeof this.runner.sendTransaction=="function","factory runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const l=await this.runner.sendTransaction(u),a=(0,t.getCreateAddress)(l);return new n.BaseContract(a,this.interface,this.runner,l)}connect(o){return new i(this.interface,this.bytecode,o)}static fromSolidity(o,u){(0,r.assertArgument)(o!=null,"bad compiler output","output",o),typeof o=="string"&&(o=JSON.parse(o));const l=o.abi;let a="";return o.bytecode?a=o.bytecode:o.evm&&o.evm.bytecode&&(a=o.evm.bytecode),new this(l,a,u)}}return yi.ContractFactory=i,yi}var bf;function so(){return bf||(bf=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.UndecodedEventLog=e.EventLog=e.ContractTransactionResponse=e.ContractTransactionReceipt=e.ContractUnknownEventPayload=e.ContractEventPayload=e.ContractFactory=e.Contract=e.BaseContract=void 0;var t=lh();Object.defineProperty(e,"BaseContract",{enumerable:!0,get:function(){return t.BaseContract}}),Object.defineProperty(e,"Contract",{enumerable:!0,get:function(){return t.Contract}});var r=vm();Object.defineProperty(e,"ContractFactory",{enumerable:!0,get:function(){return r.ContractFactory}});var n=uh();Object.defineProperty(e,"ContractEventPayload",{enumerable:!0,get:function(){return n.ContractEventPayload}}),Object.defineProperty(e,"ContractUnknownEventPayload",{enumerable:!0,get:function(){return n.ContractUnknownEventPayload}}),Object.defineProperty(e,"ContractTransactionReceipt",{enumerable:!0,get:function(){return n.ContractTransactionReceipt}}),Object.defineProperty(e,"ContractTransactionResponse",{enumerable:!0,get:function(){return n.ContractTransactionResponse}}),Object.defineProperty(e,"EventLog",{enumerable:!0,get:function(){return n.EventLog}}),Object.defineProperty(e,"UndecodedEventLog",{enumerable:!0,get:function(){return n.UndecodedEventLog}})}(ca)),ca}var ua={},en={},dr={},gf;function dh(){var c,g,h,Sn,P,fh;if(gf)return dr;gf=1,Object.defineProperty(dr,"__esModule",{value:!0}),dr.EnsResolver=dr.BasicMulticoinProviderPlugin=dr.MulticoinProviderPlugin=void 0;const e=ft(),t=ps(),r=so(),n=vr(),i=Ce();function s(v){return v.match(/^ipfs:\/\/ipfs\//i)?v=v.substring(12):v.match(/^ipfs:\/\//i)?v=v.substring(7):(0,i.assertArgument)(!1,"unsupported IPFS format","link",v),`https://gateway.ipfs.io/ipfs/${v}`}class o{constructor(p){pe(this,"name");(0,i.defineProperties)(this,{name:p})}connect(p){return this}supportsCoinType(p){return!1}async encodeAddress(p,B){throw new Error("unsupported coin")}async decodeAddress(p,B){throw new Error("unsupported coin")}}dr.MulticoinProviderPlugin=o;const u="org.ethers.plugins.provider.BasicMulticoin";class l extends o{constructor(){super(u)}}dr.BasicMulticoinProviderPlugin=l;const a=new RegExp("^(ipfs)://(.*)$","i"),f=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),a,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")],y=class y{constructor(p,B,k){xe(this,h);pe(this,"provider");pe(this,"address");pe(this,"name");xe(this,c);xe(this,g);(0,i.defineProperties)(this,{provider:p,address:B,name:k}),ue(this,c,null),ue(this,g,new r.Contract(B,["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)"],p))}async supportsWildcard(){return q(this,c)==null&&ue(this,c,(async()=>{try{return await q(this,g).supportsInterface("0x9061b923")}catch(p){if((0,i.isError)(p,"CALL_EXCEPTION"))return!1;throw ue(this,c,null),p}})()),await q(this,c)}async getAddress(p){if(p==null&&(p=60),p===60)try{const T=await _e(this,h,Sn).call(this,"addr(bytes32)");return T==null||T===t.ZeroAddress?null:T}catch(T){if((0,i.isError)(T,"CALL_EXCEPTION"))return null;throw T}if(p>=0&&p<2147483648){let T=p+2147483648;const N=await _e(this,h,Sn).call(this,"addr(bytes32,uint)",[T]);if((0,i.isHexString)(N,20))return(0,e.getAddress)(N)}let B=null;for(const T of this.provider.plugins)if(T instanceof o&&T.supportsCoinType(p)){B=T;break}if(B==null)return null;const k=await _e(this,h,Sn).call(this,"addr(bytes32,uint)",[p]);if(k==null||k==="0x")return null;const R=await B.decodeAddress(p,k);if(R!=null)return R;(0,i.assert)(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${p})`,info:{coinType:p,data:k}})}async getText(p){const B=await _e(this,h,Sn).call(this,"text(bytes32,string)",[p]);return B==null||B==="0x"?null:B}async getContentHash(){const p=await _e(this,h,Sn).call(this,"contenthash(bytes32)");if(p==null||p==="0x")return null;const B=p.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(B){const R=B[1]==="e3010170"?"ipfs":"ipns",T=parseInt(B[4],16);if(B[5].length===T*2)return`${R}://${(0,i.encodeBase58)("0x"+B[2])}`}const k=p.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(k&&k[1].length===64)return`bzz://${k[1]}`;(0,i.assert)(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:p}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const p=[{type:"name",value:this.name}];try{const B=await this.getText("avatar");if(B==null)return p.push({type:"!avatar",value:""}),{url:null,linkage:p};p.push({type:"avatar",value:B});for(let k=0;k<f.length;k++){const R=B.match(f[k]);if(R==null)continue;const T=R[1].toLowerCase();switch(T){case"https":case"data":return p.push({type:"url",value:B}),{linkage:p,url:B};case"ipfs":{const N=s(B);return p.push({type:"ipfs",value:B}),p.push({type:"url",value:N}),{linkage:p,url:N}}case"erc721":case"erc1155":{const N=T==="erc721"?"tokenURI(uint256)":"uri(uint256)";p.push({type:T,value:B});const S=await this.getAddress();if(S==null)return p.push({type:"!owner",value:""}),{url:null,linkage:p};const E=(R[2]||"").split("/");if(E.length!==2)return p.push({type:`!${T}caip`,value:R[2]||""}),{url:null,linkage:p};const x=E[1],A=new r.Contract(E[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(T==="erc721"){const V=await A.ownerOf(x);if(S!==V)return p.push({type:"!owner",value:V}),{url:null,linkage:p};p.push({type:"owner",value:V})}else if(T==="erc1155"){const V=await A.balanceOf(S,x);if(!V)return p.push({type:"!balance",value:"0"}),{url:null,linkage:p};p.push({type:"balance",value:V.toString()})}let O=await A[N](x);if(O==null||O==="0x")return p.push({type:"!metadata-url",value:""}),{url:null,linkage:p};p.push({type:"metadata-url-base",value:O}),T==="erc1155"&&(O=O.replace("{id}",(0,i.toBeHex)(x,32).substring(2)),p.push({type:"metadata-url-expanded",value:O})),O.match(/^ipfs:/i)&&(O=s(O)),p.push({type:"metadata-url",value:O});let I={};const L=await new i.FetchRequest(O).send();L.assertOk();try{I=L.bodyJson}catch{try{p.push({type:"!metadata",value:L.bodyText})}catch{const j=L.body;return j&&p.push({type:"!metadata",value:(0,i.hexlify)(j)}),{url:null,linkage:p}}return{url:null,linkage:p}}if(!I)return p.push({type:"!metadata",value:""}),{url:null,linkage:p};p.push({type:"metadata",value:JSON.stringify(I)});let H=I.image;if(typeof H!="string")return p.push({type:"!imageUrl",value:""}),{url:null,linkage:p};if(!H.match(/^(https:\/\/|data:)/i)){if(H.match(a)==null)return p.push({type:"!imageUrl-ipfs",value:H}),{url:null,linkage:p};p.push({type:"imageUrl-ipfs",value:H}),H=s(H)}return p.push({type:"url",value:H}),{linkage:p,url:H}}}}}catch{}return{linkage:p,url:null}}static async getEnsAddress(p){const B=await p.getNetwork(),k=B.getPlugin("org.ethers.plugins.network.Ens");return(0,i.assert)(k,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:B}}),k.address}static async fromName(p,B){var R;let k=B;for(;;){if(k===""||k==="."||B!=="eth"&&k==="eth")return null;const T=await _e(R=y,P,fh).call(R,p,k);if(T!=null){const N=new y(p,T,B);return k!==B&&!await N.supportsWildcard()?null:N}k=k.split(".").slice(1).join(".")}}};c=new WeakMap,g=new WeakMap,h=new WeakSet,Sn=async function(p,B){B=(B||[]).slice();const k=q(this,g).interface;B.unshift((0,n.namehash)(this.name));let R=null;await this.supportsWildcard()&&(R=k.getFunction(p),(0,i.assert)(R,"missing fragment","UNKNOWN_ERROR",{info:{funcName:p}}),B=[(0,n.dnsEncode)(this.name),k.encodeFunctionData(R,B)],p="resolve(bytes,bytes)"),B.push({enableCcipRead:!0});try{const T=await q(this,g)[p](...B);return R?k.decodeFunctionResult(R,T)[0]:T}catch(T){if(!(0,i.isError)(T,"CALL_EXCEPTION"))throw T}return null},P=new WeakSet,fh=async function(p,B){const k=await y.getEnsAddress(p);try{const T=await new r.Contract(k,["function resolver(bytes32) view returns (address)"],p).resolver((0,n.namehash)(B),{enableCcipRead:!0});return T===t.ZeroAddress?null:T}catch(R){throw R}return null},xe(y,P);let d=y;return dr.EnsResolver=d,dr}var Ye={},mf;function _m(){if(mf)return Ye;mf=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.formatTransactionResponse=Ye.formatTransactionReceipt=Ye.formatReceiptLog=Ye.formatBlock=Ye.formatLog=Ye.formatUint256=Ye.formatHash=Ye.formatData=Ye.formatBoolean=Ye.object=Ye.arrayOf=Ye.allowNull=void 0;const e=ft(),t=ht(),r=Ut(),n=Ce(),i=BigInt(0);function s(B,k){return function(R){return R==null?k:B(R)}}Ye.allowNull=s;function o(B){return k=>{if(!Array.isArray(k))throw new Error("not an array");return k.map(R=>B(R))}}Ye.arrayOf=o;function u(B,k){return R=>{const T={};for(const N in B){let S=N;if(k&&N in k&&!(S in R)){for(const E of k[N])if(E in R){S=E;break}}try{const E=B[N](R[S]);E!==void 0&&(T[N]=E)}catch(E){const x=E instanceof Error?E.message:"not-an-error";(0,n.assert)(!1,`invalid value for value.${N} (${x})`,"BAD_DATA",{value:R})}}return T}}Ye.object=u;function l(B){switch(B){case!0:case"true":return!0;case!1:case"false":return!1}(0,n.assertArgument)(!1,`invalid boolean; ${JSON.stringify(B)}`,"value",B)}Ye.formatBoolean=l;function a(B){return(0,n.assertArgument)((0,n.isHexString)(B,!0),"invalid data","value",B),B}Ye.formatData=a;function f(B){return(0,n.assertArgument)((0,n.isHexString)(B,32),"invalid hash","value",B),B}Ye.formatHash=f;function d(B){if(!(0,n.isHexString)(B))throw new Error("invalid uint256");return(0,n.zeroPadValue)(B,32)}Ye.formatUint256=d;const c=u({address:e.getAddress,blockHash:f,blockNumber:n.getNumber,data:a,index:n.getNumber,removed:s(l,!1),topics:o(f),transactionHash:f,transactionIndex:n.getNumber},{index:["logIndex"]});function g(B){return c(B)}Ye.formatLog=g;const h=u({hash:s(f),parentHash:f,number:n.getNumber,timestamp:n.getNumber,nonce:s(a),difficulty:n.getBigInt,gasLimit:n.getBigInt,gasUsed:n.getBigInt,miner:s(e.getAddress),extraData:a,baseFeePerGas:s(n.getBigInt)});function b(B){const k=h(B);return k.transactions=B.transactions.map(R=>typeof R=="string"?R:p(R)),k}Ye.formatBlock=b;const P=u({transactionIndex:n.getNumber,blockNumber:n.getNumber,transactionHash:f,address:e.getAddress,topics:o(f),data:a,index:n.getNumber,blockHash:f},{index:["logIndex"]});function w(B){return P(B)}Ye.formatReceiptLog=w;const y=u({to:s(e.getAddress,null),from:s(e.getAddress,null),contractAddress:s(e.getAddress,null),index:n.getNumber,root:s(n.hexlify),gasUsed:n.getBigInt,logsBloom:s(a),blockHash:f,hash:f,logs:o(w),blockNumber:n.getNumber,cumulativeGasUsed:n.getBigInt,effectiveGasPrice:s(n.getBigInt),status:s(n.getNumber),type:s(n.getNumber,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function v(B){return y(B)}Ye.formatTransactionReceipt=v;function p(B){B.to&&(0,n.getBigInt)(B.to)===i&&(B.to="0x0000000000000000000000000000000000000000");const k=u({hash:f,type:R=>R==="0x"||R==null?0:(0,n.getNumber)(R),accessList:s(r.accessListify,null),blockHash:s(f,null),blockNumber:s(n.getNumber,null),transactionIndex:s(n.getNumber,null),from:e.getAddress,gasPrice:s(n.getBigInt),maxPriorityFeePerGas:s(n.getBigInt),maxFeePerGas:s(n.getBigInt),gasLimit:n.getBigInt,to:s(e.getAddress,null),value:n.getBigInt,nonce:n.getNumber,data:a,creates:s(e.getAddress,null),chainId:s(n.getBigInt,null)},{data:["input"],gasLimit:["gas"]})(B);if(k.to==null&&k.creates==null&&(k.creates=(0,e.getCreateAddress)(k)),(B.type===1||B.type===2)&&B.accessList==null&&(k.accessList=[]),B.signature?k.signature=t.Signature.from(B.signature):k.signature=t.Signature.from(B),k.chainId==null){const R=k.signature.legacyChainId;R!=null&&(k.chainId=R)}return k.blockHash&&(0,n.getBigInt)(k.blockHash)===i&&(k.blockHash=null),k}return Ye.formatTransactionResponse=p,Ye}var xi={},Nt={},yf;function Uc(){var l,f,d;if(yf)return Nt;yf=1,Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.FetchUrlFeeDataNetworkPlugin=Nt.FeeDataNetworkPlugin=Nt.EnsPlugin=Nt.GasCostPlugin=Nt.NetworkPlugin=void 0;const e=gn(),t=Ce(),r="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class n{constructor(g){pe(this,"name");(0,e.defineProperties)(this,{name:g})}clone(){return new n(this.name)}}Nt.NetworkPlugin=n;class i extends n{constructor(h,b){h==null&&(h=0);super(`org.ethers.network.plugins.GasCost#${h||0}`);pe(this,"effectiveBlock");pe(this,"txBase");pe(this,"txCreate");pe(this,"txDataZero");pe(this,"txDataNonzero");pe(this,"txAccessListStorageKey");pe(this,"txAccessListAddress");const P={effectiveBlock:h};function w(y,v){let p=(b||{})[y];p==null&&(p=v),(0,t.assertArgument)(typeof p=="number",`invalud value for ${y}`,"costs",b),P[y]=p}w("txBase",21e3),w("txCreate",32e3),w("txDataZero",4),w("txDataNonzero",16),w("txAccessListStorageKey",1900),w("txAccessListAddress",2400),(0,e.defineProperties)(this,P)}clone(){return new i(this.effectiveBlock,this)}}Nt.GasCostPlugin=i;class s extends n{constructor(h,b){super("org.ethers.plugins.network.Ens");pe(this,"address");pe(this,"targetNetwork");(0,e.defineProperties)(this,{address:h||r,targetNetwork:b??1})}clone(){return new s(this.address,this.targetNetwork)}}Nt.EnsPlugin=s;const a=class a extends n{constructor(h){super("org.ethers.plugins.network.FeeData");xe(this,l);ue(this,l,h)}get feeDataFunc(){return q(this,l)}async getFeeData(h){return await q(this,l).call(this,h)}clone(){return new a(q(this,l))}};l=new WeakMap;let o=a;Nt.FeeDataNetworkPlugin=o;class u extends n{constructor(h,b){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");xe(this,f);xe(this,d);ue(this,f,h),ue(this,d,b)}get url(){return q(this,f)}get processFunc(){return q(this,d)}clone(){return this}}return f=new WeakMap,d=new WeakMap,Nt.FetchUrlFeeDataNetworkPlugin=u,Nt}var xf;function Ht(){var f,d,c;if(xf)return xi;xf=1,Object.defineProperty(xi,"__esModule",{value:!0}),xi.Network=void 0;const e=Ut(),t=Ce(),r=Uc(),n=new Map,g=class g{constructor(b,P){xe(this,f);xe(this,d);xe(this,c);ue(this,f,b),ue(this,d,(0,t.getBigInt)(P)),ue(this,c,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return q(this,f)}set name(b){ue(this,f,b)}get chainId(){return q(this,d)}set chainId(b){ue(this,d,(0,t.getBigInt)(b,"chainId"))}matches(b){if(b==null)return!1;if(typeof b=="string"){try{return this.chainId===(0,t.getBigInt)(b)}catch{}return this.name===b}if(typeof b=="number"||typeof b=="bigint"){try{return this.chainId===(0,t.getBigInt)(b)}catch{}return!1}if(typeof b=="object"){if(b.chainId!=null){try{return this.chainId===(0,t.getBigInt)(b.chainId)}catch{}return!1}return b.name!=null?this.name===b.name:!1}return!1}get plugins(){return Array.from(q(this,c).values())}attachPlugin(b){if(q(this,c).get(b.name))throw new Error(`cannot replace existing plugin: ${b.name} `);return q(this,c).set(b.name,b.clone()),this}getPlugin(b){return q(this,c).get(b)||null}getPlugins(b){return this.plugins.filter(P=>P.name.split("#")[0]===b)}clone(){const b=new g(this.name,this.chainId);return this.plugins.forEach(P=>{b.attachPlugin(P.clone())}),b}computeIntrinsicGas(b){const P=this.getPlugin("org.ethers.plugins.network.GasCost")||new r.GasCostPlugin;let w=P.txBase;if(b.to==null&&(w+=P.txCreate),b.data)for(let y=2;y<b.data.length;y+=2)b.data.substring(y,y+2)==="00"?w+=P.txDataZero:w+=P.txDataNonzero;if(b.accessList){const y=(0,e.accessListify)(b.accessList);for(const v in y)w+=P.txAccessListAddress+P.txAccessListStorageKey*y[v].storageKeys.length}return w}static from(b){if(a(),b==null)return g.from("mainnet");if(typeof b=="number"&&(b=BigInt(b)),typeof b=="string"||typeof b=="bigint"){const P=n.get(b);if(P)return P();if(typeof b=="bigint")return new g("unknown",b);(0,t.assertArgument)(!1,"unknown network","network",b)}if(typeof b.clone=="function")return b.clone();if(typeof b=="object"){(0,t.assertArgument)(typeof b.name=="string"&&typeof b.chainId=="number","invalid network object name or chainId","network",b);const P=new g(b.name,b.chainId);return(b.ensAddress||b.ensNetwork!=null)&&P.attachPlugin(new r.EnsPlugin(b.ensAddress,b.ensNetwork)),P}(0,t.assertArgument)(!1,"invalid network","network",b)}static register(b,P){typeof b=="number"&&(b=BigInt(b));const w=n.get(b);w&&(0,t.assertArgument)(!1,`conflicting network for ${JSON.stringify(w.name)}`,"nameOrChainId",b),n.set(b,P)}};f=new WeakMap,d=new WeakMap,c=new WeakMap;let i=g;xi.Network=i;function s(h,b){const P=String(h);if(!P.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${h}`);const w=P.split(".");if(w.length===1&&w.push(""),w.length!==2)throw new Error(`invalid gwei value: ${h}`);for(;w[1].length<b;)w[1]+="0";if(w[1].length>9){let y=BigInt(w[1].substring(0,9));w[1].substring(9).match(/^0+$/)||y++,w[1]=y.toString()}return BigInt(w[0]+w[1])}function o(h){return new r.FetchUrlFeeDataNetworkPlugin(h,async(b,P,w)=>{w.setHeader("User-Agent","ethers");let y;try{const[v,p]=await Promise.all([w.send(),b()]);y=v;const B=y.bodyJson.standard;return{gasPrice:p.gasPrice,maxFeePerGas:s(B.maxFee,9),maxPriorityFeePerGas:s(B.maxPriorityFee,9)}}catch(v){(0,t.assert)(!1,`error encountered with polygon gas station (${JSON.stringify(w.url)})`,"SERVER_ERROR",{request:w,response:y,error:v})}})}function u(h){return new r.FetchUrlFeeDataNetworkPlugin("data:",async(b,P,w)=>{const y=await b();if(y.maxFeePerGas==null||y.maxPriorityFeePerGas==null)return y;const v=y.maxFeePerGas-y.maxPriorityFeePerGas;return{gasPrice:y.gasPrice,maxFeePerGas:v+h,maxPriorityFeePerGas:h}})}let l=!1;function a(){if(l)return;l=!0;function h(b,P,w){const y=function(){const v=new i(b,P);return w.ensNetwork!=null&&v.attachPlugin(new r.EnsPlugin(null,w.ensNetwork)),v.attachPlugin(new r.GasCostPlugin),(w.plugins||[]).forEach(p=>{v.attachPlugin(p)}),v};i.register(b,y),i.register(P,y),w.altNames&&w.altNames.forEach(v=>{i.register(v,y)})}h("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),h("ropsten",3,{ensNetwork:3}),h("rinkeby",4,{ensNetwork:4}),h("goerli",5,{ensNetwork:5}),h("kovan",42,{ensNetwork:42}),h("sepolia",11155111,{}),h("classic",61,{}),h("classicKotti",6,{}),h("arbitrum",42161,{ensNetwork:1}),h("arbitrum-goerli",421613,{}),h("bnb",56,{ensNetwork:1}),h("bnbt",97,{}),h("linea",59144,{ensNetwork:1}),h("linea-goerli",59140,{}),h("matic",137,{ensNetwork:1,plugins:[o("https://gasstation.polygon.technology/v2")]}),h("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[o("https://gasstation-testnet.polygon.technology/v2")]}),h("optimism",10,{ensNetwork:1,plugins:[u(BigInt("1000000"))]}),h("optimism-goerli",420,{}),h("xdai",100,{ensNetwork:1})}return xi}var _t={},wf;function Fc(){var l,a,f,d,c,Ls,h,b,P,w,y,v,p,B,k,R,T,hh;if(wf)return _t;wf=1,Object.defineProperty(_t,"__esModule",{value:!0}),_t.PollingEventSubscriber=_t.PollingTransactionSubscriber=_t.PollingOrphanSubscriber=_t.OnBlockSubscriber=_t.PollingBlockSubscriber=_t.getPollingSubscriber=void 0;const e=Ce();function t(S){return JSON.parse(JSON.stringify(S))}function r(S,E){if(E==="block")return new n(S);if((0,e.isHexString)(E,32))return new o(S,E);(0,e.assert)(!1,"unsupported polling event","UNSUPPORTED_OPERATION",{operation:"getPollingSubscriber",info:{event:E}})}_t.getPollingSubscriber=r;class n{constructor(E){xe(this,c);xe(this,l);xe(this,a);xe(this,f);xe(this,d);ue(this,l,E),ue(this,a,null),ue(this,f,4e3),ue(this,d,-2)}get pollingInterval(){return q(this,f)}set pollingInterval(E){ue(this,f,E)}start(){q(this,a)||(ue(this,a,q(this,l)._setTimeout(_e(this,c,Ls).bind(this),q(this,f))),_e(this,c,Ls).call(this))}stop(){q(this,a)&&(q(this,l)._clearTimeout(q(this,a)),ue(this,a,null))}pause(E){this.stop(),E&&ue(this,d,-2)}resume(){this.start()}}l=new WeakMap,a=new WeakMap,f=new WeakMap,d=new WeakMap,c=new WeakSet,Ls=async function(){try{const E=await q(this,l).getBlockNumber();if(q(this,d)===-2){ue(this,d,E);return}if(E!==q(this,d)){for(let x=q(this,d)+1;x<=E;x++){if(q(this,a)==null)return;await q(this,l).emit("block",x)}ue(this,d,E)}}catch{}q(this,a)!=null&&ue(this,a,q(this,l)._setTimeout(_e(this,c,Ls).bind(this),q(this,f)))},_t.PollingBlockSubscriber=n;class i{constructor(E){xe(this,h);xe(this,b);xe(this,P);ue(this,h,E),ue(this,P,!1),ue(this,b,x=>{this._poll(x,q(this,h))})}async _poll(E,x){throw new Error("sub-classes must override this")}start(){q(this,P)||(ue(this,P,!0),q(this,b).call(this,-2),q(this,h).on("block",q(this,b)))}stop(){q(this,P)&&(ue(this,P,!1),q(this,h).off("block",q(this,b)))}pause(E){this.stop()}resume(){this.start()}}h=new WeakMap,b=new WeakMap,P=new WeakMap,_t.OnBlockSubscriber=i;class s extends i{constructor(x,A){super(x);xe(this,w);ue(this,w,t(A))}async _poll(x,A){throw new Error("@TODO")}}w=new WeakMap,_t.PollingOrphanSubscriber=s;class o extends i{constructor(x,A){super(x);xe(this,y);ue(this,y,A)}async _poll(x,A){const O=await A.getTransactionReceipt(q(this,y));O&&A.emit(q(this,y),O)}}y=new WeakMap,_t.PollingTransactionSubscriber=o;class u{constructor(E,x){xe(this,T);xe(this,v);xe(this,p);xe(this,B);xe(this,k);xe(this,R);ue(this,v,E),ue(this,p,t(x)),ue(this,B,_e(this,T,hh).bind(this)),ue(this,k,!1),ue(this,R,-2)}start(){q(this,k)||(ue(this,k,!0),q(this,R)===-2&&q(this,v).getBlockNumber().then(E=>{ue(this,R,E)}),q(this,v).on("block",q(this,B)))}stop(){q(this,k)&&(ue(this,k,!1),q(this,v).off("block",q(this,B)))}pause(E){this.stop(),E&&ue(this,R,-2)}resume(){this.start()}}return v=new WeakMap,p=new WeakMap,B=new WeakMap,k=new WeakMap,R=new WeakMap,T=new WeakSet,hh=async function(E){if(q(this,R)===-2)return;const x=t(q(this,p));x.fromBlock=q(this,R)+1,x.toBlock=E;const A=await q(this,v).getLogs(x);if(A.length===0){q(this,R)<E-60&&ue(this,R,E-60);return}for(const O of A)q(this,v).emit(q(this,p),O),ue(this,R,O.blockNumber)},_t.PollingEventSubscriber=u,_t}var Af;function ms(){var O,I,L,H,V,D,j,$,F,M,ee,de,Q,jt,qa,Va,is,za,ss,Us;if(Af)return en;Af=1,Object.defineProperty(en,"__esModule",{value:!0}),en.AbstractProvider=en.UnmanagedSubscriber=void 0;const e=ft(),t=ps(),r=so(),n=vr(),i=Ut(),s=Ce(),o=dh(),u=_m(),l=Ht(),a=gs(),f=Fc(),d=BigInt(2),c=10;function g(se){return se&&typeof se.then=="function"}function h(se,U){return se+":"+JSON.stringify(U,(J,z)=>{if(z==null)return"null";if(typeof z=="bigint")return`bigint:${z.toString()}`;if(typeof z=="string")return z.toLowerCase();if(typeof z=="object"&&!Array.isArray(z)){const oe=Object.keys(z);return oe.sort(),oe.reduce((Y,he)=>(Y[he]=z[he],Y),{})}return z})}class b{constructor(U){pe(this,"name");(0,s.defineProperties)(this,{name:U})}start(){}stop(){}pause(U){}resume(){}}en.UnmanagedSubscriber=b;function P(se){return JSON.parse(JSON.stringify(se))}function w(se){return se=Array.from(new Set(se).values()),se.sort(),se}async function y(se,U){if(se==null)throw new Error("invalid event");if(Array.isArray(se)&&(se={topics:se}),typeof se=="string")switch(se){case"block":case"pending":case"debug":case"error":case"network":return{type:se,tag:se}}if((0,s.isHexString)(se,32)){const J=se.toLowerCase();return{type:"transaction",tag:h("tx",{hash:J}),hash:J}}if(se.orphan){const J=se;return{type:"orphan",tag:h("orphan",J),filter:P(J)}}if(se.address||se.topics){const J=se,z={topics:(J.topics||[]).map(oe=>oe==null?null:Array.isArray(oe)?w(oe.map(Y=>Y.toLowerCase())):oe.toLowerCase())};if(J.address){const oe=[],Y=[],he=we=>{(0,s.isHexString)(we)?oe.push(we):Y.push((async()=>{oe.push(await(0,e.resolveAddress)(we,U))})())};Array.isArray(J.address)?J.address.forEach(he):he(J.address),Y.length&&await Promise.all(Y),z.address=w(oe.map(we=>we.toLowerCase()))}return{filter:z,tag:h("event",z),type:"event"}}(0,s.assertArgument)(!1,"unknown ProviderEvent","event",se)}function v(){return new Date().getTime()}const p={cacheTimeout:250,pollingInterval:4e3};class B{constructor(U,J){xe(this,Q);xe(this,O);xe(this,I);xe(this,L);xe(this,H);xe(this,V);xe(this,D);xe(this,j);xe(this,$);xe(this,F);xe(this,M);xe(this,ee);xe(this,de);if(ue(this,de,Object.assign({},p,J||{})),U==="any")ue(this,D,!0),ue(this,V,null);else if(U){const z=l.Network.from(U);ue(this,D,!1),ue(this,V,Promise.resolve(z)),setTimeout(()=>{this.emit("network",z,null)},0)}else ue(this,D,!1),ue(this,V,null);ue(this,$,-1),ue(this,j,new Map),ue(this,O,new Map),ue(this,I,new Map),ue(this,L,null),ue(this,H,!1),ue(this,F,1),ue(this,M,new Map),ue(this,ee,!1)}get pollingInterval(){return q(this,de).pollingInterval}get provider(){return this}get plugins(){return Array.from(q(this,I).values())}attachPlugin(U){if(q(this,I).get(U.name))throw new Error(`cannot replace existing plugin: ${U.name} `);return q(this,I).set(U.name,U.connect(this)),this}getPlugin(U){return q(this,I).get(U)||null}get disableCcipRead(){return q(this,ee)}set disableCcipRead(U){ue(this,ee,!!U)}async ccipReadFetch(U,J,z){if(this.disableCcipRead||z.length===0||U.to==null)return null;const oe=U.to.toLowerCase(),Y=J.toLowerCase(),he=[];for(let we=0;we<z.length;we++){const ye=z[we],ie=ye.replace("{sender}",oe).replace("{data}",Y),ce=new s.FetchRequest(ie);ye.indexOf("{data}")===-1&&(ce.body={data:Y,sender:oe}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:ce,index:we,urls:z});let me="unknown error";const fe=await ce.send();try{const C=fe.bodyJson;if(C.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:ce,result:C}),C.data;C.message&&(me=C.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:ce,result:C})}catch{}(0,s.assert)(fe.statusCode<400||fe.statusCode>=500,`response not found during CCIP fetch: ${me}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:U,info:{url:ye,errorMessage:me}}),he.push(me)}(0,s.assert)(!1,`error encountered during CCIP fetch: ${he.map(we=>JSON.stringify(we)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:U,info:{urls:z,errorMessages:he}})}_wrapBlock(U,J){return new a.Block((0,u.formatBlock)(U),this)}_wrapLog(U,J){return new a.Log((0,u.formatLog)(U),this)}_wrapTransactionReceipt(U,J){return new a.TransactionReceipt((0,u.formatTransactionReceipt)(U),this)}_wrapTransactionResponse(U,J){return new a.TransactionResponse((0,u.formatTransactionResponse)(U),this)}_detectNetwork(){(0,s.assert)(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(U){(0,s.assert)(!1,`unsupported method: ${U.method}`,"UNSUPPORTED_OPERATION",{operation:U.method,info:U})}async getBlockNumber(){const U=(0,s.getNumber)(await _e(this,Q,jt).call(this,{method:"getBlockNumber"}),"%response");return q(this,$)>=0&&ue(this,$,U),U}_getAddress(U){return(0,e.resolveAddress)(U,this)}_getBlockTag(U){if(U==null)return"latest";switch(U){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return U}if((0,s.isHexString)(U))return(0,s.isHexString)(U,32)?U:(0,s.toQuantity)(U);if(typeof U=="bigint"&&(U=(0,s.getNumber)(U,"blockTag")),typeof U=="number")return U>=0?(0,s.toQuantity)(U):q(this,$)>=0?(0,s.toQuantity)(q(this,$)+U):this.getBlockNumber().then(J=>(0,s.toQuantity)(J+U));(0,s.assertArgument)(!1,"invalid blockTag","blockTag",U)}_getFilter(U){const J=(U.topics||[]).map(ye=>ye==null?null:Array.isArray(ye)?w(ye.map(ie=>ie.toLowerCase())):ye.toLowerCase()),z="blockHash"in U?U.blockHash:void 0,oe=(ye,ie,ce)=>{let me;switch(ye.length){case 0:break;case 1:me=ye[0];break;default:ye.sort(),me=ye}if(z&&(ie!=null||ce!=null))throw new Error("invalid filter");const fe={};return me&&(fe.address=me),J.length&&(fe.topics=J),ie&&(fe.fromBlock=ie),ce&&(fe.toBlock=ce),z&&(fe.blockHash=z),fe};let Y=[];if(U.address)if(Array.isArray(U.address))for(const ye of U.address)Y.push(this._getAddress(ye));else Y.push(this._getAddress(U.address));let he;"fromBlock"in U&&(he=this._getBlockTag(U.fromBlock));let we;return"toBlock"in U&&(we=this._getBlockTag(U.toBlock)),Y.filter(ye=>typeof ye!="string").length||he!=null&&typeof he!="string"||we!=null&&typeof we!="string"?Promise.all([Promise.all(Y),he,we]).then(ye=>oe(ye[0],ye[1],ye[2])):oe(Y,he,we)}_getTransactionRequest(U){const J=(0,a.copyRequest)(U),z=[];if(["to","from"].forEach(oe=>{if(J[oe]==null)return;const Y=(0,e.resolveAddress)(J[oe],this);g(Y)?z.push(async function(){J[oe]=await Y}()):J[oe]=Y}),J.blockTag!=null){const oe=this._getBlockTag(J.blockTag);g(oe)?z.push(async function(){J.blockTag=await oe}()):J.blockTag=oe}return z.length?async function(){return await Promise.all(z),J}():J}async getNetwork(){if(q(this,V)==null){const oe=this._detectNetwork().then(Y=>(this.emit("network",Y,null),Y),Y=>{throw q(this,V)===oe&&ue(this,V,null),Y});return ue(this,V,oe),(await oe).clone()}const U=q(this,V),[J,z]=await Promise.all([U,this._detectNetwork()]);return J.chainId!==z.chainId&&(q(this,D)?(this.emit("network",z,J),q(this,V)===U&&ue(this,V,Promise.resolve(z))):(0,s.assert)(!1,`network changed: ${J.chainId} => ${z.chainId} `,"NETWORK_ERROR",{event:"changed"})),J.clone()}async getFeeData(){const U=await this.getNetwork(),J=async()=>{const{_block:oe,gasPrice:Y}=await(0,s.resolveProperties)({_block:_e(this,Q,za).call(this,"latest",!1),gasPrice:(async()=>{try{const ie=await _e(this,Q,jt).call(this,{method:"getGasPrice"});return(0,s.getBigInt)(ie,"%response")}catch{}return null})()});let he=null,we=null;const ye=this._wrapBlock(oe,U);return ye&&ye.baseFeePerGas&&(we=BigInt("1000000000"),he=ye.baseFeePerGas*d+we),new a.FeeData(Y,he,we)},z=U.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(z){const oe=new s.FetchRequest(z.url),Y=await z.processFunc(J,this,oe);return new a.FeeData(Y.gasPrice,Y.maxFeePerGas,Y.maxPriorityFeePerGas)}return await J()}async estimateGas(U){let J=this._getTransactionRequest(U);return g(J)&&(J=await J),(0,s.getBigInt)(await _e(this,Q,jt).call(this,{method:"estimateGas",transaction:J}),"%response")}async call(U){const{tx:J,blockTag:z}=await(0,s.resolveProperties)({tx:this._getTransactionRequest(U),blockTag:this._getBlockTag(U.blockTag)});return await _e(this,Q,Va).call(this,_e(this,Q,qa).call(this,J,z,U.enableCcipRead?0:-1))}async getBalance(U,J){return(0,s.getBigInt)(await _e(this,Q,is).call(this,{method:"getBalance"},U,J),"%response")}async getTransactionCount(U,J){return(0,s.getNumber)(await _e(this,Q,is).call(this,{method:"getTransactionCount"},U,J),"%response")}async getCode(U,J){return(0,s.hexlify)(await _e(this,Q,is).call(this,{method:"getCode"},U,J))}async getStorage(U,J,z){const oe=(0,s.getBigInt)(J,"position");return(0,s.hexlify)(await _e(this,Q,is).call(this,{method:"getStorage",position:oe},U,z))}async broadcastTransaction(U){const{blockNumber:J,hash:z,network:oe}=await(0,s.resolveProperties)({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:U}),network:this.getNetwork()}),Y=i.Transaction.from(U);if(Y.hash!==z)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(Y,oe).replaceableTransaction(J)}async getBlock(U,J){const{network:z,params:oe}=await(0,s.resolveProperties)({network:this.getNetwork(),params:_e(this,Q,za).call(this,U,!!J)});return oe==null?null:this._wrapBlock(oe,z)}async getTransaction(U){const{network:J,params:z}=await(0,s.resolveProperties)({network:this.getNetwork(),params:_e(this,Q,jt).call(this,{method:"getTransaction",hash:U})});return z==null?null:this._wrapTransactionResponse(z,J)}async getTransactionReceipt(U){const{network:J,params:z}=await(0,s.resolveProperties)({network:this.getNetwork(),params:_e(this,Q,jt).call(this,{method:"getTransactionReceipt",hash:U})});if(z==null)return null;if(z.gasPrice==null&&z.effectiveGasPrice==null){const oe=await _e(this,Q,jt).call(this,{method:"getTransaction",hash:U});if(oe==null)throw new Error("report this; could not find tx or effectiveGasPrice");z.effectiveGasPrice=oe.gasPrice}return this._wrapTransactionReceipt(z,J)}async getTransactionResult(U){const{result:J}=await(0,s.resolveProperties)({network:this.getNetwork(),result:_e(this,Q,jt).call(this,{method:"getTransactionResult",hash:U})});return J==null?null:(0,s.hexlify)(J)}async getLogs(U){let J=this._getFilter(U);g(J)&&(J=await J);const{network:z,params:oe}=await(0,s.resolveProperties)({network:this.getNetwork(),params:_e(this,Q,jt).call(this,{method:"getLogs",filter:J})});return oe.map(Y=>this._wrapLog(Y,z))}_getProvider(U){(0,s.assert)(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(U){return await o.EnsResolver.fromName(this,U)}async getAvatar(U){const J=await this.getResolver(U);return J?await J.getAvatar():null}async resolveName(U){const J=await this.getResolver(U);return J?await J.getAddress():null}async lookupAddress(U){U=(0,e.getAddress)(U);const J=(0,n.namehash)(U.substring(2).toLowerCase()+".addr.reverse");try{const z=await o.EnsResolver.getEnsAddress(this),Y=await new r.Contract(z,["function resolver(bytes32) view returns (address)"],this).resolver(J);if(Y==null||Y===t.ZeroAddress)return null;const we=await new r.Contract(Y,["function name(bytes32) view returns (string)"],this).name(J);return await this.resolveName(we)!==U?null:we}catch(z){if((0,s.isError)(z,"BAD_DATA")&&z.value==="0x"||(0,s.isError)(z,"CALL_EXCEPTION"))return null;throw z}return null}async waitForTransaction(U,J,z){const oe=J??1;return oe===0?this.getTransactionReceipt(U):new Promise(async(Y,he)=>{let we=null;const ye=async ie=>{try{const ce=await this.getTransactionReceipt(U);if(ce!=null&&ie-ce.blockNumber+1>=oe){Y(ce),we&&(clearTimeout(we),we=null);return}}catch(ce){console.log("EEE",ce)}this.once("block",ye)};z!=null&&(we=setTimeout(()=>{we!=null&&(we=null,this.off("block",ye),he((0,s.makeError)("timeout","TIMEOUT",{reason:"timeout"})))},z)),ye(await this.getBlockNumber())})}async waitForBlock(U){(0,s.assert)(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(U){const J=q(this,M).get(U);J&&(J.timer&&clearTimeout(J.timer),q(this,M).delete(U))}_setTimeout(U,J){J==null&&(J=0);const z=An(this,F)._++,oe=()=>{q(this,M).delete(z),U()};if(this.paused)q(this,M).set(z,{timer:null,func:oe,time:J});else{const Y=setTimeout(oe,J);q(this,M).set(z,{timer:Y,func:oe,time:v()})}return z}_forEachSubscriber(U){for(const J of q(this,O).values())U(J.subscriber)}_getSubscriber(U){switch(U.type){case"debug":case"error":case"network":return new b(U.type);case"block":{const J=new f.PollingBlockSubscriber(this);return J.pollingInterval=this.pollingInterval,J}case"event":return new f.PollingEventSubscriber(this,U.filter);case"transaction":return new f.PollingTransactionSubscriber(this,U.hash);case"orphan":return new f.PollingOrphanSubscriber(this,U.filter)}throw new Error(`unsupported event: ${U.type}`)}_recoverSubscriber(U,J){for(const z of q(this,O).values())if(z.subscriber===U){z.started&&z.subscriber.stop(),z.subscriber=J,z.started&&J.start(),q(this,L)!=null&&J.pause(q(this,L));break}}async on(U,J){const z=await _e(this,Q,Us).call(this,U);return z.listeners.push({listener:J,once:!1}),z.started||(z.subscriber.start(),z.started=!0,q(this,L)!=null&&z.subscriber.pause(q(this,L))),this}async once(U,J){const z=await _e(this,Q,Us).call(this,U);return z.listeners.push({listener:J,once:!0}),z.started||(z.subscriber.start(),z.started=!0,q(this,L)!=null&&z.subscriber.pause(q(this,L))),this}async emit(U,...J){const z=await _e(this,Q,ss).call(this,U,J);if(!z||z.listeners.length===0)return!1;const oe=z.listeners.length;return z.listeners=z.listeners.filter(({listener:Y,once:he})=>{const we=new s.EventPayload(this,he?null:Y,U);try{Y.call(this,...J,we)}catch{}return!he}),z.listeners.length===0&&(z.started&&z.subscriber.stop(),q(this,O).delete(z.tag)),oe>0}async listenerCount(U){if(U){const z=await _e(this,Q,ss).call(this,U);return z?z.listeners.length:0}let J=0;for(const{listeners:z}of q(this,O).values())J+=z.length;return J}async listeners(U){if(U){const z=await _e(this,Q,ss).call(this,U);return z?z.listeners.map(({listener:oe})=>oe):[]}let J=[];for(const{listeners:z}of q(this,O).values())J=J.concat(z.map(({listener:oe})=>oe));return J}async off(U,J){const z=await _e(this,Q,ss).call(this,U);if(!z)return this;if(J){const oe=z.listeners.map(({listener:Y})=>Y).indexOf(J);oe>=0&&z.listeners.splice(oe,1)}return(!J||z.listeners.length===0)&&(z.started&&z.subscriber.stop(),q(this,O).delete(z.tag)),this}async removeAllListeners(U){if(U){const{tag:J,started:z,subscriber:oe}=await _e(this,Q,Us).call(this,U);z&&oe.stop(),q(this,O).delete(J)}else for(const[J,{started:z,subscriber:oe}]of q(this,O))z&&oe.stop(),q(this,O).delete(J);return this}async addListener(U,J){return await this.on(U,J)}async removeListener(U,J){return this.off(U,J)}get destroyed(){return q(this,H)}destroy(){this.removeAllListeners();for(const U of q(this,M).keys())this._clearTimeout(U);ue(this,H,!0)}get paused(){return q(this,L)!=null}set paused(U){!!U!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(U){if(ue(this,$,-1),q(this,L)!=null){if(q(this,L)==!!U)return;(0,s.assert)(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(J=>J.pause(U)),ue(this,L,!!U);for(const J of q(this,M).values())J.timer&&clearTimeout(J.timer),J.time=v()-J.time}resume(){if(q(this,L)!=null){this._forEachSubscriber(U=>U.resume()),ue(this,L,null);for(const U of q(this,M).values()){let J=U.time;J<0&&(J=0),U.time=v(),setTimeout(U.func,J)}}}}O=new WeakMap,I=new WeakMap,L=new WeakMap,H=new WeakMap,V=new WeakMap,D=new WeakMap,j=new WeakMap,$=new WeakMap,F=new WeakMap,M=new WeakMap,ee=new WeakMap,de=new WeakMap,Q=new WeakSet,jt=async function(U){const J=q(this,de).cacheTimeout;if(J<0)return await this._perform(U);const z=h(U.method,U);let oe=q(this,j).get(z);return oe||(oe=this._perform(U),q(this,j).set(z,oe),setTimeout(()=>{q(this,j).get(z)===oe&&q(this,j).delete(z)},J)),await oe},qa=async function(U,J,z){(0,s.assert)(z<c,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},U,{blockTag:J,enableCcipRead:!0})});const oe=(0,a.copyRequest)(U);try{return(0,s.hexlify)(await this._perform({method:"call",transaction:oe,blockTag:J}))}catch(Y){if(!this.disableCcipRead&&(0,s.isCallException)(Y)&&Y.data&&z>=0&&J==="latest"&&oe.to!=null&&(0,s.dataSlice)(Y.data,0,4)==="0x556f1830"){const he=Y.data,we=await(0,e.resolveAddress)(oe.to,this);let ye;try{ye=A((0,s.dataSlice)(Y.data,4))}catch(me){(0,s.assert)(!1,me.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:oe,info:{data:he}})}(0,s.assert)(ye.sender.toLowerCase()===we.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:he,reason:"OffchainLookup",transaction:oe,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:ye.errorArgs}});const ie=await this.ccipReadFetch(oe,ye.calldata,ye.urls);(0,s.assert)(ie!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:oe,info:{data:Y.data,errorArgs:ye.errorArgs}});const ce={to:we,data:(0,s.concat)([ye.selector,E([ie,ye.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:ce});try{const me=await _e(this,Q,qa).call(this,ce,J,z+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},ce),result:me}),me}catch(me){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},ce),error:me}),me}}throw Y}},Va=async function(U){const{value:J}=await(0,s.resolveProperties)({network:this.getNetwork(),value:U});return J},is=async function(U,J,z){let oe=this._getAddress(J),Y=this._getBlockTag(z);return(typeof oe!="string"||typeof Y!="string")&&([oe,Y]=await Promise.all([oe,Y])),await _e(this,Q,Va).call(this,_e(this,Q,jt).call(this,Object.assign(U,{address:oe,blockTag:Y})))},za=async function(U,J){if((0,s.isHexString)(U,32))return await _e(this,Q,jt).call(this,{method:"getBlock",blockHash:U,includeTransactions:J});let z=this._getBlockTag(U);return typeof z!="string"&&(z=await z),await _e(this,Q,jt).call(this,{method:"getBlock",blockTag:z,includeTransactions:J})},ss=async function(U,J){let z=await y(U,this);return z.type==="event"&&J&&J.length>0&&J[0].removed===!0&&(z=await y({orphan:"drop-log",log:J[0]},this)),q(this,O).get(z.tag)||null},Us=async function(U){const J=await y(U,this),z=J.tag;let oe=q(this,O).get(z);return oe||(oe={subscriber:this._getSubscriber(J),tag:z,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},q(this,O).set(z,oe)),oe},en.AbstractProvider=B;function k(se,U){try{const J=R(se,U);if(J)return(0,s.toUtf8String)(J)}catch{}return null}function R(se,U){if(se==="0x")return null;try{const J=(0,s.getNumber)((0,s.dataSlice)(se,U,U+32)),z=(0,s.getNumber)((0,s.dataSlice)(se,J,J+32));return(0,s.dataSlice)(se,J+32,J+32+z)}catch{}return null}function T(se){const U=(0,s.toBeArray)(se);if(U.length>32)throw new Error("internal; should not happen");const J=new Uint8Array(32);return J.set(U,32-U.length),J}function N(se){if(se.length%32===0)return se;const U=new Uint8Array(Math.ceil(se.length/32)*32);return U.set(se),U}const S=new Uint8Array([]);function E(se){const U=[];let J=0;for(let z=0;z<se.length;z++)U.push(S),J+=32;for(let z=0;z<se.length;z++){const oe=(0,s.getBytes)(se[z]);U[z]=T(J),U.push(T(oe.length)),U.push(N(oe)),J+=32+Math.ceil(oe.length/32)*32}return(0,s.concat)(U)}const x="0x0000000000000000000000000000000000000000000000000000000000000000";function A(se){const U={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};(0,s.assert)((0,s.dataLength)(se)>=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const J=(0,s.dataSlice)(se,0,32);(0,s.assert)((0,s.dataSlice)(J,0,12)===(0,s.dataSlice)(x,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),U.sender=(0,s.dataSlice)(J,12);try{const z=[],oe=(0,s.getNumber)((0,s.dataSlice)(se,32,64)),Y=(0,s.getNumber)((0,s.dataSlice)(se,oe,oe+32)),he=(0,s.dataSlice)(se,oe+32);for(let we=0;we<Y;we++){const ye=k(he,we*32);if(ye==null)throw new Error("abort");z.push(ye)}U.urls=z}catch{(0,s.assert)(!1,"corrupt OffchainLookup urls","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup urls"})}try{const z=R(se,64);if(z==null)throw new Error("abort");U.calldata=z}catch{(0,s.assert)(!1,"corrupt OffchainLookup calldata","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup calldata"})}(0,s.assert)((0,s.dataSlice)(se,100,128)===(0,s.dataSlice)(x,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),U.selector=(0,s.dataSlice)(se,96,100);try{const z=R(se,128);if(z==null)throw new Error("abort");U.extraData=z}catch{(0,s.assert)(!1,"corrupt OffchainLookup extraData","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup extraData"})}return U.errorArgs="sender,urls,calldata,selector,extraData".split(/,/).map(z=>U[z]),U}return en}var tn={},Ef;function jc(){var l,Fs;if(Ef)return tn;Ef=1,Object.defineProperty(tn,"__esModule",{value:!0}),tn.VoidSigner=tn.AbstractSigner=void 0;const e=ft(),t=Ut(),r=Ce(),n=gs();function i(d,c){if(d.provider)return d.provider;(0,r.assert)(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:c})}async function s(d,c){let g=(0,n.copyRequest)(c);if(g.to!=null&&(g.to=(0,e.resolveAddress)(g.to,d)),g.from!=null){const h=g.from;g.from=Promise.all([d.getAddress(),(0,e.resolveAddress)(h,d)]).then(([b,P])=>((0,r.assertArgument)(b.toLowerCase()===P.toLowerCase(),"transaction from mismatch","tx.from",P),b))}else g.from=d.getAddress();return await(0,r.resolveProperties)(g)}class o{constructor(c){pe(this,"provider");(0,r.defineProperties)(this,{provider:c||null})}async getNonce(c){return i(this,"getTransactionCount").getTransactionCount(await this.getAddress(),c)}async populateCall(c){return await s(this,c)}async populateTransaction(c){const g=i(this,"populateTransaction"),h=await s(this,c);h.nonce==null&&(h.nonce=await this.getNonce("pending")),h.gasLimit==null&&(h.gasLimit=await this.estimateGas(h));const b=await this.provider.getNetwork();if(h.chainId!=null){const w=(0,r.getBigInt)(h.chainId);(0,r.assertArgument)(w===b.chainId,"transaction chainId mismatch","tx.chainId",c.chainId)}else h.chainId=b.chainId;const P=h.maxFeePerGas!=null||h.maxPriorityFeePerGas!=null;if(h.gasPrice!=null&&(h.type===2||P)?(0,r.assertArgument)(!1,"eip-1559 transaction do not support gasPrice","tx",c):(h.type===0||h.type===1)&&P&&(0,r.assertArgument)(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",c),(h.type===2||h.type==null)&&h.maxFeePerGas!=null&&h.maxPriorityFeePerGas!=null)h.type=2;else if(h.type===0||h.type===1){const w=await g.getFeeData();(0,r.assert)(w.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),h.gasPrice==null&&(h.gasPrice=w.gasPrice)}else{const w=await g.getFeeData();if(h.type==null)if(w.maxFeePerGas!=null&&w.maxPriorityFeePerGas!=null)if(h.type=2,h.gasPrice!=null){const y=h.gasPrice;delete h.gasPrice,h.maxFeePerGas=y,h.maxPriorityFeePerGas=y}else h.maxFeePerGas==null&&(h.maxFeePerGas=w.maxFeePerGas),h.maxPriorityFeePerGas==null&&(h.maxPriorityFeePerGas=w.maxPriorityFeePerGas);else w.gasPrice!=null?((0,r.assert)(!P,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),h.gasPrice==null&&(h.gasPrice=w.gasPrice),h.type=0):(0,r.assert)(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else h.type===2&&(h.maxFeePerGas==null&&(h.maxFeePerGas=w.maxFeePerGas),h.maxPriorityFeePerGas==null&&(h.maxPriorityFeePerGas=w.maxPriorityFeePerGas))}return await(0,r.resolveProperties)(h)}async estimateGas(c){return i(this,"estimateGas").estimateGas(await this.populateCall(c))}async call(c){return i(this,"call").call(await this.populateCall(c))}async resolveName(c){return await i(this,"resolveName").resolveName(c)}async sendTransaction(c){const g=i(this,"sendTransaction"),h=await this.populateTransaction(c);delete h.from;const b=t.Transaction.from(h);return await g.broadcastTransaction(await this.signTransaction(b))}}tn.AbstractSigner=o;const f=class f extends o{constructor(g,h){super(h);xe(this,l);pe(this,"address");(0,r.defineProperties)(this,{address:g})}async getAddress(){return this.address}connect(g){return new f(this.address,g)}async signTransaction(g){_e(this,l,Fs).call(this,"transactions","signTransaction")}async signMessage(g){_e(this,l,Fs).call(this,"messages","signMessage")}async signTypedData(g,h,b){_e(this,l,Fs).call(this,"typed-data","signTypedData")}};l=new WeakSet,Fs=function(g,h){(0,r.assert)(!1,`VoidSigner cannot sign ${g}`,"UNSUPPORTED_OPERATION",{operation:h})};let u=f;return tn.VoidSigner=u,tn}var wi={},vf;function mn(){if(vf)return wi;vf=1,Object.defineProperty(wi,"__esModule",{value:!0}),wi.showThrottleMessage=void 0;const e=new Set;function t(r){e.has(r)||(e.add(r),console.log("========= NOTICE ========="),console.log(`Request-Rate Exceeded for ${r} (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 wi.showThrottleMessage=t,wi}var Ai={},Ei={},zt={},hr={},_f;function km(){var o,u,l,a,f,d,c,Wa,Ja,b;if(_f)return hr;_f=1,Object.defineProperty(hr,"__esModule",{value:!0}),hr.FilterIdPendingSubscriber=hr.FilterIdEventSubscriber=hr.FilterIdSubscriber=void 0;const e=Ce(),t=Fc();function r(P){return JSON.parse(JSON.stringify(P))}class n{constructor(w){xe(this,c);xe(this,o);xe(this,u);xe(this,l);xe(this,a);xe(this,f);xe(this,d);ue(this,o,w),ue(this,u,null),ue(this,l,_e(this,c,Wa).bind(this)),ue(this,a,!1),ue(this,f,null),ue(this,d,!1)}_subscribe(w){throw new Error("subclasses must override this")}_emitResults(w,y){throw new Error("subclasses must override this")}_recover(w){throw new Error("subclasses must override this")}start(){q(this,a)||(ue(this,a,!0),_e(this,c,Wa).call(this,-2))}stop(){q(this,a)&&(ue(this,a,!1),ue(this,d,!0),_e(this,c,Ja).call(this),q(this,o).off("block",q(this,l)))}pause(w){w&&_e(this,c,Ja).call(this),q(this,o).off("block",q(this,l))}resume(){this.start()}}o=new WeakMap,u=new WeakMap,l=new WeakMap,a=new WeakMap,f=new WeakMap,d=new WeakMap,c=new WeakSet,Wa=async function(w){try{q(this,u)==null&&ue(this,u,this._subscribe(q(this,o)));let y=null;try{y=await q(this,u)}catch(B){if(!(0,e.isError)(B,"UNSUPPORTED_OPERATION")||B.operation!=="eth_newFilter")throw B}if(y==null){ue(this,u,null),q(this,o)._recoverSubscriber(this,this._recover(q(this,o)));return}const v=await q(this,o).getNetwork();if(q(this,f)||ue(this,f,v),q(this,f).chainId!==v.chainId)throw new Error("chaid changed");if(q(this,d))return;const p=await q(this,o).send("eth_getFilterChanges",[y]);await this._emitResults(q(this,o),p)}catch(y){console.log("@TODO",y)}q(this,o).once("block",q(this,l))},Ja=function(){const w=q(this,u);w&&(ue(this,u,null),w.then(y=>{q(this,o).send("eth_uninstallFilter",[y])}))},hr.FilterIdSubscriber=n;class i extends n{constructor(y,v){super(y);xe(this,b);ue(this,b,r(v))}_recover(y){return new t.PollingEventSubscriber(y,q(this,b))}async _subscribe(y){return await y.send("eth_newFilter",[q(this,b)])}async _emitResults(y,v){for(const p of v)y.emit(q(this,b),y._wrapLog(p,y._network))}}b=new WeakMap,hr.FilterIdEventSubscriber=i;class s extends n{async _subscribe(w){return await w.send("eth_newPendingTransactionFilter",[])}async _emitResults(w,y){for(const v of y)w.emit("pending",v)}}return hr.FilterIdPendingSubscriber=s,hr}var kf;function ar(){var R,T,N,S,E,x,A,Qa,I,L;if(kf)return zt;kf=1,Object.defineProperty(zt,"__esModule",{value:!0}),zt.JsonRpcProvider=zt.JsonRpcApiPollingProvider=zt.JsonRpcApiProvider=zt.JsonRpcSigner=void 0;const e=bs(),t=ft(),r=vr(),n=Ut(),i=Ce(),s=ms(),o=jc(),u=Ht(),l=km(),a=Fc(),f="bigint,boolean,function,number,string,symbol".split(/,/g);function d(H){if(H==null||f.indexOf(typeof H)>=0||typeof H.getAddress=="function")return H;if(Array.isArray(H))return H.map(d);if(typeof H=="object")return Object.keys(H).reduce((V,D)=>(V[D]=H[D],V),{});throw new Error(`should not happen: ${H} (${typeof H})`)}function c(H){return new Promise(V=>{setTimeout(V,H)})}function g(H){return H&&H.toLowerCase()}function h(H){return H&&typeof H.pollingInterval=="number"}const b={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class P extends o.AbstractSigner{constructor(D,j){super(D);pe(this,"address");j=(0,t.getAddress)(j),(0,i.defineProperties)(this,{address:j})}connect(D){(0,i.assert)(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(D){return await this.populateCall(D)}async sendUncheckedTransaction(D){const j=d(D),$=[];if(j.from){const M=j.from;$.push((async()=>{const ee=await(0,t.resolveAddress)(M,this.provider);(0,i.assertArgument)(ee!=null&&ee.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",D),j.from=ee})())}else j.from=this.address;if(j.gasLimit==null&&$.push((async()=>{j.gasLimit=await this.provider.estimateGas({...j,from:this.address})})()),j.to!=null){const M=j.to;$.push((async()=>{j.to=await(0,t.resolveAddress)(M,this.provider)})())}$.length&&await Promise.all($);const F=this.provider.getRpcTransaction(j);return this.provider.send("eth_sendTransaction",[F])}async sendTransaction(D){const j=await this.provider.getBlockNumber(),$=await this.sendUncheckedTransaction(D);return await new Promise((F,M)=>{const ee=[1e3,100],de=async()=>{const Q=await this.provider.getTransaction($);if(Q!=null){F(Q.replaceableTransaction(j));return}this.provider._setTimeout(()=>{de()},ee.pop()||4e3)};de()})}async signTransaction(D){const j=d(D);if(j.from){const F=await(0,t.resolveAddress)(j.from,this.provider);(0,i.assertArgument)(F!=null&&F.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",D),j.from=F}else j.from=this.address;const $=this.provider.getRpcTransaction(j);return await this.provider.send("eth_signTransaction",[$])}async signMessage(D){const j=typeof D=="string"?(0,i.toUtf8Bytes)(D):D;return await this.provider.send("personal_sign",[(0,i.hexlify)(j),this.address.toLowerCase()])}async signTypedData(D,j,$){const F=d($),M=await r.TypedDataEncoder.resolveNames(D,j,F,async ee=>{const de=await(0,t.resolveAddress)(ee);return(0,i.assertArgument)(de!=null,"TypedData does not support null address","value",ee),de});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(r.TypedDataEncoder.getPayload(M.domain,j,M.value))])}async unlock(D){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),D,null])}async _legacySignMessage(D){const j=typeof D=="string"?(0,i.toUtf8Bytes)(D):D;return await this.provider.send("eth_sign",[this.address.toLowerCase(),(0,i.hexlify)(j)])}}zt.JsonRpcSigner=P;class w extends s.AbstractProvider{constructor(D,j){super(D,j);xe(this,A);xe(this,R);xe(this,T);xe(this,N);xe(this,S);xe(this,E);xe(this,x);ue(this,T,1),ue(this,R,Object.assign({},b,j||{})),ue(this,N,[]),ue(this,S,null),ue(this,x,null);{let F=null;const M=new Promise(ee=>{F=ee});ue(this,E,{promise:M,resolve:F})}const $=this._getOption("staticNetwork");$&&((0,i.assertArgument)(D==null||$.matches(D),"staticNetwork MUST match network object","options",j),ue(this,x,$))}_getOption(D){return q(this,R)[D]}get _network(){return(0,i.assert)(q(this,x),"network is not available yet","NETWORK_ERROR"),q(this,x)}async _perform(D){if(D.method==="call"||D.method==="estimateGas"){let $=D.transaction;if($&&$.type!=null&&(0,i.getBigInt)($.type)&&$.maxFeePerGas==null&&$.maxPriorityFeePerGas==null){const F=await this.getFeeData();F.maxFeePerGas==null&&F.maxPriorityFeePerGas==null&&(D=Object.assign({},D,{transaction:Object.assign({},$,{type:void 0})}))}}const j=this.getRpcRequest(D);return j!=null?await this.send(j.method,j.args):super._perform(D)}async _detectNetwork(){const D=this._getOption("staticNetwork");if(D)return D;if(this.ready)return u.Network.from((0,i.getBigInt)(await this.send("eth_chainId",[])));const j={id:An(this,T)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:j});let $;try{$=(await this._send(j))[0]}catch(F){throw this.emit("debug",{action:"receiveRpcError",error:F}),F}if(this.emit("debug",{action:"receiveRpcResult",result:$}),"result"in $)return u.Network.from((0,i.getBigInt)($.result));throw this.getRpcError(j,$)}_start(){q(this,E)==null||q(this,E).resolve==null||(q(this,E).resolve(),ue(this,E,null),(async()=>{for(;q(this,x)==null&&!this.destroyed;)try{ue(this,x,await this._detectNetwork())}catch(D){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,i.makeError)("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:D}})),await c(1e3)}_e(this,A,Qa).call(this)})())}async _waitUntilReady(){if(q(this,E)!=null)return await q(this,E).promise}_getSubscriber(D){return D.type==="pending"?new l.FilterIdPendingSubscriber(this):D.type==="event"?this._getOption("polling")?new a.PollingEventSubscriber(this,D.filter):new l.FilterIdEventSubscriber(this,D.filter):D.type==="orphan"&&D.filter.orphan==="drop-log"?new s.UnmanagedSubscriber("orphan"):super._getSubscriber(D)}get ready(){return q(this,E)==null}getRpcTransaction(D){const j={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach($=>{if(D[$]==null)return;let F=$;$==="gasLimit"&&(F="gas"),j[F]=(0,i.toQuantity)((0,i.getBigInt)(D[$],`tx.${$}`))}),["from","to","data"].forEach($=>{D[$]!=null&&(j[$]=(0,i.hexlify)(D[$]))}),D.accessList&&(j.accessList=(0,n.accessListify)(D.accessList)),j}getRpcRequest(D){switch(D.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:[g(D.address),D.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[g(D.address),D.blockTag]};case"getCode":return{method:"eth_getCode",args:[g(D.address),D.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[g(D.address),"0x"+D.position.toString(16),D.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[D.signedTransaction]};case"getBlock":if("blockTag"in D)return{method:"eth_getBlockByNumber",args:[D.blockTag,!!D.includeTransactions]};if("blockHash"in D)return{method:"eth_getBlockByHash",args:[D.blockHash,!!D.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[D.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[D.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(D.transaction),D.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(D.transaction)]};case"getLogs":return D.filter&&D.filter.address!=null&&(Array.isArray(D.filter.address)?D.filter.address=D.filter.address.map(g):D.filter.address=g(D.filter.address)),{method:"eth_getLogs",args:[D.filter]}}return null}getRpcError(D,j){const{method:$}=D,{error:F}=j;if($==="eth_estimateGas"&&F.message){const de=F.message;if(!de.match(/revert/i)&&de.match(/insufficient funds/i))return(0,i.makeError)("insufficient funds","INSUFFICIENT_FUNDS",{transaction:D.params[0],info:{payload:D,error:F}})}if($==="eth_call"||$==="eth_estimateGas"){const de=p(F),Q=e.AbiCoder.getBuiltinCallException($==="eth_call"?"call":"estimateGas",D.params[0],de?de.data:null);return Q.info={error:F,payload:D},Q}const M=JSON.stringify(k(F));if(typeof F.message=="string"&&F.message.match(/user denied|ethers-user-denied/i)){const de={eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"};return(0,i.makeError)("user rejected action","ACTION_REJECTED",{action:de[$]||"unknown",reason:"rejected",info:{payload:D,error:F}})}if($==="eth_sendRawTransaction"||$==="eth_sendTransaction"){const de=D.params[0];if(M.match(/insufficient funds|base fee exceeds gas limit/i))return(0,i.makeError)("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:de,info:{error:F}});if(M.match(/nonce/i)&&M.match(/too low/i))return(0,i.makeError)("nonce has already been used","NONCE_EXPIRED",{transaction:de,info:{error:F}});if(M.match(/replacement transaction/i)&&M.match(/underpriced/i))return(0,i.makeError)("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:de,info:{error:F}});if(M.match(/only replay-protected/i))return(0,i.makeError)("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:$,info:{transaction:de,info:{error:F}}})}let ee=!!M.match(/the method .* does not exist/i);return ee||F&&F.details&&F.details.startsWith("Unauthorized method:")&&(ee=!0),ee?(0,i.makeError)("unsupported operation","UNSUPPORTED_OPERATION",{operation:D.method,info:{error:F,payload:D}}):(0,i.makeError)("could not coalesce error","UNKNOWN_ERROR",{error:F,payload:D})}send(D,j){if(this.destroyed)return Promise.reject((0,i.makeError)("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:D}));const $=An(this,T)._++,F=new Promise((M,ee)=>{q(this,N).push({resolve:M,reject:ee,payload:{method:D,params:j,id:$,jsonrpc:"2.0"}})});return _e(this,A,Qa).call(this),F}async getSigner(D){D==null&&(D=0);const j=this.send("eth_accounts",[]);if(typeof D=="number"){const F=await j;if(D>=F.length)throw new Error("no such account");return new P(this,F[D])}const{accounts:$}=await(0,i.resolveProperties)({network:this.getNetwork(),accounts:j});D=(0,t.getAddress)(D);for(const F of $)if((0,t.getAddress)(F)===D)return new P(this,D);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(j=>new P(this,j))}destroy(){q(this,S)&&(clearTimeout(q(this,S)),ue(this,S,null));for(const{payload:D,reject:j}of q(this,N))j((0,i.makeError)("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:D.method}));ue(this,N,[]),super.destroy()}}R=new WeakMap,T=new WeakMap,N=new WeakMap,S=new WeakMap,E=new WeakMap,x=new WeakMap,A=new WeakSet,Qa=function(){if(q(this,S))return;const D=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");ue(this,S,setTimeout(()=>{ue(this,S,null);const j=q(this,N);for(ue(this,N,[]);j.length;){const $=[j.shift()];for(;j.length&&$.length!==q(this,R).batchMaxCount;)if($.push(j.shift()),JSON.stringify($.map(M=>M.payload)).length>q(this,R).batchMaxSize){j.unshift($.pop());break}(async()=>{const F=$.length===1?$[0].payload:$.map(M=>M.payload);this.emit("debug",{action:"sendRpcPayload",payload:F});try{const M=await this._send(F);this.emit("debug",{action:"receiveRpcResult",result:M});for(const{resolve:ee,reject:de,payload:Q}of $){if(this.destroyed){de((0,i.makeError)("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:Q.method}));continue}const ae=M.filter(Z=>Z.id===Q.id)[0];if(ae==null){const Z=(0,i.makeError)("missing response for request","BAD_DATA",{value:M,info:{payload:Q}});this.emit("error",Z),de(Z);continue}if("error"in ae){de(this.getRpcError(Q,ae));continue}ee(ae.result)}}catch(M){this.emit("debug",{action:"receiveRpcError",error:M});for(const{reject:ee}of $)ee(M)}})()}},D))},zt.JsonRpcApiProvider=w;class y extends w{constructor(D,j){super(D,j);xe(this,I);ue(this,I,4e3)}_getSubscriber(D){const j=super._getSubscriber(D);return h(j)&&(j.pollingInterval=q(this,I)),j}get pollingInterval(){return q(this,I)}set pollingInterval(D){if(!Number.isInteger(D)||D<0)throw new Error("invalid interval");ue(this,I,D),this._forEachSubscriber(j=>{h(j)&&(j.pollingInterval=q(this,I))})}}I=new WeakMap,zt.JsonRpcApiPollingProvider=y;class v extends y{constructor(D,j,$){D==null&&(D="http://localhost:8545");super(j,$);xe(this,L);typeof D=="string"?ue(this,L,new i.FetchRequest(D)):ue(this,L,D.clone())}_getConnection(){return q(this,L).clone()}async send(D,j){return await this._start(),await super.send(D,j)}async _send(D){const j=this._getConnection();j.body=JSON.stringify(D),j.setHeader("content-type","application/json");const $=await j.send();$.assertOk();let F=$.bodyJson;return Array.isArray(F)||(F=[F]),F}}L=new WeakMap,zt.JsonRpcProvider=v;function p(H){if(H==null)return null;if(typeof H.message=="string"&&H.message.match(/revert/i)&&(0,i.isHexString)(H.data))return{message:H.message,data:H.data};if(typeof H=="object"){for(const V in H){const D=p(H[V]);if(D)return D}return null}if(typeof H=="string")try{return p(JSON.parse(H))}catch{}return null}function B(H,V){if(H!=null){if(typeof H.message=="string"&&V.push(H.message),typeof H=="object")for(const D in H)B(H[D],V);if(typeof H=="string")try{return B(JSON.parse(H),V)}catch{}}}function k(H){const V=[];return B(H,V),V}return zt}var Pf;function ph(){if(Pf)return Ei;Pf=1,Object.defineProperty(Ei,"__esModule",{value:!0}),Ei.AnkrProvider=void 0;const e=Ce(),t=mn(),r=Ht(),n=ar(),i="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function s(u){switch(u){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,e.assertArgument)(!1,"unsupported network","network",u)}class o extends n.JsonRpcProvider{constructor(a,f){a==null&&(a="mainnet");const d=r.Network.from(a);f==null&&(f=i);const c={polling:!0,staticNetwork:d},g=o.getRequest(d,f);super(g,d,c);pe(this,"apiKey");(0,e.defineProperties)(this,{apiKey:f})}_getProvider(a){try{return new o(a,this.apiKey)}catch{}return super._getProvider(a)}static getRequest(a,f){f==null&&(f=i);const d=new e.FetchRequest(`https://${s(a.name)}/${f}`);return d.allowGzip=!0,f===i&&(d.retryFunc=async(c,g,h)=>((0,t.showThrottleMessage)("AnkrProvider"),!0)),d}getRpcError(a,f){return a.method==="eth_sendRawTransaction"&&f&&f.error&&f.error.message==="INTERNAL_ERROR: could not replace existing tx"&&(f.error.message="replacement transaction underpriced"),super.getRpcError(a,f)}isCommunityResource(){return this.apiKey===i}}return Ei.AnkrProvider=o,Ei}var vi={},Tf;function bh(){if(Tf)return vi;Tf=1,Object.defineProperty(vi,"__esModule",{value:!0}),vi.AlchemyProvider=void 0;const e=Ce(),t=mn(),r=Ht(),n=ar(),i="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";function s(u){switch(u){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,e.assertArgument)(!1,"unsupported network","network",u)}class o extends n.JsonRpcProvider{constructor(a,f){a==null&&(a="mainnet");const d=r.Network.from(a);f==null&&(f=i);const c=o.getRequest(d,f);super(c,d,{staticNetwork:d});pe(this,"apiKey");(0,e.defineProperties)(this,{apiKey:f})}_getProvider(a){try{return new o(a,this.apiKey)}catch{}return super._getProvider(a)}async _perform(a){if(a.method==="getTransactionResult"){const{trace:f,tx:d}=await(0,e.resolveProperties)({trace:this.send("trace_transaction",[a.hash]),tx:this.getTransaction(a.hash)});if(f==null||d==null)return null;let c,g=!1;try{c=f[0].result.output,g=f[0].error==="Reverted"}catch{}if(c)return(0,e.assert)(!g,"an error occurred during transaction executions","CALL_EXCEPTION",{action:"getTransactionResult",data:c,reason:null,transaction:d,invocation:null,revert:null}),c;(0,e.assert)(!1,"could not parse trace result","BAD_DATA",{value:f})}return await super._perform(a)}isCommunityResource(){return this.apiKey===i}static getRequest(a,f){f==null&&(f=i);const d=new e.FetchRequest(`https://${s(a.name)}/v2/${f}`);return d.allowGzip=!0,f===i&&(d.retryFunc=async(c,g,h)=>((0,t.showThrottleMessage)("alchemy"),!0)),d}}return vi.AlchemyProvider=o,vi}var _i={},Sf;function gh(){if(Sf)return _i;Sf=1,Object.defineProperty(_i,"__esModule",{value:!0}),_i.CloudflareProvider=void 0;const e=Ce(),t=Ht(),r=ar();class n extends r.JsonRpcProvider{constructor(s){s==null&&(s="mainnet");const o=t.Network.from(s);(0,e.assertArgument)(o.name==="mainnet","unsupported network","network",s),super("https://cloudflare-eth.com/",o,{staticNetwork:o})}}return _i.CloudflareProvider=n,_i}var rn={},Of;function mh(){var b;if(Of)return rn;Of=1,Object.defineProperty(rn,"__esModule",{value:!0}),rn.EtherscanProvider=rn.EtherscanPlugin=void 0;const e=bs(),t=so(),r=Ut(),n=Ce(),i=ms(),s=Ht(),o=Uc(),u=mn(),l=2e3;function a(P){return P&&typeof P.then=="function"}const f="org.ethers.plugins.provider.Etherscan";class d extends o.NetworkPlugin{constructor(y){super(f);pe(this,"baseUrl");(0,n.defineProperties)(this,{baseUrl:y})}clone(){return new d(this.baseUrl)}}rn.EtherscanPlugin=d;const c=["enableCcipRead"];let g=1;class h extends i.AbstractProvider{constructor(y,v){const p=v??null;super();pe(this,"network");pe(this,"apiKey");xe(this,b);const B=s.Network.from(y);ue(this,b,B.getPlugin(f)),(0,n.defineProperties)(this,{apiKey:p,network:B}),this.getBaseUrl()}getBaseUrl(){if(q(this,b))return q(this,b).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,n.assertArgument)(!1,"unsupported network","network",this.network)}getUrl(y,v){const p=Object.keys(v).reduce((k,R)=>{const T=v[R];return T!=null&&(k+=`&${R}=${T}`),k},""),B=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.getBaseUrl()}/api?module=${y}${p}${B}`}getPostUrl(){return`${this.getBaseUrl()}/api`}getPostData(y,v){return v.module=y,v.apikey=this.apiKey,v}async detectNetwork(){return this.network}async fetch(y,v,p){const B=g++,k=p?this.getPostUrl():this.getUrl(y,v),R=p?this.getPostData(y,v):null;this.emit("debug",{action:"sendRequest",id:B,url:k,payload:R});const T=new n.FetchRequest(k);T.setThrottleParams({slotInterval:1e3}),T.retryFunc=(E,x,A)=>(this.isCommunityResource()&&(0,u.showThrottleMessage)("Etherscan"),Promise.resolve(!0)),T.processFunc=async(E,x)=>{const A=x.hasBody()?JSON.parse((0,n.toUtf8String)(x.body)):{},O=(typeof A.result=="string"?A.result:"").toLowerCase().indexOf("rate limit")>=0;return y==="proxy"?A&&A.status==0&&A.message=="NOTOK"&&O&&(this.emit("debug",{action:"receiveError",id:B,reason:"proxy-NOTOK",error:A}),x.throwThrottleError(A.result,l)):O&&(this.emit("debug",{action:"receiveError",id:B,reason:"null result",error:A.result}),x.throwThrottleError(A.result,l)),x},R&&(T.setHeader("content-type","application/x-www-form-urlencoded; charset=UTF-8"),T.body=Object.keys(R).map(E=>`${E}=${R[E]}`).join("&"));const N=await T.send();try{N.assertOk()}catch(E){this.emit("debug",{action:"receiveError",id:B,error:E,reason:"assertOk"}),(0,n.assert)(!1,"response error","SERVER_ERROR",{request:T,response:N})}N.hasBody()||(this.emit("debug",{action:"receiveError",id:B,error:"missing body",reason:"null body"}),(0,n.assert)(!1,"missing response","SERVER_ERROR",{request:T,response:N}));const S=JSON.parse((0,n.toUtf8String)(N.body));return y==="proxy"?(S.jsonrpc!="2.0"&&(this.emit("debug",{action:"receiveError",id:B,result:S,reason:"invalid JSON-RPC"}),(0,n.assert)(!1,"invalid JSON-RPC response (missing jsonrpc='2.0')","SERVER_ERROR",{request:T,response:N,info:{result:S}})),S.error&&(this.emit("debug",{action:"receiveError",id:B,result:S,reason:"JSON-RPC error"}),(0,n.assert)(!1,"error response","SERVER_ERROR",{request:T,response:N,info:{result:S}})),this.emit("debug",{action:"receiveRequest",id:B,result:S}),S.result):S.status==0&&(S.message==="No records found"||S.message==="No transactions found")?(this.emit("debug",{action:"receiveRequest",id:B,result:S}),S.result):((S.status!=1||typeof S.message=="string"&&!S.message.match(/^OK/))&&(this.emit("debug",{action:"receiveError",id:B,result:S}),(0,n.assert)(!1,"error response","SERVER_ERROR",{request:T,response:N,info:{result:S}})),this.emit("debug",{action:"receiveRequest",id:B,result:S}),S.result)}_getTransactionPostData(y){const v={};for(let p in y){if(c.indexOf(p)>=0||y[p]==null)continue;let B=y[p];p==="type"&&B===0||p==="blockTag"&&B==="latest"||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[p]?B=(0,n.toQuantity)(B):p==="accessList"?B="["+(0,r.accessListify)(B).map(k=>`{address:"${k.address}",storageKeys:["${k.storageKeys.join('","')}"]}`).join(",")+"]":B=(0,n.hexlify)(B),v[p]=B)}return v}_checkError(y,v,p){let B="";if((0,n.isError)(v,"SERVER_ERROR")){try{B=v.info.result.error.message}catch{}if(!B)try{B=v.info.message}catch{}}if(y.method==="estimateGas"&&!B.match(/revert/i)&&B.match(/insufficient funds/i)&&(0,n.assert)(!1,"insufficient funds","INSUFFICIENT_FUNDS",{transaction:y.transaction}),(y.method==="call"||y.method==="estimateGas")&&B.match(/execution reverted/i)){let k="";try{k=v.info.result.error.data}catch{}const R=e.AbiCoder.getBuiltinCallException(y.method,y.transaction,k);throw R.info={request:y,error:v},R}if(B&&y.method==="broadcastTransaction"){const k=r.Transaction.from(y.signedTransaction);B.match(/replacement/i)&&B.match(/underpriced/i)&&(0,n.assert)(!1,"replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:k}),B.match(/insufficient funds/)&&(0,n.assert)(!1,"insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:k}),B.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&(0,n.assert)(!1,"nonce has already been used","NONCE_EXPIRED",{transaction:k})}throw v}async _detectNetwork(){return this.network}async _perform(y){switch(y.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:y.address,tag:y.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:y.address,tag:y.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:y.address,tag:y.blockTag});case"getStorage":return this.fetch("proxy",{action:"eth_getStorageAt",address:y.address,position:y.position,tag:y.blockTag});case"broadcastTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:y.signedTransaction},!0).catch(v=>this._checkError(y,v,y.signedTransaction));case"getBlock":if("blockTag"in y)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:y.blockTag,boolean:y.includeTransactions?"true":"false"});(0,n.assert)(!1,"getBlock by blockHash not supported by Etherscan","UNSUPPORTED_OPERATION",{operation:"getBlock(blockHash)"});case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:y.hash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:y.hash});case"call":{if(y.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const v=this._getTransactionPostData(y.transaction);v.module="proxy",v.action="eth_call";try{return await this.fetch("proxy",v,!0)}catch(p){return this._checkError(y,p,y.transaction)}}case"estimateGas":{const v=this._getTransactionPostData(y.transaction);v.module="proxy",v.action="eth_estimateGas";try{return await this.fetch("proxy",v,!0)}catch(p){return this._checkError(y,p,y.transaction)}}}return super._perform(y)}async getNetwork(){return this.network}async getEtherPrice(){return this.network.name!=="mainnet"?0:parseFloat((await this.fetch("stats",{action:"ethprice"})).ethusd)}async getContract(y){let v=this._getAddress(y);a(v)&&(v=await v);try{const p=await this.fetch("contract",{action:"getabi",address:v}),B=JSON.parse(p);return new t.Contract(v,B,this)}catch{return null}}isCommunityResource(){return this.apiKey==null}}return b=new WeakMap,rn.EtherscanProvider=h,rn}var nn={},ki={},Pi={},Bf;function Pm(){if(Bf)return Pi;Bf=1,Object.defineProperty(Pi,"__esModule",{value:!0}),Pi.WebSocket=void 0;function e(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof Me<"u")return Me;throw new Error("unable to locate global object")}const t=e().WebSocket;return Pi.WebSocket=t,Pi}var It={},Cf;function Ya(){var l,a,f,d,c,g,h,b,P;if(Cf)return It;Cf=1,Object.defineProperty(It,"__esModule",{value:!0}),It.SocketProvider=It.SocketEventSubscriber=It.SocketPendingSubscriber=It.SocketBlockSubscriber=It.SocketSubscriber=void 0;const e=ms(),t=Ce(),r=ar();class n{constructor(y,v){xe(this,l);xe(this,a);xe(this,f);xe(this,d);xe(this,c);ue(this,l,y),ue(this,a,JSON.stringify(v)),ue(this,f,null),ue(this,d,null),ue(this,c,null)}get filter(){return JSON.parse(q(this,a))}start(){ue(this,f,q(this,l).send("eth_subscribe",this.filter).then(y=>(q(this,l)._register(y,this),y)))}stop(){q(this,f).then(y=>{q(this,l).send("eth_unsubscribe",[y])}),ue(this,f,null)}pause(y){(0,t.assert)(y,"preserve logs while paused not supported by SocketSubscriber yet","UNSUPPORTED_OPERATION",{operation:"pause(false)"}),ue(this,d,!!y)}resume(){ue(this,d,null)}_handleMessage(y){if(q(this,f)!=null&&q(this,d)===null){let v=q(this,c);v==null?v=this._emit(q(this,l),y):v=v.then(async()=>{await this._emit(q(this,l),y)}),ue(this,c,v.then(()=>{q(this,c)===v&&ue(this,c,null)}))}}async _emit(y,v){throw new Error("sub-classes must implemente this; _emit")}}l=new WeakMap,a=new WeakMap,f=new WeakMap,d=new WeakMap,c=new WeakMap,It.SocketSubscriber=n;class i extends n{constructor(y){super(y,["newHeads"])}async _emit(y,v){y.emit("block",parseInt(v.number))}}It.SocketBlockSubscriber=i;class s extends n{constructor(y){super(y,["newPendingTransactions"])}async _emit(y,v){y.emit("pending",v)}}It.SocketPendingSubscriber=s;class o extends n{constructor(v,p){super(v,["logs",p]);xe(this,g);ue(this,g,JSON.stringify(p))}get logFilter(){return JSON.parse(q(this,g))}async _emit(v,p){v.emit(this.logFilter,v._wrapLog(p,v._network))}}g=new WeakMap,It.SocketEventSubscriber=o;class u extends r.JsonRpcApiProvider{constructor(v){super(v,{batchMaxCount:1});xe(this,h);xe(this,b);xe(this,P);ue(this,h,new Map),ue(this,b,new Map),ue(this,P,new Map)}_getSubscriber(v){switch(v.type){case"close":return new e.UnmanagedSubscriber("close");case"block":return new i(this);case"pending":return new s(this);case"event":return new o(this,v.filter);case"orphan":if(v.filter.orphan==="drop-log")return new e.UnmanagedSubscriber("drop-log")}return super._getSubscriber(v)}_register(v,p){q(this,b).set(v,p);const B=q(this,P).get(v);if(B){for(const k of B)p._handleMessage(k);q(this,P).delete(v)}}async _send(v){(0,t.assertArgument)(!Array.isArray(v),"WebSocket does not support batch send","payload",v);const p=new Promise((B,k)=>{q(this,h).set(v.id,{payload:v,resolve:B,reject:k})});return await this._waitUntilReady(),await this._write(JSON.stringify(v)),[await p]}async _processMessage(v){const p=JSON.parse(v);if(p&&typeof p=="object"&&"id"in p){const B=q(this,h).get(p.id);if(B==null){this.emit("error",(0,t.makeError)("received result for unknown id","UNKNOWN_ERROR",{reasonCode:"UNKNOWN_ID",result:p}));return}q(this,h).delete(p.id),B.resolve(p)}else if(p&&p.method==="eth_subscription"){const B=p.params.subscription,k=q(this,b).get(B);if(k)k._handleMessage(p.params.result);else{let R=q(this,P).get(B);R==null&&(R=[],q(this,P).set(B,R)),R.push(p.params.result)}}else{this.emit("error",(0,t.makeError)("received unexpected message","UNKNOWN_ERROR",{reasonCode:"UNEXPECTED_MESSAGE",result:p}));return}}async _write(v){throw new Error("sub-classes must override this")}}return h=new WeakMap,b=new WeakMap,P=new WeakMap,It.SocketProvider=u,It}var Rf;function Dc(){var n,i;if(Rf)return ki;Rf=1,Object.defineProperty(ki,"__esModule",{value:!0}),ki.WebSocketProvider=void 0;const e=Pm(),t=Ya();class r extends t.SocketProvider{constructor(u,l){super(l);xe(this,n);xe(this,i);typeof u=="string"?(ue(this,n,()=>new e.WebSocket(u)),ue(this,i,q(this,n).call(this))):typeof u=="function"?(ue(this,n,u),ue(this,i,u())):(ue(this,n,null),ue(this,i,u)),this.websocket.onopen=async()=>{try{await this._start(),this.resume()}catch(a){console.log("failed to start WebsocketProvider",a)}},this.websocket.onmessage=a=>{this._processMessage(a.data)}}get websocket(){if(q(this,i)==null)throw new Error("websocket closed");return q(this,i)}async _write(u){this.websocket.send(u)}async destroy(){q(this,i)!=null&&(q(this,i).close(),ue(this,i,null)),super.destroy()}}return n=new WeakMap,i=new WeakMap,ki.WebSocketProvider=r,ki}var Nf;function yh(){if(Nf)return nn;Nf=1,Object.defineProperty(nn,"__esModule",{value:!0}),nn.InfuraProvider=nn.InfuraWebSocketProvider=void 0;const e=Ce(),t=mn(),r=Ht(),n=ar(),i=Dc(),s="84842078b09946638c03157f83405213";function o(a){switch(a){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,e.assertArgument)(!1,"unsupported network","network",a)}class u extends i.WebSocketProvider{constructor(d,c){const g=new l(d,c),h=g._getConnection();(0,e.assert)(!h.credentials,"INFURA WebSocket project secrets unsupported","UNSUPPORTED_OPERATION",{operation:"InfuraProvider.getWebSocketProvider()"});const b=h.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(b,d);pe(this,"projectId");pe(this,"projectSecret");(0,e.defineProperties)(this,{projectId:g.projectId,projectSecret:g.projectSecret})}isCommunityResource(){return this.projectId===s}}nn.InfuraWebSocketProvider=u;class l extends n.JsonRpcProvider{constructor(d,c,g){d==null&&(d="mainnet");const h=r.Network.from(d);c==null&&(c=s),g==null&&(g=null);const b=l.getRequest(h,c,g);super(b,h,{staticNetwork:h});pe(this,"projectId");pe(this,"projectSecret");(0,e.defineProperties)(this,{projectId:c,projectSecret:g})}_getProvider(d){try{return new l(d,this.projectId,this.projectSecret)}catch{}return super._getProvider(d)}isCommunityResource(){return this.projectId===s}static getWebSocketProvider(d,c){return new u(d,c)}static getRequest(d,c,g){c==null&&(c=s),g==null&&(g=null);const h=new e.FetchRequest(`https://${o(d.name)}/v3/${c}`);return h.allowGzip=!0,g&&h.setCredentials("",g),c===s&&(h.retryFunc=async(b,P,w)=>((0,t.showThrottleMessage)("InfuraProvider"),!0)),h}}return nn.InfuraProvider=l,nn}var Ti={},If;function xh(){if(If)return Ti;If=1,Object.defineProperty(Ti,"__esModule",{value:!0}),Ti.QuickNodeProvider=void 0;const e=Ce(),t=mn(),r=Ht(),n=ar(),i="919b412a057b5e9c9b6dce193c5a60242d6efadb";function s(u){switch(u){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,e.assertArgument)(!1,"unsupported network","network",u)}class o extends n.JsonRpcProvider{constructor(a,f){a==null&&(a="mainnet");const d=r.Network.from(a);f==null&&(f=i);const c=o.getRequest(d,f);super(c,d,{staticNetwork:d});pe(this,"token");(0,e.defineProperties)(this,{token:f})}_getProvider(a){try{return new o(a,this.token)}catch{}return super._getProvider(a)}isCommunityResource(){return this.token===i}static getRequest(a,f){f==null&&(f=i);const d=new e.FetchRequest(`https://${s(a.name)}/${f}`);return d.allowGzip=!0,f===i&&(d.retryFunc=async(c,g,h)=>((0,t.showThrottleMessage)("QuickNodeProvider"),!0)),d}}return Ti.QuickNodeProvider=o,Ti}var Si={},Mf;function vh(){var v,p,B,k,wh,Za,Ah,Eh,Xa;if(Mf)return Si;Mf=1,Object.defineProperty(Si,"__esModule",{value:!0}),Si.FallbackProvider=void 0;const e=Ce(),t=ms(),r=Ht(),n=BigInt("1"),i=BigInt("2");function s(x){for(let A=x.length-1;A>0;A--){const O=Math.floor(Math.random()*(A+1)),I=x[A];x[A]=x[O],x[O]=I}}function o(x){return new Promise(A=>{setTimeout(A,x)})}function u(){return new Date().getTime()}function l(x){return JSON.stringify(x,(A,O)=>typeof O=="bigint"?{type:"bigint",value:O.toString()}:O)}const a={stallTimeout:400,priority:1,weight:1},f={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 d(x,A){for(;(x.blockNumber<0||x.blockNumber<A)&&(x._updateNumber||(x._updateNumber=(async()=>{try{const O=await x.provider.getBlockNumber();O>x.blockNumber&&(x.blockNumber=O)}catch(O){x.blockNumber=-2,x._lastFatalError=O,x._lastFatalErrorTimestamp=u()}x._updateNumber=null})()),await x._updateNumber,x.outOfSync++,!x._lastFatalError););}function c(x){if(x==null)return"null";if(Array.isArray(x))return"["+x.map(c).join(",")+"]";if(typeof x=="object"&&typeof x.toJSON=="function")return c(x.toJSON());switch(typeof x){case"boolean":case"symbol":return x.toString();case"bigint":case"number":return BigInt(x).toString();case"string":return JSON.stringify(x);case"object":{const A=Object.keys(x);return A.sort(),"{"+A.map(O=>`${JSON.stringify(O)}:${c(x[O])}`).join(",")+"}"}}throw console.log("Could not serialize",x),new Error("Hmm...")}function g(x){if("error"in x){const O=x.error;return{tag:c(O),value:O}}const A=x.result;return{tag:c(A),value:A}}function h(x,A){const O=new Map;for(const{value:L,tag:H,weight:V}of A){const D=O.get(H)||{value:L,weight:0};D.weight+=V,O.set(H,D)}let I=null;for(const L of O.values())L.weight>=x&&(!I||L.weight>I.weight)&&(I=L);if(I)return I.value}function b(x,A){let O=0;const I=new Map;let L=null;const H=[];for(const{value:D,tag:j,weight:$}of A)if(D instanceof Error){const F=I.get(j)||{value:D,weight:0};F.weight+=$,I.set(j,F),(L==null||F.weight>L.weight)&&(L=F)}else H.push(BigInt(D)),O+=$;if(O<x)return L&&L.weight>=x?L.value:void 0;H.sort((D,j)=>D<j?-1:j>D?1:0);const V=Math.floor(H.length/2);return H.length%2?H[V]:(H[V-1]+H[V]+n)/i}function P(x,A){const O=h(x,A);if(O!==void 0)return O;for(const I of A)if(I.value)return I.value}function w(x,A){if(x===1)return(0,e.getNumber)(b(x,A),"%internal");const O=new Map,I=(V,D)=>{const j=O.get(V)||{result:V,weight:0};j.weight+=D,O.set(V,j)};for(const{weight:V,value:D}of A){const j=(0,e.getNumber)(D);I(j-1,V),I(j,V),I(j+1,V)}let L=0,H;for(const{weight:V,result:D}of O.values())V>=x&&(V>L||H!=null&&V===L&&D>H)&&(L=V,H=D);return H}class y extends t.AbstractProvider{constructor(O,I,L){super(I,L);xe(this,k);pe(this,"quorum");pe(this,"eventQuorum");pe(this,"eventWorkers");xe(this,v);xe(this,p);xe(this,B);ue(this,v,O.map(H=>H instanceof t.AbstractProvider?Object.assign({provider:H},a,f):Object.assign({},a,H,f))),ue(this,p,-2),ue(this,B,null),L&&L.quorum!=null?this.quorum=L.quorum:this.quorum=Math.ceil(q(this,v).reduce((H,V)=>(H+=V.weight,H),0)/2),this.eventQuorum=1,this.eventWorkers=1,(0,e.assertArgument)(this.quorum<=q(this,v).reduce((H,V)=>H+V.weight,0),"quorum exceed provider wieght","quorum",this.quorum)}get providerConfigs(){return q(this,v).map(O=>{const I=Object.assign({},O);for(const L in I)L[0]==="_"&&delete I[L];return I})}async _detectNetwork(){return r.Network.from((0,e.getBigInt)(await this._perform({method:"chainId"})))}async _translatePerform(O,I){switch(I.method){case"broadcastTransaction":return await O.broadcastTransaction(I.signedTransaction);case"call":return await O.call(Object.assign({},I.transaction,{blockTag:I.blockTag}));case"chainId":return(await O.getNetwork()).chainId;case"estimateGas":return await O.estimateGas(I.transaction);case"getBalance":return await O.getBalance(I.address,I.blockTag);case"getBlock":{const L="blockHash"in I?I.blockHash:I.blockTag;return await O.getBlock(L,I.includeTransactions)}case"getBlockNumber":return await O.getBlockNumber();case"getCode":return await O.getCode(I.address,I.blockTag);case"getGasPrice":return(await O.getFeeData()).gasPrice;case"getLogs":return await O.getLogs(I.filter);case"getStorage":return await O.getStorage(I.address,I.position,I.blockTag);case"getTransaction":return await O.getTransaction(I.hash);case"getTransactionCount":return await O.getTransactionCount(I.address,I.blockTag);case"getTransactionReceipt":return await O.getTransactionReceipt(I.hash);case"getTransactionResult":return await O.getTransactionResult(I.hash)}}async _perform(O){if(O.method==="broadcastTransaction"){const H=await Promise.all(q(this,v).map(async({provider:D,weight:j})=>{try{const $=await D._perform(O);return Object.assign(g({result:$}),{weight:j})}catch($){return Object.assign(g({error:$}),{weight:j})}})),V=P(this.quorum,H);if((0,e.assert)(V!==void 0,"problem multi-broadcasting","SERVER_ERROR",{request:"%sub-requests",info:{request:O,results:H.map(l)}}),V instanceof Error)throw V;return V}await _e(this,k,Ah).call(this);const I=new Set;for(let H=0;H<this.quorum;H++)_e(this,k,Za).call(this,I,O);const L=await _e(this,k,Xa).call(this,I,O);for(const H of I)H.perform&&H.result==null&&H.config.lateResponses++;return L}async destroy(){for(const{provider:O}of q(this,v))O.destroy();super.destroy()}}return v=new WeakMap,p=new WeakMap,B=new WeakMap,k=new WeakSet,wh=function(O){const I=Array.from(O).map(H=>H.config),L=q(this,v).slice();s(L),L.sort((H,V)=>H.priority-V.priority);for(const H of L)if(!H._lastFatalError&&I.indexOf(H)===-1)return H;return null},Za=function(O,I){const L=_e(this,k,wh).call(this,O);if(L==null)return null;const H={config:L,result:null,didBump:!1,perform:null,staller:null},V=u();return H.perform=(async()=>{try{L.requests++;const j=await this._translatePerform(L.provider,I);H.result={result:j}}catch(j){L.errorResponses++,H.result={error:j}}const D=u()-V;L._totalTime+=D,L.rollingDuration=.95*L.rollingDuration+.05*D,H.perform=null})(),H.staller=(async()=>{await o(L.stallTimeout),H.staller=null})(),O.add(H),H},Ah=async function(){let O=q(this,B);if(!O){const I=[];q(this,v).forEach(L=>{I.push((async()=>{await d(L,0),L._lastFatalError||(L._network=await L.provider.getNetwork())})())}),ue(this,B,O=(async()=>{await Promise.all(I);let L=null;for(const H of q(this,v)){if(H._lastFatalError)continue;const V=H._network;L==null?L=V.chainId:V.chainId!==L&&(0,e.assert)(!1,"cannot mix providers on different networks","UNSUPPORTED_OPERATION",{operation:"new FallbackProvider"})}})())}await O},Eh=async function(O,I){const L=[];for(const H of O)if(H.result!=null){const{tag:V,value:D}=g(H.result);L.push({tag:V,value:D,weight:H.config.weight})}if(!(L.reduce((H,V)=>H+V.weight,0)<this.quorum)){switch(I.method){case"getBlockNumber":{q(this,p)===-2&&ue(this,p,Math.ceil((0,e.getNumber)(b(this.quorum,q(this,v).filter(V=>!V._lastFatalError).map(V=>({value:V.blockNumber,tag:(0,e.getNumber)(V.blockNumber).toString(),weight:V.weight}))))));const H=w(this.quorum,L);return H===void 0?void 0:(H>q(this,p)&&ue(this,p,H),q(this,p))}case"getGasPrice":case"estimateGas":return b(this.quorum,L);case"getBlock":return"blockTag"in I&&I.blockTag==="pending"?P(this.quorum,L):h(this.quorum,L);case"call":case"chainId":case"getBalance":case"getTransactionCount":case"getCode":case"getStorage":case"getTransaction":case"getTransactionReceipt":case"getLogs":return h(this.quorum,L);case"broadcastTransaction":return P(this.quorum,L)}(0,e.assert)(!1,"unsupported method","UNSUPPORTED_OPERATION",{operation:`_perform(${l(I.method)})`})}},Xa=async function(O,I){if(O.size===0)throw new Error("no runners?!");const L=[];let H=0;for(const D of O){if(D.perform&&L.push(D.perform),D.staller){L.push(D.staller);continue}D.didBump||(D.didBump=!0,H++)}const V=await _e(this,k,Eh).call(this,O,I);if(V!==void 0){if(V instanceof Error)throw V;return V}for(let D=0;D<H;D++)_e(this,k,Za).call(this,O,I);return(0,e.assert)(L.length>0,"quorum not met","SERVER_ERROR",{request:"%sub-requests",info:{request:I,results:Array.from(O).map(D=>l(D.result))}}),await Promise.race(L),await _e(this,k,Xa).call(this,O,I)},Si.FallbackProvider=y,Si}var Lf;function Tm(){if(Lf)return Ai;Lf=1,Object.defineProperty(Ai,"__esModule",{value:!0}),Ai.getDefaultProvider=void 0;const e=Ce(),t=ph(),r=bh(),n=gh(),i=mh(),s=yh(),o=xh(),u=vh(),l=ar(),a=Ht(),f=Dc();function d(h){return h&&typeof h.send=="function"&&typeof h.close=="function"}const c="goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" ");function g(h,b){b==null&&(b={});const P=p=>b[p]==="-"?!1:typeof b.exclusive=="string"?p===b.exclusive:Array.isArray(b.exclusive)?b.exclusive.indexOf(p)!==-1:!0;if(typeof h=="string"&&h.match(/^https?:/))return new l.JsonRpcProvider(h);if(typeof h=="string"&&h.match(/^wss?:/)||d(h))return new f.WebSocketProvider(h);let w=null;try{w=a.Network.from(h)}catch{}const y=[];if(P("publicPolygon")&&w&&w.name==="matic"&&y.push(new l.JsonRpcProvider("https://polygon-rpc.com/",w,{staticNetwork:w})),P("alchemy"))try{y.push(new r.AlchemyProvider(h,b.alchemy))}catch{}if(P("ankr")&&b.ankr!=null)try{y.push(new t.AnkrProvider(h,b.ankr))}catch{}if(P("cloudflare"))try{y.push(new n.CloudflareProvider(h))}catch{}if(P("etherscan"))try{y.push(new i.EtherscanProvider(h,b.etherscan))}catch{}if(P("infura"))try{let p=b.infura,B;typeof p=="object"&&(B=p.projectSecret,p=p.projectId),y.push(new s.InfuraProvider(h,p,B))}catch{}if(P("quicknode"))try{let p=b.quicknode;y.push(new o.QuickNodeProvider(h,p))}catch{}if((0,e.assert)(y.length,"unsupported default network","UNSUPPORTED_OPERATION",{operation:"getDefaultProvider"}),y.length===1)return y[0];let v=Math.floor(y.length/2);return v>2&&(v=2),w&&c.indexOf(w.name)!==-1&&(v=1),b&&b.quorum&&(v=b.quorum),new u.FallbackProvider(y,void 0,{quorum:v})}return Ai.getDefaultProvider=g,Ai}var Oi={},Uf;function Sm(){var n,i;if(Uf)return Oi;Uf=1,Object.defineProperty(Oi,"__esModule",{value:!0}),Oi.NonceManager=void 0;const e=Ce(),t=jc(),s=class s extends t.AbstractSigner{constructor(l){super(l.provider);pe(this,"signer");xe(this,n);xe(this,i);(0,e.defineProperties)(this,{signer:l}),ue(this,n,null),ue(this,i,0)}async getAddress(){return this.signer.getAddress()}connect(l){return new s(this.signer.connect(l))}async getNonce(l){if(l==="pending"){q(this,n)==null&&ue(this,n,super.getNonce("pending"));const a=q(this,i);return await q(this,n)+a}return super.getNonce(l)}increment(){An(this,i)._++}reset(){ue(this,i,0),ue(this,n,null)}async sendTransaction(l){const a=this.getNonce("pending");return this.increment(),l=await this.signer.populateTransaction(l),l.nonce=await a,await this.signer.sendTransaction(l)}signTransaction(l){return this.signer.signTransaction(l)}signMessage(l){return this.signer.signMessage(l)}signTypedData(l,a,f){return this.signer.signTypedData(l,a,f)}};n=new WeakMap,i=new WeakMap;let r=s;return Oi.NonceManager=r,Oi}var Bi={},Ff;function Om(){var n;if(Ff)return Bi;Ff=1,Object.defineProperty(Bi,"__esModule",{value:!0}),Bi.BrowserProvider=void 0;const e=Ce(),t=ar();class r extends t.JsonRpcApiPollingProvider{constructor(o,u){super(u,{batchMaxCount:1});xe(this,n);ue(this,n,async(l,a)=>{const f={method:l,params:a};this.emit("debug",{action:"sendEip1193Request",payload:f});try{const d=await o.request(f);return this.emit("debug",{action:"receiveEip1193Result",result:d}),d}catch(d){const c=new Error(d.message);throw c.code=d.code,c.data=d.data,c.payload=f,this.emit("debug",{action:"receiveEip1193Error",error:c}),c}})}async send(o,u){return await this._start(),await super.send(o,u)}async _send(o){(0,e.assertArgument)(!Array.isArray(o),"EIP-1193 does not support batch request","payload",o);try{const u=await q(this,n).call(this,o.method,o.params||[]);return[{id:o.id,result:u}]}catch(u){return[{id:o.id,error:{code:u.code,data:u.data,message:u.message}}]}}getRpcError(o,u){switch(u=JSON.parse(JSON.stringify(u)),u.error.code||-1){case 4001:u.error.message=`ethers-user-denied: ${u.error.message}`;break;case 4200:u.error.message=`ethers-unsupported: ${u.error.message}`;break}return super.getRpcError(o,u)}async hasSigner(o){o==null&&(o=0);const u=await this.send("eth_accounts",[]);return typeof o=="number"?u.length>o:(o=o.toLowerCase(),u.filter(l=>l.toLowerCase()===o).length!==0)}async getSigner(o){if(o==null&&(o=0),!await this.hasSigner(o))try{await q(this,n).call(this,"eth_requestAccounts",[])}catch(u){const l=u.payload;throw this.getRpcError(l,{id:l.id,error:u})}return await super.getSigner(o)}}return n=new WeakMap,Bi.BrowserProvider=r,Bi}var Ci={},jf;function Bm(){if(jf)return Ci;jf=1,Object.defineProperty(Ci,"__esModule",{value:!0}),Ci.PocketProvider=void 0;const e=Ce(),t=mn(),r=Ht(),n=ar(),i="62e1ad51b37b8e00394bda3b";function s(u){switch(u){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,e.assertArgument)(!1,"unsupported network","network",u)}class o extends n.JsonRpcProvider{constructor(a,f,d){a==null&&(a="mainnet");const c=r.Network.from(a);f==null&&(f=i),d==null&&(d=null);const g={staticNetwork:c},h=o.getRequest(c,f,d);super(h,c,g);pe(this,"applicationId");pe(this,"applicationSecret");(0,e.defineProperties)(this,{applicationId:f,applicationSecret:d})}_getProvider(a){try{return new o(a,this.applicationId,this.applicationSecret)}catch{}return super._getProvider(a)}static getRequest(a,f,d){f==null&&(f=i);const c=new e.FetchRequest(`https://${s(a.name)}/v1/lb/${f}`);return c.allowGzip=!0,d&&c.setCredentials("",d),f===i&&(c.retryFunc=async(g,h,b)=>((0,t.showThrottleMessage)("PocketProvider"),!0)),c}isCommunityResource(){return this.applicationId===i}}return Ci.PocketProvider=o,Ci}var Ri={},Df;function Cm(){if(Df)return Ri;Df=1,Object.defineProperty(Ri,"__esModule",{value:!0}),Ri.IpcSocketProvider=void 0;const e=void 0;return Ri.IpcSocketProvider=e,Ri}var Hf;function Hc(){return Hf||(Hf=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SocketEventSubscriber=e.SocketPendingSubscriber=e.SocketBlockSubscriber=e.SocketSubscriber=e.WebSocketProvider=e.SocketProvider=e.IpcSocketProvider=e.QuickNodeProvider=e.PocketProvider=e.InfuraWebSocketProvider=e.InfuraProvider=e.EtherscanPlugin=e.EtherscanProvider=e.CloudflareProvider=e.AnkrProvider=e.AlchemyProvider=e.BrowserProvider=e.JsonRpcSigner=e.JsonRpcProvider=e.JsonRpcApiProvider=e.FallbackProvider=e.copyRequest=e.TransactionResponse=e.TransactionReceipt=e.Log=e.FeeData=e.Block=e.FetchUrlFeeDataNetworkPlugin=e.FeeDataNetworkPlugin=e.EnsPlugin=e.GasCostPlugin=e.NetworkPlugin=e.NonceManager=e.Network=e.MulticoinProviderPlugin=e.EnsResolver=e.getDefaultProvider=e.showThrottleMessage=e.VoidSigner=e.AbstractSigner=e.UnmanagedSubscriber=e.AbstractProvider=void 0;var t=ms();Object.defineProperty(e,"AbstractProvider",{enumerable:!0,get:function(){return t.AbstractProvider}}),Object.defineProperty(e,"UnmanagedSubscriber",{enumerable:!0,get:function(){return t.UnmanagedSubscriber}});var r=jc();Object.defineProperty(e,"AbstractSigner",{enumerable:!0,get:function(){return r.AbstractSigner}}),Object.defineProperty(e,"VoidSigner",{enumerable:!0,get:function(){return r.VoidSigner}});var n=mn();Object.defineProperty(e,"showThrottleMessage",{enumerable:!0,get:function(){return n.showThrottleMessage}});var i=Tm();Object.defineProperty(e,"getDefaultProvider",{enumerable:!0,get:function(){return i.getDefaultProvider}});var s=dh();Object.defineProperty(e,"EnsResolver",{enumerable:!0,get:function(){return s.EnsResolver}}),Object.defineProperty(e,"MulticoinProviderPlugin",{enumerable:!0,get:function(){return s.MulticoinProviderPlugin}});var o=Ht();Object.defineProperty(e,"Network",{enumerable:!0,get:function(){return o.Network}});var u=Sm();Object.defineProperty(e,"NonceManager",{enumerable:!0,get:function(){return u.NonceManager}});var l=Uc();Object.defineProperty(e,"NetworkPlugin",{enumerable:!0,get:function(){return l.NetworkPlugin}}),Object.defineProperty(e,"GasCostPlugin",{enumerable:!0,get:function(){return l.GasCostPlugin}}),Object.defineProperty(e,"EnsPlugin",{enumerable:!0,get:function(){return l.EnsPlugin}}),Object.defineProperty(e,"FeeDataNetworkPlugin",{enumerable:!0,get:function(){return l.FeeDataNetworkPlugin}}),Object.defineProperty(e,"FetchUrlFeeDataNetworkPlugin",{enumerable:!0,get:function(){return l.FetchUrlFeeDataNetworkPlugin}});var a=gs();Object.defineProperty(e,"Block",{enumerable:!0,get:function(){return a.Block}}),Object.defineProperty(e,"FeeData",{enumerable:!0,get:function(){return a.FeeData}}),Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return a.Log}}),Object.defineProperty(e,"TransactionReceipt",{enumerable:!0,get:function(){return a.TransactionReceipt}}),Object.defineProperty(e,"TransactionResponse",{enumerable:!0,get:function(){return a.TransactionResponse}}),Object.defineProperty(e,"copyRequest",{enumerable:!0,get:function(){return a.copyRequest}});var f=vh();Object.defineProperty(e,"FallbackProvider",{enumerable:!0,get:function(){return f.FallbackProvider}});var d=ar();Object.defineProperty(e,"JsonRpcApiProvider",{enumerable:!0,get:function(){return d.JsonRpcApiProvider}}),Object.defineProperty(e,"JsonRpcProvider",{enumerable:!0,get:function(){return d.JsonRpcProvider}}),Object.defineProperty(e,"JsonRpcSigner",{enumerable:!0,get:function(){return d.JsonRpcSigner}});var c=Om();Object.defineProperty(e,"BrowserProvider",{enumerable:!0,get:function(){return c.BrowserProvider}});var g=bh();Object.defineProperty(e,"AlchemyProvider",{enumerable:!0,get:function(){return g.AlchemyProvider}});var h=ph();Object.defineProperty(e,"AnkrProvider",{enumerable:!0,get:function(){return h.AnkrProvider}});var b=gh();Object.defineProperty(e,"CloudflareProvider",{enumerable:!0,get:function(){return b.CloudflareProvider}});var P=mh();Object.defineProperty(e,"EtherscanProvider",{enumerable:!0,get:function(){return P.EtherscanProvider}}),Object.defineProperty(e,"EtherscanPlugin",{enumerable:!0,get:function(){return P.EtherscanPlugin}});var w=yh();Object.defineProperty(e,"InfuraProvider",{enumerable:!0,get:function(){return w.InfuraProvider}}),Object.defineProperty(e,"InfuraWebSocketProvider",{enumerable:!0,get:function(){return w.InfuraWebSocketProvider}});var y=Bm();Object.defineProperty(e,"PocketProvider",{enumerable:!0,get:function(){return y.PocketProvider}});var v=xh();Object.defineProperty(e,"QuickNodeProvider",{enumerable:!0,get:function(){return v.QuickNodeProvider}});const p=Cm();Object.defineProperty(e,"IpcSocketProvider",{enumerable:!0,get:function(){return p.IpcSocketProvider}});var B=Ya();Object.defineProperty(e,"SocketProvider",{enumerable:!0,get:function(){return B.SocketProvider}});var k=Dc();Object.defineProperty(e,"WebSocketProvider",{enumerable:!0,get:function(){return k.WebSocketProvider}});var R=Ya();Object.defineProperty(e,"SocketSubscriber",{enumerable:!0,get:function(){return R.SocketSubscriber}}),Object.defineProperty(e,"SocketBlockSubscriber",{enumerable:!0,get:function(){return R.SocketBlockSubscriber}}),Object.defineProperty(e,"SocketPendingSubscriber",{enumerable:!0,get:function(){return R.SocketPendingSubscriber}}),Object.defineProperty(e,"SocketEventSubscriber",{enumerable:!0,get:function(){return R.SocketEventSubscriber}})}(ua)),ua}var la={},Ni={},$f;function $c(){var o;if($f)return Ni;$f=1,Object.defineProperty(Ni,"__esModule",{value:!0}),Ni.BaseWallet=void 0;const e=ft(),t=vr(),r=Hc(),n=Ut(),i=Ce(),u=class u extends r.AbstractSigner{constructor(f,d){super(d);pe(this,"address");xe(this,o);(0,i.assertArgument)(f&&typeof f.sign=="function","invalid private key","privateKey","[ REDACTED ]"),ue(this,o,f);const c=(0,n.computeAddress)(this.signingKey.publicKey);(0,i.defineProperties)(this,{address:c})}get signingKey(){return q(this,o)}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(f){return new u(q(this,o),f)}async signTransaction(f){const{to:d,from:c}=await(0,i.resolveProperties)({to:f.to?(0,e.resolveAddress)(f.to,this.provider):void 0,from:f.from?(0,e.resolveAddress)(f.from,this.provider):void 0});d!=null&&(f.to=d),c!=null&&(f.from=c),f.from!=null&&((0,i.assertArgument)((0,e.getAddress)(f.from)===this.address,"transaction from address mismatch","tx.from",f.from),delete f.from);const g=n.Transaction.from(f);return g.signature=this.signingKey.sign(g.unsignedHash),g.serialized}async signMessage(f){return this.signMessageSync(f)}signMessageSync(f){return this.signingKey.sign((0,t.hashMessage)(f)).serialized}async signTypedData(f,d,c){const g=await t.TypedDataEncoder.resolveNames(f,d,c,async h=>{(0,i.assert)(this.provider!=null,"cannot resolve ENS names without a provider","UNSUPPORTED_OPERATION",{operation:"resolveName",info:{name:h}});const b=await this.provider.resolveName(h);return(0,i.assert)(b!=null,"unconfigured ENS name","UNCONFIGURED_NAME",{value:h}),b});return this.signingKey.sign(t.TypedDataEncoder.hash(g.domain,d,g.value)).serialized}};o=new WeakMap;let s=u;return Ni.BaseWallet=s,Ni}var fa={},Ii={},Mi={},sn={},Gf;function _h(){if(Gf)return sn;Gf=1,Object.defineProperty(sn,"__esModule",{value:!0}),sn.decodeOwl=sn.decode=void 0;const e=Ce(),t=" !#$%&'()*+,-./<=>?@[]^_`{|}~",r=/^[a-z]*$/i;function n(o,u){let l=97;return o.reduce((a,f)=>(f===u?l++:f.match(r)?a.push(String.fromCharCode(l)+f):(l=97,a.push(f)),a),[])}function i(o,u){for(let f=t.length-1;f>=0;f--)o=o.split(t[f]).join(u.substring(2*f,2*f+2));const l=[],a=o.replace(/(:|([0-9])|([A-Z][a-z]*))/g,(f,d,c,g)=>{if(c)for(let h=parseInt(c);h>=0;h--)l.push(";");else l.push(d.toLowerCase());return""});if(a)throw new Error(`leftovers: ${JSON.stringify(a)}`);return n(n(l,";"),":")}sn.decode=i;function s(o){return(0,e.assertArgument)(o[0]==="0","unsupported auwl data","data",o),i(o.substring(1+2*t.length),o.substring(1,1+2*t.length))}return sn.decodeOwl=s,sn}var Li={},Kf;function kh(){if(Kf)return Li;Kf=1,Object.defineProperty(Li,"__esModule",{value:!0}),Li.Wordlist=void 0;const e=Ce();class t{constructor(n){pe(this,"locale");(0,e.defineProperties)(this,{locale:n})}split(n){return n.toLowerCase().split(/\s+/g)}join(n){return n.join(" ")}}return Li.Wordlist=t,Li}var qf;function Gc(){var s,o,u,l,ec;if(qf)return Mi;qf=1,Object.defineProperty(Mi,"__esModule",{value:!0}),Mi.WordlistOwl=void 0;const e=vr(),t=Ce(),r=_h(),n=kh();class i extends n.Wordlist{constructor(c,g,h){super(c);xe(this,l);xe(this,s);xe(this,o);xe(this,u);ue(this,s,g),ue(this,o,h),ue(this,u,null)}get _data(){return q(this,s)}_decodeWords(){return(0,r.decodeOwl)(q(this,s))}getWord(c){const g=_e(this,l,ec).call(this);return(0,t.assertArgument)(c>=0&&c<g.length,`invalid word index: ${c}`,"index",c),g[c]}getWordIndex(c){return _e(this,l,ec).call(this).indexOf(c)}}return s=new WeakMap,o=new WeakMap,u=new WeakMap,l=new WeakSet,ec=function(){if(q(this,u)==null){const c=this._decodeWords();if((0,e.id)(c.join(`
|
|
765
|
-
`)+`
|
|
766
|
-
`)!==q(this,o))throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`);ue(this,u,c)}return q(this,u)},Mi.WordlistOwl=i,Mi}var Vf;function oo(){if(Vf)return Ii;Vf=1,Object.defineProperty(Ii,"__esModule",{value:!0}),Ii.LangEn=void 0;const e=Gc(),t="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",r="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60";let n=null;class i extends e.WordlistOwl{constructor(){super("en",t,r)}static wordlist(){return n==null&&(n=new i),n}}return Ii.LangEn=i,Ii}var Ui={},zf;function Kc(){if(zf)return Ui;zf=1,Object.defineProperty(Ui,"__esModule",{value:!0}),Ui.Mnemonic=void 0;const e=ht(),t=Ce(),r=oo();function n(a){return(1<<a)-1<<8-a&255}function i(a){return(1<<a)-1&255}function s(a,f){(0,t.assertNormalize)("NFKD"),f==null&&(f=r.LangEn.wordlist());const d=f.split(a);(0,t.assertArgument)(d.length%3===0&&d.length>=12&&d.length<=24,"invalid mnemonic length","mnemonic","[ REDACTED ]");const c=new Uint8Array(Math.ceil(11*d.length/8));let g=0;for(let y=0;y<d.length;y++){let v=f.getWordIndex(d[y].normalize("NFKD"));(0,t.assertArgument)(v>=0,`invalid mnemonic word at index ${y}`,"mnemonic","[ REDACTED ]");for(let p=0;p<11;p++)v&1<<10-p&&(c[g>>3]|=1<<7-g%8),g++}const h=32*d.length/3,b=d.length/3,P=n(b),w=(0,t.getBytes)((0,e.sha256)(c.slice(0,h/8)))[0]&P;return(0,t.assertArgument)(w===(c[c.length-1]&P),"invalid mnemonic checksum","mnemonic","[ REDACTED ]"),(0,t.hexlify)(c.slice(0,h/8))}function o(a,f){(0,t.assertArgument)(a.length%4===0&&a.length>=16&&a.length<=32,"invalid entropy size","entropy","[ REDACTED ]"),f==null&&(f=r.LangEn.wordlist());const d=[0];let c=11;for(let b=0;b<a.length;b++)c>8?(d[d.length-1]<<=8,d[d.length-1]|=a[b],c-=8):(d[d.length-1]<<=c,d[d.length-1]|=a[b]>>8-c,d.push(a[b]&i(8-c)),c+=3);const g=a.length/4,h=parseInt((0,e.sha256)(a).substring(2,4),16)&n(g);return d[d.length-1]<<=g,d[d.length-1]|=h>>8-g,f.join(d.map(b=>f.getWord(b)))}const u={};class l{constructor(f,d,c,g,h){pe(this,"phrase");pe(this,"password");pe(this,"wordlist");pe(this,"entropy");g==null&&(g=""),h==null&&(h=r.LangEn.wordlist()),(0,t.assertPrivate)(f,u,"Mnemonic"),(0,t.defineProperties)(this,{phrase:c,password:g,wordlist:h,entropy:d})}computeSeed(){const f=(0,t.toUtf8Bytes)("mnemonic"+this.password,"NFKD");return(0,e.pbkdf2)((0,t.toUtf8Bytes)(this.phrase,"NFKD"),f,2048,64,"sha512")}static fromPhrase(f,d,c){const g=s(f,c);return f=o((0,t.getBytes)(g),c),new l(u,g,f,d,c)}static fromEntropy(f,d,c){const g=(0,t.getBytes)(f,"entropy"),h=o(g,c);return new l(u,(0,t.hexlify)(g),h,d,c)}static entropyToPhrase(f,d){const c=(0,t.getBytes)(f,"entropy");return o(c,d)}static phraseToEntropy(f,d){return s(f,d)}static isValidMnemonic(f,d){try{return s(f,d),!0}catch{}return!1}}return Ui.Mnemonic=l,Ui}var Mt={},da={},Fi={},Wf;function Ph(){if(Wf)return Fi;Wf=1;/*! MIT License. Copyright 2015-2022 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */var e=Me&&Me.__classPrivateFieldGet||function(R,T,N,S){if(N==="a"&&!S)throw new TypeError("Private accessor was defined without a getter");if(typeof T=="function"?R!==T||!S:!T.has(R))throw new TypeError("Cannot read private member from an object whose class did not declare it");return N==="m"?S:N==="a"?S.call(R):S?S.value:T.get(R)},t=Me&&Me.__classPrivateFieldSet||function(R,T,N,S,E){if(S==="m")throw new TypeError("Private method is not writable");if(S==="a"&&!E)throw new TypeError("Private accessor was defined without a setter");if(typeof T=="function"?R!==T||!E:!T.has(R))throw new TypeError("Cannot write private member to an object whose class did not declare it");return S==="a"?E.call(R,N):E?E.value=N:T.set(R,N),N},r,n,i;Object.defineProperty(Fi,"__esModule",{value:!0}),Fi.AES=void 0;const s={16:10,24:12,32:14},o=[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],u=[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],l=[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],a=[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],f=[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],d=[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],c=[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],g=[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],h=[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],b=[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],P=[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],w=[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],y=[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],v=[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],p=[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 B(R){const T=[];for(let N=0;N<R.length;N+=4)T.push(R[N]<<24|R[N+1]<<16|R[N+2]<<8|R[N+3]);return T}class k{get key(){return e(this,r,"f").slice()}constructor(T){if(r.set(this,void 0),n.set(this,void 0),i.set(this,void 0),!(this instanceof k))throw Error("AES must be instanitated with `new`");t(this,r,new Uint8Array(T),"f");const N=s[this.key.length];if(N==null)throw new TypeError("invalid key size (must be 16, 24 or 32 bytes)");t(this,i,[],"f"),t(this,n,[],"f");for(let H=0;H<=N;H++)e(this,i,"f").push([0,0,0,0]),e(this,n,"f").push([0,0,0,0]);const S=(N+1)*4,E=this.key.length/4,x=B(this.key);let A;for(let H=0;H<E;H++)A=H>>2,e(this,i,"f")[A][H%4]=x[H],e(this,n,"f")[N-A][H%4]=x[H];let O=0,I=E,L;for(;I<S;){if(L=x[E-1],x[0]^=u[L>>16&255]<<24^u[L>>8&255]<<16^u[L&255]<<8^u[L>>24&255]^o[O]<<24,O+=1,E!=8)for(let j=1;j<E;j++)x[j]^=x[j-1];else{for(let j=1;j<E/2;j++)x[j]^=x[j-1];L=x[E/2-1],x[E/2]^=u[L&255]^u[L>>8&255]<<8^u[L>>16&255]<<16^u[L>>24&255]<<24;for(let j=E/2+1;j<E;j++)x[j]^=x[j-1]}let H=0,V,D;for(;H<E&&I<S;)V=I>>2,D=I%4,e(this,i,"f")[V][D]=x[H],e(this,n,"f")[N-V][D]=x[H++],I++}for(let H=1;H<N;H++)for(let V=0;V<4;V++)L=e(this,n,"f")[H][V],e(this,n,"f")[H][V]=w[L>>24&255]^y[L>>16&255]^v[L>>8&255]^p[L&255]}encrypt(T){if(T.length!=16)throw new TypeError("invalid plaintext size (must be 16 bytes)");const N=e(this,i,"f").length-1,S=[0,0,0,0];let E=B(T);for(let O=0;O<4;O++)E[O]^=e(this,i,"f")[0][O];for(let O=1;O<N;O++){for(let I=0;I<4;I++)S[I]=a[E[I]>>24&255]^f[E[(I+1)%4]>>16&255]^d[E[(I+2)%4]>>8&255]^c[E[(I+3)%4]&255]^e(this,i,"f")[O][I];E=S.slice()}const x=new Uint8Array(16);let A=0;for(let O=0;O<4;O++)A=e(this,i,"f")[N][O],x[4*O]=(u[E[O]>>24&255]^A>>24)&255,x[4*O+1]=(u[E[(O+1)%4]>>16&255]^A>>16)&255,x[4*O+2]=(u[E[(O+2)%4]>>8&255]^A>>8)&255,x[4*O+3]=(u[E[(O+3)%4]&255]^A)&255;return x}decrypt(T){if(T.length!=16)throw new TypeError("invalid ciphertext size (must be 16 bytes)");const N=e(this,n,"f").length-1,S=[0,0,0,0];let E=B(T);for(let O=0;O<4;O++)E[O]^=e(this,n,"f")[0][O];for(let O=1;O<N;O++){for(let I=0;I<4;I++)S[I]=g[E[I]>>24&255]^h[E[(I+3)%4]>>16&255]^b[E[(I+2)%4]>>8&255]^P[E[(I+1)%4]&255]^e(this,n,"f")[O][I];E=S.slice()}const x=new Uint8Array(16);let A=0;for(let O=0;O<4;O++)A=e(this,n,"f")[N][O],x[4*O]=(l[E[O]>>24&255]^A>>24)&255,x[4*O+1]=(l[E[(O+3)%4]>>16&255]^A>>16)&255,x[4*O+2]=(l[E[(O+2)%4]>>8&255]^A>>8)&255,x[4*O+3]=(l[E[(O+1)%4]&255]^A)&255;return x}}return Fi.AES=k,r=new WeakMap,n=new WeakMap,i=new WeakMap,Fi}var ji={},Jf;function Un(){if(Jf)return ji;Jf=1,Object.defineProperty(ji,"__esModule",{value:!0}),ji.ModeOfOperation=void 0;const e=Ph();class t{constructor(n,i,s){if(s&&!(this instanceof s))throw new Error(`${n} must be instantiated with "new"`);Object.defineProperties(this,{aes:{enumerable:!0,value:new e.AES(i)},name:{enumerable:!0,value:n}})}}return ji.ModeOfOperation=t,ji}var Di={},Qf;function Rm(){if(Qf)return Di;Qf=1;var e=Me&&Me.__classPrivateFieldSet||function(o,u,l,a,f){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!f)throw new TypeError("Private accessor was defined without a setter");if(typeof u=="function"?o!==u||!f:!u.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?f.call(o,l):f?f.value=l:u.set(o,l),l},t=Me&&Me.__classPrivateFieldGet||function(o,u,l,a){if(l==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof u=="function"?o!==u||!a:!u.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return l==="m"?a:l==="a"?a.call(o):a?a.value:u.get(o)},r,n;Object.defineProperty(Di,"__esModule",{value:!0}),Di.CBC=void 0;const i=Un();class s extends i.ModeOfOperation{constructor(u,l){if(super("ECC",u,s),r.set(this,void 0),n.set(this,void 0),l){if(l.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");e(this,r,new Uint8Array(l),"f")}else e(this,r,new Uint8Array(16),"f");e(this,n,this.iv,"f")}get iv(){return new Uint8Array(t(this,r,"f"))}encrypt(u){if(u.length%16)throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)");const l=new Uint8Array(u.length);for(let a=0;a<u.length;a+=16){for(let f=0;f<16;f++)t(this,n,"f")[f]^=u[a+f];e(this,n,this.aes.encrypt(t(this,n,"f")),"f"),l.set(t(this,n,"f"),a)}return l}decrypt(u){if(u.length%16)throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)");const l=new Uint8Array(u.length);for(let a=0;a<u.length;a+=16){const f=this.aes.decrypt(u.subarray(a,a+16));for(let d=0;d<16;d++)l[a+d]=f[d]^t(this,n,"f")[d],t(this,n,"f")[d]=u[a+d]}return l}}return Di.CBC=s,r=new WeakMap,n=new WeakMap,Di}var Hi={},Yf;function Nm(){if(Yf)return Hi;Yf=1;var e=Me&&Me.__classPrivateFieldSet||function(l,a,f,d,c){if(d==="m")throw new TypeError("Private method is not writable");if(d==="a"&&!c)throw new TypeError("Private accessor was defined without a setter");if(typeof a=="function"?l!==a||!c:!a.has(l))throw new TypeError("Cannot write private member to an object whose class did not declare it");return d==="a"?c.call(l,f):c?c.value=f:a.set(l,f),f},t=Me&&Me.__classPrivateFieldGet||function(l,a,f,d){if(f==="a"&&!d)throw new TypeError("Private accessor was defined without a getter");if(typeof a=="function"?l!==a||!d:!a.has(l))throw new TypeError("Cannot read private member from an object whose class did not declare it");return f==="m"?d:f==="a"?d.call(l):d?d.value:a.get(l)},r,n,i,s;Object.defineProperty(Hi,"__esModule",{value:!0}),Hi.CFB=void 0;const o=Un();class u extends o.ModeOfOperation{constructor(a,f,d=8){if(super("CFB",a,u),r.add(this),n.set(this,void 0),i.set(this,void 0),!Number.isInteger(d)||d%8)throw new TypeError("invalid segmentSize");if(Object.defineProperties(this,{segmentSize:{enumerable:!0,value:d}}),f){if(f.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");e(this,n,new Uint8Array(f),"f")}else e(this,n,new Uint8Array(16),"f");e(this,i,this.iv,"f")}get iv(){return new Uint8Array(t(this,n,"f"))}encrypt(a){if(8*a.length%this.segmentSize)throw new TypeError("invalid plaintext size (must be multiple of segmentSize bytes)");const f=this.segmentSize/8,d=new Uint8Array(a);for(let c=0;c<d.length;c+=f){const g=this.aes.encrypt(t(this,i,"f"));for(let h=0;h<f;h++)d[c+h]^=g[h];t(this,r,"m",s).call(this,d.subarray(c))}return d}decrypt(a){if(8*a.length%this.segmentSize)throw new TypeError("invalid ciphertext size (must be multiple of segmentSize bytes)");const f=this.segmentSize/8,d=new Uint8Array(a);for(let c=0;c<d.length;c+=f){const g=this.aes.encrypt(t(this,i,"f"));for(let h=0;h<f;h++)d[c+h]^=g[h];t(this,r,"m",s).call(this,a.subarray(c))}return d}}return Hi.CFB=u,n=new WeakMap,i=new WeakMap,r=new WeakSet,s=function(a){const f=this.segmentSize/8;t(this,i,"f").set(t(this,i,"f").subarray(f)),t(this,i,"f").set(a.subarray(0,f),16-f)},Hi}var $i={},Zf;function Im(){if(Zf)return $i;Zf=1;var e=Me&&Me.__classPrivateFieldSet||function(u,l,a,f,d){if(f==="m")throw new TypeError("Private method is not writable");if(f==="a"&&!d)throw new TypeError("Private accessor was defined without a setter");if(typeof l=="function"?u!==l||!d:!l.has(u))throw new TypeError("Cannot write private member to an object whose class did not declare it");return f==="a"?d.call(u,a):d?d.value=a:l.set(u,a),a},t=Me&&Me.__classPrivateFieldGet||function(u,l,a,f){if(a==="a"&&!f)throw new TypeError("Private accessor was defined without a getter");if(typeof l=="function"?u!==l||!f:!l.has(u))throw new TypeError("Cannot read private member from an object whose class did not declare it");return a==="m"?f:a==="a"?f.call(u):f?f.value:l.get(u)},r,n,i;Object.defineProperty($i,"__esModule",{value:!0}),$i.CTR=void 0;const s=Un();class o extends s.ModeOfOperation{constructor(l,a){super("CTR",l,o),r.set(this,void 0),n.set(this,void 0),i.set(this,void 0),e(this,i,new Uint8Array(16),"f"),t(this,i,"f").fill(0),e(this,r,t(this,i,"f"),"f"),e(this,n,16,"f"),a==null&&(a=1),typeof a=="number"?this.setCounterValue(a):this.setCounterBytes(a)}get counter(){return new Uint8Array(t(this,i,"f"))}setCounterValue(l){if(!Number.isInteger(l)||l<0||l>Number.MAX_SAFE_INTEGER)throw new TypeError("invalid counter initial integer value");for(let a=15;a>=0;--a)t(this,i,"f")[a]=l%256,l=Math.floor(l/256)}setCounterBytes(l){if(l.length!==16)throw new TypeError("invalid counter initial Uint8Array value length");t(this,i,"f").set(l)}increment(){for(let l=15;l>=0;l--)if(t(this,i,"f")[l]===255)t(this,i,"f")[l]=0;else{t(this,i,"f")[l]++;break}}encrypt(l){var a,f;const d=new Uint8Array(l);for(let c=0;c<d.length;c++)t(this,n,"f")===16&&(e(this,r,this.aes.encrypt(t(this,i,"f")),"f"),e(this,n,0,"f"),this.increment()),d[c]^=t(this,r,"f")[e(this,n,(f=t(this,n,"f"),a=f++,f),"f"),a];return d}decrypt(l){return this.encrypt(l)}}return $i.CTR=o,r=new WeakMap,n=new WeakMap,i=new WeakMap,$i}var Gi={},Xf;function Mm(){if(Xf)return Gi;Xf=1,Object.defineProperty(Gi,"__esModule",{value:!0}),Gi.ECB=void 0;const e=Un();class t extends e.ModeOfOperation{constructor(n){super("ECB",n,t)}encrypt(n){if(n.length%16)throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)");const i=new Uint8Array(n.length);for(let s=0;s<n.length;s+=16)i.set(this.aes.encrypt(n.subarray(s,s+16)),s);return i}decrypt(n){if(n.length%16)throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)");const i=new Uint8Array(n.length);for(let s=0;s<n.length;s+=16)i.set(this.aes.decrypt(n.subarray(s,s+16)),s);return i}}return Gi.ECB=t,Gi}var Ki={},ed;function Lm(){if(ed)return Ki;ed=1;var e=Me&&Me.__classPrivateFieldSet||function(u,l,a,f,d){if(f==="m")throw new TypeError("Private method is not writable");if(f==="a"&&!d)throw new TypeError("Private accessor was defined without a setter");if(typeof l=="function"?u!==l||!d:!l.has(u))throw new TypeError("Cannot write private member to an object whose class did not declare it");return f==="a"?d.call(u,a):d?d.value=a:l.set(u,a),a},t=Me&&Me.__classPrivateFieldGet||function(u,l,a,f){if(a==="a"&&!f)throw new TypeError("Private accessor was defined without a getter");if(typeof l=="function"?u!==l||!f:!l.has(u))throw new TypeError("Cannot read private member from an object whose class did not declare it");return a==="m"?f:a==="a"?f.call(u):f?f.value:l.get(u)},r,n,i;Object.defineProperty(Ki,"__esModule",{value:!0}),Ki.OFB=void 0;const s=Un();class o extends s.ModeOfOperation{constructor(l,a){if(super("OFB",l,o),r.set(this,void 0),n.set(this,void 0),i.set(this,void 0),a){if(a.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");e(this,r,new Uint8Array(a),"f")}else e(this,r,new Uint8Array(16),"f");e(this,n,this.iv,"f"),e(this,i,16,"f")}get iv(){return new Uint8Array(t(this,r,"f"))}encrypt(l){var a,f;if(l.length%16)throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)");const d=new Uint8Array(l);for(let c=0;c<d.length;c++)t(this,i,"f")===16&&(e(this,n,this.aes.encrypt(t(this,n,"f")),"f"),e(this,i,0,"f")),d[c]^=t(this,n,"f")[e(this,i,(f=t(this,i,"f"),a=f++,f),"f"),a];return d}decrypt(l){if(l.length%16)throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)");return this.encrypt(l)}}return Ki.OFB=o,r=new WeakMap,n=new WeakMap,i=new WeakMap,Ki}var on={},td;function Um(){if(td)return on;td=1,Object.defineProperty(on,"__esModule",{value:!0}),on.pkcs7Strip=on.pkcs7Pad=void 0;function e(r){const n=16-r.length%16,i=new Uint8Array(r.length+n);i.set(r);for(let s=r.length;s<i.length;s++)i[s]=n;return i}on.pkcs7Pad=e;function t(r){if(r.length<16)throw new TypeError("PKCS#7 invalid length");const n=r[r.length-1];if(n>16)throw new TypeError("PKCS#7 padding byte out of range");const i=r.length-n;for(let s=0;s<n;s++)if(r[i+s]!==n)throw new TypeError("PKCS#7 invalid padding byte");return new Uint8Array(r.subarray(0,i))}return on.pkcs7Strip=t,on}var rd;function Th(){return rd||(rd=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.pkcs7Strip=e.pkcs7Pad=e.OFB=e.ECB=e.CTR=e.CFB=e.CBC=e.ModeOfOperation=e.AES=void 0;var t=Ph();Object.defineProperty(e,"AES",{enumerable:!0,get:function(){return t.AES}});var r=Un();Object.defineProperty(e,"ModeOfOperation",{enumerable:!0,get:function(){return r.ModeOfOperation}});var n=Rm();Object.defineProperty(e,"CBC",{enumerable:!0,get:function(){return n.CBC}});var i=Nm();Object.defineProperty(e,"CFB",{enumerable:!0,get:function(){return i.CFB}});var s=Im();Object.defineProperty(e,"CTR",{enumerable:!0,get:function(){return s.CTR}});var o=Mm();Object.defineProperty(e,"ECB",{enumerable:!0,get:function(){return o.ECB}});var u=Lm();Object.defineProperty(e,"OFB",{enumerable:!0,get:function(){return u.OFB}});var l=Um();Object.defineProperty(e,"pkcs7Pad",{enumerable:!0,get:function(){return l.pkcs7Pad}}),Object.defineProperty(e,"pkcs7Strip",{enumerable:!0,get:function(){return l.pkcs7Strip}})}(da)),da}var Wt={},nd;function Sh(){if(nd)return Wt;nd=1,Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.spelunk=Wt.getPassword=Wt.zpad=Wt.looseArrayify=void 0;const e=Ce();function t(s){return typeof s=="string"&&!s.startsWith("0x")&&(s="0x"+s),(0,e.getBytesCopy)(s)}Wt.looseArrayify=t;function r(s,o){for(s=String(s);s.length<o;)s="0"+s;return s}Wt.zpad=r;function n(s){return typeof s=="string"?(0,e.toUtf8Bytes)(s,"NFKC"):(0,e.getBytesCopy)(s)}Wt.getPassword=n;function i(s,o){const u=o.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i);(0,e.assertArgument)(u!=null,"invalid path","path",o);const l=u[1],a=u[3],f=u[4]==="!";let d=s;for(const c of l.toLowerCase().split(".")){if(Array.isArray(d)){if(!c.match(/^[0-9]+$/))break;d=d[parseInt(c)]}else if(typeof d=="object"){let g=null;for(const h in d)if(h.toLowerCase()===c){g=d[h];break}d=g}else d=null;if(d==null)break}if((0,e.assertArgument)(!f||d!=null,"missing required value","path",l),a&&d!=null){if(a==="int"){if(typeof d=="string"&&d.match(/^-?[0-9]+$/))return parseInt(d);if(Number.isSafeInteger(d))return d}if(a==="number"&&typeof d=="string"&&d.match(/^-?[0-9.]*$/))return parseFloat(d);if(a==="data"&&typeof d=="string")return t(d);if(a==="array"&&Array.isArray(d)||a===typeof d)return d;(0,e.assertArgument)(!1,`wrong type found for ${a} `,"path",l)}return d}return Wt.spelunk=i,Wt}var id;function qc(){if(id)return Mt;id=1,Object.defineProperty(Mt,"__esModule",{value:!0}),Mt.encryptKeystoreJson=Mt.encryptKeystoreJsonSync=Mt.decryptKeystoreJson=Mt.decryptKeystoreJsonSync=Mt.isKeystoreJson=void 0;const e=Th(),t=ft(),r=ht(),n=Ut(),i=Ce(),s=Sh(),o=Bc(),u="m/44'/60'/0'/0/0";function l(v){try{const p=JSON.parse(v);if((p.version!=null?parseInt(p.version):0)===3)return!0}catch{}return!1}Mt.isKeystoreJson=l;function a(v,p,B){if((0,s.spelunk)(v,"crypto.cipher:string")==="aes-128-ctr"){const R=(0,s.spelunk)(v,"crypto.cipherparams.iv:data!"),T=new e.CTR(p,R);return(0,i.hexlify)(T.decrypt(B))}(0,i.assert)(!1,"unsupported cipher","UNSUPPORTED_OPERATION",{operation:"decrypt"})}function f(v,p){const B=(0,i.getBytes)(p),k=(0,s.spelunk)(v,"crypto.ciphertext:data!"),R=(0,i.hexlify)((0,r.keccak256)((0,i.concat)([B.slice(16,32),k]))).substring(2);(0,i.assertArgument)(R===(0,s.spelunk)(v,"crypto.mac:string!").toLowerCase(),"incorrect password","password","[ REDACTED ]");const T=a(v,B.slice(0,16),k),N=(0,n.computeAddress)(T);if(v.address){let x=v.address.toLowerCase();x.startsWith("0x")||(x="0x"+x),(0,i.assertArgument)((0,t.getAddress)(x)===N,"keystore address/privateKey mismatch","address",v.address)}const S={address:N,privateKey:T};if((0,s.spelunk)(v,"x-ethers.version:string")==="0.1"){const x=B.slice(32,64),A=(0,s.spelunk)(v,"x-ethers.mnemonicCiphertext:data!"),O=(0,s.spelunk)(v,"x-ethers.mnemonicCounter:data!"),I=new e.CTR(x,O);S.mnemonic={path:(0,s.spelunk)(v,"x-ethers.path:string")||u,locale:(0,s.spelunk)(v,"x-ethers.locale:string")||"en",entropy:(0,i.hexlify)((0,i.getBytes)(I.decrypt(A)))}}return S}function d(v){const p=(0,s.spelunk)(v,"crypto.kdf:string");if(p&&typeof p=="string"){if(p.toLowerCase()==="scrypt"){const B=(0,s.spelunk)(v,"crypto.kdfparams.salt:data!"),k=(0,s.spelunk)(v,"crypto.kdfparams.n:int!"),R=(0,s.spelunk)(v,"crypto.kdfparams.r:int!"),T=(0,s.spelunk)(v,"crypto.kdfparams.p:int!");(0,i.assertArgument)(k>0&&(k&k-1)===0,"invalid kdf.N","kdf.N",k),(0,i.assertArgument)(R>0&&T>0,"invalid kdf","kdf",p);const N=(0,s.spelunk)(v,"crypto.kdfparams.dklen:int!");return(0,i.assertArgument)(N===32,"invalid kdf.dklen","kdf.dflen",N),{name:"scrypt",salt:B,N:k,r:R,p:T,dkLen:64}}else if(p.toLowerCase()==="pbkdf2"){const B=(0,s.spelunk)(v,"crypto.kdfparams.salt:data!"),k=(0,s.spelunk)(v,"crypto.kdfparams.prf:string!"),R=k.split("-").pop();(0,i.assertArgument)(R==="sha256"||R==="sha512","invalid kdf.pdf","kdf.pdf",k);const T=(0,s.spelunk)(v,"crypto.kdfparams.c:int!"),N=(0,s.spelunk)(v,"crypto.kdfparams.dklen:int!");return(0,i.assertArgument)(N===32,"invalid kdf.dklen","kdf.dklen",N),{name:"pbkdf2",salt:B,count:T,dkLen:N,algorithm:R}}}(0,i.assertArgument)(!1,"unsupported key-derivation function","kdf",p)}function c(v,p){const B=JSON.parse(v),k=(0,s.getPassword)(p),R=d(B);if(R.name==="pbkdf2"){const{salt:O,count:I,dkLen:L,algorithm:H}=R,V=(0,r.pbkdf2)(k,O,I,L,H);return f(B,V)}(0,i.assert)(R.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:R});const{salt:T,N,r:S,p:E,dkLen:x}=R,A=(0,r.scryptSync)(k,T,N,S,E,x);return f(B,A)}Mt.decryptKeystoreJsonSync=c;function g(v){return new Promise(p=>{setTimeout(()=>{p()},v)})}async function h(v,p,B){const k=JSON.parse(v),R=(0,s.getPassword)(p),T=d(k);if(T.name==="pbkdf2"){B&&(B(0),await g(0));const{salt:I,count:L,dkLen:H,algorithm:V}=T,D=(0,r.pbkdf2)(R,I,L,H,V);return B&&(B(1),await g(0)),f(k,D)}(0,i.assert)(T.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:T});const{salt:N,N:S,r:E,p:x,dkLen:A}=T,O=await(0,r.scrypt)(R,N,S,E,x,A,B);return f(k,O)}Mt.decryptKeystoreJson=h;function b(v){const p=v.salt!=null?(0,i.getBytes)(v.salt,"options.salt"):(0,r.randomBytes)(32);let B=1<<17,k=8,R=1;return v.scrypt&&(v.scrypt.N&&(B=v.scrypt.N),v.scrypt.r&&(k=v.scrypt.r),v.scrypt.p&&(R=v.scrypt.p)),(0,i.assertArgument)(typeof B=="number"&&B>0&&Number.isSafeInteger(B)&&(BigInt(B)&BigInt(B-1))===BigInt(0),"invalid scrypt N parameter","options.N",B),(0,i.assertArgument)(typeof k=="number"&&k>0&&Number.isSafeInteger(k),"invalid scrypt r parameter","options.r",k),(0,i.assertArgument)(typeof R=="number"&&R>0&&Number.isSafeInteger(R),"invalid scrypt p parameter","options.p",R),{name:"scrypt",dkLen:32,salt:p,N:B,r:k,p:R}}function P(v,p,B,k){const R=(0,i.getBytes)(B.privateKey,"privateKey"),T=k.iv!=null?(0,i.getBytes)(k.iv,"options.iv"):(0,r.randomBytes)(16);(0,i.assertArgument)(T.length===16,"invalid options.iv length","options.iv",k.iv);const N=k.uuid!=null?(0,i.getBytes)(k.uuid,"options.uuid"):(0,r.randomBytes)(16);(0,i.assertArgument)(N.length===16,"invalid options.uuid length","options.uuid",k.iv);const S=v.slice(0,16),E=v.slice(16,32),x=new e.CTR(S,T),A=(0,i.getBytes)(x.encrypt(R)),O=(0,r.keccak256)((0,i.concat)([E,A])),I={address:B.address.substring(2).toLowerCase(),id:(0,i.uuidV4)(N),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:(0,i.hexlify)(T).substring(2)},ciphertext:(0,i.hexlify)(A).substring(2),kdf:"scrypt",kdfparams:{salt:(0,i.hexlify)(p.salt).substring(2),n:p.N,dklen:32,p:p.p,r:p.r},mac:O.substring(2)}};if(B.mnemonic){const L=k.client!=null?k.client:`ethers/${o.version}`,H=B.mnemonic.path||u,V=B.mnemonic.locale||"en",D=v.slice(32,64),j=(0,i.getBytes)(B.mnemonic.entropy,"account.mnemonic.entropy"),$=(0,r.randomBytes)(16),F=new e.CTR(D,$),M=(0,i.getBytes)(F.encrypt(j)),ee=new Date,Q="UTC--"+(ee.getUTCFullYear()+"-"+(0,s.zpad)(ee.getUTCMonth()+1,2)+"-"+(0,s.zpad)(ee.getUTCDate(),2)+"T"+(0,s.zpad)(ee.getUTCHours(),2)+"-"+(0,s.zpad)(ee.getUTCMinutes(),2)+"-"+(0,s.zpad)(ee.getUTCSeconds(),2)+".0Z")+"--"+I.address;I["x-ethers"]={client:L,gethFilename:Q,path:H,locale:V,mnemonicCounter:(0,i.hexlify)($).substring(2),mnemonicCiphertext:(0,i.hexlify)(M).substring(2),version:"0.1"}}return JSON.stringify(I)}function w(v,p,B){B==null&&(B={});const k=(0,s.getPassword)(p),R=b(B),T=(0,r.scryptSync)(k,R.salt,R.N,R.r,R.p,64);return P((0,i.getBytes)(T),R,v,B)}Mt.encryptKeystoreJsonSync=w;async function y(v,p,B){B==null&&(B={});const k=(0,s.getPassword)(p),R=b(B),T=await(0,r.scrypt)(k,R.salt,R.N,R.r,R.p,64,B.progressCallback);return P((0,i.getBytes)(T),R,v,B)}return Mt.encryptKeystoreJson=y,Mt}var sd;function Oh(){return sd||(sd=1,function(e){var k,tc,T,os;Object.defineProperty(e,"__esModule",{value:!0}),e.getIndexedAccountPath=e.getAccountPath=e.HDNodeVoidWallet=e.HDNodeWallet=e.defaultPath=void 0;const t=ht(),r=Hc(),n=Ut(),i=Ce(),s=oo(),o=$c(),u=Kc(),l=qc();e.defaultPath="m/44'/60'/0'/0/0";const a=new Uint8Array([66,105,116,99,111,105,110,32,115,101,101,100]),f=2147483648,d=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),c="0123456789abcdef";function g(E,x){let A="";for(;E;)A=c[E%16]+A,E=Math.trunc(E/16);for(;A.length<x*2;)A="0"+A;return"0x"+A}function h(E){const x=(0,i.getBytes)(E),A=(0,i.dataSlice)((0,t.sha256)((0,t.sha256)(x)),0,4),O=(0,i.concat)([x,A]);return(0,i.encodeBase58)(O)}const b={};function P(E,x,A,O){const I=new Uint8Array(37);E&f?((0,i.assert)(O!=null,"cannot derive child of neutered node","UNSUPPORTED_OPERATION",{operation:"deriveChild"}),I.set((0,i.getBytes)(O),1)):I.set((0,i.getBytes)(A));for(let H=24;H>=0;H-=8)I[33+(H>>3)]=E>>24-H&255;const L=(0,i.getBytes)((0,t.computeHmac)("sha512",x,I));return{IL:L.slice(0,32),IR:L.slice(32)}}function w(E,x){const A=x.split("/");(0,i.assertArgument)(A.length>0&&(A[0]==="m"||E.depth>0),"invalid path","path",x),A[0]==="m"&&A.shift();let O=E;for(let I=0;I<A.length;I++){const L=A[I];if(L.match(/^[0-9]+'$/)){const H=parseInt(L.substring(0,L.length-1));(0,i.assertArgument)(H<f,"invalid path index",`path[${I}]`,L),O=O.deriveChild(f+H)}else if(L.match(/^[0-9]+$/)){const H=parseInt(L);(0,i.assertArgument)(H<f,"invalid path index",`path[${I}]`,L),O=O.deriveChild(H)}else(0,i.assertArgument)(!1,"invalid path component",`path[${I}]`,L)}return O}const S=class S extends o.BaseWallet{constructor(A,O,I,L,H,V,D,j,$){super(O,$);xe(this,k);pe(this,"publicKey");pe(this,"fingerprint");pe(this,"parentFingerprint");pe(this,"mnemonic");pe(this,"chainCode");pe(this,"path");pe(this,"index");pe(this,"depth");(0,i.assertPrivate)(A,b,"HDNodeWallet"),(0,i.defineProperties)(this,{publicKey:O.compressedPublicKey});const F=(0,i.dataSlice)((0,t.ripemd160)((0,t.sha256)(this.publicKey)),0,4);(0,i.defineProperties)(this,{parentFingerprint:I,fingerprint:F,chainCode:L,path:H,index:V,depth:D}),(0,i.defineProperties)(this,{mnemonic:j})}connect(A){return new S(b,this.signingKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.mnemonic,A)}async encrypt(A,O){return await(0,l.encryptKeystoreJson)(_e(this,k,tc).call(this),A,{progressCallback:O})}encryptSync(A){return(0,l.encryptKeystoreJsonSync)(_e(this,k,tc).call(this),A)}get extendedKey(){return(0,i.assert)(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),h((0,i.concat)(["0x0488ADE4",g(this.depth,1),this.parentFingerprint,g(this.index,4),this.chainCode,(0,i.concat)(["0x00",this.privateKey])]))}hasPath(){return this.path!=null}neuter(){return new v(b,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.provider)}deriveChild(A){const O=(0,i.getNumber)(A,"index");(0,i.assertArgument)(O<=4294967295,"invalid index","index",O);let I=this.path;I&&(I+="/"+(O&~f),O&f&&(I+="'"));const{IR:L,IL:H}=P(O,this.chainCode,this.publicKey,this.privateKey),V=new t.SigningKey((0,i.toBeHex)(((0,i.toBigInt)(H)+BigInt(this.privateKey))%d,32));return new S(b,V,this.fingerprint,(0,i.hexlify)(L),I,O,this.depth+1,this.mnemonic,this.provider)}derivePath(A){return w(this,A)}static fromExtendedKey(A){const O=(0,i.toBeArray)((0,i.decodeBase58)(A));(0,i.assertArgument)(O.length===82||h(O.slice(0,78))===A,"invalid extended key","extendedKey","[ REDACTED ]");const I=O[4],L=(0,i.hexlify)(O.slice(5,9)),H=parseInt((0,i.hexlify)(O.slice(9,13)).substring(2),16),V=(0,i.hexlify)(O.slice(13,45)),D=O.slice(45,78);switch((0,i.hexlify)(O.slice(0,4))){case"0x0488b21e":case"0x043587cf":{const j=(0,i.hexlify)(D);return new v(b,(0,n.computeAddress)(j),j,L,V,null,H,I,null)}case"0x0488ade4":case"0x04358394 ":if(D[0]!==0)break;return new S(b,new t.SigningKey(D.slice(1)),L,V,null,H,I,null,null)}(0,i.assertArgument)(!1,"invalid extended key prefix","extendedKey","[ REDACTED ]")}static createRandom(A,O,I){var H;A==null&&(A=""),O==null&&(O=e.defaultPath),I==null&&(I=s.LangEn.wordlist());const L=u.Mnemonic.fromEntropy((0,t.randomBytes)(16),A,I);return _e(H=S,T,os).call(H,L.computeSeed(),L).derivePath(O)}static fromMnemonic(A,O){var I;return O||(O=e.defaultPath),_e(I=S,T,os).call(I,A.computeSeed(),A).derivePath(O)}static fromPhrase(A,O,I,L){var V;O==null&&(O=""),I==null&&(I=e.defaultPath),L==null&&(L=s.LangEn.wordlist());const H=u.Mnemonic.fromPhrase(A,O,L);return _e(V=S,T,os).call(V,H.computeSeed(),H).derivePath(I)}static fromSeed(A){var O;return _e(O=S,T,os).call(O,A,null)}};k=new WeakSet,tc=function(){const A={address:this.address,privateKey:this.privateKey},O=this.mnemonic;return this.path&&O&&O.wordlist.locale==="en"&&O.password===""&&(A.mnemonic={path:this.path,locale:"en",entropy:O.entropy}),A},T=new WeakSet,os=function(A,O){(0,i.assertArgument)((0,i.isBytesLike)(A),"invalid seed","seed","[REDACTED]");const I=(0,i.getBytes)(A,"seed");(0,i.assertArgument)(I.length>=16&&I.length<=64,"invalid seed","seed","[REDACTED]");const L=(0,i.getBytes)((0,t.computeHmac)("sha512",a,I)),H=new t.SigningKey((0,i.hexlify)(L.slice(0,32)));return new S(b,H,"0x00000000",(0,i.hexlify)(L.slice(32)),"m",0,0,O,null)},xe(S,T);let y=S;e.HDNodeWallet=y;class v extends r.VoidSigner{constructor(A,O,I,L,H,V,D,j,$){super(O,$);pe(this,"publicKey");pe(this,"fingerprint");pe(this,"parentFingerprint");pe(this,"chainCode");pe(this,"path");pe(this,"index");pe(this,"depth");(0,i.assertPrivate)(A,b,"HDNodeVoidWallet"),(0,i.defineProperties)(this,{publicKey:I});const F=(0,i.dataSlice)((0,t.ripemd160)((0,t.sha256)(I)),0,4);(0,i.defineProperties)(this,{publicKey:I,fingerprint:F,parentFingerprint:L,chainCode:H,path:V,index:D,depth:j})}connect(A){return new v(b,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,A)}get extendedKey(){return(0,i.assert)(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),h((0,i.concat)(["0x0488B21E",g(this.depth,1),this.parentFingerprint,g(this.index,4),this.chainCode,this.publicKey]))}hasPath(){return this.path!=null}deriveChild(A){const O=(0,i.getNumber)(A,"index");(0,i.assertArgument)(O<=4294967295,"invalid index","index",O);let I=this.path;I&&(I+="/"+(O&~f),O&f&&(I+="'"));const{IR:L,IL:H}=P(O,this.chainCode,this.publicKey,null),V=t.SigningKey.addPoints(H,this.publicKey,!0),D=(0,n.computeAddress)(V);return new v(b,D,V,this.fingerprint,(0,i.hexlify)(L),I,O,this.depth+1,this.provider)}derivePath(A){return w(this,A)}}e.HDNodeVoidWallet=v;function p(E){const x=(0,i.getNumber)(E,"index");return(0,i.assertArgument)(x>=0&&x<f,"invalid account index","index",x),`m/44'/60'/${x}'/0/0`}e.getAccountPath=p;function B(E){const x=(0,i.getNumber)(E,"index");return(0,i.assertArgument)(x>=0&&x<f,"invalid account index","index",x),`m/44'/60'/0'/0/${x}`}e.getIndexedAccountPath=B}(fa)),fa}var an={},od;function Bh(){if(od)return an;od=1,Object.defineProperty(an,"__esModule",{value:!0}),an.decryptCrowdsaleJson=an.isCrowdsaleJson=void 0;const e=Th(),t=ft(),r=ht(),n=vr(),i=Ce(),s=Sh();function o(l){try{if(JSON.parse(l).encseed)return!0}catch{}return!1}an.isCrowdsaleJson=o;function u(l,a){const f=JSON.parse(l),d=(0,s.getPassword)(a),c=(0,t.getAddress)((0,s.spelunk)(f,"ethaddr:string!")),g=(0,s.looseArrayify)((0,s.spelunk)(f,"encseed:string!"));(0,i.assertArgument)(g&&g.length%16===0,"invalid encseed","json",l);const h=(0,i.getBytes)((0,r.pbkdf2)(d,d,2e3,32,"sha256")).slice(0,16),b=g.slice(0,16),P=g.slice(16),w=new e.CBC(h,b),y=(0,e.pkcs7Strip)((0,i.getBytes)(w.decrypt(P)));let v="";for(let p=0;p<y.length;p++)v+=String.fromCharCode(y[p]);return{address:c,privateKey:(0,n.id)(v)}}return an.decryptCrowdsaleJson=u,an}var qi={},ad;function Fm(){var a,rc;if(ad)return qi;ad=1,Object.defineProperty(qi,"__esModule",{value:!0}),qi.Wallet=void 0;const e=ht(),t=Ce(),r=$c(),n=Oh(),i=Bh(),s=qc(),o=Kc();function u(c){return new Promise(g=>{setTimeout(()=>{g()},c)})}const d=class d extends r.BaseWallet{constructor(g,h){typeof g=="string"&&!g.startsWith("0x")&&(g="0x"+g);let b=typeof g=="string"?new e.SigningKey(g):g;super(b,h)}connect(g){return new d(this.signingKey,g)}async encrypt(g,h){const b={address:this.address,privateKey:this.privateKey};return await(0,s.encryptKeystoreJson)(b,g,{progressCallback:h})}encryptSync(g){const h={address:this.address,privateKey:this.privateKey};return(0,s.encryptKeystoreJsonSync)(h,g)}static async fromEncryptedJson(g,h,b){var w;let P=null;return(0,s.isKeystoreJson)(g)?P=await(0,s.decryptKeystoreJson)(g,h,b):(0,i.isCrowdsaleJson)(g)&&(b&&(b(0),await u(0)),P=(0,i.decryptCrowdsaleJson)(g,h),b&&(b(1),await u(0))),_e(w=d,a,rc).call(w,P)}static fromEncryptedJsonSync(g,h){var P;let b=null;return(0,s.isKeystoreJson)(g)?b=(0,s.decryptKeystoreJsonSync)(g,h):(0,i.isCrowdsaleJson)(g)?b=(0,i.decryptCrowdsaleJson)(g,h):(0,t.assertArgument)(!1,"invalid JSON wallet","json","[ REDACTED ]"),_e(P=d,a,rc).call(P,b)}static createRandom(g){const h=n.HDNodeWallet.createRandom();return g?h.connect(g):h}static fromPhrase(g,h){const b=n.HDNodeWallet.fromPhrase(g);return h?b.connect(h):b}};a=new WeakSet,rc=function(g){if((0,t.assertArgument)(g,"invalid JSON wallet","json","[ REDACTED ]"),"mnemonic"in g&&g.mnemonic&&g.mnemonic.locale==="en"){const b=o.Mnemonic.fromEntropy(g.mnemonic.entropy),P=n.HDNodeWallet.fromMnemonic(b,g.mnemonic.path);if(P.address===g.address&&P.privateKey===g.privateKey)return P;console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key")}const h=new d(g.privateKey);return(0,t.assertArgument)(h.address===g.address,"address/privateKey mismatch","json","[ REDACTED ]"),h},xe(d,a);let l=d;return qi.Wallet=l,qi}var cd;function jm(){return cd||(cd=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Wallet=e.Mnemonic=e.encryptKeystoreJsonSync=e.encryptKeystoreJson=e.decryptKeystoreJson=e.decryptKeystoreJsonSync=e.isKeystoreJson=e.decryptCrowdsaleJson=e.isCrowdsaleJson=e.HDNodeVoidWallet=e.HDNodeWallet=e.getIndexedAccountPath=e.getAccountPath=e.defaultPath=e.BaseWallet=void 0;var t=$c();Object.defineProperty(e,"BaseWallet",{enumerable:!0,get:function(){return t.BaseWallet}});var r=Oh();Object.defineProperty(e,"defaultPath",{enumerable:!0,get:function(){return r.defaultPath}}),Object.defineProperty(e,"getAccountPath",{enumerable:!0,get:function(){return r.getAccountPath}}),Object.defineProperty(e,"getIndexedAccountPath",{enumerable:!0,get:function(){return r.getIndexedAccountPath}}),Object.defineProperty(e,"HDNodeWallet",{enumerable:!0,get:function(){return r.HDNodeWallet}}),Object.defineProperty(e,"HDNodeVoidWallet",{enumerable:!0,get:function(){return r.HDNodeVoidWallet}});var n=Bh();Object.defineProperty(e,"isCrowdsaleJson",{enumerable:!0,get:function(){return n.isCrowdsaleJson}}),Object.defineProperty(e,"decryptCrowdsaleJson",{enumerable:!0,get:function(){return n.decryptCrowdsaleJson}});var i=qc();Object.defineProperty(e,"isKeystoreJson",{enumerable:!0,get:function(){return i.isKeystoreJson}}),Object.defineProperty(e,"decryptKeystoreJsonSync",{enumerable:!0,get:function(){return i.decryptKeystoreJsonSync}}),Object.defineProperty(e,"decryptKeystoreJson",{enumerable:!0,get:function(){return i.decryptKeystoreJson}}),Object.defineProperty(e,"encryptKeystoreJson",{enumerable:!0,get:function(){return i.encryptKeystoreJson}}),Object.defineProperty(e,"encryptKeystoreJsonSync",{enumerable:!0,get:function(){return i.encryptKeystoreJsonSync}});var s=Kc();Object.defineProperty(e,"Mnemonic",{enumerable:!0,get:function(){return s.Mnemonic}});var o=Fm();Object.defineProperty(e,"Wallet",{enumerable:!0,get:function(){return o.Wallet}})}(la)),la}var ha={},Vi={},zi={},Wi={},ud;function Dm(){if(ud)return Wi;ud=1,Object.defineProperty(Wi,"__esModule",{value:!0}),Wi.decodeBits=void 0;const e=")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_";function t(r,n){const i=(1<<r)-1,s=[];let o=0,u=0,l=0;for(let a=0;a<n.length;a++)for(o=o<<6|e.indexOf(n[a]),u+=6;u>=r;){const f=o>>u-r;o&=(1<<u-r)-1,u-=r,f===0?l+=i:(s.push(f+l),l=0)}return s}return Wi.decodeBits=t,Wi}var ld;function Hm(){if(ld)return zi;ld=1,Object.defineProperty(zi,"__esModule",{value:!0}),zi.decodeOwlA=void 0;const e=Ce(),t=Dm(),r=_h();function n(i,s){let o=(0,r.decodeOwl)(i).join(",");return s.split(/,/g).forEach(u=>{const l=u.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/);(0,e.assertArgument)(l!==null,"internal error parsing accents","accents",s);let a=0;const f=(0,t.decodeBits)(parseInt(l[3]),l[4]),d=parseInt(l[2]),c=new RegExp(`([${l[1]}])`,"g");o=o.replace(c,(g,h)=>(--f[a]===0&&(h=String.fromCharCode(h.charCodeAt(0),d),a++),h))}),o.split(",")}return zi.decodeOwlA=n,zi}var fd;function $m(){var n;if(fd)return Vi;fd=1,Object.defineProperty(Vi,"__esModule",{value:!0}),Vi.WordlistOwlA=void 0;const e=Gc(),t=Hm();class r extends e.WordlistOwl{constructor(o,u,l,a){super(o,u,a);xe(this,n);ue(this,n,l)}get _accent(){return q(this,n)}_decodeWords(){return(0,t.decodeOwlA)(this._data,this._accent)}}return n=new WeakMap,Vi.WordlistOwlA=r,Vi}var Ji={},dd;function Gm(){if(dd)return Ji;dd=1,Object.defineProperty(Ji,"__esModule",{value:!0}),Ji.wordlists=void 0;const e=oo();return Ji.wordlists={en:e.LangEn.wordlist()},Ji}var hd;function Km(){return hd||(hd=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.wordlists=e.WordlistOwlA=e.WordlistOwl=e.LangEn=e.Wordlist=void 0;var t=kh();Object.defineProperty(e,"Wordlist",{enumerable:!0,get:function(){return t.Wordlist}});var r=oo();Object.defineProperty(e,"LangEn",{enumerable:!0,get:function(){return r.LangEn}});var n=Gc();Object.defineProperty(e,"WordlistOwl",{enumerable:!0,get:function(){return n.WordlistOwl}});var i=$m();Object.defineProperty(e,"WordlistOwlA",{enumerable:!0,get:function(){return i.WordlistOwlA}});var s=Gm();Object.defineProperty(e,"wordlists",{enumerable:!0,get:function(){return s.wordlists}})}(ha)),ha}var pd;function bd(){return pd||(pd=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ripemd160=e.keccak256=e.randomBytes=e.computeHmac=e.UndecodedEventLog=e.EventLog=e.ContractUnknownEventPayload=e.ContractTransactionResponse=e.ContractTransactionReceipt=e.ContractEventPayload=e.ContractFactory=e.Contract=e.BaseContract=e.MessagePrefix=e.EtherSymbol=e.ZeroHash=e.N=e.MaxInt256=e.MinInt256=e.MaxUint256=e.WeiPerEther=e.ZeroAddress=e.resolveAddress=e.isAddress=e.isAddressable=e.getCreate2Address=e.getCreateAddress=e.getIcapAddress=e.getAddress=e.Typed=e.TransactionDescription=e.Result=e.LogDescription=e.Interface=e.Indexed=e.ErrorDescription=e.checkResultErrors=e.StructFragment=e.ParamType=e.NamedFragment=e.FunctionFragment=e.FallbackFragment=e.Fragment=e.EventFragment=e.ErrorFragment=e.ConstructorFragment=e.AbiCoder=e.encodeBytes32String=e.decodeBytes32String=e.version=void 0,e.EtherscanPlugin=e.EnsPlugin=e.Network=e.EnsResolver=e.WebSocketProvider=e.SocketProvider=e.IpcSocketProvider=e.QuickNodeProvider=e.PocketProvider=e.InfuraWebSocketProvider=e.InfuraProvider=e.EtherscanProvider=e.CloudflareProvider=e.AnkrProvider=e.AlchemyProvider=e.BrowserProvider=e.JsonRpcSigner=e.JsonRpcProvider=e.JsonRpcApiProvider=e.FallbackProvider=e.AbstractProvider=e.VoidSigner=e.NonceManager=e.AbstractSigner=e.TransactionResponse=e.TransactionReceipt=e.Log=e.FeeData=e.Block=e.getDefaultProvider=e.verifyTypedData=e.TypedDataEncoder=e.solidityPackedSha256=e.solidityPackedKeccak256=e.solidityPacked=e.verifyMessage=e.hashMessage=e.dnsEncode=e.namehash=e.isValidName=e.ensNormalize=e.id=e.SigningKey=e.Signature=e.lock=e.scryptSync=e.scrypt=e.pbkdf2=e.sha512=e.sha256=void 0,e.toBeArray=e.getUint=e.getNumber=e.getBigInt=e.FixedNumber=e.FetchCancelSignal=e.FetchResponse=e.FetchRequest=e.EventPayload=e.isError=e.isCallException=e.makeError=e.assertPrivate=e.assertNormalize=e.assertArgumentCount=e.assertArgument=e.assert=e.resolveProperties=e.defineProperties=e.zeroPadValue=e.zeroPadBytes=e.stripZerosLeft=e.isBytesLike=e.isHexString=e.hexlify=e.getBytesCopy=e.getBytes=e.dataSlice=e.dataLength=e.concat=e.encodeBase64=e.decodeBase64=e.encodeBase58=e.decodeBase58=e.Transaction=e.recoverAddress=e.computeAddress=e.accessListify=e.showThrottleMessage=e.copyRequest=e.UnmanagedSubscriber=e.SocketSubscriber=e.SocketPendingSubscriber=e.SocketEventSubscriber=e.SocketBlockSubscriber=e.MulticoinProviderPlugin=e.NetworkPlugin=e.GasCostPlugin=e.FetchUrlFeeDataNetworkPlugin=e.FeeDataNetworkPlugin=void 0,e.wordlists=e.WordlistOwlA=e.WordlistOwl=e.LangEn=e.Wordlist=e.encryptKeystoreJsonSync=e.encryptKeystoreJson=e.decryptKeystoreJson=e.decryptKeystoreJsonSync=e.decryptCrowdsaleJson=e.isKeystoreJson=e.isCrowdsaleJson=e.getIndexedAccountPath=e.getAccountPath=e.defaultPath=e.Wallet=e.HDNodeVoidWallet=e.HDNodeWallet=e.BaseWallet=e.Mnemonic=e.uuidV4=e.encodeRlp=e.decodeRlp=e.Utf8ErrorFuncs=e.toUtf8String=e.toUtf8CodePoints=e.toUtf8Bytes=e.parseUnits=e.formatUnits=e.parseEther=e.formatEther=e.mask=e.toTwos=e.fromTwos=e.toQuantity=e.toNumber=e.toBeHex=e.toBigInt=void 0;var t=Bc();Object.defineProperty(e,"version",{enumerable:!0,get:function(){return t.version}});var r=bs();Object.defineProperty(e,"decodeBytes32String",{enumerable:!0,get:function(){return r.decodeBytes32String}}),Object.defineProperty(e,"encodeBytes32String",{enumerable:!0,get:function(){return r.encodeBytes32String}}),Object.defineProperty(e,"AbiCoder",{enumerable:!0,get:function(){return r.AbiCoder}}),Object.defineProperty(e,"ConstructorFragment",{enumerable:!0,get:function(){return r.ConstructorFragment}}),Object.defineProperty(e,"ErrorFragment",{enumerable:!0,get:function(){return r.ErrorFragment}}),Object.defineProperty(e,"EventFragment",{enumerable:!0,get:function(){return r.EventFragment}}),Object.defineProperty(e,"Fragment",{enumerable:!0,get:function(){return r.Fragment}}),Object.defineProperty(e,"FallbackFragment",{enumerable:!0,get:function(){return r.FallbackFragment}}),Object.defineProperty(e,"FunctionFragment",{enumerable:!0,get:function(){return r.FunctionFragment}}),Object.defineProperty(e,"NamedFragment",{enumerable:!0,get:function(){return r.NamedFragment}}),Object.defineProperty(e,"ParamType",{enumerable:!0,get:function(){return r.ParamType}}),Object.defineProperty(e,"StructFragment",{enumerable:!0,get:function(){return r.StructFragment}}),Object.defineProperty(e,"checkResultErrors",{enumerable:!0,get:function(){return r.checkResultErrors}}),Object.defineProperty(e,"ErrorDescription",{enumerable:!0,get:function(){return r.ErrorDescription}}),Object.defineProperty(e,"Indexed",{enumerable:!0,get:function(){return r.Indexed}}),Object.defineProperty(e,"Interface",{enumerable:!0,get:function(){return r.Interface}}),Object.defineProperty(e,"LogDescription",{enumerable:!0,get:function(){return r.LogDescription}}),Object.defineProperty(e,"Result",{enumerable:!0,get:function(){return r.Result}}),Object.defineProperty(e,"TransactionDescription",{enumerable:!0,get:function(){return r.TransactionDescription}}),Object.defineProperty(e,"Typed",{enumerable:!0,get:function(){return r.Typed}});var n=ft();Object.defineProperty(e,"getAddress",{enumerable:!0,get:function(){return n.getAddress}}),Object.defineProperty(e,"getIcapAddress",{enumerable:!0,get:function(){return n.getIcapAddress}}),Object.defineProperty(e,"getCreateAddress",{enumerable:!0,get:function(){return n.getCreateAddress}}),Object.defineProperty(e,"getCreate2Address",{enumerable:!0,get:function(){return n.getCreate2Address}}),Object.defineProperty(e,"isAddressable",{enumerable:!0,get:function(){return n.isAddressable}}),Object.defineProperty(e,"isAddress",{enumerable:!0,get:function(){return n.isAddress}}),Object.defineProperty(e,"resolveAddress",{enumerable:!0,get:function(){return n.resolveAddress}});var i=ps();Object.defineProperty(e,"ZeroAddress",{enumerable:!0,get:function(){return i.ZeroAddress}}),Object.defineProperty(e,"WeiPerEther",{enumerable:!0,get:function(){return i.WeiPerEther}}),Object.defineProperty(e,"MaxUint256",{enumerable:!0,get:function(){return i.MaxUint256}}),Object.defineProperty(e,"MinInt256",{enumerable:!0,get:function(){return i.MinInt256}}),Object.defineProperty(e,"MaxInt256",{enumerable:!0,get:function(){return i.MaxInt256}}),Object.defineProperty(e,"N",{enumerable:!0,get:function(){return i.N}}),Object.defineProperty(e,"ZeroHash",{enumerable:!0,get:function(){return i.ZeroHash}}),Object.defineProperty(e,"EtherSymbol",{enumerable:!0,get:function(){return i.EtherSymbol}}),Object.defineProperty(e,"MessagePrefix",{enumerable:!0,get:function(){return i.MessagePrefix}});var s=so();Object.defineProperty(e,"BaseContract",{enumerable:!0,get:function(){return s.BaseContract}}),Object.defineProperty(e,"Contract",{enumerable:!0,get:function(){return s.Contract}}),Object.defineProperty(e,"ContractFactory",{enumerable:!0,get:function(){return s.ContractFactory}}),Object.defineProperty(e,"ContractEventPayload",{enumerable:!0,get:function(){return s.ContractEventPayload}}),Object.defineProperty(e,"ContractTransactionReceipt",{enumerable:!0,get:function(){return s.ContractTransactionReceipt}}),Object.defineProperty(e,"ContractTransactionResponse",{enumerable:!0,get:function(){return s.ContractTransactionResponse}}),Object.defineProperty(e,"ContractUnknownEventPayload",{enumerable:!0,get:function(){return s.ContractUnknownEventPayload}}),Object.defineProperty(e,"EventLog",{enumerable:!0,get:function(){return s.EventLog}}),Object.defineProperty(e,"UndecodedEventLog",{enumerable:!0,get:function(){return s.UndecodedEventLog}});var o=ht();Object.defineProperty(e,"computeHmac",{enumerable:!0,get:function(){return o.computeHmac}}),Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return o.randomBytes}}),Object.defineProperty(e,"keccak256",{enumerable:!0,get:function(){return o.keccak256}}),Object.defineProperty(e,"ripemd160",{enumerable:!0,get:function(){return o.ripemd160}}),Object.defineProperty(e,"sha256",{enumerable:!0,get:function(){return o.sha256}}),Object.defineProperty(e,"sha512",{enumerable:!0,get:function(){return o.sha512}}),Object.defineProperty(e,"pbkdf2",{enumerable:!0,get:function(){return o.pbkdf2}}),Object.defineProperty(e,"scrypt",{enumerable:!0,get:function(){return o.scrypt}}),Object.defineProperty(e,"scryptSync",{enumerable:!0,get:function(){return o.scryptSync}}),Object.defineProperty(e,"lock",{enumerable:!0,get:function(){return o.lock}}),Object.defineProperty(e,"Signature",{enumerable:!0,get:function(){return o.Signature}}),Object.defineProperty(e,"SigningKey",{enumerable:!0,get:function(){return o.SigningKey}});var u=vr();Object.defineProperty(e,"id",{enumerable:!0,get:function(){return u.id}}),Object.defineProperty(e,"ensNormalize",{enumerable:!0,get:function(){return u.ensNormalize}}),Object.defineProperty(e,"isValidName",{enumerable:!0,get:function(){return u.isValidName}}),Object.defineProperty(e,"namehash",{enumerable:!0,get:function(){return u.namehash}}),Object.defineProperty(e,"dnsEncode",{enumerable:!0,get:function(){return u.dnsEncode}}),Object.defineProperty(e,"hashMessage",{enumerable:!0,get:function(){return u.hashMessage}}),Object.defineProperty(e,"verifyMessage",{enumerable:!0,get:function(){return u.verifyMessage}}),Object.defineProperty(e,"solidityPacked",{enumerable:!0,get:function(){return u.solidityPacked}}),Object.defineProperty(e,"solidityPackedKeccak256",{enumerable:!0,get:function(){return u.solidityPackedKeccak256}}),Object.defineProperty(e,"solidityPackedSha256",{enumerable:!0,get:function(){return u.solidityPackedSha256}}),Object.defineProperty(e,"TypedDataEncoder",{enumerable:!0,get:function(){return u.TypedDataEncoder}}),Object.defineProperty(e,"verifyTypedData",{enumerable:!0,get:function(){return u.verifyTypedData}});var l=Hc();Object.defineProperty(e,"getDefaultProvider",{enumerable:!0,get:function(){return l.getDefaultProvider}}),Object.defineProperty(e,"Block",{enumerable:!0,get:function(){return l.Block}}),Object.defineProperty(e,"FeeData",{enumerable:!0,get:function(){return l.FeeData}}),Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return l.Log}}),Object.defineProperty(e,"TransactionReceipt",{enumerable:!0,get:function(){return l.TransactionReceipt}}),Object.defineProperty(e,"TransactionResponse",{enumerable:!0,get:function(){return l.TransactionResponse}}),Object.defineProperty(e,"AbstractSigner",{enumerable:!0,get:function(){return l.AbstractSigner}}),Object.defineProperty(e,"NonceManager",{enumerable:!0,get:function(){return l.NonceManager}}),Object.defineProperty(e,"VoidSigner",{enumerable:!0,get:function(){return l.VoidSigner}}),Object.defineProperty(e,"AbstractProvider",{enumerable:!0,get:function(){return l.AbstractProvider}}),Object.defineProperty(e,"FallbackProvider",{enumerable:!0,get:function(){return l.FallbackProvider}}),Object.defineProperty(e,"JsonRpcApiProvider",{enumerable:!0,get:function(){return l.JsonRpcApiProvider}}),Object.defineProperty(e,"JsonRpcProvider",{enumerable:!0,get:function(){return l.JsonRpcProvider}}),Object.defineProperty(e,"JsonRpcSigner",{enumerable:!0,get:function(){return l.JsonRpcSigner}}),Object.defineProperty(e,"BrowserProvider",{enumerable:!0,get:function(){return l.BrowserProvider}}),Object.defineProperty(e,"AlchemyProvider",{enumerable:!0,get:function(){return l.AlchemyProvider}}),Object.defineProperty(e,"AnkrProvider",{enumerable:!0,get:function(){return l.AnkrProvider}}),Object.defineProperty(e,"CloudflareProvider",{enumerable:!0,get:function(){return l.CloudflareProvider}}),Object.defineProperty(e,"EtherscanProvider",{enumerable:!0,get:function(){return l.EtherscanProvider}}),Object.defineProperty(e,"InfuraProvider",{enumerable:!0,get:function(){return l.InfuraProvider}}),Object.defineProperty(e,"InfuraWebSocketProvider",{enumerable:!0,get:function(){return l.InfuraWebSocketProvider}}),Object.defineProperty(e,"PocketProvider",{enumerable:!0,get:function(){return l.PocketProvider}}),Object.defineProperty(e,"QuickNodeProvider",{enumerable:!0,get:function(){return l.QuickNodeProvider}}),Object.defineProperty(e,"IpcSocketProvider",{enumerable:!0,get:function(){return l.IpcSocketProvider}}),Object.defineProperty(e,"SocketProvider",{enumerable:!0,get:function(){return l.SocketProvider}}),Object.defineProperty(e,"WebSocketProvider",{enumerable:!0,get:function(){return l.WebSocketProvider}}),Object.defineProperty(e,"EnsResolver",{enumerable:!0,get:function(){return l.EnsResolver}}),Object.defineProperty(e,"Network",{enumerable:!0,get:function(){return l.Network}}),Object.defineProperty(e,"EnsPlugin",{enumerable:!0,get:function(){return l.EnsPlugin}}),Object.defineProperty(e,"EtherscanPlugin",{enumerable:!0,get:function(){return l.EtherscanPlugin}}),Object.defineProperty(e,"FeeDataNetworkPlugin",{enumerable:!0,get:function(){return l.FeeDataNetworkPlugin}}),Object.defineProperty(e,"FetchUrlFeeDataNetworkPlugin",{enumerable:!0,get:function(){return l.FetchUrlFeeDataNetworkPlugin}}),Object.defineProperty(e,"GasCostPlugin",{enumerable:!0,get:function(){return l.GasCostPlugin}}),Object.defineProperty(e,"NetworkPlugin",{enumerable:!0,get:function(){return l.NetworkPlugin}}),Object.defineProperty(e,"MulticoinProviderPlugin",{enumerable:!0,get:function(){return l.MulticoinProviderPlugin}}),Object.defineProperty(e,"SocketBlockSubscriber",{enumerable:!0,get:function(){return l.SocketBlockSubscriber}}),Object.defineProperty(e,"SocketEventSubscriber",{enumerable:!0,get:function(){return l.SocketEventSubscriber}}),Object.defineProperty(e,"SocketPendingSubscriber",{enumerable:!0,get:function(){return l.SocketPendingSubscriber}}),Object.defineProperty(e,"SocketSubscriber",{enumerable:!0,get:function(){return l.SocketSubscriber}}),Object.defineProperty(e,"UnmanagedSubscriber",{enumerable:!0,get:function(){return l.UnmanagedSubscriber}}),Object.defineProperty(e,"copyRequest",{enumerable:!0,get:function(){return l.copyRequest}}),Object.defineProperty(e,"showThrottleMessage",{enumerable:!0,get:function(){return l.showThrottleMessage}});var a=Ut();Object.defineProperty(e,"accessListify",{enumerable:!0,get:function(){return a.accessListify}}),Object.defineProperty(e,"computeAddress",{enumerable:!0,get:function(){return a.computeAddress}}),Object.defineProperty(e,"recoverAddress",{enumerable:!0,get:function(){return a.recoverAddress}}),Object.defineProperty(e,"Transaction",{enumerable:!0,get:function(){return a.Transaction}});var f=Ce();Object.defineProperty(e,"decodeBase58",{enumerable:!0,get:function(){return f.decodeBase58}}),Object.defineProperty(e,"encodeBase58",{enumerable:!0,get:function(){return f.encodeBase58}}),Object.defineProperty(e,"decodeBase64",{enumerable:!0,get:function(){return f.decodeBase64}}),Object.defineProperty(e,"encodeBase64",{enumerable:!0,get:function(){return f.encodeBase64}}),Object.defineProperty(e,"concat",{enumerable:!0,get:function(){return f.concat}}),Object.defineProperty(e,"dataLength",{enumerable:!0,get:function(){return f.dataLength}}),Object.defineProperty(e,"dataSlice",{enumerable:!0,get:function(){return f.dataSlice}}),Object.defineProperty(e,"getBytes",{enumerable:!0,get:function(){return f.getBytes}}),Object.defineProperty(e,"getBytesCopy",{enumerable:!0,get:function(){return f.getBytesCopy}}),Object.defineProperty(e,"hexlify",{enumerable:!0,get:function(){return f.hexlify}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return f.isHexString}}),Object.defineProperty(e,"isBytesLike",{enumerable:!0,get:function(){return f.isBytesLike}}),Object.defineProperty(e,"stripZerosLeft",{enumerable:!0,get:function(){return f.stripZerosLeft}}),Object.defineProperty(e,"zeroPadBytes",{enumerable:!0,get:function(){return f.zeroPadBytes}}),Object.defineProperty(e,"zeroPadValue",{enumerable:!0,get:function(){return f.zeroPadValue}}),Object.defineProperty(e,"defineProperties",{enumerable:!0,get:function(){return f.defineProperties}}),Object.defineProperty(e,"resolveProperties",{enumerable:!0,get:function(){return f.resolveProperties}}),Object.defineProperty(e,"assert",{enumerable:!0,get:function(){return f.assert}}),Object.defineProperty(e,"assertArgument",{enumerable:!0,get:function(){return f.assertArgument}}),Object.defineProperty(e,"assertArgumentCount",{enumerable:!0,get:function(){return f.assertArgumentCount}}),Object.defineProperty(e,"assertNormalize",{enumerable:!0,get:function(){return f.assertNormalize}}),Object.defineProperty(e,"assertPrivate",{enumerable:!0,get:function(){return f.assertPrivate}}),Object.defineProperty(e,"makeError",{enumerable:!0,get:function(){return f.makeError}}),Object.defineProperty(e,"isCallException",{enumerable:!0,get:function(){return f.isCallException}}),Object.defineProperty(e,"isError",{enumerable:!0,get:function(){return f.isError}}),Object.defineProperty(e,"EventPayload",{enumerable:!0,get:function(){return f.EventPayload}}),Object.defineProperty(e,"FetchRequest",{enumerable:!0,get:function(){return f.FetchRequest}}),Object.defineProperty(e,"FetchResponse",{enumerable:!0,get:function(){return f.FetchResponse}}),Object.defineProperty(e,"FetchCancelSignal",{enumerable:!0,get:function(){return f.FetchCancelSignal}}),Object.defineProperty(e,"FixedNumber",{enumerable:!0,get:function(){return f.FixedNumber}}),Object.defineProperty(e,"getBigInt",{enumerable:!0,get:function(){return f.getBigInt}}),Object.defineProperty(e,"getNumber",{enumerable:!0,get:function(){return f.getNumber}}),Object.defineProperty(e,"getUint",{enumerable:!0,get:function(){return f.getUint}}),Object.defineProperty(e,"toBeArray",{enumerable:!0,get:function(){return f.toBeArray}}),Object.defineProperty(e,"toBigInt",{enumerable:!0,get:function(){return f.toBigInt}}),Object.defineProperty(e,"toBeHex",{enumerable:!0,get:function(){return f.toBeHex}}),Object.defineProperty(e,"toNumber",{enumerable:!0,get:function(){return f.toNumber}}),Object.defineProperty(e,"toQuantity",{enumerable:!0,get:function(){return f.toQuantity}}),Object.defineProperty(e,"fromTwos",{enumerable:!0,get:function(){return f.fromTwos}}),Object.defineProperty(e,"toTwos",{enumerable:!0,get:function(){return f.toTwos}}),Object.defineProperty(e,"mask",{enumerable:!0,get:function(){return f.mask}}),Object.defineProperty(e,"formatEther",{enumerable:!0,get:function(){return f.formatEther}}),Object.defineProperty(e,"parseEther",{enumerable:!0,get:function(){return f.parseEther}}),Object.defineProperty(e,"formatUnits",{enumerable:!0,get:function(){return f.formatUnits}}),Object.defineProperty(e,"parseUnits",{enumerable:!0,get:function(){return f.parseUnits}}),Object.defineProperty(e,"toUtf8Bytes",{enumerable:!0,get:function(){return f.toUtf8Bytes}}),Object.defineProperty(e,"toUtf8CodePoints",{enumerable:!0,get:function(){return f.toUtf8CodePoints}}),Object.defineProperty(e,"toUtf8String",{enumerable:!0,get:function(){return f.toUtf8String}}),Object.defineProperty(e,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return f.Utf8ErrorFuncs}}),Object.defineProperty(e,"decodeRlp",{enumerable:!0,get:function(){return f.decodeRlp}}),Object.defineProperty(e,"encodeRlp",{enumerable:!0,get:function(){return f.encodeRlp}}),Object.defineProperty(e,"uuidV4",{enumerable:!0,get:function(){return f.uuidV4}});var d=jm();Object.defineProperty(e,"Mnemonic",{enumerable:!0,get:function(){return d.Mnemonic}}),Object.defineProperty(e,"BaseWallet",{enumerable:!0,get:function(){return d.BaseWallet}}),Object.defineProperty(e,"HDNodeWallet",{enumerable:!0,get:function(){return d.HDNodeWallet}}),Object.defineProperty(e,"HDNodeVoidWallet",{enumerable:!0,get:function(){return d.HDNodeVoidWallet}}),Object.defineProperty(e,"Wallet",{enumerable:!0,get:function(){return d.Wallet}}),Object.defineProperty(e,"defaultPath",{enumerable:!0,get:function(){return d.defaultPath}}),Object.defineProperty(e,"getAccountPath",{enumerable:!0,get:function(){return d.getAccountPath}}),Object.defineProperty(e,"getIndexedAccountPath",{enumerable:!0,get:function(){return d.getIndexedAccountPath}}),Object.defineProperty(e,"isCrowdsaleJson",{enumerable:!0,get:function(){return d.isCrowdsaleJson}}),Object.defineProperty(e,"isKeystoreJson",{enumerable:!0,get:function(){return d.isKeystoreJson}}),Object.defineProperty(e,"decryptCrowdsaleJson",{enumerable:!0,get:function(){return d.decryptCrowdsaleJson}}),Object.defineProperty(e,"decryptKeystoreJsonSync",{enumerable:!0,get:function(){return d.decryptKeystoreJsonSync}}),Object.defineProperty(e,"decryptKeystoreJson",{enumerable:!0,get:function(){return d.decryptKeystoreJson}}),Object.defineProperty(e,"encryptKeystoreJson",{enumerable:!0,get:function(){return d.encryptKeystoreJson}}),Object.defineProperty(e,"encryptKeystoreJsonSync",{enumerable:!0,get:function(){return d.encryptKeystoreJsonSync}});var c=Km();Object.defineProperty(e,"Wordlist",{enumerable:!0,get:function(){return c.Wordlist}}),Object.defineProperty(e,"LangEn",{enumerable:!0,get:function(){return c.LangEn}}),Object.defineProperty(e,"WordlistOwl",{enumerable:!0,get:function(){return c.WordlistOwl}}),Object.defineProperty(e,"WordlistOwlA",{enumerable:!0,get:function(){return c.WordlistOwlA}}),Object.defineProperty(e,"wordlists",{enumerable:!0,get:function(){return c.wordlists}})}(zo)),zo}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ethers=void 0;const t=Og,r=t.__importStar(bd());e.ethers=r,t.__exportStar(bd(),e)})(Sc);Object.defineProperty(yr,"__esModule",{value:!0});yr.getAddress=yr.hashMessage=yr.verifyMessage=void 0;const _n=Sc;let nc=null,ic=null,sc=null;try{nc=_n.ethers.utils.verifyMessage,ic=_n.ethers.utils.hashMessage,sc=_n.ethers.utils.getAddress}catch{nc=_n.ethers.verifyMessage,ic=_n.ethers.hashMessage,sc=_n.ethers.getAddress}yr.verifyMessage=nc;yr.hashMessage=ic;yr.getAddress=sc;var Vc={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SiweErrorType=e.SiweError=e.VerifyOptsKeys=e.VerifyParamsKeys=void 0,e.VerifyParamsKeys=["signature","scheme","domain","nonce","time"],e.VerifyOptsKeys=["provider","suppressExceptions","verificationFallback"];class t{constructor(n,i,s){this.type=n,this.expected=i,this.received=s}}e.SiweError=t,function(r){r.EXPIRED_MESSAGE="Expired message.",r.INVALID_DOMAIN="Invalid domain.",r.SCHEME_MISMATCH="Scheme does not match provided scheme for verification.",r.DOMAIN_MISMATCH="Domain does not match provided domain for verification.",r.NONCE_MISMATCH="Nonce does not match provided nonce for verification.",r.INVALID_ADDRESS="Invalid address.",r.INVALID_URI="URI does not conform to RFC 3986.",r.INVALID_NONCE="Nonce size smaller then 8 characters or is not alphanumeric.",r.NOT_YET_VALID_MESSAGE="Message is not valid yet.",r.INVALID_SIGNATURE="Signature does not match address of the message.",r.INVALID_TIME_FORMAT="Invalid time format.",r.INVALID_MESSAGE_VERSION="Invalid message version.",r.UNABLE_TO_PARSE="Unable to parse the message."}(e.SiweErrorType||(e.SiweErrorType={}))})(Vc);var Jt={},Ch={},ao={},co={};Object.defineProperty(co,"__esModule",{value:!0});co.BrowserRandomSource=void 0;const gd=65536;class qm{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const t=typeof self<"u"?self.crypto||self.msCrypto:null;t&&t.getRandomValues!==void 0&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(t);for(let n=0;n<r.length;n+=gd)this._crypto.getRandomValues(r.subarray(n,n+Math.min(r.length-n,gd)));return r}}co.BrowserRandomSource=qm;function Vm(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var uo={},lo={};Object.defineProperty(lo,"__esModule",{value:!0});function zm(e){for(var t=0;t<e.length;t++)e[t]=0;return e}lo.wipe=zm;const Wm={},Jm=Object.freeze(Object.defineProperty({__proto__:null,default:Wm},Symbol.toStringTag,{value:"Module"})),fo=a0(Jm);Object.defineProperty(uo,"__esModule",{value:!0});uo.NodeRandomSource=void 0;const Qm=lo;class Ym{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Vm<"u"){const t=fo;t&&t.randomBytes&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(t);if(r.length!==t)throw new Error("NodeRandomSource: got fewer bytes than requested");const n=new Uint8Array(t);for(let i=0;i<n.length;i++)n[i]=r[i];return(0,Qm.wipe)(r),n}}uo.NodeRandomSource=Ym;Object.defineProperty(ao,"__esModule",{value:!0});ao.SystemRandomSource=void 0;const Zm=co,Xm=uo;class ey{constructor(){if(this.isAvailable=!1,this.name="",this._source=new Zm.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new Xm.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(t){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(t)}}ao.SystemRandomSource=ey;var Ke={},Rh={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});function t(u,l){var a=u>>>16&65535,f=u&65535,d=l>>>16&65535,c=l&65535;return f*c+(a*c+f*d<<16>>>0)|0}e.mul=Math.imul||t;function r(u,l){return u+l|0}e.add=r;function n(u,l){return u-l|0}e.sub=n;function i(u,l){return u<<l|u>>>32-l}e.rotl=i;function s(u,l){return u<<32-l|u>>>l}e.rotr=s;function o(u){return typeof u=="number"&&isFinite(u)&&Math.floor(u)===u}e.isInteger=Number.isInteger||o,e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(u){return e.isInteger(u)&&u>=-e.MAX_SAFE_INTEGER&&u<=e.MAX_SAFE_INTEGER}})(Rh);Object.defineProperty(Ke,"__esModule",{value:!0});var Nh=Rh;function ty(e,t){return t===void 0&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16}Ke.readInt16BE=ty;function ry(e,t){return t===void 0&&(t=0),(e[t+0]<<8|e[t+1])>>>0}Ke.readUint16BE=ry;function ny(e,t){return t===void 0&&(t=0),(e[t+1]<<8|e[t])<<16>>16}Ke.readInt16LE=ny;function iy(e,t){return t===void 0&&(t=0),(e[t+1]<<8|e[t])>>>0}Ke.readUint16LE=iy;function Ih(e,t,r){return t===void 0&&(t=new Uint8Array(2)),r===void 0&&(r=0),t[r+0]=e>>>8,t[r+1]=e>>>0,t}Ke.writeUint16BE=Ih;Ke.writeInt16BE=Ih;function Mh(e,t,r){return t===void 0&&(t=new Uint8Array(2)),r===void 0&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t}Ke.writeUint16LE=Mh;Ke.writeInt16LE=Mh;function oc(e,t){return t===void 0&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}Ke.readInt32BE=oc;function ac(e,t){return t===void 0&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}Ke.readUint32BE=ac;function cc(e,t){return t===void 0&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}Ke.readInt32LE=cc;function uc(e,t){return t===void 0&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}Ke.readUint32LE=uc;function Gs(e,t,r){return t===void 0&&(t=new Uint8Array(4)),r===void 0&&(r=0),t[r+0]=e>>>24,t[r+1]=e>>>16,t[r+2]=e>>>8,t[r+3]=e>>>0,t}Ke.writeUint32BE=Gs;Ke.writeInt32BE=Gs;function Ks(e,t,r){return t===void 0&&(t=new Uint8Array(4)),r===void 0&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,t}Ke.writeUint32LE=Ks;Ke.writeInt32LE=Ks;function sy(e,t){t===void 0&&(t=0);var r=oc(e,t),n=oc(e,t+4);return r*4294967296+n-(n>>31)*4294967296}Ke.readInt64BE=sy;function oy(e,t){t===void 0&&(t=0);var r=ac(e,t),n=ac(e,t+4);return r*4294967296+n}Ke.readUint64BE=oy;function ay(e,t){t===void 0&&(t=0);var r=cc(e,t),n=cc(e,t+4);return n*4294967296+r-(r>>31)*4294967296}Ke.readInt64LE=ay;function cy(e,t){t===void 0&&(t=0);var r=uc(e,t),n=uc(e,t+4);return n*4294967296+r}Ke.readUint64LE=cy;function Lh(e,t,r){return t===void 0&&(t=new Uint8Array(8)),r===void 0&&(r=0),Gs(e/4294967296>>>0,t,r),Gs(e>>>0,t,r+4),t}Ke.writeUint64BE=Lh;Ke.writeInt64BE=Lh;function Uh(e,t,r){return t===void 0&&(t=new Uint8Array(8)),r===void 0&&(r=0),Ks(e>>>0,t,r),Ks(e/4294967296>>>0,t,r+4),t}Ke.writeUint64LE=Uh;Ke.writeInt64LE=Uh;function uy(e,t,r){if(r===void 0&&(r=0),e%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=e/8+r-1;s>=r;s--)n+=t[s]*i,i*=256;return n}Ke.readUintBE=uy;function ly(e,t,r){if(r===void 0&&(r=0),e%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s<r+e/8;s++)n+=t[s]*i,i*=256;return n}Ke.readUintLE=ly;function fy(e,t,r,n){if(r===void 0&&(r=new Uint8Array(e/8)),n===void 0&&(n=0),e%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!Nh.isSafeInteger(t))throw new Error("writeUintBE value must be an integer");for(var i=1,s=e/8+n-1;s>=n;s--)r[s]=t/i&255,i*=256;return r}Ke.writeUintBE=fy;function dy(e,t,r,n){if(r===void 0&&(r=new Uint8Array(e/8)),n===void 0&&(n=0),e%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Nh.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s<n+e/8;s++)r[s]=t/i&255,i*=256;return r}Ke.writeUintLE=dy;function hy(e,t){t===void 0&&(t=0);var r=new DataView(e.buffer,e.byteOffset,e.byteLength);return r.getFloat32(t)}Ke.readFloat32BE=hy;function py(e,t){t===void 0&&(t=0);var r=new DataView(e.buffer,e.byteOffset,e.byteLength);return r.getFloat32(t,!0)}Ke.readFloat32LE=py;function by(e,t){t===void 0&&(t=0);var r=new DataView(e.buffer,e.byteOffset,e.byteLength);return r.getFloat64(t)}Ke.readFloat64BE=by;function gy(e,t){t===void 0&&(t=0);var r=new DataView(e.buffer,e.byteOffset,e.byteLength);return r.getFloat64(t,!0)}Ke.readFloat64LE=gy;function my(e,t,r){t===void 0&&(t=new Uint8Array(4)),r===void 0&&(r=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.setFloat32(r,e),t}Ke.writeFloat32BE=my;function yy(e,t,r){t===void 0&&(t=new Uint8Array(4)),r===void 0&&(r=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.setFloat32(r,e,!0),t}Ke.writeFloat32LE=yy;function xy(e,t,r){t===void 0&&(t=new Uint8Array(8)),r===void 0&&(r=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.setFloat64(r,e),t}Ke.writeFloat64BE=xy;function wy(e,t,r){t===void 0&&(t=new Uint8Array(8)),r===void 0&&(r=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.setFloat64(r,e,!0),t}Ke.writeFloat64LE=wy;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.randomStringForEntropy=e.randomString=e.randomUint32=e.randomBytes=e.defaultRandomSource=void 0;const t=ao,r=Ke,n=lo;e.defaultRandomSource=new t.SystemRandomSource;function i(a,f=e.defaultRandomSource){return f.randomBytes(a)}e.randomBytes=i;function s(a=e.defaultRandomSource){const f=i(4,a),d=(0,r.readUint32LE)(f);return(0,n.wipe)(f),d}e.randomUint32=s;const o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function u(a,f=o,d=e.defaultRandomSource){if(f.length<2)throw new Error("randomString charset is too short");if(f.length>256)throw new Error("randomString charset is too long");let c="";const g=f.length,h=256-256%g;for(;a>0;){const b=i(Math.ceil(a*256/h),d);for(let P=0;P<b.length&&a>0;P++){const w=b[P];w<h&&(c+=f.charAt(w%g),a--)}(0,n.wipe)(b)}return c}e.randomString=u;function l(a,f=o,d=e.defaultRandomSource){const c=Math.ceil(a/(Math.log(f.length)/Math.LN2));return u(c,f,d)}e.randomStringForEntropy=l})(Ch);var Ay=Me&&Me.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(f){try{a(n.next(f))}catch(d){o(d)}}function l(f){try{a(n.throw(f))}catch(d){o(d)}}function a(f){f.done?s(f.value):i(f.value).then(u,l)}a((n=n.apply(e,t||[])).next())})};Object.defineProperty(Jt,"__esModule",{value:!0});Jt.checkInvalidKeys=Jt.isValidISO8601Date=Jt.generateNonce=Jt.checkContractWalletSignature=void 0;const Ey=Ch,vy=Sc,_y=yr,ky=["function isValidSignature(bytes32 _message, bytes _signature) public view returns (bytes4)"],Py="0x1626ba7e",md=/^(?<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]))$/,Ty=(e,t,r)=>Ay(void 0,void 0,void 0,function*(){if(!r)return!1;const n=new vy.Contract(e.address,ky,r),i=(0,_y.hashMessage)(e.prepareMessage());return(yield n.isValidSignature(i,t))===Py});Jt.checkContractWalletSignature=Ty;const Sy=()=>{const e=(0,Ey.randomStringForEntropy)(96);if(!e||e.length<8)throw new Error("Error during nonce creation.");return e};Jt.generateNonce=Sy;const Oy=e=>{const t=md.exec(e);if(!e)return!1;const r=new Date(t.groups.date).toISOString(),n=md.exec(r);return t.groups.date===n.groups.date};Jt.isValidISO8601Date=Oy;const By=(e,t)=>{const r=[];return Object.keys(e).forEach(n=>{t.includes(n)||r.push(n)}),r};Jt.checkInvalidKeys=By;var Cy=Me&&Me.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Ry=Me&&Me.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ny=Me&&Me.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Cy(t,e,r);return Ry(t,e),t},yd=Me&&Me.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(f){try{a(n.next(f))}catch(d){o(d)}}function l(f){try{a(n.throw(f))}catch(d){o(d)}}function a(f){f.done?s(f.value):i(f.value).then(u,l)}a((n=n.apply(e,t||[])).next())})};Object.defineProperty(Zs,"__esModule",{value:!0});Zs.SiweMessage=void 0;const pa=u0,Iy=Ny(og),xd=yr,ze=Vc,Pr=Jt;class My{constructor(t){if(typeof t=="string"){const r=new pa.ParsedMessage(t);this.scheme=r.scheme,this.domain=r.domain,this.address=r.address,this.statement=r.statement,this.uri=r.uri,this.version=r.version,this.nonce=r.nonce,this.issuedAt=r.issuedAt,this.expirationTime=r.expirationTime,this.notBefore=r.notBefore,this.requestId=r.requestId,this.chainId=r.chainId,this.resources=r.resources}else this.scheme=t==null?void 0:t.scheme,this.domain=t.domain,this.address=t.address,this.statement=t==null?void 0:t.statement,this.uri=t.uri,this.version=t.version,this.chainId=t.chainId,this.nonce=t.nonce,this.issuedAt=t==null?void 0:t.issuedAt,this.expirationTime=t==null?void 0:t.expirationTime,this.notBefore=t==null?void 0:t.notBefore,this.requestId=t==null?void 0:t.requestId,this.resources=t==null?void 0:t.resources,typeof this.chainId=="string"&&(this.chainId=(0,pa.parseIntegerNumber)(this.chainId));this.nonce=this.nonce||(0,Pr.generateNonce)(),this.validateMessage()}toMessage(){this.validateMessage();const r=`${this.scheme?`${this.scheme}://${this.domain}`:this.domain} wants you to sign in with your Ethereum account:`,n=`URI: ${this.uri}`;let i=[r,this.address].join(`
|
|
767
|
-
`);const s=`Version: ${this.version}`;this.nonce||(this.nonce=(0,Pr.generateNonce)());const o="Chain ID: "+this.chainId||"1",u=`Nonce: ${this.nonce}`,l=[n,s,o,u];if(this.issuedAt=this.issuedAt||new Date().toISOString(),l.push(`Issued At: ${this.issuedAt}`),this.expirationTime){const f=`Expiration Time: ${this.expirationTime}`;l.push(f)}this.notBefore&&l.push(`Not Before: ${this.notBefore}`),this.requestId&&l.push(`Request ID: ${this.requestId}`),this.resources&&l.push(["Resources:",...this.resources.map(f=>`- ${f}`)].join(`
|
|
768
|
-
`));const a=l.join(`
|
|
769
|
-
`);return i=[i,this.statement].join(`
|
|
770
|
-
|
|
771
|
-
`),this.statement&&(i+=`
|
|
772
|
-
`),[i,a].join(`
|
|
773
|
-
`)}prepareMessage(){let t;switch(this.version){case"1":{t=this.toMessage();break}default:{t=this.toMessage();break}}return t}validate(t,r){return yd(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:t},{provider:r,suppressExceptions:!1}).then(({data:n})=>n).catch(({error:n})=>{throw n})})}verify(t,r={suppressExceptions:!1}){return yd(this,void 0,void 0,function*(){return new Promise((n,i)=>{var s,o,u;const l=v=>r.suppressExceptions?n(v):i(v),a=(0,Pr.checkInvalidKeys)(t,ze.VerifyParamsKeys);a.length>0&&l({success:!1,data:this,error:new Error(`${a.join(", ")} is/are not valid key(s) for VerifyParams.`)});const f=(0,Pr.checkInvalidKeys)(r,ze.VerifyOptsKeys);a.length>0&&l({success:!1,data:this,error:new Error(`${f.join(", ")} is/are not valid key(s) for VerifyOpts.`)});const{signature:d,scheme:c,domain:g,nonce:h,time:b}=t;c&&c!==this.scheme&&l({success:!1,data:this,error:new ze.SiweError(ze.SiweErrorType.SCHEME_MISMATCH,c,this.scheme)}),g&&g!==this.domain&&l({success:!1,data:this,error:new ze.SiweError(ze.SiweErrorType.DOMAIN_MISMATCH,g,this.domain)}),h&&h!==this.nonce&&l({success:!1,data:this,error:new ze.SiweError(ze.SiweErrorType.NONCE_MISMATCH,h,this.nonce)});const P=new Date(b||new Date);if(this.expirationTime){const v=new Date(this.expirationTime);P.getTime()>=v.getTime()&&l({success:!1,data:this,error:new ze.SiweError(ze.SiweErrorType.EXPIRED_MESSAGE,`${P.toISOString()} < ${v.toISOString()}`,`${P.toISOString()} >= ${v.toISOString()}`)})}if(this.notBefore){const v=new Date(this.notBefore);P.getTime()<v.getTime()&&l({success:!1,data:this,error:new ze.SiweError(ze.SiweErrorType.NOT_YET_VALID_MESSAGE,`${P.toISOString()} >= ${v.toISOString()}`,`${P.toISOString()} < ${v.toISOString()}`)})}let w;try{w=this.prepareMessage()}catch(v){l({success:!1,data:this,error:v})}let y;try{y=(0,xd.verifyMessage)(w,d)}catch(v){console.error(v)}if(y===this.address)return n({success:!0,data:this});{const v=(0,Pr.checkContractWalletSignature)(this,d,r.provider).then(p=>p?{success:!0,data:this}:{success:!1,data:this,error:new ze.SiweError(ze.SiweErrorType.INVALID_SIGNATURE,y,`Resolved address to be ${this.address}`)}).catch(p=>({success:!1,data:this,error:p}));Promise.all([v,(u=(o=(s=r==null?void 0:r.verificationFallback)===null||s===void 0?void 0:s.call(r,t,r,this,v))===null||o===void 0?void 0:o.then(p=>p))===null||u===void 0?void 0:u.catch(p=>p)]).then(([p,B])=>{if(B){if(B.success)return n(B);l(B)}else{if(p.success)return n(p);l(p)}})}})})}validateMessage(...t){var r;if(t.length>0)throw new ze.SiweError(ze.SiweErrorType.UNABLE_TO_PARSE,"Unexpected argument in the validateMessage function.");if(!this.domain||this.domain.length===0||!/[^#?]*/.test(this.domain))throw new ze.SiweError(ze.SiweErrorType.INVALID_DOMAIN,`${this.domain} to be a valid domain.`);if(!(0,pa.isEIP55Address)(this.address))throw new ze.SiweError(ze.SiweErrorType.INVALID_ADDRESS,(0,xd.getAddress)(this.address),this.address);if(!Iy.isUri(this.uri))throw new ze.SiweError(ze.SiweErrorType.INVALID_URI,`${this.uri} to be a valid uri.`);if(this.version!=="1")throw new ze.SiweError(ze.SiweErrorType.INVALID_MESSAGE_VERSION,"1",this.version);const n=(r=this===null||this===void 0?void 0:this.nonce)===null||r===void 0?void 0:r.match(/[a-zA-Z0-9]{8,}/);if(!n||this.nonce.length<8||n[0]!==this.nonce)throw new ze.SiweError(ze.SiweErrorType.INVALID_NONCE,`Length > 8 (${n.length}). Alphanumeric.`,this.nonce);if(this.issuedAt&&!(0,Pr.isValidISO8601Date)(this.issuedAt))throw new Error(ze.SiweErrorType.INVALID_TIME_FORMAT);if(this.expirationTime&&!(0,Pr.isValidISO8601Date)(this.expirationTime))throw new Error(ze.SiweErrorType.INVALID_TIME_FORMAT);if(this.notBefore&&!(0,Pr.isValidISO8601Date)(this.notBefore))throw new Error(ze.SiweErrorType.INVALID_TIME_FORMAT)}}Zs.SiweMessage=My;(function(e){var t=Me&&Me.__createBinding||(Object.create?function(n,i,s,o){o===void 0&&(o=s);var u=Object.getOwnPropertyDescriptor(i,s);(!u||("get"in u?!i.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,o,u)}:function(n,i,s,o){o===void 0&&(o=s),n[o]=i[s]}),r=Me&&Me.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(Zs,e),r(Vc,e),r(Jt,e)})(c0);class zc{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)}}var lc=(e=>(e.AUTH_TOKEN="auth_token",e))(lc||{});class Ly{constructor(t,r,n){this.API="https://api.garden.finance",this.url=new fn("/",t??this.API),this.walletClient=r,this.domain=(n==null?void 0:n.domain)||"app.garden.finance",this.domain.startsWith("https://")&&(this.domain=this.domain.split("https://")[1]),this.signingStatement=(n==null?void 0:n.signingStatement)??"Garden.fi",this.store=(n==null?void 0:n.store)??new zc}verifyToken(t,r){const n=Uy(t);if(!n)return Te.Ok(!1);try{const i=Math.floor(Date.now()/1e3)+120;return Te.Ok(n.exp>i&&n.address.toLowerCase()===r.toLowerCase())}catch{return Te.Ok(!1)}}async getToken(){var t;if(!((t=this.walletClient.account)!=null&&t.address))return Te.Err("Wallet client does not have an account");const r=this.store.getItem(lc.AUTH_TOKEN);if(r){const o=this.verifyToken(r,this.walletClient.account.address);if(o.ok&&o.val)return Te.Ok(r)}const n=await this.signStatement();if(n.error)return Te.Err(n.error);const i=await Te.Fetcher.post(this.url.endpoint("verify"),{body:JSON.stringify({...n.val}),headers:{"Content-Type":"application/json"}});if(i.error)return Te.Err(i.error);const s=i.result;if(!s)return Te.Err("Failed to get token");if(!this.verifyToken(s,this.walletClient.account.address).val)throw new Error("Token verification failed");return this.store.setItem(lc.AUTH_TOKEN,s),Te.Ok(s)}async signStatement(){var t,r,n;if(!((t=this.walletClient.chain)!=null&&t.id)||!((r=this.walletClient.account)!=null&&r.address))return Te.Err("Wallet client does not have a chain");const i=new Date,s=new Date(i.getTime()+300*1e3),o=(await Te.Fetcher.get(this.url.endpoint("nonce"))).result;if(!o)return Te.Err("Failed to get nonce");const u=(n=this.walletClient.chain)==null?void 0:n.id,l=new c0.SiweMessage({domain:this.domain,address:this.walletClient.account.address,statement:this.signingStatement,nonce:o,uri:"https://"+this.domain,version:"1",chainId:u,expirationTime:s.toISOString()}).prepareMessage(),a=await this.walletClient.signMessage({account:this.walletClient.account,message:l});return Te.Ok({message:l,signature:a,nonce:o})}}const Uy=e=>{try{if(e.split(".").length<3)return;const t=e.split(".")[1];return t?JSON.parse(Buffer.from(t,"base64").toString("latin1")):void 0}catch{return}};var ut=(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))(ut||{}),nt=(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))(nt||{}),un=(e=>(e.Idle="Idle",e.Initiate="Initiate",e.Redeem="Redeem",e.Refund="Refund",e))(un||{}),Tr=(e=>(e.init="init",e.redeem="redeem",e.refund="refund",e))(Tr||{});const Fh=(e,t,r)=>{const n=qs(e.source_swap,t),i=qs(e.destination_swap,r);return n===nt.RedeemDetected?ut.CounterPartyRedeemDetected:n===nt.Redeemed?ut.CounterPartyRedeemed:i===nt.RedeemDetected?ut.RedeemDetected:i===nt.Redeemed?ut.Redeemed:i===nt.RefundDetected?ut.CounterPartyRefundDetected:i===nt.Refunded?ut.CounterPartyRefunded:n===nt.RefundDetected?ut.RefundDetected:n===nt.Refunded?ut.Refunded:i===nt.Expired?ut.CounterPartySwapExpired:n===nt.Expired?ut.Expired:i===nt.InitiateDetected?ut.CounterPartyInitiateDetected:i===nt.Initiated?ut.CounterPartyInitiated:n===nt.InitiateDetected?ut.InitiateDetected:n===nt.Initiated?ut.Initiated:ut.Matched},qs=(e,t)=>{if(e.redeem_tx_hash)return e.redeem_block_number?nt.Redeemed:nt.RedeemDetected;if(e.refund_tx_hash)return e.refund_block_number?nt.Refunded:nt.RefundDetected;if(Number(e.initiate_block_number)){const r=Number(e.initiate_block_number)+e.timelock;if(t>r)return nt.Expired}return e.initiate_tx_hash?e.initiate_block_number?nt.Initiated:nt.InitiateDetected:nt.Idle},jh=(e,t,r)=>{const n=Fh(e,t,r);switch(console.log("orderStatus :",n),n){case ut.Matched:return un.Initiate;case ut.CounterPartyInitiated:return un.Redeem;case ut.Expired:return un.Refund;default:return un.Idle}};function Fy(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}const jy=Fy({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}}}),Dy=[42161,421614],js=async e=>{if(!e.chain)return Te.Err("No chain found");const t=Dy.includes(e.chain.id)?jy:e.chain;return await Hy(t)},Hy=async e=>{const t=nr.createPublicClient({chain:e,transport:nr.http()});try{const r=await t.getBlockNumber();return Te.Ok(Number(r))}catch(r){return Te.Err("Failed to fetch evm block number",r)}},fc=async e=>{try{const t=await e.getLatestTip();return Te.Ok(t)}catch(t){return Te.Err("Failed to fetch bitcoin block number",t)}},$y=[{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 dc{constructor(t,r,n){this.walletClient=r,this.url=new fn("/relayer",t),this.auth=new Ly(this.url,r,{...n,store:(n==null?void 0:n.store)||new zc})}async init(t,r){if(!this.walletClient.account)return Te.Err("No account found");if(this.walletClient.account.address.toLowerCase()!==t.source_swap.initiator.toLowerCase())return Te.Err("Account and order initiator mismatch");if(qs(t.source_swap,r)!==nt.Idle)return Te.Err("Invalid swap status");const{create_order:i,source_swap:s}=t;if(!s.amount||!s.redeemer||!i.timelock||!i.secret_hash)return Te.Err("Invalid order");const o=Sr(i.secret_hash),u=BigInt(i.timelock),l=Sr(s.redeemer),a=BigInt(s.amount);try{const f=await this.auth.getToken();if(f.error)return Te.Err(f.error);const d=nr.getContract({address:Sr(t.source_swap.asset),abi:$y,client:this.walletClient}),c=await d.read.token(),g=await yb(Number(a),c,t.source_swap.asset,this.walletClient);if(g.error)return Te.Err(g.error);const h=await d.read.eip712Domain(),b=await this.walletClient.signTypedData({account:this.walletClient.account,domain:{name:h[1],version:h[2],chainId:Number(h[3]),verifyingContract:h[4]},types:{Initiate:[{name:"redeemer",type:"address"},{name:"timelock",type:"uint256"},{name:"amount",type:"uint256"},{name:"secretHash",type:"bytes32"}]},primaryType:"Initiate",message:{redeemer:l,timelock:u,amount:a,secretHash:o}}),P=await Te.Fetcher.post(this.url.endpoint("initiate"),{body:JSON.stringify({order_id:i.create_id,signature:b,perform_on:"Source"}),headers:{Authorization:hu(f.val),"Content-Type":"application/json"}});return P.error?Te.Err(P.error):P.result?Te.Ok(P.result):Te.Err("Init: No result found")}catch(f){return console.log("init error :",f),Te.Err(String(f))}}async redeem(t,r){try{const n=await this.auth.getToken();if(n.error)return Te.Err(n.error);const i=await Te.Fetcher.post(this.url.endpoint("redeem"),{body:JSON.stringify({order_id:t,secret:Te.trim0x(r),perform_on:"Destination"}),headers:{Authorization:hu(n.val),"Content-Type":"application/json"}});return i.error?Te.Err(i.error):i.result?Te.Ok(i.result):Te.Err("Redeem: No result found")}catch(n){return Te.Err(String(n))}}}function hc(e){return typeof e=="string"&&(e=Buffer.from(e,"hex")),e.length===32?e:e.subarray(1,33)}function kn(e,t){if(!e)throw new Error(t)}function Gy(e){return Buffer.concat([Uint8Array.from([192]),Ky(e)])}function Ky(e){const t=du.encodingLength(e.length),r=Buffer.allocUnsafe(t);return du.encode(e.length,r),Buffer.concat([r,e])}function qy(e,t){if(e.compare(t)>0){const r=e;e=t,t=r}return[e,t]}const Ss=e=>e.length===64?e:e.slice(2),Vy=e=>{if(!e)return!1;try{const t=Buffer.from(e,"hex");return Cn.isPoint(t)}catch{return!1}},zy=Buffer.from("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","hex"),Wy=Buffer.from("483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8","hex"),Jy=Buffer.concat([zy,Wy]),Qy=Buffer.from("0250929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0","hex"),wd={failedToCreateInternalPubkey:"failed to create internal pubkey",failedToTweakPubkey:"failed to tweak pubkey"};function Yy(){const e=Yd.crypto.sha256(Buffer.from("GardenHTLC","utf-8")),t=Cn.pointMultiply(Buffer.concat([Buffer.from("04","hex"),Jy]),e);if(!t)throw new Error(wd.failedToCreateInternalPubkey);const r=Cn.pointAdd(Qy,t);if(!r)throw new Error(wd.failedToCreateInternalPubkey);return hc(Buffer.from(r))}const kt={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"},Os=192;wt.initEccLib(Cn);class Vs{constructor(t,r,n,i,s,o,u){this.secretHash=n,this.redeemerPubkey=i,this.initiatorPubkey=s,this.expiry=o,this.signer=t,this.network=u,this.internalPubkey=Yy(),this.initiateAmount=r}static async from(t,r,n,i,s,o){n=n.startsWith("0x")?n.slice(2):n,kn(n.length===64,kt.secretHashLenMismatch),kn(i.length===64||i.length===66,`initiator ${kt.pubkeyLenMismatch}`),kn(s.length===64||s.length===66,`redeemer ${kt.pubkeyLenMismatch}`),kn(o>0,kt.zeroOrNegativeExpiry);const u=await t.getNetwork();return new Vs(t,r,n,hc(s).toString("hex"),hc(i).toString("hex"),o,u)}address(){const{address:t}=wt.payments.p2tr({internalPubkey:this.internalPubkey,network:this.network,scriptTree:this.leaves()});if(!t)throw new Error(kt.htlcAddressGenerationFailed);return t}id(){return this.address()}async _buildRawTx(t,r){const n=new wt.Transaction;n.version=2;const i=this.address(),s=await this.signer.getProvider(),o=await s.getUTXOs(i),u=o.reduce((l,a)=>l+a.value,0);if(u===0)throw new Error(`${i} ${kt.notFunded}`);for(let l=0;l<o.length;l++)n.addInput(Buffer.from(o[l].txid,"hex").reverse(),o[l].vout);return r??(r=await s.suggestFee(i,u,fu.Urgency.MEDIUM)),n.addOutput(wt.address.toOutputScript(t,this.network),u-r),{tx:n,usedUtxos:o}}async buildRawTx(t){return await this._buildRawTx(await this.signer.getAddress(),t)}getOutputScript(){return wt.address.toOutputScript(this.address(),this.network)}async init(t){return t??(t=await(await this.signer.getProvider()).suggestFee(await this.signer.getAddress(),this.initiateAmount,fu.Urgency.MEDIUM)),await this.signer.send(this.address(),this.initiateAmount,t)}async instantRefund(t,r){kn(t.length>0,kt.noCounterpartySigs);const{tx:n,usedUtxos:i}=await this.buildRawTx(r);for(const d of i)if(!t.find(c=>c.utxo===d.txid))throw new Error(kt.counterPartySigNotFound(d.txid));const s=this.getOutputScript(),o=wt.Transaction.SIGHASH_DEFAULT,u=this.leafHash(2),l=i.map(d=>d.value),a=ba(s,i.length);for(let d=0;d<n.ins.length;d++){const c=n.hashForWitnessV1(d,a,l,o,u);if(!Cn.verifySchnorr(c,Buffer.from(this.redeemerPubkey,"hex"),Buffer.from(t[d].sig,"hex")))throw new Error(kt.invalidCounterpartySigForUTXO(t[d].utxo));const g=await this.signer.signSchnorr(c),h=Buffer.from(n.ins[d].hash).reverse().toString("hex"),b=t.find(P=>P.utxo===h);if(!b)throw new Error(kt.counterPartySigNotFound(h));n.setWitness(d,[Buffer.from(b.sig,"hex"),g,this.instantRefundLeaf(),this.generateControlBlockFor(2)])}return await(await this.signer.getProvider()).broadcast(n.toHex())}async redeem(t,r,n){kn(wt.crypto.sha256(Buffer.from(t,"hex")).toString("hex")===this.secretHash,kt.secretMismatch);const{tx:i,usedUtxos:s}=await this._buildRawTx(r??await this.signer.getAddress(),n),o=this.leafHash(1),u=s.map(d=>d.value),l=ba(this.getOutputScript(),s.length),a=wt.Transaction.SIGHASH_DEFAULT;for(let d=0;d<i.ins.length;d++){const c=i.hashForWitnessV1(d,l,u,a,o),g=await this.signer.signSchnorr(c);i.setWitness(d,[g,Buffer.from(t,"hex"),this.redeemLeaf(),this.generateControlBlockFor(1)])}return await(await this.signer.getProvider()).broadcast(i.toHex())}async refund(t,r){const{tx:n,usedUtxos:i}=await this._buildRawTx(t??await this.signer.getAddress(),r),[s,o]=await this.canRefund(i);if(!s)throw new Error(kt.htlcNotExpired(o));const u=this.leafHash(0),l=i.map(c=>c.value),a=ba(this.getOutputScript(),i.length),f=wt.Transaction.SIGHASH_DEFAULT;for(let c=0;c<n.ins.length;c++){n.ins[c].sequence=this.expiry;const g=n.hashForWitnessV1(c,a,l,f,u),h=await this.signer.signSchnorr(g);n.setWitness(c,[h,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 i of t){let s=0;if(i.status.confirmed&&i.status.block_height+this.expiry>n?s=i.status.block_height+this.expiry-n+1:i.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(kt.invalidLeaf)}const n=wt.payments.p2tr({internalPubkey:this.internalPubkey,network:this.network,scriptTree:this.leaves(),redeem:{output:r,redeemVersion:Os}});if(!n.witness)throw new Error(kt.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()),wt.crypto.taggedHash("TapLeaf",Gy(r))}refundLeaf(){return wt.script.fromASM(`
|
|
774
|
-
${wt.script.number.encode(this.expiry).toString("hex")}
|
|
1
|
+
"use strict";var Mi=Object.defineProperty;var Ui=(e,t,r)=>t in e?Mi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var it=(e,t,r)=>Ui(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"),Di=require("varuint-bitcoin"),$i=require("tiny-secp256k1"),Jr=require("@catalogfi/wallets"),Fn=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(Di),ct=$r($i),de=$r(Fn);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}`,Hi=e=>new Promise(t=>setTimeout(t,e)),Ln="2.21.21";let or={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:Ln},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=or.getDocsUrl)==null?void 0:n.call(or,{...r,docsPath:s}),u=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...c?[`Docs: ${c}`]:[],...o?[`Details: ${o}`]:[],`Version: ${or.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=Ln}walk(t){return Mn(this,t)}};function Mn(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e?Mn(e.cause,t):t?null:e}let Un=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"})}},Dn=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 $n 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 ji=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 qi=0;function Sr(e,t,r){const n=++qi,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,T;const R=o();if(R.length!==0)for(const C of R)(T=(x=C.fns)[g])==null||T.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 Tr=(e,t,r)=>JSON.stringify(e,(n,o)=>typeof o=="bigint"?o.toString():o,r);class Wi 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 Gi=class extends Ze{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};class Hn 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 zi(e,{dir:t,size:r=32}={}){return typeof e=="string"?Ki(e,{dir:t,size:r}):Vi(e,{dir:t,size:r})}function Ki(e,{dir:t,size:r=32}={}){if(r===null)return e;const n=e.replace("0x","");if(n.length>r*2)throw new Hn({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](r*2,"0")}`}function Vi(e,{dir:t,size:r=32}={}){if(r===null)return e;if(e.length>r)throw new Hn({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 Mt(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 Wi({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?zi(u,{size:n}):u}function Ji(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 Ji(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function Yi(e,{size:t}){if(en(e)>t)throw new Gi({givenSize:en(e),maxSize:t})}function jn(e,t={}){const{signed:r}=t;t.size&&Yi(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 kr(e,t={}){return Number(jn(e,t))}const qn={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Wn(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?kr(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?kr(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?qn[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=Qi(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 Qi(e){return e.map(t=>({contractAddress:t.address,r:t.r,s:t.s,chainId:Number(t.chainId),nonce:Number(t.nonce),...typeof t.yParity<"u"?{yParity:Number(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:Number(t.v)}:{}}))}function Xi(e){var t;const r=(t=e.transactions)==null?void 0:t.map(n=>typeof n=="string"?n:Wn(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 Zi(e,{blockHash:t,blockNumber:r,blockTag:n,includeTransactions:o}={}){var s,c,u;const p=n??"latest",y=o??!1,g=r!==void 0?Mt(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 Un({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)||Xi)(w)}async function ea(e,{blockHash:t,blockNumber:r,blockTag:n,hash:o,index:s}){var c,u,p;const y=n||"latest",g=r!==void 0?Mt(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,Mt(s)]},{dedupe:!0}):(g||y)&&(w=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[g||y,Mt(s)]},{dedupe:!!g})),!w)throw new Dn({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)||Wn)(w)}function ta(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 ra={"0x0":"reverted","0x1":"success"};function na(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=>ta(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?kr(e.transactionIndex):null,status:e.status?ra[e.status]:null,type:e.type?qn[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 $n({hash:t});return(((o=(n=(r=e.chain)==null?void 0:r.formatters)==null?void 0:n.transactionReceipt)==null?void 0:o.format)||na)(s)}function ia(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 aa=new Map,oa=new Map;function sa(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:c=>s.set(o,c)}),r=t(e,aa),n=t(e,oa);return{clear:()=>{r.clear(),n.clear()},promise:r,response:n}}async function fa(e,{cacheKey:t,cacheTime:r=Number.POSITIVE_INFINITY}){const n=sa(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 ua=e=>`blockNumber.${e}`;async function ca(e,{cacheTime:t=e.cacheTime}={}){const r=await fa(()=>e.request({method:"eth_blockNumber"}),{cacheKey:ua(e.uid),cacheTime:t});return BigInt(r)}function la(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=Tr(["watchBlockNumber",e.uid,t,r,c]);return Sr(y,{onBlockNumber:n,onError:o},g=>ia(async()=>{var w;try{const x=await st(e,ca,"getBlockNumber")({cacheTime:0});if(p){if(x===p)return;if(x-p>1&&r)for(let T=p+1n;T<x;T++)g.onBlockNumber(T,p),p=T}(!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=Tr(["watchBlockNumber",e.uid,t,r]);return Sr(y,{onBlockNumber:n,onError:o},g=>{let w=!0,x=()=>w=!1;return(async()=>{try{const T=(()=>{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 T.subscribe({params:["newHeads"],onData(C){var E;if(!w)return;const k=jn((E=C.result)==null?void 0:E.number);g.onBlockNumber(k,p),p=k},onError(C){var E;(E=g.onError)==null||E.call(g,C)}});x=R,w||x()}catch(T){o==null||o(T)}})(),()=>x()})})()}async function ha(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=Tr(["waitForTransactionReceipt",e.uid,r]);let y,g,w,x=!1;return new Promise((T,R)=>{u&&setTimeout(()=>R(new ji({hash:r})),u);const C=Sr(p,{onReplaced:n,resolve:T,reject:R},E=>{const k=st(e,la,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:o,async onBlockNumber(O){const F=L=>{k(),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,ea,"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 Dn||L instanceof $n){if(!y){x=!1;return}try{g=y,x=!0;const S=await Zr(()=>st(e,Zi,"getBlock")({blockNumber:N,includeTransactions:!0}),{delay:c,retryCount:s,shouldRetry:({error:U})=>U instanceof Un});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 da=async(e,t,r,n)=>{if(!n.account)return P.Err("No account found");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 ha(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)}}let pa=class{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 ba(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}const ya=ba({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}}}),ga=[42161,421614],Ar=async e=>{if(!e.chain)return P.Err("No chain found");const t=ga.includes(e.chain.id)?ya:e.chain;return await _a(t)},_a=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)}},rn=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 Kt(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}const ma=Kt({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}}}),wa=Kt({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}),va=Kt({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}}}),xa=Kt({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 Ea(e){return Buffer.concat([Uint8Array.from([192]),Ba(e)])}function Ba(e){const t=Yr.encodingLength(e.length),r=Buffer.allocUnsafe(t);return Yr.encode(e.length,r),Buffer.concat([r,e])}function Ra(e,t){if(e.compare(t)>0){const r=e;e=t,t=r}return[e,t]}const Nt=e=>e.length===64?e:e.slice(2),Sa=e=>{if(!e)return!1;try{const t=Buffer.from(e,"hex");return ct.isPoint(t)}catch{return!1}},Ia={ethereum:va,ethereum_arbitrum:ma,ethereum_sepolia:xa,arbitrum_sepolia:wa,ethereum_localnet:te.EthereumLocalnet,arbitrum_localnet:te.ArbitrumLocalnet},Ta=async(e,t)=>{var n;const r=Ia[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(ka(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")},ka=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 Gn=(e,t,r)=>{const n=$t(e.source_swap,t),o=$t(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},$t=(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},zn=(e,t,r)=>{switch(Gn(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}},Aa=[{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 Kn{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($t(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:Aa,client:t}),x=await w.read.token(),T=await da(Number(y),x,this.order.source_swap.asset,t);if(T.error)return P.Err(T.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 Ca=Buffer.from("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","hex"),Pa=Buffer.from("483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8","hex"),Oa=Buffer.concat([Ca,Pa]),Na=Buffer.from("0250929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0","hex"),nn={failedToCreateInternalPubkey:"failed to create internal pubkey",failedToTweakPubkey:"failed to tweak pubkey"};function Fa(){const e=Fn.crypto.sha256(Buffer.from("GardenHTLC","utf-8")),t=ct.pointMultiply(Buffer.concat([Buffer.from("04","hex"),Oa]),e);if(!t)throw new Error(nn.failedToCreateInternalPubkey);const r=ct.pointAdd(Na,t);if(!r)throw new Error(nn.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"},Ft=192;de.initEccLib(ct);class Ht{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=Fa(),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 Ht(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 T=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"),T,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),T=await this.signer.signSchnorr(x);o.setWitness(w,[T,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 T=n.hashForWitnessV1(x,y,p,g,u),R=await this.signer.signSchnorr(T);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:Ft}});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",Ea(r))}refundLeaf(){return de.script.fromASM(`
|
|
3
|
+
${de.script.number.encode(this.expiry).toString("hex")}
|
|
775
4
|
OP_CHECKSEQUENCEVERIFY
|
|
776
5
|
OP_DROP
|
|
777
6
|
${this.initiatorPubkey}
|
|
778
7
|
OP_CHECKSIG
|
|
779
|
-
`.trim().replace(/\s+/g," "))}redeemLeaf(){return
|
|
8
|
+
`.trim().replace(/\s+/g," "))}redeemLeaf(){return de.script.fromASM(`
|
|
780
9
|
OP_SHA256
|
|
781
10
|
${this.secretHash}
|
|
782
11
|
OP_EQUALVERIFY
|
|
783
12
|
${this.redeemerPubkey}
|
|
784
13
|
OP_CHECKSIG
|
|
785
|
-
`.trim().replace(/\s+/g," "))}instantRefundLeaf(){return
|
|
14
|
+
`.trim().replace(/\s+/g," "))}instantRefundLeaf(){return de.script.fromASM(`
|
|
786
15
|
${this.initiatorPubkey}
|
|
787
16
|
OP_CHECKSIG
|
|
788
17
|
${this.redeemerPubkey}
|
|
789
18
|
OP_CHECKSIGADD
|
|
790
19
|
OP_2
|
|
791
20
|
OP_NUMEQUAL
|
|
792
|
-
`.trim().replace(/\s+/g," "))}leaves(){return[{version:
|
|
793
|
-
`,bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128};
|
|
794
|
-
`,bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239};var
|
|
795
|
-
Use Chrome, Firefox or Internet Explorer 11`)}var u1=St.Buffer,Ws=Me.crypto||Me.msCrypto;Ws&&Ws.getRandomValues?pc.exports=l1:pc.exports=c1;function l1(e,t){if(e>a1)throw new RangeError("requested too many random bytes");var r=u1.allocUnsafe(e);if(e>0)if(e>ma)for(var n=0;n<e;n+=ma)Ws.getRandomValues(r.slice(n,n+ma));else Ws.getRandomValues(r);return typeof t=="function"?process.nextTick(function(){t(null,r)}):r}var f1=pc.exports,gc={exports:{}};typeof Object.create=="function"?gc.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:gc.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 At=gc.exports,mc={exports:{}},Yc={exports:{}},Bn=typeof Reflect=="object"?Reflect:null,_d=Bn&&typeof Bn.apply=="function"?Bn.apply:function(t,r,n){return Function.prototype.apply.call(t,r,n)},Ds;Bn&&typeof Bn.ownKeys=="function"?Ds=Bn.ownKeys:Object.getOwnPropertySymbols?Ds=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Ds=function(t){return Object.getOwnPropertyNames(t)};function d1(e){console&&console.warn&&console.warn(e)}var Jh=Number.isNaN||function(t){return t!==t};function We(){We.init.call(this)}Yc.exports=We;Yc.exports.once=g1;We.EventEmitter=We;We.prototype._events=void 0;We.prototype._eventsCount=0;We.prototype._maxListeners=void 0;var kd=10;function ho(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(We,"defaultMaxListeners",{enumerable:!0,get:function(){return kd},set:function(e){if(typeof e!="number"||e<0||Jh(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");kd=e}});We.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};We.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Jh(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 Qh(e){return e._maxListeners===void 0?We.defaultMaxListeners:e._maxListeners}We.prototype.getMaxListeners=function(){return Qh(this)};We.prototype.emit=function(t){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=t==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var u=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw u.context=o,u}var l=s[t];if(l===void 0)return!1;if(typeof l=="function")_d(l,this,r);else for(var a=l.length,f=tp(l,a),n=0;n<a;++n)_d(f[n],this,r);return!0};function Yh(e,t,r,n){var i,s,o;if(ho(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),o=s[t]),o===void 0)o=s[t]=r,++e._eventsCount;else if(typeof o=="function"?o=s[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=Qh(e),i>0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,d1(u)}return e}We.prototype.addListener=function(t,r){return Yh(this,t,r,!1)};We.prototype.on=We.prototype.addListener;We.prototype.prependListener=function(t,r){return Yh(this,t,r,!0)};function h1(){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 Zh(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=h1.bind(n);return i.listener=r,n.wrapFn=i,i}We.prototype.once=function(t,r){return ho(r),this.on(t,Zh(this,t,r)),this};We.prototype.prependOnceListener=function(t,r){return ho(r),this.prependListener(t,Zh(this,t,r)),this};We.prototype.removeListener=function(t,r){var n,i,s,o,u;if(ho(r),i=this._events,i===void 0)return this;if(n=i[t],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){u=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():p1(n,s),n.length===1&&(i[t]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",t,u||r)}return this};We.prototype.off=We.prototype.removeListener;We.prototype.removeAllListeners=function(t){var r,n,i;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),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);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(i=r.length-1;i>=0;i--)this.removeListener(t,r[i]);return this};function Xh(e,t,r){var n=e._events;if(n===void 0)return[];var i=n[t];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?b1(i):tp(i,i.length)}We.prototype.listeners=function(t){return Xh(this,t,!0)};We.prototype.rawListeners=function(t){return Xh(this,t,!1)};We.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):ep.call(e,t)};We.prototype.listenerCount=ep;function ep(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}We.prototype.eventNames=function(){return this._eventsCount>0?Ds(this._events):[]};function tp(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function p1(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function b1(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function g1(e,t){return new Promise(function(r,n){function i(o){e.removeListener(t,s),n(o)}function s(){typeof e.removeListener=="function"&&e.removeListener("error",i),r([].slice.call(arguments))}rp(e,t,s,{once:!0}),t!=="error"&&m1(e,i,{once:!0})})}function m1(e,t,r){typeof e.on=="function"&&rp(e,"error",t,r)}function rp(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 i(s){n.once&&e.removeEventListener(t,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}var np=Yc.exports,ip=np.EventEmitter,ya,Pd;function y1(){if(Pd)return ya;Pd=1;function e(h,b){var P=Object.keys(h);if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(h);b&&(w=w.filter(function(y){return Object.getOwnPropertyDescriptor(h,y).enumerable})),P.push.apply(P,w)}return P}function t(h){for(var b=1;b<arguments.length;b++){var P=arguments[b]!=null?arguments[b]:{};b%2?e(Object(P),!0).forEach(function(w){r(h,w,P[w])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(P)):e(Object(P)).forEach(function(w){Object.defineProperty(h,w,Object.getOwnPropertyDescriptor(P,w))})}return h}function r(h,b,P){return b=o(b),b in h?Object.defineProperty(h,b,{value:P,enumerable:!0,configurable:!0,writable:!0}):h[b]=P,h}function n(h,b){if(!(h instanceof b))throw new TypeError("Cannot call a class as a function")}function i(h,b){for(var P=0;P<b.length;P++){var w=b[P];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(h,o(w.key),w)}}function s(h,b,P){return b&&i(h.prototype,b),Object.defineProperty(h,"prototype",{writable:!1}),h}function o(h){var b=u(h,"string");return typeof b=="symbol"?b:String(b)}function u(h,b){if(typeof h!="object"||h===null)return h;var P=h[Symbol.toPrimitive];if(P!==void 0){var w=P.call(h,b||"default");if(typeof w!="object")return w;throw new TypeError("@@toPrimitive must return a primitive value.")}return(b==="string"?String:Number)(h)}var l=Ar,a=l.Buffer,f=fo,d=f.inspect,c=d&&d.custom||"inspect";function g(h,b,P){a.prototype.copy.call(h,b,P)}return ya=function(){function h(){n(this,h),this.head=null,this.tail=null,this.length=0}return s(h,[{key:"push",value:function(P){var w={data:P,next:null};this.length>0?this.tail.next=w:this.head=w,this.tail=w,++this.length}},{key:"unshift",value:function(P){var w={data:P,next:this.head};this.length===0&&(this.tail=w),this.head=w,++this.length}},{key:"shift",value: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}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(P){if(this.length===0)return"";for(var w=this.head,y=""+w.data;w=w.next;)y+=P+w.data;return y}},{key:"concat",value:function(P){if(this.length===0)return a.alloc(0);for(var w=a.allocUnsafe(P>>>0),y=this.head,v=0;y;)g(y.data,w,v),v+=y.data.length,y=y.next;return w}},{key:"consume",value:function(P,w){var y;return P<this.head.data.length?(y=this.head.data.slice(0,P),this.head.data=this.head.data.slice(P)):P===this.head.data.length?y=this.shift():y=w?this._getString(P):this._getBuffer(P),y}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(P){var w=this.head,y=1,v=w.data;for(P-=v.length;w=w.next;){var p=w.data,B=P>p.length?p.length:P;if(B===p.length?v+=p:v+=p.slice(0,P),P-=B,P===0){B===p.length?(++y,w.next?this.head=w.next:this.head=this.tail=null):(this.head=w,w.data=p.slice(B));break}++y}return this.length-=y,v}},{key:"_getBuffer",value:function(P){var w=a.allocUnsafe(P),y=this.head,v=1;for(y.data.copy(w),P-=y.data.length;y=y.next;){var p=y.data,B=P>p.length?p.length:P;if(p.copy(w,w.length-P,0,B),P-=B,P===0){B===p.length?(++v,y.next?this.head=y.next:this.head=this.tail=null):(this.head=y,y.data=p.slice(B));break}++v}return this.length-=v,w}},{key:c,value:function(P,w){return d(this,t(t({},w),{},{depth:0,customInspect:!1}))}}]),h}(),ya}function x1(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(yc,this,e)):process.nextTick(yc,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(Hs,r):(r._writableState.errorEmitted=!0,process.nextTick(Td,r,s)):process.nextTick(Td,r,s):t?(process.nextTick(Hs,r),t(s)):process.nextTick(Hs,r)}),this)}function Td(e,t){yc(e,t),Hs(e)}function Hs(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function w1(){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 yc(e,t){e.emit("error",t)}function A1(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}var sp={destroy:x1,undestroy:w1,errorOrDestroy:A1},yn={};function E1(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var op={};function $t(e,t,r){r||(r=Error);function n(s,o,u){return typeof t=="string"?t:t(s,o,u)}var i=function(s){E1(o,s);function o(u,l,a){return s.call(this,n(u,l,a))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=e,op[e]=i}function Sd(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 v1(e,t,r){return e.substr(0,t.length)===t}function _1(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function k1(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}$t("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);$t("ERR_INVALID_ARG_TYPE",function(e,t,r){var n;typeof t=="string"&&v1(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";var i;if(_1(e," argument"))i="The ".concat(e," ").concat(n," ").concat(Sd(t,"type"));else{var s=k1(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(s," ").concat(n," ").concat(Sd(t,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);$t("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");$t("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});$t("ERR_STREAM_PREMATURE_CLOSE","Premature close");$t("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});$t("ERR_MULTIPLE_CALLBACK","Callback called multiple times");$t("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");$t("ERR_STREAM_WRITE_AFTER_END","write after end");$t("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);$t("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);$t("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");yn.codes=op;var P1=yn.codes.ERR_INVALID_OPT_VALUE;function T1(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function S1(e,t,r,n){var i=T1(t,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new P1(s,i)}return Math.floor(i)}return e.objectMode?16:16*1024}var ap={getHighWaterMark:S1},O1=B1;function B1(e,t){if(xa("noDeprecation"))return e;var r=!1;function n(){if(!r){if(xa("throwDeprecation"))throw new Error(t);xa("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return n}function xa(e){try{if(!Me.localStorage)return!1}catch{return!1}var t=Me.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}var wa,Od;function cp(){if(Od)return wa;Od=1,wa=T;function e(Q){var ae=this;this.next=null,this.entry=null,this.finish=function(){de(ae,Q)}}var t;T.WritableState=k;var r={deprecate:O1},n=ip,i=Ar.Buffer,s=(typeof Me<"u"?Me:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function o(Q){return i.from(Q)}function u(Q){return i.isBuffer(Q)||Q instanceof s}var l=sp,a=ap,f=a.getHighWaterMark,d=yn.codes,c=d.ERR_INVALID_ARG_TYPE,g=d.ERR_METHOD_NOT_IMPLEMENTED,h=d.ERR_MULTIPLE_CALLBACK,b=d.ERR_STREAM_CANNOT_PIPE,P=d.ERR_STREAM_DESTROYED,w=d.ERR_STREAM_NULL_VALUES,y=d.ERR_STREAM_WRITE_AFTER_END,v=d.ERR_UNKNOWN_ENCODING,p=l.errorOrDestroy;At(T,n);function B(){}function k(Q,ae,Z){t=t||Mn(),Q=Q||{},typeof Z!="boolean"&&(Z=ae instanceof t),this.objectMode=!!Q.objectMode,Z&&(this.objectMode=this.objectMode||!!Q.writableObjectMode),this.highWaterMark=f(this,Q,"writableHighWaterMark",Z),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var te=Q.decodeStrings===!1;this.decodeStrings=!te,this.defaultEncoding=Q.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(re){L(ae,re)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=Q.emitClose!==!1,this.autoDestroy=!!Q.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}k.prototype.getBuffer=function(){for(var ae=this.bufferedRequest,Z=[];ae;)Z.push(ae),ae=ae.next;return Z},function(){try{Object.defineProperty(k.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var R;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(R=Function.prototype[Symbol.hasInstance],Object.defineProperty(T,Symbol.hasInstance,{value:function(ae){return R.call(this,ae)?!0:this!==T?!1:ae&&ae._writableState instanceof k}})):R=function(ae){return ae instanceof this};function T(Q){t=t||Mn();var ae=this instanceof t;if(!ae&&!R.call(T,this))return new T(Q);this._writableState=new k(Q,this,ae),this.writable=!0,Q&&(typeof Q.write=="function"&&(this._write=Q.write),typeof Q.writev=="function"&&(this._writev=Q.writev),typeof Q.destroy=="function"&&(this._destroy=Q.destroy),typeof Q.final=="function"&&(this._final=Q.final)),n.call(this)}T.prototype.pipe=function(){p(this,new b)};function N(Q,ae){var Z=new y;p(Q,Z),process.nextTick(ae,Z)}function S(Q,ae,Z,te){var re;return Z===null?re=new w:typeof Z!="string"&&!ae.objectMode&&(re=new c("chunk",["string","Buffer"],Z)),re?(p(Q,re),process.nextTick(te,re),!1):!0}T.prototype.write=function(Q,ae,Z){var te=this._writableState,re=!1,K=!te.objectMode&&u(Q);return K&&!i.isBuffer(Q)&&(Q=o(Q)),typeof ae=="function"&&(Z=ae,ae=null),K?ae="buffer":ae||(ae=te.defaultEncoding),typeof Z!="function"&&(Z=B),te.ending?N(this,Z):(K||S(this,te,Q,Z))&&(te.pendingcb++,re=x(this,te,K,Q,ae,Z)),re},T.prototype.cork=function(){this._writableState.corked++},T.prototype.uncork=function(){var Q=this._writableState;Q.corked&&(Q.corked--,!Q.writing&&!Q.corked&&!Q.bufferProcessing&&Q.bufferedRequest&&D(this,Q))},T.prototype.setDefaultEncoding=function(ae){if(typeof ae=="string"&&(ae=ae.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((ae+"").toLowerCase())>-1))throw new v(ae);return this._writableState.defaultEncoding=ae,this},Object.defineProperty(T.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function E(Q,ae,Z){return!Q.objectMode&&Q.decodeStrings!==!1&&typeof ae=="string"&&(ae=i.from(ae,Z)),ae}Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function x(Q,ae,Z,te,re,K){if(!Z){var W=E(ae,te,re);te!==W&&(Z=!0,re="buffer",te=W)}var ne=ae.objectMode?1:te.length;ae.length+=ne;var se=ae.length<ae.highWaterMark;if(se||(ae.needDrain=!0),ae.writing||ae.corked){var U=ae.lastBufferedRequest;ae.lastBufferedRequest={chunk:te,encoding:re,isBuf:Z,callback:K,next:null},U?U.next=ae.lastBufferedRequest:ae.bufferedRequest=ae.lastBufferedRequest,ae.bufferedRequestCount+=1}else A(Q,ae,!1,ne,te,re,K);return se}function A(Q,ae,Z,te,re,K,W){ae.writelen=te,ae.writecb=W,ae.writing=!0,ae.sync=!0,ae.destroyed?ae.onwrite(new P("write")):Z?Q._writev(re,ae.onwrite):Q._write(re,K,ae.onwrite),ae.sync=!1}function O(Q,ae,Z,te,re){--ae.pendingcb,Z?(process.nextTick(re,te),process.nextTick(M,Q,ae),Q._writableState.errorEmitted=!0,p(Q,te)):(re(te),Q._writableState.errorEmitted=!0,p(Q,te),M(Q,ae))}function I(Q){Q.writing=!1,Q.writecb=null,Q.length-=Q.writelen,Q.writelen=0}function L(Q,ae){var Z=Q._writableState,te=Z.sync,re=Z.writecb;if(typeof re!="function")throw new h;if(I(Z),ae)O(Q,Z,te,ae,re);else{var K=j(Z)||Q.destroyed;!K&&!Z.corked&&!Z.bufferProcessing&&Z.bufferedRequest&&D(Q,Z),te?process.nextTick(H,Q,Z,K,re):H(Q,Z,K,re)}}function H(Q,ae,Z,te){Z||V(Q,ae),ae.pendingcb--,te(),M(Q,ae)}function V(Q,ae){ae.length===0&&ae.needDrain&&(ae.needDrain=!1,Q.emit("drain"))}function D(Q,ae){ae.bufferProcessing=!0;var Z=ae.bufferedRequest;if(Q._writev&&Z&&Z.next){var te=ae.bufferedRequestCount,re=new Array(te),K=ae.corkedRequestsFree;K.entry=Z;for(var W=0,ne=!0;Z;)re[W]=Z,Z.isBuf||(ne=!1),Z=Z.next,W+=1;re.allBuffers=ne,A(Q,ae,!0,ae.length,re,"",K.finish),ae.pendingcb++,ae.lastBufferedRequest=null,K.next?(ae.corkedRequestsFree=K.next,K.next=null):ae.corkedRequestsFree=new e(ae),ae.bufferedRequestCount=0}else{for(;Z;){var se=Z.chunk,U=Z.encoding,J=Z.callback,z=ae.objectMode?1:se.length;if(A(Q,ae,!1,z,se,U,J),Z=Z.next,ae.bufferedRequestCount--,ae.writing)break}Z===null&&(ae.lastBufferedRequest=null)}ae.bufferedRequest=Z,ae.bufferProcessing=!1}T.prototype._write=function(Q,ae,Z){Z(new g("_write()"))},T.prototype._writev=null,T.prototype.end=function(Q,ae,Z){var te=this._writableState;return typeof Q=="function"?(Z=Q,Q=null,ae=null):typeof ae=="function"&&(Z=ae,ae=null),Q!=null&&this.write(Q,ae),te.corked&&(te.corked=1,this.uncork()),te.ending||ee(this,te,Z),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function j(Q){return Q.ending&&Q.length===0&&Q.bufferedRequest===null&&!Q.finished&&!Q.writing}function $(Q,ae){Q._final(function(Z){ae.pendingcb--,Z&&p(Q,Z),ae.prefinished=!0,Q.emit("prefinish"),M(Q,ae)})}function F(Q,ae){!ae.prefinished&&!ae.finalCalled&&(typeof Q._final=="function"&&!ae.destroyed?(ae.pendingcb++,ae.finalCalled=!0,process.nextTick($,Q,ae)):(ae.prefinished=!0,Q.emit("prefinish")))}function M(Q,ae){var Z=j(ae);if(Z&&(F(Q,ae),ae.pendingcb===0&&(ae.finished=!0,Q.emit("finish"),ae.autoDestroy))){var te=Q._readableState;(!te||te.autoDestroy&&te.endEmitted)&&Q.destroy()}return Z}function ee(Q,ae,Z){ae.ending=!0,M(Q,ae),Z&&(ae.finished?process.nextTick(Z):Q.once("finish",Z)),ae.ended=!0,Q.writable=!1}function de(Q,ae,Z){var te=Q.entry;for(Q.entry=null;te;){var re=te.callback;ae.pendingcb--,re(Z),te=te.next}ae.corkedRequestsFree.next=Q}return Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(ae){this._writableState&&(this._writableState.destroyed=ae)}}),T.prototype.destroy=l.destroy,T.prototype._undestroy=l.undestroy,T.prototype._destroy=function(Q,ae){ae(Q)},wa}var Aa,Bd;function Mn(){if(Bd)return Aa;Bd=1;var e=Object.keys||function(a){var f=[];for(var d in a)f.push(d);return f};Aa=o;var t=lp(),r=cp();At(o,t);for(var n=e(r.prototype),i=0;i<n.length;i++){var s=n[i];o.prototype[s]||(o.prototype[s]=r.prototype[s])}function o(a){if(!(this instanceof o))return new o(a);t.call(this,a),r.call(this,a),this.allowHalfOpen=!0,a&&(a.readable===!1&&(this.readable=!1),a.writable===!1&&(this.writable=!1),a.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",u)))}Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function u(){this._writableState.ended||process.nextTick(l,this)}function l(a){a.end()}return Object.defineProperty(o.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(f){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=f,this._writableState.destroyed=f)}}),Aa}var Js={},Zc=St.Buffer,Cd=Zc.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 C1(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 R1(e){var t=C1(e);if(typeof t!="string"&&(Zc.isEncoding===Cd||!Cd(e)))throw new Error("Unknown encoding: "+e);return t||e}Js.StringDecoder=xs;function xs(e){this.encoding=R1(e);var t;switch(this.encoding){case"utf16le":this.text=F1,this.end=j1,t=4;break;case"utf8":this.fillLast=M1,t=4;break;case"base64":this.text=D1,this.end=H1,t=3;break;default:this.write=$1,this.end=G1;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Zc.allocUnsafe(t)}xs.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||""};xs.prototype.end=U1;xs.prototype.text=L1;xs.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 Ea(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function N1(e,t,r){var n=t.length-1;if(n<r)return 0;var i=Ea(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||i===-2?0:(i=Ea(t[n]),i>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||i===-2?0:(i=Ea(t[n]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function I1(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 M1(e){var t=this.lastTotal-this.lastNeed,r=I1(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 L1(e,t){var r=N1(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 U1(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t}function F1(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 j1(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 D1(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 H1(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function $1(e){return e.toString(this.encoding)}function G1(e){return e&&e.length?this.write(e):""}var Rd=yn.codes.ERR_STREAM_PREMATURE_CLOSE;function K1(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}function q1(){}function V1(e){return e.setHeader&&typeof e.abort=="function"}function up(e,t,r){if(typeof t=="function")return up(e,null,t);t||(t={}),r=K1(r||q1);var n=t.readable||t.readable!==!1&&e.readable,i=t.writable||t.writable!==!1&&e.writable,s=function(){e.writable||u()},o=e._writableState&&e._writableState.finished,u=function(){i=!1,o=!0,n||r.call(e)},l=e._readableState&&e._readableState.endEmitted,a=function(){n=!1,l=!0,i||r.call(e)},f=function(h){r.call(e,h)},d=function(){var h;if(n&&!l)return(!e._readableState||!e._readableState.ended)&&(h=new Rd),r.call(e,h);if(i&&!o)return(!e._writableState||!e._writableState.ended)&&(h=new Rd),r.call(e,h)},c=function(){e.req.on("finish",u)};return V1(e)?(e.on("complete",u),e.on("abort",d),e.req?c():e.on("request",c)):i&&!e._writableState&&(e.on("end",s),e.on("close",s)),e.on("end",a),e.on("finish",u),t.error!==!1&&e.on("error",f),e.on("close",d),function(){e.removeListener("complete",u),e.removeListener("abort",d),e.removeListener("request",c),e.req&&e.req.removeListener("finish",u),e.removeListener("end",s),e.removeListener("close",s),e.removeListener("finish",u),e.removeListener("end",a),e.removeListener("error",f),e.removeListener("close",d)}}var Xc=up,va,Nd;function z1(){if(Nd)return va;Nd=1;var e;function t(v,p,B){return p=r(p),p in v?Object.defineProperty(v,p,{value:B,enumerable:!0,configurable:!0,writable:!0}):v[p]=B,v}function r(v){var p=n(v,"string");return typeof p=="symbol"?p:String(p)}function n(v,p){if(typeof v!="object"||v===null)return v;var B=v[Symbol.toPrimitive];if(B!==void 0){var k=B.call(v,p||"default");if(typeof k!="object")return k;throw new TypeError("@@toPrimitive must return a primitive value.")}return(p==="string"?String:Number)(v)}var i=Xc,s=Symbol("lastResolve"),o=Symbol("lastReject"),u=Symbol("error"),l=Symbol("ended"),a=Symbol("lastPromise"),f=Symbol("handlePromise"),d=Symbol("stream");function c(v,p){return{value:v,done:p}}function g(v){var p=v[s];if(p!==null){var B=v[d].read();B!==null&&(v[a]=null,v[s]=null,v[o]=null,p(c(B,!1)))}}function h(v){process.nextTick(g,v)}function b(v,p){return function(B,k){v.then(function(){if(p[l]){B(c(void 0,!0));return}p[f](B,k)},k)}}var P=Object.getPrototypeOf(function(){}),w=Object.setPrototypeOf((e={get stream(){return this[d]},next:function(){var p=this,B=this[u];if(B!==null)return Promise.reject(B);if(this[l])return Promise.resolve(c(void 0,!0));if(this[d].destroyed)return new Promise(function(N,S){process.nextTick(function(){p[u]?S(p[u]):N(c(void 0,!0))})});var k=this[a],R;if(k)R=new Promise(b(k,this));else{var T=this[d].read();if(T!==null)return Promise.resolve(c(T,!1));R=new Promise(this[f])}return this[a]=R,R}},t(e,Symbol.asyncIterator,function(){return this}),t(e,"return",function(){var p=this;return new Promise(function(B,k){p[d].destroy(null,function(R){if(R){k(R);return}B(c(void 0,!0))})})}),e),P),y=function(p){var B,k=Object.create(w,(B={},t(B,d,{value:p,writable:!0}),t(B,s,{value:null,writable:!0}),t(B,o,{value:null,writable:!0}),t(B,u,{value:null,writable:!0}),t(B,l,{value:p._readableState.endEmitted,writable:!0}),t(B,f,{value:function(T,N){var S=k[d].read();S?(k[a]=null,k[s]=null,k[o]=null,T(c(S,!1))):(k[s]=T,k[o]=N)},writable:!0}),B));return k[a]=null,i(p,function(R){if(R&&R.code!=="ERR_STREAM_PREMATURE_CLOSE"){var T=k[o];T!==null&&(k[a]=null,k[s]=null,k[o]=null,T(R)),k[u]=R;return}var N=k[s];N!==null&&(k[a]=null,k[s]=null,k[o]=null,N(c(void 0,!0))),k[l]=!0}),p.on("readable",h.bind(null,k)),k};return va=y,va}var _a,Id;function W1(){return Id||(Id=1,_a=function(){throw new Error("Readable.from is not available in the browser")}),_a}var ka,Md;function lp(){if(Md)return ka;Md=1,ka=N;var e;N.ReadableState=T,np.EventEmitter;var t=function(W,ne){return W.listeners(ne).length},r=ip,n=Ar.Buffer,i=(typeof Me<"u"?Me:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function s(K){return n.from(K)}function o(K){return n.isBuffer(K)||K instanceof i}var u=fo,l;u&&u.debuglog?l=u.debuglog("stream"):l=function(){};var a=y1(),f=sp,d=ap,c=d.getHighWaterMark,g=yn.codes,h=g.ERR_INVALID_ARG_TYPE,b=g.ERR_STREAM_PUSH_AFTER_EOF,P=g.ERR_METHOD_NOT_IMPLEMENTED,w=g.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,y,v,p;At(N,r);var B=f.errorOrDestroy,k=["error","close","destroy","pause","resume"];function R(K,W,ne){if(typeof K.prependListener=="function")return K.prependListener(W,ne);!K._events||!K._events[W]?K.on(W,ne):Array.isArray(K._events[W])?K._events[W].unshift(ne):K._events[W]=[ne,K._events[W]]}function T(K,W,ne){e=e||Mn(),K=K||{},typeof ne!="boolean"&&(ne=W instanceof e),this.objectMode=!!K.objectMode,ne&&(this.objectMode=this.objectMode||!!K.readableObjectMode),this.highWaterMark=c(this,K,"readableHighWaterMark",ne),this.buffer=new a,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=K.emitClose!==!1,this.autoDestroy=!!K.autoDestroy,this.destroyed=!1,this.defaultEncoding=K.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,K.encoding&&(y||(y=Js.StringDecoder),this.decoder=new y(K.encoding),this.encoding=K.encoding)}function N(K){if(e=e||Mn(),!(this instanceof N))return new N(K);var W=this instanceof e;this._readableState=new T(K,this,W),this.readable=!0,K&&(typeof K.read=="function"&&(this._read=K.read),typeof K.destroy=="function"&&(this._destroy=K.destroy)),r.call(this)}Object.defineProperty(N.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(W){this._readableState&&(this._readableState.destroyed=W)}}),N.prototype.destroy=f.destroy,N.prototype._undestroy=f.undestroy,N.prototype._destroy=function(K,W){W(K)},N.prototype.push=function(K,W){var ne=this._readableState,se;return ne.objectMode?se=!0:typeof K=="string"&&(W=W||ne.defaultEncoding,W!==ne.encoding&&(K=n.from(K,W),W=""),se=!0),S(this,K,W,!1,se)},N.prototype.unshift=function(K){return S(this,K,null,!0,!1)};function S(K,W,ne,se,U){l("readableAddChunk",W);var J=K._readableState;if(W===null)J.reading=!1,L(K,J);else{var z;if(U||(z=x(J,W)),z)B(K,z);else if(J.objectMode||W&&W.length>0)if(typeof W!="string"&&!J.objectMode&&Object.getPrototypeOf(W)!==n.prototype&&(W=s(W)),se)J.endEmitted?B(K,new w):E(K,J,W,!0);else if(J.ended)B(K,new b);else{if(J.destroyed)return!1;J.reading=!1,J.decoder&&!ne?(W=J.decoder.write(W),J.objectMode||W.length!==0?E(K,J,W,!1):D(K,J)):E(K,J,W,!1)}else se||(J.reading=!1,D(K,J))}return!J.ended&&(J.length<J.highWaterMark||J.length===0)}function E(K,W,ne,se){W.flowing&&W.length===0&&!W.sync?(W.awaitDrain=0,K.emit("data",ne)):(W.length+=W.objectMode?1:ne.length,se?W.buffer.unshift(ne):W.buffer.push(ne),W.needReadable&&H(K)),D(K,W)}function x(K,W){var ne;return!o(W)&&typeof W!="string"&&W!==void 0&&!K.objectMode&&(ne=new h("chunk",["string","Buffer","Uint8Array"],W)),ne}N.prototype.isPaused=function(){return this._readableState.flowing===!1},N.prototype.setEncoding=function(K){y||(y=Js.StringDecoder);var W=new y(K);this._readableState.decoder=W,this._readableState.encoding=this._readableState.decoder.encoding;for(var ne=this._readableState.buffer.head,se="";ne!==null;)se+=W.write(ne.data),ne=ne.next;return this._readableState.buffer.clear(),se!==""&&this._readableState.buffer.push(se),this._readableState.length=se.length,this};var A=1073741824;function O(K){return K>=A?K=A:(K--,K|=K>>>1,K|=K>>>2,K|=K>>>4,K|=K>>>8,K|=K>>>16,K++),K}function I(K,W){return K<=0||W.length===0&&W.ended?0:W.objectMode?1:K!==K?W.flowing&&W.length?W.buffer.head.data.length:W.length:(K>W.highWaterMark&&(W.highWaterMark=O(K)),K<=W.length?K:W.ended?W.length:(W.needReadable=!0,0))}N.prototype.read=function(K){l("read",K),K=parseInt(K,10);var W=this._readableState,ne=K;if(K!==0&&(W.emittedReadable=!1),K===0&&W.needReadable&&((W.highWaterMark!==0?W.length>=W.highWaterMark:W.length>0)||W.ended))return l("read: emitReadable",W.length,W.ended),W.length===0&&W.ended?Z(this):H(this),null;if(K=I(K,W),K===0&&W.ended)return W.length===0&&Z(this),null;var se=W.needReadable;l("need readable",se),(W.length===0||W.length-K<W.highWaterMark)&&(se=!0,l("length less than watermark",se)),W.ended||W.reading?(se=!1,l("reading or ended",se)):se&&(l("do read"),W.reading=!0,W.sync=!0,W.length===0&&(W.needReadable=!0),this._read(W.highWaterMark),W.sync=!1,W.reading||(K=I(ne,W)));var U;return K>0?U=ae(K,W):U=null,U===null?(W.needReadable=W.length<=W.highWaterMark,K=0):(W.length-=K,W.awaitDrain=0),W.length===0&&(W.ended||(W.needReadable=!0),ne!==K&&W.ended&&Z(this)),U!==null&&this.emit("data",U),U};function L(K,W){if(l("onEofChunk"),!W.ended){if(W.decoder){var ne=W.decoder.end();ne&&ne.length&&(W.buffer.push(ne),W.length+=W.objectMode?1:ne.length)}W.ended=!0,W.sync?H(K):(W.needReadable=!1,W.emittedReadable||(W.emittedReadable=!0,V(K)))}}function H(K){var W=K._readableState;l("emitReadable",W.needReadable,W.emittedReadable),W.needReadable=!1,W.emittedReadable||(l("emitReadable",W.flowing),W.emittedReadable=!0,process.nextTick(V,K))}function V(K){var W=K._readableState;l("emitReadable_",W.destroyed,W.length,W.ended),!W.destroyed&&(W.length||W.ended)&&(K.emit("readable"),W.emittedReadable=!1),W.needReadable=!W.flowing&&!W.ended&&W.length<=W.highWaterMark,Q(K)}function D(K,W){W.readingMore||(W.readingMore=!0,process.nextTick(j,K,W))}function j(K,W){for(;!W.reading&&!W.ended&&(W.length<W.highWaterMark||W.flowing&&W.length===0);){var ne=W.length;if(l("maybeReadMore read 0"),K.read(0),ne===W.length)break}W.readingMore=!1}N.prototype._read=function(K){B(this,new P("_read()"))},N.prototype.pipe=function(K,W){var ne=this,se=this._readableState;switch(se.pipesCount){case 0:se.pipes=K;break;case 1:se.pipes=[se.pipes,K];break;default:se.pipes.push(K);break}se.pipesCount+=1,l("pipe count=%d opts=%j",se.pipesCount,W);var U=(!W||W.end!==!1)&&K!==process.stdout&&K!==process.stderr,J=U?oe:fe;se.endEmitted?process.nextTick(J):ne.once("end",J),K.on("unpipe",z);function z(C,m){l("onunpipe"),C===ne&&m&&m.hasUnpiped===!1&&(m.hasUnpiped=!0,we())}function oe(){l("onend"),K.end()}var Y=$(ne);K.on("drain",Y);var he=!1;function we(){l("cleanup"),K.removeListener("close",ce),K.removeListener("finish",me),K.removeListener("drain",Y),K.removeListener("error",ie),K.removeListener("unpipe",z),ne.removeListener("end",oe),ne.removeListener("end",fe),ne.removeListener("data",ye),he=!0,se.awaitDrain&&(!K._writableState||K._writableState.needDrain)&&Y()}ne.on("data",ye);function ye(C){l("ondata");var m=K.write(C);l("dest.write",m),m===!1&&((se.pipesCount===1&&se.pipes===K||se.pipesCount>1&&re(se.pipes,K)!==-1)&&!he&&(l("false write response, pause",se.awaitDrain),se.awaitDrain++),ne.pause())}function ie(C){l("onerror",C),fe(),K.removeListener("error",ie),t(K,"error")===0&&B(K,C)}R(K,"error",ie);function ce(){K.removeListener("finish",me),fe()}K.once("close",ce);function me(){l("onfinish"),K.removeListener("close",ce),fe()}K.once("finish",me);function fe(){l("unpipe"),ne.unpipe(K)}return K.emit("pipe",ne),se.flowing||(l("pipe resume"),ne.resume()),K};function $(K){return function(){var ne=K._readableState;l("pipeOnDrain",ne.awaitDrain),ne.awaitDrain&&ne.awaitDrain--,ne.awaitDrain===0&&t(K,"data")&&(ne.flowing=!0,Q(K))}}N.prototype.unpipe=function(K){var W=this._readableState,ne={hasUnpiped:!1};if(W.pipesCount===0)return this;if(W.pipesCount===1)return K&&K!==W.pipes?this:(K||(K=W.pipes),W.pipes=null,W.pipesCount=0,W.flowing=!1,K&&K.emit("unpipe",this,ne),this);if(!K){var se=W.pipes,U=W.pipesCount;W.pipes=null,W.pipesCount=0,W.flowing=!1;for(var J=0;J<U;J++)se[J].emit("unpipe",this,{hasUnpiped:!1});return this}var z=re(W.pipes,K);return z===-1?this:(W.pipes.splice(z,1),W.pipesCount-=1,W.pipesCount===1&&(W.pipes=W.pipes[0]),K.emit("unpipe",this,ne),this)},N.prototype.on=function(K,W){var ne=r.prototype.on.call(this,K,W),se=this._readableState;return K==="data"?(se.readableListening=this.listenerCount("readable")>0,se.flowing!==!1&&this.resume()):K==="readable"&&!se.endEmitted&&!se.readableListening&&(se.readableListening=se.needReadable=!0,se.flowing=!1,se.emittedReadable=!1,l("on readable",se.length,se.reading),se.length?H(this):se.reading||process.nextTick(M,this)),ne},N.prototype.addListener=N.prototype.on,N.prototype.removeListener=function(K,W){var ne=r.prototype.removeListener.call(this,K,W);return K==="readable"&&process.nextTick(F,this),ne},N.prototype.removeAllListeners=function(K){var W=r.prototype.removeAllListeners.apply(this,arguments);return(K==="readable"||K===void 0)&&process.nextTick(F,this),W};function F(K){var W=K._readableState;W.readableListening=K.listenerCount("readable")>0,W.resumeScheduled&&!W.paused?W.flowing=!0:K.listenerCount("data")>0&&K.resume()}function M(K){l("readable nexttick read 0"),K.read(0)}N.prototype.resume=function(){var K=this._readableState;return K.flowing||(l("resume"),K.flowing=!K.readableListening,ee(this,K)),K.paused=!1,this};function ee(K,W){W.resumeScheduled||(W.resumeScheduled=!0,process.nextTick(de,K,W))}function de(K,W){l("resume",W.reading),W.reading||K.read(0),W.resumeScheduled=!1,K.emit("resume"),Q(K),W.flowing&&!W.reading&&K.read(0)}N.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Q(K){var W=K._readableState;for(l("flow",W.flowing);W.flowing&&K.read()!==null;);}N.prototype.wrap=function(K){var W=this,ne=this._readableState,se=!1;K.on("end",function(){if(l("wrapped end"),ne.decoder&&!ne.ended){var z=ne.decoder.end();z&&z.length&&W.push(z)}W.push(null)}),K.on("data",function(z){if(l("wrapped data"),ne.decoder&&(z=ne.decoder.write(z)),!(ne.objectMode&&z==null)&&!(!ne.objectMode&&(!z||!z.length))){var oe=W.push(z);oe||(se=!0,K.pause())}});for(var U in K)this[U]===void 0&&typeof K[U]=="function"&&(this[U]=function(oe){return function(){return K[oe].apply(K,arguments)}}(U));for(var J=0;J<k.length;J++)K.on(k[J],this.emit.bind(this,k[J]));return this._read=function(z){l("wrapped _read",z),se&&(se=!1,K.resume())},this},typeof Symbol=="function"&&(N.prototype[Symbol.asyncIterator]=function(){return v===void 0&&(v=z1()),v(this)}),Object.defineProperty(N.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(N.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(N.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(W){this._readableState&&(this._readableState.flowing=W)}}),N._fromList=ae,Object.defineProperty(N.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function ae(K,W){if(W.length===0)return null;var ne;return W.objectMode?ne=W.buffer.shift():!K||K>=W.length?(W.decoder?ne=W.buffer.join(""):W.buffer.length===1?ne=W.buffer.first():ne=W.buffer.concat(W.length),W.buffer.clear()):ne=W.buffer.consume(K,W.decoder),ne}function Z(K){var W=K._readableState;l("endReadable",W.endEmitted),W.endEmitted||(W.ended=!0,process.nextTick(te,W,K))}function te(K,W){if(l("endReadableNT",K.endEmitted,K.length),!K.endEmitted&&K.length===0&&(K.endEmitted=!0,W.readable=!1,W.emit("end"),K.autoDestroy)){var ne=W._writableState;(!ne||ne.autoDestroy&&ne.finished)&&W.destroy()}}typeof Symbol=="function"&&(N.from=function(K,W){return p===void 0&&(p=W1()),p(N,K,W)});function re(K,W){for(var ne=0,se=K.length;ne<se;ne++)if(K[ne]===W)return ne;return-1}return ka}var fp=wr,po=yn.codes,J1=po.ERR_METHOD_NOT_IMPLEMENTED,Q1=po.ERR_MULTIPLE_CALLBACK,Y1=po.ERR_TRANSFORM_ALREADY_TRANSFORMING,Z1=po.ERR_TRANSFORM_WITH_LENGTH_0,bo=Mn();At(wr,bo);function X1(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new Q1);r.writechunk=null,r.writecb=null,t!=null&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function wr(e){if(!(this instanceof wr))return new wr(e);bo.call(this,e),this._transformState={afterTransform:X1.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",ex)}function ex(){var e=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(t,r){Ld(e,t,r)}):Ld(this,null,null)}wr.prototype.push=function(e,t){return this._transformState.needTransform=!1,bo.prototype.push.call(this,e,t)};wr.prototype._transform=function(e,t,r){r(new J1("_transform()"))};wr.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};wr.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};wr.prototype._destroy=function(e,t){bo.prototype._destroy.call(this,e,function(r){t(r)})};function Ld(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new Z1;if(e._transformState.transforming)throw new Y1;return e.push(null)}var tx=ls,dp=fp;At(ls,dp);function ls(e){if(!(this instanceof ls))return new ls(e);dp.call(this,e)}ls.prototype._transform=function(e,t,r){r(null,e)};var Pa;function rx(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}var hp=yn.codes,nx=hp.ERR_MISSING_ARGS,ix=hp.ERR_STREAM_DESTROYED;function Ud(e){if(e)throw e}function sx(e){return e.setHeader&&typeof e.abort=="function"}function ox(e,t,r,n){n=rx(n);var i=!1;e.on("close",function(){i=!0}),Pa===void 0&&(Pa=Xc),Pa(e,{readable:t,writable:r},function(o){if(o)return n(o);i=!0,n()});var s=!1;return function(o){if(!i&&!s){if(s=!0,sx(e))return e.abort();if(typeof e.destroy=="function")return e.destroy();n(o||new ix("pipe"))}}}function Fd(e){e()}function ax(e,t){return e.pipe(t)}function cx(e){return!e.length||typeof e[e.length-1]!="function"?Ud:e.pop()}function ux(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=cx(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new nx("streams");var i,s=t.map(function(o,u){var l=u<t.length-1,a=u>0;return ox(o,l,a,function(f){i||(i=f),f&&s.forEach(Fd),!l&&(s.forEach(Fd),n(i))})});return t.reduce(ax)}var lx=ux;(function(e,t){t=e.exports=lp(),t.Stream=t,t.Readable=t,t.Writable=cp(),t.Duplex=Mn(),t.Transform=fp,t.PassThrough=tx,t.finished=Xc,t.pipeline=lx})(mc,mc.exports);var fx=mc.exports,Qs=St.Buffer,pp=fx.Transform,dx=At;function hx(e,t){if(!Qs.isBuffer(e)&&typeof e!="string")throw new TypeError(t+" must be a string or a buffer")}function Cr(e){pp.call(this),this._block=Qs.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}dx(Cr,pp);Cr.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(i){n=i}r(n)};Cr.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(r){t=r}e(t)};Cr.prototype.update=function(e,t){if(hx(e,"Data"),this._finalized)throw new Error("Digest already called");Qs.isBuffer(e)||(e=Qs.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)r[i++]=e[n++];this._update(),this._blockOffset=0}for(;n<e.length;)r[this._blockOffset++]=e[n++];for(var s=0,o=e.length*8;o>0;++s)this._length[s]+=o,o=this._length[s]/4294967296|0,o>0&&(this._length[s]-=4294967296*o);return this};Cr.prototype._update=function(){throw new Error("_update is not implemented")};Cr.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};Cr.prototype._digest=function(){throw new Error("_digest is not implemented")};var bp=Cr,px=At,gp=bp,bx=St.Buffer,gx=new Array(16);function go(){gp.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}px(go,gp);go.prototype._update=function(){for(var e=gx,t=0;t<16;++t)e[t]=this._block.readInt32LE(t*4);var r=this._a,n=this._b,i=this._c,s=this._d;r=gt(r,n,i,s,e[0],3614090360,7),s=gt(s,r,n,i,e[1],3905402710,12),i=gt(i,s,r,n,e[2],606105819,17),n=gt(n,i,s,r,e[3],3250441966,22),r=gt(r,n,i,s,e[4],4118548399,7),s=gt(s,r,n,i,e[5],1200080426,12),i=gt(i,s,r,n,e[6],2821735955,17),n=gt(n,i,s,r,e[7],4249261313,22),r=gt(r,n,i,s,e[8],1770035416,7),s=gt(s,r,n,i,e[9],2336552879,12),i=gt(i,s,r,n,e[10],4294925233,17),n=gt(n,i,s,r,e[11],2304563134,22),r=gt(r,n,i,s,e[12],1804603682,7),s=gt(s,r,n,i,e[13],4254626195,12),i=gt(i,s,r,n,e[14],2792965006,17),n=gt(n,i,s,r,e[15],1236535329,22),r=mt(r,n,i,s,e[1],4129170786,5),s=mt(s,r,n,i,e[6],3225465664,9),i=mt(i,s,r,n,e[11],643717713,14),n=mt(n,i,s,r,e[0],3921069994,20),r=mt(r,n,i,s,e[5],3593408605,5),s=mt(s,r,n,i,e[10],38016083,9),i=mt(i,s,r,n,e[15],3634488961,14),n=mt(n,i,s,r,e[4],3889429448,20),r=mt(r,n,i,s,e[9],568446438,5),s=mt(s,r,n,i,e[14],3275163606,9),i=mt(i,s,r,n,e[3],4107603335,14),n=mt(n,i,s,r,e[8],1163531501,20),r=mt(r,n,i,s,e[13],2850285829,5),s=mt(s,r,n,i,e[2],4243563512,9),i=mt(i,s,r,n,e[7],1735328473,14),n=mt(n,i,s,r,e[12],2368359562,20),r=yt(r,n,i,s,e[5],4294588738,4),s=yt(s,r,n,i,e[8],2272392833,11),i=yt(i,s,r,n,e[11],1839030562,16),n=yt(n,i,s,r,e[14],4259657740,23),r=yt(r,n,i,s,e[1],2763975236,4),s=yt(s,r,n,i,e[4],1272893353,11),i=yt(i,s,r,n,e[7],4139469664,16),n=yt(n,i,s,r,e[10],3200236656,23),r=yt(r,n,i,s,e[13],681279174,4),s=yt(s,r,n,i,e[0],3936430074,11),i=yt(i,s,r,n,e[3],3572445317,16),n=yt(n,i,s,r,e[6],76029189,23),r=yt(r,n,i,s,e[9],3654602809,4),s=yt(s,r,n,i,e[12],3873151461,11),i=yt(i,s,r,n,e[15],530742520,16),n=yt(n,i,s,r,e[2],3299628645,23),r=xt(r,n,i,s,e[0],4096336452,6),s=xt(s,r,n,i,e[7],1126891415,10),i=xt(i,s,r,n,e[14],2878612391,15),n=xt(n,i,s,r,e[5],4237533241,21),r=xt(r,n,i,s,e[12],1700485571,6),s=xt(s,r,n,i,e[3],2399980690,10),i=xt(i,s,r,n,e[10],4293915773,15),n=xt(n,i,s,r,e[1],2240044497,21),r=xt(r,n,i,s,e[8],1873313359,6),s=xt(s,r,n,i,e[15],4264355552,10),i=xt(i,s,r,n,e[6],2734768916,15),n=xt(n,i,s,r,e[13],1309151649,21),r=xt(r,n,i,s,e[4],4149444226,6),s=xt(s,r,n,i,e[11],3174756917,10),i=xt(i,s,r,n,e[2],718787259,15),n=xt(n,i,s,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+s|0};go.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=bx.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 mo(e,t){return e<<t|e>>>32-t}function gt(e,t,r,n,i,s,o){return mo(e+(t&r|~t&n)+i+s|0,o)+t|0}function mt(e,t,r,n,i,s,o){return mo(e+(t&n|r&~n)+i+s|0,o)+t|0}function yt(e,t,r,n,i,s,o){return mo(e+(t^r^n)+i+s|0,o)+t|0}function xt(e,t,r,n,i,s,o){return mo(e+(r^(t|~n))+i+s|0,o)+t|0}var mx=go,Ta=Ar.Buffer,yx=At,mp=bp,xx=new Array(16),Yi=[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],Zi=[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],Xi=[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],es=[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],ts=[0,1518500249,1859775393,2400959708,2840853838],rs=[1352829926,1548603684,1836072691,2053994217,0];function yo(){mp.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}yx(yo,mp);yo.prototype._update=function(){for(var e=xx,t=0;t<16;++t)e[t]=this._block.readInt32LE(t*4);for(var r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,o=this._e|0,u=this._a|0,l=this._b|0,a=this._c|0,f=this._d|0,d=this._e|0,c=0;c<80;c+=1){var g,h;c<16?(g=jd(r,n,i,s,o,e[Yi[c]],ts[0],Xi[c]),h=Gd(u,l,a,f,d,e[Zi[c]],rs[0],es[c])):c<32?(g=Dd(r,n,i,s,o,e[Yi[c]],ts[1],Xi[c]),h=$d(u,l,a,f,d,e[Zi[c]],rs[1],es[c])):c<48?(g=Hd(r,n,i,s,o,e[Yi[c]],ts[2],Xi[c]),h=Hd(u,l,a,f,d,e[Zi[c]],rs[2],es[c])):c<64?(g=$d(r,n,i,s,o,e[Yi[c]],ts[3],Xi[c]),h=Dd(u,l,a,f,d,e[Zi[c]],rs[3],es[c])):(g=Gd(r,n,i,s,o,e[Yi[c]],ts[4],Xi[c]),h=jd(u,l,a,f,d,e[Zi[c]],rs[4],es[c])),r=o,o=s,s=hn(i,10),i=n,n=g,u=d,d=f,f=hn(a,10),a=l,l=h}var b=this._b+i+f|0;this._b=this._c+s+d|0,this._c=this._d+o+u|0,this._d=this._e+r+l|0,this._e=this._a+n+a|0,this._a=b};yo.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=Ta.alloc?Ta.alloc(20):new Ta(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 hn(e,t){return e<<t|e>>>32-t}function jd(e,t,r,n,i,s,o,u){return hn(e+(t^r^n)+s+o|0,u)+i|0}function Dd(e,t,r,n,i,s,o,u){return hn(e+(t&r|~t&n)+s+o|0,u)+i|0}function Hd(e,t,r,n,i,s,o,u){return hn(e+((t|~r)^n)+s+o|0,u)+i|0}function $d(e,t,r,n,i,s,o,u){return hn(e+(t&n|r&~n)+s+o|0,u)+i|0}function Gd(e,t,r,n,i,s,o,u){return hn(e+(t^(r|~n))+s+o|0,u)+i|0}var wx=yo,yp={exports:{}},xp=St.Buffer;function xo(e,t){this._block=xp.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}xo.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=xp.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,s=this._len,o=0;o<i;){for(var u=s%n,l=Math.min(i-o,n-u),a=0;a<l;a++)r[u+a]=e[o+a];s+=l,o+=l,s%n===0&&this._update(r)}return this._len+=i,this};xo.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,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return e?s.toString(e):s};xo.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Fn=xo,Ax=At,wp=Fn,Ex=St.Buffer,vx=[1518500249,1859775393,-1894007588,-899497514],_x=new Array(80);function ws(){this.init(),this._w=_x,wp.call(this,64,56)}Ax(ws,wp);ws.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function kx(e){return e<<5|e>>>27}function Px(e){return e<<30|e>>>2}function Tx(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}ws.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,o=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 l=0;l<80;++l){var a=~~(l/20),f=kx(r)+Tx(a,n,i,s)+o+t[l]+vx[a]|0;o=s,s=i,i=Px(n),n=r,r=f}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0};ws.prototype._hash=function(){var e=Ex.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 Sx=ws,Ox=At,Ap=Fn,Bx=St.Buffer,Cx=[1518500249,1859775393,-1894007588,-899497514],Rx=new Array(80);function As(){this.init(),this._w=Rx,Ap.call(this,64,56)}Ox(As,Ap);As.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function Nx(e){return e<<1|e>>>31}function Ix(e){return e<<5|e>>>27}function Mx(e){return e<<30|e>>>2}function Lx(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}As.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,o=this._e|0,u=0;u<16;++u)t[u]=e.readInt32BE(u*4);for(;u<80;++u)t[u]=Nx(t[u-3]^t[u-8]^t[u-14]^t[u-16]);for(var l=0;l<80;++l){var a=~~(l/20),f=Ix(r)+Lx(a,n,i,s)+o+t[l]+Cx[a]|0;o=s,s=i,i=Mx(n),n=r,r=f}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0};As.prototype._hash=function(){var e=Bx.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 Ux=As,Fx=At,Ep=Fn,jx=St.Buffer,Dx=[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],Hx=new Array(64);function Es(){this.init(),this._w=Hx,Ep.call(this,64,56)}Fx(Es,Ep);Es.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 $x(e,t,r){return r^e&(t^r)}function Gx(e,t,r){return e&t|r&(e|t)}function Kx(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function qx(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function Vx(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function zx(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Es.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,o=this._e|0,u=this._f|0,l=this._g|0,a=this._h|0,f=0;f<16;++f)t[f]=e.readInt32BE(f*4);for(;f<64;++f)t[f]=zx(t[f-2])+t[f-7]+Vx(t[f-15])+t[f-16]|0;for(var d=0;d<64;++d){var c=a+qx(o)+$x(o,u,l)+Dx[d]+t[d]|0,g=Kx(r)+Gx(r,n,i)|0;a=l,l=u,u=o,o=s+c|0,s=i,i=n,n=r,r=c+g|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0,this._f=u+this._f|0,this._g=l+this._g|0,this._h=a+this._h|0};Es.prototype._hash=function(){var e=jx.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 vp=Es,Wx=At,Jx=vp,Qx=Fn,Yx=St.Buffer,Zx=new Array(64);function wo(){this.init(),this._w=Zx,Qx.call(this,64,56)}Wx(wo,Jx);wo.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};wo.prototype._hash=function(){var e=Yx.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 Xx=wo,ew=At,_p=Fn,tw=St.Buffer,Kd=[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],rw=new Array(160);function vs(){this.init(),this._w=rw,_p.call(this,128,112)}ew(vs,_p);vs.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 qd(e,t,r){return r^e&(t^r)}function Vd(e,t,r){return e&t|r&(e|t)}function zd(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function Wd(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function nw(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function iw(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function sw(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function ow(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function lt(e,t){return e>>>0<t>>>0?1:0}vs.prototype._update=function(e){for(var t=this._w,r=this._ah|0,n=this._bh|0,i=this._ch|0,s=this._dh|0,o=this._eh|0,u=this._fh|0,l=this._gh|0,a=this._hh|0,f=this._al|0,d=this._bl|0,c=this._cl|0,g=this._dl|0,h=this._el|0,b=this._fl|0,P=this._gl|0,w=this._hl|0,y=0;y<32;y+=2)t[y]=e.readInt32BE(y*4),t[y+1]=e.readInt32BE(y*4+4);for(;y<160;y+=2){var v=t[y-30],p=t[y-15*2+1],B=nw(v,p),k=iw(p,v);v=t[y-2*2],p=t[y-2*2+1];var R=sw(v,p),T=ow(p,v),N=t[y-7*2],S=t[y-7*2+1],E=t[y-16*2],x=t[y-16*2+1],A=k+S|0,O=B+N+lt(A,k)|0;A=A+T|0,O=O+R+lt(A,T)|0,A=A+x|0,O=O+E+lt(A,x)|0,t[y]=O,t[y+1]=A}for(var I=0;I<160;I+=2){O=t[I],A=t[I+1];var L=Vd(r,n,i),H=Vd(f,d,c),V=zd(r,f),D=zd(f,r),j=Wd(o,h),$=Wd(h,o),F=Kd[I],M=Kd[I+1],ee=qd(o,u,l),de=qd(h,b,P),Q=w+$|0,ae=a+j+lt(Q,w)|0;Q=Q+de|0,ae=ae+ee+lt(Q,de)|0,Q=Q+M|0,ae=ae+F+lt(Q,M)|0,Q=Q+A|0,ae=ae+O+lt(Q,A)|0;var Z=D+H|0,te=V+L+lt(Z,D)|0;a=l,w=P,l=u,P=b,u=o,b=h,h=g+Q|0,o=s+ae+lt(h,g)|0,s=i,g=c,i=n,c=d,n=r,d=f,f=Q+Z|0,r=ae+te+lt(f,Q)|0}this._al=this._al+f|0,this._bl=this._bl+d|0,this._cl=this._cl+c|0,this._dl=this._dl+g|0,this._el=this._el+h|0,this._fl=this._fl+b|0,this._gl=this._gl+P|0,this._hl=this._hl+w|0,this._ah=this._ah+r+lt(this._al,f)|0,this._bh=this._bh+n+lt(this._bl,d)|0,this._ch=this._ch+i+lt(this._cl,c)|0,this._dh=this._dh+s+lt(this._dl,g)|0,this._eh=this._eh+o+lt(this._el,h)|0,this._fh=this._fh+u+lt(this._fl,b)|0,this._gh=this._gh+l+lt(this._gl,P)|0,this._hh=this._hh+a+lt(this._hl,w)|0};vs.prototype._hash=function(){var e=tw.allocUnsafe(64);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+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 kp=vs,aw=At,cw=kp,uw=Fn,lw=St.Buffer,fw=new Array(160);function Ao(){this.init(),this._w=fw,uw.call(this,128,112)}aw(Ao,cw);Ao.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};Ao.prototype._hash=function(){var e=lw.allocUnsafe(48);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+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 dw=Ao,xn=yp.exports=function(t){t=t.toLowerCase();var r=xn[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r};xn.sha=Sx;xn.sha1=Ux;xn.sha224=Xx;xn.sha256=vp;xn.sha384=dw;xn.sha512=kp;var hw=yp.exports,Pp=St.Buffer,Tp=fo.Transform,pw=Js.StringDecoder,bw=At;function Xt(e){Tp.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}bw(Xt,Tp);Xt.prototype.update=function(e,t,r){typeof e=="string"&&(e=Pp.from(e,t));var n=this._update(e);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)};Xt.prototype.setAutoPadding=function(){};Xt.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")};Xt.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")};Xt.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")};Xt.prototype._transform=function(e,t,r){var n;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(i){n=i}finally{r(n)}};Xt.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(r){t=r}e(t)};Xt.prototype._finalOrDigest=function(e){var t=this.__final()||Pp.alloc(0);return e&&(t=this._toString(t,e,!0)),t};Xt.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new pw(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 gw=Xt,mw=At,yw=mx,xw=wx,ww=hw,Sp=gw;function Eo(e){Sp.call(this,"digest"),this._hash=e}mw(Eo,Sp);Eo.prototype._update=function(e){this._hash.update(e)};Eo.prototype._final=function(){return this._hash.digest()};var Aw=function(t){return t=t.toLowerCase(),t==="md5"?new yw:t==="rmd160"||t==="ripemd160"?new xw:new Eo(ww(t))},Bs=St.Buffer;function Ew(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 i=e.charAt(n),s=i.charCodeAt(0);if(t[s]!==255)throw new TypeError(i+" is ambiguous");t[s]=n}var o=e.length,u=e.charAt(0),l=Math.log(o)/Math.log(256),a=Math.log(256)/Math.log(o);function f(g){if((Array.isArray(g)||g instanceof Uint8Array)&&(g=Bs.from(g)),!Bs.isBuffer(g))throw new TypeError("Expected Buffer");if(g.length===0)return"";for(var h=0,b=0,P=0,w=g.length;P!==w&&g[P]===0;)P++,h++;for(var y=(w-P)*a+1>>>0,v=new Uint8Array(y);P!==w;){for(var p=g[P],B=0,k=y-1;(p!==0||B<b)&&k!==-1;k--,B++)p+=256*v[k]>>>0,v[k]=p%o>>>0,p=p/o>>>0;if(p!==0)throw new Error("Non-zero carry");b=B,P++}for(var R=y-b;R!==y&&v[R]===0;)R++;for(var T=u.repeat(h);R<y;++R)T+=e.charAt(v[R]);return T}function d(g){if(typeof g!="string")throw new TypeError("Expected String");if(g.length===0)return Bs.alloc(0);for(var h=0,b=0,P=0;g[h]===u;)b++,h++;for(var w=(g.length-h)*l+1>>>0,y=new Uint8Array(w);h<g.length;){var v=t[g.charCodeAt(h)];if(v===255)return;for(var p=0,B=w-1;(v!==0||p<P)&&B!==-1;B--,p++)v+=o*y[B]>>>0,y[B]=v%256>>>0,v=v/256>>>0;if(v!==0)throw new Error("Non-zero carry");P=p,h++}for(var k=w-P;k!==w&&y[k]===0;)k++;var R=Bs.allocUnsafe(b+(w-k));R.fill(0,0,b);for(var T=b;k!==w;)R[T++]=y[k++];return R}function c(g){var h=d(g);if(h)return h;throw new Error("Non-base"+o+" character")}return{encode:f,decodeUnsafe:d,decode:c}}var vw=Ew,_w=vw,kw="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Pw=_w(kw),Sa=Pw,Tw=St.Buffer,Sw=function(e){function t(s){var o=e(s);return Sa.encode(Tw.concat([s,o],s.length+4))}function r(s){var o=s.slice(0,-4),u=s.slice(-4),l=e(o);if(!(u[0]^l[0]|u[1]^l[1]|u[2]^l[2]|u[3]^l[3]))return o}function n(s){var o=Sa.decodeUnsafe(s);if(o)return r(o)}function i(s){var o=Sa.decode(s),u=r(o);if(!u)throw new Error("Invalid checksum");return u}return{encode:t,decode:i,decodeUnsafe:n}},Jd=Aw,Ow=Sw;function Bw(e){var t=Jd("sha256").update(e).digest();return Jd("sha256").update(t).digest()}var Cw=Ow(Bw),xc=Cw;function Op(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 wc(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 Rw(e,t){return Op(xc.decode(e),t)}function Nw(e,t,r){return typeof e=="number"?xc.encode(wc(e,t,r)):xc.encode(wc(e.version,e.privateKey,e.compressed))}var Iw={decode:Rw,decodeRaw:Op,encode:Nw,encodeRaw:wc},vo={};Object.defineProperty(vo,"__esModule",{value:!0});vo.testEcc=void 0;const Ie=e=>Buffer.from(e,"hex");function Mw(e){tt(e.isPoint(Ie("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),tt(!e.isPoint(Ie("030000000000000000000000000000000000000000000000000000000000000005"))),tt(e.isPrivate(Ie("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),tt(e.isPrivate(Ie("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))),tt(!e.isPrivate(Ie("0000000000000000000000000000000000000000000000000000000000000000"))),tt(!e.isPrivate(Ie("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"))),tt(!e.isPrivate(Ie("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364142"))),tt(Buffer.from(e.privateAdd(Ie("0000000000000000000000000000000000000000000000000000000000000001"),Ie("0000000000000000000000000000000000000000000000000000000000000000"))).equals(Ie("0000000000000000000000000000000000000000000000000000000000000001"))),tt(e.privateAdd(Ie("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e"),Ie("0000000000000000000000000000000000000000000000000000000000000003"))===null),tt(Buffer.from(e.privateAdd(Ie("e211078564db65c3ce7704f08262b1f38f1ef412ad15b5ac2d76657a63b2c500"),Ie("b51fbb69051255d1becbd683de5848242a89c229348dd72896a87ada94ae8665"))).equals(Ie("9730c2ee69edbb958d42db7460bafa18fef9d955325aec99044c81c8282b0a24"))),tt(Buffer.from(e.privateNegate(Ie("0000000000000000000000000000000000000000000000000000000000000001"))).equals(Ie("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))),tt(Buffer.from(e.privateNegate(Ie("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e"))).equals(Ie("0000000000000000000000000000000000000000000000000000000000000003"))),tt(Buffer.from(e.privateNegate(Ie("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af"))).equals(Ie("4eede1bf775995d70a494f0a7bb6bc11e0b8cccd41cce8009ab1132c8b0a3792"))),tt(Buffer.from(e.pointCompress(Ie("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"),!0)).equals(Ie("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),tt(Buffer.from(e.pointCompress(Ie("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"),!1)).equals(Ie("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"))),tt(Buffer.from(e.pointCompress(Ie("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),!0)).equals(Ie("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),tt(Buffer.from(e.pointCompress(Ie("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),!1)).equals(Ie("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"))),tt(Buffer.from(e.pointFromScalar(Ie("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af"))).equals(Ie("02b07ba9dca9523b7ef4bd97703d43d20399eb698e194704791a25ce77a400df99"))),tt(e.xOnlyPointAddTweak(Ie("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Ie("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))===null);let t=e.xOnlyPointAddTweak(Ie("1617d38ed8d8657da4d4761e8057bc396ea9e4b9d29776d4be096016dbd2509b"),Ie("a8397a935f0dfceba6ba9618f6451ef4d80637abf4e6af2669fbc9de6a8fd2ac"));tt(Buffer.from(t.xOnlyPubkey).equals(Ie("e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf"))&&t.parity===1),t=e.xOnlyPointAddTweak(Ie("2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991"),Ie("823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47")),tt(Buffer.from(t.xOnlyPubkey).equals(Ie("9534f8dc8c6deda2dc007655981c78b49c5d96c778fbf363462a11ec9dfd948c"))&&t.parity===0),tt(Buffer.from(e.sign(Ie("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),Ie("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))).equals(Ie("54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"))),tt(e.verify(Ie("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),Ie("0379be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Ie("54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"))),e.signSchnorr&&tt(Buffer.from(e.signSchnorr(Ie("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),Ie("c90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b14e5c9"),Ie("c87aa53824b4d7ae2eb035a2b5bbbccc080e76cdc6d1692c4b0b62d798e6d906"))).equals(Ie("5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7"))),e.verifySchnorr&&tt(e.verifySchnorr(Ie("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),Ie("dd308afec5777e13121fa72b9cc1b7cc0139715309b086c960e18fd969774eb8"),Ie("5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7")))}vo.testEcc=Mw;function tt(e){if(!e)throw new Error("ecc library invalid")}Object.defineProperty(Nn,"__esModule",{value:!0});Nn.ECPairFactory=Nn.networks=void 0;const Ac=In;Nn.networks=Ac;const Pt=Gh,Lw=f1,Qd=Iw,Uw=vo,Oa=Pt.typeforce.maybe(Pt.typeforce.compile({compressed:Pt.maybe(Pt.Boolean),network:Pt.maybe(Pt.Network)})),Fw=e=>e.length===32?e:e.slice(1,33);function jw(e){(0,Uw.testEcc)(e);function t(u){return e.isPoint(u)}function r(u,l){if(Pt.typeforce(Pt.Buffer256bit,u),!e.isPrivate(u))throw new TypeError("Private key not in range [1, n)");return Pt.typeforce(Oa,l),new o(u,void 0,l)}function n(u,l){return Pt.typeforce(e.isPoint,u),Pt.typeforce(Oa,l),new o(void 0,u,l)}function i(u,l){const a=Qd.decode(u),f=a.version;if(Pt.Array(l)){if(l=l.filter(d=>f===d.wif).pop(),!l)throw new Error("Unknown network version")}else if(l=l||Ac.bitcoin,f!==l.wif)throw new Error("Invalid network version");return r(a.privateKey,{compressed:a.compressed,network:l})}function s(u){Pt.typeforce(Oa,u),u===void 0&&(u={});const l=u.rng||Lw;let a;do a=l(32),Pt.typeforce(Pt.Buffer256bit,a);while(!e.isPrivate(a));return r(a,u)}class o{constructor(l,a,f){pe(this,"__D");pe(this,"__Q");pe(this,"compressed");pe(this,"network");pe(this,"lowR");this.__D=l,this.__Q=a,this.lowR=!1,f===void 0&&(f={}),this.compressed=f.compressed===void 0?!0:f.compressed,this.network=f.network||Ac.bitcoin,a!==void 0&&(this.__Q=Buffer.from(e.pointCompress(a,this.compressed)))}get privateKey(){return this.__D}get publicKey(){if(!this.__Q){const l=e.pointFromScalar(this.__D,this.compressed);this.__Q=Buffer.from(l)}return this.__Q}toWIF(){if(!this.__D)throw new Error("Missing private key");return Qd.encode(this.network.wif,this.__D,this.compressed)}tweak(l){return this.privateKey?this.tweakFromPrivateKey(l):this.tweakFromPublicKey(l)}sign(l,a){if(!this.__D)throw new Error("Missing private key");if(a===void 0&&(a=this.lowR),a===!1)return Buffer.from(e.sign(l,this.__D));{let f=e.sign(l,this.__D);const d=Buffer.alloc(32,0);let c=0;for(;f[0]>127;)c++,d.writeUIntLE(c,0,6),f=e.sign(l,this.__D,d);return Buffer.from(f)}}signSchnorr(l){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(l,this.privateKey))}verify(l,a){return e.verify(l,this.publicKey,a)}verifySchnorr(l,a){if(!e.verifySchnorr)throw new Error("verifySchnorr not supported by ecc library");return e.verifySchnorr(l,this.publicKey.subarray(1,33),a)}tweakFromPublicKey(l){const a=Fw(this.publicKey),f=e.xOnlyPointAddTweak(a,l);if(!f||f.xOnlyPubkey===null)throw new Error("Cannot tweak public key!");const d=Buffer.from([f.parity===0?2:3]);return n(Buffer.concat([d,f.xOnlyPubkey]),{network:this.network,compressed:this.compressed})}tweakFromPrivateKey(l){const f=this.publicKey[0]===3||this.publicKey[0]===4&&(this.publicKey[64]&1)===1?e.privateNegate(this.privateKey):this.privateKey,d=e.privateAdd(f,l);if(!d)throw new Error("Invalid tweaked private key!");return r(Buffer.from(d),{network:this.network,compressed:this.compressed})}}return{isPoint:t,fromPrivateKey:r,fromPublicKey:n,fromWIF:i,makeRandom:s}}Nn.ECPairFactory=jw;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.networks=e.ECPairFactory=e.default=void 0;var t=Nn;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}})})($h);class Ys{constructor(t){this.privKey=t}static fromPrivKey(t){return new Ys(Te.trim0x(t))}static async fromWalletClient(t){if(!t.account)return Te.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 Te.Ok(new Ys(Te.trim0x(nr.sha256(r))))}catch(r){return Te.Err("Failed to initialize: "+r)}}getMasterPrivKey(){return this.privKey}generateSecret(t){const r=this.signMessage(t),n=nr.sha256(Sr(r)),i=nr.sha256(n);return Te.Ok({secret:n,secretHash:i})}signMessage(t){const r=$h.ECPairFactory(Cn),n="Garden.fi"+t.toString(),i=Buffer.from(n,"utf8"),s=nr.sha256(i),o=Buffer.from(Te.trim0x(this.privKey),"hex");if(o.length!==32)throw new Error("Invalid private key length. Expected 32 bytes.");return r.fromPrivateKey(o).sign(Buffer.from(Te.trim0x(s),"hex")).toString("hex")}}exports.EvmRelay=dc;exports.Garden=Xy;exports.OrderExecutor=Dh;exports.ParseOrderStatus=Fh;exports.ParseSwapStatus=qs;exports.Quote=Hh;exports.SecretManager=Ys;exports.fetchBitcoinBlockNumber=fc;exports.fetchEVMBlockNumber=js;exports.parseAction=jh;
|
|
21
|
+
`.trim().replace(/\s+/g," "))}leaves(){return[{version:Ft,output:this.redeemLeaf()},[{version:Ft,output:this.refundLeaf()},{version:Ft,output:this.instantRefundLeaf()}]]}generateMerkleProofFor(t){const r=this.leafHash(1),n=this.leafHash(2),o=this.leafHash(0);switch(t){case 1:{const s=Ra(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 La{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 Ma{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 pa,!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},T=await this.quote.getAttestedQuote(x);if(T.error)return P.Err(T.error);const R=await this.orderBook.createOrder(T.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||!Sa(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 Hi(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=zn(c,w.val.source,w.val.destination),T=new La(c,this.store),R=T.get(x);if(console.log("prevResult :",R),R)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 Kn(c,this.orderbookUrl,this.auth),k=this.secretManager.generateSecret(Number(c.create_order.nonce));if(k.error){this.emit("error",c,k.error);return}const O=await E.redeem(c.create_order.create_id,k.val.secret);if(O.error){this.emit("error",c,O.error);return}this.emit("success",c,Re.Redeem,O.val),T.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 Ht.from(g.val,Number(c.destination_swap.amount),c.create_order.secret_hash,Nt(c.destination_swap.initiator),Nt(c.destination_swap.redeemer),c.destination_swap.timelock),k=this.secretManager.generateSecret(Number(c.create_order.nonce));if(k.error){this.emit("error",c,k.error);return}const O=await E.redeem(P.trim0x(k.val.secret),(n=c.create_order.additional_data)==null?void 0:n.bitcoin_optional_recipient);this.emit("success",c,Re.Redeem,O),T.set(x,O)}catch(E){this.emit("error",c,"Failed btc redeem: "+E)}break}case Re.Refund:{try{const k=await(await Ht.from(y.val,Number(c.source_swap.amount),c.create_order.secret_hash,Nt(c.source_swap.initiator),Nt(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,k),T.set(x,k)}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 rn(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 rn(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 Ua(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 Vn={},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 Jn={},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 an in St)St[an].toJSON=(function(e){return e}).bind(null,an);var Hr=St,Qe=Hr;function Yn(e){return e.name||e.toString().match(/function (.*?)\s*\(/)[1]}function jr(e){return Qe.Nil(e)?"":Yn(e.constructor)}function Da(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 jt(e){return Qe.Function(e)?e.toJSON?e.toJSON():Yn(e):Qe.Array(e)?"Array":e&&Qe.Object(e)?"Object":e!==void 0?e:""}function Qn(e,t,r){var n=Da(t);return"Expected "+jt(e)+", got"+(r!==""?" "+r:"")+(n!==""?" "+n:"")}function Me(e,t,r){r=r||jr(t),this.message=Qn(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 $a(e,t,r,n,o){var s='" of type ';return t==="key"&&(s='" with key type '),Qn('property "'+jt(r)+s+jt(e),n,o)}function ft(e,t,r,n,o){e?(o=o||jr(n),this.message=$a(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 Ha(e,t){return new Me(e,{},t)}function ja(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 Xn={TfTypeError:Me,TfPropertyTypeError:ft,tfCustomError:Ha,tfSubError:ja,tfJSON:jt,getValueTypeName:jr},ur,on;function qa(){if(on)return ur;on=1;var e=Hr,t=Xn;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 T(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 k(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:T,Int32:R,Int53:C,Range:y,StringN:p,UInt8:E,UInt16:k,UInt32:O,UInt53:F};for(var L in N)N[L].toJSON=(function(S){return S}).bind(null,L);return ur=N,ur}var Tt=Xn,fe=Hr,Fe=Tt.tfJSON,Zn=Tt.TfTypeError,ei=Tt.TfPropertyTypeError,_t=Tt.tfSubError,Wa=Tt.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 ei(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===Wa(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 Zn(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 sn=qa();for(Ge in sn)ge[Ge]=sn[Ge];ge.compile=Ce;ge.TfTypeError=Zn;ge.TfPropertyTypeError=ei;var Ga=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=Ga,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})(Jn);var Pr={exports:{}},Or={exports:{}},pt={},Vt={};Vt.byteLength=Va;Vt.toByteArray=Ya;Vt.fromByteArray=Za;var Pe=[],Be=[],za=typeof Uint8Array<"u"?Uint8Array:Array,cr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var ot=0,Ka=cr.length;ot<Ka;++ot)Pe[ot]=cr[ot],Be[cr.charCodeAt(ot)]=ot;Be[45]=62;Be[95]=63;function ti(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 Va(e){var t=ti(e),r=t[0],n=t[1];return(r+n)*3/4-n}function Ja(e,t,r){return(t+r)*3/4-r}function Ya(e){var t,r=ti(e),n=r[0],o=r[1],s=new za(Ja(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 Qa(e){return Pe[e>>18&63]+Pe[e>>12&63]+Pe[e>>6&63]+Pe[e&63]}function Xa(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(Qa(n));return o.join("")}function Za(e){for(var t,r=e.length,n=r%3,o=[],s=16383,c=0,u=r-n;c<u;c+=s)o.push(Xa(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,T=e[t+w];for(w+=x,s=T&(1<<-g)-1,T>>=-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:(T?-1:1)*(1/0);c=c+Math.pow(2,n),s=s-y}return(T?-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,T=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+T]=u&255,T+=R,u/=256,o-=8);for(c=c<<o|u,y+=o;y>0;e[r+T]=c&255,T+=R,c/=256,y-=8);e[r+T-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=Vt,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:k(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 T(f){const i=f.length<0?0:k(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 T(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=k(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):T(f);if(f.type==="Buffer"&&Array.isArray(f.data))return T(f.data)}function k(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 ke(this,i,a);case"utf8":case"utf-8":return _e(this,i,a);case"ascii":return Te(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 Te(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 ke(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,eo=4294967295;function to(){throw new Error(`Secure random number generation is not supported by this browser.
|
|
29
|
+
Use Chrome, Firefox or Internet Explorer 11`)}var ro=we.Buffer,qt=ze.crypto||ze.msCrypto;qt&&qt.getRandomValues?Pr.exports=no:Pr.exports=to;function no(e,t){if(e>eo)throw new RangeError("requested too many random bytes");var r=ro.allocUnsafe(e);if(e>0)if(e>lr)for(var n=0;n<e;n+=lr)qt.getRandomValues(r.slice(n,n+lr));else qt.getRandomValues(r);return typeof t=="function"?process.nextTick(function(){t(null,r)}):r}var io=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,fn=ut&&typeof ut.apply=="function"?ut.apply:function(t,r,n){return Function.prototype.apply.call(t,r,n)},Ut;ut&&typeof ut.ownKeys=="function"?Ut=ut.ownKeys:Object.getOwnPropertySymbols?Ut=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Ut=function(t){return Object.getOwnPropertyNames(t)};function ao(e){console&&console.warn&&console.warn(e)}var ri=Number.isNaN||function(t){return t!==t};function K(){K.init.call(this)}Gr.exports=K;Gr.exports.once=uo;K.EventEmitter=K;K.prototype._events=void 0;K.prototype._eventsCount=0;K.prototype._maxListeners=void 0;var un=10;function Jt(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 un},set:function(e){if(typeof e!="number"||e<0||ri(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");un=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||ri(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 ni(e){return e._maxListeners===void 0?K.defaultMaxListeners:e._maxListeners}K.prototype.getMaxListeners=function(){return ni(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")fn(p,this,r);else for(var y=p.length,g=fi(p,y),n=0;n<y;++n)fn(g[n],this,r);return!0};function ii(e,t,r,n){var o,s,c;if(Jt(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=ni(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,ao(u)}return e}K.prototype.addListener=function(t,r){return ii(this,t,r,!1)};K.prototype.on=K.prototype.addListener;K.prototype.prependListener=function(t,r){return ii(this,t,r,!0)};function oo(){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 ai(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=oo.bind(n);return o.listener=r,n.wrapFn=o,o}K.prototype.once=function(t,r){return Jt(r),this.on(t,ai(this,t,r)),this};K.prototype.prependOnceListener=function(t,r){return Jt(r),this.prependListener(t,ai(this,t,r)),this};K.prototype.removeListener=function(t,r){var n,o,s,c,u;if(Jt(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():so(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 oi(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?fo(o):fi(o,o.length)}K.prototype.listeners=function(t){return oi(this,t,!0)};K.prototype.rawListeners=function(t){return oi(this,t,!1)};K.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):si.call(e,t)};K.prototype.listenerCount=si;function si(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?Ut(this._events):[]};function fi(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function so(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function fo(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function uo(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))}ui(e,t,s,{once:!0}),t!=="error"&&co(e,o,{once:!0})})}function co(e,t,r){typeof e.on=="function"&&ui(e,"error",t,r)}function ui(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 ci=Gr.exports,li=ci.EventEmitter;const lo={},ho=Object.freeze(Object.defineProperty({__proto__:null,default:lo},Symbol.toStringTag,{value:"Module"})),zr=Ua(ho);var hr,cn;function po(){if(cn)return hr;cn=1;function e(R,C){var E=Object.keys(R);if(Object.getOwnPropertySymbols){var k=Object.getOwnPropertySymbols(R);C&&(k=k.filter(function(O){return Object.getOwnPropertyDescriptor(R,O).enumerable})),E.push.apply(E,k)}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(k){r(R,k,E[k])}):Object.getOwnPropertyDescriptors?Object.defineProperties(R,Object.getOwnPropertyDescriptors(E)):e(Object(E)).forEach(function(k){Object.defineProperty(R,k,Object.getOwnPropertyDescriptor(E,k))})}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 k=C[E];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(R,c(k.key),k)}}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 k=E.call(R,C||"default");if(typeof k!="object")return k;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 T(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 k={data:E,next:null};this.length>0?this.tail.next=k:this.head=k,this.tail=k,++this.length}},{key:"unshift",value:function(E){var k={data:E,next:this.head};this.length===0&&(this.tail=k),this.head=k,++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 k=this.head,O=""+k.data;k=k.next;)O+=E+k.data;return O}},{key:"concat",value:function(E){if(this.length===0)return y.alloc(0);for(var k=y.allocUnsafe(E>>>0),O=this.head,F=0;O;)T(O.data,k,F),F+=O.data.length,O=O.next;return k}},{key:"consume",value:function(E,k){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=k?this._getString(E):this._getBuffer(E),O}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(E){var k=this.head,O=1,F=k.data;for(E-=F.length;k=k.next;){var N=k.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,k.next?this.head=k.next:this.head=this.tail=null):(this.head=k,k.data=N.slice(L));break}++O}return this.length-=O,F}},{key:"_getBuffer",value:function(E){var k=y.allocUnsafe(E),O=this.head,F=1;for(O.data.copy(k),E-=O.data.length;O=O.next;){var N=O.data,L=E>N.length?N.length:E;if(N.copy(k,k.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,k}},{key:x,value:function(E,k){return w(this,t(t({},k),{},{depth:0,customInspect:!1}))}}]),R}(),hr}function bo(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(Dt,r):(r._writableState.errorEmitted=!0,process.nextTick(ln,r,s)):process.nextTick(ln,r,s):t?(process.nextTick(Dt,r),t(s)):process.nextTick(Dt,r)}),this)}function ln(e,t){Lr(e,t),Dt(e)}function Dt(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function yo(){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 go(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}var hi={destroy:bo,undestroy:yo,errorOrDestroy:go},et={};function _o(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var di={};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){_o(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,di[e]=o}function hn(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 mo(e,t,r){return e.substr(0,t.length)===t}function wo(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function vo(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"&&mo(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";var o;if(wo(e," argument"))o="The ".concat(e," ").concat(n," ").concat(hn(t,"type"));else{var s=vo(e,".")?"property":"argument";o='The "'.concat(e,'" ').concat(s," ").concat(n," ").concat(hn(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=di;var xo=et.codes.ERR_INVALID_OPT_VALUE;function Eo(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function Bo(e,t,r,n){var o=Eo(t,n,r);if(o!=null){if(!(isFinite(o)&&Math.floor(o)===o)||o<0){var s=n?r:"highWaterMark";throw new xo(s,o)}return Math.floor(o)}return e.objectMode?16:16*1024}var pi={getHighWaterMark:Bo},Ro=So;function So(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,dn;function bi(){if(dn)return pr;dn=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:Ro},n=li,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=hi,y=pi,g=y.getHighWaterMark,w=et.codes,x=w.ERR_INVALID_ARG_TYPE,T=w.ERR_METHOD_NOT_IMPLEMENTED,R=w.ERR_MULTIPLE_CALLBACK,C=w.ERR_STREAM_CANNOT_PIPE,E=w.ERR_STREAM_DESTROYED,k=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 k: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&&ke(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&&ke(m,A),$?process.nextTick(Te,m,A,h,q):Te(m,A,h,q)}}function Te(m,_,A,$){A||$e(m,_),_.pendingcb--,$(),ve(m,_)}function $e(m,_){_.length===0&&_.needDrain&&(_.needDrain=!1,m.emit("drain"))}function ke(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 T("_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,pn;function dt(){if(pn)return br;pn=1;var e=Object.keys||function(y){var g=[];for(var w in y)g.push(w);return g};br=c;var t=gi(),r=bi();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 Wt={},Kr=we.Buffer,bn=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 Io(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=Io(e);if(typeof t!="string"&&(Kr.isEncoding===bn||!bn(e)))throw new Error("Unknown encoding: "+e);return t||e}Wt.StringDecoder=kt;function kt(e){this.encoding=To(e);var t;switch(this.encoding){case"utf16le":this.text=No,this.end=Fo,t=4;break;case"utf8":this.fillLast=Co,t=4;break;case"base64":this.text=Lo,this.end=Mo,t=3;break;default:this.write=Uo,this.end=Do;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Kr.allocUnsafe(t)}kt.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||""};kt.prototype.end=Oo;kt.prototype.text=Po;kt.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 ko(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 Ao(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 Co(e){var t=this.lastTotal-this.lastNeed,r=Ao(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 Po(e,t){var r=ko(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 Oo(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t}function No(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 Fo(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 Lo(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 Mo(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function Uo(e){return e.toString(this.encoding)}function Do(e){return e&&e.length?this.write(e):""}var yn=et.codes.ERR_STREAM_PREMATURE_CLOSE;function $o(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 Ho(){}function jo(e){return e.setHeader&&typeof e.abort=="function"}function yi(e,t,r){if(typeof t=="function")return yi(e,null,t);t||(t={}),r=$o(r||Ho);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 yn),r.call(e,R);if(o&&!c)return(!e._writableState||!e._writableState.ended)&&(R=new yn),r.call(e,R)},x=function(){e.req.on("finish",u)};return jo(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=yi,gr,gn;function qo(){if(gn)return gr;gn=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 T(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(T,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(){}),k=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(k,(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,_n;function Wo(){return _n||(_n=1,_r=function(){throw new Error("Readable.from is not available in the browser")}),_r}var mr,mn;function gi(){if(mn)return mr;mn=1,mr=U;var e;U.ReadableState=D,ci.EventEmitter;var t=function(d,I){return d.listeners(I).length},r=li,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=po(),g=hi,w=pi,x=w.getHighWaterMark,T=et.codes,R=T.ERR_INVALID_ARG_TYPE,C=T.ERR_STREAM_PUSH_AFTER_EOF,E=T.ERR_METHOD_NOT_IMPLEMENTED,k=T.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=Wt.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 k):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):ke(h,W)):Ie(h,W,d,!1)}else M||(W.reading=!1,ke(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&&Te(h)),ke(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=Wt.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):Te(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?Te(h):(d.needReadable=!1,d.emittedReadable||(d.emittedReadable=!0,$e(h)))}}function Te(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 ke(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?Te(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=qo()),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=Wo()),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 _i=Ue,Yt=et.codes,Go=Yt.ERR_METHOD_NOT_IMPLEMENTED,zo=Yt.ERR_MULTIPLE_CALLBACK,Ko=Yt.ERR_TRANSFORM_ALREADY_TRANSFORMING,Vo=Yt.ERR_TRANSFORM_WITH_LENGTH_0,Qt=dt();pe(Ue,Qt);function Jo(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new zo);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);Qt.call(this,e),this._transformState={afterTransform:Jo.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",Yo)}function Yo(){var e=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(t,r){wn(e,t,r)}):wn(this,null,null)}Ue.prototype.push=function(e,t){return this._transformState.needTransform=!1,Qt.prototype.push.call(this,e,t)};Ue.prototype._transform=function(e,t,r){r(new Go("_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){Qt.prototype._destroy.call(this,e,function(r){t(r)})};function wn(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new Vo;if(e._transformState.transforming)throw new Ko;return e.push(null)}var Qo=It,mi=_i;pe(It,mi);function It(e){if(!(this instanceof It))return new It(e);mi.call(this,e)}It.prototype._transform=function(e,t,r){r(null,e)};var wr;function Xo(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}var wi=et.codes,Zo=wi.ERR_MISSING_ARGS,es=wi.ERR_STREAM_DESTROYED;function vn(e){if(e)throw e}function ts(e){return e.setHeader&&typeof e.abort=="function"}function rs(e,t,r,n){n=Xo(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,ts(e))return e.abort();if(typeof e.destroy=="function")return e.destroy();n(c||new es("pipe"))}}}function xn(e){e()}function ns(e,t){return e.pipe(t)}function is(e){return!e.length||typeof e[e.length-1]!="function"?vn:e.pop()}function as(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=is(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Zo("streams");var o,s=t.map(function(c,u){var p=u<t.length-1,y=u>0;return rs(c,p,y,function(g){o||(o=g),g&&s.forEach(xn),!p&&(s.forEach(xn),n(o))})});return t.reduce(ns)}var os=as;(function(e,t){t=e.exports=gi(),t.Stream=t,t.Readable=t,t.Writable=bi(),t.Duplex=dt(),t.Transform=_i,t.PassThrough=Qo,t.finished=Vr,t.pipeline=os})(Fr,Fr.exports);var ss=Fr.exports,Gt=we.Buffer,vi=ss.Transform,fs=pe;function us(e,t){if(!Gt.isBuffer(e)&&typeof e!="string")throw new TypeError(t+" must be a string or a buffer")}function Ke(e){vi.call(this),this._block=Gt.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}fs(Ke,vi);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(us(e,"Data"),this._finalized)throw new Error("Digest already called");Gt.isBuffer(e)||(e=Gt.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 xi=Ke,cs=pe,Ei=xi,ls=we.Buffer,hs=new Array(16);function Xt(){Ei.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}cs(Xt,Ei);Xt.prototype._update=function(){for(var e=hs,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};Xt.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=ls.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 Zt(e,t){return e<<t|e>>>32-t}function ue(e,t,r,n,o,s,c){return Zt(e+(t&r|~t&n)+o+s|0,c)+t|0}function ce(e,t,r,n,o,s,c){return Zt(e+(t&n|r&~n)+o+s|0,c)+t|0}function le(e,t,r,n,o,s,c){return Zt(e+(t^r^n)+o+s|0,c)+t|0}function he(e,t,r,n,o,s,c){return Zt(e+(r^(t|~n))+o+s|0,c)+t|0}var ds=Xt,vr=pt.Buffer,ps=pe,Bi=xi,bs=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 er(){Bi.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}ps(er,Bi);er.prototype._update=function(){for(var e=bs,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 T,R;x<16?(T=En(r,n,o,s,c,e[mt[x]],Et[0],vt[x]),R=In(u,p,y,g,w,e[wt[x]],Bt[0],xt[x])):x<32?(T=Bn(r,n,o,s,c,e[mt[x]],Et[1],vt[x]),R=Sn(u,p,y,g,w,e[wt[x]],Bt[1],xt[x])):x<48?(T=Rn(r,n,o,s,c,e[mt[x]],Et[2],vt[x]),R=Rn(u,p,y,g,w,e[wt[x]],Bt[2],xt[x])):x<64?(T=Sn(r,n,o,s,c,e[mt[x]],Et[3],vt[x]),R=Bn(u,p,y,g,w,e[wt[x]],Bt[3],xt[x])):(T=In(r,n,o,s,c,e[mt[x]],Et[4],vt[x]),R=En(u,p,y,g,w,e[wt[x]],Bt[4],xt[x])),r=c,c=s,s=Xe(o,10),o=n,n=T,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};er.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 En(e,t,r,n,o,s,c,u){return Xe(e+(t^r^n)+s+c|0,u)+o|0}function Bn(e,t,r,n,o,s,c,u){return Xe(e+(t&r|~t&n)+s+c|0,u)+o|0}function Rn(e,t,r,n,o,s,c,u){return Xe(e+((t|~r)^n)+s+c|0,u)+o|0}function Sn(e,t,r,n,o,s,c,u){return Xe(e+(t&n|r&~n)+s+c|0,u)+o|0}function In(e,t,r,n,o,s,c,u){return Xe(e+(t^(r|~n))+s+c|0,u)+o|0}var ys=er,Ri={exports:{}},Si=we.Buffer;function tr(e,t){this._block=Si.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}tr.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=Si.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};tr.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};tr.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var bt=tr,gs=pe,Ii=bt,_s=we.Buffer,ms=[1518500249,1859775393,-1894007588,-899497514],ws=new Array(80);function At(){this.init(),this._w=ws,Ii.call(this,64,56)}gs(At,Ii);At.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function vs(e){return e<<5|e>>>27}function xs(e){return e<<30|e>>>2}function Es(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=vs(r)+Es(y,n,o,s)+c+t[p]+ms[y]|0;c=s,s=o,o=xs(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=_s.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 Bs=At,Rs=pe,Ti=bt,Ss=we.Buffer,Is=[1518500249,1859775393,-1894007588,-899497514],Ts=new Array(80);function Ct(){this.init(),this._w=Ts,Ti.call(this,64,56)}Rs(Ct,Ti);Ct.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function ks(e){return e<<1|e>>>31}function As(e){return e<<5|e>>>27}function Cs(e){return e<<30|e>>>2}function Ps(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]=ks(t[u-3]^t[u-8]^t[u-14]^t[u-16]);for(var p=0;p<80;++p){var y=~~(p/20),g=As(r)+Ps(y,n,o,s)+c+t[p]+Is[y]|0;c=s,s=o,o=Cs(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=Ss.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 Os=Ct,Ns=pe,ki=bt,Fs=we.Buffer,Ls=[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],Ms=new Array(64);function Pt(){this.init(),this._w=Ms,ki.call(this,64,56)}Ns(Pt,ki);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 Us(e,t,r){return r^e&(t^r)}function Ds(e,t,r){return e&t|r&(e|t)}function $s(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function Hs(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function js(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function qs(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]=qs(t[g-2])+t[g-7]+js(t[g-15])+t[g-16]|0;for(var w=0;w<64;++w){var x=y+Hs(c)+Us(c,u,p)+Ls[w]+t[w]|0,T=$s(r)+Ds(r,n,o)|0;y=p,p=u,u=c,c=s+x|0,s=o,o=n,n=r,r=x+T|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=Fs.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 Ai=Pt,Ws=pe,Gs=Ai,zs=bt,Ks=we.Buffer,Vs=new Array(64);function rr(){this.init(),this._w=Vs,zs.call(this,64,56)}Ws(rr,Gs);rr.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};rr.prototype._hash=function(){var e=Ks.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 Js=rr,Ys=pe,Ci=bt,Qs=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],Xs=new Array(160);function Ot(){this.init(),this._w=Xs,Ci.call(this,128,112)}Ys(Ot,Ci);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 kn(e,t,r){return r^e&(t^r)}function An(e,t,r){return e&t|r&(e|t)}function Cn(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function Pn(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Zs(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function ef(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function tf(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function rf(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,T=this._dl|0,R=this._el|0,C=this._fl|0,E=this._gl|0,k=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=Zs(F,N),S=ef(N,F);F=t[O-2*2],N=t[O-2*2+1];var j=tf(F,N),D=rf(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=An(r,n,o),Te=An(g,w,x),$e=Cn(r,g),ke=Cn(g,r),He=Pn(c,R),Y=Pn(R,c),ie=Tn[me],ve=Tn[me+1],je=kn(c,u,p),Ne=kn(R,C,E),m=k+Y|0,_=y+He+se(m,k)|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=ke+Te|0,$=$e+Ve+se(A,ke)|0;y=p,k=E,p=u,E=C,u=c,C=R,R=T+m|0,c=s+_+se(R,T)|0,s=o,T=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+T|0,this._el=this._el+R|0,this._fl=this._fl+C|0,this._gl=this._gl+E|0,this._hl=this._hl+k|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,T)|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,k)|0};Ot.prototype._hash=function(){var e=Qs.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 Pi=Ot,nf=pe,af=Pi,of=bt,sf=we.Buffer,ff=new Array(160);function nr(){this.init(),this._w=ff,of.call(this,128,112)}nf(nr,af);nr.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};nr.prototype._hash=function(){var e=sf.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 uf=nr,tt=Ri.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=Bs;tt.sha1=Os;tt.sha224=Js;tt.sha256=Ai;tt.sha384=uf;tt.sha512=Pi;var cf=Ri.exports,Oi=we.Buffer,Ni=zr.Transform,lf=Wt.StringDecoder,hf=pe;function Ae(e){Ni.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}hf(Ae,Ni);Ae.prototype.update=function(e,t,r){typeof e=="string"&&(e=Oi.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()||Oi.alloc(0);return e&&(t=this._toString(t,e,!0)),t};Ae.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new lf(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 df=Ae,pf=pe,bf=ds,yf=ys,gf=cf,Fi=df;function ir(e){Fi.call(this,"digest"),this._hash=e}pf(ir,Fi);ir.prototype._update=function(e){this._hash.update(e)};ir.prototype._final=function(){return this._hash.digest()};var _f=function(t){return t=t.toLowerCase(),t==="md5"?new bf:t==="rmd160"||t==="ripemd160"?new yf:new ir(gf(t))},Lt=we.Buffer;function mf(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(T){if((Array.isArray(T)||T instanceof Uint8Array)&&(T=Lt.from(T)),!Lt.isBuffer(T))throw new TypeError("Expected Buffer");if(T.length===0)return"";for(var R=0,C=0,E=0,k=T.length;E!==k&&T[E]===0;)E++,R++;for(var O=(k-E)*y+1>>>0,F=new Uint8Array(O);E!==k;){for(var N=T[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(T){if(typeof T!="string")throw new TypeError("Expected String");if(T.length===0)return Lt.alloc(0);for(var R=0,C=0,E=0;T[R]===u;)C++,R++;for(var k=(T.length-R)*p+1>>>0,O=new Uint8Array(k);R<T.length;){var F=t[T.charCodeAt(R)];if(F===255)return;for(var N=0,L=k-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=k-E;S!==k&&O[S]===0;)S++;var j=Lt.allocUnsafe(C+(k-S));j.fill(0,0,C);for(var D=C;S!==k;)j[D++]=O[S++];return j}function x(T){var R=w(T);if(R)return R;throw new Error("Non-base"+c+" character")}return{encode:g,decodeUnsafe:w,decode:x}}var wf=mf,vf=wf,xf="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Ef=vf(xf),xr=Ef,Bf=we.Buffer,Rf=function(e){function t(s){var c=e(s);return xr.encode(Bf.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}},On=_f,Sf=Rf;function If(e){var t=On("sha256").update(e).digest();return On("sha256").update(t).digest()}var Tf=Sf(If),Mr=Tf;function Li(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 kf(e,t){return Li(Mr.decode(e),t)}function Af(e,t,r){return typeof e=="number"?Mr.encode(Ur(e,t,r)):Mr.encode(Ur(e.version,e.privateKey,e.compressed))}var Cf={decode:kf,decodeRaw:Li,encode:Af,encodeRaw:Ur},ar={};Object.defineProperty(ar,"__esModule",{value:!0});ar.testEcc=void 0;const H=e=>Buffer.from(e,"hex");function Pf(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")))}ar.testEcc=Pf;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=Jn,Of=io,Nn=Cf,Nf=ar,Er=ye.typeforce.maybe(ye.typeforce.compile({compressed:ye.maybe(ye.Boolean),network:ye.maybe(ye.Network)})),Ff=e=>e.length===32?e:e.slice(1,33);function Lf(e){(0,Nf.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=Nn.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||Of;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 Nn.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=Ff(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=Lf;(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}})})(Vn);class zt{constructor(t){this.privKey=t}static fromPrivKey(t){return new zt(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 zt(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=Vn.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 Mf{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=Kn;exports.Garden=Ma;exports.ParseOrderStatus=Gn;exports.ParseSwapStatus=$t;exports.Quote=Mf;exports.SecretManager=zt;exports.parseAction=zn;exports.switchOrAddNetwork=Ta;
|