@tinycloud/web-sdk 3.12.0-beta.9 โ 3.12.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/README.md +30 -8
- package/dist/adapters/BrowserSessionStorage.d.ts +13 -3
- package/dist/adapters/BrowserWasmBindings.d.ts +2 -0
- package/dist/delegations-issued.cjs +2 -1
- package/dist/delegations-issued.cjs.LICENSE.txt +5 -0
- package/dist/delegations-issued.mjs +2 -1
- package/dist/delegations-issued.mjs.LICENSE.txt +5 -0
- package/dist/delegations-renewal-entry.d.ts +3 -0
- package/dist/delegations-renewal.cjs +2 -0
- package/dist/delegations-renewal.cjs.LICENSE.txt +21 -0
- package/dist/delegations-renewal.mjs +2 -0
- package/dist/delegations-renewal.mjs.LICENSE.txt +21 -0
- package/dist/encryption-keys.cjs +1 -1
- package/dist/encryption-keys.cjs.LICENSE.txt +4 -0
- package/dist/encryption-keys.mjs +1 -1
- package/dist/encryption-keys.mjs.LICENSE.txt +4 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.LICENSE.txt +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.LICENSE.txt +2 -0
- package/dist/modals.cjs +1 -1
- package/dist/modals.mjs +1 -1
- package/dist/modules/Storage/tinycloud/module.d.ts +1 -0
- package/dist/modules/Storage/tinycloud/types.schema.d.ts +10 -10
- package/dist/modules/requestPermissionsCore.d.ts +0 -7
- package/dist/modules/restoreAccount.d.ts +13 -0
- package/dist/modules/runtimeGrantPersistence.d.ts +4 -2
- package/dist/modules/tcw.d.ts +27 -6
- package/dist/panel.cjs +1 -1
- package/dist/panel.mjs +1 -1
- package/dist/registry-verdict-cache-entry.d.ts +2 -0
- package/dist/registry-verdict-cache.cjs +1 -0
- package/dist/registry-verdict-cache.mjs +1 -0
- package/dist/replica.cjs +1 -1
- package/dist/replica.mjs +1 -1
- package/dist/share-placement-core-bridge.d.ts +2 -0
- package/dist/share-placement-core.d.ts +13 -0
- package/dist/share-placement-entry.d.ts +2 -0
- package/dist/share-placement.cjs +2 -0
- package/dist/share-placement.cjs.LICENSE.txt +3 -0
- package/dist/share-placement.mjs +2 -0
- package/dist/share-placement.mjs.LICENSE.txt +3 -0
- package/dist/space-hosting-entry.d.ts +1 -1
- package/dist/space-hosting.cjs +1 -1
- package/dist/space-hosting.mjs +1 -1
- package/dist/ui/pending.d.ts +1 -1
- package/dist/ui/strings.d.ts +2 -0
- package/package.json +7 -7
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see delegations-renewal.cjs.LICENSE.txt */
|
|
2
|
+
(()=>{var e={3725(e){"use strict";!function(){function t(e){return parseInt(e)===e}function r(e){if(!t(e.length))return!1;for(var r=0;r<e.length;r++)if(!t(e[r])||e[r]<0||e[r]>255)return!1;return!0}function n(e,n){if(e.buffer&&ArrayBuffer.isView(e)&&"Uint8Array"===e.name)return n&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!r(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(t(e.length)&&r(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function i(e){return new Uint8Array(e)}function s(e,t,r,n,i){null==n&&null==i||(e=e.slice?e.slice(n,i):Array.prototype.slice.call(e,n,i)),t.set(e,r)}var o,a={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r<e.length;){var i=e.charCodeAt(r++);37===i?(t.push(parseInt(e.substr(r,2),16)),r+=2):t.push(i)}return n(t)},fromBytes:function(e){for(var t=[],r=0;r<e.length;){var n=e[r];n<128?(t.push(String.fromCharCode(n)),r++):n>191&&n<224?(t.push(String.fromCharCode((31&n)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&n)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},c=(o="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r<e.length;r+=2)t.push(parseInt(e.substr(r,2),16));return t},fromBytes:function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];t.push(o[(240&n)>>4]+o[15&n])}return t.join("")}}),u={16:10,24:12,32:14},l=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],h=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],d=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],f=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],p=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],g=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],m=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],y=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],b=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],w=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],v=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],A=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],E=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],x=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],k=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function T(e){for(var t=[],r=0;r<e.length;r+=4)t.push(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]);return t}var S=function(e){if(!(this instanceof S))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:n(e,!0)}),this._prepare()};S.prototype._prepare=function(){var e=u[this.key.length];if(null==e)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var t=0;t<=e;t++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var r,n=4*(e+1),i=this.key.length/4,s=T(this.key);for(t=0;t<i;t++)r=t>>2,this._Ke[r][t%4]=s[t],this._Kd[e-r][t%4]=s[t];for(var o,a=0,c=i;c<n;){if(o=s[i-1],s[0]^=h[o>>16&255]<<24^h[o>>8&255]<<16^h[255&o]<<8^h[o>>24&255]^l[a]<<24,a+=1,8!=i)for(t=1;t<i;t++)s[t]^=s[t-1];else{for(t=1;t<i/2;t++)s[t]^=s[t-1];for(o=s[i/2-1],s[i/2]^=h[255&o]^h[o>>8&255]<<8^h[o>>16&255]<<16^h[o>>24&255]<<24,t=i/2+1;t<i;t++)s[t]^=s[t-1]}for(t=0;t<i&&c<n;)d=c>>2,f=c%4,this._Ke[d][f]=s[t],this._Kd[e-d][f]=s[t++],c++}for(var d=1;d<e;d++)for(var f=0;f<4;f++)o=this._Kd[d][f],this._Kd[d][f]=A[o>>24&255]^E[o>>16&255]^x[o>>8&255]^k[255&o]},S.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],n=T(e),s=0;s<4;s++)n[s]^=this._Ke[0][s];for(var o=1;o<t;o++){for(s=0;s<4;s++)r[s]=f[n[s]>>24&255]^p[n[(s+1)%4]>>16&255]^g[n[(s+2)%4]>>8&255]^m[255&n[(s+3)%4]]^this._Ke[o][s];n=r.slice()}var a,c=i(16);for(s=0;s<4;s++)a=this._Ke[t][s],c[4*s]=255&(h[n[s]>>24&255]^a>>24),c[4*s+1]=255&(h[n[(s+1)%4]>>16&255]^a>>16),c[4*s+2]=255&(h[n[(s+2)%4]>>8&255]^a>>8),c[4*s+3]=255&(h[255&n[(s+3)%4]]^a);return c},S.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],n=T(e),s=0;s<4;s++)n[s]^=this._Kd[0][s];for(var o=1;o<t;o++){for(s=0;s<4;s++)r[s]=y[n[s]>>24&255]^b[n[(s+3)%4]>>16&255]^w[n[(s+2)%4]>>8&255]^v[255&n[(s+1)%4]]^this._Kd[o][s];n=r.slice()}var a,c=i(16);for(s=0;s<4;s++)a=this._Kd[t][s],c[4*s]=255&(d[n[s]>>24&255]^a>>24),c[4*s+1]=255&(d[n[(s+3)%4]>>16&255]^a>>16),c[4*s+2]=255&(d[n[(s+2)%4]>>8&255]^a>>8),c[4*s+3]=255&(d[255&n[(s+1)%4]]^a);return c};var I=function(e){if(!(this instanceof I))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new S(e)};I.prototype.encrypt=function(e){if((e=n(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=i(e.length),r=i(16),o=0;o<e.length;o+=16)s(e,r,0,o,o+16),s(r=this._aes.encrypt(r),t,o);return t},I.prototype.decrypt=function(e){if((e=n(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=i(e.length),r=i(16),o=0;o<e.length;o+=16)s(e,r,0,o,o+16),s(r=this._aes.decrypt(r),t,o);return t};var C=function(e,t){if(!(this instanceof C))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=i(16);this._lastCipherblock=n(t,!0),this._aes=new S(e)};C.prototype.encrypt=function(e){if((e=n(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=i(e.length),r=i(16),o=0;o<e.length;o+=16){s(e,r,0,o,o+16);for(var a=0;a<16;a++)r[a]^=this._lastCipherblock[a];this._lastCipherblock=this._aes.encrypt(r),s(this._lastCipherblock,t,o)}return t},C.prototype.decrypt=function(e){if((e=n(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=i(e.length),r=i(16),o=0;o<e.length;o+=16){s(e,r,0,o,o+16),r=this._aes.decrypt(r);for(var a=0;a<16;a++)t[o+a]=r[a]^this._lastCipherblock[a];s(e,this._lastCipherblock,0,o,o+16)}return t};var B=function(e,t,r){if(!(this instanceof B))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 size)")}else t=i(16);r||(r=1),this.segmentSize=r,this._shiftRegister=n(t,!0),this._aes=new S(e)};B.prototype.encrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var t,r=n(e,!0),i=0;i<r.length;i+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var o=0;o<this.segmentSize;o++)r[i+o]^=t[o];s(this._shiftRegister,this._shiftRegister,0,this.segmentSize),s(r,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return r},B.prototype.decrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var t,r=n(e,!0),i=0;i<r.length;i+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var o=0;o<this.segmentSize;o++)r[i+o]^=t[o];s(this._shiftRegister,this._shiftRegister,0,this.segmentSize),s(e,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return r};var N=function(e,t){if(!(this instanceof N))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=i(16);this._lastPrecipher=n(t,!0),this._lastPrecipherIndex=16,this._aes=new S(e)};N.prototype.encrypt=function(e){for(var t=n(e,!0),r=0;r<t.length;r++)16===this._lastPrecipherIndex&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),t[r]^=this._lastPrecipher[this._lastPrecipherIndex++];return t},N.prototype.decrypt=N.prototype.encrypt;var _=function(e){if(!(this instanceof _))throw Error("Counter must be instanitated with `new`");0===e||e||(e=1),"number"==typeof e?(this._counter=i(16),this.setValue(e)):this.setBytes(e)};_.prototype.setValue=function(e){if("number"!=typeof e||parseInt(e)!=e)throw new Error("invalid counter value (must be an integer)");for(var t=15;t>=0;--t)this._counter[t]=e%256,e>>=8},_.prototype.setBytes=function(e){if(16!=(e=n(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},_.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var M=function(e,t){if(!(this instanceof M))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof _||(t=new _(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new S(e)};M.prototype.encrypt=function(e){for(var t=n(e,!0),r=0;r<t.length;r++)16===this._remainingCounterIndex&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),t[r]^=this._remainingCounter[this._remainingCounterIndex++];return t},M.prototype.decrypt=M.prototype.encrypt;var R={AES:S,Counter:_,ModeOfOperation:{ecb:I,cbc:C,cfb:B,ofb:N,ctr:M},utils:{hex:c,utf8:a},padding:{pkcs7:{pad:function(e){var t=16-(e=n(e,!0)).length%16,r=i(e.length+t);s(e,r);for(var o=e.length;o<r.length;o++)r[o]=t;return r},strip:function(e){if((e=n(e,!0)).length<16)throw new Error("PKCS#7 invalid length");var t=e[e.length-1];if(t>16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,o=0;o<t;o++)if(e[r+o]!==t)throw new Error("PKCS#7 invalid padding byte");var a=i(r);return s(e,a,0,0,r),a}}},_arrayTest:{coerceArray:n,createArray:i,copyArray:s}};e.exports=R}()},8748(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isUri=t.ParsedMessage=void 0;const i=r(9851),s=r(8651),o=n(r(4202)),a=new i.grammar;t.ParsedMessage=class{constructor(e){const t=new o.default.parser;t.callbacks["sign-in-with-ethereum"]=s.cb.signInWithEtherium,t.callbacks.oscheme=s.cb.oscheme,t.callbacks.domain=s.cb.domain,t.callbacks.LF=s.cb.lineno,t.callbacks["ex-title"]=s.cb.exTitle,t.callbacks["nb-title"]=s.cb.nbTitle,t.callbacks["ri-title"]=s.cb.riTitle,t.callbacks["re-title"]=s.cb.reTitle,t.callbacks.address=s.cb.address,t.callbacks.statement=s.cb.statement,t.callbacks["empty-statement"]=s.cb.emptyStatement,t.callbacks.version=s.cb.version,t.callbacks["chain-id"]=s.cb.chainId,t.callbacks.nonce=s.cb.nonce,t.callbacks["issued-at"]=s.cb.issuedAt,t.callbacks["expiration-time"]=s.cb.expirationTime,t.callbacks["not-before"]=s.cb.notBefore,t.callbacks["request-id"]=s.cb.requestId,t.callbacks.uri=s.cb.uri,t.callbacks["uri-r"]=s.cb.uriR,t.callbacks.resource=s.cb.resource,t.callbacks.scheme=s.cb.scheme,t.callbacks["userinfo-at"]=s.cb.userinfo,t.callbacks.host=s.cb.host,t.callbacks["IP-literal"]=s.cb.ipLiteral,t.callbacks.port=s.cb.port,t.callbacks["path-abempty"]=s.cb.pathAbempty,t.callbacks["path-absolute"]=s.cb.pathAbsolute,t.callbacks["path-rootless"]=s.cb.pathRootless,t.callbacks["path-empty"]=s.cb.pathEmpty,t.callbacks.query=s.cb.query,t.callbacks.fragment=s.cb.fragment,t.callbacks.IPv4address=s.cb.ipv4,t.callbacks.nodcolon=s.cb.nodcolon,t.callbacks.dcolon=s.cb.dcolon,t.callbacks.h16=s.cb.h16,t.callbacks.h16c=s.cb.h16,t.callbacks.h16n=s.cb.h16,t.callbacks.h16cn=s.cb.h16,t.callbacks["dec-octet"]=s.cb.decOctet,t.callbacks["dec-digit"]=s.cb.decDigit;const r={errors:[],lineno:1,scheme:void 0,domain:void 0,address:void 0,statement:void 0,uri:void 0,version:void 0,chainId:void 0,nonce:void 0,issuedAt:void 0,expirationTime:void 0,notBefore:void 0,requestId:void 0,resources:void 0,uriElements:{scheme:void 0,userinfo:void 0,host:void 0,port:void 0,path:void 0,query:void 0,fragment:void 0}},n=t.parse(a,0,e,r);let i="";for(let e=0;e<r.errors.length;e+=1)i+=r.errors[e]+"\n";if(n.success||(i+=`Invalid message: ${JSON.stringify(n)}`),""!==i)throw new Error(i);this.scheme=r.scheme,this.domain=r.domain,this.address=r.address,this.statement=r.statement,this.uri=r.uri,this.version=r.version,this.chainId=r.chainId,this.nonce=r.nonce,this.issuedAt=r.issuedAt,this.expirationTime=r.expirationTime,this.notBefore=r.notBefore,this.requestId=r.requestId,this.resources=r.resources,this.uriElements=r.uriElements}},t.isUri=e=>{const t=new o.default.parser;return t.callbacks["IP-literal"]=s.cb.ipLiteral,t.callbacks.IPv4address=s.cb.ipv4,t.callbacks.nodcolon=s.cb.nodcolon,t.callbacks.dcolon=s.cb.dcolon,t.callbacks.h16=s.cb.h16,t.callbacks.h16c=s.cb.h16,t.callbacks.h16n=s.cb.h16,t.callbacks.h16cn=s.cb.h16,t.callbacks["dec-octet"]=s.cb.decOctet,t.callbacks["dec-digit"]=s.cb.decDigit,t.parse(a,"uri-r",e,{errors:[]}).success}},8651(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.cb=void 0;const i=n(r(4202)),s=i.default.utils,o=i.default.ids,a=r(2626),c=/^(?<date>[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]))[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(.[0-9]+)?(([Zz])|([+|-]([01][0-9]|2[0-3]):[0-5][0-9]))$/,u=e=>{const t=c.exec(e);if(!t)return!1;const r=new Date(t.groups.date).toISOString(),n=c.exec(r);return t.groups.date===n.groups.date};t.cb={signInWithEtherium:function(e,t,r,n){switch(e.state){case o.ACTIVE:if("object"!=typeof n||null===n)throw new Error("data must be an object");break;case o.NOMATCH:n.errors.push(`invalid message: max line number was ${n.lineno}`)}},lineno:function(e,t,r,n){e.state===o.MATCH&&(n.lineno+=1)},exTitle:function(e,t,r,n){e.state===o.NOMATCH&&(n.lineno-=1)},nbTitle:function(e,t,r,n){e.state===o.NOMATCH&&(n.lineno-=1)},riTitle:function(e,t,r,n){e.state===o.NOMATCH&&(n.lineno-=1)},reTitle:function(e,t,r,n){e.state===o.MATCH?n.resources=[]:e.state===o.NOMATCH&&(n.lineno-=1)},oscheme:function(e,t,r,n){e.state===o.MATCH&&(n.scheme=s.charsToString(t,r,e.phraseLength-3))},domain:function(e,t,r,n){switch(e.state){case o.MATCH:n.domain=s.charsToString(t,r,e.phraseLength);break;case o.EMPTY:n.errors.push(`line ${n.lineno}: domain cannot be empty`);break;case o.NOMATCH:n.errors.push(`line ${n.lineno}: invalid domain`)}},address:function(e,t,r,n){switch(e.state){case o.MATCH:n.address=s.charsToString(t,r,e.phraseLength),(0,a.isEIP55Address)(n.address)||n.errors.push(`line ${n.lineno}: invalid EIP-55 address - ${n.address}`);break;case o.NOMATCH:n.errors.push(`line ${n.lineno}: invalid address`)}},statement:function(e,t,r,n){e.state===o.MATCH&&(n.statement=s.charsToString(t,r,e.phraseLength))},emptyStatement:function(e,t,r,n){e.state===o.MATCH&&(n.statement="")},version:function(e,t,r,n){switch(e.state){case o.MATCH:n.version=s.charsToString(t,r,e.phraseLength);break;case o.NOMATCH:n.errors.push(`line ${n.lineno}: invalid version`)}},nonce:function(e,t,r,n){switch(e.state){case o.MATCH:n.nonce=s.charsToString(t,r,e.phraseLength);break;case o.NOMATCH:n.errors.push(`line ${n.lineno}: invalid nonce`)}},issuedAt:function(e,t,r,n){switch(e.state){case o.MATCH:n.issuedAt=s.charsToString(t,r,e.phraseLength),u(n.issuedAt)||n.errors.push(`line ${n.lineno}: invalid issued-at date time semantics`);break;case o.NOMATCH:n.errors.push(`line ${n.lineno}: invalid issued-at date time syntax`)}},expirationTime:function(e,t,r,n){switch(e.state){case o.MATCH:n.expirationTime=s.charsToString(t,r,e.phraseLength),u(n.expirationTime)||n.errors.push(`line ${n.lineno}: invalid expiration-time date time semantics`);break;case o.NOMATCH:n.errors.push(`line ${n.lineno}: invalid expiration-time date time syntax`)}},notBefore:function(e,t,r,n){switch(e.state){case o.MATCH:n.notBefore=s.charsToString(t,r,e.phraseLength),u(n.notBefore)||n.errors.push(`line ${n.lineno}: invalid not-before date time semantics`);break;case o.NOMATCH:n.errors.push(`line ${n.lineno}: invalid not-before date time syntax`)}},requestId:function(e,t,r,n){switch(e.state){case o.MATCH:n.requestId=s.charsToString(t,r,e.phraseLength);break;case o.EMPTY:n.requestId="";break;case o.NOMATCH:n.errors.push(`line ${n.lineno}: invalid requestID`)}},chainId:function(e,t,r,n){switch(e.state){case o.MATCH:n.chainId=(0,a.parseIntegerNumber)(s.charsToString(t,r,e.phraseLength));break;case o.NOMATCH:n.errors.push(`line ${n.lineno}: invalid chain-id`)}},uriR:function(e,t,r,n){switch(e.state){case o.MATCH:n.uriR=s.charsToString(t,r,e.phraseLength);break;case o.NOMATCH:n.errors.push(`line ${n.lineno}: invalid resource URI`)}},resource:function(e,t,r,n){switch(e.state){case o.MATCH:n.resources.push(n.uriR),delete n.uriR;break;case o.NOMATCH:n.errors.push(`line ${n.lineno}: invalid resource`)}},scheme:function(e,t,r,n){switch(e.state){case o.MATCH:n.uriElements.scheme=s.charsToString(t,r,e.phraseLength);break;case o.NOMATCH:n.errors.push(`line ${n.lineno}: invalid URI scheme`)}},userinfo:function(e,t,r,n){e.state===o.MATCH&&(n.uriElements.userinfo=s.charsToString(t,r,e.phraseLength-1))},host:function(e,t,r,n){switch(e.state){case o.ACTIVE:n.iplit=!1;break;case o.MATCH:n.iplit?n.uriElements.host=s.charsToString(t,r+1,e.phraseLength-2):n.uriElements.host=s.charsToString(t,r,e.phraseLength);break;case o.EMPTY:n.uriElements.host="";break;case o.NOMATCH:n.errors.push(`line ${n.lineno}: invalid URI host`)}},ipLiteral:function(e,t,r,n){e.state===o.MATCH&&(n.iplit=!0)},port:function(e,t,r,n){switch(e.state){case o.MATCH:n.uriElements.port=(0,a.parseIntegerNumber)(s.charsToString(t,r,e.phraseLength));break;case o.EMPTY:n.uriElements.port="";break;case o.NOMATCH:n.errors.push(`line ${n.lineno}: invalid URI port`)}},pathAbempty:function(e,t,r,n){switch(e.state){case o.MATCH:n.uriElements.path=s.charsToString(t,r,e.phraseLength);break;case o.EMPTY:n.uriElements.path="";break;case o.NOMATCH:n.errors.push(`line ${n.lineno}: invalid URI path-abempty`)}},pathAbsolute:function(e,t,r,n){e.state===o.MATCH&&(n.uriElements.path=s.charsToString(t,r,e.phraseLength))},pathRootless:function(e,t,r,n){e.state===o.MATCH&&(n.uriElements.path=s.charsToString(t,r,e.phraseLength))},pathEmpty:function(e,t,r,n){switch(e.state){case o.MATCH:case o.NOMATCH:n.errors.push(`line ${n.lineno}: invalid URI - path-empty must be empty`);break;case o.EMPTY:n.uriElements.path=""}},query:function(e,t,r,n){switch(e.state){case o.MATCH:n.uriElements.query=s.charsToString(t,r,e.phraseLength);break;case o.EMPTY:n.uriElements.query="";break;case o.NOMATCH:n.errors.push(`line ${n.lineno}: invalid URI query`)}},fragment:function(e,t,r,n){switch(e.state){case o.MATCH:n.uriElements.fragment=s.charsToString(t,r,e.phraseLength);break;case o.EMPTY:n.uriElements.fragment="";break;case o.NOMATCH:n.errors.push(`line ${n.lineno}: invalid URI fragment`)}},uri:function(e,t,r,n){switch(e.state){case o.MATCH:n.uri=s.charsToString(t,r,e.phraseLength);break;case o.EMPTY:case o.NOMATCH:n.errors.push(`line ${n.lineno}: invalid URI`)}},ipv4:function(e,t,r,n){e.state===o.MATCH&&(n.ipv4=!0)},h16:function(e,t,r,n){e.state===o.MATCH&&(n.h16count+=1)},nodcolon:function(e,t,r,n){switch(e.state){case o.ACTIVE:n.h16count=0,n.ipv4=!1;break;case o.MATCH:n.ipv4?6===n.h16count?e.state=o.MATCH:(e.state=o.NOMATCH,e.phraseLength=0):8===n.h16count?e.state=o.MATCH:(e.state=o.NOMATCH,e.phraseLength=0)}},dcolon:function(e,t,r,n){switch(e.state){case o.ACTIVE:n.h16count=0,n.ipv4=!1;break;case o.MATCH:n.ipv4?n.h16count<6?e.state=o.MATCH:(e.state=o.NOMATCH,e.phraseLength=0):n.h16count<8?e.state=o.MATCH:(e.state=o.NOMATCH,e.phraseLength=0)}},decOctet:function(e,t,r,n){switch(e.state){case o.ACTIVE:n.octet=0;break;case o.MATCH:n.octet>255?(e.state=o.NOMATCH,e.phraseLength=0):e.state=o.MATCH}},decDigit:function(e,t,r,n){e.state===o.MATCH&&(n.octet=10*n.octet+t[r]-48)}}},2311(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.isUri=t.ParsedMessage=void 0;const s=r(8748);Object.defineProperty(t,"ParsedMessage",{enumerable:!0,get:function(){return s.ParsedMessage}});const o=r(8748);Object.defineProperty(t,"isUri",{enumerable:!0,get:function(){return o.isUri}}),i(r(2626),t)},9851(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.grammar=void 0,t.grammar=function(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"sign-in-with-ethereum",lower:"sign-in-with-ethereum",index:0,isBkr:!1},this.rules[1]={name:"ex-title",lower:"ex-title",index:1,isBkr:!1},this.rules[2]={name:"nb-title",lower:"nb-title",index:2,isBkr:!1},this.rules[3]={name:"ri-title",lower:"ri-title",index:3,isBkr:!1},this.rules[4]={name:"re-title",lower:"re-title",index:4,isBkr:!1},this.rules[5]={name:"oscheme",lower:"oscheme",index:5,isBkr:!1},this.rules[6]={name:"domain",lower:"domain",index:6,isBkr:!1},this.rules[7]={name:"address",lower:"address",index:7,isBkr:!1},this.rules[8]={name:"statement",lower:"statement",index:8,isBkr:!1},this.rules[9]={name:"empty-statement",lower:"empty-statement",index:9,isBkr:!1},this.rules[10]={name:"version",lower:"version",index:10,isBkr:!1},this.rules[11]={name:"nonce",lower:"nonce",index:11,isBkr:!1},this.rules[12]={name:"issued-at",lower:"issued-at",index:12,isBkr:!1},this.rules[13]={name:"expiration-time",lower:"expiration-time",index:13,isBkr:!1},this.rules[14]={name:"not-before",lower:"not-before",index:14,isBkr:!1},this.rules[15]={name:"request-id",lower:"request-id",index:15,isBkr:!1},this.rules[16]={name:"chain-id",lower:"chain-id",index:16,isBkr:!1},this.rules[17]={name:"resources",lower:"resources",index:17,isBkr:!1},this.rules[18]={name:"resource",lower:"resource",index:18,isBkr:!1},this.rules[19]={name:"URI",lower:"uri",index:19,isBkr:!1},this.rules[20]={name:"hier-part",lower:"hier-part",index:20,isBkr:!1},this.rules[21]={name:"scheme",lower:"scheme",index:21,isBkr:!1},this.rules[22]={name:"authority",lower:"authority",index:22,isBkr:!1},this.rules[23]={name:"path-abempty",lower:"path-abempty",index:23,isBkr:!1},this.rules[24]={name:"path-absolute",lower:"path-absolute",index:24,isBkr:!1},this.rules[25]={name:"path-rootless",lower:"path-rootless",index:25,isBkr:!1},this.rules[26]={name:"path-empty",lower:"path-empty",index:26,isBkr:!1},this.rules[27]={name:"userinfo-at",lower:"userinfo-at",index:27,isBkr:!1},this.rules[28]={name:"userinfo",lower:"userinfo",index:28,isBkr:!1},this.rules[29]={name:"host",lower:"host",index:29,isBkr:!1},this.rules[30]={name:"IP-literal",lower:"ip-literal",index:30,isBkr:!1},this.rules[31]={name:"IPvFuture",lower:"ipvfuture",index:31,isBkr:!1},this.rules[32]={name:"IPv6address",lower:"ipv6address",index:32,isBkr:!1},this.rules[33]={name:"nodcolon",lower:"nodcolon",index:33,isBkr:!1},this.rules[34]={name:"dcolon",lower:"dcolon",index:34,isBkr:!1},this.rules[35]={name:"h16",lower:"h16",index:35,isBkr:!1},this.rules[36]={name:"h16c",lower:"h16c",index:36,isBkr:!1},this.rules[37]={name:"h16n",lower:"h16n",index:37,isBkr:!1},this.rules[38]={name:"h16cn",lower:"h16cn",index:38,isBkr:!1},this.rules[39]={name:"IPv4address",lower:"ipv4address",index:39,isBkr:!1},this.rules[40]={name:"dec-octet",lower:"dec-octet",index:40,isBkr:!1},this.rules[41]={name:"dec-digit",lower:"dec-digit",index:41,isBkr:!1},this.rules[42]={name:"reg-name",lower:"reg-name",index:42,isBkr:!1},this.rules[43]={name:"reg-name-char",lower:"reg-name-char",index:43,isBkr:!1},this.rules[44]={name:"port",lower:"port",index:44,isBkr:!1},this.rules[45]={name:"query",lower:"query",index:45,isBkr:!1},this.rules[46]={name:"fragment",lower:"fragment",index:46,isBkr:!1},this.rules[47]={name:"URI-r",lower:"uri-r",index:47,isBkr:!1},this.rules[48]={name:"hier-part-r",lower:"hier-part-r",index:48,isBkr:!1},this.rules[49]={name:"scheme-r",lower:"scheme-r",index:49,isBkr:!1},this.rules[50]={name:"query-r",lower:"query-r",index:50,isBkr:!1},this.rules[51]={name:"fragment-r",lower:"fragment-r",index:51,isBkr:!1},this.rules[52]={name:"authority-d",lower:"authority-d",index:52,isBkr:!1},this.rules[53]={name:"userinfo-d",lower:"userinfo-d",index:53,isBkr:!1},this.rules[54]={name:"host-d",lower:"host-d",index:54,isBkr:!1},this.rules[55]={name:"port-d",lower:"port-d",index:55,isBkr:!1},this.rules[56]={name:"path-abempty-r",lower:"path-abempty-r",index:56,isBkr:!1},this.rules[57]={name:"path-absolute-r",lower:"path-absolute-r",index:57,isBkr:!1},this.rules[58]={name:"path-rootless-r",lower:"path-rootless-r",index:58,isBkr:!1},this.rules[59]={name:"path-empty-r",lower:"path-empty-r",index:59,isBkr:!1},this.rules[60]={name:"segment",lower:"segment",index:60,isBkr:!1},this.rules[61]={name:"segment-nz",lower:"segment-nz",index:61,isBkr:!1},this.rules[62]={name:"pchar",lower:"pchar",index:62,isBkr:!1},this.rules[63]={name:"pct-encoded",lower:"pct-encoded",index:63,isBkr:!1},this.rules[64]={name:"date-fullyear",lower:"date-fullyear",index:64,isBkr:!1},this.rules[65]={name:"date-month",lower:"date-month",index:65,isBkr:!1},this.rules[66]={name:"date-mday",lower:"date-mday",index:66,isBkr:!1},this.rules[67]={name:"time-hour",lower:"time-hour",index:67,isBkr:!1},this.rules[68]={name:"time-minute",lower:"time-minute",index:68,isBkr:!1},this.rules[69]={name:"time-second",lower:"time-second",index:69,isBkr:!1},this.rules[70]={name:"time-secfrac",lower:"time-secfrac",index:70,isBkr:!1},this.rules[71]={name:"time-numoffset",lower:"time-numoffset",index:71,isBkr:!1},this.rules[72]={name:"time-offset",lower:"time-offset",index:72,isBkr:!1},this.rules[73]={name:"partial-time",lower:"partial-time",index:73,isBkr:!1},this.rules[74]={name:"full-date",lower:"full-date",index:74,isBkr:!1},this.rules[75]={name:"full-time",lower:"full-time",index:75,isBkr:!1},this.rules[76]={name:"date-time",lower:"date-time",index:76,isBkr:!1},this.rules[77]={name:"ALPHA",lower:"alpha",index:77,isBkr:!1},this.rules[78]={name:"LF",lower:"lf",index:78,isBkr:!1},this.rules[79]={name:"DIGIT",lower:"digit",index:79,isBkr:!1},this.rules[80]={name:"HEXDIG",lower:"hexdig",index:80,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:2,children:[1,2,3,4,5,6,7,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,36,41,46]},this.rules[0].opcodes[1]={type:4,index:5},this.rules[0].opcodes[2]={type:4,index:6},this.rules[0].opcodes[3]={type:6,string:[32,119,97,110,116,115,32,121,111,117,32,116,111,32,115,105,103,110,32,105,110,32,119,105,116,104,32,121,111,117,114,32,69,116,104,101,114,101,117,109,32,97,99,99,111,117,110,116,58]},this.rules[0].opcodes[4]={type:4,index:78},this.rules[0].opcodes[5]={type:4,index:7},this.rules[0].opcodes[6]={type:4,index:78},this.rules[0].opcodes[7]={type:1,children:[8,13,14]},this.rules[0].opcodes[8]={type:2,children:[9,10,11,12]},this.rules[0].opcodes[9]={type:4,index:78},this.rules[0].opcodes[10]={type:4,index:8},this.rules[0].opcodes[11]={type:4,index:78},this.rules[0].opcodes[12]={type:4,index:78},this.rules[0].opcodes[13]={type:4,index:9},this.rules[0].opcodes[14]={type:2,children:[15,16]},this.rules[0].opcodes[15]={type:4,index:78},this.rules[0].opcodes[16]={type:4,index:78},this.rules[0].opcodes[17]={type:6,string:[85,82,73,58,32]},this.rules[0].opcodes[18]={type:4,index:19},this.rules[0].opcodes[19]={type:4,index:78},this.rules[0].opcodes[20]={type:6,string:[86,101,114,115,105,111,110,58,32]},this.rules[0].opcodes[21]={type:4,index:10},this.rules[0].opcodes[22]={type:4,index:78},this.rules[0].opcodes[23]={type:6,string:[67,104,97,105,110,32,73,68,58,32]},this.rules[0].opcodes[24]={type:4,index:16},this.rules[0].opcodes[25]={type:4,index:78},this.rules[0].opcodes[26]={type:6,string:[78,111,110,99,101,58,32]},this.rules[0].opcodes[27]={type:4,index:11},this.rules[0].opcodes[28]={type:4,index:78},this.rules[0].opcodes[29]={type:6,string:[73,115,115,117,101,100,32,65,116,58,32]},this.rules[0].opcodes[30]={type:4,index:12},this.rules[0].opcodes[31]={type:3,min:0,max:1},this.rules[0].opcodes[32]={type:2,children:[33,34,35]},this.rules[0].opcodes[33]={type:4,index:78},this.rules[0].opcodes[34]={type:4,index:1},this.rules[0].opcodes[35]={type:4,index:13},this.rules[0].opcodes[36]={type:3,min:0,max:1},this.rules[0].opcodes[37]={type:2,children:[38,39,40]},this.rules[0].opcodes[38]={type:4,index:78},this.rules[0].opcodes[39]={type:4,index:2},this.rules[0].opcodes[40]={type:4,index:14},this.rules[0].opcodes[41]={type:3,min:0,max:1},this.rules[0].opcodes[42]={type:2,children:[43,44,45]},this.rules[0].opcodes[43]={type:4,index:78},this.rules[0].opcodes[44]={type:4,index:3},this.rules[0].opcodes[45]={type:4,index:15},this.rules[0].opcodes[46]={type:3,min:0,max:1},this.rules[0].opcodes[47]={type:2,children:[48,49,50]},this.rules[0].opcodes[48]={type:4,index:78},this.rules[0].opcodes[49]={type:4,index:4},this.rules[0].opcodes[50]={type:4,index:17},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:6,string:[69,120,112,105,114,97,116,105,111,110,32,84,105,109,101,58,32]},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:6,string:[78,111,116,32,66,101,102,111,114,101,58,32]},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:6,string:[82,101,113,117,101,115,116,32,73,68,58,32]},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:6,string:[82,101,115,111,117,114,99,101,115,58]},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:3,min:0,max:1},this.rules[5].opcodes[1]={type:2,children:[2,3,9]},this.rules[5].opcodes[2]={type:4,index:77},this.rules[5].opcodes[3]={type:3,min:0,max:1/0},this.rules[5].opcodes[4]={type:1,children:[5,6,7,8]},this.rules[5].opcodes[5]={type:4,index:77},this.rules[5].opcodes[6]={type:4,index:79},this.rules[5].opcodes[7]={type:6,string:[43]},this.rules[5].opcodes[8]={type:5,min:45,max:46},this.rules[5].opcodes[9]={type:7,string:[58,47,47]},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:4,index:52},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:2,children:[1,2]},this.rules[7].opcodes[1]={type:7,string:[48,120]},this.rules[7].opcodes[2]={type:3,min:40,max:40},this.rules[7].opcodes[3]={type:4,index:80},this.rules[8].opcodes=[],this.rules[8].opcodes[0]={type:3,min:1,max:1/0},this.rules[8].opcodes[1]={type:1,children:[2,3,4,5,6,7,8,9,10,11,12,13]},this.rules[8].opcodes[2]={type:5,min:97,max:122},this.rules[8].opcodes[3]={type:5,min:65,max:90},this.rules[8].opcodes[4]={type:5,min:48,max:57},this.rules[8].opcodes[5]={type:5,min:32,max:33},this.rules[8].opcodes[6]={type:5,min:35,max:36},this.rules[8].opcodes[7]={type:5,min:38,max:59},this.rules[8].opcodes[8]={type:6,string:[61]},this.rules[8].opcodes[9]={type:5,min:63,max:64},this.rules[8].opcodes[10]={type:6,string:[91]},this.rules[8].opcodes[11]={type:6,string:[93]},this.rules[8].opcodes[12]={type:6,string:[95]},this.rules[8].opcodes[13]={type:6,string:[126]},this.rules[9].opcodes=[],this.rules[9].opcodes[0]={type:2,children:[1,2,3]},this.rules[9].opcodes[1]={type:4,index:78},this.rules[9].opcodes[2]={type:4,index:78},this.rules[9].opcodes[3]={type:4,index:78},this.rules[10].opcodes=[],this.rules[10].opcodes[0]={type:7,string:[49]},this.rules[11].opcodes=[],this.rules[11].opcodes[0]={type:3,min:8,max:1/0},this.rules[11].opcodes[1]={type:1,children:[2,3]},this.rules[11].opcodes[2]={type:4,index:77},this.rules[11].opcodes[3]={type:4,index:79},this.rules[12].opcodes=[],this.rules[12].opcodes[0]={type:4,index:76},this.rules[13].opcodes=[],this.rules[13].opcodes[0]={type:4,index:76},this.rules[14].opcodes=[],this.rules[14].opcodes[0]={type:4,index:76},this.rules[15].opcodes=[],this.rules[15].opcodes[0]={type:3,min:0,max:1/0},this.rules[15].opcodes[1]={type:4,index:62},this.rules[16].opcodes=[],this.rules[16].opcodes[0]={type:3,min:1,max:1/0},this.rules[16].opcodes[1]={type:4,index:79},this.rules[17].opcodes=[],this.rules[17].opcodes[0]={type:3,min:0,max:1/0},this.rules[17].opcodes[1]={type:2,children:[2,3]},this.rules[17].opcodes[2]={type:4,index:78},this.rules[17].opcodes[3]={type:4,index:18},this.rules[18].opcodes=[],this.rules[18].opcodes[0]={type:2,children:[1,2]},this.rules[18].opcodes[1]={type:7,string:[45,32]},this.rules[18].opcodes[2]={type:4,index:47},this.rules[19].opcodes=[],this.rules[19].opcodes[0]={type:2,children:[1,2,3,4,8]},this.rules[19].opcodes[1]={type:4,index:21},this.rules[19].opcodes[2]={type:7,string:[58]},this.rules[19].opcodes[3]={type:4,index:20},this.rules[19].opcodes[4]={type:3,min:0,max:1},this.rules[19].opcodes[5]={type:2,children:[6,7]},this.rules[19].opcodes[6]={type:7,string:[63]},this.rules[19].opcodes[7]={type:4,index:45},this.rules[19].opcodes[8]={type:3,min:0,max:1},this.rules[19].opcodes[9]={type:2,children:[10,11]},this.rules[19].opcodes[10]={type:7,string:[35]},this.rules[19].opcodes[11]={type:4,index:46},this.rules[20].opcodes=[],this.rules[20].opcodes[0]={type:1,children:[1,5,6,7]},this.rules[20].opcodes[1]={type:2,children:[2,3,4]},this.rules[20].opcodes[2]={type:7,string:[47,47]},this.rules[20].opcodes[3]={type:4,index:22},this.rules[20].opcodes[4]={type:4,index:23},this.rules[20].opcodes[5]={type:4,index:24},this.rules[20].opcodes[6]={type:4,index:25},this.rules[20].opcodes[7]={type:4,index:26},this.rules[21].opcodes=[],this.rules[21].opcodes[0]={type:2,children:[1,2]},this.rules[21].opcodes[1]={type:4,index:77},this.rules[21].opcodes[2]={type:3,min:0,max:1/0},this.rules[21].opcodes[3]={type:1,children:[4,5,6,7]},this.rules[21].opcodes[4]={type:4,index:77},this.rules[21].opcodes[5]={type:4,index:79},this.rules[21].opcodes[6]={type:6,string:[43]},this.rules[21].opcodes[7]={type:5,min:45,max:46},this.rules[22].opcodes=[],this.rules[22].opcodes[0]={type:2,children:[1,3,4]},this.rules[22].opcodes[1]={type:3,min:0,max:1},this.rules[22].opcodes[2]={type:4,index:27},this.rules[22].opcodes[3]={type:4,index:29},this.rules[22].opcodes[4]={type:3,min:0,max:1},this.rules[22].opcodes[5]={type:2,children:[6,7]},this.rules[22].opcodes[6]={type:7,string:[58]},this.rules[22].opcodes[7]={type:4,index:44},this.rules[23].opcodes=[],this.rules[23].opcodes[0]={type:3,min:0,max:1/0},this.rules[23].opcodes[1]={type:2,children:[2,3]},this.rules[23].opcodes[2]={type:7,string:[47]},this.rules[23].opcodes[3]={type:4,index:60},this.rules[24].opcodes=[],this.rules[24].opcodes[0]={type:2,children:[1,2]},this.rules[24].opcodes[1]={type:7,string:[47]},this.rules[24].opcodes[2]={type:3,min:0,max:1},this.rules[24].opcodes[3]={type:2,children:[4,5]},this.rules[24].opcodes[4]={type:4,index:61},this.rules[24].opcodes[5]={type:3,min:0,max:1/0},this.rules[24].opcodes[6]={type:2,children:[7,8]},this.rules[24].opcodes[7]={type:7,string:[47]},this.rules[24].opcodes[8]={type:4,index:60},this.rules[25].opcodes=[],this.rules[25].opcodes[0]={type:2,children:[1,2]},this.rules[25].opcodes[1]={type:4,index:61},this.rules[25].opcodes[2]={type:3,min:0,max:1/0},this.rules[25].opcodes[3]={type:2,children:[4,5]},this.rules[25].opcodes[4]={type:7,string:[47]},this.rules[25].opcodes[5]={type:4,index:60},this.rules[26].opcodes=[],this.rules[26].opcodes[0]={type:7,string:[]},this.rules[27].opcodes=[],this.rules[27].opcodes[0]={type:2,children:[1,2]},this.rules[27].opcodes[1]={type:4,index:28},this.rules[27].opcodes[2]={type:6,string:[64]},this.rules[28].opcodes=[],this.rules[28].opcodes[0]={type:3,min:0,max:1/0},this.rules[28].opcodes[1]={type:1,children:[2,3,4,5,6,7,8,9,10,11,12]},this.rules[28].opcodes[2]={type:5,min:97,max:122},this.rules[28].opcodes[3]={type:5,min:65,max:90},this.rules[28].opcodes[4]={type:5,min:48,max:57},this.rules[28].opcodes[5]={type:4,index:63},this.rules[28].opcodes[6]={type:6,string:[33]},this.rules[28].opcodes[7]={type:6,string:[36]},this.rules[28].opcodes[8]={type:5,min:38,max:46},this.rules[28].opcodes[9]={type:5,min:58,max:59},this.rules[28].opcodes[10]={type:6,string:[61]},this.rules[28].opcodes[11]={type:6,string:[95]},this.rules[28].opcodes[12]={type:6,string:[126]},this.rules[29].opcodes=[],this.rules[29].opcodes[0]={type:1,children:[1,2,6]},this.rules[29].opcodes[1]={type:4,index:30},this.rules[29].opcodes[2]={type:2,children:[3,4]},this.rules[29].opcodes[3]={type:4,index:39},this.rules[29].opcodes[4]={type:13},this.rules[29].opcodes[5]={type:4,index:43},this.rules[29].opcodes[6]={type:4,index:42},this.rules[30].opcodes=[],this.rules[30].opcodes[0]={type:2,children:[1,2,5]},this.rules[30].opcodes[1]={type:7,string:[91]},this.rules[30].opcodes[2]={type:1,children:[3,4]},this.rules[30].opcodes[3]={type:4,index:32},this.rules[30].opcodes[4]={type:4,index:31},this.rules[30].opcodes[5]={type:7,string:[93]},this.rules[31].opcodes=[],this.rules[31].opcodes[0]={type:2,children:[1,2,4,5]},this.rules[31].opcodes[1]={type:7,string:[118]},this.rules[31].opcodes[2]={type:3,min:1,max:1/0},this.rules[31].opcodes[3]={type:4,index:80},this.rules[31].opcodes[4]={type:7,string:[46]},this.rules[31].opcodes[5]={type:3,min:1,max:1/0},this.rules[31].opcodes[6]={type:1,children:[7,8,9,10,11,12,13,14,15,16]},this.rules[31].opcodes[7]={type:5,min:97,max:122},this.rules[31].opcodes[8]={type:5,min:65,max:90},this.rules[31].opcodes[9]={type:5,min:48,max:57},this.rules[31].opcodes[10]={type:6,string:[33]},this.rules[31].opcodes[11]={type:6,string:[36]},this.rules[31].opcodes[12]={type:5,min:38,max:46},this.rules[31].opcodes[13]={type:5,min:58,max:59},this.rules[31].opcodes[14]={type:6,string:[61]},this.rules[31].opcodes[15]={type:6,string:[95]},this.rules[31].opcodes[16]={type:6,string:[126]},this.rules[32].opcodes=[],this.rules[32].opcodes[0]={type:1,children:[1,2]},this.rules[32].opcodes[1]={type:4,index:33},this.rules[32].opcodes[2]={type:4,index:34},this.rules[33].opcodes=[],this.rules[33].opcodes[0]={type:2,children:[1,5]},this.rules[33].opcodes[1]={type:2,children:[2,3]},this.rules[33].opcodes[2]={type:4,index:37},this.rules[33].opcodes[3]={type:3,min:0,max:1/0},this.rules[33].opcodes[4]={type:4,index:38},this.rules[33].opcodes[5]={type:3,min:0,max:1},this.rules[33].opcodes[6]={type:2,children:[7,8]},this.rules[33].opcodes[7]={type:6,string:[58]},this.rules[33].opcodes[8]={type:4,index:39},this.rules[34].opcodes=[],this.rules[34].opcodes[0]={type:2,children:[1,6,7]},this.rules[34].opcodes[1]={type:3,min:0,max:1},this.rules[34].opcodes[2]={type:2,children:[3,4]},this.rules[34].opcodes[3]={type:4,index:35},this.rules[34].opcodes[4]={type:3,min:0,max:1/0},this.rules[34].opcodes[5]={type:4,index:36},this.rules[34].opcodes[6]={type:6,string:[58,58]},this.rules[34].opcodes[7]={type:1,children:[8,17]},this.rules[34].opcodes[8]={type:2,children:[9,13]},this.rules[34].opcodes[9]={type:2,children:[10,11]},this.rules[34].opcodes[10]={type:4,index:37},this.rules[34].opcodes[11]={type:3,min:0,max:1/0},this.rules[34].opcodes[12]={type:4,index:38},this.rules[34].opcodes[13]={type:3,min:0,max:1},this.rules[34].opcodes[14]={type:2,children:[15,16]},this.rules[34].opcodes[15]={type:6,string:[58]},this.rules[34].opcodes[16]={type:4,index:39},this.rules[34].opcodes[17]={type:3,min:0,max:1},this.rules[34].opcodes[18]={type:4,index:39},this.rules[35].opcodes=[],this.rules[35].opcodes[0]={type:3,min:1,max:4},this.rules[35].opcodes[1]={type:4,index:80},this.rules[36].opcodes=[],this.rules[36].opcodes[0]={type:2,children:[1,2]},this.rules[36].opcodes[1]={type:6,string:[58]},this.rules[36].opcodes[2]={type:3,min:1,max:4},this.rules[36].opcodes[3]={type:4,index:80},this.rules[37].opcodes=[],this.rules[37].opcodes[0]={type:2,children:[1,3]},this.rules[37].opcodes[1]={type:3,min:1,max:4},this.rules[37].opcodes[2]={type:4,index:80},this.rules[37].opcodes[3]={type:13},this.rules[37].opcodes[4]={type:6,string:[46]},this.rules[38].opcodes=[],this.rules[38].opcodes[0]={type:2,children:[1,2,4]},this.rules[38].opcodes[1]={type:6,string:[58]},this.rules[38].opcodes[2]={type:3,min:1,max:4},this.rules[38].opcodes[3]={type:4,index:80},this.rules[38].opcodes[4]={type:13},this.rules[38].opcodes[5]={type:6,string:[46]},this.rules[39].opcodes=[],this.rules[39].opcodes[0]={type:2,children:[1,2,3,4,5,6,7]},this.rules[39].opcodes[1]={type:4,index:40},this.rules[39].opcodes[2]={type:7,string:[46]},this.rules[39].opcodes[3]={type:4,index:40},this.rules[39].opcodes[4]={type:7,string:[46]},this.rules[39].opcodes[5]={type:4,index:40},this.rules[39].opcodes[6]={type:7,string:[46]},this.rules[39].opcodes[7]={type:4,index:40},this.rules[40].opcodes=[],this.rules[40].opcodes[0]={type:3,min:0,max:3},this.rules[40].opcodes[1]={type:4,index:41},this.rules[41].opcodes=[],this.rules[41].opcodes[0]={type:5,min:48,max:57},this.rules[42].opcodes=[],this.rules[42].opcodes[0]={type:3,min:0,max:1/0},this.rules[42].opcodes[1]={type:4,index:43},this.rules[43].opcodes=[],this.rules[43].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8,9,10,11]},this.rules[43].opcodes[1]={type:5,min:97,max:122},this.rules[43].opcodes[2]={type:5,min:65,max:90},this.rules[43].opcodes[3]={type:5,min:48,max:57},this.rules[43].opcodes[4]={type:4,index:63},this.rules[43].opcodes[5]={type:6,string:[33]},this.rules[43].opcodes[6]={type:6,string:[36]},this.rules[43].opcodes[7]={type:5,min:38,max:46},this.rules[43].opcodes[8]={type:6,string:[59]},this.rules[43].opcodes[9]={type:6,string:[61]},this.rules[43].opcodes[10]={type:6,string:[95]},this.rules[43].opcodes[11]={type:6,string:[126]},this.rules[44].opcodes=[],this.rules[44].opcodes[0]={type:3,min:0,max:1/0},this.rules[44].opcodes[1]={type:4,index:79},this.rules[45].opcodes=[],this.rules[45].opcodes[0]={type:3,min:0,max:1/0},this.rules[45].opcodes[1]={type:1,children:[2,3,4]},this.rules[45].opcodes[2]={type:4,index:62},this.rules[45].opcodes[3]={type:6,string:[47]},this.rules[45].opcodes[4]={type:6,string:[63]},this.rules[46].opcodes=[],this.rules[46].opcodes[0]={type:3,min:0,max:1/0},this.rules[46].opcodes[1]={type:1,children:[2,3,4]},this.rules[46].opcodes[2]={type:4,index:62},this.rules[46].opcodes[3]={type:6,string:[47]},this.rules[46].opcodes[4]={type:6,string:[63]},this.rules[47].opcodes=[],this.rules[47].opcodes[0]={type:2,children:[1,2,3,4,8]},this.rules[47].opcodes[1]={type:4,index:49},this.rules[47].opcodes[2]={type:7,string:[58]},this.rules[47].opcodes[3]={type:4,index:48},this.rules[47].opcodes[4]={type:3,min:0,max:1},this.rules[47].opcodes[5]={type:2,children:[6,7]},this.rules[47].opcodes[6]={type:7,string:[63]},this.rules[47].opcodes[7]={type:4,index:50},this.rules[47].opcodes[8]={type:3,min:0,max:1},this.rules[47].opcodes[9]={type:2,children:[10,11]},this.rules[47].opcodes[10]={type:7,string:[35]},this.rules[47].opcodes[11]={type:4,index:51},this.rules[48].opcodes=[],this.rules[48].opcodes[0]={type:1,children:[1,5,6,7]},this.rules[48].opcodes[1]={type:2,children:[2,3,4]},this.rules[48].opcodes[2]={type:7,string:[47,47]},this.rules[48].opcodes[3]={type:4,index:52},this.rules[48].opcodes[4]={type:4,index:56},this.rules[48].opcodes[5]={type:4,index:57},this.rules[48].opcodes[6]={type:4,index:58},this.rules[48].opcodes[7]={type:4,index:59},this.rules[49].opcodes=[],this.rules[49].opcodes[0]={type:2,children:[1,2]},this.rules[49].opcodes[1]={type:4,index:77},this.rules[49].opcodes[2]={type:3,min:0,max:1/0},this.rules[49].opcodes[3]={type:1,children:[4,5,6,7]},this.rules[49].opcodes[4]={type:4,index:77},this.rules[49].opcodes[5]={type:4,index:79},this.rules[49].opcodes[6]={type:6,string:[43]},this.rules[49].opcodes[7]={type:5,min:45,max:46},this.rules[50].opcodes=[],this.rules[50].opcodes[0]={type:3,min:0,max:1/0},this.rules[50].opcodes[1]={type:1,children:[2,3,4]},this.rules[50].opcodes[2]={type:4,index:62},this.rules[50].opcodes[3]={type:6,string:[47]},this.rules[50].opcodes[4]={type:6,string:[63]},this.rules[51].opcodes=[],this.rules[51].opcodes[0]={type:3,min:0,max:1/0},this.rules[51].opcodes[1]={type:1,children:[2,3,4]},this.rules[51].opcodes[2]={type:4,index:62},this.rules[51].opcodes[3]={type:6,string:[47]},this.rules[51].opcodes[4]={type:6,string:[63]},this.rules[52].opcodes=[],this.rules[52].opcodes[0]={type:2,children:[1,5,6]},this.rules[52].opcodes[1]={type:3,min:0,max:1},this.rules[52].opcodes[2]={type:2,children:[3,4]},this.rules[52].opcodes[3]={type:4,index:53},this.rules[52].opcodes[4]={type:6,string:[64]},this.rules[52].opcodes[5]={type:4,index:54},this.rules[52].opcodes[6]={type:3,min:0,max:1},this.rules[52].opcodes[7]={type:2,children:[8,9]},this.rules[52].opcodes[8]={type:7,string:[58]},this.rules[52].opcodes[9]={type:4,index:55},this.rules[53].opcodes=[],this.rules[53].opcodes[0]={type:3,min:0,max:1/0},this.rules[53].opcodes[1]={type:1,children:[2,3,4,5,6,7,8,9,10,11,12]},this.rules[53].opcodes[2]={type:5,min:97,max:122},this.rules[53].opcodes[3]={type:5,min:65,max:90},this.rules[53].opcodes[4]={type:5,min:48,max:57},this.rules[53].opcodes[5]={type:4,index:63},this.rules[53].opcodes[6]={type:6,string:[33]},this.rules[53].opcodes[7]={type:6,string:[36]},this.rules[53].opcodes[8]={type:5,min:38,max:46},this.rules[53].opcodes[9]={type:5,min:58,max:59},this.rules[53].opcodes[10]={type:6,string:[61]},this.rules[53].opcodes[11]={type:6,string:[95]},this.rules[53].opcodes[12]={type:6,string:[126]},this.rules[54].opcodes=[],this.rules[54].opcodes[0]={type:1,children:[1,2,6]},this.rules[54].opcodes[1]={type:4,index:30},this.rules[54].opcodes[2]={type:2,children:[3,4]},this.rules[54].opcodes[3]={type:4,index:39},this.rules[54].opcodes[4]={type:13},this.rules[54].opcodes[5]={type:4,index:43},this.rules[54].opcodes[6]={type:4,index:42},this.rules[55].opcodes=[],this.rules[55].opcodes[0]={type:3,min:0,max:1/0},this.rules[55].opcodes[1]={type:4,index:79},this.rules[56].opcodes=[],this.rules[56].opcodes[0]={type:3,min:0,max:1/0},this.rules[56].opcodes[1]={type:2,children:[2,3]},this.rules[56].opcodes[2]={type:7,string:[47]},this.rules[56].opcodes[3]={type:4,index:60},this.rules[57].opcodes=[],this.rules[57].opcodes[0]={type:2,children:[1,2]},this.rules[57].opcodes[1]={type:7,string:[47]},this.rules[57].opcodes[2]={type:3,min:0,max:1},this.rules[57].opcodes[3]={type:2,children:[4,5]},this.rules[57].opcodes[4]={type:4,index:61},this.rules[57].opcodes[5]={type:3,min:0,max:1/0},this.rules[57].opcodes[6]={type:2,children:[7,8]},this.rules[57].opcodes[7]={type:7,string:[47]},this.rules[57].opcodes[8]={type:4,index:60},this.rules[58].opcodes=[],this.rules[58].opcodes[0]={type:2,children:[1,2]},this.rules[58].opcodes[1]={type:4,index:61},this.rules[58].opcodes[2]={type:3,min:0,max:1/0},this.rules[58].opcodes[3]={type:2,children:[4,5]},this.rules[58].opcodes[4]={type:7,string:[47]},this.rules[58].opcodes[5]={type:4,index:60},this.rules[59].opcodes=[],this.rules[59].opcodes[0]={type:7,string:[]},this.rules[60].opcodes=[],this.rules[60].opcodes[0]={type:3,min:0,max:1/0},this.rules[60].opcodes[1]={type:4,index:62},this.rules[61].opcodes=[],this.rules[61].opcodes[0]={type:3,min:1,max:1/0},this.rules[61].opcodes[1]={type:4,index:62},this.rules[62].opcodes=[],this.rules[62].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8,9,10,11,12]},this.rules[62].opcodes[1]={type:5,min:97,max:122},this.rules[62].opcodes[2]={type:5,min:65,max:90},this.rules[62].opcodes[3]={type:5,min:48,max:57},this.rules[62].opcodes[4]={type:4,index:63},this.rules[62].opcodes[5]={type:6,string:[33]},this.rules[62].opcodes[6]={type:6,string:[36]},this.rules[62].opcodes[7]={type:5,min:38,max:46},this.rules[62].opcodes[8]={type:5,min:58,max:59},this.rules[62].opcodes[9]={type:6,string:[61]},this.rules[62].opcodes[10]={type:6,string:[64]},this.rules[62].opcodes[11]={type:6,string:[95]},this.rules[62].opcodes[12]={type:6,string:[126]},this.rules[63].opcodes=[],this.rules[63].opcodes[0]={type:2,children:[1,2,3]},this.rules[63].opcodes[1]={type:6,string:[37]},this.rules[63].opcodes[2]={type:4,index:80},this.rules[63].opcodes[3]={type:4,index:80},this.rules[64].opcodes=[],this.rules[64].opcodes[0]={type:3,min:4,max:4},this.rules[64].opcodes[1]={type:4,index:79},this.rules[65].opcodes=[],this.rules[65].opcodes[0]={type:3,min:2,max:2},this.rules[65].opcodes[1]={type:4,index:79},this.rules[66].opcodes=[],this.rules[66].opcodes[0]={type:3,min:2,max:2},this.rules[66].opcodes[1]={type:4,index:79},this.rules[67].opcodes=[],this.rules[67].opcodes[0]={type:3,min:2,max:2},this.rules[67].opcodes[1]={type:4,index:79},this.rules[68].opcodes=[],this.rules[68].opcodes[0]={type:3,min:2,max:2},this.rules[68].opcodes[1]={type:4,index:79},this.rules[69].opcodes=[],this.rules[69].opcodes[0]={type:3,min:2,max:2},this.rules[69].opcodes[1]={type:4,index:79},this.rules[70].opcodes=[],this.rules[70].opcodes[0]={type:2,children:[1,2]},this.rules[70].opcodes[1]={type:7,string:[46]},this.rules[70].opcodes[2]={type:3,min:1,max:1/0},this.rules[70].opcodes[3]={type:4,index:79},this.rules[71].opcodes=[],this.rules[71].opcodes[0]={type:2,children:[1,4,5,6]},this.rules[71].opcodes[1]={type:1,children:[2,3]},this.rules[71].opcodes[2]={type:7,string:[43]},this.rules[71].opcodes[3]={type:7,string:[45]},this.rules[71].opcodes[4]={type:4,index:67},this.rules[71].opcodes[5]={type:7,string:[58]},this.rules[71].opcodes[6]={type:4,index:68},this.rules[72].opcodes=[],this.rules[72].opcodes[0]={type:1,children:[1,2]},this.rules[72].opcodes[1]={type:7,string:[122]},this.rules[72].opcodes[2]={type:4,index:71},this.rules[73].opcodes=[],this.rules[73].opcodes[0]={type:2,children:[1,2,3,4,5,6]},this.rules[73].opcodes[1]={type:4,index:67},this.rules[73].opcodes[2]={type:7,string:[58]},this.rules[73].opcodes[3]={type:4,index:68},this.rules[73].opcodes[4]={type:7,string:[58]},this.rules[73].opcodes[5]={type:4,index:69},this.rules[73].opcodes[6]={type:3,min:0,max:1},this.rules[73].opcodes[7]={type:4,index:70},this.rules[74].opcodes=[],this.rules[74].opcodes[0]={type:2,children:[1,2,3,4,5]},this.rules[74].opcodes[1]={type:4,index:64},this.rules[74].opcodes[2]={type:7,string:[45]},this.rules[74].opcodes[3]={type:4,index:65},this.rules[74].opcodes[4]={type:7,string:[45]},this.rules[74].opcodes[5]={type:4,index:66},this.rules[75].opcodes=[],this.rules[75].opcodes[0]={type:2,children:[1,2]},this.rules[75].opcodes[1]={type:4,index:73},this.rules[75].opcodes[2]={type:4,index:72},this.rules[76].opcodes=[],this.rules[76].opcodes[0]={type:2,children:[1,2,3]},this.rules[76].opcodes[1]={type:4,index:74},this.rules[76].opcodes[2]={type:7,string:[116]},this.rules[76].opcodes[3]={type:4,index:75},this.rules[77].opcodes=[],this.rules[77].opcodes[0]={type:1,children:[1,2]},this.rules[77].opcodes[1]={type:5,min:65,max:90},this.rules[77].opcodes[2]={type:5,min:97,max:122},this.rules[78].opcodes=[],this.rules[78].opcodes[0]={type:6,string:[10]},this.rules[79].opcodes=[],this.rules[79].opcodes[0]={type:5,min:48,max:57},this.rules[80].opcodes=[],this.rules[80].opcodes[0]={type:1,children:[1,2,3]},this.rules[80].opcodes[1]={type:5,min:48,max:57},this.rules[80].opcodes[2]={type:5,min:65,max:70},this.rules[80].opcodes[3]={type:5,min:97,max:102},this.toString=function(){let e="";return e+="; LDT 05/06/2024 \n",e+="; modified in several significant ways\n",e+="; 1) Literal strings are replaced with numbers and ranges (%d32 & %d32-126, etc.) when possible.\n",e+="; TRB and especially TRG operators are much more efficient than TLS operators.\n",e+="; 2) Two rules, authority and URI, are used multiple times in different contexts. These rules will be reproduced and renamed\n",e+="; in order to a) recognize the context and b) remove unneccary callback functions for certain contexts.\n",e+="; This will simiplify recognizing contexts AND remove unneccesary callbacks\n",e+="; 2.a) domain is defined as authority-d which is identical to authority except that there will be no\n",e+="; callback functions defined on authority-d or any of its *-d components.\n",e+="; 2.b) The resource URI is defined as URI-r and its components defined as *-r.\n",e+="; In this way, callback functions can be defined on URI and is components while\n",e+="; leaving URI-r to be parsed identically with no unnecessary callback functions to slow it down.\n",e+='; 3) IPv6address does not work because of APG\'s "first-success disambiguation" and "greedy" repetitions.\n',e+="; IPv6address redefined and validations moved to callback functions (semantic vs syntactic validation)\n",e+="; Redefinition requires negative look-ahead operators, https://en.wikipedia.org/wiki/Syntactic_predicate\n",e+="; That is SABNF instead of simple ABNF.\n",e+='; 4) IPv4address fails because of "first-success disambiguation".\n',e+="; This could be fixed with rearrangement of the alternative terms. However, it would still not\n",e+="; accept zero-padded (leading zeros) decimal octets.\n",e+="; Therefore, IPv4address is also done with callback functions and semantic validation.\n",e+="; 5) The negative look-ahead operator is also needed in the definition of host to\n",e+="; prevent failure with a reg-name that begins with an IPv4 address.\n",e+="; 6) NOTE: host = 1.1.1.256 is a valid host name even though it is an invalid IPv4address.\n",e+="; The IPv4address alternative fails but the reg-name alternative succeeds.\n",e+="; 7) The Ethereum spec (https://eips.ethereum.org/EIPS/eip-4361) message format ABNF\n",e+='; allows for empty statements. Because of the "first success disambiguation" of APG\n',e+='; the an explicit "empty-statement" rule is required to match the spec\'s intent.\n',e+="\n",e+="\n",e+="sign-in-with-ethereum =\n",e+=' oscheme domain %s" wants you to sign in with your Ethereum account:" LF\n',e+=" address LF\n",e+=" ((LF statement LF LF) / empty-statement / (LF LF))\n",e+=' %s"URI: " URI LF\n',e+=' %s"Version: " version LF\n',e+=' %s"Chain ID: " chain-id LF\n',e+=' %s"Nonce: " nonce LF\n',e+=' %s"Issued At: " issued-at\n',e+=" [ LF ex-title expiration-time ]\n",e+=" [ LF nb-title not-before ]\n",e+=" [ LF ri-title request-id ]\n",e+=" [ LF re-title resources ]\n",e+='ex-title = %s"Expiration Time: "\n',e+='nb-title = %s"Not Before: "\n',e+='ri-title = %s"Request ID: "\n',e+='re-title = %s"Resources:"\n',e+='oscheme = [ ALPHA *( ALPHA / DIGIT / %d43 / %d45-46 ) "://" ]\n',e+="domain = authority-d\n",e+='address = "0x" 40*40HEXDIG\n',e+=" ; Must also conform to captilization\n",e+=" ; checksum encoding specified in EIP-55\n",e+=" ; where applicable (EOAs).\n",e+="\n",e+="statement = 1*( %d97-122 / %d65-90 / %d48-57 / %d32-33 / %d35-36 / %d38-59 / %d61 / %d63-64 / %d91 / %d93 / %d95 / %d126)\n",e+=" ; The purpose is to exclude LF (line breaks).\n",e+=" ; LDT 10/04/2023: Do you mean %d32-126? All printing characters\n",e+="empty-statement = LF LF LF\n",e+='version = "1"\n',e+="nonce = 8*( ALPHA / DIGIT )\n",e+="issued-at = date-time\n",e+="expiration-time = date-time\n",e+="not-before = date-time\n",e+="request-id = *pchar\n",e+="chain-id = 1*DIGIT\n",e+=" ; See EIP-155 for valid CHAIN_IDs.\n",e+="resources = *( LF resource )\n",e+='resource = "- " URI-r\n',e+="\n",e+="; ------------------------------------------------------------------------------\n",e+="; RFC 3986\n",e+="\n",e+='URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]\n',e+='hier-part = "//" authority path-abempty\n',e+=" / path-absolute\n",e+=" / path-rootless\n",e+=" / path-empty\n",e+="scheme = ALPHA *( ALPHA / DIGIT / %d43 / %d45-46 )\n",e+='authority = [ userinfo-at ] host [ ":" port ]\n',e+='path-abempty = *( "/" segment )\n',e+='path-absolute = "/" [ segment-nz *( "/" segment ) ]\n',e+='path-rootless = segment-nz *( "/" segment )\n',e+='path-empty = ""\n',e+="userinfo-at = userinfo %d64\n",e+=' ; userinfo redefined to include the "@" so that it will fail without it\n',e+=" ; otherwise userinfo can match host and then the parser will backtrack\n",e+=" ; incorrectly keeping the captured userinfo phrase\n",e+="userinfo = *(%d97-122 / %d65-90 / %d48-57 / pct-encoded / %d33 / %d36 / %d38-46 / %d58-59 / %d61 / %d95 / %d126)\n",e+="host = IP-literal / (IPv4address !reg-name-char) / reg-name\n",e+=" ; negative look-ahead required to prevent IPv4address from being recognized as first part of reg-name\n",e+=" ; same fix as https://github.com/garycourt/uri-js/issues/4\n",e+='IP-literal = "[" ( IPv6address / IPvFuture ) "]"\n',e+='IPvFuture = "v" 1*HEXDIG "." 1*( %d97-122 / %d65-90 / %d48-57 / %d33 / %d36 /%d38-46 / %d58-59 /%d61 /%d95 / %d126 )\n',e+="IPv6address = nodcolon / dcolon\n",e+="nodcolon = (h16n *h16cn) [%d58 IPv4address]\n",e+="dcolon = [h16 *h16c] %d58.58 (((h16n *h16cn) [%d58 IPv4address]) / [IPv4address])\n",e+="h16 = 1*4HEXDIG\n",e+="h16c = %d58 1*4HEXDIG\n",e+="h16n = 1*4HEXDIG !%d46\n",e+="h16cn = %d58 1*4HEXDIG !%d46\n",e+='IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet\n',e+="; Here we will will use callback functions to evaluate and validate the (possibly zero-padded) dec-octet.\n",e+="dec-octet = *3dec-digit\n",e+="dec-digit = %d48-57\n",e+="reg-name = *reg-name-char\n",e+="reg-name-char = %d97-122 / %d65-90 / %d48-57 / pct-encoded / %d33 / %d36 / %d38-46 / %d59 / %d61 /%d95 / %d126\n",e+="port = *DIGIT\n",e+="query = *(pchar / %d47 / %d63)\n",e+="fragment = *(pchar / %d47 / %d63)\n",e+="\n",e+="; URI-r is a redefiniton of URI but without the callback functions attached to it\n",e+="; it reuses athority-d from domain \n",e+='URI-r = scheme-r ":" hier-part-r [ "?" query-r ] [ "#" fragment-r ]\n',e+='hier-part-r = "//" authority-d path-abempty-r\n',e+=" / path-absolute-r\n",e+=" / path-rootless-r\n",e+=" / path-empty-r\n",e+="scheme-r = ALPHA *( ALPHA / DIGIT / %d43 / %d45-46 )\n",e+="query-r = *(pchar / %d47 / %d63)\n",e+="fragment-r = *(pchar / %d47 / %d63)\n",e+="\n",e+="; authority-d is a redefinition of authority for capturing the domian phrase\n",e+="; but without callback functions \n",e+="; it is reused for URI- for the same reason \n",e+='authority-d = [ userinfo-d %d64 ] host-d [ ":" port-d ]\n',e+="userinfo-d = *(%d97-122 / %d65-90 / %d48-57 / pct-encoded / %d33 / %d36 / %d38-46 / %d58-59 / %d61 / %d95 / %d126)\n",e+="host-d = IP-literal / (IPv4address !reg-name-char) / reg-name\n",e+="port-d = *DIGIT\n",e+="\n",e+="; for use with URI-r\n",e+='path-abempty-r = *( "/" segment )\n',e+='path-absolute-r = "/" [ segment-nz *( "/" segment ) ]\n',e+='path-rootless-r = segment-nz *( "/" segment )\n',e+='path-empty-r = ""\n',e+="segment = *pchar\n",e+="segment-nz = 1*pchar\n",e+="pchar = (%d97-122 / %d65-90 / %d48-57 / pct-encoded / %d33 / %d36 / %d38-46 /%d58-59 / %d61 / %d64 / %d95 / %d126)\n",e+="pct-encoded = %d37 HEXDIG HEXDIG\n",e+="\n",e+="; no longer needed - expanded for all usage for fewer branches in the parse there\n",e+="; and more efficient use of the TBS & TRG operators in place of TLS and rule names\n",e+='; does not work with APG probably because of "first-success disambiguation" and greedy repetitions.\n',e+="; will replace with semantic checking of valid number of h16s\n",e+=';IPv6address = 6( h16 ":" ) ls32\n',e+='; / "::" 5( h16 ":" ) ls32\n',e+='; / [ h16 ] "::" 4( h16 ":" ) ls32\n',e+='; / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32\n',e+='; / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32\n',e+='; / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32\n',e+='; / [ *4( h16 ":" ) h16 ] "::" ls32\n',e+='; / [ *5( h16 ":" ) h16 ] "::" h16\n',e+='; / [ *6( h16 ":" ) h16 ] "::"\n',e+=';ls32 = ( h16 ":" h16 ) / IPv4address\n',e+='; dec-octet does not work because of "first-success disambiguation".\n',e+="; Must have the longest (3-digit) numbers first.\n",e+="; Even so, this form does not accept leading zeros.\n",e+="; There does not seem to be a clear standard for this (https://en.wikipedia.org/wiki/Dot-decimal_notation)\n",e+="; however and early RFC 790 did show leading-zero padding of the three digits.\n",e+=";dec-octet = DIGIT ; 0-9\n",e+="; / %x31-39 DIGIT ; 10-99\n",e+='; / "1" 2DIGIT ; 100-199\n',e+='; / "2" %x30-34 DIGIT ; 200-249\n',e+='; / "25" %x30-35 ; 250-255\n',e+=';statement = 1*( reserved / unreserved / " " )\n',e+=';scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )\n',e+=';authority = [ userinfo "@" ] host [ ":" port ]\n',e+=';userinfo = *( unreserved / pct-encoded / sub-delims / ":" )\n',e+=';query = *( pchar / "/" / "?" )\n',e+=';fragment = *( pchar / "/" / "?" )\n',e+=';IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )\n',e+=";reg-name = *( unreserved / pct-encoded / sub-delims )\n",e+=';pct-encoded = "%" HEXDIG HEXDIG\n',e+=';pchar = unreserved / pct-encoded / sub-delims / ":" / "@"\n',e+=';path-empty = 0pchar; deprecated - empty literal string, "", is more efficient \n',e+=';unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"\n',e+=";reserved = gen-delims / sub-delims\n",e+=';gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"\n',e+=';sub-delims = "!" / "$" / "&" / "\'" / "(" / ")"\n',e+='; / "*" / "+" / "," / ";" / "="\n',e+=';HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"\n',e+="\n",e+="; ------------------------------------------------------------------------------\n",e+="; RFC 3339\n",e+="\n",e+="date-fullyear = 4DIGIT\n",e+="date-month = 2DIGIT ; 01-12\n",e+="date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on\n",e+=" ; month/year\n",e+="time-hour = 2DIGIT ; 00-23\n",e+="time-minute = 2DIGIT ; 00-59\n",e+="time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second\n",e+=" ; rules\n",e+='time-secfrac = "." 1*DIGIT\n',e+='time-numoffset = ("+" / "-") time-hour ":" time-minute\n',e+='time-offset = "Z" / time-numoffset\n',e+="\n",e+='partial-time = time-hour ":" time-minute ":" time-second\n',e+=" [time-secfrac]\n",e+='full-date = date-fullyear "-" date-month "-" date-mday\n',e+="full-time = partial-time time-offset\n",e+="\n",e+='date-time = full-date "T" full-time\n',e+="\n",e+="; ------------------------------------------------------------------------------\n",e+="; RFC 5234\n",e+="\n",e+="ALPHA = %x41-5A / %x61-7A ; A-Z / a-z\n",e+="LF = %x0A\n",e+=" ; linefeed\n",e+="DIGIT = %x30-39\n",e+=" ; 0-9\n",e+="HEXDIG = %d48-57 / %d65-70 / %d97-102\n",e+="\n",'; LDT 05/06/2024 \n; modified in several significant ways\n; 1) Literal strings are replaced with numbers and ranges (%d32 & %d32-126, etc.) when possible.\n; TRB and especially TRG operators are much more efficient than TLS operators.\n; 2) Two rules, authority and URI, are used multiple times in different contexts. These rules will be reproduced and renamed\n; in order to a) recognize the context and b) remove unneccary callback functions for certain contexts.\n; This will simiplify recognizing contexts AND remove unneccesary callbacks\n; 2.a) domain is defined as authority-d which is identical to authority except that there will be no\n; callback functions defined on authority-d or any of its *-d components.\n; 2.b) The resource URI is defined as URI-r and its components defined as *-r.\n; In this way, callback functions can be defined on URI and is components while\n; leaving URI-r to be parsed identically with no unnecessary callback functions to slow it down.\n; 3) IPv6address does not work because of APG\'s "first-success disambiguation" and "greedy" repetitions.\n; IPv6address redefined and validations moved to callback functions (semantic vs syntactic validation)\n; Redefinition requires negative look-ahead operators, https://en.wikipedia.org/wiki/Syntactic_predicate\n; That is SABNF instead of simple ABNF.\n; 4) IPv4address fails because of "first-success disambiguation".\n; This could be fixed with rearrangement of the alternative terms. However, it would still not\n; accept zero-padded (leading zeros) decimal octets.\n; Therefore, IPv4address is also done with callback functions and semantic validation.\n; 5) The negative look-ahead operator is also needed in the definition of host to\n; prevent failure with a reg-name that begins with an IPv4 address.\n; 6) NOTE: host = 1.1.1.256 is a valid host name even though it is an invalid IPv4address.\n; The IPv4address alternative fails but the reg-name alternative succeeds.\n; 7) The Ethereum spec (https://eips.ethereum.org/EIPS/eip-4361) message format ABNF\n; allows for empty statements. Because of the "first success disambiguation" of APG\n; the an explicit "empty-statement" rule is required to match the spec\'s intent.\n\n\nsign-in-with-ethereum =\n oscheme domain %s" wants you to sign in with your Ethereum account:" LF\n address LF\n ((LF statement LF LF) / empty-statement / (LF LF))\n %s"URI: " URI LF\n %s"Version: " version LF\n %s"Chain ID: " chain-id LF\n %s"Nonce: " nonce LF\n %s"Issued At: " issued-at\n [ LF ex-title expiration-time ]\n [ LF nb-title not-before ]\n [ LF ri-title request-id ]\n [ LF re-title resources ]\nex-title = %s"Expiration Time: "\nnb-title = %s"Not Before: "\nri-title = %s"Request ID: "\nre-title = %s"Resources:"\noscheme = [ ALPHA *( ALPHA / DIGIT / %d43 / %d45-46 ) "://" ]\ndomain = authority-d\naddress = "0x" 40*40HEXDIG\n ; Must also conform to captilization\n ; checksum encoding specified in EIP-55\n ; where applicable (EOAs).\n\nstatement = 1*( %d97-122 / %d65-90 / %d48-57 / %d32-33 / %d35-36 / %d38-59 / %d61 / %d63-64 / %d91 / %d93 / %d95 / %d126)\n ; The purpose is to exclude LF (line breaks).\n ; LDT 10/04/2023: Do you mean %d32-126? All printing characters\nempty-statement = LF LF LF\nversion = "1"\nnonce = 8*( ALPHA / DIGIT )\nissued-at = date-time\nexpiration-time = date-time\nnot-before = date-time\nrequest-id = *pchar\nchain-id = 1*DIGIT\n ; See EIP-155 for valid CHAIN_IDs.\nresources = *( LF resource )\nresource = "- " URI-r\n\n; ------------------------------------------------------------------------------\n; RFC 3986\n\nURI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]\nhier-part = "//" authority path-abempty\n / path-absolute\n / path-rootless\n / path-empty\nscheme = ALPHA *( ALPHA / DIGIT / %d43 / %d45-46 )\nauthority = [ userinfo-at ] host [ ":" port ]\npath-abempty = *( "/" segment )\npath-absolute = "/" [ segment-nz *( "/" segment ) ]\npath-rootless = segment-nz *( "/" segment )\npath-empty = ""\nuserinfo-at = userinfo %d64\n ; userinfo redefined to include the "@" so that it will fail without it\n ; otherwise userinfo can match host and then the parser will backtrack\n ; incorrectly keeping the captured userinfo phrase\nuserinfo = *(%d97-122 / %d65-90 / %d48-57 / pct-encoded / %d33 / %d36 / %d38-46 / %d58-59 / %d61 / %d95 / %d126)\nhost = IP-literal / (IPv4address !reg-name-char) / reg-name\n ; negative look-ahead required to prevent IPv4address from being recognized as first part of reg-name\n ; same fix as https://github.com/garycourt/uri-js/issues/4\nIP-literal = "[" ( IPv6address / IPvFuture ) "]"\nIPvFuture = "v" 1*HEXDIG "." 1*( %d97-122 / %d65-90 / %d48-57 / %d33 / %d36 /%d38-46 / %d58-59 /%d61 /%d95 / %d126 )\nIPv6address = nodcolon / dcolon\nnodcolon = (h16n *h16cn) [%d58 IPv4address]\ndcolon = [h16 *h16c] %d58.58 (((h16n *h16cn) [%d58 IPv4address]) / [IPv4address])\nh16 = 1*4HEXDIG\nh16c = %d58 1*4HEXDIG\nh16n = 1*4HEXDIG !%d46\nh16cn = %d58 1*4HEXDIG !%d46\nIPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet\n; Here we will will use callback functions to evaluate and validate the (possibly zero-padded) dec-octet.\ndec-octet = *3dec-digit\ndec-digit = %d48-57\nreg-name = *reg-name-char\nreg-name-char = %d97-122 / %d65-90 / %d48-57 / pct-encoded / %d33 / %d36 / %d38-46 / %d59 / %d61 /%d95 / %d126\nport = *DIGIT\nquery = *(pchar / %d47 / %d63)\nfragment = *(pchar / %d47 / %d63)\n\n; URI-r is a redefiniton of URI but without the callback functions attached to it\n; it reuses athority-d from domain \nURI-r = scheme-r ":" hier-part-r [ "?" query-r ] [ "#" fragment-r ]\nhier-part-r = "//" authority-d path-abempty-r\n / path-absolute-r\n / path-rootless-r\n / path-empty-r\nscheme-r = ALPHA *( ALPHA / DIGIT / %d43 / %d45-46 )\nquery-r = *(pchar / %d47 / %d63)\nfragment-r = *(pchar / %d47 / %d63)\n\n; authority-d is a redefinition of authority for capturing the domian phrase\n; but without callback functions \n; it is reused for URI- for the same reason \nauthority-d = [ userinfo-d %d64 ] host-d [ ":" port-d ]\nuserinfo-d = *(%d97-122 / %d65-90 / %d48-57 / pct-encoded / %d33 / %d36 / %d38-46 / %d58-59 / %d61 / %d95 / %d126)\nhost-d = IP-literal / (IPv4address !reg-name-char) / reg-name\nport-d = *DIGIT\n\n; for use with URI-r\npath-abempty-r = *( "/" segment )\npath-absolute-r = "/" [ segment-nz *( "/" segment ) ]\npath-rootless-r = segment-nz *( "/" segment )\npath-empty-r = ""\nsegment = *pchar\nsegment-nz = 1*pchar\npchar = (%d97-122 / %d65-90 / %d48-57 / pct-encoded / %d33 / %d36 / %d38-46 /%d58-59 / %d61 / %d64 / %d95 / %d126)\npct-encoded = %d37 HEXDIG HEXDIG\n\n; no longer needed - expanded for all usage for fewer branches in the parse there\n; and more efficient use of the TBS & TRG operators in place of TLS and rule names\n; does not work with APG probably because of "first-success disambiguation" and greedy repetitions.\n; will replace with semantic checking of valid number of h16s\n;IPv6address = 6( h16 ":" ) ls32\n; / "::" 5( h16 ":" ) ls32\n; / [ h16 ] "::" 4( h16 ":" ) ls32\n; / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32\n; / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32\n; / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32\n; / [ *4( h16 ":" ) h16 ] "::" ls32\n; / [ *5( h16 ":" ) h16 ] "::" h16\n; / [ *6( h16 ":" ) h16 ] "::"\n;ls32 = ( h16 ":" h16 ) / IPv4address\n; dec-octet does not work because of "first-success disambiguation".\n; Must have the longest (3-digit) numbers first.\n; Even so, this form does not accept leading zeros.\n; There does not seem to be a clear standard for this (https://en.wikipedia.org/wiki/Dot-decimal_notation)\n; however and early RFC 790 did show leading-zero padding of the three digits.\n;dec-octet = DIGIT ; 0-9\n; / %x31-39 DIGIT ; 10-99\n; / "1" 2DIGIT ; 100-199\n; / "2" %x30-34 DIGIT ; 200-249\n; / "25" %x30-35 ; 250-255\n;statement = 1*( reserved / unreserved / " " )\n;scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )\n;authority = [ userinfo "@" ] host [ ":" port ]\n;userinfo = *( unreserved / pct-encoded / sub-delims / ":" )\n;query = *( pchar / "/" / "?" )\n;fragment = *( pchar / "/" / "?" )\n;IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )\n;reg-name = *( unreserved / pct-encoded / sub-delims )\n;pct-encoded = "%" HEXDIG HEXDIG\n;pchar = unreserved / pct-encoded / sub-delims / ":" / "@"\n;path-empty = 0pchar; deprecated - empty literal string, "", is more efficient \n;unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"\n;reserved = gen-delims / sub-delims\n;gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"\n;sub-delims = "!" / "$" / "&" / "\'" / "(" / ")"\n; / "*" / "+" / "," / ";" / "="\n;HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"\n\n; ------------------------------------------------------------------------------\n; RFC 3339\n\ndate-fullyear = 4DIGIT\ndate-month = 2DIGIT ; 01-12\ndate-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on\n ; month/year\ntime-hour = 2DIGIT ; 00-23\ntime-minute = 2DIGIT ; 00-59\ntime-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second\n ; rules\ntime-secfrac = "." 1*DIGIT\ntime-numoffset = ("+" / "-") time-hour ":" time-minute\ntime-offset = "Z" / time-numoffset\n\npartial-time = time-hour ":" time-minute ":" time-second\n [time-secfrac]\nfull-date = date-fullyear "-" date-month "-" date-mday\nfull-time = partial-time time-offset\n\ndate-time = full-date "T" full-time\n\n; ------------------------------------------------------------------------------\n; RFC 5234\n\nALPHA = %x41-5A / %x61-7A ; A-Z / a-z\nLF = %x0A\n ; linefeed\nDIGIT = %x30-39\n ; 0-9\nHEXDIG = %d48-57 / %d65-70 / %d97-102\n\n'}}},2626(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseIntegerNumber=t.isEIP55Address=void 0;const n=r(113),i=r(7997);t.isEIP55Address=e=>{if(42!=e.length)return!1;const t=`${e}`.toLowerCase().replace("0x",""),r=(0,i.bytesToHex)((0,n.keccak_256)(t));let s="0x";for(let e=0;e<t.length;e++)parseInt(r[e],16)>=8?s+=t[e].toUpperCase():s+=t[e];return e===s},t.parseIntegerNumber=e=>{const t=parseInt(e);if(isNaN(t))throw new Error("Invalid number.");if(t===1/0)throw new Error("Invalid number.");return t}},3447(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(6411);function i(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>8,t[r+1]=e>>>0,t}function s(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t}function o(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function a(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function c(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function u(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function l(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>24,t[r+1]=e>>>16,t[r+2]=e>>>8,t[r+3]=e>>>0,t}function h(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,t}function d(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),l(e/4294967296>>>0,t,r),l(e>>>0,t,r+4),t}function f(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),h(e>>>0,t,r),h(e/4294967296>>>0,t,r+4),t}t.readInt16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16},t.readUint16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0},t.readInt16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16},t.readUint16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0},t.writeUint16BE=i,t.writeInt16BE=i,t.writeUint16LE=s,t.writeInt16LE=s,t.readInt32BE=o,t.readUint32BE=a,t.readInt32LE=c,t.readUint32LE=u,t.writeUint32BE=l,t.writeInt32BE=l,t.writeUint32LE=h,t.writeInt32LE=h,t.readInt64BE=function(e,t){void 0===t&&(t=0);var r=o(e,t),n=o(e,t+4);return 4294967296*r+n-4294967296*(n>>31)},t.readUint64BE=function(e,t){return void 0===t&&(t=0),4294967296*a(e,t)+a(e,t+4)},t.readInt64LE=function(e,t){void 0===t&&(t=0);var r=c(e,t);return 4294967296*c(e,t+4)+r-4294967296*(r>>31)},t.readUint64LE=function(e,t){void 0===t&&(t=0);var r=u(e,t);return 4294967296*u(e,t+4)+r},t.writeUint64BE=d,t.writeInt64BE=d,t.writeUint64LE=f,t.writeInt64LE=f,t.readUintBE=function(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=e/8+r-1;s>=r;s--)n+=t[s]*i,i*=256;return n},t.readUintLE=function(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s<r+e/8;s++)n+=t[s]*i,i*=256;return n},t.writeUintBE=function(e,t,r,i){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===i&&(i=0),e%8!=0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!n.isSafeInteger(t))throw new Error("writeUintBE value must be an integer");for(var s=1,o=e/8+i-1;o>=i;o--)r[o]=t/s&255,s*=256;return r},t.writeUintLE=function(e,t,r,i){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===i&&(i=0),e%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!n.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var s=1,o=i;o<i+e/8;o++)r[o]=t/s&255,s*=256;return r},t.readFloat32BE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t)},t.readFloat32LE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t,!0)},t.readFloat64BE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t)},t.readFloat64LE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t,!0)},t.writeFloat32BE=function(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(r,e),t},t.writeFloat32LE=function(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(r,e,!0),t},t.writeFloat64BE=function(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(r,e),t},t.writeFloat64LE=function(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(r,e,!0),t}},6411(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mul=Math.imul||function(e,t){var r=65535&e,n=65535&t;return r*n+((e>>>16&65535)*n+r*(t>>>16&65535)<<16>>>0)|0},t.add=function(e,t){return e+t|0},t.sub=function(e,t){return e-t|0},t.rotl=function(e,t){return e<<t|e>>>32-t},t.rotr=function(e,t){return e<<32-t|e>>>t},t.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(e){return t.isInteger(e)&&e>=-t.MAX_SAFE_INTEGER&&e<=t.MAX_SAFE_INTEGER}},7687(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const n=r(7841),i=r(3447),s=r(8767);function o(e,r=t.defaultRandomSource){return r.randomBytes(e)}t.defaultRandomSource=new n.SystemRandomSource,t.randomBytes=o,t.randomUint32=function(e=t.defaultRandomSource){const r=o(4,e),n=(0,i.readUint32LE)(r);return(0,s.wipe)(r),n};const a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function c(e,r=a,n=t.defaultRandomSource){if(r.length<2)throw new Error("randomString charset is too short");if(r.length>256)throw new Error("randomString charset is too long");let i="";const c=r.length,u=256-256%c;for(;e>0;){const t=o(Math.ceil(256*e/u),n);for(let n=0;n<t.length&&e>0;n++){const s=t[n];s<u&&(i+=r.charAt(s%c),e--)}(0,s.wipe)(t)}return i}t.randomString=c,t.randomStringForEntropy=function(e,r=a,n=t.defaultRandomSource){return c(Math.ceil(e/(Math.log(r.length)/Math.LN2)),r,n)}},4262(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserRandomSource=void 0,t.BrowserRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e="undefined"!=typeof self?self.crypto||self.msCrypto:null;e&&void 0!==e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let e=0;e<t.length;e+=65536)this._crypto.getRandomValues(t.subarray(e,e+Math.min(t.length-e,65536)));return t}}},1052(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeRandomSource=void 0;const n=r(8767);t.NodeRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;{const e=r(5423);e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const r=new Uint8Array(e);for(let e=0;e<r.length;e++)r[e]=t[e];return(0,n.wipe)(t),r}}},7841(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SystemRandomSource=void 0;const n=r(4262),i=r(1052);t.SystemRandomSource=class{constructor(){return this.isAvailable=!1,this.name="",this._source=new n.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new i.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}},8767(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wipe=function(e){for(var t=0;t<e.length;t++)e[t]=0;return e}},240(e,t,r){const{Buffer:n}=r(1048),i=r(5950),s="UTF8",o="UTF16",a="UTF16BE",c="UTF16LE",u="UTF32",l="UTF32BE",h="UTF32LE",d="UINT7",f="ASCII",p="BINARY",g="UINT8",m="UINT16",y="UINT16LE",b="UINT16BE",w="UINT32",v="UINT32LE",A="UINT32BE",E="ESCAPED",x="STRING",k=function(e,t){switch(e){case s:return i.utf8.encode(t);case a:return i.utf16be.encode(t);case c:return i.utf16le.encode(t);case l:return i.utf32be.encode(t);case h:return i.utf32le.encode(t);case d:return i.uint7.encode(t);case g:return i.uint8.encode(t);case b:return i.uint16be.encode(t);case y:return i.uint16le.encode(t);case A:return i.uint32be.encode(t);case v:return i.uint32le.encode(t);case x:return i.string.encode(t);case E:return i.escaped.encode(t);default:throw new TypeError(`encode type "${e}" not recognized`)}};t.decode=function(e,t){return function(e){switch(e.type){case s:return i.utf8.decode(e.data,e.bom);case c:return i.utf16le.decode(e.data,e.bom);case a:return i.utf16be.decode(e.data,e.bom);case l:return i.utf32be.decode(e.data,e.bom);case h:return i.utf32le.decode(e.data,e.bom);case d:return i.uint7.decode(e.data);case g:return i.uint8.decode(e.data);case b:return i.uint16be.decode(e.data);case y:return i.uint16le.decode(e.data);case A:return i.uint32be.decode(e.data);case v:return i.uint32le.decode(e.data);case x:return i.string.decode(e.data);case E:return i.escaped.decode(e.data);default:throw new TypeError(`decode type "${e.type}" not recognized`)}}(function(e,t){const r=function(e){const t={type:"",base64:!1},r=/^(base64:)?([a-zA-Z0-9]+)$/i.exec(e);return r&&(r[2]&&(t.type=r[2].toUpperCase()),r[1]&&(t.base64=!0)),t}(e.toUpperCase());if(r.base64){if(r.type===x)throw new TypeError(`type: "${e} "BASE64:" prefix not allowed with type ${x}`);if(n.isBuffer(t))r.data=i.base64.decode(t);else{if("string"!=typeof t)throw new TypeError(`type: "${e} unrecognized data type: typeof(data): ${typeof t}`);{const e=n.from(t,"ascii");r.data=i.base64.decode(e)}}}else r.data=t;switch(r.type){case s:!function(e){e.type=s;const t=e.data;e.bom=0,t.length>=3&&239===t[0]&&187===t[1]&&191===t[2]&&(e.bom=3)}(r);break;case o:case a:case c:!function(e){const t=e.data;switch(e.bom=0,e.type){case o:e.type=a,t.length>=2&&(254===t[0]&&255===t[1]?e.bom=2:255===t[0]&&254===t[1]&&(e.type=c,e.bom=2));break;case a:if(e.type=a,t.length>=2)if(254===t[0]&&255===t[1])e.bom=2;else if(255===t[0]&&254===t[1])throw new TypeError(`src type: "${a}" specified but BOM is for "${c}"`);break;case c:if(e.type=c,t.length>=0){if(254===t[0]&&255===t[1])throw new TypeError(`src type: "${c}" specified but BOM is for "${a}"`);255===t[0]&&254===t[1]&&(e.bom=2)}break;default:throw new TypeError(`UTF16 BOM: src type "${e.type}" unrecognized`)}}(r);break;case u:case l:case h:!function(e){const t=e.data;switch(e.bom=0,e.type){case u:e.type=l,t.length>=4&&(0===t[0]&&0===t[1]&&254===t[2]&&255===t[3]&&(e.bom=4),255===t[0]&&254===t[1]&&0===t[2]&&0===t[3]&&(e.type=h,e.bom=4));break;case l:if(e.type=l,t.length>=4&&(0===t[0]&&0===t[1]&&254===t[2]&&255===t[3]&&(e.bom=4),255===t[0]&&254===t[1]&&0===t[2]&&0===t[3]))throw new TypeError(`src type: ${l} specified but BOM is for ${h}"`);break;case h:if(e.type=h,t.length>=4){if(0===t[0]&&0===t[1]&&254===t[2]&&255===t[3])throw new TypeError(`src type: "${h}" specified but BOM is for "${l}"`);255===t[0]&&254===t[1]&&0===t[2]&&0===t[3]&&(e.bom=4)}break;default:throw new TypeError(`UTF32 BOM: src type "${e.type}" unrecognized`)}}(r);break;case m:r.type=b;break;case w:r.type=A;break;case f:r.type=d;break;case p:r.type=g;break;case d:case g:case y:case b:case v:case A:case x:case E:break;default:throw new TypeError(`type: "${e}" not recognized`)}if(r.type===x){if("string"!=typeof r.data)throw new TypeError(`type: "${e}" but data is not a string`)}else if(!n.isBuffer(r.data))throw new TypeError(`type: "${e}" but data is not a Buffer`);return r}(e,t))},t.encode=function(e,t){let r,n;const T=function(e,t){if(!Array.isArray(t))throw new TypeError('dst chars: not array: "'+typeof t);if("string"!=typeof e)throw new TypeError('dst type: not string: "'+typeof e);const r=function(e){let t,r;const n={crlf:!1,lf:!1,base64:!1,type:""};for(;;){if(r=e,t=e.slice(0,5),"CRLF:"===t){n.crlf=!0,r=e.slice(5);break}if(t=e.slice(0,3),"LF:"===t){n.lf=!0,r=e.slice(3);break}break}return t=r.split(":"),1===t.length?n.type=t[0]:2===t.length&&"BASE64"===t[1]&&(n.base64=!0,n.type=t[0]),n}(e.toUpperCase());switch(r.type){case s:case a:case c:case l:case h:case d:case g:case y:case b:case v:case A:case E:break;case x:if(r.base64)throw new TypeError(`":BASE64" suffix not allowed with type ${x}`);break;case f:r.type=d;break;case p:r.type=g;break;case o:r.type=a;break;case u:r.type=l;break;case m:r.type=b;break;case w:r.type=A;break;default:throw new TypeError(`dst type unrecognized: "${e}" : must have form [crlf:|lf:]type[:base64]`)}return r}(e,t);return T.crlf?(r=i.lineEnds.crlf(t),n=k(T.type,r)):T.lf?(r=i.lineEnds.lf(t),n=k(T.type,r)):n=k(T.type,t),T.base64&&(n=i.base64.encode(n)),n},t.convert=function(e,r,n){return t.encode(n,t.decode(e,r))}},5950(e,t,r){const{Buffer:n}=r(1048),i=4294967292,s=4294967293,o=4294967294,a=4294967295,c=[0,1,3,7,15,31,63,127,255,511,1023],u=["00","01","02","03","04","05","06","07","08","09","0A","0B","0C","0D","0E","0F","10","11","12","13","14","15","16","17","18","19","1A","1B","1C","1D","1E","1F","20","21","22","23","24","25","26","27","28","29","2A","2B","2C","2D","2E","2F","30","31","32","33","34","35","36","37","38","39","3A","3B","3C","3D","3E","3F","40","41","42","43","44","45","46","47","48","49","4A","4B","4C","4D","4E","4F","50","51","52","53","54","55","56","57","58","59","5A","5B","5C","5D","5E","5F","60","61","62","63","64","65","66","67","68","69","6A","6B","6C","6D","6E","6F","70","71","72","73","74","75","76","77","78","79","7A","7B","7C","7D","7E","7F","80","81","82","83","84","85","86","87","88","89","8A","8B","8C","8D","8E","8F","90","91","92","93","94","95","96","97","98","99","9A","9B","9C","9D","9E","9F","A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","AA","AB","AC","AD","AE","AF","B0","B1","B2","B3","B4","B5","B6","B7","B8","B9","BA","BB","BC","BD","BE","BF","C0","C1","C2","C3","C4","C5","C6","C7","C8","C9","CA","CB","CC","CD","CE","CF","D0","D1","D2","D3","D4","D5","D6","D7","D8","D9","DA","DB","DC","DD","DE","DF","E0","E1","E2","E3","E4","E5","E6","E7","E8","E9","EA","EB","EC","ED","EE","EF","F0","F1","F2","F3","F4","F5","F6","F7","F8","F9","FA","FB","FC","FD","FE","FF"],l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split(""),h=[];l.forEach(e=>{h.push(e.charCodeAt(0))}),t.utf8={encode(e){const t=[];return e.forEach(e=>{if(e>=0&&e<=127)t.push(e);else if(e<=2047)t.push(192+(e>>6&c[5])),t.push(128+(e&c[6]));else if(e<55296||e>57343&&e<=65535)t.push(224+(e>>12&c[4])),t.push(128+(e>>6&c[6])),t.push(128+(e&c[6]));else{if(!(e>=65536&&e<=1114111))throw new RangeError(`utf8.encode: character out of range: char: ${e}`);{const r=e>>16&c[5];t.push(240+(r>>2)),t.push(128+((r&c[2])<<4)+(e>>12&c[4])),t.push(128+(e>>6&c[6])),t.push(128+(e&c[6]))}}}),n.from(t)},decode(e,t){function r(e,t){if(128!=(192&t))return s;const r=((e&c[5])<<6)+(t&c[6]);return r<128?i:r}function n(e,t,r){if(128!=(192&r)||128!=(192&t))return s;const n=((e&c[4])<<12)+((t&c[6])<<6)+(r&c[6]);return n<2048?i:n>=55296&&n<=57343?o:n}function u(e,t,r,n){if(128!=(192&n)||128!=(192&r)||128!=(192&t))return s;const a=(((e&c[3])<<2)+(t>>4&c[2])<<16)+((t&c[4])<<12)+((r&c[6])<<6)+(n&c[6]);return a<65536?i:a>1114111?o:a}let l,h,d,f,p,g;const m=e.length;let y=t?3:0;const b=[];for(;y<m;){h=e[y],l=a;const t=!0;for(;t;){if(h>=0&&h<=127){l=h,g=1;break}if(d=y+1,d<m&&h>=194&&h<=223){l=r(h,e[d]),g=2;break}if(f=y+2,f<m&&h>=224&&h<=239){l=n(h,e[d],e[f]),g=3;break}if(p=y+3,p<m&&h>=240&&h<=244){l=u(h,e[d],e[f],e[p]),g=4;break}break}if(l>1114111){const e=`byte[${y}]`;if(l===a)throw new RangeError(`utf8.decode: ill-formed UTF8 byte sequence found at: ${e}`);if(l===s)throw new RangeError(`utf8.decode: illegal trailing byte found at: ${e}`);if(l===o)throw new RangeError(`utf8.decode: code point out of range found at: ${e}`);if(l===i)throw new RangeError(`utf8.decode: non-shortest form found at: ${e}`);throw new RangeError(`utf8.decode: unrecognized error found at: ${e}`)}b.push(l),y+=g}return b}},t.utf16be={encode(e){const t=[];let r,i,s;for(let n=0;n<e.length;n+=1)if(r=e[n],r>=0&&r<=55295||r>=57344&&r<=65535)t.push(r>>8&c[8]),t.push(r&c[8]);else{if(!(r>=65536&&r<=1114111))throw new RangeError(`utf16be.encode: UTF16BE value out of range: char[${n}]: ${r}`);s=r-65536,i=55296+(s>>10),s=56320+(s&c[10]),t.push(i>>8&c[8]),t.push(i&c[8]),t.push(s>>8&c[8]),t.push(s&c[8])}return n.from(t)},decode(e,t){if(e.length%2>0)throw new RangeError(`utf16be.decode: data length must be even multiple of 2: length: ${e.length}`);const r=[],n=e.length;let i,s,o,a,c,u,l=t?2:0,h=0;for(;l<n;){const t=!0;for(;t;){if(o=l+1,o<n){if(c=(e[l]<<8)+e[o],c<55296||c>57343){i=c,s=2;break}if(a=l+3,a<n&&(u=(e[l+2]<<8)+e[a],c<=56319&&u>=56320&&u<=57343)){i=65536+(c-55296<<10)+(u-56320),s=4;break}}throw new RangeError(`utf16be.decode: ill-formed UTF16BE byte sequence found: byte[${l}]`)}r[h++]=i,l+=s}return r}},t.utf16le={encode(e){const t=[];let r,i,s;for(let n=0;n<e.length;n+=1)if(r=e[n],r>=0&&r<=55295||r>=57344&&r<=65535)t.push(r&c[8]),t.push(r>>8&c[8]);else{if(!(r>=65536&&r<=1114111))throw new RangeError(`utf16le.encode: UTF16LE value out of range: char[${n}]: ${r}`);s=r-65536,i=55296+(s>>10),s=56320+(s&c[10]),t.push(i&c[8]),t.push(i>>8&c[8]),t.push(s&c[8]),t.push(s>>8&c[8])}return n.from(t)},decode(e,t){if(e.length%2>0)throw new RangeError(`utf16le.decode: data length must be even multiple of 2: length: ${e.length}`);const r=[],n=e.length;let i,s,o,a,c,u,l=t?2:0,h=0;for(;l<n;){const t=!0;for(;t;){if(o=l+1,o<n){if(c=(e[o]<<8)+e[l],c<55296||c>57343){i=c,s=2;break}if(a=l+3,a<n&&(u=(e[a]<<8)+e[l+2],c<=56319&&u>=56320&&u<=57343)){i=65536+(c-55296<<10)+(u-56320),s=4;break}}throw new RangeError(`utf16le.decode: ill-formed UTF16LE byte sequence found: byte[${l}]`)}r[h++]=i,l+=s}return r}},t.utf32be={encode(e){const t=n.alloc(4*e.length);let r=0;return e.forEach(e=>{if(e>=55296&&e<=57343||e>1114111)throw new RangeError(`utf32be.encode: UTF32BE character code out of range: char[${r/4}]: ${e}`);t[r++]=e>>24&c[8],t[r++]=e>>16&c[8],t[r++]=e>>8&c[8],t[r++]=e&c[8]}),t},decode(e,t){if(e.length%4>0)throw new RangeError(`utf32be.decode: UTF32BE byte length must be even multiple of 4: length: ${e.length}`);const r=[];let n=t?4:0;for(;n<e.length;n+=4){const t=(e[n]<<24)+(e[n+1]<<16)+(e[n+2]<<8)+e[n+3];if(t>=55296&&t<=57343||t>1114111)throw new RangeError(`utf32be.decode: UTF32BE character code out of range: char[${n/4}]: ${t}`);r.push(t)}return r}},t.utf32le={encode(e){const t=n.alloc(4*e.length);let r=0;return e.forEach(e=>{if(e>=55296&&e<=57343||e>1114111)throw new RangeError(`utf32le.encode: UTF32LE character code out of range: char[${r/4}]: ${e}`);t[r++]=e&c[8],t[r++]=e>>8&c[8],t[r++]=e>>16&c[8],t[r++]=e>>24&c[8]}),t},decode(e,t){if(e.length%4>0)throw new RangeError(`utf32be.decode: UTF32LE byte length must be even multiple of 4: length: ${e.length}`);const r=[];let n=t?4:0;for(;n<e.length;n+=4){const t=(e[n+3]<<24)+(e[n+2]<<16)+(e[n+1]<<8)+e[n];if(t>=55296&&t<=57343||t>1114111)throw new RangeError(`utf32le.encode: UTF32LE character code out of range: char[${n/4}]: ${t}`);r.push(t)}return r}},t.uint7={encode(e){const t=n.alloc(e.length);for(let r=0;r<e.length;r+=1){if(e[r]>127)throw new RangeError(`uint7.encode: UINT7 character code out of range: char[${r}]: ${e[r]}`);t[r]=e[r]}return t},decode(e){const t=[];for(let r=0;r<e.length;r+=1){if(e[r]>127)throw new RangeError(`uint7.decode: UINT7 character code out of range: byte[${r}]: ${e[r]}`);t[r]=e[r]}return t}},t.uint8={encode(e){const t=n.alloc(e.length);for(let r=0;r<e.length;r+=1){if(e[r]>255)throw new RangeError(`uint8.encode: UINT8 character code out of range: char[${r}]: ${e[r]}`);t[r]=e[r]}return t},decode(e){const t=[];for(let r=0;r<e.length;r+=1)t[r]=e[r];return t}},t.uint16be={encode(e){const t=n.alloc(2*e.length);let r=0;return e.forEach(e=>{if(e>65535)throw new RangeError(`uint16be.encode: UINT16BE character code out of range: char[${r/2}]: ${e}`);t[r++]=e>>8&c[8],t[r++]=e&c[8]}),t},decode(e){if(e.length%2>0)throw new RangeError(`uint16be.decode: UINT16BE byte length must be even multiple of 2: length: ${e.length}`);const t=[];for(let r=0;r<e.length;r+=2)t.push((e[r]<<8)+e[r+1]);return t}},t.uint16le={encode(e){const t=n.alloc(2*e.length);let r=0;return e.forEach(e=>{if(e>65535)throw new RangeError(`uint16le.encode: UINT16LE character code out of range: char[${r/2}]: ${e}`);t[r++]=e&c[8],t[r++]=e>>8&c[8]}),t},decode(e){if(e.length%2>0)throw new RangeError(`uint16le.decode: UINT16LE byte length must be even multiple of 2: length: ${e.length}`);const t=[];for(let r=0;r<e.length;r+=2)t.push((e[r+1]<<8)+e[r]);return t}},t.uint32be={encode(e){const t=n.alloc(4*e.length);let r=0;return e.forEach(e=>{t[r++]=e>>24&c[8],t[r++]=e>>16&c[8],t[r++]=e>>8&c[8],t[r++]=e&c[8]}),t},decode(e){if(e.length%4>0)throw new RangeError(`uint32be.decode: UINT32BE byte length must be even multiple of 4: length: ${e.length}`);const t=[];for(let r=0;r<e.length;r+=4)t.push((e[r]<<24)+(e[r+1]<<16)+(e[r+2]<<8)+e[r+3]);return t}},t.uint32le={encode(e){const t=n.alloc(4*e.length);let r=0;return e.forEach(e=>{t[r++]=e&c[8],t[r++]=e>>8&c[8],t[r++]=e>>16&c[8],t[r++]=e>>24&c[8]}),t},decode(e){if(e.length%4>0)throw new RangeError(`uint32le.decode: UINT32LE byte length must be even multiple of 4: length: ${e.length}`);const t=[];for(let r=0;r<e.length;r+=4)t.push((e[r+3]<<24)+(e[r+2]<<16)+(e[r+1]<<8)+e[r]);return t}},t.string={encode:e=>t.utf16le.encode(e).toString("utf16le"),decode:e=>t.utf16le.decode(n.from(e,"utf16le"),0)},t.escaped={encode(e){const t=[];for(let r=0;r<e.length;r+=1){const i=e[r];if(96===i)t.push(i),t.push(i);else if(10===i)t.push(i);else if(i>=32&&i<=126)t.push(i);else{let e="";if(i>=0&&i<=31)e+=`\`x${u[i]}`;else if(i>=127&&i<=255)e+=`\`x${u[i]}`;else if(i>=256&&i<=65535)e+=`\`u${u[i>>8&c[8]]}${u[i&c[8]]}`;else{if(!(i>=65536&&i<=4294967295))throw new Error("escape.encode(char): char > 0xffffffff not allowed");{e+="`u{";const t=i>>24&c[8];t>0&&(e+=u[t]),e+=`${u[i>>16&c[8]]+u[i>>8&c[8]]+u[i&c[8]]}}`}}n.from(e).forEach(e=>{t.push(e)})}}return n.from(t)},decode(e){function t(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function r(e,r,n){const i={char:null,nexti:e+2,error:!0};if(e+1<r&&t(n[e])&&t(n[e+1])){const t=String.fromCodePoint(n[e],n[e+1]);i.char=parseInt(t,16),Number.isNaN(i.char)||(i.error=!1)}return i}function n(e,r,n){const i={char:null,nexti:e+4,error:!0};if(e+3<r&&t(n[e])&&t(n[e+1])&&t(n[e+2])&&t(n[e+3])){const t=String.fromCodePoint(n[e],n[e+1],n[e+2],n[e+3]);i.char=parseInt(t,16),Number.isNaN(i.char)||(i.error=!1)}return i}function i(e,r,n){const i={char:null,nexti:e+4,error:!0};let s="";for(;e<r&&t(n[e]);)s+=String.fromCodePoint(n[e]),e+=1;return i.char=parseInt(s,16),125!==n[e]||Number.isNaN(i.char)||(i.error=!1),i.nexti=e+1,i}const s=[],o=e.length;let a,c,u,l=0;for(;l<o;){const t=!0;for(;t;){if(u=!0,96!==e[l]){s.push(e[l]),l+=1,u=!1;break}if(a=l+1,a>=o)break;if(96===e[a]){s.push(96),l+=2,u=!1;break}if(120===e[a]){if(c=r(a+1,o,e),c.error)break;s.push(c.char),l=c.nexti,u=!1;break}if(117===e[a]){if(123===e[a+1]){if(c=i(a+2,o,e),c.error)break;s.push(c.char),l=c.nexti,u=!1;break}if(c=n(a+1,o,e),c.error)break;s.push(c.char),l=c.nexti,u=!1;break}break}if(u)throw new Error(`escaped.decode: ill-formed escape sequence at buf[${l}]`)}return s}};const d=10;t.lineEnds={crlf(e){const t=[];let r=0;for(;r<e.length;)switch(e[r]){case 13:r+1<e.length&&e[r+1]===d?r+=2:r+=1,t.push(13),t.push(d);break;case d:t.push(13),t.push(d),r+=1;break;default:t.push(e[r]),r+=1}return t.length>0&&t[t.length-1]!==d&&(t.push(13),t.push(d)),t},lf(e){const t=[];let r=0;for(;r<e.length;)switch(e[r]){case 13:r+1<e.length&&e[r+1]===d?r+=2:r+=1,t.push(d);break;case d:t.push(d),r+=1;break;default:t.push(e[r]),r+=1}return t.length>0&&t[t.length-1]!==d&&t.push(d),t}},t.base64={encode(e){if(0===e.length)return n.alloc(0);let t,r,i,s=e.length%3;s=s>0?3-s:0;let o=(e.length+s)/3;const a=n.alloc(4*o);s>0&&(o-=1),t=0,r=0;for(let n=0;n<o;n+=1)i=e[t++]<<16,i+=e[t++]<<8,i+=e[t++],a[r++]=h[i>>18&c[6]],a[r++]=h[i>>12&c[6]],a[r++]=h[i>>6&c[6]],a[r++]=h[i&c[6]];return 0===s?a:1===s?(i=e[t++]<<16,i+=e[t]<<8,a[r++]=h[i>>18&c[6]],a[r++]=h[i>>12&c[6]],a[r++]=h[i>>6&c[6]],a[r]=h[64],a):2===s?(i=e[t]<<16,a[r++]=h[i>>18&c[6]],a[r++]=h[i>>12&c[6]],a[r++]=h[64],a[r]=h[64],a):void 0},decode(e){if(0===e.length)return n.alloc(0);const t=function(e){const t=[];let r=0;for(let n=0;n<e.length;n+=1){const i=e[n],s=!0;for(;s&&32!==i&&9!==i&&10!==i&&13!==i;){if(i>=65&&i<=90){t.push(i-65);break}if(i>=97&&i<=122){t.push(i-71);break}if(i>=48&&i<=57){t.push(i+4);break}if(43===i){t.push(62);break}if(47===i){t.push(63);break}if(61===i){t.push(64),r+=1;break}throw new RangeError(`base64.decode: invalid character buf[${n}]: ${i}`)}}if(t.length%4>0)throw new RangeError(`base64.decode: string length not integral multiple of 4: ${t.length}`);switch(r){case 0:break;case 1:if(64!==t[t.length-1])throw new RangeError("base64.decode: one tail character found: not last character");break;case 2:if(64!==t[t.length-1]||64!==t[t.length-2])throw new RangeError("base64.decode: two tail characters found: not last characters");break;default:throw new RangeError(`base64.decode: more than two tail characters found: ${r}`)}return{tail:r,buf:n.from(t)}}(e),{tail:r}=t,i=t.buf;let s,o,a,u=i.length/4;const l=n.alloc(3*u-r);r>0&&(u-=1),o=0,s=0;for(let e=0;e<u;e+=1)a=i[s++]<<18,a+=i[s++]<<12,a+=i[s++]<<6,a+=i[s++],l[o++]=a>>16&c[8],l[o++]=a>>8&c[8],l[o++]=a&c[8];return 1===r&&(a=i[s++]<<18,a+=i[s++]<<12,a+=i[s]<<6,l[o++]=a>>16&c[8],l[o]=a>>8&c[8]),2===r&&(a=i[s++]<<18,a+=i[s++]<<12,l[o]=a>>16&c[8]),l},toString(e){if(e.length%4>0)throw new RangeError(`base64.toString: input buffer length not multiple of 4: ${e.length}`);let t="",r=0;function n(e,n,i,s){switch(r){case 76:t+=`\r\n${e}${n}${i}${s}`,r=4;break;case 75:t+=`${e}\r\n${n}${i}${s}`,r=3;break;case 74:t+=`${e+n}\r\n${i}${s}`,r=2;break;case 73:t+=`${e+n+i}\r\n${s}`,r=1;break;default:t+=e+n+i+s,r+=4}}function i(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||43===e||47===e||61===e}for(let t=0;t<e.length;t+=4){for(let r=t;r<t+4;r+=1)if(!i(e[r]))throw new RangeError(`base64.toString: buf[${r}]: ${e[r]} : not valid base64 character code`);n(String.fromCharCode(e[t]),String.fromCharCode(e[t+1]),String.fromCharCode(e[t+2]),String.fromCharCode(e[t+3]))}return t}}},7770(e,t,r){e.exports=function(){const e=r(5298),t=r(1174),n=this;let i=null,s=null,o=null,a=0;const c=[],u=[],l=[],h=[];function d(e){let t="";for(let r=0;r<e;r+=1)t+=" ";return t}this.callbacks=[],this.astObject="astObject",this.init=function(e,t,r){let d;l.length=0,h.length=0,c.length=0,a=0,i=e,s=t,o=r;const f=[];for(d=0;d<i.length;d+=1)f.push(i[d].lower);for(d=0;d<s.length;d+=1)f.push(s[d].lower);for(a=i.length+s.length,d=0;d<a;d+=1)c[d]=!1,u[d]=null;for(const e in n.callbacks){const t=e.toLowerCase();if(d=f.indexOf(t),d<0)throw new Error(`ast.js: init: node '${e}' not a rule or udt name`);"function"==typeof n.callbacks[e]&&(c[d]=!0,u[d]=n.callbacks[e]),!0===n.callbacks[e]&&(c[d]=!0)}},this.ruleDefined=function(e){return!1!==c[e]},this.udtDefined=function(e){return!1!==c[i.length+e]},this.down=function(t,r){const n=h.length;return l.push(n),h.push({name:r,thisIndex:n,thatIndex:null,state:e.SEM_PRE,callbackIndex:t,phraseIndex:null,phraseLength:null,stack:l.length}),n},this.up=function(t,r,n,i){const s=h.length,o=l.pop();return h.push({name:r,thisIndex:s,thatIndex:o,state:e.SEM_POST,callbackIndex:t,phraseIndex:n,phraseLength:i,stack:l.length}),h[o].thatIndex=s,h[o].phraseIndex=n,h[o].phraseLength=i,s},this.translate=function(t){let r,n,i;for(let s=0;s<h.length;s+=1)i=h[s],n=u[i.callbackIndex],i.state===e.SEM_PRE?null!==n&&(r=n(e.SEM_PRE,o,i.phraseIndex,i.phraseLength,t),r===e.SEM_SKIP&&(s=i.thatIndex)):null!==n&&n(e.SEM_POST,o,i.phraseIndex,i.phraseLength,t)},this.setLength=function(e){h.length=e,l.length=e>0?h[e-1].stack:0},this.getLength=function(){return h.length},this.toXml=function(r){let n=t.charsToDec,i="decimal integer character codes";if("string"==typeof r&&r.length>=3){const e=r.slice(0,3).toLowerCase();"asc"===e?(n=t.charsToAscii,i="ASCII for printing characters, hex for non-printing"):"hex"===e?(n=t.charsToHex,i="hexadecimal integer character codes"):"uni"===e&&(n=t.charsToUnicode,i="Unicode UTF-32 integer character codes")}let s="",a=0;return s+='<?xml version="1.0" encoding="utf-8"?>\n',s+=`<root nodes="${h.length/2}" characters="${o.length}">\n`,s+=`\x3c!-- input string, ${i} --\x3e\n`,s+=d(a+2),s+=n(o),s+="\n",h.forEach(t=>{t.state===e.SEM_PRE?(a+=1,s+=d(a),s+=`<node name="${t.name}" index="${t.phraseIndex}" length="${t.phraseLength}">\n`,s+=d(a+2),s+=n(o,t.phraseIndex,t.phraseLength),s+="\n"):(s+=d(a),s+=`</node>\x3c!-- name="${t.name}" --\x3e\n`,a-=1)}),s+="</root>\n",s},this.phrases=function(){const t={};let r,n;for(r=0;r<h.length;r+=1)n=h[r],n.state===e.SEM_PRE&&(Array.isArray(t[n.name])||(t[n.name]=[]),t[n.name].push({index:n.phraseIndex,length:n.phraseLength}));return t}}},6660(e){e.exports=function(){let e=-1,t=0;this.init=function(r){if("number"!=typeof r||r<=0)throw new Error("circular-buffer.js: init: circular buffer size must an integer > 0");t=Math.ceil(r),e=-1},this.increment=function(){return e+=1,(e+t)%t},this.maxSize=function(){return t},this.items=function(){return e+1},this.getListIndex=function(r){return-1===e||r<0||r>e||e-r>=t?-1:(r+t)%t},this.forEach=function(r){if(-1!==e)if(e<t)for(let t=0;t<=e;t+=1)r(t,t);else for(let n=e-t+1;n<=e;n+=1)r((n+t)%t,n)}}},9724(e){e.exports=function(){return"/* This file automatically generated by jsonToless() and LESS. */\n.apg-mono {\n font-family: monospace;\n}\n.apg-active {\n font-weight: bold;\n color: #000000;\n}\n.apg-match {\n font-weight: bold;\n color: #264BFF;\n}\n.apg-empty {\n font-weight: bold;\n color: #0fbd0f;\n}\n.apg-nomatch {\n font-weight: bold;\n color: #FF4000;\n}\n.apg-lh-match {\n font-weight: bold;\n color: #1A97BA;\n}\n.apg-lb-match {\n font-weight: bold;\n color: #5F1687;\n}\n.apg-remainder {\n font-weight: bold;\n color: #999999;\n}\n.apg-ctrl-char {\n font-weight: bolder;\n font-style: italic;\n font-size: 0.6em;\n}\n.apg-line-end {\n font-weight: bold;\n color: #000000;\n}\n.apg-error {\n font-weight: bold;\n color: #FF4000;\n}\n.apg-phrase {\n color: #000000;\n background-color: #8caae6;\n}\n.apg-empty-phrase {\n color: #0fbd0f;\n}\ntable.apg-state {\n font-family: monospace;\n margin-top: 5px;\n font-size: 11px;\n line-height: 130%;\n text-align: left;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-state th,\ntable.apg-state td {\n text-align: left;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-state th:nth-last-child(2),\ntable.apg-state td:nth-last-child(2) {\n text-align: right;\n}\ntable.apg-state caption {\n font-size: 125%;\n line-height: 130%;\n font-weight: bold;\n text-align: left;\n}\ntable.apg-stats {\n font-family: monospace;\n margin-top: 5px;\n font-size: 11px;\n line-height: 130%;\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-stats th,\ntable.apg-stats td {\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-stats caption {\n font-size: 125%;\n line-height: 130%;\n font-weight: bold;\n text-align: left;\n}\ntable.apg-trace {\n font-family: monospace;\n margin-top: 5px;\n font-size: 11px;\n line-height: 130%;\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-trace caption {\n font-size: 125%;\n line-height: 130%;\n font-weight: bold;\n text-align: left;\n}\ntable.apg-trace th,\ntable.apg-trace td {\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-trace th:last-child,\ntable.apg-trace th:nth-last-child(2),\ntable.apg-trace td:last-child,\ntable.apg-trace td:nth-last-child(2) {\n text-align: left;\n}\ntable.apg-grammar {\n font-family: monospace;\n margin-top: 5px;\n font-size: 11px;\n line-height: 130%;\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-grammar caption {\n font-size: 125%;\n line-height: 130%;\n font-weight: bold;\n text-align: left;\n}\ntable.apg-grammar th,\ntable.apg-grammar td {\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-grammar th:last-child,\ntable.apg-grammar td:last-child {\n text-align: left;\n}\ntable.apg-rules {\n font-family: monospace;\n margin-top: 5px;\n font-size: 11px;\n line-height: 130%;\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-rules caption {\n font-size: 125%;\n line-height: 130%;\n font-weight: bold;\n text-align: left;\n}\ntable.apg-rules th,\ntable.apg-rules td {\n text-align: right;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-rules a {\n color: #003399 !important;\n}\ntable.apg-rules a:hover {\n color: #8caae6 !important;\n}\ntable.apg-attrs {\n font-family: monospace;\n margin-top: 5px;\n font-size: 11px;\n line-height: 130%;\n text-align: center;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-attrs caption {\n font-size: 125%;\n line-height: 130%;\n font-weight: bold;\n text-align: left;\n}\ntable.apg-attrs th,\ntable.apg-attrs td {\n text-align: center;\n border: 1px solid black;\n border-collapse: collapse;\n}\ntable.apg-attrs th:nth-child(1),\ntable.apg-attrs th:nth-child(2),\ntable.apg-attrs th:nth-child(3) {\n text-align: right;\n}\ntable.apg-attrs td:nth-child(1),\ntable.apg-attrs td:nth-child(2),\ntable.apg-attrs td:nth-child(3) {\n text-align: right;\n}\ntable.apg-attrs a {\n color: #003399 !important;\n}\ntable.apg-attrs a:hover {\n color: #8caae6 !important;\n}\n"}},5298(e){e.exports={ALT:1,CAT:2,REP:3,RNM:4,TRG:5,TBS:6,TLS:7,UDT:11,AND:12,NOT:13,BKR:14,BKA:15,BKN:16,ABG:17,AEN:18,ACTIVE:100,MATCH:101,EMPTY:102,NOMATCH:103,SEM_PRE:200,SEM_POST:201,SEM_OK:300,SEM_SKIP:301,ATTR_N:400,ATTR_R:401,ATTR_MR:402,LOOKAROUND_NONE:500,LOOKAROUND_AHEAD:501,LOOKAROUND_BEHIND:502,BKR_MODE_UM:601,BKR_MODE_PM:602,BKR_MODE_CS:603,BKR_MODE_CI:604}},4202(e,t,r){e.exports={ast:r(7770),circular:r(6660),ids:r(5298),parser:r(1355),stats:r(7857),trace:r(8127),utils:r(1174),emitcss:r(9724),style:r(2475)}},1355(e,t,r){e.exports=function(){const e=r(5298),t=r(1174),n="parser.js: ",i=this;let s;this.ast=null,this.stats=null,this.trace=null,this.callbacks=[];let o,a,c,u,l=null,h=null,d=0,f=0,p=0,g=null,m=null,y=null,b=null,w=null,v=0,A=1/0,E=1/0;const x=function(t,r,i){const o=`${n}evaluateRule(): `;if(t>=y.length)throw new Error(`${o}rule index: ${t} out of range`);if(r>=c)throw new Error(`${o}phrase index: ${r} out of range`);const{length:a}=l;l.push({type:e.RNM,index:t}),s(a,r,i),l.pop()},k=function(t,r,i){const o=`${n}evaluateUdt(): `;if(t>=b.length)throw new Error(`${o}udt index: ${t} out of range`);if(r>=c)throw new Error(`${o}phrase index: ${r} out of range`);const{length:a}=l;l.push({type:e.UDT,empty:b[t].empty,index:t}),s(a,r,i),l.pop()},T=function(){d=0,f=0,p=0,v=0,u=[{lookAround:e.LOOKAROUND_NONE,anchor:0,charsEnd:0,charsLength:0}],y=null,b=null,h=null,o=0,a=0,c=0,g=null,m=null,w=null,l=null},S=function(){const e=[];this.push=function(){e.push(function(){const t=e[e.length-1],r={};for(const e in t)r[e]=t[e];return r}())},this.pop=function(t){let r=t;if(r||(r=e.length-1),r<1||r>e.length)throw new Error(`${n}backRef.pop(): bad length: ${r}`);return e.length=r,e[e.length-1]},this.length=function(){return e.length},this.savePhrase=function(t,r,n){e[e.length-1][t]={phraseIndex:r,phraseLength:n}},this.getPhrase=function(t){return e[e.length-1][t]},function(){const t={};y.forEach(e=>{e.isBkr&&(t[e.lower]=null)}),b.length>0&&b.forEach(e=>{e.isBkr&&(t[e.lower]=null)}),e.push(t)}()},I=function(){const t=this;this.state=e.ACTIVE,this.phraseLength=0,this.ruleIndex=0,this.udtIndex=0,this.lookAround=u[u.length-1],this.uFrame=new S,this.pFrame=new S,this.evaluateRule=x,this.evaluateUdt=k,this.refresh=function(){t.state=e.ACTIVE,t.phraseLength=0,t.lookAround=u[u.length-1]}},C=function(){return u[u.length-1]},B=function(){return u.length>1},N=function(e,r,i){const s=`${n}initializeInputChars(): `;let u=e,l=r,d=i;if(void 0===u)throw new Error(`${s}input string is undefined`);if(null===u)throw new Error(`${s}input string is null`);if("string"==typeof u)u=t.stringToChars(u);else if(!Array.isArray(u))throw new Error(`${s}input string is not a string or array`);if(u.length>0&&"number"!=typeof u[0])throw new Error(`${s}input string not an array of integers`);if("number"!=typeof l)l=0;else if(l=Math.floor(l),l<0||l>u.length)throw new Error(`${s}input beginning index out of range: ${l}`);if("number"!=typeof d)d=u.length-l;else if(d=Math.floor(d),d<0||d>u.length-l)throw new Error(`${s}input length out of range: ${d}`);h=u,o=l,a=d,c=o+a};this.setMaxTreeDepth=function(e){if("number"!=typeof e)throw new Error(`parser: max tree depth must be integer > 0: ${e}`);if(A=Math.floor(e),A<=0)throw new Error(`parser: max tree depth must be integer > 0: ${e}`)},this.setMaxNodeHits=function(e){if("number"!=typeof e)throw new Error(`parser: max node hits must be integer > 0: ${e}`);if(E=Math.floor(e),E<=0)throw new Error(`parser: max node hits must be integer > 0: ${e}`)};const _=function(t,r,u){let d;const A=`${n}parse(): `;!function(e){const t=`${n}initializeGrammar(): `;if(!e)throw new Error(`${t}grammar object undefined`);if("grammarObject"!==e.grammarObject)throw new Error(`${t}bad grammar object`);y=e.rules,b=e.udts}(t);const E=function(e){const t=`${n}initializeStartRule(): `;let r=null;if("number"==typeof e){if(e>=y.length)throw new Error(`${t}start rule index too large: max: ${y.length}: index: ${e}`);r=e}else{if("string"!=typeof e)throw new Error(`${t}type of start rule '${typeof e}' not recognized`);{const n=e.toLowerCase();for(let e=0;e<y.length;e+=1)if(n===y[e].lower){r=y[e].index;break}if(null===r)throw new Error(`${t}start rule name '${e}' not recognized`)}}return r}(r);!function(){const e=`${n}initializeCallbacks(): `;let t,r;for(g=[],m=[],t=0;t<y.length;t+=1)g[t]=null;for(t=0;t<b.length;t+=1)m[t]=null;const s=[];for(t=0;t<y.length;t+=1)s.push(y[t].lower);for(t=0;t<b.length;t+=1)s.push(b[t].lower);for(const n in i.callbacks){if(t=s.indexOf(n.toLowerCase()),t<0)throw new Error(`${e}syntax callback '${n}' not a rule or udt name`);if(r=i.callbacks[n],r||(r=null),"function"!=typeof r&&null!==r)throw new Error(`${e}syntax callback[${n}] must be function reference or 'false' (false/null/undefined/etc.)`);t<y.length?g[t]=r:m[t-y.length]=r}for(t=0;t<b.length;t+=1)if(null===m[t])throw new Error(`${e}all UDT callbacks must be defined. UDT callback[${b[t].lower}] not a function reference`)}(),function(){const e=`${n}initializeTrace(): `;for(;;){if(void 0===i.trace){i.trace=null;break}if(null===i.trace)break;if("traceObject"!==i.trace.traceObject)throw new Error(`${e}trace object not recognized`);break}null!==i.trace&&i.trace.init(y,b,h)}(),function(){const e=`${n}initializeStats(): `;for(;;){if(void 0===i.stats){i.stats=null;break}if(null===i.stats)break;if("statsObject"!==i.stats.statsObject)throw new Error(`${e}stats object not recognized`);break}null!==i.stats&&i.stats.init(y,b)}(),function(){const e=`${n}initializeAst(): `;for(;;){if(void 0===i.ast){i.ast=null;break}if(null===i.ast)break;if("astObject"!==i.ast.astObject)throw new Error(`${e}ast object not recognized`);break}null!==i.ast&&i.ast.init(y,b,h)}();const x=new I;switch(null!=u&&(w=u),l=[{type:e.RNM,index:E}],s(0,o,x),l=null,x.state){case e.ACTIVE:throw new Error(`${A}final state should never be 'ACTIVE'`);case e.NOMATCH:d=!1;break;case e.EMPTY:case e.MATCH:d=x.phraseLength===a;break;default:throw new Error("unrecognized state")}return{success:d,state:x.state,length:a,matched:x.phraseLength,maxMatched:v,maxTreeDepth:f,nodeHits:p,inputLength:h.length,subBegin:o,subEnd:c,subLength:a}};this.parseSubstring=function(e,t,r,n,i,s){return T(),N(r,n,i),_(e,t,s)},this.parse=function(e,t,r,n){return T(),N(r,0,r.length),_(e,t,n)};const M=function(t,r,n){const i=l[t];for(let t=0;t<i.children.length&&(s(i.children[t],r,n),n.state===e.NOMATCH);t+=1);},R=function(t,r,i,s){if(r.phraseLength>i){let e=`${n}opRNM(${t.name}): callback function error: `;throw e+=`sysData.phraseLength: ${r.phraseLength}`,e+=` must be <= remaining chars: ${i}`,new Error(e)}switch(r.state){case e.ACTIVE:if(!0!==s)throw new Error(`${n}opRNM(${t.name}): callback function return error. ACTIVE state not allowed.`);break;case e.EMPTY:r.phraseLength=0;break;case e.MATCH:0===r.phraseLength&&(r.state=e.EMPTY);break;case e.NOMATCH:r.phraseLength=0;break;default:throw new Error(`${n}opRNM(${t.name}): callback function return error. Unrecognized return state: ${r.state}`)}},P=function(t,r,n){let o,a,u,d,f,p;const m=l[t],b=y[m.index],v=g[b.index],A=!B();if(A&&(a=i.ast&&i.ast.ruleDefined(m.index),a&&(o=i.ast.getLength(),i.ast.down(m.index,y[m.index].name)),d=n.uFrame.length(),f=n.pFrame.length(),n.uFrame.push(),n.pFrame.push(),p=n.pFrame,n.pFrame=new S),null===v)u=l,l=b.opcodes,s(0,r,n),l=u;else{const t=c-r;n.ruleIndex=b.index,v(n,h,r,w),R(b,n,t,!0),n.state===e.ACTIVE&&(u=l,l=b.opcodes,s(0,r,n),l=u,n.ruleIndex=b.index,v(n,h,r,w),R(b,n,t,!1))}A&&(a&&(n.state===e.NOMATCH?i.ast.setLength(o):i.ast.up(m.index,b.name,r,n.phraseLength)),n.pFrame=p,n.state===e.NOMATCH?(n.uFrame.pop(d),n.pFrame.pop(f)):b.isBkr&&(n.pFrame.savePhrase(b.lower,r,n.phraseLength),n.uFrame.savePhrase(b.lower,r,n.phraseLength)))},O=function(t,r,s){let o,a,u,d,f,p;const g=l[t],v=b[g.index];s.UdtIndex=v.index;const A=!B();A&&(u=i.ast&&i.ast.udtDefined(g.index),u&&(a=y.length+g.index,o=i.ast.getLength(),i.ast.down(a,v.name)),d=s.uFrame.length(),f=s.pFrame.length(),s.uFrame.push(),s.pFrame.push(),p=s.pFrame,s.pFrame=new S);const E=c-r;m[g.index](s,h,r,w),function(t,r,i){if(r.phraseLength>i){let e=`${n}opUDT(${t.name}): callback function error: `;throw e+=`sysData.phraseLength: ${r.phraseLength}`,e+=` must be <= remaining chars: ${i}`,new Error(e)}switch(r.state){case e.ACTIVE:throw new Error(`${n}opUDT(${t.name}): callback function return error. ACTIVE state not allowed.`);case e.EMPTY:if(!1===t.empty)throw new Error(`${n}opUDT(${t.name}): callback function return error. May not return EMPTY.`);r.phraseLength=0;break;case e.MATCH:if(0===r.phraseLength){if(!1===t.empty)throw new Error(`${n}opUDT(${t.name}): callback function return error. May not return EMPTY.`);r.state=e.EMPTY}break;case e.NOMATCH:r.phraseLength=0;break;default:throw new Error(`${n}opUDT(${t.name}): callback function return error. Unrecognized return state: ${r.state}`)}}(v,s,E),A&&(u&&(s.state===e.NOMATCH?i.ast.setLength(o):i.ast.up(a,v.name,r,s.phraseLength)),s.pFrame=p,s.state===e.NOMATCH?(s.uFrame.pop(d),s.pFrame.pop(f)):v.isBkr&&(s.pFrame.savePhrase(v.lower,r,s.phraseLength),s.uFrame.savePhrase(v.lower,r,s.phraseLength)))},L=function(t,r,n){u.push({lookAround:e.LOOKAROUND_AHEAD,anchor:r,charsEnd:c,charsLength:a}),c=h.length,a=h.length-o,s(t+1,r,n);const i=u.pop();switch(c=i.charsEnd,a=i.charsLength,n.phraseLength=0,n.state){case e.EMPTY:case e.MATCH:n.state=e.EMPTY;break;case e.NOMATCH:n.state=e.NOMATCH;break;default:throw new Error(`opAND: invalid state ${n.state}`)}},D=function(t,r,n){u.push({lookAround:e.LOOKAROUND_AHEAD,anchor:r,charsEnd:c,charsLength:a}),c=h.length,a=h.length-o,s(t+1,r,n);const i=u.pop();switch(c=i.charsEnd,a=i.charsLength,n.phraseLength=0,n.state){case e.EMPTY:case e.MATCH:n.state=e.NOMATCH;break;case e.NOMATCH:n.state=e.EMPTY;break;default:throw new Error(`opNOT: invalid state ${n.state}`)}},U=function(t,r,n){n.state=e.NOMATCH,n.phraseLength=0,n.state=0===r?e.EMPTY:e.NOMATCH},F=function(t,r,n){n.state=e.NOMATCH,n.phraseLength=0,n.state=r===h.length?e.EMPTY:e.NOMATCH},H=function(t,r,n){switch(u.push({lookAround:e.LOOKAROUND_BEHIND,anchor:r}),s(t+1,r,n),u.pop(),n.phraseLength=0,n.state){case e.EMPTY:case e.MATCH:n.state=e.EMPTY;break;case e.NOMATCH:n.state=e.NOMATCH;break;default:throw new Error(`opBKA: invalid state ${n.state}`)}},z=function(t,r,n){switch(u.push({lookAround:e.LOOKAROUND_BEHIND,anchor:r}),s(t+1,r,n),u.pop(),n.phraseLength=0,n.state){case e.EMPTY:case e.MATCH:n.state=e.NOMATCH;break;case e.NOMATCH:n.state=e.EMPTY;break;default:throw new Error(`opBKN: invalid state ${n.state}`)}};s=function(t,r,n){let o=!0;const a=l[t];if(p+=1,p>E)throw new Error(`parser: maximum number of node hits exceeded: ${E}`);if(d+=1,d>f&&(f=d,f>A))throw new Error(`parser: maximum parse tree depth exceeded: ${A}`);if(n.refresh(),null!==i.trace){const e=C();i.trace.down(a,n.state,r,n.phraseLength,e.anchor,e.lookAround)}if(u[u.length-1].lookAround===e.LOOKAROUND_BEHIND)switch(a.type){case e.ALT:M(t,r,n);break;case e.CAT:!function(t,r,n){let o,a,c,u;const h=l[t],d=n.uFrame.length(),f=n.pFrame.length();i.ast&&(a=i.ast.getLength()),o=!0,c=r,u=0;for(let t=h.children.length-1;t>=0;t-=1)if(s(h.children[t],c,n),c-=n.phraseLength,u+=n.phraseLength,n.state===e.NOMATCH){o=!1;break}o?(n.state=0===u?e.EMPTY:e.MATCH,n.phraseLength=u):(n.state=e.NOMATCH,n.phraseLength=0,n.uFrame.pop(d),n.pFrame.pop(f),i.ast&&i.ast.setLength(a))}(t,r,n);break;case e.REP:!function(t,r,n){let o,a,c,u;const h=l[t];a=r,c=0,u=0;const d=n.uFrame.length(),f=n.pFrame.length();for(i.ast&&(o=i.ast.getLength());!(a<=0)&&(s(t+1,a,n),n.state!==e.NOMATCH)&&n.state!==e.EMPTY&&(u+=1,c+=n.phraseLength,a-=n.phraseLength,u!==h.max););n.state===e.EMPTY||u>=h.min?(n.state=0===c?e.EMPTY:e.MATCH,n.phraseLength=c):(n.state=e.NOMATCH,n.phraseLength=0,n.uFrame.pop(d),n.pFrame.pop(f),i.ast&&i.ast.setLength(o))}(t,r,n);break;case e.RNM:P(t,r,n);break;case e.UDT:O(t,r,n);break;case e.AND:L(t,r,n);break;case e.NOT:D(t,r,n);break;case e.TRG:!function(t,r,n){const i=l[t];if(n.state=e.NOMATCH,n.phraseLength=0,r>0){const t=h[r-1];i.min<=t&&t<=i.max&&(n.state=e.MATCH,n.phraseLength=1)}}(t,r,n);break;case e.TBS:!function(t,r,n){let i;const s=l[t];n.state=e.NOMATCH;const o=s.string.length,a=r-o;if(a>=0){for(i=0;i<o;i+=1)if(h[a+i]!==s.string[i])return;n.state=e.MATCH,n.phraseLength=o}}(t,r,n);break;case e.TLS:!function(t,r,n){let i;const s=l[t];n.state=e.NOMATCH;const o=s.string.length;if(0===o)return void(n.state=e.EMPTY);const a=r-o;if(a>=0){for(let e=0;e<o;e+=1)if(i=h[a+e],i>=65&&i<=90&&(i+=32),i!==s.string[e])return;n.state=e.MATCH,n.phraseLength=o}}(t,r,n);break;case e.BKR:!function(t,r,n){let i,s,o,a;const c=l[t];n.state=e.NOMATCH,n.phraseLength=0,a=c.index<y.length?y[c.index].lower:b[c.index-y.length].lower;const u=c.bkrMode===e.BKR_MODE_PM?n.pFrame.getPhrase(a):n.uFrame.getPhrase(a),d=c.bkrCase===e.BKR_MODE_CI;if(null===u)return;const f=u.phraseIndex,p=u.phraseLength;if(0===p)return n.state=e.EMPTY,void(n.phraseLength=0);const g=r-p;if(g>=0){if(d){for(i=0;i<p;i+=1)if(s=h[g+i],o=h[f+i],s>=65&&s<=90&&(s+=32),o>=65&&o<=90&&(o+=32),s!==o)return;n.state=e.MATCH,n.phraseLength=p}else for(i=0;i<p;i+=1)if(s=h[g+i],o=h[f+i],s!==o)return;n.state=e.MATCH,n.phraseLength=p}}(t,r,n);break;case e.BKA:H(t,r,n);break;case e.BKN:z(t,r,n);break;case e.ABG:U(0,r,n);break;case e.AEN:F(0,r,n);break;default:o=!1}else switch(a.type){case e.ALT:M(t,r,n);break;case e.CAT:!function(t,r,n){let o,a,c,u;const h=l[t],d=n.uFrame.length(),f=n.pFrame.length();i.ast&&(a=i.ast.getLength()),o=!0,c=r,u=0;for(let t=0;t<h.children.length;t+=1){if(s(h.children[t],c,n),n.state===e.NOMATCH){o=!1;break}c+=n.phraseLength,u+=n.phraseLength}o?(n.state=0===u?e.EMPTY:e.MATCH,n.phraseLength=u):(n.state=e.NOMATCH,n.phraseLength=0,n.uFrame.pop(d),n.pFrame.pop(f),i.ast&&i.ast.setLength(a))}(t,r,n);break;case e.REP:!function(t,r,n){let o,a,u,h;const d=l[t];if(0===d.max)return n.state=e.EMPTY,void(n.phraseLength=0);a=r,u=0,h=0;const f=n.uFrame.length(),p=n.pFrame.length();for(i.ast&&(o=i.ast.getLength());!(a>=c)&&(s(t+1,a,n),n.state!==e.NOMATCH)&&n.state!==e.EMPTY&&(h+=1,u+=n.phraseLength,a+=n.phraseLength,h!==d.max););n.state===e.EMPTY||h>=d.min?(n.state=0===u?e.EMPTY:e.MATCH,n.phraseLength=u):(n.state=e.NOMATCH,n.phraseLength=0,n.uFrame.pop(f),n.pFrame.pop(p),i.ast&&i.ast.setLength(o))}(t,r,n);break;case e.RNM:P(t,r,n);break;case e.UDT:O(t,r,n);break;case e.AND:L(t,r,n);break;case e.NOT:D(t,r,n);break;case e.TRG:!function(t,r,n){const i=l[t];n.state=e.NOMATCH,r<c&&i.min<=h[r]&&h[r]<=i.max&&(n.state=e.MATCH,n.phraseLength=1)}(t,r,n);break;case e.TBS:!function(t,r,n){let i;const s=l[t],o=s.string.length;if(n.state=e.NOMATCH,r+o<=c){for(i=0;i<o;i+=1)if(h[r+i]!==s.string[i])return;n.state=e.MATCH,n.phraseLength=o}}(t,r,n);break;case e.TLS:!function(t,r,n){let i,s;const o=l[t];n.state=e.NOMATCH;const a=o.string.length;if(0!==a){if(r+a<=c){for(i=0;i<a;i+=1)if(s=h[r+i],s>=65&&s<=90&&(s+=32),s!==o.string[i])return;n.state=e.MATCH,n.phraseLength=a}}else n.state=e.EMPTY}(t,r,n);break;case e.BKR:!function(t,r,n){let i,s,o,a;const u=l[t];n.state=e.NOMATCH,a=u.index<y.length?y[u.index].lower:b[u.index-y.length].lower;const d=u.bkrMode===e.BKR_MODE_PM?n.pFrame.getPhrase(a):n.uFrame.getPhrase(a),f=u.bkrCase===e.BKR_MODE_CI;if(null===d)return;const p=d.phraseIndex,g=d.phraseLength;if(0!==g){if(r+g<=c){if(f){for(i=0;i<g;i+=1)if(s=h[r+i],o=h[p+i],s>=65&&s<=90&&(s+=32),o>=65&&o<=90&&(o+=32),s!==o)return;n.state=e.MATCH,n.phraseLength=g}else for(i=0;i<g;i+=1)if(s=h[r+i],o=h[p+i],s!==o)return;n.state=e.MATCH,n.phraseLength=g}}else n.state=e.EMPTY}(t,r,n);break;case e.BKA:H(t,r,n);break;case e.BKN:z(t,r,n);break;case e.ABG:U(0,r,n);break;case e.AEN:F(0,r,n);break;default:o=!1}if(!B()&&r+n.phraseLength>v&&(v=r+n.phraseLength),null!==i.stats&&i.stats.collect(a,n),null!==i.trace){const e=C();i.trace.up(a,n.state,r,n.phraseLength,e.anchor,e.lookAround)}return d-=1,o}}},7857(e,t,r){e.exports=function(){const e=r(5298),t=r(1174),n=r(2475);let i=[],s=[];const o=[];let a;const c=[],u=[];this.statsObject="statsObject";const l=function(e,t){return e.lower<t.lower?-1:e.lower>t.lower?1:0},h=function(e,t){return e.total<t.total?1:e.total>t.total?-1:l(e,t)},d=function(e,t){return e.index<t.index?-1:e.index>t.index?1:0},f=function(){this.empty=0,this.match=0,this.nomatch=0,this.total=0},p=function(t,r){switch(t.total+=1,r){case e.EMPTY:t.empty+=1;break;case e.MATCH:t.match+=1;break;case e.NOMATCH:t.nomatch+=1;break;default:throw new Error(`stats.js: collect(): incStat(): unrecognized state: ${r}`)}},g=function(e,t){let r="";return r+="<tr>",r+=`<td class="${n.CLASS_ACTIVE}">${e}</td>`,r+=`<td class="${n.CLASS_EMPTY}">${t.empty}</td>`,r+=`<td class="${n.CLASS_MATCH}">${t.match}</td>`,r+=`<td class="${n.CLASS_NOMATCH}">${t.nomatch}</td>`,r+=`<td class="${n.CLASS_ACTIVE}">${t.total}</td>`,r+="</tr>\n",r},m=function(){let t="";return t+=g("ALT",o[e.ALT]),t+=g("CAT",o[e.CAT]),t+=g("REP",o[e.REP]),t+=g("RNM",o[e.RNM]),t+=g("TRG",o[e.TRG]),t+=g("TBS",o[e.TBS]),t+=g("TLS",o[e.TLS]),t+=g("UDT",o[e.UDT]),t+=g("AND",o[e.AND]),t+=g("NOT",o[e.NOT]),t+=g("BKR",o[e.BKR]),t+=g("BKA",o[e.BKA]),t+=g("BKN",o[e.BKN]),t+=g("ABG",o[e.ABG]),t+=g("AEN",o[e.AEN]),t+=g("totals",a),t},y=function(){let e="";e+="<tr><th></th><th></th><th></th><th></th><th></th></tr>\n",e+="<tr><th>rules</th><th></th><th></th><th></th><th></th></tr>\n";for(let t=0;t<i.length;t+=1)c[t].total>0&&(e+="<tr>",e+=`<td class="${n.CLASS_ACTIVE}">${c[t].name}</td>`,e+=`<td class="${n.CLASS_EMPTY}">${c[t].empty}</td>`,e+=`<td class="${n.CLASS_MATCH}">${c[t].match}</td>`,e+=`<td class="${n.CLASS_NOMATCH}">${c[t].nomatch}</td>`,e+=`<td class="${n.CLASS_ACTIVE}">${c[t].total}</td>`,e+="</tr>\n");if(s.length>0){e+="<tr><th></th><th></th><th></th><th></th><th></th></tr>\n",e+="<tr><th>udts</th><th></th><th></th><th></th><th></th></tr>\n";for(let t=0;t<s.length;t+=1)u[t].total>0&&(e+="<tr>",e+=`<td class="${n.CLASS_ACTIVE}">${u[t].name}</td>`,e+=`<td class="${n.CLASS_EMPTY}">${u[t].empty}</td>`,e+=`<td class="${n.CLASS_MATCH}">${u[t].match}</td>`,e+=`<td class="${n.CLASS_NOMATCH}">${u[t].nomatch}</td>`,e+=`<td class="${n.CLASS_ACTIVE}">${u[t].total}</td>`,e+="</tr>\n")}return e};this.validate=function(e){let t=!1;return"string"==typeof e&&"stats"===e&&(t=!0),t},this.init=function(t,r){i=t,s=r,function(){o.length=0,a=new f,o[e.ALT]=new f,o[e.CAT]=new f,o[e.REP]=new f,o[e.RNM]=new f,o[e.TRG]=new f,o[e.TBS]=new f,o[e.TLS]=new f,o[e.UDT]=new f,o[e.AND]=new f,o[e.NOT]=new f,o[e.BKR]=new f,o[e.BKA]=new f,o[e.BKN]=new f,o[e.ABG]=new f,o[e.AEN]=new f,c.length=0;for(let e=0;e<i.length;e+=1)c.push({empty:0,match:0,nomatch:0,total:0,name:i[e].name,lower:i[e].lower,index:i[e].index});if(s.length>0){u.length=0;for(let e=0;e<s.length;e+=1)u.push({empty:0,match:0,nomatch:0,total:0,name:s[e].name,lower:s[e].lower,index:s[e].index})}}()},this.collect=function(t,r){p(a,r.state,r.phraseLength),p(o[t.type],r.state,r.phraseLength),t.type===e.RNM&&p(c[t.index],r.state,r.phraseLength),t.type===e.UDT&&p(u[t.index],r.state,r.phraseLength)},this.toHtml=function(e,t){let r="";for(r+=`<table class="${n.CLASS_STATS}">\n`,"string"==typeof t&&(r+=`<caption>${t}</caption>\n`),r+=`<tr><th class="${n.CLASS_ACTIVE}">ops</th>\n`,r+=`<th class="${n.CLASS_EMPTY}">EMPTY</th>\n`,r+=`<th class="${n.CLASS_MATCH}">MATCH</th>\n`,r+=`<th class="${n.CLASS_NOMATCH}">NOMATCH</th>\n`,r+=`<th class="${n.CLASS_ACTIVE}">totals</th></tr>\n`;;){if(void 0===e){r+=m();break}if(null===e){r+=m();break}if("ops"===e){r+=m();break}if("index"===e){c.sort(d),u.length>0&&u.sort(d),r+=m(),r+=y();break}if("hits"===e){c.sort(h),u.length>0&&u.sort(d),r+=m(),r+=y();break}if("alpha"===e){c.sort(l),u.length>0&&u.sort(l),r+=m(),r+=y();break}break}return r+="</table>\n",r},this.toHtmlPage=function(e,r,n){return t.htmlToPage(this.toHtml(e,r),n)}}},2475(e){e.exports={CLASS_MONOSPACE:"apg-mono",CLASS_ACTIVE:"apg-active",CLASS_EMPTY:"apg-empty",CLASS_MATCH:"apg-match",CLASS_NOMATCH:"apg-nomatch",CLASS_LOOKAHEAD:"apg-lh-match",CLASS_LOOKBEHIND:"apg-lb-match",CLASS_REMAINDER:"apg-remainder",CLASS_CTRLCHAR:"apg-ctrl-char",CLASS_LINEEND:"apg-line-end",CLASS_ERROR:"apg-error",CLASS_PHRASE:"apg-phrase",CLASS_EMPTYPHRASE:"apg-empty-phrase",CLASS_STATE:"apg-state",CLASS_STATS:"apg-stats",CLASS_TRACE:"apg-trace",CLASS_GRAMMAR:"apg-grammar",CLASS_RULES:"apg-rules",CLASS_RULESLINK:"apg-rules-link",CLASS_ATTRIBUTES:"apg-attrs"}},8127(e,t,r){e.exports=function(){const e=r(1174),t=r(2475),n=new(r(6660)),i=r(5298),s="trace.js: ",o=this,a=16,c=80,u=[];let l=5e3,h=-1,d=0,f=0;const p=[];let g=null,m=null,y=null;const b=[],w=[],v=`<span class="${t.CLASS_LINEEND}">•</span>`,A=`<span class="${t.CLASS_LINEEND}">…</span>`,E=`<span class="${t.CLASS_EMPTY}">𝜺</span>`;this.traceObject="traceObject",this.filter={operators:[],rules:[]},this.setMaxRecords=function(e,t){h=-1,"number"==typeof e&&e>0?(l=Math.ceil(e),"number"==typeof t&&(h=Math.floor(t),h<0&&(h=-1))):l=0},this.getMaxRecords=function(){return l},this.getLastRecord=function(){return h},this.init=function(e,t,r){u.length=0,p.length=0,d=0,f=0,g=r,m=e,y=t,function(){const e=function(e){b[i.ALT]=e,b[i.CAT]=e,b[i.REP]=e,b[i.TLS]=e,b[i.TBS]=e,b[i.TRG]=e,b[i.AND]=e,b[i.NOT]=e,b[i.BKR]=e,b[i.BKA]=e,b[i.BKN]=e,b[i.ABG]=e,b[i.AEN]=e};let t=0;for(const e in o.filter.operators)t+=1;if(0!==t){for(const t in o.filter.operators){const r=t.toUpperCase();if("<ALL>"===r)return void e(!0);if("<NONE>"===r)return void e(!1)}e(!1);for(const e in o.filter.operators){const t=e.toUpperCase();if("ALT"===t)b[i.ALT]=!0===o.filter.operators[e];else if("CAT"===t)b[i.CAT]=!0===o.filter.operators[e];else if("REP"===t)b[i.REP]=!0===o.filter.operators[e];else if("AND"===t)b[i.AND]=!0===o.filter.operators[e];else if("NOT"===t)b[i.NOT]=!0===o.filter.operators[e];else if("TLS"===t)b[i.TLS]=!0===o.filter.operators[e];else if("TBS"===t)b[i.TBS]=!0===o.filter.operators[e];else if("TRG"===t)b[i.TRG]=!0===o.filter.operators[e];else if("BKR"===t)b[i.BKR]=!0===o.filter.operators[e];else if("BKA"===t)b[i.BKA]=!0===o.filter.operators[e];else if("BKN"===t)b[i.BKN]=!0===o.filter.operators[e];else if("ABG"===t)b[i.ABG]=!0===o.filter.operators[e];else{if("AEN"!==t)throw new Error(`${s}initOpratorFilter: '${e}' not a valid operator name. Must be <all>, <none>, alt, cat, rep, tls, tbs, trg, and, not, bkr, bka or bkn`);b[i.AEN]=!0===o.filter.operators[e]}}}else e(!1)}(),function(){const e=function(e){b[i.RNM]=e,b[i.UDT]=e;const t=m.length+y.length;w.length=0;for(let r=0;r<t;r+=1)w.push(e)};let t,r;const n=[];for(r=0;r<m.length;r+=1)n.push(m[r].lower);for(r=0;r<y.length;r+=1)n.push(y[r].lower);w.length=0,t=0;for(const e in o.filter.rules)t+=1;if(0!==t){for(const t in o.filter.rules){const r=t.toLowerCase();if("<all>"===r)return void e(!0);if("<none>"===r)return void e(!1)}e(!1),b[i.RNM]=!0,b[i.UDT]=!0;for(const e in o.filter.rules){const t=e.toLowerCase();if(r=n.indexOf(t),r<0)throw new Error(`${s}initRuleFilter: '${e}' not a valid rule or udt name`);w[r]=!0===o.filter.rules[e]}}else e(!0)}(),n.init(l)};const x=function(e){let t=!1;return t=e.type===i.RNM?!(!b[e.type]||!w[e.index]):e.type===i.UDT?!(!b[e.type]||!w[m.length+e.index]):b[e.type],t},k=function(e){return-1===h||e<=h};this.down=function(e,t,r,i,s,o){k(d)&&x(e)&&(p.push(d),u[n.increment()]={dirUp:!1,depth:f,thisLine:d,thatLine:void 0,opcode:e,state:t,phraseIndex:r,phraseLength:i,lookAnchor:s,lookAround:o},d+=1,f+=1)},this.up=function(e,t,r,i,s,o){if(k(d)&&x(e)){const a=d,c=p.pop(),l=n.getListIndex(c);-1!==l&&(u[l].thatLine=a),f-=1,u[n.increment()]={dirUp:!0,depth:f,thisLine:a,thatLine:c,opcode:e,state:t,phraseIndex:r,phraseLength:i,lookAnchor:s,lookAround:o},d+=1}},this.toTree=function(t){const r=function(){function t(t,r){let n,s,o;if(r)switch(t.op={id:r.type,name:e.opcodeToString(r.type)},t.opData=void 0,r.type){case i.RNM:t.opData=m[r.index].name;break;case i.UDT:t.opData=y[r.index].name;break;case i.BKR:n=r.index<m.length?m[r.index].name:y[r.index-m.length].name,s=r.bkrCase===i.BKR_MODE_CI?"%i":"%s",o=r.bkrMode===i.BKR_MODE_UM?"%u":"%p",t.opData=`\\\\${s}${o}${n}`;break;case i.TLS:t.opData=[];for(let e=0;e<r.string.length;e+=1)t.opData.push(r.string[e]);break;case i.TBS:t.opData=[];for(let e=0;e<r.string.length;e+=1)t.opData.push(r.string[e]);break;case i.TRG:case i.REP:t.opData=[r.min,r.max];break;default:throw new Error("unrecognized opcode")}else t.op={id:void 0,name:void 0},t.opData=void 0}function r(e,t,r){return e===i.MATCH?{index:t,length:r}:e===i.NOMATCH||e===i.EMPTY?{index:t,length:0}:null}let s=-1;function o(n,i,o){const a={id:s++,branch:-1,parent:n,up:!1,down:!1,depth:o,children:[]};return i?(a.down=!0,a.state={id:i.state,name:e.stateToString(i.state)},a.phrase=null,t(a,i.opcode)):(a.state={id:void 0,name:void 0},a.phrase=r(),t(a,void 0)),a}function a(n,i){i&&(n.up=!0,n.state={id:i.state,name:e.stateToString(i.state)},n.phrase=r(i.state,i.phraseIndex,i.phraseLength),n.down||t(n,i.opcode))}let c=0,l=-1,h=1;const d=[];let p,b,w,v,A=!0;const E=o(null,null,-1);for(d.push(E),b=E,n.forEach(e=>{if(v=u[e],A&&(A=!1,v.depth>0)){const e=v.dirUp?v.depth+1:v.depth;for(let t=0;t<e;t+=1)w=b,b=o(b,null,t),d.push(b),w.children.push(b)}v.dirUp?(b=d.pop(),a(b,v),b=d[d.length-1]):(w=b,b=o(b,v,v.depth),d.push(b),w.children.push(b))});d.length>1;)b=d.pop(),a(b,null);if(0===E.children.length)throw new Error("trace.toTree(): parse tree has no nodes");if(0===d.length)throw new Error("trace.toTree(): integrity check: dummy root node disappeared?");p=E.children[0];let x=p;for(;p&&!p.down&&!p.up;)x=p,p=p.children[0];p=x,p.leftMost=!0,p.rightMost=!0,function e(t){if(l+=1,t.branch=h,l>f&&(f=l),0===t.children.length)c+=1;else for(let r=0;r<t.children.length;r+=1)r>0&&(h+=1),t.children[r].leftMost=!1,t.children[r].rightMost=!1,t.leftMost&&(t.children[r].leftMost=0===r),t.rightMost&&(t.children[r].rightMost=r===t.children.length-1),e(t.children[r]);l-=1}(p),p.branch=0;const k={string:[]};for(let e=0;e<g.length;e+=1)k.string[e]=g[e];k.rules=[];for(let e=0;e<m.length;e+=1)k.rules[e]=m[e].name;k.udts=[];for(let e=0;e<y.length;e+=1)k.udts[e]=y[e].name;let T;return k.id={},k.id.ALT={id:i.ALT,name:"ALT"},k.id.CAT={id:i.CAT,name:"CAT"},k.id.REP={id:i.REP,name:"REP"},k.id.RNM={id:i.RNM,name:"RNM"},k.id.TLS={id:i.TLS,name:"TLS"},k.id.TBS={id:i.TBS,name:"TBS"},k.id.TRG={id:i.TRG,name:"TRG"},k.id.UDT={id:i.UDT,name:"UDT"},k.id.AND={id:i.AND,name:"AND"},k.id.NOT={id:i.NOT,name:"NOT"},k.id.BKR={id:i.BKR,name:"BKR"},k.id.BKA={id:i.BKA,name:"BKA"},k.id.BKN={id:i.BKN,name:"BKN"},k.id.ABG={id:i.ABG,name:"ABG"},k.id.AEN={id:i.AEN,name:"AEN"},k.id.ACTIVE={id:i.ACTIVE,name:"ACTIVE"},k.id.MATCH={id:i.MATCH,name:"MATCH"},k.id.EMPTY={id:i.EMPTY,name:"EMPTY"},k.id.NOMATCH={id:i.NOMATCH,name:"NOMATCH"},k.treeDepth=f,k.leafNodes=c,T=p.down?p.up?"none":"right":p.up?"left":"both",k.branchesIncomplete=T,k.tree=function e(t,r){let n;const i={};if(i.id=t.id,i.branch=t.branch,i.leftMost=t.leftMost,i.rightMost=t.rightMost,n=t.state.name?t.state.name:"ACTIVE",i.state={id:t.state.id,name:n},n=t.op.name?t.op.name:"?",i.op={id:t.op.id,name:n},"string"==typeof t.opData)i.opData=t.opData;else if(Array.isArray(t.opData)){i.opData=[];for(let e=0;e<t.opData.length;e+=1)i.opData[e]=t.opData[e]}else i.opData=void 0;t.phrase?i.phrase={index:t.phrase.index,length:t.phrase.length}:i.phrase=null,i.depth=t.depth,i.children=[];for(let n=0;n<t.children.length;n+=1)t.children.length,i.children[n]=e(t.children[n],r);return i}(p,p.depth),k}();return t?JSON.stringify(r):r},this.toHtmlPage=function(t,r,n){return e.htmlToPage(this.toHtml(t,r),n)},this.indent=function(e){let t="";for(let r=0;r<e;r+=1)t+=".";return t};const T=function(t,r,n,i,s){if(0===i)return"";let o="";const c=s?",":"";switch(t){case a:o=c+e.charsToHex(r,n,i);break;case 10:if(s)return`,${e.charsToDec(r,n,i)}`;o=c+e.charsToDec(r,n,i);break;case 32:o=e.charsToUnicode(r,n,i);break;default:o=e.charsToAsciiHtml(r,n,i)}return o},S=function(e,r,n,s,o,a){let u,l,h,d,f="",p=v;const g=`<span class="${t.CLASS_REMAINDER}">`,m="</span>";let y=!1;switch(n){case i.EMPTY:f+=E;case i.NOMATCH:case i.ACTIVE:u=s,l=0,h=s,d=r.length-h;break;case i.MATCH:u=s,l=o,h=s+l,d=r.length-h;break;default:throw new Error("unrecognized state")}return p=v,l>c?(l=c,p=A,d=0):l+d>c&&(p=A,d=c-l),l>0&&(f+=a,f+=T(e,r,u,l,y),f+=m,y=!0),d>0&&(f+=g,f+=T(e,r,h,d,y),f+=m),f+p};this.toHtml=function(r,l){let h=8;if("string"==typeof r&&r.length>=3){const e=r.toLowerCase().slice(0,3);"hex"===e?h=a:"dec"===e?h=10:"uni"===e&&(h=32)}let d="";return d+=function(e,r){let n;switch(e){case a:n="hexadecimal";break;case 10:n="decimal";break;case 8:n="ASCII";break;case 32:n="UNICODE";break;default:throw new Error(`${s}htmlHeader: unrecognized mode: ${e}`)}let i="";return i+=`<p>display mode: ${n}</p>\n`,i+=`<table class="${t.CLASS_TRACE}">\n`,"string"==typeof r&&(i+=`<caption>${r}</caption>`),i}(h,l),d+=function(r){if(null===m)return"";let s,l,h,d,f,p,b="";return b+="<tr><th>(a)</th><th>(b)</th><th>(c)</th><th>(d)</th><th>(e)</th><th>(f)</th>",b+="<th>operator</th><th>phrase</th></tr>\n",n.forEach(n=>{const w=u[n];switch(s=w.thisLine,l=void 0!==w.thatLine?w.thatLine:"--",h=!1,d=!1,f=!1,w.lookAround===i.LOOKAROUND_AHEAD&&(h=!0,f=!0,p=w.lookAnchor),w.opcode.type!==i.AND&&w.opcode.type!==i.NOT||(h=!0,f=!0,p=w.phraseIndex),w.lookAround===i.LOOKAROUND_BEHIND&&(d=!0,f=!0,p=w.lookAnchor),w.opcode.type!==i.BKA&&w.opcode.type!==i.BKN||(d=!0,f=!0,p=w.phraseIndex),b+="<tr>",b+=`<td>${s}</td><td>${l}</td>`,b+=`<td>${w.phraseIndex}</td>`,b+=`<td>${w.phraseLength}</td>`,b+=`<td>${w.depth}</td>`,b+="<td>",w.state){case i.ACTIVE:b+=`<span class="${t.CLASS_ACTIVE}">↓ </span>`;break;case i.MATCH:b+=`<span class="${t.CLASS_MATCH}">↑M</span>`;break;case i.NOMATCH:b+=`<span class="${t.CLASS_NOMATCH}">↑N</span>`;break;case i.EMPTY:b+=`<span class="${t.CLASS_EMPTY}">↑E</span>`;break;default:b+=`<span class="${t.CLASS_ACTIVE}">--</span>`}if(b+="</td>",b+="<td>",b+=o.indent(w.depth),h?b+=`<span class="${t.CLASS_LOOKAHEAD}">`:d&&(b+=`<span class="${t.CLASS_LOOKBEHIND}">`),b+=e.opcodeToString(w.opcode.type),w.opcode.type===i.RNM&&(b+=`(${m[w.opcode.index].name}) `),w.opcode.type===i.BKR){const e=w.opcode.bkrCase===i.BKR_MODE_CI?"%i":"%s",t=w.opcode.bkrMode===i.BKR_MODE_UM?"%u":"%p";b+=`(\\${e}${t}${m[w.opcode.index].name}) `}w.opcode.type===i.UDT&&(b+=`(${y[w.opcode.index].name}) `),w.opcode.type===i.TRG&&(b+=`(${function(e,t){let r="";if(t.type===i.TRG)if(e===a||32===e){let n=t.min.toString(16).toUpperCase();n.length%2!=0&&(n=`0${n}`),r+=e===a?"%x":"U+",r+=n,n=t.max.toString(16).toUpperCase(),n.length%2!=0&&(n=`0${n}`),r+=`–${n}`}else r=`%d${t.min.toString(10)}–${t.max.toString(10)}`;return r}(r,w.opcode)}) `),w.opcode.type===i.TBS&&(b+=`(${function(e,t){let r="";if(t.type===i.TBS){const n=Math.min(t.string.length,10);if(e===a||32===e){r+=e===a?"%x":"U+";for(let e=0;e<n;e+=1){let n;e>0&&(r+="."),n=t.string[e].toString(16).toUpperCase(),n.length%2!=0&&(n=`0${n}`),r+=n}}else{r="%d";for(let e=0;e<n;e+=1)e>0&&(r+="."),r+=t.string[e].toString(10)}n<t.string.length&&(r+=A)}return r}(r,w.opcode)}) `),w.opcode.type===i.TLS&&(b+=`(${function(t,r){let n="";if(r.type===i.TLS){const i=Math.min(r.string.length,5);if(t===a||10===t){let e,s,o;t===a?(n="%x",o=16):(n="%d",o=10);for(let t=0;t<i;t+=1)t>0&&(n+="."),s=r.string[t],s>=97&&s<=122?(e=s-32,n+=`${e.toString(o)}/${s.toString(o)}`.toUpperCase()):s>=65&&s<=90?(e=s,s+=32,n+=`${e.toString(o)}/${s.toString(o)}`.toUpperCase()):n+=s.toString(o).toUpperCase();i<r.string.length&&(n+=A)}else{n='"';for(let t=0;t<i;t+=1)n+=e.asciiChars[r.string[t]];i<r.string.length&&(n+=A),n+='"'}}return n}(r,w.opcode)}) `),w.opcode.type===i.REP&&(b+=`(${function(e,t){let r="";if(t.type===i.REP)if(e===a){let e=t.min.toString(16).toUpperCase();e.length%2!=0&&(e=`0${e}`),r=`x${e}`,t.max<1/0?(e=t.max.toString(16).toUpperCase(),e.length%2!=0&&(e=`0${e}`)):e="inf",r+=`–${e}`}else r=t.max<1/0?`${t.min.toString(10)}–${t.max.toString(10)}`:`${t.min.toString(10)}–inf`;return r}(r,w.opcode)}) `),f&&(b+="</span>"),b+="</td>",b+="<td>",b+=d?function(e,r,n,s,o,a){let u,l,h,d,f="",p=v;const g=`<span class="${t.CLASS_LOOKBEHIND}">`,m=`<span class="${t.CLASS_REMAINDER}">`,y="</span>";let b=!1;switch(n){case i.EMPTY:f+=E;case i.NOMATCH:case i.MATCH:case i.ACTIVE:u=s-o,l=a-u,h=a,d=r.length-h;break;default:throw new Error("unrecognized state")}return p=v,l>c?(l=c,p=A,d=0):l+d>c&&(p=A,d=c-l),l>0&&(f+=g,f+=T(e,r,u,l,b),f+=y,b=!0),d>0&&(f+=m,f+=T(e,r,h,d,b),f+=y),f+p}(r,g,w.state,w.phraseIndex,w.phraseLength,p):h?function(e,r,n,i,s){const o=`<span class="${t.CLASS_LOOKAHEAD}">`;return S(e,r,n,i,s,o)}(r,g,w.state,w.phraseIndex,w.phraseLength):function(e,r,n,i,s){const o=`<span class="${t.CLASS_MATCH}">`;return S(e,r,n,i,s,o)}(r,g,w.state,w.phraseIndex,w.phraseLength),b+="</td></tr>\n"}),b+="<tr><th>(a)</th><th>(b)</th><th>(c)</th><th>(d)</th><th>(e)</th><th>(f)</th>",b+="<th>operator</th><th>phrase</th></tr>\n",b+="</table>\n",b}(h),d+=function(){let e="";return e+="</table>\n",e+=`<p class="${t.CLASS_MONOSPACE}">legend:<br>\n`,e+="(a) - line number<br>\n",e+="(b) - matching line number<br>\n",e+="(c) - phrase offset<br>\n",e+="(d) - phrase length<br>\n",e+="(e) - tree depth<br>\n",e+="(f) - operator state<br>\n",e+=` - <span class="${t.CLASS_ACTIVE}">↓</span> phrase opened<br>\n`,e+=` - <span class="${t.CLASS_MATCH}">↑M</span> phrase matched<br>\n`,e+=` - <span class="${t.CLASS_EMPTY}">↑E</span> empty phrase matched<br>\n`,e+=` - <span class="${t.CLASS_NOMATCH}">↑N</span> phrase not matched<br>\n`,e+="operator - ALT, CAT, REP, RNM, TRG, TLS, TBS<sup>†</sup>, UDT, AND, NOT, BKA, BKN, BKR, ABG, AEN<sup>‡</sup><br>\n",e+="phrase - up to 80 characters of the phrase being matched<br>\n",e+=` - <span class="${t.CLASS_MATCH}">matched characters</span><br>\n`,e+=` - <span class="${t.CLASS_LOOKAHEAD}">matched characters in look ahead mode</span><br>\n`,e+=` - <span class="${t.CLASS_LOOKBEHIND}">matched characters in look behind mode</span><br>\n`,e+=` - <span class="${t.CLASS_REMAINDER}">remainder characters(not yet examined by parser)</span><br>\n`,e+=` - <span class="${t.CLASS_CTRLCHAR}">control characters, TAB, LF, CR, etc. (ASCII mode only)</span><br>\n`,e+=` - ${E} empty string<br>\n`,e+=` - ${v} end of input string<br>\n`,e+=` - ${A} input string display truncated<br>\n`,e+="</p>\n",e+=`<p class="${t.CLASS_MONOSPACE}">\n`,e+="<sup>†</sup>original ABNF operators:<br>\n",e+="ALT - alternation<br>\n",e+="CAT - concatenation<br>\n",e+="REP - repetition<br>\n",e+="RNM - rule name<br>\n",e+="TRG - terminal range<br>\n",e+="TLS - terminal literal string (case insensitive)<br>\n",e+="TBS - terminal binary string (case sensitive)<br>\n",e+="<br>\n",e+="<sup>‡</sup>super set SABNF operators:<br>\n",e+="UDT - user-defined terminal<br>\n",e+="AND - positive look ahead<br>\n",e+="NOT - negative look ahead<br>\n",e+="BKA - positive look behind<br>\n",e+="BKN - negative look behind<br>\n",e+="BKR - back reference<br>\n",e+="ABG - anchor - begin of input string<br>\n",e+="AEN - anchor - end of input string<br>\n",e+="</p>\n",e}(),d}}},1174(e,t,r){const n=r(2475),i=r(240),s=r(9724),o=r(5298),a="utilities.js: ",c=function(e,t,r){let n,i=t;for(;;){if(e<=0){i=0,n=0;break}if("number"!=typeof i){i=0,n=e;break}if(i>=e){i=e,n=e;break}if("number"!=typeof r){n=e;break}if(n=i+r,n>e){n=e;break}break}return{beg:i,end:n}};function u(e){return!(e>=55296&&e<=57343||e>1114111)}t.htmlToPage=function(e,t){let r;if("string"!=typeof e)throw new Error(`${a}htmlToPage: input HTML is not a string`);r="string"!=typeof t?"htmlToPage":t;let n="";return n+="<!DOCTYPE html>\n",n+='<html lang="en">\n',n+="<head>\n",n+='<meta charset="utf-8">\n',n+=`<title>${r}</title>\n`,n+="<style>\n",n+=s(),n+="</style>\n",n+="</head>\n<body>\n",n+=`<p>${new Date}</p>\n`,n+=e,n+="</body>\n</html>\n",n},t.parserResultToHtml=function(e,t){let r,i,s=null;"string"==typeof t&&""!==t&&(s=t),r=!0===e.success?`<span class="${n.CLASS_MATCH}">true</span>`:`<span class="${n.CLASS_NOMATCH}">false</span>`,i=e.state===o.EMPTY?`<span class="${n.CLASS_EMPTY}">EMPTY</span>`:e.state===o.MATCH?`<span class="${n.CLASS_MATCH}">MATCH</span>`:e.state===o.NOMATCH?`<span class="${n.CLASS_NOMATCH}">NOMATCH</span>`:`<span class="${n.CLASS_NOMATCH}">unrecognized</span>`;let a="";return a+=`<table class="${n.CLASS_STATE}">\n`,s&&(a+=`<caption>${s}</caption>\n`),a+="<tr><th>state item</th><th>value</th><th>description</th></tr>\n",a+=`<tr><td>parser success</td><td>${r}</td>\n`,a+=`<td><span class="${n.CLASS_MATCH}">true</span> if the parse succeeded,\n`,a+=` <span class="${n.CLASS_NOMATCH}">false</span> otherwise`,a+="<br><i>NOTE: for success, entire string must be matched</i></td></tr>\n",a+=`<tr><td>parser state</td><td>${i}</td>\n`,a+=`<td><span class="${n.CLASS_EMPTY}">EMPTY</span>, `,a+=`<span class="${n.CLASS_MATCH}">MATCH</span> or \n`,a+=`<span class="${n.CLASS_NOMATCH}">NOMATCH</span></td></tr>\n`,a+=`<tr><td>string length</td><td>${e.length}</td><td>length of the input (sub)string</td></tr>\n`,a+=`<tr><td>matched length</td><td>${e.matched}</td><td>number of input string characters matched</td></tr>\n`,a+=`<tr><td>max matched</td><td>${e.maxMatched}</td><td>maximum number of input string characters matched</td></tr>\n`,a+=`<tr><td>max tree depth</td><td>${e.maxTreeDepth}</td><td>maximum depth of the parse tree reached</td></tr>\n`,a+=`<tr><td>node hits</td><td>${e.nodeHits}</td><td>number of parse tree node hits (opcode function calls)</td></tr>\n`,a+=`<tr><td>input length</td><td>${e.inputLength}</td><td>length of full input string</td></tr>\n`,a+=`<tr><td>sub-string begin</td><td>${e.subBegin}</td><td>sub-string first character index</td></tr>\n`,a+=`<tr><td>sub-string end</td><td>${e.subEnd}</td><td>sub-string end-of-string index</td></tr>\n`,a+=`<tr><td>sub-string length</td><td>${e.subLength}</td><td>sub-string length</td></tr>\n`,a+="</table>\n",a},t.charsToString=function(e,t,r){let n,s;if("number"==typeof t){if(t>=e.length)return"";n=t<0?0:t}else n=0;if("number"==typeof r){if(r<=0)return"";s=r>e.length-n?e.length:n+r}else s=e.length;return n<s?i.encode("UTF16LE",e.slice(n,s)).toString("utf16le"):""},t.stringToChars=function(e){return i.decode("STRING",e)},t.opcodeToString=function(e){let t="unknown";switch(e){case o.ALT:t="ALT";break;case o.CAT:t="CAT";break;case o.RNM:t="RNM";break;case o.UDT:t="UDT";break;case o.AND:t="AND";break;case o.NOT:t="NOT";break;case o.REP:t="REP";break;case o.TRG:t="TRG";break;case o.TBS:t="TBS";break;case o.TLS:t="TLS";break;case o.BKR:t="BKR";break;case o.BKA:t="BKA";break;case o.BKN:t="BKN";break;case o.ABG:t="ABG";break;case o.AEN:t="AEN";break;default:throw new Error("unrecognized opcode")}return t},t.stateToString=function(e){let t="unknown";switch(e){case o.ACTIVE:t="ACTIVE";break;case o.MATCH:t="MATCH";break;case o.EMPTY:t="EMPTY";break;case o.NOMATCH:t="NOMATCH";break;default:throw new Error("unrecognized state")}return t},t.asciiChars=["NUL","SOH","STX","ETX","EOT","ENQ","ACK","BEL","BS","TAB","LF","VT","FF","CR","SO","SI","DLE","DC1","DC2","DC3","DC4","NAK","SYN","ETB","CAN","EM","SUB","ESC","FS","GS","RS","US"," ","!",""","#","$","%","&","'","(",")","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~","DEL"],t.charToHex=function(e){let t=e.toString(16).toUpperCase();switch(t.length){case 1:case 3:case 7:t=`0${t}`;break;case 2:case 6:t=`00${t}`;break;case 4:break;case 5:t=`000${t}`;break;default:throw new Error("unrecognized option")}return t},t.charsToDec=function(e,t,r){let n="";if(!Array.isArray(e))throw new Error(`${a}charsToDec: input must be an array of integers`);const i=c(e.length,t,r);if(i.end>i.beg){n+=e[i.beg];for(let t=i.beg+1;t<i.end;t+=1)n+=`,${e[t]}`}return n},t.charsToHex=function(e,r,n){let i="";if(!Array.isArray(e))throw new Error(`${a}charsToHex: input must be an array of integers`);const s=c(e.length,r,n);if(s.end>s.beg){i+=`\\x${t.charToHex(e[s.beg])}`;for(let r=s.beg+1;r<s.end;r+=1)i+=`,\\x${t.charToHex(e[r])}`}return i},t.charsToHtmlEntities=function(e,t,r){let n="";if(!Array.isArray(e))throw new Error(`${a}charsToHex: input must be an array of integers`);const i=c(e.length,t,r);if(i.end>i.beg)for(let t=i.beg;t<i.end;t+=1)n+=`&#x${e[t].toString(16)};`;return n},t.charsToUnicode=function(e,r,n){let i="";if(!Array.isArray(e))throw new Error(`${a}charsToUnicode: input must be an array of integers`);const s=c(e.length,r,n);if(s.end>s.beg)for(let r=s.beg;r<s.end;r+=1)u(e[r])?i+=`&#${e[r]};`:i+=` U+${t.charToHex(e[r])}`;return i},t.charsToJsUnicode=function(e,r,n){let i="";if(!Array.isArray(e))throw new Error(`${a}charsToJsUnicode: input must be an array of integers`);const s=c(e.length,r,n);if(s.end>s.beg){i+=`\\u${t.charToHex(e[s.beg])}`;for(let r=s.beg+1;r<s.end;r+=1)i+=`,\\u${t.charToHex(e[r])}`}return i},t.charsToAscii=function(e,r,n){let i="";if(!Array.isArray(e))throw new Error(`${a}charsToAscii: input must be an array of integers`);const s=c(e.length,r,n);for(let r=s.beg;r<s.end;r+=1){const n=e[r];i+=n>=32&&n<=126?String.fromCharCode(n):`\\x${t.charToHex(n)}`}return i},t.charsToAsciiHtml=function(e,r,i){if(!Array.isArray(e))throw new Error(`${a}charsToAsciiHtml: input must be an array of integers`);let s,o="";const u=c(e.length,r,i);for(let r=u.beg;r<u.end;r+=1)s=e[r],o+=s<32||127===s?`<span class="${n.CLASS_CTRLCHAR}">${t.asciiChars[s]}</span>`:s>127?`<span class="${n.CLASS_CTRLCHAR}">U+${t.charToHex(s)}</span>`:t.asciiChars[s];return o},t.stringToAsciiHtml=function(e){const t=i.decode("STRING",e);return this.charsToAsciiHtml(t)}},7991(e,t){"use strict";t.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,s=a(e),o=s[0],c=s[1],u=new i(function(e,t,r){return 3*(t+r)/4-r}(0,o,c)),l=0,h=c>0?o-4:o;for(r=0;r<h;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;return 2===c&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[l++]=255&t),1===c&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,s=[],o=16383,a=0,c=n-i;a<c;a+=o)s.push(u(e,a,a+o>c?c:a+o));return 1===i?(t=e[n-1],s.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],s.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),s.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)r[o]=s[o],n[s.charCodeAt(o)]=o;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[63&e]}function u(e,t,r){for(var n,i=[],s=t;s<r;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),i.push(c(n));return i.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},8993(e){"use strict";for(var t="qpzry9x8gf2tvdw0s3jn54khce6mua7l",r={},n=0;n<32;n++){var i=t.charAt(n);if(void 0!==r[i])throw new TypeError(i+" is ambiguous");r[i]=n}function s(e){var t=e>>25;return(33554431&e)<<5^996825010&-(1&t)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function o(e){for(var t=1,r=0;r<e.length;++r){var n=e.charCodeAt(r);if(n<33||n>126)return"Invalid prefix ("+e+")";t=s(t)^n>>5}for(t=s(t),r=0;r<e.length;++r){var i=e.charCodeAt(r);t=s(t)^31&i}return t}function a(e,t){if(t=t||90,e.length<8)return e+" too short";if(e.length>t)return"Exceeds length limit";var n=e.toLowerCase(),i=e.toUpperCase();if(e!==n&&e!==i)return"Mixed-case string "+e;var a=(e=n).lastIndexOf("1");if(-1===a)return"No separator character for "+e;if(0===a)return"Missing prefix for "+e;var c=e.slice(0,a),u=e.slice(a+1);if(u.length<6)return"Data too short";var l=o(c);if("string"==typeof l)return l;for(var h=[],d=0;d<u.length;++d){var f=u.charAt(d),p=r[f];if(void 0===p)return"Unknown character "+f;l=s(l)^p,d+6>=u.length||h.push(p)}return 1!==l?"Invalid checksum for "+e:{prefix:c,words:h}}function c(e,t,r,n){for(var i=0,s=0,o=(1<<r)-1,a=[],c=0;c<e.length;++c)for(i=i<<t|e[c],s+=t;s>=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<<r-s&o);else{if(s>=t)return"Excess padding";if(i<<r-s&o)return"Non-zero padding"}return a}e.exports={decodeUnsafe:function(){var e=a.apply(null,arguments);if("object"==typeof e)return e},decode:function(e){var t=a.apply(null,arguments);if("object"==typeof t)return t;throw new Error(t)},encode:function(e,r,n){if(n=n||90,e.length+7+r.length>n)throw new TypeError("Exceeds length limit");var i=o(e=e.toLowerCase());if("string"==typeof i)throw new Error(i);for(var a=e+"1",c=0;c<r.length;++c){var u=r[c];if(u>>5)throw new Error("Non 5-bit word");i=s(i)^u,a+=t.charAt(u)}for(c=0;c<6;++c)i=s(i);for(i^=1,c=0;c<6;++c)a+=t.charAt(i>>5*(5-c)&31);return a},toWordsUnsafe:function(e){var t=c(e,8,5,!0);if(Array.isArray(t))return t},toWords:function(e){var t=c(e,8,5,!0);if(Array.isArray(t))return t;throw new Error(t)},fromWordsUnsafe:function(e){var t=c(e,5,8,!1);if(Array.isArray(t))return t},fromWords:function(e){var t=c(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}}},2823(e,t,r){!function(e,t){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function s(e,t,r){if(s.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"==typeof e?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(8379).Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function c(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function u(e,t,r,i){for(var s=0,o=0,a=Math.min(e.length,r),c=t;c<a;c++){var u=e.charCodeAt(c)-48;s*=i,o=u>=49?u-49+10:u>=17?u-17+10:u,n(u>=0&&o<i,"Invalid character"),s+=o}return s}function l(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(s.isBN=function(e){return e instanceof s||null!==e&&"object"==typeof e&&e.constructor.wordSize===s.wordSize&&Array.isArray(e.words)},s.max=function(e,t){return e.cmp(t)>0?e:t},s.min=function(e,t){return e.cmp(t)<0?e:t},s.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},s.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},s.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var s,o,a=0;if("be"===r)for(i=e.length-1,s=0;i>=0;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if("le"===r)for(i=0,s=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this._strip()},s.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,s=0,o=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)i=c(e,t,n)<<s,this.words[o]|=67108863&i,s>=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)i=c(e,t,n)<<s,this.words[o]|=67108863&i,s>=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;this._strip()},s.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var s=e.length-r,o=s%n,a=Math.min(s,s-o)+r,c=0,l=r;l<a;l+=n)c=u(e,l,l+n,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==o){var h=1;for(c=u(e,l,e.length,t),l=0;l<o;l++)h*=t;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},s.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},s.prototype._move=function(e){l(e,this)},s.prototype.clone=function(){var e=new s(null);return this.copy(e),e},s.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch(e){s.prototype.inspect=h}else s.prototype.inspect=h;function h(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function g(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],s=0|t.words[0],o=i*s,a=67108863&o,c=o/67108864|0;r.words[0]=a;for(var u=1;u<n;u++){for(var l=c>>>26,h=67108863&c,d=Math.min(u,t.length-1),f=Math.max(0,u-e.length+1);f<=d;f++){var p=u-f|0;l+=(o=(i=0|e.words[p])*(s=0|t.words[f])+h)/67108864|0,h=67108863&o}r.words[u]=0|h,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r._strip()}s.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,s=0,o=0;o<this.length;o++){var a=this.words[o],c=(16777215&(a<<i|s)).toString(16);s=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,o--),r=0!==s||o!==this.length-1?d[6-c.length]+c+r:c+r}for(0!==s&&(r=s.toString(16)+r);r.length%t!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var u=f[e],l=p[e];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var g=h.modrn(l).toString(e);r=(h=h.idivn(l)).isZero()?g+r:d[u-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%t!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),s.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},s.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),s=r||Math.max(1,i);n(i<=s,"byte array longer than desired length"),n(s>0,"Requested array length <= 0");var o=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,s);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,i),o},s.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,i=0,s=0;i<this.length;i++){var o=this.words[i]<<s|n;e[r++]=255&o,r<e.length&&(e[r++]=o>>8&255),r<e.length&&(e[r++]=o>>16&255),6===s?(r<e.length&&(e[r++]=o>>24&255),n=0,s=0):(n=o>>>24,s+=2)}if(r<e.length)for(e[r++]=n;r<e.length;)e[r++]=0},s.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,n=0,i=0,s=0;i<this.length;i++){var o=this.words[i]<<s|n;e[r--]=255&o,r>=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===s?(r>=0&&(e[r--]=o>>24&255),n=0,s=0):(n=o>>>24,s+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?s.prototype._countBits=function(e){return 32-Math.clz32(e)}:s.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},s.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},s.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},s.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return 0!==this.negative},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},s.prototype.ior=function(e){return n(0===(this.negative|e.negative)),this.iuor(e)},s.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},s.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},s.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},s.prototype.iand=function(e){return n(0===(this.negative|e.negative)),this.iuand(e)},s.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},s.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},s.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this._strip()},s.prototype.ixor=function(e){return n(0===(this.negative|e.negative)),this.iuxor(e)},s.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},s.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},s.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},s.prototype.notn=function(e){return this.clone().inotn(e)},s.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},s.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var i=0,s=0;s<n.length;s++)t=(0|r.words[s])+(0|n.words[s])+i,this.words[s]=67108863&t,i=t>>>26;for(;0!==i&&s<r.length;s++)t=(0|r.words[s])+i,this.words[s]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this},s.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},s.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var s=0,o=0;o<n.length;o++)s=(t=(0|r.words[o])-(0|n.words[o])+s)>>26,this.words[o]=67108863&t;for(;0!==s&&o<r.length;o++)s=(t=(0|r.words[o])+s)>>26,this.words[o]=67108863&t;if(0===s&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(e){return this.clone().isub(e)};var m=function(e,t,r){var n,i,s,o=e.words,a=t.words,c=r.words,u=0,l=0|o[0],h=8191&l,d=l>>>13,f=0|o[1],p=8191&f,g=f>>>13,m=0|o[2],y=8191&m,b=m>>>13,w=0|o[3],v=8191&w,A=w>>>13,E=0|o[4],x=8191&E,k=E>>>13,T=0|o[5],S=8191&T,I=T>>>13,C=0|o[6],B=8191&C,N=C>>>13,_=0|o[7],M=8191&_,R=_>>>13,P=0|o[8],O=8191&P,L=P>>>13,D=0|o[9],U=8191&D,F=D>>>13,H=0|a[0],z=8191&H,$=H>>>13,G=0|a[1],j=8191&G,q=G>>>13,K=0|a[2],V=8191&K,W=K>>>13,Y=0|a[3],J=8191&Y,Q=Y>>>13,X=0|a[4],Z=8191&X,ee=X>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],se=8191&ie,oe=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],he=8191&le,de=le>>>13,fe=0|a[9],pe=8191&fe,ge=fe>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(u+(n=Math.imul(h,z))|0)+((8191&(i=(i=Math.imul(h,$))+Math.imul(d,z)|0))<<13)|0;u=((s=Math.imul(d,$))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,$))+Math.imul(g,z)|0,s=Math.imul(g,$);var ye=(u+(n=n+Math.imul(h,j)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,j)|0))<<13)|0;u=((s=s+Math.imul(d,q)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,z),i=(i=Math.imul(y,$))+Math.imul(b,z)|0,s=Math.imul(b,$),n=n+Math.imul(p,j)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(g,j)|0,s=s+Math.imul(g,q)|0;var be=(u+(n=n+Math.imul(h,V)|0)|0)+((8191&(i=(i=i+Math.imul(h,W)|0)+Math.imul(d,V)|0))<<13)|0;u=((s=s+Math.imul(d,W)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(v,z),i=(i=Math.imul(v,$))+Math.imul(A,z)|0,s=Math.imul(A,$),n=n+Math.imul(y,j)|0,i=(i=i+Math.imul(y,q)|0)+Math.imul(b,j)|0,s=s+Math.imul(b,q)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,V)|0,s=s+Math.imul(g,W)|0;var we=(u+(n=n+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,Q)|0)+Math.imul(d,J)|0))<<13)|0;u=((s=s+Math.imul(d,Q)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(x,z),i=(i=Math.imul(x,$))+Math.imul(k,z)|0,s=Math.imul(k,$),n=n+Math.imul(v,j)|0,i=(i=i+Math.imul(v,q)|0)+Math.imul(A,j)|0,s=s+Math.imul(A,q)|0,n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(b,V)|0,s=s+Math.imul(b,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(g,J)|0,s=s+Math.imul(g,Q)|0;var ve=(u+(n=n+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,Z)|0))<<13)|0;u=((s=s+Math.imul(d,ee)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(S,z),i=(i=Math.imul(S,$))+Math.imul(I,z)|0,s=Math.imul(I,$),n=n+Math.imul(x,j)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(k,j)|0,s=s+Math.imul(k,q)|0,n=n+Math.imul(v,V)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(A,V)|0,s=s+Math.imul(A,W)|0,n=n+Math.imul(y,J)|0,i=(i=i+Math.imul(y,Q)|0)+Math.imul(b,J)|0,s=s+Math.imul(b,Q)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,Z)|0,s=s+Math.imul(g,ee)|0;var Ae=(u+(n=n+Math.imul(h,re)|0)|0)+((8191&(i=(i=i+Math.imul(h,ne)|0)+Math.imul(d,re)|0))<<13)|0;u=((s=s+Math.imul(d,ne)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(B,z),i=(i=Math.imul(B,$))+Math.imul(N,z)|0,s=Math.imul(N,$),n=n+Math.imul(S,j)|0,i=(i=i+Math.imul(S,q)|0)+Math.imul(I,j)|0,s=s+Math.imul(I,q)|0,n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(k,V)|0,s=s+Math.imul(k,W)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,Q)|0)+Math.imul(A,J)|0,s=s+Math.imul(A,Q)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(b,Z)|0,s=s+Math.imul(b,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(g,re)|0,s=s+Math.imul(g,ne)|0;var Ee=(u+(n=n+Math.imul(h,se)|0)|0)+((8191&(i=(i=i+Math.imul(h,oe)|0)+Math.imul(d,se)|0))<<13)|0;u=((s=s+Math.imul(d,oe)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(M,z),i=(i=Math.imul(M,$))+Math.imul(R,z)|0,s=Math.imul(R,$),n=n+Math.imul(B,j)|0,i=(i=i+Math.imul(B,q)|0)+Math.imul(N,j)|0,s=s+Math.imul(N,q)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(I,V)|0,s=s+Math.imul(I,W)|0,n=n+Math.imul(x,J)|0,i=(i=i+Math.imul(x,Q)|0)+Math.imul(k,J)|0,s=s+Math.imul(k,Q)|0,n=n+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(A,Z)|0,s=s+Math.imul(A,ee)|0,n=n+Math.imul(y,re)|0,i=(i=i+Math.imul(y,ne)|0)+Math.imul(b,re)|0,s=s+Math.imul(b,ne)|0,n=n+Math.imul(p,se)|0,i=(i=i+Math.imul(p,oe)|0)+Math.imul(g,se)|0,s=s+Math.imul(g,oe)|0;var xe=(u+(n=n+Math.imul(h,ce)|0)|0)+((8191&(i=(i=i+Math.imul(h,ue)|0)+Math.imul(d,ce)|0))<<13)|0;u=((s=s+Math.imul(d,ue)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(O,z),i=(i=Math.imul(O,$))+Math.imul(L,z)|0,s=Math.imul(L,$),n=n+Math.imul(M,j)|0,i=(i=i+Math.imul(M,q)|0)+Math.imul(R,j)|0,s=s+Math.imul(R,q)|0,n=n+Math.imul(B,V)|0,i=(i=i+Math.imul(B,W)|0)+Math.imul(N,V)|0,s=s+Math.imul(N,W)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,Q)|0)+Math.imul(I,J)|0,s=s+Math.imul(I,Q)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(k,Z)|0,s=s+Math.imul(k,ee)|0,n=n+Math.imul(v,re)|0,i=(i=i+Math.imul(v,ne)|0)+Math.imul(A,re)|0,s=s+Math.imul(A,ne)|0,n=n+Math.imul(y,se)|0,i=(i=i+Math.imul(y,oe)|0)+Math.imul(b,se)|0,s=s+Math.imul(b,oe)|0,n=n+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(g,ce)|0,s=s+Math.imul(g,ue)|0;var ke=(u+(n=n+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;u=((s=s+Math.imul(d,de)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(U,z),i=(i=Math.imul(U,$))+Math.imul(F,z)|0,s=Math.imul(F,$),n=n+Math.imul(O,j)|0,i=(i=i+Math.imul(O,q)|0)+Math.imul(L,j)|0,s=s+Math.imul(L,q)|0,n=n+Math.imul(M,V)|0,i=(i=i+Math.imul(M,W)|0)+Math.imul(R,V)|0,s=s+Math.imul(R,W)|0,n=n+Math.imul(B,J)|0,i=(i=i+Math.imul(B,Q)|0)+Math.imul(N,J)|0,s=s+Math.imul(N,Q)|0,n=n+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(I,Z)|0,s=s+Math.imul(I,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(k,re)|0,s=s+Math.imul(k,ne)|0,n=n+Math.imul(v,se)|0,i=(i=i+Math.imul(v,oe)|0)+Math.imul(A,se)|0,s=s+Math.imul(A,oe)|0,n=n+Math.imul(y,ce)|0,i=(i=i+Math.imul(y,ue)|0)+Math.imul(b,ce)|0,s=s+Math.imul(b,ue)|0,n=n+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(g,he)|0,s=s+Math.imul(g,de)|0;var Te=(u+(n=n+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ge)|0)+Math.imul(d,pe)|0))<<13)|0;u=((s=s+Math.imul(d,ge)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,j),i=(i=Math.imul(U,q))+Math.imul(F,j)|0,s=Math.imul(F,q),n=n+Math.imul(O,V)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(L,V)|0,s=s+Math.imul(L,W)|0,n=n+Math.imul(M,J)|0,i=(i=i+Math.imul(M,Q)|0)+Math.imul(R,J)|0,s=s+Math.imul(R,Q)|0,n=n+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(N,Z)|0,s=s+Math.imul(N,ee)|0,n=n+Math.imul(S,re)|0,i=(i=i+Math.imul(S,ne)|0)+Math.imul(I,re)|0,s=s+Math.imul(I,ne)|0,n=n+Math.imul(x,se)|0,i=(i=i+Math.imul(x,oe)|0)+Math.imul(k,se)|0,s=s+Math.imul(k,oe)|0,n=n+Math.imul(v,ce)|0,i=(i=i+Math.imul(v,ue)|0)+Math.imul(A,ce)|0,s=s+Math.imul(A,ue)|0,n=n+Math.imul(y,he)|0,i=(i=i+Math.imul(y,de)|0)+Math.imul(b,he)|0,s=s+Math.imul(b,de)|0;var Se=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;u=((s=s+Math.imul(g,ge)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(U,V),i=(i=Math.imul(U,W))+Math.imul(F,V)|0,s=Math.imul(F,W),n=n+Math.imul(O,J)|0,i=(i=i+Math.imul(O,Q)|0)+Math.imul(L,J)|0,s=s+Math.imul(L,Q)|0,n=n+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(R,Z)|0,s=s+Math.imul(R,ee)|0,n=n+Math.imul(B,re)|0,i=(i=i+Math.imul(B,ne)|0)+Math.imul(N,re)|0,s=s+Math.imul(N,ne)|0,n=n+Math.imul(S,se)|0,i=(i=i+Math.imul(S,oe)|0)+Math.imul(I,se)|0,s=s+Math.imul(I,oe)|0,n=n+Math.imul(x,ce)|0,i=(i=i+Math.imul(x,ue)|0)+Math.imul(k,ce)|0,s=s+Math.imul(k,ue)|0,n=n+Math.imul(v,he)|0,i=(i=i+Math.imul(v,de)|0)+Math.imul(A,he)|0,s=s+Math.imul(A,de)|0;var Ie=(u+(n=n+Math.imul(y,pe)|0)|0)+((8191&(i=(i=i+Math.imul(y,ge)|0)+Math.imul(b,pe)|0))<<13)|0;u=((s=s+Math.imul(b,ge)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(U,J),i=(i=Math.imul(U,Q))+Math.imul(F,J)|0,s=Math.imul(F,Q),n=n+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(L,Z)|0,s=s+Math.imul(L,ee)|0,n=n+Math.imul(M,re)|0,i=(i=i+Math.imul(M,ne)|0)+Math.imul(R,re)|0,s=s+Math.imul(R,ne)|0,n=n+Math.imul(B,se)|0,i=(i=i+Math.imul(B,oe)|0)+Math.imul(N,se)|0,s=s+Math.imul(N,oe)|0,n=n+Math.imul(S,ce)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(I,ce)|0,s=s+Math.imul(I,ue)|0,n=n+Math.imul(x,he)|0,i=(i=i+Math.imul(x,de)|0)+Math.imul(k,he)|0,s=s+Math.imul(k,de)|0;var Ce=(u+(n=n+Math.imul(v,pe)|0)|0)+((8191&(i=(i=i+Math.imul(v,ge)|0)+Math.imul(A,pe)|0))<<13)|0;u=((s=s+Math.imul(A,ge)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(U,Z),i=(i=Math.imul(U,ee))+Math.imul(F,Z)|0,s=Math.imul(F,ee),n=n+Math.imul(O,re)|0,i=(i=i+Math.imul(O,ne)|0)+Math.imul(L,re)|0,s=s+Math.imul(L,ne)|0,n=n+Math.imul(M,se)|0,i=(i=i+Math.imul(M,oe)|0)+Math.imul(R,se)|0,s=s+Math.imul(R,oe)|0,n=n+Math.imul(B,ce)|0,i=(i=i+Math.imul(B,ue)|0)+Math.imul(N,ce)|0,s=s+Math.imul(N,ue)|0,n=n+Math.imul(S,he)|0,i=(i=i+Math.imul(S,de)|0)+Math.imul(I,he)|0,s=s+Math.imul(I,de)|0;var Be=(u+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,ge)|0)+Math.imul(k,pe)|0))<<13)|0;u=((s=s+Math.imul(k,ge)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(U,re),i=(i=Math.imul(U,ne))+Math.imul(F,re)|0,s=Math.imul(F,ne),n=n+Math.imul(O,se)|0,i=(i=i+Math.imul(O,oe)|0)+Math.imul(L,se)|0,s=s+Math.imul(L,oe)|0,n=n+Math.imul(M,ce)|0,i=(i=i+Math.imul(M,ue)|0)+Math.imul(R,ce)|0,s=s+Math.imul(R,ue)|0,n=n+Math.imul(B,he)|0,i=(i=i+Math.imul(B,de)|0)+Math.imul(N,he)|0,s=s+Math.imul(N,de)|0;var Ne=(u+(n=n+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,ge)|0)+Math.imul(I,pe)|0))<<13)|0;u=((s=s+Math.imul(I,ge)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,n=Math.imul(U,se),i=(i=Math.imul(U,oe))+Math.imul(F,se)|0,s=Math.imul(F,oe),n=n+Math.imul(O,ce)|0,i=(i=i+Math.imul(O,ue)|0)+Math.imul(L,ce)|0,s=s+Math.imul(L,ue)|0,n=n+Math.imul(M,he)|0,i=(i=i+Math.imul(M,de)|0)+Math.imul(R,he)|0,s=s+Math.imul(R,de)|0;var _e=(u+(n=n+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,ge)|0)+Math.imul(N,pe)|0))<<13)|0;u=((s=s+Math.imul(N,ge)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(U,ce),i=(i=Math.imul(U,ue))+Math.imul(F,ce)|0,s=Math.imul(F,ue),n=n+Math.imul(O,he)|0,i=(i=i+Math.imul(O,de)|0)+Math.imul(L,he)|0,s=s+Math.imul(L,de)|0;var Me=(u+(n=n+Math.imul(M,pe)|0)|0)+((8191&(i=(i=i+Math.imul(M,ge)|0)+Math.imul(R,pe)|0))<<13)|0;u=((s=s+Math.imul(R,ge)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(U,he),i=(i=Math.imul(U,de))+Math.imul(F,he)|0,s=Math.imul(F,de);var Re=(u+(n=n+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,ge)|0)+Math.imul(L,pe)|0))<<13)|0;u=((s=s+Math.imul(L,ge)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Pe=(u+(n=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,ge))+Math.imul(F,pe)|0))<<13)|0;return u=((s=Math.imul(F,ge))+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,c[0]=me,c[1]=ye,c[2]=be,c[3]=we,c[4]=ve,c[5]=Ae,c[6]=Ee,c[7]=xe,c[8]=ke,c[9]=Te,c[10]=Se,c[11]=Ie,c[12]=Ce,c[13]=Be,c[14]=Ne,c[15]=_e,c[16]=Me,c[17]=Re,c[18]=Pe,0!==u&&(c[19]=u,r.length++),r};function y(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,s=0;s<r.length-1;s++){var o=i;i=0;for(var a=67108863&n,c=Math.min(s,t.length-1),u=Math.max(0,s-e.length+1);u<=c;u++){var l=s-u,h=(0|e.words[l])*(0|t.words[u]),d=67108863&h;a=67108863&(d=d+a|0),i+=(o=(o=o+(h/67108864|0)|0)+(d>>>26)|0)>>>26,o&=67108863}r.words[s]=a,n=o,o=i}return 0!==n?r.words[s]=n:r.length--,r._strip()}function b(e,t,r){return y(e,t,r)}function w(e,t){this.x=e,this.y=t}Math.imul||(m=g),s.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):r<63?g(this,e,t):r<1024?y(this,e,t):b(this,e,t)},w.prototype.makeRBT=function(e){for(var t=new Array(e),r=s.prototype._countBits(e)-1,n=0;n<e;n++)t[n]=this.revBin(n,r,e);return t},w.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var n=0,i=0;i<t;i++)n|=(1&e)<<t-i-1,e>>=1;return n},w.prototype.permute=function(e,t,r,n,i,s){for(var o=0;o<s;o++)n[o]=t[e[o]],i[o]=r[e[o]]},w.prototype.transform=function(e,t,r,n,i,s){this.permute(s,e,t,r,n,i);for(var o=1;o<i;o<<=1)for(var a=o<<1,c=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),l=0;l<i;l+=a)for(var h=c,d=u,f=0;f<o;f++){var p=r[l+f],g=n[l+f],m=r[l+f+o],y=n[l+f+o],b=h*m-d*y;y=h*y+d*m,m=b,r[l+f]=p+m,n[l+f]=g+y,r[l+f+o]=p-m,n[l+f+o]=g-y,f!==a&&(b=c*h-u*d,d=c*d+u*h,h=b)}},w.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},w.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=e[n];e[n]=e[r-n-1],e[r-n-1]=i,i=t[n],t[n]=-t[r-n-1],t[r-n-1]=-i}},w.prototype.normalize13b=function(e,t){for(var r=0,n=0;n<t/2;n++){var i=8192*Math.round(e[2*n+1]/t)+Math.round(e[2*n]/t)+r;e[n]=67108863&i,r=i<67108864?0:i/67108864|0}return e},w.prototype.convert13b=function(e,t,r,i){for(var s=0,o=0;o<t;o++)s+=0|e[o],r[2*o]=8191&s,s>>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*t;o<i;++o)r[o]=0;n(0===s),n(!(-8192&s))},w.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},w.prototype.mulp=function(e,t,r){var n=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(n),s=this.stub(n),o=new Array(n),a=new Array(n),c=new Array(n),u=new Array(n),l=new Array(n),h=new Array(n),d=r.words;d.length=n,this.convert13b(e.words,e.length,o,n),this.convert13b(t.words,t.length,u,n),this.transform(o,s,a,c,n,i),this.transform(u,s,l,h,n,i);for(var f=0;f<n;f++){var p=a[f]*l[f]-c[f]*h[f];c[f]=a[f]*h[f]+c[f]*l[f],a[f]=p}return this.conjugate(a,c,n),this.transform(a,c,d,s,n,i),this.conjugate(d,s,n),this.normalize13b(d,n),r.negative=e.negative^t.negative,r.length=e.length+t.length,r._strip()},s.prototype.mul=function(e){var t=new s(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},s.prototype.mulf=function(e){var t=new s(null);return t.words=new Array(this.length+e.length),b(this,e,t)},s.prototype.imul=function(e){return this.clone().mulTo(e,this)},s.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var s=(0|this.words[i])*e,o=(67108863&s)+(67108863&r);r>>=26,r+=s/67108864|0,r+=o>>>26,this.words[i]=67108863&o}return 0!==r&&(this.words[i]=r,this.length++),this.length=0===e?1:this.length,t?this.ineg():this},s.prototype.muln=function(e){return this.clone().imuln(e)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var n=r/26|0,i=r%26;t[r]=e.words[n]>>>i&1}return t}(e);if(0===t.length)return new s(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var i=r.sqr();n<t.length;n++,i=i.sqr())0!==t[n]&&(r=r.mul(i));return r},s.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t<this.length;t++){var a=this.words[t]&s,c=(0|this.words[t])-a<<r;this.words[t]=c|o,o=a>>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},s.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},s.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var s=e%26,o=Math.min((e-s)/26,this.length),a=67108863^67108863>>>s<<s,c=r;if(i-=o,i=Math.max(0,i),c){for(var u=0;u<o;u++)c.words[u]=this.words[u];c.length=o}if(0===o);else if(this.length>o)for(this.length-=o,u=0;u<this.length;u++)this.words[u]=this.words[u+o];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=i);u--){var h=0|this.words[u];this.words[u]=l<<26-s|h>>>s,l=h&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},s.prototype.shln=function(e){return this.clone().ishln(e)},s.prototype.ushln=function(e){return this.clone().iushln(e)},s.prototype.shrn=function(e){return this.clone().ishrn(e)},s.prototype.ushrn=function(e){return this.clone().iushrn(e)},s.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r||!(this.words[r]&i))},s.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this._strip()},s.prototype.maskn=function(e){return this.clone().imaskn(e)},s.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},s.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},s.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},s.prototype.addn=function(e){return this.clone().iaddn(e)},s.prototype.subn=function(e){return this.clone().isubn(e)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(e,t,r){var i,s,o=e.length+r;this._expand(o);var a=0;for(i=0;i<e.length;i++){s=(0|this.words[i+r])+a;var c=(0|e.words[i])*t;a=((s-=67108863&c)>>26)-(c/67108864|0),this.words[i+r]=67108863&s}for(;i<this.length-r;i++)a=(s=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&s;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(s=-(0|this.words[i])+a)>>26,this.words[i]=67108863&s;return this.negative=1,this._strip()},s.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,o=0|i.words[i.length-1];0!=(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var a,c=n.length-i.length;if("mod"!==t){(a=new s(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=n.clone()._ishlnsubmul(i,1,c);0===l.negative&&(n=l,a&&(a.words[c]=1));for(var h=c-1;h>=0;h--){var d=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(d=Math.min(d/o|0,67108863),n._ishlnsubmul(i,d,h);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);a&&(a.words[h]=d)}return a&&a._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},s.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:i,mod:o}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(e)),{div:a.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new s(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new s(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new s(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,o,a},s.prototype.div=function(e){return this.divmod(e,"div",!1).div},s.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},s.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},s.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),s=r.cmp(n);return s<0||1===i&&0===s?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},s.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,s=this.length-1;s>=0;s--)i=(r*i+(0|this.words[s]))%e;return t?-i:i},s.prototype.modn=function(e){return this.modrn(e)},s.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var s=(0|this.words[i])+67108864*r;this.words[i]=s/e|0,r=s%e}return this._strip(),t?this.ineg():this},s.prototype.divn=function(e){return this.clone().idivn(e)},s.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new s(1),o=new s(0),a=new s(0),c=new s(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var l=r.clone(),h=t.clone();!t.isZero();){for(var d=0,f=1;0===(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(l),o.isub(h)),i.iushrn(1),o.iushrn(1);for(var p=0,g=1;0===(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(h)),a.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(a),o.isub(c)):(r.isub(t),a.isub(i),c.isub(o))}return{a,b:c,gcd:r.iushln(u)}},s.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,o=new s(1),a=new s(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,l=1;0===(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);for(var h=0,d=1;0===(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(a)):(r.isub(t),a.isub(o))}return(i=0===t.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(e),i},s.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var s=t;t=r,r=s}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},s.prototype.invm=function(e){return this.egcd(e).a.umod(e)},s.prototype.isEven=function(){return!(1&this.words[0])},s.prototype.isOdd=function(){return!(1&~this.words[0])},s.prototype.andln=function(e){return this.words[0]&e},s.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var s=i,o=r;0!==s&&o<this.length;o++){var a=0|this.words[o];s=(a+=s)>>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},s.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},s.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){n<i?t=-1:n>i&&(t=1);break}}return t},s.prototype.gtn=function(e){return 1===this.cmpn(e)},s.prototype.gt=function(e){return 1===this.cmp(e)},s.prototype.gten=function(e){return this.cmpn(e)>=0},s.prototype.gte=function(e){return this.cmp(e)>=0},s.prototype.ltn=function(e){return-1===this.cmpn(e)},s.prototype.lt=function(e){return-1===this.cmp(e)},s.prototype.lten=function(e){return this.cmpn(e)<=0},s.prototype.lte=function(e){return this.cmp(e)<=0},s.prototype.eqn=function(e){return 0===this.cmpn(e)},s.prototype.eq=function(e){return 0===this.cmp(e)},s.red=function(e){return new S(e)},s.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(e){return this.red=e,this},s.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},s.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},s.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},s.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},s.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},s.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},s.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},s.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function A(e,t){this.name=e,this.p=new s(t,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function E(){A.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function x(){A.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){A.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function T(){A.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"==typeof e){var t=s._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function I(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}A.prototype._tmp=function(){var e=new s(null);return e.words=new Array(Math.ceil(this.n/13)),e},A.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},A.prototype.split=function(e,t){e.iushrn(this.n,0,t)},A.prototype.imulK=function(e){return e.imul(this.k)},i(E,A),E.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i<n;i++)t.words[i]=e.words[i];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var s=e.words[9];for(t.words[t.length++]=s&r,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(o&r)<<4|s>>>22,s=o}s>>>=22,e.words[i-10]=s,0===s&&e.length>10?e.length-=10:e.length-=9},E.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(x,A),i(k,A),i(T,A),T.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,i=67108863&n;n>>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},s._prime=function(e){if(v[e])return v[e];var t;if("k256"===e)t=new E;else if("p224"===e)t=new x;else if("p192"===e)t=new k;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new T}return v[e]=t,t},S.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){n(0===(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new s(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var a=new s(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new s(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var h=this.pow(l,i),d=this.pow(e,i.addn(1).iushrn(1)),f=this.pow(e,i),p=o;0!==f.cmp(a);){for(var g=f,m=0;0!==g.cmp(a);m++)g=g.redSqr();n(m<p);var y=this.pow(h,new s(1).iushln(p-m-1));d=d.redMul(y),h=y.redSqr(),f=f.redMul(h),p=m}return d},S.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},S.prototype.pow=function(e,t){if(t.isZero())return new s(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new s(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var i=r[0],o=0,a=0,c=t.bitLength()%26;for(0===c&&(c=26),n=t.length-1;n>=0;n--){for(var u=t.words[n],l=c-1;l>=0;l--){var h=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==o?(o<<=1,o|=h,(4===++a||0===n&&0===l)&&(i=this.mul(i,r[o]),a=0,o=0)):a=0}c=26}return i},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},s.mont=function(e){return new I(e)},i(I,S),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},I.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},I.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new s(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},1048(e,t,r){"use strict";const n=r(7991),i=r(9318),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50;const o=2147483647;function a(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return h(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|g(e,t);let n=a(r);const i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return d(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return f(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return f(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||J(e.length)?a(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function h(e){return l(e),a(e<0?0:0|p(e))}function d(e){const t=e.length<0?0:0|p(e.length),r=a(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function f(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,c.prototype),n}function p(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return V(e).length;default:if(i)return n?-1:K(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return N(this,t,r);case"utf8":case"utf-8":return S(this,t,r);case"ascii":return C(this,t,r);case"latin1":case"binary":return B(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:w(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):w(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function w(e,t,r,n,i){let s,o=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,a/=2,c/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){let n=-1;for(s=r;s<a;s++)if(u(e,s)===u(t,-1===n?0:s-n)){if(-1===n&&(n=s),s-n+1===c)return n*o}else-1!==n&&(s-=s-n),n=-1}else for(r+c>a&&(r=a-c),s=r;s>=0;s--){let r=!0;for(let n=0;n<c;n++)if(u(e,s+n)!==u(t,n)){r=!1;break}if(r)return s}return-1}function v(e,t,r,n){r=Number(r)||0;const i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;const s=t.length;let o;for(n>s/2&&(n=s/2),o=0;o<n;++o){const n=parseInt(t.substr(2*o,2),16);if(J(n))return o;e[r+o]=n}return o}function A(e,t,r,n){return W(K(t,e.length-r),e,r,n)}function E(e,t,r,n){return W(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function x(e,t,r,n){return W(V(t),e,r,n)}function k(e,t,r,n){return W(function(e,t){let r,n,i;const s=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)r=e.charCodeAt(o),n=r>>8,i=r%256,s.push(i),s.push(n);return s}(t,e.length-r),e,r,n)}function T(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function S(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i<r;){const t=e[i];let s=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=r){let r,n,a,c;switch(o){case 1:t<128&&(s=t);break;case 2:r=e[i+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(s=c));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(s=c));break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(s=c))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=o}return function(e){const t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=I));return r}(n)}t.kMaxLength=o,c.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),c.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(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,r){return function(e,t,r){return l(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},c.allocUnsafe=function(e){return h(e)},c.allocUnsafeSlow=function(e){return h(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),Y(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},c.isEncoding=function(e){switch(String(e).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}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=c.allocUnsafe(t);let i=0;for(r=0;r<e.length;++r){let t=e[r];if(Y(t,Uint8Array))i+t.length>n.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)y(this,t,t+1);return this},c.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},c.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},c.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?S(this,0,e):m.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},s&&(c.prototype[s]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,i){if(Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let s=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0);const a=Math.min(s,o),u=this.slice(n,i),l=e.slice(t,r);for(let e=0;e<a;++e)if(u[e]!==l[e]){s=u[e],o=l[e];break}return s<o?-1:o<s?1:0},c.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},c.prototype.indexOf=function(e,t,r){return b(this,e,t,r,!0)},c.prototype.lastIndexOf=function(e,t,r){return b(this,e,t,r,!1)},c.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let s=!1;for(;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return A(this,e,t,r);case"ascii":case"latin1":case"binary":return E(this,e,t,r);case"base64":return x(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function C(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function B(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function N(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n<r;++n)i+=Q[e[n]];return i}function _(e,t,r){const n=e.slice(t,r);let i="";for(let e=0;e<n.length-1;e+=2)i+=String.fromCharCode(n[e]+256*n[e+1]);return i}function M(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,r,n,i,s){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function P(e,t,r,n,i){$(t,n,i,e,r,7);let s=Number(t&BigInt(4294967295));e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,r}function O(e,t,r,n,i){$(t,n,i,e,r,7);let s=Number(t&BigInt(4294967295));e[r+7]=s,s>>=8,e[r+6]=s,s>>=8,e[r+5]=s,s>>=8,e[r+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=o,o>>=8,e[r+2]=o,o>>=8,e[r+1]=o,o>>=8,e[r]=o,r+8}function L(e,t,r,n,i,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,r,n,s){return t=+t,r>>>=0,s||L(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function U(e,t,r,n,s){return t=+t,r>>>=0,s||L(e,0,r,8),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,c.prototype),n},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);let n=this[e],i=1,s=0;for(;++s<t&&(i*=256);)n+=this[e+s]*i;return n},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=X(function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||j(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))}),c.prototype.readBigUInt64BE=X(function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||j(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)}),c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);let n=this[e],i=1,s=0;for(;++s<t&&(i*=256);)n+=this[e+s]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);let n=t,i=1,s=this[e+--n];for(;n>0&&(i*=256);)s+=this[e+--n]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*t)),s},c.prototype.readInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||M(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||M(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=X(function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||j(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)}),c.prototype.readBigInt64BE=X(function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||j(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)}),c.prototype.readFloatLE=function(e,t){return e>>>=0,t||M(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||M(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||M(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||M(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||R(this,e,t,r,Math.pow(2,8*r)-1,0);let i=1,s=0;for(this[t]=255&e;++s<r&&(i*=256);)this[t+s]=e/i&255;return t+r},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||R(this,e,t,r,Math.pow(2,8*r)-1,0);let i=r-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=X(function(e,t=0){return P(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=X(function(e,t=0){return O(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);R(this,e,t,r,n-1,-n)}let i=0,s=1,o=0;for(this[t]=255&e;++i<r&&(s*=256);)e<0&&0===o&&0!==this[t+i-1]&&(o=1),this[t+i]=(e/s|0)-o&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);R(this,e,t,r,n-1,-n)}let i=r-1,s=1,o=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/s|0)-o&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=X(function(e,t=0){return P(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=X(function(e,t=0){return O(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);const i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},c.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!c.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{const s=c.isBuffer(e)?e:c.from(e,n),o=s.length;if(0===o)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%o]}return this};const F={};function H(e,t,r){F[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function z(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function $(e,t,r,n,i,s){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let i;throw i=s>3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(s+1)}${n}`:`>= -(2${n} ** ${8*(s+1)-1}${n}) and < 2 ** ${8*(s+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new F.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||j(t,e.length-(r+1))}(n,i,s)}function G(e,t){if("number"!=typeof e)throw new F.ERR_INVALID_ARG_TYPE(t,"number",e)}function j(e,t,r){if(Math.floor(e)!==e)throw G(e,r),new F.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new F.ERR_BUFFER_OUT_OF_BOUNDS;throw new F.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}H("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),H("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),H("ERR_OUT_OF_RANGE",function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=z(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=z(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);const q=/[^+/0-9A-Za-z-_]/g;function K(e,t){let r;t=t||1/0;const n=e.length;let i=null;const s=[];for(let o=0;o<n;++o){if(r=e.charCodeAt(o),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function V(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function W(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}const Q=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function X(e){return"undefined"==typeof BigInt?Z:e}function Z(){throw new Error("BigInt not supported")}},8367(e,t,r){"use strict";r.r(t),r.d(t,{BaseContract:()=>Mn,BigNumber:()=>W,Contract:()=>Rn,ContractFactory:()=>Pn,FixedNumber:()=>qn,Signer:()=>cr,VoidSigner:()=>ur,Wallet:()=>ws,Wordlist:()=>Ai,constants:()=>i,errors:()=>m,ethers:()=>c,getDefaultProvider:()=>lc,logger:()=>Hc,providers:()=>s,utils:()=>a,version:()=>Fc,wordlists:()=>Ti});var n={};r.r(n),r.d(n,{decode:()=>Se,encode:()=>xe});var i={};r.r(i),r.d(i,{AddressZero:()=>Es,EtherSymbol:()=>ks,HashZero:()=>xs,MaxInt256:()=>gt,MaxUint256:()=>ft,MinInt256:()=>pt,NegativeOne:()=>ct,One:()=>lt,Two:()=>ht,WeiPerEther:()=>dt,Zero:()=>ut});var s={};r.r(s),r.d(s,{AlchemyProvider:()=>ma,AlchemyWebSocketProvider:()=>ga,AnkrProvider:()=>va,BaseProvider:()=>qo,CloudflareProvider:()=>Ea,EtherscanProvider:()=>Na,FallbackProvider:()=>qa,Formatter:()=>yo,InfuraProvider:()=>Ja,InfuraWebSocketProvider:()=>Ya,IpcProvider:()=>Ka,JsonRpcBatchProvider:()=>Qa,JsonRpcProvider:()=>ia,JsonRpcSigner:()=>ta,NodesmithProvider:()=>Za,PocketProvider:()=>rc,Provider:()=>nr,QuickNodeProvider:()=>ic,Resolver:()=>$o,StaticJsonRpcProvider:()=>ha,UrlJsonRpcProvider:()=>da,Web3Provider:()=>cc,WebSocketProvider:()=>ua,getDefaultProvider:()=>lc,getNetwork:()=>Ms,isCommunityResourcable:()=>bo,isCommunityResource:()=>wo,showThrottleMessage:()=>Ao});var o={};r.r(o),r.d(o,{decode:()=>Rs,encode:()=>Ps});var a={};r.r(a),r.d(a,{AbiCoder:()=>qt,ConstructorFragment:()=>Pt,ErrorFragment:()=>Dt,EventFragment:()=>Nt,FormatTypes:()=>Tt,Fragment:()=>Bt,FunctionFragment:()=>Ot,HDNode:()=>Di,Indexed:()=>Qt,Interface:()=>er,LogDescription:()=>Wt,Logger:()=>b,ParamType:()=>It,RLP:()=>n,SigningKey:()=>Qr,SupportedAlgorithm:()=>fi,TransactionDescription:()=>Yt,TransactionTypes:()=>tn,UnicodeNormalizationForm:()=>Fe,Utf8ErrorFuncs:()=>$e,Utf8ErrorReason:()=>He,_TypedDataEncoder:()=>li,_fetchData:()=>uo,_toEscapedUtf8String:()=>Ke,accessListify:()=>hn,arrayify:()=>T,base58:()=>di,base64:()=>o,checkProperties:()=>ne,checkResultErrors:()=>de,commify:()=>Pc,computeAddress:()=>an,computeHmac:()=>bi,computePublicKey:()=>Zr,concat:()=>S,deepCopy:()=>ce,defaultAbiCoder:()=>Kt,defaultPath:()=>Li,defineReadOnly:()=>ee,dnsEncode:()=>io,entropyToMnemonic:()=>Hi,fetchJson:()=>lo,formatBytes32String:()=>Nc,formatEther:()=>Dc,formatUnits:()=>Oc,getAccountPath:()=>$i,getAddress:()=>Re,getContractAddress:()=>Le,getCreate2Address:()=>De,getIcapAddress:()=>Oe,getJsonWalletAddress:()=>gs,getStatic:()=>te,hashMessage:()=>Wn,hexConcat:()=>P,hexDataLength:()=>M,hexDataSlice:()=>R,hexStripZeros:()=>L,hexValue:()=>O,hexZeroPad:()=>D,hexlify:()=>_,id:()=>Je,isAddress:()=>Pe,isBytes:()=>k,isBytesLike:()=>E,isHexString:()=>B,isValidMnemonic:()=>zi,isValidName:()=>ro,joinSignature:()=>F,keccak256:()=>be,mnemonicToEntropy:()=>Fi,mnemonicToSeed:()=>Ui,namehash:()=>no,nameprep:()=>Bc,parseBytes32String:()=>_c,parseEther:()=>Uc,parseTransaction:()=>yn,parseUnits:()=>Lc,poll:()=>ho,randomBytes:()=>Ki,recoverAddress:()=>cn,recoverPublicKey:()=>Xr,resolveProperties:()=>re,ripemd160:()=>gi,serializeTransaction:()=>gn,sha256:()=>mi,sha512:()=>yi,shallowCopy:()=>ie,shuffled:()=>_a,solidityKeccak256:()=>yc,solidityPack:()=>mc,soliditySha256:()=>bc,splitSignature:()=>U,stripZeros:()=>I,toUtf8Bytes:()=>je,toUtf8CodePoints:()=>Ye,toUtf8String:()=>We,verifyMessage:()=>vs,verifyTypedData:()=>As,zeroPad:()=>C});var c={};r.r(c),r.d(c,{BaseContract:()=>Mn,BigNumber:()=>W,Contract:()=>Rn,ContractFactory:()=>Pn,FixedNumber:()=>qn,Signer:()=>cr,VoidSigner:()=>ur,Wallet:()=>ws,Wordlist:()=>Ai,constants:()=>i,errors:()=>m,getDefaultProvider:()=>lc,logger:()=>Hc,providers:()=>s,utils:()=>a,version:()=>Fc,wordlists:()=>Ti});let u=!1,l=!1;const h={debug:1,default:2,info:2,warning:3,error:4,off:5};let d=h.default,f=null;const p=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach(t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}}),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var g,m;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(g||(g={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(m||(m={}));const y="0123456789abcdef";class b{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==h[r]&&this.throwArgumentError("invalid log level name","logLevel",e),d>h[r]||console.log.apply(console,t)}debug(...e){this._log(b.levels.DEBUG,e)}info(...e){this._log(b.levels.INFO,e)}warn(...e){this._log(b.levels.WARNING,e)}makeError(e,t,r){if(l)return this.makeError("censored error",t,{});t||(t=b.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach(e=>{const t=r[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=y[t[e]>>4],r+=y[15&t[e]];n.push(e+"=Uint8Array(0x"+r+")")}else n.push(e+"="+JSON.stringify(t))}catch(t){n.push(e+"="+JSON.stringify(r[e].toString()))}}),n.push(`code=${t}`),n.push(`version=${this.version}`);const i=e;let s="";switch(t){case m.NUMERIC_FAULT:{s="NUMERIC_FAULT";const t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":s+="-"+t;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case m.CALL_EXCEPTION:case m.INSUFFICIENT_FUNDS:case m.MISSING_NEW:case m.NONCE_EXPIRED:case m.REPLACEMENT_UNDERPRICED:case m.TRANSACTION_REPLACED:case m.UNPREDICTABLE_GAS_LIMIT:s=t}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const o=new Error(e);return o.reason=i,o.code=t,Object.keys(r).forEach(function(e){o[e]=r[e]}),o}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,b.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(e){null==e&&(e="platform missing String.prototype.normalize"),p&&this.throwError("platform missing String.prototype.normalize",b.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:p})}checkSafeUint53(e,t){"number"==typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,b.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,b.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r=r?": "+r:"",e<t&&this.throwError("missing argument"+r,b.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+r,b.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",b.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",b.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",b.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return f||(f=new b("logger/5.8.0")),f}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",b.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),u){if(!e)return;this.globalLogger().throwError("error censorship permanent",b.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}l=!!e,u=!!t}static setLogLevel(e){const t=h[e.toLowerCase()];null!=t?d=t:b.globalLogger().warn("invalid log level - "+e)}static from(e){return new b(e)}}b.errors=m,b.levels=g;const w=new b("bytes/5.8.0");function v(e){return!!e.toHexString}function A(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return A(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function E(e){return B(e)&&!(e.length%2)||k(e)}function x(e){return"number"==typeof e&&e==e&&e%1==0}function k(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!x(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!x(r)||r<0||r>=256)return!1}return!0}function T(e,t){if(t||(t={}),"number"==typeof e){w.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),A(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),v(e)&&(e=e.toHexString()),B(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":w.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e<r.length;e+=2)n.push(parseInt(r.substring(e,e+2),16));return A(new Uint8Array(n))}return k(e)?A(new Uint8Array(e)):w.throwArgumentError("invalid arrayify value","value",e)}function S(e){const t=e.map(e=>T(e)),r=t.reduce((e,t)=>e+t.length,0),n=new Uint8Array(r);return t.reduce((e,t)=>(n.set(t,e),e+t.length),0),A(n)}function I(e){let t=T(e);if(0===t.length)return t;let r=0;for(;r<t.length&&0===t[r];)r++;return r&&(t=t.slice(r)),t}function C(e,t){(e=T(e)).length>t&&w.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),A(r)}function B(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t)}const N="0123456789abcdef";function _(e,t){if(t||(t={}),"number"==typeof e){w.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=N[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),v(e))return e.toHexString();if(B(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":w.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(k(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=N[(240&n)>>4]+N[15&n]}return t}return w.throwArgumentError("invalid hexlify value","value",e)}function M(e){if("string"!=typeof e)e=_(e);else if(!B(e)||e.length%2)return null;return(e.length-2)/2}function R(e,t,r){return"string"!=typeof e?e=_(e):(!B(e)||e.length%2)&&w.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function P(e){let t="0x";return e.forEach(e=>{t+=_(e).substring(2)}),t}function O(e){const t=L(_(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function L(e){"string"!=typeof e&&(e=_(e)),B(e)||w.throwArgumentError("invalid hex string","value",e),e=e.substring(2);let t=0;for(;t<e.length&&"0"===e[t];)t++;return"0x"+e.substring(t)}function D(e,t){for("string"!=typeof e?e=_(e):B(e)||w.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&w.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function U(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(E(e)){let r=T(e);64===r.length?(t.v=27+(r[32]>>7),r[32]&=127,t.r=_(r.slice(0,32)),t.s=_(r.slice(32,64))):65===r.length?(t.r=_(r.slice(0,32)),t.s=_(r.slice(32,64)),t.v=r[64]):w.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:w.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=_(r.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){const r=C(T(t._vs),32);t._vs=_(r);const n=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=n:t.recoveryParam!==n&&w.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;const i=_(r);null==t.s?t.s=i:t.s!==i&&w.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?w.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{const r=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==r&&w.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&B(t.r)?t.r=D(t.r,32):w.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&B(t.s)?t.s=D(t.s,32):w.throwArgumentError("signature missing or invalid s","signature",e);const r=T(t.s);r[0]>=128&&w.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const n=_(r);t._vs&&(B(t._vs)||w.throwArgumentError("signature invalid _vs","signature",e),t._vs=D(t._vs,32)),null==t._vs?t._vs=n:t._vs!==n&&w.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function F(e){return _(S([(e=U(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}var H=r(2823),z=r.n(H);const $="bignumber/5.8.0";var G=z().BN;const j=new b($),q={},K=9007199254740991;let V=!1;class W{constructor(e,t){e!==q&&j.throwError("cannot call constructor directly; use BigNumber.from",b.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return J(Q(this).fromTwos(e))}toTwos(e){return J(Q(this).toTwos(e))}abs(){return"-"===this._hex[0]?W.from(this._hex.substring(1)):this}add(e){return J(Q(this).add(Q(e)))}sub(e){return J(Q(this).sub(Q(e)))}div(e){return W.from(e).isZero()&&X("division-by-zero","div"),J(Q(this).div(Q(e)))}mul(e){return J(Q(this).mul(Q(e)))}mod(e){const t=Q(e);return t.isNeg()&&X("division-by-zero","mod"),J(Q(this).umod(t))}pow(e){const t=Q(e);return t.isNeg()&&X("negative-power","pow"),J(Q(this).pow(t))}and(e){const t=Q(e);return(this.isNegative()||t.isNeg())&&X("unbound-bitwise-result","and"),J(Q(this).and(t))}or(e){const t=Q(e);return(this.isNegative()||t.isNeg())&&X("unbound-bitwise-result","or"),J(Q(this).or(t))}xor(e){const t=Q(e);return(this.isNegative()||t.isNeg())&&X("unbound-bitwise-result","xor"),J(Q(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&X("negative-width","mask"),J(Q(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&X("negative-width","shl"),J(Q(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&X("negative-width","shr"),J(Q(this).shrn(e))}eq(e){return Q(this).eq(Q(e))}lt(e){return Q(this).lt(Q(e))}lte(e){return Q(this).lte(Q(e))}gt(e){return Q(this).gt(Q(e))}gte(e){return Q(this).gte(Q(e))}isNegative(){return"-"===this._hex[0]}isZero(){return Q(this).isZero()}toNumber(){try{return Q(this).toNumber()}catch(e){X("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return j.throwError("this platform does not support BigInt",b.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?V||(V=!0,j.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?j.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",b.errors.UNEXPECTED_ARGUMENT,{}):j.throwError("BigNumber.toString does not accept parameters",b.errors.UNEXPECTED_ARGUMENT,{})),Q(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof W)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new W(q,Y(e)):e.match(/^-?[0-9]+$/)?new W(q,Y(new G(e))):j.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&X("underflow","BigNumber.from",e),(e>=K||e<=-K)&&X("overflow","BigNumber.from",e),W.from(String(e));const t=e;if("bigint"==typeof t)return W.from(t.toString());if(k(t))return W.from(_(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"==typeof e)return W.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"==typeof e&&(B(e)||"-"===e[0]&&B(e.substring(1))))return W.from(e)}return j.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function Y(e){if("string"!=typeof e)return Y(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&j.throwArgumentError("invalid hex","value",e),"0x00"===(e=Y(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function J(e){return W.from(Y(e))}function Q(e){const t=W.from(e).toHexString();return"-"===t[0]?new G("-"+t.substring(3),16):new G(t.substring(2),16)}function X(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),j.throwError(e,b.errors.NUMERIC_FAULT,n)}const Z=new b("properties/5.8.0");function ee(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function te(e,t){for(let r=0;r<32;r++){if(e[t])return e[t];if(!e.prototype||"object"!=typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function re(e){return t=this,r=void 0,i=function*(){const t=Object.keys(e).map(t=>{const r=e[t];return Promise.resolve(r).then(e=>({key:t,value:e}))});return(yield Promise.all(t)).reduce((e,t)=>(e[t.key]=t.value,e),{})},new((n=void 0)||(n=Promise))(function(e,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n(function(e){e(r)})).then(o,a)}c((i=i.apply(t,r||[])).next())});var t,r,n,i}function ne(e,t){e&&"object"==typeof e||Z.throwArgumentError("invalid object","object",e),Object.keys(e).forEach(r=>{t[r]||Z.throwArgumentError("invalid object key - "+r,"transaction:"+r,e)})}function ie(e){const t={};for(const r in e)t[r]=e[r];return t}const se={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function oe(e){if(null==e||se[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const t=Object.keys(e);for(let r=0;r<t.length;r++){let n=null;try{n=e[t[r]]}catch(e){continue}if(!oe(n))return!1}return!0}return Z.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function ae(e){if(oe(e))return e;if(Array.isArray(e))return Object.freeze(e.map(e=>ce(e)));if("object"==typeof e){const t={};for(const r in e){const n=e[r];void 0!==n&&ee(t,r,ce(n))}return t}return Z.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function ce(e){return ae(e)}class ue{constructor(e){for(const t in e)this[t]=ce(e[t])}}const le="abi/5.8.0",he=new b(le);function de(e){const t=[],r=function(e,n){if(Array.isArray(n))for(let i in n){const s=e.slice();s.push(i);try{r(s,n[i])}catch(e){t.push({path:s,error:e})}}};return r([],e),t}class fe{constructor(e,t,r,n){this.name=e,this.type=t,this.localName=r,this.dynamic=n}_throwError(e,t){he.throwArgumentError(e,this.localName,t)}}class pe{constructor(e){ee(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return P(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(S(e._data))}writeBytes(e){let t=T(e);const r=t.length%this.wordSize;return r&&(t=S([t,this._padding.slice(r)])),this._writeData(t)}_getValue(e){let t=T(W.from(e));return t.length>this.wordSize&&he.throwError("value out-of-bounds",b.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=S([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}}class ge{constructor(e,t,r,n){ee(this,"_data",T(e)),ee(this,"wordSize",t||32),ee(this,"_coerceFunc",r),ee(this,"allowLoose",n),this._offset=0}get data(){return _(this._data)}get consumed(){return this._offset}static coerce(e,t){let r=e.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(t=t.toNumber()),t}coerce(e,t){return this._coerceFunc?this._coerceFunc(e,t):ge.coerce(e,t)}_peekBytes(e,t,r){let n=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+t<=this._data.length?n=t:he.throwError("data out-of-bounds",b.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}subReader(e){return new ge(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,t){let r=this._peekBytes(0,e,!!t);return this._offset+=r.length,r.slice(0,e)}readValue(){return W.from(this.readBytes(this.wordSize))}}var me=r(671),ye=r.n(me);function be(e){return"0x"+ye().keccak_256(T(e))}const we=new b("rlp/5.8.0");function ve(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function Ae(e,t,r){let n=0;for(let i=0;i<r;i++)n=256*n+e[t+i];return n}function Ee(e){if(Array.isArray(e)){let t=[];if(e.forEach(function(e){t=t.concat(Ee(e))}),t.length<=55)return t.unshift(192+t.length),t;const r=ve(t.length);return r.unshift(247+r.length),r.concat(t)}E(e)||we.throwArgumentError("RLP object must be BytesLike","object",e);const t=Array.prototype.slice.call(T(e));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const r=ve(t.length);return r.unshift(183+r.length),r.concat(t)}function xe(e){return _(Ee(e))}function ke(e,t,r,n){const i=[];for(;r<t+1+n;){const s=Te(e,r);i.push(s.result),(r+=s.consumed)>t+1+n&&we.throwError("child data too short",b.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function Te(e,t){if(0===e.length&&we.throwError("data too short",b.errors.BUFFER_OVERRUN,{}),e[t]>=248){const r=e[t]-247;t+1+r>e.length&&we.throwError("data short segment too short",b.errors.BUFFER_OVERRUN,{});const n=Ae(e,t+1,r);return t+1+r+n>e.length&&we.throwError("data long segment too short",b.errors.BUFFER_OVERRUN,{}),ke(e,t,t+1+r,r+n)}if(e[t]>=192){const r=e[t]-192;return t+1+r>e.length&&we.throwError("data array too short",b.errors.BUFFER_OVERRUN,{}),ke(e,t,t+1,r)}if(e[t]>=184){const r=e[t]-183;t+1+r>e.length&&we.throwError("data array too short",b.errors.BUFFER_OVERRUN,{});const n=Ae(e,t+1,r);return t+1+r+n>e.length&&we.throwError("data array too short",b.errors.BUFFER_OVERRUN,{}),{consumed:1+r+n,result:_(e.slice(t+1+r,t+1+r+n))}}if(e[t]>=128){const r=e[t]-128;return t+1+r>e.length&&we.throwError("data too short",b.errors.BUFFER_OVERRUN,{}),{consumed:1+r,result:_(e.slice(t+1,t+1+r))}}return{consumed:1,result:_(e[t])}}function Se(e){const t=T(e),r=Te(t,0);return r.consumed!==t.length&&we.throwArgumentError("invalid rlp data","data",e),r.result}const Ie=new b("address/5.8.0");function Ce(e){B(e,20)||Ie.throwArgumentError("invalid address","address",e);const t=(e=e.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let e=0;e<40;e++)r[e]=t[e].charCodeAt(0);const n=T(be(r));for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&(t[e]=t[e].toUpperCase()),(15&n[e>>1])>=8&&(t[e+1]=t[e+1].toUpperCase());return"0x"+t.join("")}const Be={};for(let e=0;e<10;e++)Be[String(e)]=String(e);for(let e=0;e<26;e++)Be[String.fromCharCode(65+e)]=String(10+e);const Ne=Math.floor((_e=9007199254740991,Math.log10?Math.log10(_e):Math.log(_e)/Math.LN10));var _e;function Me(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map(e=>Be[e]).join("");for(;t.length>=Ne;){let e=t.substring(0,Ne);t=parseInt(e,10)%97+t.substring(e.length)}let r=String(98-parseInt(t,10)%97);for(;r.length<2;)r="0"+r;return r}function Re(e){let t=null;if("string"!=typeof e&&Ie.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=Ce(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&Ie.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==Me(e)&&Ie.throwArgumentError("bad icap checksum","address",e),r=e.substring(4),t=new G(r,36).toString(16);t.length<40;)t="0"+t;t=Ce("0x"+t)}else Ie.throwArgumentError("invalid address","address",e);var r;return t}function Pe(e){try{return Re(e),!0}catch(e){}return!1}function Oe(e){let t=(r=Re(e).substring(2),new G(r,16).toString(36)).toUpperCase();for(var r;t.length<30;)t="0"+t;return"XE"+Me("XE00"+t)+t}function Le(e){let t=null;try{t=Re(e.from)}catch(t){Ie.throwArgumentError("missing from address","transaction",e)}return Re(R(be(xe([t,I(T(W.from(e.nonce).toHexString()))])),12))}function De(e,t,r){return 32!==M(t)&&Ie.throwArgumentError("salt must be 32 bytes","salt",t),32!==M(r)&&Ie.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),Re(R(be(S(["0xff",Re(e),t,r])),12))}const Ue=new b("strings/5.8.0");var Fe,He;function ze(e,t,r,n,i){if(e===He.BAD_PREFIX||e===He.UNEXPECTED_CONTINUE){let e=0;for(let n=t+1;n<r.length&&r[n]>>6==2;n++)e++;return e}return e===He.OVERRUN?r.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(Fe||(Fe={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(He||(He={}));const $e=Object.freeze({error:function(e,t,r,n,i){return Ue.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",r)},ignore:ze,replace:function(e,t,r,n,i){return e===He.OVERLONG?(n.push(i),0):(n.push(65533),ze(e,t,r))}});function Ge(e,t){null==t&&(t=$e.error),e=T(e);const r=[];let n=0;for(;n<e.length;){const i=e[n++];if(!(i>>7)){r.push(i);continue}let s=null,o=null;if(192==(224&i))s=1,o=127;else if(224==(240&i))s=2,o=2047;else{if(240!=(248&i)){n+=t(128==(192&i)?He.UNEXPECTED_CONTINUE:He.BAD_PREFIX,n-1,e,r);continue}s=3,o=65535}if(n-1+s>=e.length){n+=t(He.OVERRUN,n-1,e,r);continue}let a=i&(1<<8-s-1)-1;for(let i=0;i<s;i++){let i=e[n];if(128!=(192&i)){n+=t(He.MISSING_CONTINUE,n,e,r),a=null;break}a=a<<6|63&i,n++}null!==a&&(a>1114111?n+=t(He.OUT_OF_RANGE,n-1-s,e,r,a):a>=55296&&a<=57343?n+=t(He.UTF16_SURROGATE,n-1-s,e,r,a):a<=o?n+=t(He.OVERLONG,n-1-s,e,r,a):r.push(a))}return r}function je(e,t=Fe.current){t!=Fe.current&&(Ue.checkNormalize(),e=e.normalize(t));let r=[];for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(63&n|128);else if(55296==(64512&n)){t++;const i=e.charCodeAt(t);if(t>=e.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const s=65536+((1023&n)<<10)+(1023&i);r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(63&s|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return T(r)}function qe(e){const t="0000"+e.toString(16);return"\\u"+t.substring(t.length-4)}function Ke(e,t){return'"'+Ge(e,t).map(e=>{if(e<256){switch(e){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(e>=32&&e<127)return String.fromCharCode(e)}return e<=65535?qe(e):qe(55296+((e-=65536)>>10&1023))+qe(56320+(1023&e))}).join("")+'"'}function Ve(e){return e.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e)))).join("")}function We(e,t){return Ve(Ge(e,t))}function Ye(e,t=Fe.current){return Ge(je(e,t))}function Je(e){return be(je(e))}class Qe extends fe{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=Re(t)}catch(e){this._throwError(e.message,t)}return e.writeValue(t)}decode(e){return Re(D(e.readValue().toHexString(),20))}}class Xe extends fe{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}const Ze=new b(le);function et(e,t,r){let n=null;if(Array.isArray(r))n=r;else if(r&&"object"==typeof r){let e={};n=t.map(t=>{const n=t.localName;return n||Ze.throwError("cannot encode object for signature with missing names",b.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:r}),e[n]&&Ze.throwError("cannot encode object for signature with duplicate names",b.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:r}),e[n]=!0,r[n]})}else Ze.throwArgumentError("invalid tuple value","tuple",r);t.length!==n.length&&Ze.throwArgumentError("types/value length mismatch","tuple",r);let i=new pe(e.wordSize),s=new pe(e.wordSize),o=[];t.forEach((e,t)=>{let r=n[t];if(e.dynamic){let t=s.length;e.encode(s,r);let n=i.writeUpdatableValue();o.push(e=>{n(e+t)})}else e.encode(i,r)}),o.forEach(e=>{e(i.length)});let a=e.appendWriter(i);return a+=e.appendWriter(s),a}function tt(e,t){let r=[],n=e.subReader(0);t.forEach(t=>{let i=null;if(t.dynamic){let r=e.readValue(),s=n.subReader(r.toNumber());try{i=t.decode(s)}catch(e){if(e.code===b.errors.BUFFER_OVERRUN)throw e;i=e,i.baseType=t.name,i.name=t.localName,i.type=t.type}}else try{i=t.decode(e)}catch(e){if(e.code===b.errors.BUFFER_OVERRUN)throw e;i=e,i.baseType=t.name,i.name=t.localName,i.type=t.type}null!=i&&r.push(i)});const i=t.reduce((e,t)=>{const r=t.localName;return r&&(e[r]||(e[r]=0),e[r]++),e},{});t.forEach((e,t)=>{let n=e.localName;if(!n||1!==i[n])return;if("length"===n&&(n="_length"),null!=r[n])return;const s=r[t];s instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw s}}):r[n]=s});for(let e=0;e<r.length;e++){const t=r[e];t instanceof Error&&Object.defineProperty(r,e,{enumerable:!0,get:()=>{throw t}})}return Object.freeze(r)}class rt extends fe{constructor(e,t,r){super("array",e.type+"["+(t>=0?t:"")+"]",r,-1===t||e.dynamic),this.coder=e,this.length=t}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let r=0;r<this.length;r++)t.push(e);return t}encode(e,t){Array.isArray(t)||this._throwError("expected array value",t);let r=this.length;-1===r&&(r=t.length,e.writeValue(t.length)),Ze.checkArgumentCount(t.length,r,"coder array"+(this.localName?" "+this.localName:""));let n=[];for(let e=0;e<t.length;e++)n.push(this.coder);return et(e,n,t)}decode(e){let t=this.length;-1===t&&(t=e.readValue().toNumber(),32*t>e._data.length&&Ze.throwError("insufficient data length",b.errors.BUFFER_OVERRUN,{length:e._data.length,count:t}));let r=[];for(let e=0;e<t;e++)r.push(new Xe(this.coder));return e.coerce(this.name,tt(e,r))}}class nt extends fe{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){return e.writeValue(t?1:0)}decode(e){return e.coerce(this.type,!e.readValue().isZero())}}class it extends fe{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=T(t);let r=e.writeValue(t.length);return r+=e.writeBytes(t),r}decode(e){return e.readBytes(e.readValue().toNumber(),!0)}}class st extends it{constructor(e){super("bytes",e)}decode(e){return e.coerce(this.name,_(super.decode(e)))}}class ot extends fe{constructor(e,t){let r="bytes"+String(e);super(r,r,t,!1),this.size=e}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(e,t){let r=T(t);return r.length!==this.size&&this._throwError("incorrect data length",t),e.writeBytes(r)}decode(e){return e.coerce(this.name,_(e.readBytes(this.size)))}}class at extends fe{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return null!=t&&this._throwError("not null",t),e.writeBytes([])}decode(e){return e.readBytes(0),e.coerce(this.name,null)}}const ct=W.from(-1),ut=W.from(0),lt=W.from(1),ht=W.from(2),dt=W.from("1000000000000000000"),ft=W.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),pt=W.from("-0x8000000000000000000000000000000000000000000000000000000000000000"),gt=W.from("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class mt extends fe{constructor(e,t,r){const n=(t?"int":"uint")+8*e;super(n,n,r,!1),this.size=e,this.signed=t}defaultValue(){return 0}encode(e,t){let r=W.from(t),n=ft.mask(8*e.wordSize);if(this.signed){let e=n.mask(8*this.size-1);(r.gt(e)||r.lt(e.add(lt).mul(ct)))&&this._throwError("value out-of-bounds",t)}else(r.lt(ut)||r.gt(n.mask(8*this.size)))&&this._throwError("value out-of-bounds",t);return r=r.toTwos(8*this.size).mask(8*this.size),this.signed&&(r=r.fromTwos(8*this.size).toTwos(8*e.wordSize)),e.writeValue(r)}decode(e){let t=e.readValue().mask(8*this.size);return this.signed&&(t=t.fromTwos(8*this.size)),e.coerce(this.name,t)}}class yt extends it{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,je(t))}decode(e){return We(super.decode(e))}}class bt extends fe{constructor(e,t){let r=!1;const n=[];e.forEach(e=>{e.dynamic&&(r=!0),n.push(e.type)}),super("tuple","tuple("+n.join(",")+")",t,r),this.coders=e}defaultValue(){const e=[];this.coders.forEach(t=>{e.push(t.defaultValue())});const t=this.coders.reduce((e,t)=>{const r=t.localName;return r&&(e[r]||(e[r]=0),e[r]++),e},{});return this.coders.forEach((r,n)=>{let i=r.localName;i&&1===t[i]&&("length"===i&&(i="_length"),null==e[i]&&(e[i]=e[n]))}),Object.freeze(e)}encode(e,t){return et(e,this.coders,t)}decode(e){return e.coerce(this.name,tt(e,this.coders))}}const wt=new b(le),vt={};let At={calldata:!0,memory:!0,storage:!0},Et={calldata:!0,memory:!0};function xt(e,t){if("bytes"===e||"string"===e){if(At[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&Et[t])return!0;return(At[t]||"payable"===t)&&wt.throwArgumentError("invalid modifier","name",t),!1}function kt(e,t){for(let r in t)ee(e,r,t[r])}const Tt=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),St=new RegExp(/^(.*)\[([0-9]*)\]$/);class It{constructor(e,t){e!==vt&&wt.throwError("use fromString",b.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),kt(this,t);let r=this.type.match(St);kt(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:It.fromObject({type:r[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(e){if(e||(e=Tt.sighash),Tt[e]||wt.throwArgumentError("invalid format type","format",e),e===Tt.json){let t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map(t=>JSON.parse(t.format(e)))),JSON.stringify(t)}let t="";return"array"===this.baseType?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==Tt.sighash&&(t+=this.type),t+="("+this.components.map(t=>t.format(e)).join(e===Tt.full?", ":",")+")"):t+=this.type,e!==Tt.sighash&&(!0===this.indexed&&(t+=" indexed"),e===Tt.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return"string"==typeof e?It.fromString(e,t):It.fromObject(e)}static fromObject(e){return It.isParamType(e)?e:new It(vt,{name:e.name||null,type:Ut(e.type),indexed:null==e.indexed?null:!!e.indexed,components:e.components?e.components.map(It.fromObject):null})}static fromString(e,t){return r=function(e,t){let r=e;function n(t){wt.throwArgumentError(`unexpected character at position ${t}`,"param",e)}function i(e){let r={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(r.indexed=!1),r}e=e.replace(/\s/g," ");let s={type:"",name:"",state:{allowType:!0}},o=s;for(let r=0;r<e.length;r++){let s=e[r];switch(s){case"(":o.state.allowType&&""===o.type?o.type="tuple":o.state.allowParams||n(r),o.state.allowType=!1,o.type=Ut(o.type),o.components=[i(o)],o=o.components[0];break;case")":delete o.state,"indexed"===o.name&&(t||n(r),o.indexed=!0,o.name=""),xt(o.type,o.name)&&(o.name=""),o.type=Ut(o.type);let e=o;o=o.parent,o||n(r),delete e.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,"indexed"===o.name&&(t||n(r),o.indexed=!0,o.name=""),xt(o.type,o.name)&&(o.name=""),o.type=Ut(o.type);let a=i(o.parent);o.parent.components.push(a),delete o.parent,o=a;break;case" ":o.state.allowType&&""!==o.type&&(o.type=Ut(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&""!==o.name&&("indexed"===o.name?(t||n(r),o.indexed&&n(r),o.indexed=!0,o.name=""):xt(o.type,o.name)?o.name="":o.state.allowName=!1);break;case"[":o.state.allowArray||n(r),o.type+=s,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||n(r),o.type+=s,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=s,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=s,delete o.state.allowArray):o.state.readArray?o.type+=s:n(r)}}return o.parent&&wt.throwArgumentError("unexpected eof","param",e),delete s.state,"indexed"===o.name?(t||n(r.length-7),o.indexed&&n(r.length-7),o.indexed=!0,o.name=""):xt(o.type,o.name)&&(o.name=""),s.type=Ut(s.type),s}(e,!!t),It.fromObject({name:r.name,type:r.type,indexed:r.indexed,components:r.components});var r}static isParamType(e){return!(null==e||!e._isParamType)}}function Ct(e,t){return function(e){e=e.trim();let t=[],r="",n=0;for(let i=0;i<e.length;i++){let s=e[i];","===s&&0===n?(t.push(r),r=""):(r+=s,"("===s?n++:")"===s&&(n--,-1===n&&wt.throwArgumentError("unbalanced parenthesis","value",e)))}return r&&t.push(r),t}(e).map(e=>It.fromString(e,t))}class Bt{constructor(e,t){e!==vt&&wt.throwError("use a static from method",b.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),kt(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return Bt.isFragment(e)?e:"string"==typeof e?Bt.fromString(e):Bt.fromObject(e)}static fromObject(e){if(Bt.isFragment(e))return e;switch(e.type){case"function":return Ot.fromObject(e);case"event":return Nt.fromObject(e);case"constructor":return Pt.fromObject(e);case"error":return Dt.fromObject(e);case"fallback":case"receive":return null}return wt.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return"event"===(e=(e=(e=e.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?Nt.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?Ot.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?Pt.fromString(e.trim()):"error"===e.split(" ")[0]?Dt.fromString(e.substring(5).trim()):wt.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}}class Nt extends Bt{format(e){if(e||(e=Tt.sighash),Tt[e]||wt.throwArgumentError("invalid format type","format",e),e===Tt.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(t=>JSON.parse(t.format(e)))});let t="";return e!==Tt.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map(t=>t.format(e)).join(e===Tt.full?", ":",")+") ",e!==Tt.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return"string"==typeof e?Nt.fromString(e):Nt.fromObject(e)}static fromObject(e){if(Nt.isEventFragment(e))return e;"event"!==e.type&&wt.throwArgumentError("invalid event object","value",e);const t={name:Ht(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(It.fromObject):[],type:"event"};return new Nt(vt,t)}static fromString(e){let t=e.match(zt);t||wt.throwArgumentError("invalid event string","value",e);let r=!1;return t[3].split(" ").forEach(e=>{switch(e.trim()){case"anonymous":r=!0;break;case"":break;default:wt.warn("unknown modifier: "+e)}}),Nt.fromObject({name:t[1].trim(),anonymous:r,inputs:Ct(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}}function _t(e,t){t.gas=null;let r=e.split("@");return 1!==r.length?(r.length>2&&wt.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||wt.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=W.from(r[1]),r[0]):e}function Mt(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach(e=>{switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+e)}})}function Rt(e){let t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&wt.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&wt.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||wt.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&wt.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&wt.throwArgumentError("unable to determine stateMutability","value",e),t}class Pt extends Bt{format(e){if(e||(e=Tt.sighash),Tt[e]||wt.throwArgumentError("invalid format type","format",e),e===Tt.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(t=>JSON.parse(t.format(e)))});e===Tt.sighash&&wt.throwError("cannot format a constructor for sighash",b.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map(t=>t.format(e)).join(e===Tt.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}static from(e){return"string"==typeof e?Pt.fromString(e):Pt.fromObject(e)}static fromObject(e){if(Pt.isConstructorFragment(e))return e;"constructor"!==e.type&&wt.throwArgumentError("invalid constructor object","value",e);let t=Rt(e);t.constant&&wt.throwArgumentError("constructor cannot be constant","value",e);const r={name:null,type:e.type,inputs:e.inputs?e.inputs.map(It.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?W.from(e.gas):null};return new Pt(vt,r)}static fromString(e){let t={type:"constructor"},r=(e=_t(e,t)).match(zt);return r&&"constructor"===r[1].trim()||wt.throwArgumentError("invalid constructor string","value",e),t.inputs=Ct(r[2].trim(),!1),Mt(r[3].trim(),t),Pt.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}}class Ot extends Pt{format(e){if(e||(e=Tt.sighash),Tt[e]||wt.throwArgumentError("invalid format type","format",e),e===Tt.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(t=>JSON.parse(t.format(e))),outputs:this.outputs.map(t=>JSON.parse(t.format(e)))});let t="";return e!==Tt.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map(t=>t.format(e)).join(e===Tt.full?", ":",")+") ",e!==Tt.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map(t=>t.format(e)).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}static from(e){return"string"==typeof e?Ot.fromString(e):Ot.fromObject(e)}static fromObject(e){if(Ot.isFunctionFragment(e))return e;"function"!==e.type&&wt.throwArgumentError("invalid function object","value",e);let t=Rt(e);const r={type:e.type,name:Ht(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(It.fromObject):[],outputs:e.outputs?e.outputs.map(It.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?W.from(e.gas):null};return new Ot(vt,r)}static fromString(e){let t={type:"function"},r=(e=_t(e,t)).split(" returns ");r.length>2&&wt.throwArgumentError("invalid function string","value",e);let n=r[0].match(zt);if(n||wt.throwArgumentError("invalid function signature","value",e),t.name=n[1].trim(),t.name&&Ht(t.name),t.inputs=Ct(n[2],!1),Mt(n[3].trim(),t),r.length>1){let n=r[1].match(zt);""==n[1].trim()&&""==n[3].trim()||wt.throwArgumentError("unexpected tokens","value",e),t.outputs=Ct(n[2],!1)}else t.outputs=[];return Ot.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}}function Lt(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||wt.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}class Dt extends Bt{format(e){if(e||(e=Tt.sighash),Tt[e]||wt.throwArgumentError("invalid format type","format",e),e===Tt.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(t=>JSON.parse(t.format(e)))});let t="";return e!==Tt.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map(t=>t.format(e)).join(e===Tt.full?", ":",")+") ",t.trim()}static from(e){return"string"==typeof e?Dt.fromString(e):Dt.fromObject(e)}static fromObject(e){if(Dt.isErrorFragment(e))return e;"error"!==e.type&&wt.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:Ht(e.name),inputs:e.inputs?e.inputs.map(It.fromObject):[]};return Lt(new Dt(vt,t))}static fromString(e){let t={type:"error"},r=e.match(zt);return r||wt.throwArgumentError("invalid error signature","value",e),t.name=r[1].trim(),t.name&&Ht(t.name),t.inputs=Ct(r[2],!1),Lt(Dt.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}}function Ut(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const Ft=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Ht(e){return e&&e.match(Ft)||wt.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const zt=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$"),$t=new b(le),Gt=new RegExp(/^bytes([0-9]*)$/),jt=new RegExp(/^(u?int)([0-9]*)$/);class qt{constructor(e){ee(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new Qe(e.name);case"bool":return new nt(e.name);case"string":return new yt(e.name);case"bytes":return new st(e.name);case"array":return new rt(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new bt((e.components||[]).map(e=>this._getCoder(e)),e.name);case"":return new at(e.name)}let t=e.type.match(jt);if(t){let r=parseInt(t[2]||"256");return(0===r||r>256||r%8!=0)&&$t.throwArgumentError("invalid "+t[1]+" bit length","param",e),new mt(r/8,"int"===t[1],e.name)}if(t=e.type.match(Gt),t){let r=parseInt(t[1]);return(0===r||r>32)&&$t.throwArgumentError("invalid bytes length","param",e),new ot(r,e.name)}return $t.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new ge(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new pe(this._getWordSize())}getDefaultValue(e){const t=e.map(e=>this._getCoder(It.from(e)));return new bt(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&$t.throwError("types/values length mismatch",b.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const r=e.map(e=>this._getCoder(It.from(e))),n=new bt(r,"_"),i=this._getWriter();return n.encode(i,t),i.data}decode(e,t,r){const n=e.map(e=>this._getCoder(It.from(e)));return new bt(n,"_").decode(this._getReader(T(t),r))}}const Kt=new qt,Vt=new b(le);class Wt extends ue{}class Yt extends ue{}class Jt extends ue{}class Qt extends ue{static isIndexed(e){return!(!e||!e._isIndexed)}}const Xt={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Zt(e,t){const r=new Error(`deferred error during ABI decoding triggered accessing ${e}`);return r.error=t,r}class er{constructor(e){let t=[];t="string"==typeof e?JSON.parse(e):e,ee(this,"fragments",t.map(e=>Bt.from(e)).filter(e=>null!=e)),ee(this,"_abiCoder",te(new.target,"getAbiCoder")()),ee(this,"functions",{}),ee(this,"errors",{}),ee(this,"events",{}),ee(this,"structs",{}),this.fragments.forEach(e=>{let t=null;switch(e.type){case"constructor":return this.deploy?void Vt.warn("duplicate definition - constructor"):void ee(this,"deploy",e);case"function":t=this.functions;break;case"event":t=this.events;break;case"error":t=this.errors;break;default:return}let r=e.format();t[r]?Vt.warn("duplicate definition - "+r):t[r]=e}),this.deploy||ee(this,"deploy",Pt.from({payable:!1,type:"constructor"})),ee(this,"_isInterface",!0)}format(e){e||(e=Tt.full),e===Tt.sighash&&Vt.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map(t=>t.format(e));return e===Tt.json?JSON.stringify(t.map(e=>JSON.parse(e))):t}static getAbiCoder(){return Kt}static getAddress(e){return Re(e)}static getSighash(e){return R(Je(e.format()),0,4)}static getEventTopic(e){return Je(e.format())}getFunction(e){if(B(e)){for(const t in this.functions)if(e===this.getSighash(t))return this.functions[t];Vt.throwArgumentError("no matching function","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),r=Object.keys(this.functions).filter(e=>e.split("(")[0]===t);return 0===r.length?Vt.throwArgumentError("no matching function","name",t):r.length>1&&Vt.throwArgumentError("multiple matching functions","name",t),this.functions[r[0]]}const t=this.functions[Ot.fromString(e).format()];return t||Vt.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(B(e)){const t=e.toLowerCase();for(const e in this.events)if(t===this.getEventTopic(e))return this.events[e];Vt.throwArgumentError("no matching event","topichash",t)}if(-1===e.indexOf("(")){const t=e.trim(),r=Object.keys(this.events).filter(e=>e.split("(")[0]===t);return 0===r.length?Vt.throwArgumentError("no matching event","name",t):r.length>1&&Vt.throwArgumentError("multiple matching events","name",t),this.events[r[0]]}const t=this.events[Nt.fromString(e).format()];return t||Vt.throwArgumentError("no matching event","signature",e),t}getError(e){if(B(e)){const t=te(this.constructor,"getSighash");for(const r in this.errors)if(e===t(this.errors[r]))return this.errors[r];Vt.throwArgumentError("no matching error","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),r=Object.keys(this.errors).filter(e=>e.split("(")[0]===t);return 0===r.length?Vt.throwArgumentError("no matching error","name",t):r.length>1&&Vt.throwArgumentError("multiple matching errors","name",t),this.errors[r[0]]}const t=this.errors[Ot.fromString(e).format()];return t||Vt.throwArgumentError("no matching error","signature",e),t}getSighash(e){if("string"==typeof e)try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch(e){throw t}}return te(this.constructor,"getSighash")(e)}getEventTopic(e){return"string"==typeof e&&(e=this.getEvent(e)),te(this.constructor,"getEventTopic")(e)}_decodeParams(e,t){return this._abiCoder.decode(e,t)}_encodeParams(e,t){return this._abiCoder.encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){"string"==typeof e&&(e=this.getError(e));const r=T(t);return _(r.slice(0,4))!==this.getSighash(e)&&Vt.throwArgumentError(`data signature does not match error ${e.name}.`,"data",_(r)),this._decodeParams(e.inputs,r.slice(4))}encodeErrorResult(e,t){return"string"==typeof e&&(e=this.getError(e)),_(S([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){"string"==typeof e&&(e=this.getFunction(e));const r=T(t);return _(r.slice(0,4))!==this.getSighash(e)&&Vt.throwArgumentError(`data signature does not match function ${e.name}.`,"data",_(r)),this._decodeParams(e.inputs,r.slice(4))}encodeFunctionData(e,t){return"string"==typeof e&&(e=this.getFunction(e)),_(S([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){"string"==typeof e&&(e=this.getFunction(e));let r=T(t),n=null,i="",s=null,o=null,a=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch(e){}break;case 4:{const e=_(r.slice(0,4)),t=Xt[e];if(t)s=this._abiCoder.decode(t.inputs,r.slice(4)),o=t.name,a=t.signature,t.reason&&(n=s[0]),"Error"===o?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(s[0])}`:"Panic"===o&&(i=`; VM Exception while processing transaction: reverted with panic code ${s[0]}`);else try{const t=this.getError(e);s=this._abiCoder.decode(t.inputs,r.slice(4)),o=t.name,a=t.format()}catch(e){}break}}return Vt.throwError("call revert exception"+i,b.errors.CALL_EXCEPTION,{method:e.format(),data:_(t),errorArgs:s,errorName:o,errorSignature:a,reason:n})}encodeFunctionResult(e,t){return"string"==typeof e&&(e=this.getFunction(e)),_(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){"string"==typeof e&&(e=this.getEvent(e)),t.length>e.inputs.length&&Vt.throwError("too many arguments for "+e.format(),b.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let r=[];e.anonymous||r.push(this.getEventTopic(e));const n=(e,t)=>"string"===e.type?Je(t):"bytes"===e.type?be(_(t)):("bool"===e.type&&"boolean"==typeof t&&(t=t?"0x01":"0x00"),e.type.match(/^u?int/)&&(t=W.from(t).toHexString()),"address"===e.type&&this._abiCoder.encode(["address"],[t]),D(_(t),32));for(t.forEach((t,i)=>{let s=e.inputs[i];s.indexed?null==t?r.push(null):"array"===s.baseType||"tuple"===s.baseType?Vt.throwArgumentError("filtering with tuples or arrays not supported","contract."+s.name,t):Array.isArray(t)?r.push(t.map(e=>n(s,e))):r.push(n(s,t)):null!=t&&Vt.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+s.name,t)});r.length&&null===r[r.length-1];)r.pop();return r}encodeEventLog(e,t){"string"==typeof e&&(e=this.getEvent(e));const r=[],n=[],i=[];return e.anonymous||r.push(this.getEventTopic(e)),t.length!==e.inputs.length&&Vt.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach((e,s)=>{const o=t[s];if(e.indexed)if("string"===e.type)r.push(Je(o));else if("bytes"===e.type)r.push(be(o));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");r.push(this._abiCoder.encode([e.type],[o]))}else n.push(e),i.push(o)}),{data:this._abiCoder.encode(n,i),topics:r}}decodeEventLog(e,t,r){if("string"==typeof e&&(e=this.getEvent(e)),null!=r&&!e.anonymous){let t=this.getEventTopic(e);B(r[0],32)&&r[0].toLowerCase()===t||Vt.throwError("fragment/topic mismatch",b.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:t,value:r[0]}),r=r.slice(1)}let n=[],i=[],s=[];e.inputs.forEach((e,t)=>{e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(n.push(It.fromObject({type:"bytes32",name:e.name})),s.push(!0)):(n.push(e),s.push(!1)):(i.push(e),s.push(!1))});let o=null!=r?this._abiCoder.decode(n,S(r)):null,a=this._abiCoder.decode(i,t,!0),c=[],u=0,l=0;e.inputs.forEach((e,t)=>{if(e.indexed)if(null==o)c[t]=new Qt({_isIndexed:!0,hash:null});else if(s[t])c[t]=new Qt({_isIndexed:!0,hash:o[l++]});else try{c[t]=o[l++]}catch(e){c[t]=e}else try{c[t]=a[u++]}catch(e){c[t]=e}if(e.name&&null==c[e.name]){const r=c[t];r instanceof Error?Object.defineProperty(c,e.name,{enumerable:!0,get:()=>{throw Zt(`property ${JSON.stringify(e.name)}`,r)}}):c[e.name]=r}});for(let e=0;e<c.length;e++){const t=c[e];t instanceof Error&&Object.defineProperty(c,e,{enumerable:!0,get:()=>{throw Zt(`index ${e}`,t)}})}return Object.freeze(c)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new Yt({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:W.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new Wt({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){const t=_(e);let r=this.getError(t.substring(0,10).toLowerCase());return r?new Jt({args:this._abiCoder.decode(r.inputs,"0x"+t.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(e){return!(!e||!e._isInterface)}}const tr=new b("abstract-provider/5.8.0");class rr extends ue{static isForkEvent(e){return!(!e||!e._isForkEvent)}}class nr{constructor(){tr.checkAbstract(new.target,nr),ee(this,"_isProvider",!0)}getFeeData(){return e=this,t=void 0,n=function*(){const{block:e,gasPrice:t}=yield re({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(e=>null)});let r=null,n=null,i=null;return e&&e.baseFeePerGas&&(r=e.baseFeePerGas,i=W.from("1500000000"),n=e.baseFeePerGas.mul(2).add(i)),{lastBaseFeePerGas:r,maxFeePerGas:n,maxPriorityFeePerGas:i,gasPrice:t}},new((r=void 0)||(r=Promise))(function(i,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((n=n.apply(e,t||[])).next())});var e,t,r,n}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}static isProvider(e){return!(!e||!e._isProvider)}}var ir=function(e,t,r,n){return new(r||(r=Promise))(function(i,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((n=n.apply(e,t||[])).next())})};const sr=new b("abstract-signer/5.8.0"),or=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],ar=[b.errors.INSUFFICIENT_FUNDS,b.errors.NONCE_EXPIRED,b.errors.REPLACEMENT_UNDERPRICED];class cr{constructor(){sr.checkAbstract(new.target,cr),ee(this,"_isSigner",!0)}getBalance(e){return ir(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return ir(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return ir(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const t=yield re(this.checkTransaction(e));return yield this.provider.estimateGas(t)})}call(e,t){return ir(this,void 0,void 0,function*(){this._checkProvider("call");const r=yield re(this.checkTransaction(e));return yield this.provider.call(r,t)})}sendTransaction(e){return ir(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const t=yield this.populateTransaction(e),r=yield this.signTransaction(t);return yield this.provider.sendTransaction(r)})}getChainId(){return ir(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return ir(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return ir(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return ir(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const t in e)-1===or.indexOf(t)&&sr.throwArgumentError("invalid transaction key: "+t,"transaction",e);const t=ie(e);return null==t.from?t.from=this.getAddress():t.from=Promise.all([Promise.resolve(t.from),this.getAddress()]).then(t=>(t[0].toLowerCase()!==t[1].toLowerCase()&&sr.throwArgumentError("from address mismatch","transaction",e),t[0])),t}populateTransaction(e){return ir(this,void 0,void 0,function*(){const t=yield re(this.checkTransaction(e));null!=t.to&&(t.to=Promise.resolve(t.to).then(e=>ir(this,void 0,void 0,function*(){if(null==e)return null;const t=yield this.resolveName(e);return null==t&&sr.throwArgumentError("provided ENS name resolves to null","tx.to",e),t})),t.to.catch(e=>{}));const r=null!=t.maxFeePerGas||null!=t.maxPriorityFeePerGas;if(null==t.gasPrice||2!==t.type&&!r?0!==t.type&&1!==t.type||!r||sr.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e):sr.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e),2!==t.type&&null!=t.type||null==t.maxFeePerGas||null==t.maxPriorityFeePerGas)if(0===t.type||1===t.type)null==t.gasPrice&&(t.gasPrice=this.getGasPrice());else{const e=yield this.getFeeData();if(null==t.type)if(null!=e.maxFeePerGas&&null!=e.maxPriorityFeePerGas)if(t.type=2,null!=t.gasPrice){const e=t.gasPrice;delete t.gasPrice,t.maxFeePerGas=e,t.maxPriorityFeePerGas=e}else null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas);else null!=e.gasPrice?(r&&sr.throwError("network does not support EIP-1559",b.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==t.gasPrice&&(t.gasPrice=e.gasPrice),t.type=0):sr.throwError("failed to get consistent fee data",b.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===t.type&&(null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas))}else t.type=2;return null==t.nonce&&(t.nonce=this.getTransactionCount("pending")),null==t.gasLimit&&(t.gasLimit=this.estimateGas(t).catch(e=>{if(ar.indexOf(e.code)>=0)throw e;return sr.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",b.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,tx:t})})),null==t.chainId?t.chainId=this.getChainId():t.chainId=Promise.all([Promise.resolve(t.chainId),this.getChainId()]).then(t=>(0!==t[1]&&t[0]!==t[1]&&sr.throwArgumentError("chainId address mismatch","transaction",e),t[0])),yield re(t)})}_checkProvider(e){this.provider||sr.throwError("missing provider",b.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!(!e||!e._isSigner)}}class ur extends cr{constructor(e,t){super(),ee(this,"address",e),ee(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then(()=>{sr.throwError(e,b.errors.UNSUPPORTED_OPERATION,{operation:t})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,t,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new ur(this.address,e)}}var lr=r(9499),hr=r.n(lr);function dr(e,t,r){return r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},e(r,r.exports),r.exports}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self;var fr=pr;function pr(e,t){if(!e)throw new Error(t||"Assertion failed")}pr.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var gr=dr(function(e,t){var r=t;function n(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",r=0;r<e.length;r++)t+=n(e[r].toString(16));return t}r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16));else for(n=0;n<e.length;n++){var i=e.charCodeAt(n),s=i>>8,o=255&i;s?r.push(s,o):r.push(o)}return r},r.zero2=n,r.toHex=i,r.encode=function(e,t){return"hex"===t?i(e):e}}),mr=dr(function(e,t){var r=t;r.assert=fr,r.toArray=gr.toArray,r.zero2=gr.zero2,r.toHex=gr.toHex,r.encode=gr.encode,r.getNAF=function(e,t,r){var n,i=new Array(Math.max(e.bitLength(),r)+1);for(n=0;n<i.length;n+=1)i[n]=0;var s=1<<t+1,o=e.clone();for(n=0;n<i.length;n++){var a,c=o.andln(s-1);o.isOdd()?(a=c>(s>>1)-1?(s>>1)-c:c,o.isubn(a)):a=0,i[n]=a,o.iushrn(1)}return i},r.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,s=0;e.cmpn(-i)>0||t.cmpn(-s)>0;){var o,a,c=e.andln(3)+i&3,u=t.andln(3)+s&3;3===c&&(c=-1),3===u&&(u=-1),o=1&c?3!=(n=e.andln(7)+i&7)&&5!==n||2!==u?c:-c:0,r[0].push(o),a=1&u?3!=(n=t.andln(7)+s&7)&&5!==n||2!==c?u:-u:0,r[1].push(a),2*i===o+1&&(i=1-i),2*s===a+1&&(s=1-s),e.iushrn(1),t.iushrn(1)}return r},r.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(e){return"string"==typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new(z())(e,"hex","le")}}),yr=mr.getNAF,br=mr.getJSF,wr=mr.assert;function vr(e,t){this.type=e,this.p=new(z())(t.p,16),this.red=t.prime?z().red(t.prime):z().mont(this.p),this.zero=new(z())(0).toRed(this.red),this.one=new(z())(1).toRed(this.red),this.two=new(z())(2).toRed(this.red),this.n=t.n&&new(z())(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ar=vr;function Er(e,t){this.curve=e,this.type=t,this.precomputed=null}vr.prototype.point=function(){throw new Error("Not implemented")},vr.prototype.validate=function(){throw new Error("Not implemented")},vr.prototype._fixedNafMul=function(e,t){wr(e.precomputed);var r=e._getDoubles(),n=yr(t,1,this._bitLength),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;var s,o,a=[];for(s=0;s<n.length;s+=r.step){o=0;for(var c=s+r.step-1;c>=s;c--)o=(o<<1)+n[c];a.push(o)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=i;h>0;h--){for(s=0;s<a.length;s++)(o=a[s])===h?l=l.mixedAdd(r.points[s]):o===-h&&(l=l.mixedAdd(r.points[s].neg()));u=u.add(l)}return u.toP()},vr.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var i=n.points,s=yr(t,r,this._bitLength),o=this.jpoint(null,null,null),a=s.length-1;a>=0;a--){for(var c=0;a>=0&&0===s[a];a--)c++;if(a>=0&&c++,o=o.dblp(c),a<0)break;var u=s[a];wr(0!==u),o="affine"===e.type?u>0?o.mixedAdd(i[u-1>>1]):o.mixedAdd(i[-u-1>>1].neg()):u>0?o.add(i[u-1>>1]):o.add(i[-u-1>>1].neg())}return"affine"===e.type?o.toP():o},vr.prototype._wnafMulAdd=function(e,t,r,n,i){var s,o,a,c=this._wnafT1,u=this._wnafT2,l=this._wnafT3,h=0;for(s=0;s<n;s++){var d=(a=t[s])._getNAFPoints(e);c[s]=d.wnd,u[s]=d.points}for(s=n-1;s>=1;s-=2){var f=s-1,p=s;if(1===c[f]&&1===c[p]){var g=[t[f],null,null,t[p]];0===t[f].y.cmp(t[p].y)?(g[1]=t[f].add(t[p]),g[2]=t[f].toJ().mixedAdd(t[p].neg())):0===t[f].y.cmp(t[p].y.redNeg())?(g[1]=t[f].toJ().mixedAdd(t[p]),g[2]=t[f].add(t[p].neg())):(g[1]=t[f].toJ().mixedAdd(t[p]),g[2]=t[f].toJ().mixedAdd(t[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],y=br(r[f],r[p]);for(h=Math.max(y[0].length,h),l[f]=new Array(h),l[p]=new Array(h),o=0;o<h;o++){var b=0|y[0][o],w=0|y[1][o];l[f][o]=m[3*(b+1)+(w+1)],l[p][o]=0,u[f]=g}}else l[f]=yr(r[f],c[f],this._bitLength),l[p]=yr(r[p],c[p],this._bitLength),h=Math.max(l[f].length,h),h=Math.max(l[p].length,h)}var v=this.jpoint(null,null,null),A=this._wnafT4;for(s=h;s>=0;s--){for(var E=0;s>=0;){var x=!0;for(o=0;o<n;o++)A[o]=0|l[o][s],0!==A[o]&&(x=!1);if(!x)break;E++,s--}if(s>=0&&E++,v=v.dblp(E),s<0)break;for(o=0;o<n;o++){var k=A[o];0!==k&&(k>0?a=u[o][k-1>>1]:k<0&&(a=u[o][-k-1>>1].neg()),v="affine"===a.type?v.mixedAdd(a):v.add(a))}}for(s=0;s<n;s++)u[s]=null;return i?v:v.toP()},vr.BasePoint=Er,Er.prototype.eq=function(){throw new Error("Not implemented")},Er.prototype.validate=function(){return this.curve.validate(this)},vr.prototype.decodePoint=function(e,t){e=mr.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?wr(e[e.length-1]%2==0):7===e[0]&&wr(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},Er.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Er.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},Er.prototype.encode=function(e,t){return mr.encode(this._encode(t),e)},Er.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Er.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},Er.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<t;i+=e){for(var s=0;s<e;s++)n=n.dbl();r.push(n)}return{step:e,points:r}},Er.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)t[i]=t[i-1].add(n);return{wnd:e,points:t}},Er.prototype._getBeta=function(){return null},Er.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var xr=dr(function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}}),kr=mr.assert;function Tr(e){Ar.call(this,"short",e),this.a=new(z())(e.a,16).toRed(this.red),this.b=new(z())(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}xr(Tr,Ar);var Sr=Tr;function Ir(e,t,r,n){Ar.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new(z())(t,16),this.y=new(z())(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function Cr(e,t,r,n){Ar.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new(z())(0)):(this.x=new(z())(t,16),this.y=new(z())(r,16),this.z=new(z())(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Tr.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new(z())(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new(z())(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?r=i[0]:(r=i[1],kr(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map(function(e){return{a:new(z())(e.a,16),b:new(z())(e.b,16)}}):this._getEndoBasis(r)}}},Tr.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:z().mont(e),r=new(z())(2).toRed(t).redInvm(),n=r.redNeg(),i=new(z())(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},Tr.prototype._getEndoBasis=function(e){for(var t,r,n,i,s,o,a,c,u,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=e,d=this.n.clone(),f=new(z())(1),p=new(z())(0),g=new(z())(0),m=new(z())(1),y=0;0!==h.cmpn(0);){var b=d.div(h);c=d.sub(b.mul(h)),u=g.sub(b.mul(f));var w=m.sub(b.mul(p));if(!n&&c.cmp(l)<0)t=a.neg(),r=f,n=c.neg(),i=u;else if(n&&2===++y)break;a=c,d=h,h=c,g=f,f=u,m=p,p=w}s=c.neg(),o=u;var v=n.sqr().add(i.sqr());return s.sqr().add(o.sqr()).cmp(v)>=0&&(s=t,o=r),n.negative&&(n=n.neg(),i=i.neg()),s.negative&&(s=s.neg(),o=o.neg()),[{a:n,b:i},{a:s,b:o}]},Tr.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),s=r.b.neg().mul(e).divRound(this.n),o=i.mul(r.a),a=s.mul(n.a),c=i.mul(r.b),u=s.mul(n.b);return{k1:e.sub(o).sub(a),k2:c.add(u).neg()}},Tr.prototype.pointFromX=function(e,t){(e=new(z())(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},Tr.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},Tr.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,s=0;s<e.length;s++){var o=this._endoSplit(t[s]),a=e[s],c=a._getBeta();o.k1.negative&&(o.k1.ineg(),a=a.neg(!0)),o.k2.negative&&(o.k2.ineg(),c=c.neg(!0)),n[2*s]=a,n[2*s+1]=c,i[2*s]=o.k1,i[2*s+1]=o.k2}for(var u=this._wnafMulAdd(1,n,i,2*s,r),l=0;l<2*s;l++)n[l]=null,i[l]=null;return u},xr(Ir,Ar.BasePoint),Tr.prototype.point=function(e,t,r){return new Ir(this,e,t,r)},Tr.prototype.pointFromJSON=function(e,t){return Ir.fromJSON(this,e,t)},Ir.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Ir.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Ir.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function i(t){return e.point(t[0],t[1],r)}var s=t[2];return n.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[n].concat(s.doubles.points.map(i))},naf:s.naf&&{wnd:s.naf.wnd,points:[n].concat(s.naf.points.map(i))}},n},Ir.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Ir.prototype.isInfinity=function(){return this.inf},Ir.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},Ir.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),s=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},Ir.prototype.getX=function(){return this.x.fromRed()},Ir.prototype.getY=function(){return this.y.fromRed()},Ir.prototype.mul=function(e){return e=new(z())(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Ir.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},Ir.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},Ir.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},Ir.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},Ir.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},xr(Cr,Ar.BasePoint),Tr.prototype.jpoint=function(e,t,r){return new Cr(this,e,t,r)},Cr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},Cr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Cr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),s=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),a=n.redSub(i),c=s.redSub(o);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),h=n.redMul(u),d=c.redSqr().redIAdd(l).redISub(h).redISub(h),f=c.redMul(h.redISub(d)).redISub(s.redMul(l)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(d,f,p)},Cr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,s=e.y.redMul(t).redMul(this.z),o=r.redSub(n),a=i.redSub(s);if(0===o.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=o.redSqr(),u=c.redMul(o),l=r.redMul(c),h=a.redSqr().redIAdd(u).redISub(l).redISub(l),d=a.redMul(l.redISub(h)).redISub(i.redMul(u)),f=this.z.redMul(o);return this.curve.jpoint(h,d,f)},Cr.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,s=this.x,o=this.y,a=this.z,c=a.redSqr().redSqr(),u=o.redAdd(o);for(t=0;t<e;t++){var l=s.redSqr(),h=u.redSqr(),d=h.redSqr(),f=l.redAdd(l).redIAdd(l).redIAdd(n.redMul(c)),p=s.redMul(h),g=f.redSqr().redISub(p.redAdd(p)),m=p.redISub(g),y=f.redMul(m);y=y.redIAdd(y).redISub(d);var b=u.redMul(a);t+1<e&&(c=c.redMul(d)),s=g,a=b,u=y}return this.curve.jpoint(s,u.redMul(i),a)},Cr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Cr.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(n).redISub(s);o=o.redIAdd(o);var a=n.redAdd(n).redIAdd(n),c=a.redSqr().redISub(o).redISub(o),u=s.redIAdd(s);u=(u=u.redIAdd(u)).redIAdd(u),e=c,t=a.redMul(o.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),h=this.y.redSqr(),d=h.redSqr(),f=this.x.redAdd(h).redSqr().redISub(l).redISub(d);f=f.redIAdd(f);var p=l.redAdd(l).redIAdd(l),g=p.redSqr(),m=d.redIAdd(d);m=(m=m.redIAdd(m)).redIAdd(m),e=g.redISub(f).redISub(f),t=p.redMul(f.redISub(e)).redISub(m),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},Cr.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(n).redISub(s);o=o.redIAdd(o);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),c=a.redSqr().redISub(o).redISub(o);e=c;var u=s.redIAdd(s);u=(u=u.redIAdd(u)).redIAdd(u),t=a.redMul(o.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),h=this.y.redSqr(),d=this.x.redMul(h),f=this.x.redSub(l).redMul(this.x.redAdd(l));f=f.redAdd(f).redIAdd(f);var p=d.redIAdd(d),g=(p=p.redIAdd(p)).redAdd(p);e=f.redSqr().redISub(g),r=this.y.redAdd(this.z).redSqr().redISub(h).redISub(l);var m=h.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),t=f.redMul(p.redISub(e)).redISub(m)}return this.curve.jpoint(e,t,r)},Cr.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),s=t.redSqr(),o=r.redSqr(),a=s.redAdd(s).redIAdd(s).redIAdd(e.redMul(i)),c=t.redAdd(t),u=(c=c.redIAdd(c)).redMul(o),l=a.redSqr().redISub(u.redAdd(u)),h=u.redISub(l),d=o.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=a.redMul(h).redISub(d),p=r.redAdd(r).redMul(n);return this.curve.jpoint(l,f,p)},Cr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),i=e.redAdd(e).redIAdd(e),s=i.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(n),a=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(s)).redSqr(),c=n.redIAdd(n);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var u=i.redIAdd(o).redSqr().redISub(s).redISub(a).redISub(c),l=t.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var h=this.x.redMul(a).redISub(l);h=(h=h.redIAdd(h)).redIAdd(h);var d=this.y.redMul(u.redMul(c.redISub(u)).redISub(o.redMul(a)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=this.z.redAdd(o).redSqr().redISub(r).redISub(a);return this.curve.jpoint(h,d,f)},Cr.prototype.mul=function(e,t){return e=new(z())(e,t),this.curve._wnafMul(this,e)},Cr.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),i=r.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(n)).cmpn(0)},Cr.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),i=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},Cr.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},Cr.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var Br=dr(function(e,t){var r=t;r.base=Ar,r.short=Sr,r.mont=null,r.edwards=null}),Nr=dr(function(e,t){var r,n=t,i=mr.assert;function s(e){"short"===e.type?this.curve=new Br.short(e):"edwards"===e.type?this.curve=new Br.edwards(e):this.curve=new Br.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function o(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new s(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=s,o("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:hr().sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:hr().sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:hr().sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:hr().sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),o("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:hr().sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hr().sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hr().sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(e){r=void 0}o("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:hr().sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})});function _r(e){if(!(this instanceof _r))return new _r(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=gr.toArray(e.entropy,e.entropyEnc||"hex"),r=gr.toArray(e.nonce,e.nonceEnc||"hex"),n=gr.toArray(e.pers,e.persEnc||"hex");fr(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var Mr=_r;_r.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},_r.prototype._hmac=function(){return new(hr().hmac)(this.hash,this.K)},_r.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},_r.prototype.reseed=function(e,t,r,n){"string"!=typeof t&&(n=r,r=t,t=null),e=gr.toArray(e,t),r=gr.toArray(r,n),fr(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},_r.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=gr.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length<e;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var s=i.slice(0,e);return this._update(r),this._reseed++,gr.encode(s,t)};var Rr=mr.assert;function Pr(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var Or=Pr;Pr.fromPublic=function(e,t,r){return t instanceof Pr?t:new Pr(e,{pub:t,pubEnc:r})},Pr.fromPrivate=function(e,t,r){return t instanceof Pr?t:new Pr(e,{priv:t,privEnc:r})},Pr.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},Pr.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},Pr.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},Pr.prototype._importPrivate=function(e,t){this.priv=new(z())(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},Pr.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?Rr(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||Rr(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},Pr.prototype.derive=function(e){return e.validate()||Rr(e.validate(),"public point not validated"),e.mul(this.priv).getX()},Pr.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},Pr.prototype.verify=function(e,t,r){return this.ec.verify(e,t,this,void 0,r)},Pr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var Lr=mr.assert;function Dr(e,t){if(e instanceof Dr)return e;this._importDER(e,t)||(Lr(e.r&&e.s,"Signature without r or s"),this.r=new(z())(e.r,16),this.s=new(z())(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var Ur=Dr;function Fr(){this.place=0}function Hr(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;if(0===e[t.place])return!1;for(var i=0,s=0,o=t.place;s<n;s++,o++)i<<=8,i|=e[o],i>>>=0;return!(i<=127)&&(t.place=o,i)}function zr(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function $r(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}Dr.prototype._importDER=function(e,t){e=mr.toArray(e,t);var r=new Fr;if(48!==e[r.place++])return!1;var n=Hr(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var i=Hr(e,r);if(!1===i)return!1;if(128&e[r.place])return!1;var s=e.slice(r.place,i+r.place);if(r.place+=i,2!==e[r.place++])return!1;var o=Hr(e,r);if(!1===o)return!1;if(e.length!==o+r.place)return!1;if(128&e[r.place])return!1;var a=e.slice(r.place,o+r.place);if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new(z())(s),this.s=new(z())(a),this.recoveryParam=null,!0},Dr.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=zr(t),r=zr(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];$r(n,t.length),(n=n.concat(t)).push(2),$r(n,r.length);var i=n.concat(r),s=[48];return $r(s,i.length),s=s.concat(i),mr.encode(s,e)};var Gr=function(){throw new Error("unsupported")},jr=mr.assert;function qr(e){if(!(this instanceof qr))return new qr(e);"string"==typeof e&&(jr(Object.prototype.hasOwnProperty.call(Nr,e),"Unknown curve "+e),e=Nr[e]),e instanceof Nr.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var Kr=qr;qr.prototype.keyPair=function(e){return new Or(this,e)},qr.prototype.keyFromPrivate=function(e,t){return Or.fromPrivate(this,e,t)},qr.prototype.keyFromPublic=function(e,t){return Or.fromPublic(this,e,t)},qr.prototype.genKeyPair=function(e){e||(e={});for(var t=new Mr({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Gr(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new(z())(2));;){var i=new(z())(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},qr.prototype._truncateToN=function(e,t,r){var n;if(z().isBN(e)||"number"==typeof e)n=(e=new(z())(e,16)).byteLength();else if("object"==typeof e)n=e.length,e=new(z())(e,16);else{var i=e.toString();n=i.length+1>>>1,e=new(z())(i,16)}"number"!=typeof r&&(r=8*n);var s=r-this.n.bitLength();return s>0&&(e=e.ushrn(s)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},qr.prototype.sign=function(e,t,r,n){if("object"==typeof r&&(n=r,r=null),n||(n={}),"string"!=typeof e&&"number"!=typeof e&&!z().isBN(e)){jr("object"==typeof e&&e&&"number"==typeof e.length,"Expected message to be an array-like, a hex string, or a BN instance"),jr(e.length>>>0===e.length);for(var i=0;i<e.length;i++)jr((255&e[i])===e[i])}t=this.keyFromPrivate(t,r),e=this._truncateToN(e,!1,n.msgBitLength),jr(!e.isNeg(),"Can not sign a negative message");var s=this.n.byteLength(),o=t.getPrivate().toArray("be",s),a=e.toArray("be",s);jr(new(z())(a).eq(e),"Can not sign message");for(var c=new Mr({hash:this.hash,entropy:o,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new(z())(1)),l=0;;l++){var h=n.k?n.k(l):new(z())(c.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(u)>=0)){var d=this.g.mul(h);if(!d.isInfinity()){var f=d.getX(),p=f.umod(this.n);if(0!==p.cmpn(0)){var g=h.invm(this.n).mul(p.mul(t.getPrivate()).iadd(e));if(0!==(g=g.umod(this.n)).cmpn(0)){var m=(d.getY().isOdd()?1:0)|(0!==f.cmp(p)?2:0);return n.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g),m^=1),new Ur({r:p,s:g,recoveryParam:m})}}}}}},qr.prototype.verify=function(e,t,r,n,i){i||(i={}),e=this._truncateToN(e,!1,i.msgBitLength),r=this.keyFromPublic(r,n);var s=(t=new Ur(t,"hex")).r,o=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,c=o.invm(this.n),u=c.mul(e).umod(this.n),l=c.mul(s).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,r.getPublic(),l)).isInfinity()&&a.eqXToP(s):!(a=this.g.mulAdd(u,r.getPublic(),l)).isInfinity()&&0===a.getX().umod(this.n).cmp(s)},qr.prototype.recoverPubKey=function(e,t,r,n){jr((3&r)===r,"The recovery param is more than two bits"),t=new Ur(t,n);var i=this.n,s=new(z())(e),o=t.r,a=t.s,c=1&r,u=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");o=u?this.curve.pointFromX(o.add(this.curve.n),c):this.curve.pointFromX(o,c);var l=t.r.invm(i),h=i.sub(s).mul(l).umod(i),d=a.mul(l).umod(i);return this.g.mulAdd(h,o,d)},qr.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new Ur(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(e,t,i)}catch(e){continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var Vr=dr(function(e,t){var r=t;r.version="6.6.1",r.utils=mr,r.rand=function(){throw new Error("unsupported")},r.curve=Br,r.curves=Nr,r.ec=Kr,r.eddsa=null}).ec;const Wr=new b("signing-key/5.8.0");let Yr=null;function Jr(){return Yr||(Yr=new Vr("secp256k1")),Yr}class Qr{constructor(e){ee(this,"curve","secp256k1"),ee(this,"privateKey",_(e)),32!==M(this.privateKey)&&Wr.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Jr().keyFromPrivate(T(this.privateKey));ee(this,"publicKey","0x"+t.getPublic(!1,"hex")),ee(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),ee(this,"_isSigningKey",!0)}_addPoint(e){const t=Jr().keyFromPublic(T(this.publicKey)),r=Jr().keyFromPublic(T(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=Jr().keyFromPrivate(T(this.privateKey)),r=T(e);32!==r.length&&Wr.throwArgumentError("bad digest length","digest",e);const n=t.sign(r,{canonical:!0});return U({recoveryParam:n.recoveryParam,r:D("0x"+n.r.toString(16),32),s:D("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const t=Jr().keyFromPrivate(T(this.privateKey)),r=Jr().keyFromPublic(T(Zr(e)));return D("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!(!e||!e._isSigningKey)}}function Xr(e,t){const r=U(t),n={r:T(r.r),s:T(r.s)};return"0x"+Jr().recoverPubKey(T(e),n,r.recoveryParam).encode("hex",!1)}function Zr(e,t){const r=T(e);if(32===r.length){const e=new Qr(r);return t?"0x"+Jr().keyFromPrivate(r).getPublic(!0,"hex"):e.publicKey}return 33===r.length?t?_(r):"0x"+Jr().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?t?"0x"+Jr().keyFromPublic(r).getPublic(!0,"hex"):_(r):Wr.throwArgumentError("invalid public or private key","key","[REDACTED]")}const en=new b("transactions/5.8.0");var tn;function rn(e){return"0x"===e?null:Re(e)}function nn(e){return"0x"===e?ut:W.from(e)}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(tn||(tn={}));const sn=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],on={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function an(e){return Re(R(be(R(Zr(e),1)),12))}function cn(e,t){return an(Xr(T(e),t))}function un(e,t){const r=I(W.from(e).toHexString());return r.length>32&&en.throwArgumentError("invalid length for "+t,"transaction:"+t,e),r}function ln(e,t){return{address:Re(e),storageKeys:(t||[]).map((t,r)=>(32!==M(t)&&en.throwArgumentError("invalid access list storageKey",`accessList[${e}:${r}]`,t),t.toLowerCase()))}}function hn(e){if(Array.isArray(e))return e.map((e,t)=>Array.isArray(e)?(e.length>2&&en.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${t}]`,e),ln(e[0],e[1])):ln(e.address,e.storageKeys));const t=Object.keys(e).map(t=>{const r=e[t].reduce((e,t)=>(e[t]=!0,e),{});return ln(t,Object.keys(r).sort())});return t.sort((e,t)=>e.address.localeCompare(t.address)),t}function dn(e){return hn(e).map(e=>[e.address,e.storageKeys])}function fn(e,t){if(null!=e.gasPrice){const t=W.from(e.gasPrice),r=W.from(e.maxFeePerGas||0);t.eq(r)||en.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:t,maxFeePerGas:r})}const r=[un(e.chainId||0,"chainId"),un(e.nonce||0,"nonce"),un(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),un(e.maxFeePerGas||0,"maxFeePerGas"),un(e.gasLimit||0,"gasLimit"),null!=e.to?Re(e.to):"0x",un(e.value||0,"value"),e.data||"0x",dn(e.accessList||[])];if(t){const e=U(t);r.push(un(e.recoveryParam,"recoveryParam")),r.push(I(e.r)),r.push(I(e.s))}return P(["0x02",xe(r)])}function pn(e,t){const r=[un(e.chainId||0,"chainId"),un(e.nonce||0,"nonce"),un(e.gasPrice||0,"gasPrice"),un(e.gasLimit||0,"gasLimit"),null!=e.to?Re(e.to):"0x",un(e.value||0,"value"),e.data||"0x",dn(e.accessList||[])];if(t){const e=U(t);r.push(un(e.recoveryParam,"recoveryParam")),r.push(I(e.r)),r.push(I(e.s))}return P(["0x01",xe(r)])}function gn(e,t){if(null==e.type||0===e.type)return null!=e.accessList&&en.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",e),function(e,t){ne(e,on);const r=[];sn.forEach(function(t){let n=e[t.name]||[];const i={};t.numeric&&(i.hexPad="left"),n=T(_(n,i)),t.length&&n.length!==t.length&&n.length>0&&en.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,n),t.maxLength&&(n=I(n),n.length>t.maxLength&&en.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,n)),r.push(_(n))});let n=0;if(null!=e.chainId?(n=e.chainId,"number"!=typeof n&&en.throwArgumentError("invalid transaction.chainId","transaction",e)):t&&!E(t)&&t.v>28&&(n=Math.floor((t.v-35)/2)),0!==n&&(r.push(_(n)),r.push("0x"),r.push("0x")),!t)return xe(r);const i=U(t);let s=27+i.recoveryParam;return 0!==n?(r.pop(),r.pop(),r.pop(),s+=2*n+8,i.v>28&&i.v!==s&&en.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t)):i.v!==s&&en.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t),r.push(_(s)),r.push(I(T(i.r))),r.push(I(T(i.s))),xe(r)}(e,t);switch(e.type){case 1:return pn(e,t);case 2:return fn(e,t)}return en.throwError(`unsupported transaction type: ${e.type}`,b.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:e.type})}function mn(e,t,r){try{const r=nn(t[0]).toNumber();if(0!==r&&1!==r)throw new Error("bad recid");e.v=r}catch(e){en.throwArgumentError("invalid v for transaction type: 1","v",t[0])}e.r=D(t[1],32),e.s=D(t[2],32);try{const t=be(r(e));e.from=cn(t,{r:e.r,s:e.s,recoveryParam:e.v})}catch(e){}}function yn(e){const t=T(e);if(t[0]>127)return function(e){const t=Se(e);9!==t.length&&6!==t.length&&en.throwArgumentError("invalid raw transaction","rawTransaction",e);const r={nonce:nn(t[0]).toNumber(),gasPrice:nn(t[1]),gasLimit:nn(t[2]),to:rn(t[3]),value:nn(t[4]),data:t[5],chainId:0};if(6===t.length)return r;try{r.v=W.from(t[6]).toNumber()}catch(e){return r}if(r.r=D(t[7],32),r.s=D(t[8],32),W.from(r.r).isZero()&&W.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=t.slice(0,6);0!==r.chainId&&(i.push(_(r.chainId)),i.push("0x"),i.push("0x"),n-=2*r.chainId+8);const s=be(xe(i));try{r.from=cn(s,{r:_(r.r),s:_(r.s),recoveryParam:n})}catch(e){}r.hash=be(e)}return r.type=null,r}(t);switch(t[0]){case 1:return function(e){const t=Se(e.slice(1));8!==t.length&&11!==t.length&&en.throwArgumentError("invalid component count for transaction type: 1","payload",_(e));const r={type:1,chainId:nn(t[0]).toNumber(),nonce:nn(t[1]).toNumber(),gasPrice:nn(t[2]),gasLimit:nn(t[3]),to:rn(t[4]),value:nn(t[5]),data:t[6],accessList:hn(t[7])};return 8===t.length||(r.hash=be(e),mn(r,t.slice(8),pn)),r}(t);case 2:return function(e){const t=Se(e.slice(1));9!==t.length&&12!==t.length&&en.throwArgumentError("invalid component count for transaction type: 2","payload",_(e));const r=nn(t[2]),n=nn(t[3]),i={type:2,chainId:nn(t[0]).toNumber(),nonce:nn(t[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:nn(t[4]),to:rn(t[5]),value:nn(t[6]),data:t[7],accessList:hn(t[8])};return 9===t.length||(i.hash=be(e),mn(i,t.slice(9),fn)),i}(t)}return en.throwError(`unsupported transaction type: ${t[0]}`,b.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:t[0]})}var bn=function(e,t,r,n){return new(r||(r=Promise))(function(i,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((n=n.apply(e,t||[])).next())})};const wn=new b("contracts/5.8.0"),vn={chainId:!0,data:!0,from:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0,customData:!0,ccipReadEnabled:!0};function An(e,t){return bn(this,void 0,void 0,function*(){const r=yield t;"string"!=typeof r&&wn.throwArgumentError("invalid address or ENS name","name",r);try{return Re(r)}catch(e){}e||wn.throwError("a provider or signer is needed to resolve ENS names",b.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield e.resolveName(r);return null==n&&wn.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n})}function En(e,t,r){return bn(this,void 0,void 0,function*(){return Array.isArray(r)?yield Promise.all(r.map((r,n)=>En(e,Array.isArray(t)?t[n]:t[r.name],r))):"address"===r.type?yield An(e,t):"tuple"===r.type?yield En(e,t,r.components):"array"===r.baseType?Array.isArray(t)?yield Promise.all(t.map(t=>En(e,t,r.arrayChildren))):Promise.reject(wn.makeError("invalid value for array",b.errors.INVALID_ARGUMENT,{argument:"value",value:t})):t})}function xn(e,t,r){return bn(this,void 0,void 0,function*(){let n={};r.length===t.inputs.length+1&&"object"==typeof r[r.length-1]&&(n=ie(r.pop())),wn.checkArgumentCount(r.length,t.inputs.length,"passed to contract"),e.signer?n.from?n.from=re({override:An(e.signer,n.from),signer:e.signer.getAddress()}).then(e=>bn(this,void 0,void 0,function*(){return Re(e.signer)!==e.override&&wn.throwError("Contract with a Signer cannot override from",b.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),e.override})):n.from=e.signer.getAddress():n.from&&(n.from=An(e.provider,n.from));const i=yield re({args:En(e.signer||e.provider,r,t.inputs),address:e.resolvedAddress,overrides:re(n)||{}}),s=e.interface.encodeFunctionData(t,i.args),o={data:s,to:i.address},a=i.overrides;if(null!=a.nonce&&(o.nonce=W.from(a.nonce).toNumber()),null!=a.gasLimit&&(o.gasLimit=W.from(a.gasLimit)),null!=a.gasPrice&&(o.gasPrice=W.from(a.gasPrice)),null!=a.maxFeePerGas&&(o.maxFeePerGas=W.from(a.maxFeePerGas)),null!=a.maxPriorityFeePerGas&&(o.maxPriorityFeePerGas=W.from(a.maxPriorityFeePerGas)),null!=a.from&&(o.from=a.from),null!=a.type&&(o.type=a.type),null!=a.accessList&&(o.accessList=hn(a.accessList)),null==o.gasLimit&&null!=t.gas){let e=21e3;const r=T(s);for(let t=0;t<r.length;t++)e+=4,r[t]&&(e+=64);o.gasLimit=W.from(t.gas).add(e)}if(a.value){const e=W.from(a.value);e.isZero()||t.payable||wn.throwError("non-payable method cannot override value",b.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:n.value}),o.value=e}a.customData&&(o.customData=ie(a.customData)),a.ccipReadEnabled&&(o.ccipReadEnabled=!!a.ccipReadEnabled),delete n.nonce,delete n.gasLimit,delete n.gasPrice,delete n.from,delete n.value,delete n.type,delete n.accessList,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.customData,delete n.ccipReadEnabled;const c=Object.keys(n).filter(e=>null!=n[e]);return c.length&&wn.throwError(`cannot override ${c.map(e=>JSON.stringify(e)).join(",")}`,b.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:c}),o})}function kn(e,t){const r=t.wait.bind(t);t.wait=t=>r(t).then(t=>(t.events=t.logs.map(r=>{let n=ce(r),i=null;try{i=e.interface.parseLog(r)}catch(e){}return i&&(n.args=i.args,n.decode=(t,r)=>e.interface.decodeEventLog(i.eventFragment,t,r),n.event=i.name,n.eventSignature=i.signature),n.removeListener=()=>e.provider,n.getBlock=()=>e.provider.getBlock(t.blockHash),n.getTransaction=()=>e.provider.getTransaction(t.transactionHash),n.getTransactionReceipt=()=>Promise.resolve(t),n}),t))}function Tn(e,t,r){const n=e.signer||e.provider;return function(...i){return bn(this,void 0,void 0,function*(){let s;if(i.length===t.inputs.length+1&&"object"==typeof i[i.length-1]){const e=ie(i.pop());null!=e.blockTag&&(s=yield e.blockTag),delete e.blockTag,i.push(e)}null!=e.deployTransaction&&(yield e._deployed(s));const o=yield xn(e,t,i),a=yield n.call(o,s);try{let n=e.interface.decodeFunctionResult(t,a);return r&&1===t.outputs.length&&(n=n[0]),n}catch(t){throw t.code===b.errors.CALL_EXCEPTION&&(t.address=e.address,t.args=i,t.transaction=o),t}})}}function Sn(e,t,r){return t.constant?Tn(e,t,r):function(e,t){return function(...r){return bn(this,void 0,void 0,function*(){e.signer||wn.throwError("sending a transaction requires a signer",b.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=e.deployTransaction&&(yield e._deployed());const n=yield xn(e,t,r),i=yield e.signer.sendTransaction(n);return kn(e,i),i})}}(e,t)}function In(e){return!e.address||null!=e.topics&&0!==e.topics.length?(e.address||"*")+"@"+(e.topics?e.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):""):"*"}class Cn{constructor(e,t){ee(this,"tag",e),ee(this,"filter",t),this._listeners=[]}addListener(e,t){this._listeners.push({listener:e,once:t})}removeListener(e){let t=!1;this._listeners=this._listeners.filter(r=>!(!t&&r.listener===e&&(t=!0,1)))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){const t=this.listenerCount();return this._listeners=this._listeners.filter(t=>{const r=e.slice();return setTimeout(()=>{t.listener.apply(this,r)},0),!t.once}),t}prepareEvent(e){}getEmit(e){return[e]}}class Bn extends Cn{constructor(){super("error",null)}}class Nn extends Cn{constructor(e,t,r,n){const i={address:e};let s=t.getEventTopic(r);n?(s!==n[0]&&wn.throwArgumentError("topic mismatch","topics",n),i.topics=n.slice()):i.topics=[s],super(In(i),i),ee(this,"address",e),ee(this,"interface",t),ee(this,"fragment",r)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(e,t)=>this.interface.decodeEventLog(this.fragment,e,t);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(t){e.args=null,e.decodeError=t}}getEmit(e){const t=de(e.args);if(t.length)throw t[0].error;const r=(e.args||[]).slice();return r.push(e),r}}class _n extends Cn{constructor(e,t){super("*",{address:e}),ee(this,"address",e),ee(this,"interface",t)}prepareEvent(e){super.prepareEvent(e);try{const t=this.interface.parseLog(e);e.event=t.name,e.eventSignature=t.signature,e.decode=(e,r)=>this.interface.decodeEventLog(t.eventFragment,e,r),e.args=t.args}catch(e){}}}class Mn{constructor(e,t,r){ee(this,"interface",te(new.target,"getInterface")(t)),null==r?(ee(this,"provider",null),ee(this,"signer",null)):cr.isSigner(r)?(ee(this,"provider",r.provider||null),ee(this,"signer",r)):nr.isProvider(r)?(ee(this,"provider",r),ee(this,"signer",null)):wn.throwArgumentError("invalid signer or provider","signerOrProvider",r),ee(this,"callStatic",{}),ee(this,"estimateGas",{}),ee(this,"functions",{}),ee(this,"populateTransaction",{}),ee(this,"filters",{});{const e={};Object.keys(this.interface.events).forEach(t=>{const r=this.interface.events[t];ee(this.filters,t,(...e)=>({address:this.address,topics:this.interface.encodeFilterTopics(r,e)})),e[r.name]||(e[r.name]=[]),e[r.name].push(t)}),Object.keys(e).forEach(t=>{const r=e[t];1===r.length?ee(this.filters,t,this.filters[r[0]]):wn.warn(`Duplicate definition of ${t} (${r.join(", ")})`)})}if(ee(this,"_runningEvents",{}),ee(this,"_wrappedEmits",{}),null==e&&wn.throwArgumentError("invalid contract address or ENS name","addressOrName",e),ee(this,"address",e),this.provider)ee(this,"resolvedAddress",An(this.provider,e));else try{ee(this,"resolvedAddress",Promise.resolve(Re(e)))}catch(e){wn.throwError("provider is required to use ENS name as contract address",b.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(e=>{});const n={},i={};Object.keys(this.interface.functions).forEach(e=>{const t=this.interface.functions[e];if(i[e])wn.warn(`Duplicate ABI entry for ${JSON.stringify(e)}`);else{i[e]=!0;{const r=t.name;n[`%${r}`]||(n[`%${r}`]=[]),n[`%${r}`].push(e)}null==this[e]&&ee(this,e,Sn(this,t,!0)),null==this.functions[e]&&ee(this.functions,e,Sn(this,t,!1)),null==this.callStatic[e]&&ee(this.callStatic,e,Tn(this,t,!0)),null==this.populateTransaction[e]&&ee(this.populateTransaction,e,function(e,t){return function(...r){return xn(e,t,r)}}(this,t)),null==this.estimateGas[e]&&ee(this.estimateGas,e,function(e,t){const r=e.signer||e.provider;return function(...n){return bn(this,void 0,void 0,function*(){r||wn.throwError("estimate require a provider or signer",b.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield xn(e,t,n);return yield r.estimateGas(i)})}}(this,t))}}),Object.keys(n).forEach(e=>{const t=n[e];if(t.length>1)return;e=e.substring(1);const r=t[0];try{null==this[e]&&ee(this,e,this[r])}catch(e){}null==this.functions[e]&&ee(this.functions,e,this.functions[r]),null==this.callStatic[e]&&ee(this.callStatic,e,this.callStatic[r]),null==this.populateTransaction[e]&&ee(this.populateTransaction,e,this.populateTransaction[r]),null==this.estimateGas[e]&&ee(this.estimateGas,e,this.estimateGas[r])})}static getContractAddress(e){return Le(e)}static getInterface(e){return er.isInterface(e)?e:new er(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(e=>("0x"===e&&wn.throwError("contract not deployed",b.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||wn.throwError("sending a transactions require a signer",b.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=ie(e||{});return["from","to"].forEach(function(e){null!=t[e]&&wn.throwError("cannot override "+e,b.errors.UNSUPPORTED_OPERATION,{operation:e})}),t.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(t))}connect(e){"string"==typeof e&&(e=new ur(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&ee(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return Qt.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if("string"==typeof e){if("error"===e)return this._normalizeRunningEvent(new Bn);if("event"===e)return this._normalizeRunningEvent(new Cn("event",null));if("*"===e)return this._normalizeRunningEvent(new _n(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new Nn(this.address,this.interface,t))}if(e.topics&&e.topics.length>0){try{const t=e.topics[0];if("string"!=typeof t)throw new Error("invalid topic");const r=this.interface.getEvent(t);return this._normalizeRunningEvent(new Nn(this.address,this.interface,r,e.topics))}catch(e){}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new Cn(In(t),t))}return this._normalizeRunningEvent(new _n(this.address,this.interface))}_checkRunningEvents(e){if(0===e.listenerCount()){delete this._runningEvents[e.tag];const t=this._wrappedEmits[e.tag];t&&e.filter&&(this.provider.off(e.filter,t),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,t,r){const n=ce(t);return n.removeListener=()=>{r&&(e.removeListener(r),this._checkRunningEvents(e))},n.getBlock=()=>this.provider.getBlock(t.blockHash),n.getTransaction=()=>this.provider.getTransaction(t.transactionHash),n.getTransactionReceipt=()=>this.provider.getTransactionReceipt(t.transactionHash),e.prepareEvent(n),n}_addEventListener(e,t,r){if(this.provider||wn.throwError("events require a provider or a signer with a provider",b.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(t,r),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const r=r=>{let n=this._wrapEvent(e,r,t);if(null==n.decodeError)try{const t=e.getEmit(n);this.emit(e.filter,...t)}catch(e){n.decodeError=e.error}null!=e.filter&&this.emit("event",n),null!=n.decodeError&&this.emit("error",n.decodeError,n)};this._wrappedEmits[e.tag]=r,null!=e.filter&&this.provider.on(e.filter,r)}}queryFilter(e,t,r){const n=this._getRunningEvent(e),i=ie(n.filter);return"string"==typeof t&&B(t,32)?(null!=r&&wn.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),i.blockHash=t):(i.fromBlock=null!=t?t:0,i.toBlock=null!=r?r:"latest"),this.provider.getLogs(i).then(e=>e.map(e=>this._wrapEvent(n,e,null)))}on(e,t){return this._addEventListener(this._getRunningEvent(e),t,!1),this}once(e,t){return this._addEventListener(this._getRunningEvent(e),t,!0),this}emit(e,...t){if(!this.provider)return!1;const r=this._getRunningEvent(e),n=r.run(t)>0;return this._checkRunningEvents(r),n}listenerCount(e){return this.provider?null==e?Object.keys(this._runningEvents).reduce((e,t)=>e+this._runningEvents[t].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(null==e){const e=[];for(let t in this._runningEvents)this._runningEvents[t].listeners().forEach(t=>{e.push(t)});return e}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(null==e){for(const e in this._runningEvents){const t=this._runningEvents[e];t.removeAllListeners(),this._checkRunningEvents(t)}return this}const t=this._getRunningEvent(e);return t.removeAllListeners(),this._checkRunningEvents(t),this}off(e,t){if(!this.provider)return this;const r=this._getRunningEvent(e);return r.removeListener(t),this._checkRunningEvents(r),this}removeListener(e,t){return this.off(e,t)}}class Rn extends Mn{}class Pn{constructor(e,t,r){let n=null;n="string"==typeof t?t:k(t)?_(t):t&&"string"==typeof t.object?t.object:"!","0x"!==n.substring(0,2)&&(n="0x"+n),(!B(n)||n.length%2)&&wn.throwArgumentError("invalid bytecode","bytecode",t),r&&!cr.isSigner(r)&&wn.throwArgumentError("invalid signer","signer",r),ee(this,"bytecode",n),ee(this,"interface",te(new.target,"getInterface")(e)),ee(this,"signer",r||null)}getDeployTransaction(...e){let t={};if(e.length===this.interface.deploy.inputs.length+1&&"object"==typeof e[e.length-1]){t=ie(e.pop());for(const e in t)if(!vn[e])throw new Error("unknown transaction override "+e)}return["data","from","to"].forEach(e=>{null!=t[e]&&wn.throwError("cannot override "+e,b.errors.UNSUPPORTED_OPERATION,{operation:e})}),t.value&&(W.from(t.value).isZero()||this.interface.deploy.payable||wn.throwError("non-payable constructor cannot override value",b.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:t.value})),wn.checkArgumentCount(e.length,this.interface.deploy.inputs.length," in Contract constructor"),t.data=_(S([this.bytecode,this.interface.encodeDeploy(e)])),t}deploy(...e){return bn(this,void 0,void 0,function*(){let t={};e.length===this.interface.deploy.inputs.length+1&&(t=e.pop()),wn.checkArgumentCount(e.length,this.interface.deploy.inputs.length," in Contract constructor");const r=yield En(this.signer,e,this.interface.deploy.inputs);r.push(t);const n=this.getDeployTransaction(...r),i=yield this.signer.sendTransaction(n),s=te(this.constructor,"getContractAddress")(i),o=te(this.constructor,"getContract")(s,this.interface,this.signer);return kn(o,i),ee(o,"deployTransaction",i),o})}attach(e){return this.constructor.getContract(e,this.interface,this.signer)}connect(e){return new this.constructor(this.interface,this.bytecode,e)}static fromSolidity(e,t){null==e&&wn.throwError("missing compiler output",b.errors.MISSING_ARGUMENT,{argument:"compilerOutput"}),"string"==typeof e&&(e=JSON.parse(e));const r=e.abi;let n=null;return e.bytecode?n=e.bytecode:e.evm&&e.evm.bytecode&&(n=e.evm.bytecode),new this(r,n,t)}static getInterface(e){return Rn.getInterface(e)}static getContractAddress(e){return Le(e)}static getContract(e,t,r){return new Rn(e,t,r)}}const On=new b($),Ln={},Dn=W.from(0),Un=W.from(-1);function Fn(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),On.throwError(e,b.errors.NUMERIC_FAULT,i)}let Hn="0";for(;Hn.length<256;)Hn+=Hn;function zn(e){if("number"!=typeof e)try{e=W.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+Hn.substring(0,e):On.throwArgumentError("invalid decimal size","decimals",e)}function $n(e,t){null==t&&(t=0);const r=zn(t),n=(e=W.from(e)).lt(Dn);n&&(e=e.mul(Un));let i=e.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=e.div(r).toString();return e=1===r.length?s:s+"."+i,n&&(e="-"+e),e}function Gn(e,t){null==t&&(t=0);const r=zn(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||On.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&On.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&On.throwArgumentError("too many decimal points","value",e);let s=i[0],o=i[1];for(s||(s="0"),o||(o="0");"0"===o[o.length-1];)o=o.substring(0,o.length-1);for(o.length>r.length-1&&Fn("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";const a=W.from(s),c=W.from(o);let u=a.mul(r).add(c);return n&&(u=u.mul(Un)),u}class jn{constructor(e,t,r,n){e!==Ln&&On.throwError("cannot use FixedFormat constructor; use FixedFormat.from",b.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=r,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=zn(n),Object.freeze(this)}static from(e){if(e instanceof jn)return e;"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,r=128,n=18;if("string"==typeof e)if("fixed"===e);else if("ufixed"===e)t=!1;else{const i=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||On.throwArgumentError("invalid fixed format","format",e),t="u"!==i[1],r=parseInt(i[2]),n=parseInt(i[3])}else if(e){const i=(t,r,n)=>null==e[t]?n:(typeof e[t]!==r&&On.throwArgumentError("invalid fixed format ("+t+" not "+r+")","format."+t,e[t]),e[t]);t=i("signed","boolean",t),r=i("width","number",r),n=i("decimals","number",n)}return r%8&&On.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&On.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new jn(Ln,t,r,n)}}class qn{constructor(e,t,r,n){e!==Ln&&On.throwError("cannot use FixedNumber constructor; use FixedNumber.from",b.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&On.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=Gn(this._value,this.format.decimals),r=Gn(e._value,e.format.decimals);return qn.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=Gn(this._value,this.format.decimals),r=Gn(e._value,e.format.decimals);return qn.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=Gn(this._value,this.format.decimals),r=Gn(e._value,e.format.decimals);return qn.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=Gn(this._value,this.format.decimals),r=Gn(e._value,e.format.decimals);return qn.fromValue(t.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=qn.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(Kn.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=qn.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(Kn.toFormat(t.format))),t}round(e){null==e&&(e=0);const t=this.toString().split(".");if(1===t.length&&t.push("0"),(e<0||e>80||e%1)&&On.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=qn.from("1"+Hn.substring(0,e),this.format),n=Vn.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(n).floor().divUnsafe(r)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){return null==e?this._hex:(e%8&&On.throwArgumentError("invalid byte width","width",e),D(W.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8))}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return qn.fromString(this._value,e)}static fromValue(e,t,r){return null!=r||null==t||function(e){return null!=e&&(W.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||B(e)||"bigint"==typeof e||k(e))}(t)||(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),qn.fromString($n(e,t),jn.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=jn.from(t),n=Gn(e,r.decimals);!r.signed&&n.lt(Dn)&&Fn("unsigned value cannot be negative","overflow","value",e);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=D(i,r.width/8));const s=$n(n,r.decimals);return new qn(Ln,i,s,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=jn.from(t);if(T(e).length>r.width/8)throw new Error("overflow");let n=W.from(e);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),s=$n(n,r.decimals);return new qn(Ln,i,s,r)}static from(e,t){if("string"==typeof e)return qn.fromString(e,t);if(k(e))return qn.fromBytes(e,t);try{return qn.fromValue(e,0,t)}catch(e){if(e.code!==b.errors.INVALID_ARGUMENT)throw e}return On.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const Kn=qn.from(1),Vn=qn.from("0.5");function Wn(e){return"string"==typeof e&&(e=je(e)),be(S([je("Ethereum Signed Message:\n"),je(String(e.length)),e]))}const Yn="hash/5.8.0";const Jn=new b(Yn),Qn=new Uint8Array(32);Qn.fill(0);const Xn=W.from(-1),Zn=W.from(0),ei=W.from(1),ti=W.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),ri=D(ei.toHexString(),32),ni=D(Zn.toHexString(),32),ii={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},si=["name","version","chainId","verifyingContract","salt"];function oi(e){return function(t){return"string"!=typeof t&&Jn.throwArgumentError(`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const ai={name:oi("name"),version:oi("version"),chainId:function(e){try{return W.from(e).toString()}catch(e){}return Jn.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return Re(e).toLowerCase()}catch(e){}return Jn.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{const t=T(e);if(32!==t.length)throw new Error("bad length");return _(t)}catch(e){}return Jn.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function ci(e){{const t=e.match(/^(u?)int(\d*)$/);if(t){const r=""===t[1],n=parseInt(t[2]||"256");(n%8!=0||n>256||t[2]&&t[2]!==String(n))&&Jn.throwArgumentError("invalid numeric width","type",e);const i=ti.mask(r?n-1:n),s=r?i.add(ei).mul(Xn):Zn;return function(t){const r=W.from(t);return(r.lt(s)||r.gt(i))&&Jn.throwArgumentError(`value out-of-bounds for ${e}`,"value",t),D(r.toTwos(256).toHexString(),32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const r=parseInt(t[1]);return(0===r||r>32||t[1]!==String(r))&&Jn.throwArgumentError("invalid bytes width","type",e),function(t){return T(t).length!==r&&Jn.throwArgumentError(`invalid length for ${e}`,"value",t),function(e){const t=T(e),r=t.length%32;return r?P([t,Qn.slice(r)]):_(t)}(t)}}}switch(e){case"address":return function(e){return D(Re(e),32)};case"bool":return function(e){return e?ri:ni};case"bytes":return function(e){return be(e)};case"string":return function(e){return Je(e)}}return null}function ui(e,t){return`${e}(${t.map(({name:e,type:t})=>t+" "+e).join(",")})`}class li{constructor(e){ee(this,"types",Object.freeze(ce(e))),ee(this,"_encoderCache",{}),ee(this,"_types",{});const t={},r={},n={};Object.keys(e).forEach(e=>{t[e]={},r[e]=[],n[e]={}});for(const n in e){const i={};e[n].forEach(s=>{i[s.name]&&Jn.throwArgumentError(`duplicate variable name ${JSON.stringify(s.name)} in ${JSON.stringify(n)}`,"types",e),i[s.name]=!0;const o=s.type.match(/^([^\x5b]*)(\x5b|$)/)[1];o===n&&Jn.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",e),ci(o)||(r[o]||Jn.throwArgumentError(`unknown type ${JSON.stringify(o)}`,"types",e),r[o].push(n),t[n][o]=!0)})}const i=Object.keys(r).filter(e=>0===r[e].length);0===i.length?Jn.throwArgumentError("missing primary type","types",e):i.length>1&&Jn.throwArgumentError(`ambiguous primary types or unused types: ${i.map(e=>JSON.stringify(e)).join(", ")}`,"types",e),ee(this,"primaryType",i[0]),function i(s,o){o[s]&&Jn.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",e),o[s]=!0,Object.keys(t[s]).forEach(e=>{r[e]&&(i(e,o),Object.keys(o).forEach(t=>{n[t][e]=!0}))}),delete o[s]}(this.primaryType,{});for(const t in n){const r=Object.keys(n[t]);r.sort(),this._types[t]=ui(t,e[t])+r.map(t=>ui(t,e[t])).join("")}}getEncoder(e){let t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}_getEncoder(e){{const t=ci(e);if(t)return t}const t=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const e=t[1],r=this.getEncoder(e),n=parseInt(t[3]);return t=>{n>=0&&t.length!==n&&Jn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t);let i=t.map(r);return this._types[e]&&(i=i.map(be)),be(P(i))}}const r=this.types[e];if(r){const t=Je(this._types[e]);return e=>{const n=r.map(({name:t,type:r})=>{const n=this.getEncoder(r)(e[t]);return this._types[r]?be(n):n});return n.unshift(t),P(n)}}return Jn.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||Jn.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return be(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,r){if(ci(e))return r(e,t);const n=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const e=n[1],i=parseInt(n[3]);return i>=0&&t.length!==i&&Jn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map(t=>this._visit(e,t,r))}const i=this.types[e];return i?i.reduce((e,{name:n,type:i})=>(e[n]=this._visit(i,t[n],r),e),{}):Jn.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new li(e)}static getPrimaryType(e){return li.from(e).primaryType}static hashStruct(e,t,r){return li.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const n=ii[r];n||Jn.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:n})}return t.sort((e,t)=>si.indexOf(e.name)-si.indexOf(t.name)),li.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return P(["0x1901",li.hashDomain(e),li.from(t).hash(r)])}static hash(e,t,r){return be(li.encode(e,t,r))}static resolveNames(e,t,r,n){return i=this,s=void 0,a=function*(){e=ie(e);const i={};e.verifyingContract&&!B(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const s=li.from(t);s.visit(r,(e,t)=>("address"!==e||B(t,20)||(i[t]="0x"),t));for(const e in i)i[e]=yield n(e);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),r=s.visit(r,(e,t)=>"address"===e&&i[t]?i[t]:t),{domain:e,value:r}},new((o=void 0)||(o=Promise))(function(e,t){function r(e){try{c(a.next(e))}catch(e){t(e)}}function n(e){try{c(a.throw(e))}catch(e){t(e)}}function c(t){var i;t.done?e(t.value):(i=t.value,i instanceof o?i:new o(function(e){e(i)})).then(r,n)}c((a=a.apply(i,s||[])).next())});var i,s,o,a}static getPayload(e,t,r){li.hashDomain(e);const n={},i=[];si.forEach(t=>{const r=e[t];null!=r&&(n[t]=ai[t](r),i.push({name:t,type:ii[t]}))});const s=li.from(t),o=ie(t);return o.EIP712Domain?Jn.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):o.EIP712Domain=i,s.encode(r),{types:o,domain:n,primaryType:s.primaryType,message:s.visit(r,(e,t)=>{if(e.match(/^bytes(\d*)/))return _(T(t));if(e.match(/^u?int/))return W.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!=typeof t&&Jn.throwArgumentError("invalid string","value",t),t}return Jn.throwArgumentError("unsupported type","type",e)})}}}class hi{constructor(e){ee(this,"alphabet",e),ee(this,"base",e.length),ee(this,"_alphabetMap",{}),ee(this,"_leader",e.charAt(0));for(let t=0;t<e.length;t++)this._alphabetMap[e.charAt(t)]=t}encode(e){let t=T(e);if(0===t.length)return"";let r=[0];for(let e=0;e<t.length;++e){let n=t[e];for(let e=0;e<r.length;++e)n+=r[e]<<8,r[e]=n%this.base,n=n/this.base|0;for(;n>0;)r.push(n%this.base),n=n/this.base|0}let n="";for(let e=0;0===t[e]&&e<t.length-1;++e)n+=this._leader;for(let e=r.length-1;e>=0;--e)n+=this.alphabet[r[e]];return n}decode(e){if("string"!=typeof e)throw new TypeError("Expected String");let t=[];if(0===e.length)return new Uint8Array(t);t.push(0);for(let r=0;r<e.length;r++){let n=this._alphabetMap[e[r]];if(void 0===n)throw new Error("Non-base"+this.base+" character");let i=n;for(let e=0;e<t.length;++e)i+=t[e]*this.base,t[e]=255&i,i>>=8;for(;i>0;)t.push(255&i),i>>=8}for(let r=0;e[r]===this._leader&&r<e.length-1;++r)t.push(0);return T(new Uint8Array(t.reverse()))}}new hi("abcdefghijklmnopqrstuvwxyz234567");const di=new hi("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var fi;!function(e){e.sha256="sha256",e.sha512="sha512"}(fi||(fi={}));const pi=new b("sha2/5.8.0");function gi(e){return"0x"+hr().ripemd160().update(T(e)).digest("hex")}function mi(e){return"0x"+hr().sha256().update(T(e)).digest("hex")}function yi(e){return"0x"+hr().sha512().update(T(e)).digest("hex")}function bi(e,t,r){return fi[e]||pi.throwError("unsupported algorithm "+e,b.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:e}),"0x"+hr().hmac(hr()[e],T(t)).update(T(r)).digest("hex")}function wi(e,t,r,n,i){let s;e=T(e),t=T(t);let o=1;const a=new Uint8Array(n),c=new Uint8Array(t.length+4);let u,l;c.set(t);for(let h=1;h<=o;h++){c[t.length]=h>>24&255,c[t.length+1]=h>>16&255,c[t.length+2]=h>>8&255,c[t.length+3]=255&h;let d=T(bi(i,e,c));s||(s=d.length,l=new Uint8Array(s),o=Math.ceil(n/s),u=n-(o-1)*s),l.set(d);for(let t=1;t<r;t++){d=T(bi(i,e,d));for(let e=0;e<s;e++)l[e]^=d[e]}const f=(h-1)*s,p=h===o?u:s;a.set(T(l).slice(0,p),f)}return _(a)}const vi=new b("wordlists/5.8.0");class Ai{constructor(e){vi.checkAbstract(new.target,Ai),ee(this,"locale",e)}split(e){return e.toLowerCase().split(/ +/g)}join(e){return e.join(" ")}static check(e){const t=[];for(let r=0;r<2048;r++){const n=e.getWord(r);if(r!==e.getWordIndex(n))return"0x";t.push(n)}return Je(t.join("\n")+"\n")}static register(e,t){t||(t=e.locale)}}let Ei=null;function xi(e){if(null==Ei&&(Ei="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==Ai.check(e)))throw Ei=null,new Error("BIP39 Wordlist for en (English) FAILED")}const ki=new class extends Ai{constructor(){super("en")}getWord(e){return xi(this),Ei[e]}getWordIndex(e){return xi(this),Ei.indexOf(e)}};Ai.register(ki);const Ti={en:ki},Si=new b("hdnode/5.8.0"),Ii=W.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Ci=je("Bitcoin seed"),Bi=2147483648;function Ni(e){return(1<<e)-1<<8-e}function _i(e){return(1<<e)-1}function Mi(e){return D(_(e),32)}function Ri(e){return di.encode(S([e,R(mi(mi(e)),0,4)]))}function Pi(e){if(null==e)return Ti.en;if("string"==typeof e){const t=Ti[e];return null==t&&Si.throwArgumentError("unknown locale","wordlist",e),t}return e}const Oi={},Li="m/44'/60'/0'/0/0";class Di{constructor(e,t,r,n,i,s,o,a){if(e!==Oi)throw new Error("HDNode constructor cannot be called directly");if(t){const e=new Qr(t);ee(this,"privateKey",e.privateKey),ee(this,"publicKey",e.compressedPublicKey)}else ee(this,"privateKey",null),ee(this,"publicKey",_(r));ee(this,"parentFingerprint",n),ee(this,"fingerprint",R(gi(mi(this.publicKey)),0,4)),ee(this,"address",an(this.publicKey)),ee(this,"chainCode",i),ee(this,"index",s),ee(this,"depth",o),null==a?(ee(this,"mnemonic",null),ee(this,"path",null)):"string"==typeof a?(ee(this,"mnemonic",null),ee(this,"path",a)):(ee(this,"mnemonic",a),ee(this,"path",a.path))}get extendedKey(){if(this.depth>=256)throw new Error("Depth too large!");return Ri(S([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",_(this.depth),this.parentFingerprint,D(_(this.index),4),this.chainCode,null!=this.privateKey?S(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new Di(Oi,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(e){if(e>4294967295)throw new Error("invalid index - "+String(e));let t=this.path;t&&(t+="/"+(2147483647&e));const r=new Uint8Array(37);if(e&Bi){if(!this.privateKey)throw new Error("cannot derive child of neutered node");r.set(T(this.privateKey),1),t&&(t+="'")}else r.set(T(this.publicKey));for(let t=24;t>=0;t-=8)r[33+(t>>3)]=e>>24-t&255;const n=T(bi(fi.sha512,this.chainCode,r)),i=n.slice(0,32),s=n.slice(32);let o=null,a=null;this.privateKey?o=Mi(W.from(i).add(this.privateKey).mod(Ii)):a=new Qr(_(i))._addPoint(this.publicKey);let c=t;const u=this.mnemonic;return u&&(c=Object.freeze({phrase:u.phrase,path:t,locale:u.locale||"en"})),new Di(Oi,o,a,this.fingerprint,Mi(s),e,this.depth+1,c)}derivePath(e){const t=e.split("/");if(0===t.length||"m"===t[0]&&0!==this.depth)throw new Error("invalid path - "+e);"m"===t[0]&&t.shift();let r=this;for(let e=0;e<t.length;e++){const n=t[e];if(n.match(/^[0-9]+'$/)){const e=parseInt(n.substring(0,n.length-1));if(e>=Bi)throw new Error("invalid path index - "+n);r=r._derive(Bi+e)}else{if(!n.match(/^[0-9]+$/))throw new Error("invalid path component - "+n);{const e=parseInt(n);if(e>=Bi)throw new Error("invalid path index - "+n);r=r._derive(e)}}}return r}static _fromSeed(e,t){const r=T(e);if(r.length<16||r.length>64)throw new Error("invalid seed");const n=T(bi(fi.sha512,Ci,r));return new Di(Oi,Mi(n.slice(0,32)),null,"0x00000000",Mi(n.slice(32)),0,0,t)}static fromMnemonic(e,t,r){return e=Hi(Fi(e,r=Pi(r)),r),Di._fromSeed(Ui(e,t),{phrase:e,path:"m",locale:r.locale})}static fromSeed(e){return Di._fromSeed(e,null)}static fromExtendedKey(e){const t=di.decode(e);82===t.length&&Ri(t.slice(0,78))===e||Si.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const r=t[4],n=_(t.slice(5,9)),i=parseInt(_(t.slice(9,13)).substring(2),16),s=_(t.slice(13,45)),o=t.slice(45,78);switch(_(t.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new Di(Oi,null,_(o),n,s,i,r,null);case"0x0488ade4":case"0x04358394 ":if(0!==o[0])break;return new Di(Oi,_(o.slice(1)),null,n,s,i,r,null)}return Si.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function Ui(e,t){t||(t="");const r=je("mnemonic"+t,Fe.NFKD);return wi(je(e,Fe.NFKD),r,2048,64,"sha512")}function Fi(e,t){t=Pi(t),Si.checkNormalize();const r=t.split(e);if(r.length%3!=0)throw new Error("invalid mnemonic");const n=T(new Uint8Array(Math.ceil(11*r.length/8)));let i=0;for(let e=0;e<r.length;e++){let s=t.getWordIndex(r[e].normalize("NFKD"));if(-1===s)throw new Error("invalid mnemonic");for(let e=0;e<11;e++)s&1<<10-e&&(n[i>>3]|=1<<7-i%8),i++}const s=32*r.length/3,o=Ni(r.length/3);if((T(mi(n.slice(0,s/8)))[0]&o)!==(n[n.length-1]&o))throw new Error("invalid checksum");return _(n.slice(0,s/8))}function Hi(e,t){if(t=Pi(t),(e=T(e)).length%4!=0||e.length<16||e.length>32)throw new Error("invalid entropy");const r=[0];let n=11;for(let t=0;t<e.length;t++)n>8?(r[r.length-1]<<=8,r[r.length-1]|=e[t],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=e[t]>>8-n,r.push(e[t]&_i(8-n)),n+=3);const i=e.length/4,s=T(mi(e))[0]&Ni(i);return r[r.length-1]<<=i,r[r.length-1]|=s>>8-i,t.join(r.map(e=>t.getWord(e)))}function zi(e,t){try{return Fi(e,t),!0}catch(e){}return!1}function $i(e){return("number"!=typeof e||e<0||e>=Bi||e%1)&&Si.throwArgumentError("invalid account index","index",e),`m/44'/60'/${e}'/0/0`}const Gi=new b("random/5.8.0"),ji=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof globalThis)return globalThis;throw new Error("unable to locate global object")}();let qi=ji.crypto||ji.msCrypto;function Ki(e){(e<=0||e>1024||e%1||e!=e)&&Gi.throwArgumentError("invalid length","length",e);const t=new Uint8Array(e);return qi.getRandomValues(t),T(t)}qi&&qi.getRandomValues||(Gi.warn("WARNING: Missing strong random number source"),qi={getRandomValues:function(e){return Gi.throwError("no secure random source avaialble",b.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});var Vi=r(3725),Wi=r.n(Vi),Yi=r(3432),Ji=r.n(Yi);function Qi(e){return"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),T(e)}function Xi(e,t){for(e=String(e);e.length<t;)e="0"+e;return e}function Zi(e){return"string"==typeof e?je(e,Fe.NFKC):T(e)}function es(e,t){let r=e;const n=t.toLowerCase().split("/");for(let e=0;e<n.length;e++){let t=null;for(const i in r)if(i.toLowerCase()===n[e]){t=r[i];break}if(null===t)return null;r=t}return r}function ts(e){const t=T(e);t[6]=15&t[6]|64,t[8]=63&t[8]|128;const r=_(t);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}const rs="json-wallets/5.8.0";const ns=new b(rs);function is(e){return null!=e&&e.mnemonic&&e.mnemonic.phrase}class ss extends ue{isKeystoreAccount(e){return!(!e||!e._isKeystoreAccount)}}function os(e,t){const r=Qi(es(e,"crypto/ciphertext"));if(_(be(S([t.slice(16,32),r]))).substring(2)!==es(e,"crypto/mac").toLowerCase())throw new Error("invalid password");const n=function(e,t,r){if("aes-128-ctr"===es(e,"crypto/cipher")){const n=Qi(es(e,"crypto/cipherparams/iv")),i=new(Wi().Counter)(n);return T(new(Wi().ModeOfOperation.ctr)(t,i).decrypt(r))}return null}(e,t.slice(0,16),r);n||ns.throwError("unsupported cipher",b.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});const i=t.slice(32,64),s=an(n);if(e.address){let t=e.address.toLowerCase();if("0x"!==t.substring(0,2)&&(t="0x"+t),Re(t)!==s)throw new Error("address mismatch")}const o={_isKeystoreAccount:!0,address:s,privateKey:_(n)};if("0.1"===es(e,"x-ethers/version")){const t=Qi(es(e,"x-ethers/mnemonicCiphertext")),r=Qi(es(e,"x-ethers/mnemonicCounter")),n=new(Wi().Counter)(r),s=new(Wi().ModeOfOperation.ctr)(i,n),a=es(e,"x-ethers/path")||Li,c=es(e,"x-ethers/locale")||"en",u=T(s.decrypt(t));try{const e=Hi(u,c),t=Di.fromMnemonic(e,null,c).derivePath(a);if(t.privateKey!=o.privateKey)throw new Error("mnemonic mismatch");o.mnemonic=t.mnemonic}catch(e){if(e.code!==b.errors.INVALID_ARGUMENT||"wordlist"!==e.argument)throw e}}return new ss(o)}function as(e,t,r,n,i){return T(wi(e,t,r,n,i))}function cs(e,t,r,n,i){return Promise.resolve(as(e,t,r,n,i))}function us(e,t,r,n,i){const s=Zi(t),o=es(e,"crypto/kdf");if(o&&"string"==typeof o){const t=function(e,t){return ns.throwArgumentError("invalid key-derivation function parameters",e,t)};if("scrypt"===o.toLowerCase()){const r=Qi(es(e,"crypto/kdfparams/salt")),a=parseInt(es(e,"crypto/kdfparams/n")),c=parseInt(es(e,"crypto/kdfparams/r")),u=parseInt(es(e,"crypto/kdfparams/p"));a&&c&&u||t("kdf",o),a&a-1&&t("N",a);const l=parseInt(es(e,"crypto/kdfparams/dklen"));return 32!==l&&t("dklen",l),n(s,r,a,c,u,64,i)}if("pbkdf2"===o.toLowerCase()){const n=Qi(es(e,"crypto/kdfparams/salt"));let i=null;const o=es(e,"crypto/kdfparams/prf");"hmac-sha256"===o?i="sha256":"hmac-sha512"===o?i="sha512":t("prf",o);const a=parseInt(es(e,"crypto/kdfparams/c")),c=parseInt(es(e,"crypto/kdfparams/dklen"));return 32!==c&&t("dklen",c),r(s,n,a,c,i)}}return ns.throwArgumentError("unsupported key-derivation function","kdf",o)}const ls=new b(rs);class hs extends ue{isCrowdsaleAccount(e){return!(!e||!e._isCrowdsaleAccount)}}function ds(e,t){const r=JSON.parse(e);t=Zi(t);const n=Re(es(r,"ethaddr")),i=Qi(es(r,"encseed"));i&&i.length%16==0||ls.throwArgumentError("invalid encseed","json",e);const s=T(wi(t,t,2e3,32,"sha256")).slice(0,16),o=i.slice(0,16),a=i.slice(16),c=new(Wi().ModeOfOperation.cbc)(s,o),u=Wi().padding.pkcs7.strip(T(c.decrypt(a)));let l="";for(let e=0;e<u.length;e++)l+=String.fromCharCode(u[e]);const h=be(je(l));return new hs({_isCrowdsaleAccount:!0,address:n,privateKey:h})}function fs(e){let t=null;try{t=JSON.parse(e)}catch(e){return!1}return t.encseed&&t.ethaddr}function ps(e){let t=null;try{t=JSON.parse(e)}catch(e){return!1}return!(!t.version||parseInt(t.version)!==t.version||3!==parseInt(t.version))}function gs(e){if(fs(e))try{return Re(JSON.parse(e).ethaddr)}catch(e){return null}if(ps(e))try{return Re(JSON.parse(e).address)}catch(e){return null}return null}function ms(e,t,r){if(fs(e)){r&&r(0);const n=ds(e,t);return r&&r(1),Promise.resolve(n)}return ps(e)?function(e,t,r){return n=this,i=void 0,o=function*(){const n=JSON.parse(e);return os(n,yield us(n,t,cs,Ji().scrypt,r))},new((s=void 0)||(s=Promise))(function(e,t){function r(e){try{c(o.next(e))}catch(e){t(e)}}function a(e){try{c(o.throw(e))}catch(e){t(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof s?n:new s(function(e){e(n)})).then(r,a)}c((o=o.apply(n,i||[])).next())});var n,i,s,o}(e,t,r):Promise.reject(new Error("invalid JSON wallet"))}var ys=function(e,t,r,n){return new(r||(r=Promise))(function(i,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((n=n.apply(e,t||[])).next())})};const bs=new b("wallet/5.8.0");class ws extends cr{constructor(e,t){if(super(),null!=(r=e)&&B(r.privateKey,32)&&null!=r.address){const t=new Qr(e.privateKey);if(ee(this,"_signingKey",()=>t),ee(this,"address",an(this.publicKey)),this.address!==Re(e.address)&&bs.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),function(e){const t=e.mnemonic;return t&&t.phrase}(e)){const t=e.mnemonic;ee(this,"_mnemonic",()=>({phrase:t.phrase,path:t.path||Li,locale:t.locale||"en"}));const r=this.mnemonic;an(Di.fromMnemonic(r.phrase,null,r.locale).derivePath(r.path).privateKey)!==this.address&&bs.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else ee(this,"_mnemonic",()=>null)}else{if(Qr.isSigningKey(e))"secp256k1"!==e.curve&&bs.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),ee(this,"_signingKey",()=>e);else{"string"==typeof e&&e.match(/^[0-9a-f]*$/i)&&64===e.length&&(e="0x"+e);const t=new Qr(e);ee(this,"_signingKey",()=>t)}ee(this,"_mnemonic",()=>null),ee(this,"address",an(this.publicKey))}var r;t&&!nr.isProvider(t)&&bs.throwArgumentError("invalid provider","provider",t),ee(this,"provider",t||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(e){return new ws(this,e)}signTransaction(e){return re(e).then(t=>{null!=t.from&&(Re(t.from)!==this.address&&bs.throwArgumentError("transaction from address mismatch","transaction.from",e.from),delete t.from);const r=this._signingKey().signDigest(be(gn(t)));return gn(t,r)})}signMessage(e){return ys(this,void 0,void 0,function*(){return F(this._signingKey().signDigest(Wn(e)))})}_signTypedData(e,t,r){return ys(this,void 0,void 0,function*(){const n=yield li.resolveNames(e,t,r,e=>(null==this.provider&&bs.throwError("cannot resolve ENS names without a provider",b.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:e}),this.provider.resolveName(e)));return F(this._signingKey().signDigest(li.hash(n.domain,t,n.value)))})}encrypt(e,t,r){if("function"!=typeof t||r||(r=t,t={}),r&&"function"!=typeof r)throw new Error("invalid callback");return t||(t={}),function(e,t,r,n){try{if(Re(e.address)!==an(e.privateKey))throw new Error("address/privateKey mismatch");if(is(e)){const t=e.mnemonic;if(Di.fromMnemonic(t.phrase,null,t.locale).derivePath(t.path||Li).privateKey!=e.privateKey)throw new Error("mnemonic mismatch")}}catch(e){return Promise.reject(e)}"function"!=typeof r||n||(n=r,r={}),r||(r={});const i=T(e.privateKey),s=Zi(t);let o=null,a=null,c=null;if(is(e)){const t=e.mnemonic;o=T(Fi(t.phrase,t.locale||"en")),a=t.path||Li,c=t.locale||"en"}let u=r.client;u||(u="ethers.js");let l=null;l=r.salt?T(r.salt):Ki(32);let h=null;if(r.iv){if(h=T(r.iv),16!==h.length)throw new Error("invalid iv")}else h=Ki(16);let d=null;if(r.uuid){if(d=T(r.uuid),16!==d.length)throw new Error("invalid uuid")}else d=Ki(16);let f=1<<17,p=8,g=1;return r.scrypt&&(r.scrypt.N&&(f=r.scrypt.N),r.scrypt.r&&(p=r.scrypt.r),r.scrypt.p&&(g=r.scrypt.p)),Ji().scrypt(s,l,f,p,g,64,n).then(t=>{const r=(t=T(t)).slice(0,16),n=t.slice(16,32),s=t.slice(32,64),m=new(Wi().Counter)(h),y=T(new(Wi().ModeOfOperation.ctr)(r,m).encrypt(i)),b=be(S([n,y])),w={address:e.address.substring(2).toLowerCase(),id:ts(d),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:_(h).substring(2)},ciphertext:_(y).substring(2),kdf:"scrypt",kdfparams:{salt:_(l).substring(2),n:f,dklen:32,p:g,r:p},mac:b.substring(2)}};if(o){const e=Ki(16),t=new(Wi().Counter)(e),r=T(new(Wi().ModeOfOperation.ctr)(s,t).encrypt(o)),n=new Date,i=n.getUTCFullYear()+"-"+Xi(n.getUTCMonth()+1,2)+"-"+Xi(n.getUTCDate(),2)+"T"+Xi(n.getUTCHours(),2)+"-"+Xi(n.getUTCMinutes(),2)+"-"+Xi(n.getUTCSeconds(),2)+".0Z";w["x-ethers"]={client:u,gethFilename:"UTC--"+i+"--"+w.address,mnemonicCounter:_(e).substring(2),mnemonicCiphertext:_(r).substring(2),path:a,locale:c,version:"0.1"}}return JSON.stringify(w)})}(this,e,t,r)}static createRandom(e){let t=Ki(16);e||(e={}),e.extraEntropy&&(t=T(R(be(S([t,e.extraEntropy])),0,16)));const r=Hi(t,e.locale);return ws.fromMnemonic(r,e.path,e.locale)}static fromEncryptedJson(e,t,r){return ms(e,t,r).then(e=>new ws(e))}static fromEncryptedJsonSync(e,t){return new ws(function(e,t){if(fs(e))return ds(e,t);if(ps(e))return function(e,t){const r=JSON.parse(e);return os(r,us(r,t,as,Ji().syncScrypt))}(e,t);throw new Error("invalid JSON wallet")}(e,t))}static fromMnemonic(e,t,r){return t||(t=Li),new ws(Di.fromMnemonic(e,null,r).derivePath(t))}}function vs(e,t){return cn(Wn(e),t)}function As(e,t,r,n){return cn(li.hash(e,t,r),n)}const Es="0x0000000000000000000000000000000000000000",xs="0x0000000000000000000000000000000000000000000000000000000000000000",ks="ฮ",Ts=new b("networks/5.8.0");function Ss(e){const t=function(t,r){null==r&&(r={});const n=[];if(t.InfuraProvider&&"-"!==r.infura)try{n.push(new t.InfuraProvider(e,r.infura))}catch(e){}if(t.EtherscanProvider&&"-"!==r.etherscan)try{n.push(new t.EtherscanProvider(e,r.etherscan))}catch(e){}if(t.AlchemyProvider&&"-"!==r.alchemy)try{n.push(new t.AlchemyProvider(e,r.alchemy))}catch(e){}if(t.PocketProvider&&"-"!==r.pocket){const i=["goerli","ropsten","rinkeby","sepolia"];try{const s=new t.PocketProvider(e,r.pocket);s.network&&-1===i.indexOf(s.network.name)&&n.push(s)}catch(e){}}if(t.CloudflareProvider&&"-"!==r.cloudflare)try{n.push(new t.CloudflareProvider(e))}catch(e){}if(t.AnkrProvider&&"-"!==r.ankr)try{const i=["ropsten"],s=new t.AnkrProvider(e,r.ankr);s.network&&-1===i.indexOf(s.network.name)&&n.push(s)}catch(e){}if(t.QuickNodeProvider&&"-"!==r.quicknode)try{n.push(new t.QuickNodeProvider(e,r.quicknode))}catch(e){}if(0===n.length)return null;if(t.FallbackProvider){let i=1;return null!=r.quorum?i=r.quorum:"homestead"===e&&(i=2),new t.FallbackProvider(n,i)}return n[0]};return t.renetwork=function(e){return Ss(e)},t}function Is(e,t){const r=function(r,n){return r.JsonRpcProvider?new r.JsonRpcProvider(e,t):null};return r.renetwork=function(t){return Is(e,t)},r}const Cs={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:Ss("homestead")},Bs={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:Ss("ropsten")},Ns={chainId:63,name:"classicMordor",_defaultProvider:Is("https://www.ethercluster.com/mordor","classicMordor")},_s={unspecified:{chainId:0,name:"unspecified"},homestead:Cs,mainnet:Cs,morden:{chainId:2,name:"morden"},ropsten:Bs,testnet:Bs,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:Ss("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:Ss("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:Ss("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"sepolia",_defaultProvider:Ss("sepolia")},holesky:{chainId:17e3,name:"holesky",_defaultProvider:Ss("holesky")},classic:{chainId:61,name:"classic",_defaultProvider:Is("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:Ns,classicTestnet:Ns,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:Is("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:Ss("matic")},maticmum:{chainId:80001,name:"maticmum",_defaultProvider:Ss("maticmum")},optimism:{chainId:10,name:"optimism",_defaultProvider:Ss("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},"optimism-sepolia":{chainId:11155420,name:"optimism-sepolia"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},"arbitrum-sepolia":{chainId:421614,name:"arbitrum-sepolia"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function Ms(e){if(null==e)return null;if("number"==typeof e){for(const t in _s){const r=_s[t];if(r.chainId===e)return{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress||null,_defaultProvider:r._defaultProvider||null}}return{chainId:e,name:"unknown"}}if("string"==typeof e){const t=_s[e];return null==t?null:{name:t.name,chainId:t.chainId,ensAddress:t.ensAddress,_defaultProvider:t._defaultProvider||null}}const t=_s[e.name];if(!t)return"number"!=typeof e.chainId&&Ts.throwArgumentError("invalid network chainId","network",e),e;0!==e.chainId&&e.chainId!==t.chainId&&Ts.throwArgumentError("network chainId mismatch","network",e);let r=e._defaultProvider||null;var n;return null==r&&t._defaultProvider&&(r=(n=t._defaultProvider)&&"function"==typeof n.renetwork?t._defaultProvider.renetwork(e):t._defaultProvider),{name:e.name,chainId:t.chainId,ensAddress:e.ensAddress||t.ensAddress||null,_defaultProvider:r}}function Rs(e){e=atob(e);const t=[];for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));return T(t)}function Ps(e){e=T(e);let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Os(e,t){null==t&&(t=1);const r=[],n=r.forEach,i=function(e,t){n.call(e,function(e){t>0&&Array.isArray(e)?i(e,t-1):r.push(e)})};return i(e,t),r}function Ls(e){return 1&e?~e>>1:e>>1}function Ds(e,t){let r=Array(e);for(let n=0,i=-1;n<e;n++)r[n]=i+=1+t();return r}function Us(e,t){let r=Array(e);for(let n=0,i=0;n<e;n++)r[n]=i+=Ls(t());return r}function Fs(e,t){let r=Ds(e(),e),n=e(),i=Ds(n,e),s=function(e,t){let r=Array(e);for(let n=0;n<e;n++)r[n]=1+t();return r}(n,e);for(let e=0;e<n;e++)for(let t=0;t<s[e];t++)r.push(i[e]+t);return t?r.map(e=>t[e]):r}function Hs(e,t,r){let n=Array(e).fill(void 0).map(()=>[]);for(let i=0;i<t;i++)Us(e,r).forEach((e,t)=>n[t].push(e));return n}function zs(e,t){let r=1+t(),n=t(),i=function(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(r)}return t}(t);return Os(Hs(i.length,1+e,t).map((e,t)=>{const s=e[0],o=e.slice(1);return Array(i[t]).fill(void 0).map((e,t)=>{let i=t*n;return[s+t*r,o.map(e=>e+i)]})}))}function $s(e,t){return Hs(1+t(),1+e,t).map(e=>[e[0],e.slice(1)])}const Gs=function(e){let t=0;return()=>e[t++]}(function(e){let t=0;function r(){return e[t++]<<8|e[t++]}let n=r(),i=1,s=[0,1];for(let e=1;e<n;e++)s.push(i+=r());let o=r(),a=t;t+=o;let c=0,u=0;function l(){return 0==c&&(u=u<<8|e[t++],c=8),u>>--c&1}const h=Math.pow(2,31),d=h>>>1,f=d>>1,p=h-1;let g=0;for(let e=0;e<31;e++)g=g<<1|l();let m=[],y=0,b=h;for(;;){let e=Math.floor(((g-y+1)*i-1)/b),t=0,r=n;for(;r-t>1;){let n=t+r>>>1;e<s[n]?r=n:t=n}if(0==t)break;m.push(t);let o=y+Math.floor(b*s[t]/i),a=y+Math.floor(b*s[t+1]/i)-1;for(;0==((o^a)&d);)g=g<<1&p|l(),o=o<<1&p,a=a<<1&p|1;for(;o&~a&f;)g=g&d|g<<1&p>>>1|l(),o=o<<1^d,a=(a^d)<<1|d|1;y=o,b=1+a-o}let w=n-4;return m.map(t=>{switch(t-w){case 3:return w+65792+(e[a++]<<16|e[a++]<<8|e[a++]);case 2:return w+256+(e[a++]<<8|e[a++]);case 1:return w+e[a++];default:return t-1}})}(Rs("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))),js=new Set(Fs(Gs)),qs=new Set(Fs(Gs)),Ks=function(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(zs(r,e))}for(;;){let r=e()-1;if(r<0)break;t.push($s(r,e))}return function(e){const t={};for(let r=0;r<e.length;r++){const n=e[r];t[n[0]]=n[1]}return t}(Os(t))}(Gs),Vs=function(e){let t=Fs(e).sort((e,t)=>e-t);return function r(){let n=[];for(;;){let i=Fs(e,t);if(0==i.length)break;n.push({set:new Set(i),node:r()})}n.sort((e,t)=>t.set.size-e.set.size);let i=e(),s=i%3;i=i/3|0;let o=!!(1&i);return i>>=1,{branches:n,valid:s,fe0f:o,save:1==i,check:2==i}}()}(Gs);function Ws(e){return Ye(e)}function Ys(e){return e.filter(e=>65039!=e)}function Js(e){for(let t of e.split(".")){let e=Ws(t);try{for(let t=e.lastIndexOf(95)-1;t>=0;t--)if(95!==e[t])throw new Error("underscore only allowed at start");if(e.length>=4&&e.every(e=>e<128)&&45===e[2]&&45===e[3])throw new Error("invalid label extension")}catch(e){throw new Error(`Invalid label "${t}": ${e.message}`)}}return e}function Qs(e,t){var r;let n,i,s=Vs,o=[],a=e.length;for(t&&(t.length=0);a;){let c=e[--a];if(s=null===(r=s.branches.find(e=>e.set.has(c)))||void 0===r?void 0:r.node,!s)break;if(s.save)i=c;else if(s.check&&c===i)break;o.push(c),s.fe0f&&(o.push(65039),a>0&&65039==e[a-1]&&a--),s.valid&&(n=o.slice(),2==s.valid&&n.splice(1,1),t&&t.push(...e.slice(a).reverse()),e.length=a)}return n}const Xs=new b(Yn),Zs=new Uint8Array(32);function eo(e){if(0===e.length)throw new Error("invalid ENS name; empty component");return e}function to(e){const t=je(function(e){return Js(function(e,t){let r=Ws(e).reverse(),n=[];for(;r.length;){let e=Qs(r);if(e){n.push(...t(e));continue}let i=r.pop();if(js.has(i)){n.push(i);continue}if(qs.has(i))continue;let s=Ks[i];if(!s)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);n.push(...s)}return Js(String.fromCodePoint(...n).normalize("NFC"))}(e,Ys))}(e)),r=[];if(0===e.length)return r;let n=0;for(let e=0;e<t.length;e++)46===t[e]&&(r.push(eo(t.slice(n,e))),n=e+1);if(n>=t.length)throw new Error("invalid ENS name; empty component");return r.push(eo(t.slice(n))),r}function ro(e){try{return 0!==to(e).length}catch(e){}return!1}function no(e){"string"!=typeof e&&Xs.throwArgumentError("invalid ENS name; not a string","name",e);let t=Zs;const r=to(e);for(;r.length;)t=be(S([t,be(r.pop())]));return _(t)}function io(e){return _(S(to(e).map(e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t})))+"00"}Zs.fill(0);function so(e,t){return r=this,n=void 0,s=function*(){null==t&&(t={});const r={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0};if(!0!==t.skipFetchSetup&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),null!=t.fetchOptions){const e=t.fetchOptions;e.mode&&(r.mode=e.mode),e.cache&&(r.cache=e.cache),e.credentials&&(r.credentials=e.credentials),e.redirect&&(r.redirect=e.redirect),e.referrer&&(r.referrer=e.referrer)}const n=yield fetch(e,r),i=yield n.arrayBuffer(),s={};return n.headers.forEach?n.headers.forEach((e,t)=>{s[t.toLowerCase()]=e}):n.headers.keys().forEach(e=>{s[e.toLowerCase()]=n.headers.get(e)}),{headers:s,statusCode:n.status,statusMessage:n.statusText,body:T(new Uint8Array(i))}},new((i=void 0)||(i=Promise))(function(e,t){function o(e){try{c(s.next(e))}catch(e){t(e)}}function a(e){try{c(s.throw(e))}catch(e){t(e)}}function c(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i(function(e){e(r)})).then(o,a)}c((s=s.apply(r,n||[])).next())});var r,n,i,s}const oo=new b("web/5.8.0");function ao(e){return new Promise(t=>{setTimeout(t,e)})}function co(e,t){if(null==e)return null;if("string"==typeof e)return e;if(E(e)){if(t&&("text"===t.split("/")[0]||"application/json"===t.split(";")[0].trim()))try{return We(e)}catch(e){}return _(e)}return e}function uo(e,t,r){const n="object"==typeof e&&null!=e.throttleLimit?e.throttleLimit:12;oo.assertArgument(n>0&&n%1==0,"invalid connection throttle limit","connection.throttleLimit",n);const i="object"==typeof e?e.throttleCallback:null,s="object"==typeof e&&"number"==typeof e.throttleSlotInterval?e.throttleSlotInterval:100;oo.assertArgument(s>0&&s%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",s);const o="object"==typeof e&&!!e.errorPassThrough,a={};let c=null;const u={method:"GET"};let l=!1,h=12e4;if("string"==typeof e)c=e;else if("object"==typeof e){if(null!=e&&null!=e.url||oo.throwArgumentError("missing URL","connection.url",e),c=e.url,"number"==typeof e.timeout&&e.timeout>0&&(h=e.timeout),e.headers)for(const t in e.headers)a[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(l=!0);if(u.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==c.substring(0,6)&&!0!==e.allowInsecureAuthentication&&oo.throwError("basic authentication requires a secure https url",b.errors.INVALID_ARGUMENT,{argument:"url",url:c,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;a.authorization={key:"Authorization",value:"Basic "+Ps(je(t))}}null!=e.skipFetchSetup&&(u.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(u.fetchOptions=ie(e.fetchOptions))}const d=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),f=c?c.match(d):null;if(f)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":f[1]||"text/plain"},body:f[2]?Rs(f[3]):(p=f[3],je(p.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16)))))};let t=e.body;return r&&(t=r(e.body,e)),Promise.resolve(t)}catch(e){oo.throwError("processing response error",b.errors.SERVER_ERROR,{body:co(f[1],f[2]),error:e,requestBody:null,requestMethod:"GET",url:c})}var p;t&&(u.method="POST",u.body=t,null==a["content-type"]&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==a["content-length"]&&(a["content-length"]={key:"Content-Length",value:String(t.length)}));const g={};Object.keys(a).forEach(e=>{const t=a[e];g[t.key]=t.value}),u.headers=g;const m=function(){let e=null;return{promise:new Promise(function(t,r){h&&(e=setTimeout(()=>{null!=e&&(e=null,r(oo.makeError("timeout",b.errors.TIMEOUT,{requestBody:co(u.body,g["content-type"]),requestMethod:u.method,timeout:h,url:c})))},h))}),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),y=function(){return e=this,t=void 0,h=function*(){for(let e=0;e<n;e++){let t=null;try{if(t=yield so(c,u),e<n)if(301===t.statusCode||302===t.statusCode){const e=t.headers.location||"";if("GET"===u.method&&e.match(/^https:/)){c=t.headers.location;continue}}else if(429===t.statusCode){let r=!0;if(i&&(r=yield i(e,c)),r){let r=0;const n=t.headers["retry-after"];r="string"==typeof n&&n.match(/^[1-9][0-9]*$/)?1e3*parseInt(n):s*parseInt(String(Math.random()*Math.pow(2,e))),yield ao(r);continue}}}catch(e){t=e.response,null==t&&(m.cancel(),oo.throwError("missing response",b.errors.SERVER_ERROR,{requestBody:co(u.body,g["content-type"]),requestMethod:u.method,serverError:e,url:c}))}let a=t.body;if(l&&304===t.statusCode?a=null:!o&&(t.statusCode<200||t.statusCode>=300)&&(m.cancel(),oo.throwError("bad response",b.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:co(a,t.headers?t.headers["content-type"]:null),requestBody:co(u.body,g["content-type"]),requestMethod:u.method,url:c})),r)try{const e=yield r(a,t);return m.cancel(),e}catch(r){if(r.throttleRetry&&e<n){let t=!0;if(i&&(t=yield i(e,c)),t){const t=s*parseInt(String(Math.random()*Math.pow(2,e)));yield ao(t);continue}}m.cancel(),oo.throwError("processing response error",b.errors.SERVER_ERROR,{body:co(a,t.headers?t.headers["content-type"]:null),error:r,requestBody:co(u.body,g["content-type"]),requestMethod:u.method,url:c})}return m.cancel(),a}return oo.throwError("failed response",b.errors.SERVER_ERROR,{requestBody:co(u.body,g["content-type"]),requestMethod:u.method,url:c})},new((a=void 0)||(a=Promise))(function(r,n){function i(e){try{o(h.next(e))}catch(e){n(e)}}function s(e){try{o(h.throw(e))}catch(e){n(e)}}function o(e){var t;e.done?r(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(i,s)}o((h=h.apply(e,t||[])).next())});var e,t,a,h}();return Promise.race([m.promise,y])}function lo(e,t,r){let n=null;if(null!=t){n=je(t);const r="string"==typeof e?{url:e}:ie(e);r.headers?0!==Object.keys(r.headers).filter(e=>"content-type"===e.toLowerCase()).length||(r.headers=ie(r.headers),r.headers["content-type"]="application/json"):r.headers={"content-type":"application/json"},e=r}return uo(e,n,(e,t)=>{let n=null;if(null!=e)try{n=JSON.parse(We(e))}catch(t){oo.throwError("invalid JSON",b.errors.SERVER_ERROR,{body:e,error:t})}return r&&(n=r(n,t)),n})}function ho(e,t){return t||(t={}),null==(t=ie(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise(function(r,n){let i=null,s=!1;const o=()=>!s&&(s=!0,i&&clearTimeout(i),!0);t.timeout&&(i=setTimeout(()=>{o()&&n(new Error("timeout"))},t.timeout));const a=t.retryLimit;let c=0;!function i(){return e().then(function(e){if(void 0!==e)o()&&r(e);else if(t.oncePoll)t.oncePoll.once("poll",i);else if(t.onceBlock)t.onceBlock.once("block",i);else if(!s){if(c++,c>a)return void(o()&&n(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,c)));e<t.floor&&(e=t.floor),e>t.ceiling&&(e=t.ceiling),setTimeout(i,e)}return null},function(e){o()&&n(e)})}()})}var fo=r(8993),po=r.n(fo);const go="providers/5.8.0",mo=new b(go);class yo{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const e={},t=this.address.bind(this),r=this.bigNumber.bind(this),n=this.blockTag.bind(this),i=this.data.bind(this),s=this.hash.bind(this),o=this.hex.bind(this),a=this.number.bind(this),c=this.type.bind(this);return e.transaction={hash:s,type:c,accessList:yo.allowNull(this.accessList.bind(this),null),blockHash:yo.allowNull(s,null),blockNumber:yo.allowNull(a,null),transactionIndex:yo.allowNull(a,null),confirmations:yo.allowNull(a,null),from:t,gasPrice:yo.allowNull(r),maxPriorityFeePerGas:yo.allowNull(r),maxFeePerGas:yo.allowNull(r),gasLimit:r,to:yo.allowNull(t,null),value:r,nonce:a,data:i,r:yo.allowNull(this.uint256),s:yo.allowNull(this.uint256),v:yo.allowNull(a),creates:yo.allowNull(t,null),raw:yo.allowNull(i)},e.transactionRequest={from:yo.allowNull(t),nonce:yo.allowNull(a),gasLimit:yo.allowNull(r),gasPrice:yo.allowNull(r),maxPriorityFeePerGas:yo.allowNull(r),maxFeePerGas:yo.allowNull(r),to:yo.allowNull(t),value:yo.allowNull(r),data:yo.allowNull(e=>this.data(e,!0)),type:yo.allowNull(a),accessList:yo.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:s,address:t,topics:yo.arrayOf(s),data:i,logIndex:a,blockHash:s},e.receipt={to:yo.allowNull(this.address,null),from:yo.allowNull(this.address,null),contractAddress:yo.allowNull(t,null),transactionIndex:a,root:yo.allowNull(o),gasUsed:r,logsBloom:yo.allowNull(i),blockHash:s,transactionHash:s,logs:yo.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:yo.allowNull(a,null),cumulativeGasUsed:r,effectiveGasPrice:yo.allowNull(r),status:yo.allowNull(a),type:c},e.block={hash:yo.allowNull(s),parentHash:s,number:a,timestamp:a,nonce:yo.allowNull(o),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:yo.allowNull(t),extraData:i,transactions:yo.allowNull(yo.arrayOf(s)),baseFeePerGas:yo.allowNull(r)},e.blockWithTransactions=ie(e.block),e.blockWithTransactions.transactions=yo.allowNull(yo.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:yo.allowNull(n,void 0),toBlock:yo.allowNull(n,void 0),blockHash:yo.allowNull(s,void 0),address:yo.allowNull(t,void 0),topics:yo.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:yo.allowNull(a),blockHash:yo.allowNull(s),transactionIndex:a,removed:yo.allowNull(this.boolean.bind(this)),address:t,data:yo.allowFalsish(i,"0x"),topics:yo.arrayOf(s),transactionHash:s,logIndex:a},e}accessList(e){return hn(e||[])}number(e){return"0x"===e?0:W.from(e).toNumber()}type(e){return"0x"===e||null==e?0:W.from(e).toNumber()}bigNumber(e){return W.from(e)}boolean(e){if("boolean"==typeof e)return e;if("string"==typeof e){if("true"===(e=e.toLowerCase()))return!0;if("false"===e)return!1}throw new Error("invalid boolean - "+e)}hex(e,t){return"string"==typeof e&&(t||"0x"===e.substring(0,2)||(e="0x"+e),B(e))?e.toLowerCase():mo.throwArgumentError("invalid hash","value",e)}data(e,t){const r=this.hex(e,t);if(r.length%2!=0)throw new Error("invalid data; odd-length - "+e);return r}address(e){return Re(e)}callAddress(e){if(!B(e,32))return null;const t=Re(R(e,12));return t===Es?null:t}contractAddress(e){return Le(e)}blockTag(e){if(null==e)return"latest";if("earliest"===e)return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if("number"==typeof e||B(e))return O(e);throw new Error("invalid blockTag")}hash(e,t){const r=this.hex(e,t);return 32!==M(r)?mo.throwArgumentError("invalid hash","value",e):r}difficulty(e){if(null==e)return null;const t=W.from(e);try{return t.toNumber()}catch(e){}return null}uint256(e){if(!B(e))throw new Error("invalid uint256");return D(e,32)}_block(e,t){null!=e.author&&null==e.miner&&(e.miner=e.author);const r=null!=e._difficulty?e._difficulty:e.difficulty,n=yo.check(t,e);return n._difficulty=null==r?null:W.from(r),n}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return yo.check(this.formats.transactionRequest,e)}transactionResponse(e){null!=e.gas&&null==e.gasLimit&&(e.gasLimit=e.gas),e.to&&W.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),null!=e.input&&null==e.data&&(e.data=e.input),null==e.to&&null==e.creates&&(e.creates=this.contractAddress(e)),1!==e.type&&2!==e.type||null!=e.accessList||(e.accessList=[]);const t=yo.check(this.formats.transaction,e);if(null!=e.chainId){let r=e.chainId;B(r)&&(r=W.from(r).toNumber()),t.chainId=r}else{let r=e.networkId;null==r&&null==t.v&&(r=e.chainId),B(r)&&(r=W.from(r).toNumber()),"number"!=typeof r&&null!=t.v&&(r=(t.v-35)/2,r<0&&(r=0),r=parseInt(r)),"number"!=typeof r&&(r=0),t.chainId=r}return t.blockHash&&"x"===t.blockHash.replace(/0/g,"")&&(t.blockHash=null),t}transaction(e){return yn(e)}receiptLog(e){return yo.check(this.formats.receiptLog,e)}receipt(e){const t=yo.check(this.formats.receipt,e);if(null!=t.root)if(t.root.length<=4){const e=W.from(t.root).toNumber();0===e||1===e?(null!=t.status&&t.status!==e&&mo.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=e,delete t.root):mo.throwArgumentError("invalid alt-root-status","value.root",t.root)}else 66!==t.root.length&&mo.throwArgumentError("invalid root hash","value.root",t.root);return null!=t.status&&(t.byzantium=!0),t}topics(e){return Array.isArray(e)?e.map(e=>this.topics(e)):null!=e?this.hash(e,!0):null}filter(e){return yo.check(this.formats.filter,e)}filterLog(e){return yo.check(this.formats.filterLog,e)}static check(e,t){const r={};for(const n in e)try{const i=e[n](t[n]);void 0!==i&&(r[n]=i)}catch(e){throw e.checkKey=n,e.checkValue=t[n],e}return r}static allowNull(e,t){return function(r){return null==r?t:e(r)}}static allowFalsish(e,t){return function(r){return r?e(r):t}}static arrayOf(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");const r=[];return t.forEach(function(t){r.push(e(t))}),r}}}function bo(e){return e&&"function"==typeof e.isCommunityResource}function wo(e){return bo(e)&&e.isCommunityResource()}let vo=!1;function Ao(){vo||(vo=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var Eo=function(e,t,r,n){return new(r||(r=Promise))(function(i,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((n=n.apply(e,t||[])).next())})};const xo=new b(go);function ko(e){return null==e?"null":(32!==M(e)&&xo.throwArgumentError("invalid topic","topic",e),e.toLowerCase())}function To(e){for(e=e.slice();e.length>0&&null==e[e.length-1];)e.pop();return e.map(e=>{if(Array.isArray(e)){const t={};e.forEach(e=>{t[ko(e)]=!0});const r=Object.keys(t);return r.sort(),r.join("|")}return ko(e)}).join("&")}function So(e){if("string"==typeof e){if(32===M(e=e.toLowerCase()))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter:*:"+To(e);if(rr.isForkEvent(e))throw xo.warn("not implemented"),new Error("not implemented");if(e&&"object"==typeof e)return"filter:"+(e.address||"*")+":"+To(e.topics||[])}throw new Error("invalid event - "+e)}function Io(){return(new Date).getTime()}function Co(e){return new Promise(t=>{setTimeout(t,e)})}const Bo=["block","network","pending","poll"];class No{constructor(e,t,r){ee(this,"tag",e),ee(this,"listener",t),ee(this,"once",r),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return"tx"!==e[0]?null:e[1]}get filter(){const e=this.tag.split(":");if("filter"!==e[0])return null;const t=e[1],r=""===(n=e[2])?[]:n.split(/&/g).map(e=>{if(""===e)return[];const t=e.split("|").map(e=>"null"===e?null:e);return 1===t.length?t[0]:t});var n;const i={};return r.length>0&&(i.topics=r),t&&"*"!==t&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||Bo.indexOf(this.tag)>=0}}const _o={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Mo(e){return D(W.from(e).toHexString(),32)}function Ro(e){return di.encode(S([e,R(mi(mi(e)),0,4)]))}const Po=new RegExp("^(ipfs)://(.*)$","i"),Oo=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),Po,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function Lo(e,t){try{return We(Do(e,t))}catch(e){}return null}function Do(e,t){if("0x"===e)return null;const r=W.from(R(e,t,t+32)).toNumber(),n=W.from(R(e,r,r+32)).toNumber();return R(e,r+32,r+32+n)}function Uo(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):xo.throwArgumentError("unsupported IPFS format","link",e),`https://gateway.ipfs.io/ipfs/${e}`}function Fo(e){const t=T(e);if(t.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(t,32-t.length),r}function Ho(e){if(e.length%32==0)return e;const t=new Uint8Array(32*Math.ceil(e.length/32));return t.set(e),t}function zo(e){const t=[];let r=0;for(let n=0;n<e.length;n++)t.push(null),r+=32;for(let n=0;n<e.length;n++){const i=T(e[n]);t[n]=Fo(r),t.push(Fo(i.length)),t.push(Ho(i)),r+=32+32*Math.ceil(i.length/32)}return P(t)}class $o{constructor(e,t,r,n){ee(this,"provider",e),ee(this,"name",r),ee(this,"address",e.formatter.address(t)),ee(this,"_resolvedAddress",n)}supportsWildcard(){return this._supportsEip2544||(this._supportsEip2544=this.provider.call({to:this.address,data:"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"}).then(e=>W.from(e).eq(1)).catch(e=>{if(e.code===b.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,t){return Eo(this,void 0,void 0,function*(){const r={to:this.address,ccipReadEnabled:!0,data:P([e,no(this.name),t||"0x"])};let n=!1;(yield this.supportsWildcard())&&(n=!0,r.data=P(["0x9061b923",zo([io(this.name),r.data])]));try{let e=yield this.provider.call(r);return T(e).length%32==4&&xo.throwError("resolver threw error",b.errors.CALL_EXCEPTION,{transaction:r,data:e}),n&&(e=Do(e,0)),e}catch(e){if(e.code===b.errors.CALL_EXCEPTION)return null;throw e}})}_fetchBytes(e,t){return Eo(this,void 0,void 0,function*(){const r=yield this._fetch(e,t);return null!=r?Do(r,0):null})}_getAddress(e,t){const r=_o[String(e)];if(null==r&&xo.throwError(`unsupported coin type: ${e}`,b.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),"eth"===r.ilk)return this.provider.formatter.address(t);const n=T(t);if(null!=r.p2pkh){const e=t.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return Ro(S([[r.p2pkh],"0x"+e[2]]))}}if(null!=r.p2sh){const e=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return Ro(S([[r.p2sh],"0x"+e[2]]))}}if(null!=r.prefix){const e=n[1];let t=n[0];if(0===t?20!==e&&32!==e&&(t=-1):t=-1,t>=0&&n.length===2+e&&e>=1&&e<=75){const e=po().toWords(n.slice(2));return e.unshift(t),po().encode(r.prefix,e)}}return null}getAddress(e){return Eo(this,void 0,void 0,function*(){if(null==e&&(e=60),60===e)try{const e=yield this._fetch("0x3b3b57de");return"0x"===e||e===xs?null:this.provider.formatter.callAddress(e)}catch(e){if(e.code===b.errors.CALL_EXCEPTION)return null;throw e}const t=yield this._fetchBytes("0xf1cb7e06",Mo(e));if(null==t||"0x"===t)return null;const r=this._getAddress(e,t);return null==r&&xo.throwError("invalid or unsupported coin data",b.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),r})}getAvatar(){return Eo(this,void 0,void 0,function*(){const e=[{type:"name",content:this.name}];try{const t=yield this.getText("avatar");if(null==t)return null;for(let r=0;r<Oo.length;r++){const n=t.match(Oo[r]);if(null==n)continue;const i=n[1].toLowerCase();switch(i){case"https":return e.push({type:"url",content:t}),{linkage:e,url:t};case"data":return e.push({type:"data",content:t}),{linkage:e,url:t};case"ipfs":return e.push({type:"ipfs",content:t}),{linkage:e,url:Uo(t)};case"erc721":case"erc1155":{const r="erc721"===i?"0xc87b56dd":"0x0e89341c";e.push({type:i,content:t});const s=this._resolvedAddress||(yield this.getAddress()),o=(n[2]||"").split("/");if(2!==o.length)return null;const a=yield this.provider.formatter.address(o[0]),c=D(W.from(o[1]).toHexString(),32);if("erc721"===i){const t=this.provider.formatter.callAddress(yield this.provider.call({to:a,data:P(["0x6352211e",c])}));if(s!==t)return null;e.push({type:"owner",content:t})}else if("erc1155"===i){const t=W.from(yield this.provider.call({to:a,data:P(["0x00fdd58e",D(s,32),c])}));if(t.isZero())return null;e.push({type:"balance",content:t.toString()})}const u={to:this.provider.formatter.address(o[0]),data:P([r,c])};let l=Lo(yield this.provider.call(u),0);if(null==l)return null;e.push({type:"metadata-url-base",content:l}),"erc1155"===i&&(l=l.replace("{id}",c.substring(2)),e.push({type:"metadata-url-expanded",content:l})),l.match(/^ipfs:/i)&&(l=Uo(l)),e.push({type:"metadata-url",content:l});const h=yield lo(l);if(!h)return null;e.push({type:"metadata",content:JSON.stringify(h)});let d=h.image;if("string"!=typeof d)return null;if(d.match(/^(https:\/\/|data:)/i));else{if(null==d.match(Po))return null;e.push({type:"url-ipfs",content:d}),d=Uo(d)}return e.push({type:"url",content:d}),{linkage:e,url:d}}}}}catch(e){}return null})}getContentHash(){return Eo(this,void 0,void 0,function*(){const e=yield this._fetchBytes("0xbc1c58d1");if(null==e||"0x"===e)return null;const t=e.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(t){const e=parseInt(t[3],16);if(t[4].length===2*e)return"ipfs://"+di.encode("0x"+t[1])}const r=e.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){const e=parseInt(r[3],16);if(r[4].length===2*e)return"ipns://"+di.encode("0x"+r[1])}const n=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&64===n[1].length)return"bzz://"+n[1];const i=e.match(/^0x90b2c605([0-9a-f]*)$/);if(i&&68===i[1].length){const e={"=":"","+":"-","/":"_"};return"sia://"+Ps("0x"+i[1]).replace(/[=+\/]/g,t=>e[t])}return xo.throwError("invalid or unsupported content hash data",b.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return Eo(this,void 0,void 0,function*(){let t=je(e);t=S([Mo(64),Mo(t.length),t]),t.length%32!=0&&(t=S([t,D("0x",32-e.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",_(t));return null==r||"0x"===r?null:We(r)})}}let Go=null,jo=1;class qo extends nr{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),ee(this,"anyNetwork","any"===e),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(e=>{}),this._ready().catch(e=>{});else{const t=te(new.target,"getNetwork")(e);t?(ee(this,"_network",t),this.emit("network",t,null)):xo.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return Eo(this,void 0,void 0,function*(){if(null==this._network){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch(e){}null==e&&(e=yield this.detectNetwork()),e||xo.throwError("no network detected",b.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=e:ee(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return ho(()=>this._ready().then(e=>e,e=>{if(e.code!==b.errors.NETWORK_ERROR||"noNetwork"!==e.event)throw e}))}static getFormatter(){return null==Go&&(Go=new yo),Go}static getNetwork(e){return Ms(null==e?"homestead":e)}ccipReadFetch(e,t,r){return Eo(this,void 0,void 0,function*(){if(this.disableCcipRead||0===r.length)return null;const n=e.to.toLowerCase(),i=t.toLowerCase(),s=[];for(let e=0;e<r.length;e++){const t=r[e],o=t.replace("{sender}",n).replace("{data}",i),a=t.indexOf("{data}")>=0?null:JSON.stringify({data:i,sender:n}),c=yield lo({url:o,errorPassThrough:!0},a,(e,t)=>(e.status=t.statusCode,e));if(c.data)return c.data;const u=c.message||"unknown error";if(c.status>=400&&c.status<500)return xo.throwError(`response not found during CCIP fetch: ${u}`,b.errors.SERVER_ERROR,{url:t,errorMessage:u});s.push(u)}return xo.throwError(`error encountered during CCIP fetch: ${s.map(e=>JSON.stringify(e)).join(", ")}`,b.errors.SERVER_ERROR,{urls:r,errorMessages:s})})}_getInternalBlockNumber(e){return Eo(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const t=this._internalBlockNumber;try{const r=yield t;if(Io()-r.respTime<=e)return r.blockNumber;break}catch(e){if(this._internalBlockNumber===t)break}}const t=Io(),r=re({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(e=>null,e=>e)}).then(({blockNumber:e,networkError:n})=>{if(n)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),n;const i=Io();return(e=W.from(e).toNumber())<this._maxInternalBlockNumber&&(e=this._maxInternalBlockNumber),this._maxInternalBlockNumber=e,this._setFastBlockNumber(e),{blockNumber:e,reqTime:t,respTime:i}});return this._internalBlockNumber=r,r.catch(e=>{this._internalBlockNumber===r&&(this._internalBlockNumber=null)}),(yield r).blockNumber})}poll(){return Eo(this,void 0,void 0,function*(){const e=jo++,t=[];let r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(e){return void this.emit("error",e)}if(this._setFastBlockNumber(r),this.emit("poll",e,r),r!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)xo.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",xo.makeError("network block skew detected",b.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let e=this._emitted.block+1;e<=r;e++)this.emit("block",e);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach(e=>{if("block"===e)return;const t=this._emitted[e];"pending"!==t&&r-t>12&&delete this._emitted[e]})),-2===this._lastBlockNumber&&(this._lastBlockNumber=r-1),this._events.forEach(e=>{switch(e.type){case"tx":{const r=e.hash;let n=this.getTransactionReceipt(r).then(e=>e&&null!=e.blockNumber?(this._emitted["t:"+r]=e.blockNumber,this.emit(r,e),null):null).catch(e=>{this.emit("error",e)});t.push(n);break}case"filter":if(!e._inflight){e._inflight=!0,-2===e._lastBlockNumber&&(e._lastBlockNumber=r-1);const n=e.filter;n.fromBlock=e._lastBlockNumber+1,n.toBlock=r;const i=n.toBlock-this._maxFilterBlockRange;i>n.fromBlock&&(n.fromBlock=i),n.fromBlock<0&&(n.fromBlock=0);const s=this.getLogs(n).then(t=>{e._inflight=!1,0!==t.length&&t.forEach(t=>{t.blockNumber>e._lastBlockNumber&&(e._lastBlockNumber=t.blockNumber),this._emitted["b:"+t.blockHash]=t.blockNumber,this._emitted["t:"+t.transactionHash]=t.blockNumber,this.emit(n,t)})}).catch(t=>{this.emit("error",t),e._inflight=!1});t.push(s)}}}),this._lastBlockNumber=r,Promise.all(t).then(()=>{this.emit("didPoll",e)}).catch(e=>{this.emit("error",e)})}else this.emit("didPoll",e)})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return Eo(this,void 0,void 0,function*(){return xo.throwError("provider does not support network detection",b.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return Eo(this,void 0,void 0,function*(){const e=yield this._ready(),t=yield this.detectNetwork();if(e.chainId!==t.chainId){if(this.anyNetwork)return this._network=t,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",t,e),yield Co(0),this._network;const r=xo.makeError("underlying network changed",b.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:t});throw this.emit("error",r),r}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if("number"!=typeof e||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const e=Io();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(e=>((null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){null!=this._fastBlockNumber&&e<this._fastBlockNumber||(this._fastQueryDate=Io(),(null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,t,r){return Eo(this,void 0,void 0,function*(){return this._waitForTransaction(e,null==t?1:t,r||0,null)})}_waitForTransaction(e,t,r,n){return Eo(this,void 0,void 0,function*(){const i=yield this.getTransactionReceipt(e);return(i?i.confirmations:0)>=t?i:new Promise((i,s)=>{const o=[];let a=!1;const c=function(){return!!a||(a=!0,o.forEach(e=>{e()}),!1)},u=e=>{e.confirmations<t||c()||i(e)};if(this.on(e,u),o.push(()=>{this.removeListener(e,u)}),n){let r=n.startBlock,i=null;const u=o=>Eo(this,void 0,void 0,function*(){a||(yield Co(1e3),this.getTransactionCount(n.from).then(l=>Eo(this,void 0,void 0,function*(){if(!a){if(l<=n.nonce)r=o;else{{const t=yield this.getTransaction(e);if(t&&null!=t.blockNumber)return}for(null==i&&(i=r-3,i<n.startBlock&&(i=n.startBlock));i<=o;){if(a)return;const r=yield this.getBlockWithTransactions(i);for(let i=0;i<r.transactions.length;i++){const o=r.transactions[i];if(o.hash===e)return;if(o.from===n.from&&o.nonce===n.nonce){if(a)return;const r=yield this.waitForTransaction(o.hash,t);if(c())return;let i="replaced";return o.data===n.data&&o.to===n.to&&o.value.eq(n.value)?i="repriced":"0x"===o.data&&o.from===o.to&&o.value.isZero()&&(i="cancelled"),void s(xo.makeError("transaction was replaced",b.errors.TRANSACTION_REPLACED,{cancelled:"replaced"===i||"cancelled"===i,reason:i,replacement:this._wrapTransaction(o),hash:e,receipt:r}))}}i++}}a||this.once("block",u)}}),e=>{a||this.once("block",u)}))});if(a)return;this.once("block",u),o.push(()=>{this.removeListener("block",u)})}if("number"==typeof r&&r>0){const e=setTimeout(()=>{c()||s(xo.makeError("timeout exceeded",b.errors.TIMEOUT,{timeout:r}))},r);e.unref&&e.unref(),o.push(()=>{clearTimeout(e)})}})})}getBlockNumber(){return Eo(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return Eo(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return W.from(e)}catch(t){return xo.throwError("bad result from backend",b.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}})}getBalance(e,t){return Eo(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield re({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getBalance",r);try{return W.from(n)}catch(e){return xo.throwError("bad result from backend",b.errors.SERVER_ERROR,{method:"getBalance",params:r,result:n,error:e})}})}getTransactionCount(e,t){return Eo(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield re({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getTransactionCount",r);try{return W.from(n).toNumber()}catch(e){return xo.throwError("bad result from backend",b.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:n,error:e})}})}getCode(e,t){return Eo(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield re({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getCode",r);try{return _(n)}catch(e){return xo.throwError("bad result from backend",b.errors.SERVER_ERROR,{method:"getCode",params:r,result:n,error:e})}})}getStorageAt(e,t,r){return Eo(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield re({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then(e=>O(e))}),i=yield this.perform("getStorageAt",n);try{return _(i)}catch(e){return xo.throwError("bad result from backend",b.errors.SERVER_ERROR,{method:"getStorageAt",params:n,result:i,error:e})}})}_wrapTransaction(e,t,r){if(null!=t&&32!==M(t))throw new Error("invalid response - sendTransaction");const n=e;return null!=t&&e.hash!==t&&xo.throwError("Transaction hash mismatch from Provider.sendTransaction.",b.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),n.wait=(t,n)=>Eo(this,void 0,void 0,function*(){let i;null==t&&(t=1),null==n&&(n=0),0!==t&&null!=r&&(i={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:r});const s=yield this._waitForTransaction(e.hash,t,n,i);return null==s&&0===t?null:(this._emitted["t:"+e.hash]=s.blockNumber,0===s.status&&xo.throwError("transaction failed",b.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:s}),s)}),n}sendTransaction(e){return Eo(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then(e=>_(e)),r=this.formatter.transaction(e);null==r.confirmations&&(r.confirmations=0);const n=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const e=yield this.perform("sendTransaction",{signedTransaction:t});return this._wrapTransaction(r,e,n)}catch(e){throw e.transaction=r,e.transactionHash=r.hash,e}})}_getTransactionRequest(e){return Eo(this,void 0,void 0,function*(){const t=yield e,r={};return["from","to"].forEach(e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then(e=>e?this._getAddress(e):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then(e=>e?W.from(e):null))}),["type"].forEach(e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then(e=>null!=e?e:null))}),t.accessList&&(r.accessList=this.formatter.accessList(t.accessList)),["data"].forEach(e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then(e=>e?_(e):null))}),this.formatter.transactionRequest(yield re(r))})}_getFilter(e){return Eo(this,void 0,void 0,function*(){e=yield e;const t={};return null!=e.address&&(t.address=this._getAddress(e.address)),["blockHash","topics"].forEach(r=>{null!=e[r]&&(t[r]=e[r])}),["fromBlock","toBlock"].forEach(r=>{null!=e[r]&&(t[r]=this._getBlockTag(e[r]))}),this.formatter.filter(yield re(t))})}_call(e,t,r){return Eo(this,void 0,void 0,function*(){r>=10&&xo.throwError("CCIP read exceeded maximum redirections",b.errors.SERVER_ERROR,{redirects:r,transaction:e});const n=e.to,i=yield this.perform("call",{transaction:e,blockTag:t});if(r>=0&&"latest"===t&&null!=n&&"0x556f1830"===i.substring(0,10)&&M(i)%32==4)try{const s=R(i,4),o=R(s,0,32);W.from(o).eq(n)||xo.throwError("CCIP Read sender did not match",b.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const a=[],c=W.from(R(s,32,64)).toNumber(),u=W.from(R(s,c,c+32)).toNumber(),l=R(s,c+32);for(let t=0;t<u;t++){const r=Lo(l,32*t);null==r&&xo.throwError("CCIP Read contained corrupt URL string",b.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i}),a.push(r)}const h=Do(s,64);W.from(R(s,100,128)).isZero()||xo.throwError("CCIP Read callback selector included junk",b.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const d=R(s,96,100),f=Do(s,128),p=yield this.ccipReadFetch(e,h,a);null==p&&xo.throwError("CCIP Read disabled or provided no URLs",b.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const g={to:n,data:P([d,zo([p,f])])};return this._call(g,t,r+1)}catch(e){if(e.code===b.errors.SERVER_ERROR)throw e}try{return _(i)}catch(r){return xo.throwError("bad result from backend",b.errors.SERVER_ERROR,{method:"call",params:{transaction:e,blockTag:t},result:i,error:r})}})}call(e,t){return Eo(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield re({transaction:this._getTransactionRequest(e),blockTag:this._getBlockTag(t),ccipReadEnabled:Promise.resolve(e.ccipReadEnabled)});return this._call(r.transaction,r.blockTag,r.ccipReadEnabled?0:-1)})}estimateGas(e){return Eo(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield re({transaction:this._getTransactionRequest(e)}),r=yield this.perform("estimateGas",t);try{return W.from(r)}catch(e){return xo.throwError("bad result from backend",b.errors.SERVER_ERROR,{method:"estimateGas",params:t,result:r,error:e})}})}_getAddress(e){return Eo(this,void 0,void 0,function*(){"string"!=typeof(e=yield e)&&xo.throwArgumentError("invalid address or ENS name","name",e);const t=yield this.resolveName(e);return null==t&&xo.throwError("ENS name not configured",b.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(e)})`}),t})}_getBlock(e,t){return Eo(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;let r=-128;const n={includeTransactions:!!t};if(B(e,32))n.blockHash=e;else try{n.blockTag=yield this._getBlockTag(e),B(n.blockTag)&&(r=parseInt(n.blockTag.substring(2),16))}catch(t){xo.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",e)}return ho(()=>Eo(this,void 0,void 0,function*(){const e=yield this.perform("getBlock",n);if(null==e)return null!=n.blockHash&&null==this._emitted["b:"+n.blockHash]||null!=n.blockTag&&r>this._emitted.block?null:void 0;if(t){let t=null;for(let r=0;r<e.transactions.length;r++){const n=e.transactions[r];if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){null==t&&(t=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let e=t-n.blockNumber+1;e<=0&&(e=1),n.confirmations=e}}const r=this.formatter.blockWithTransactions(e);return r.transactions=r.transactions.map(e=>this._wrapTransaction(e)),r}return this.formatter.block(e)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return Eo(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return ho(()=>Eo(this,void 0,void 0,function*(){const r=yield this.perform("getTransaction",t);if(null==r)return null==this._emitted["t:"+e]?null:void 0;const n=this.formatter.transactionResponse(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;e<=0&&(e=1),n.confirmations=e}return this._wrapTransaction(n)}),{oncePoll:this})})}getTransactionReceipt(e){return Eo(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return ho(()=>Eo(this,void 0,void 0,function*(){const r=yield this.perform("getTransactionReceipt",t);if(null==r)return null==this._emitted["t:"+e]?null:void 0;if(null==r.blockHash)return;const n=this.formatter.receipt(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;e<=0&&(e=1),n.confirmations=e}return n}),{oncePoll:this})})}getLogs(e){return Eo(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield re({filter:this._getFilter(e)}),r=yield this.perform("getLogs",t);return r.forEach(e=>{null==e.removed&&(e.removed=!1)}),yo.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)})}getEtherPrice(){return Eo(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return Eo(this,void 0,void 0,function*(){if("number"==typeof(e=yield e)&&e<0){e%1&&xo.throwArgumentError("invalid BlockTag","blockTag",e);let t=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return t+=e,t<0&&(t=0),this.formatter.blockTag(t)}return this.formatter.blockTag(e)})}getResolver(e){return Eo(this,void 0,void 0,function*(){let t=e;for(;;){if(""===t||"."===t)return null;if("eth"!==e&&"eth"===t)return null;const r=yield this._getResolver(t,"getResolver");if(null!=r){const n=new $o(this,r,e);return t===e||(yield n.supportsWildcard())?n:null}t=t.split(".").slice(1).join(".")}})}_getResolver(e,t){return Eo(this,void 0,void 0,function*(){null==t&&(t="ENS");const r=yield this.getNetwork();r.ensAddress||xo.throwError("network does not support ENS",b.errors.UNSUPPORTED_OPERATION,{operation:t,network:r.name});try{const t=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+no(e).substring(2)});return this.formatter.callAddress(t)}catch(e){}return null})}resolveName(e){return Eo(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(t){if(B(e))throw t}"string"!=typeof e&&xo.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null})}lookupAddress(e){return Eo(this,void 0,void 0,function*(){e=yield e;const t=(e=this.formatter.address(e)).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(t,"lookupAddress");if(null==r)return null;const n=Lo(yield this.call({to:r,data:"0x691f3431"+no(t).substring(2)}),0);return(yield this.resolveName(n))!=e?null:n})}getAvatar(e){return Eo(this,void 0,void 0,function*(){let t=null;if(B(e)){const r=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"getAvatar");if(!n)return null;t=new $o(this,n,r);try{const e=yield t.getAvatar();if(e)return e.url}catch(e){if(e.code!==b.errors.CALL_EXCEPTION)throw e}try{const e=Lo(yield this.call({to:n,data:"0x691f3431"+no(r).substring(2)}),0);t=yield this.getResolver(e)}catch(e){if(e.code!==b.errors.CALL_EXCEPTION)throw e;return null}}else if(t=yield this.getResolver(e),!t)return null;const r=yield t.getAvatar();return null==r?null:r.url})}perform(e,t){return xo.throwError(e+" not implemented",b.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(e=>e.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(e=>e.pollable()).length>0}_addEventListener(e,t,r){const n=new No(So(e),t,r);return this._events.push(n),this._startEvent(n),this}on(e,t){return this._addEventListener(e,t,!1)}once(e,t){return this._addEventListener(e,t,!0)}emit(e,...t){let r=!1,n=[],i=So(e);return this._events=this._events.filter(e=>e.tag!==i||(setTimeout(()=>{e.listener.apply(this,t)},0),r=!0,!e.once||(n.push(e),!1))),n.forEach(e=>{this._stopEvent(e)}),r}listenerCount(e){if(!e)return this._events.length;let t=So(e);return this._events.filter(e=>e.tag===t).length}listeners(e){if(null==e)return this._events.map(e=>e.listener);let t=So(e);return this._events.filter(e=>e.tag===t).map(e=>e.listener)}off(e,t){if(null==t)return this.removeAllListeners(e);const r=[];let n=!1,i=So(e);return this._events=this._events.filter(e=>e.tag!==i||e.listener!=t||!!n||(n=!0,r.push(e),!1)),r.forEach(e=>{this._stopEvent(e)}),this}removeAllListeners(e){let t=[];if(null==e)t=this._events,this._events=[];else{const r=So(e);this._events=this._events.filter(e=>e.tag!==r||(t.push(e),!1))}return t.forEach(e=>{this._stopEvent(e)}),this}}var Ko=function(e,t,r,n){return new(r||(r=Promise))(function(i,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((n=n.apply(e,t||[])).next())})};const Vo=new b(go),Wo=["call","estimateGas"];function Yo(e,t){if(null==e)return null;if("string"==typeof e.message&&e.message.match("reverted")){const r=B(e.data)?e.data:null;if(!t||r)return{message:e.message,data:r}}if("object"==typeof e){for(const r in e){const n=Yo(e[r],t);if(n)return n}return null}if("string"==typeof e)try{return Yo(JSON.parse(e),t)}catch(e){}return null}function Jo(e,t,r){const n=r.transaction||r.signedTransaction;if("call"===e){const e=Yo(t,!0);if(e)return e.data;Vo.throwError("missing revert data in call exception; Transaction reverted without a reason string",b.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:t})}if("estimateGas"===e){let r=Yo(t.body,!1);null==r&&(r=Yo(t,!1)),r&&Vo.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",b.errors.UNPREDICTABLE_GAS_LIMIT,{reason:r.message,method:e,transaction:n,error:t})}let i=t.message;throw t.code===b.errors.SERVER_ERROR&&t.error&&"string"==typeof t.error.message?i=t.error.message:"string"==typeof t.body?i=t.body:"string"==typeof t.responseText&&(i=t.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&Vo.throwError("insufficient funds for intrinsic transaction cost",b.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:n}),i.match(/nonce (is )?too low/i)&&Vo.throwError("nonce has already been used",b.errors.NONCE_EXPIRED,{error:t,method:e,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&Vo.throwError("replacement fee too low",b.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:n}),i.match(/only replay-protected/i)&&Vo.throwError("legacy pre-eip-155 transactions not supported",b.errors.UNSUPPORTED_OPERATION,{error:t,method:e,transaction:n}),Wo.indexOf(e)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&Vo.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",b.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:n}),t}function Qo(e){return new Promise(function(t){setTimeout(t,e)})}function Xo(e){if(e.error){const t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function Zo(e){return e?e.toLowerCase():e}const ea={};class ta extends cr{constructor(e,t,r){if(super(),e!==ea)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");ee(this,"provider",t),null==r&&(r=0),"string"==typeof r?(ee(this,"_address",this.provider.formatter.address(r)),ee(this,"_index",null)):"number"==typeof r?(ee(this,"_index",r),ee(this,"_address",null)):Vo.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(e){return Vo.throwError("cannot alter JSON-RPC Signer connection",b.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new ra(ea,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&Vo.throwError("unknown account #"+this._index,b.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=ie(e);const t=this.getAddress().then(e=>(e&&(e=e.toLowerCase()),e));if(null==e.gasLimit){const r=ie(e);r.from=t,e.gasLimit=this.provider.estimateGas(r)}return null!=e.to&&(e.to=Promise.resolve(e.to).then(e=>Ko(this,void 0,void 0,function*(){if(null==e)return null;const t=yield this.provider.resolveName(e);return null==t&&Vo.throwArgumentError("provided ENS name resolves to null","tx.to",e),t}))),re({tx:re(e),sender:t}).then(({tx:t,sender:r})=>{null!=t.from?t.from.toLowerCase()!==r&&Vo.throwArgumentError("from address mismatch","transaction",e):t.from=r;const n=this.provider.constructor.hexlifyTransaction(t,{from:!0});return this.provider.send("eth_sendTransaction",[n]).then(e=>e,e=>("string"==typeof e.message&&e.message.match(/user denied/i)&&Vo.throwError("user rejected transaction",b.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:t}),Jo("sendTransaction",e,n)))})}signTransaction(e){return Vo.throwError("signing transactions is unsupported",b.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return Ko(this,void 0,void 0,function*(){const t=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(e);try{return yield ho(()=>Ko(this,void 0,void 0,function*(){const e=yield this.provider.getTransaction(r);if(null!==e)return this.provider._wrapTransaction(e,r,t)}),{oncePoll:this.provider})}catch(e){throw e.transactionHash=r,e}})}signMessage(e){return Ko(this,void 0,void 0,function*(){const t="string"==typeof e?je(e):e,r=yield this.getAddress();try{return yield this.provider.send("personal_sign",[_(t),r.toLowerCase()])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&Vo.throwError("user rejected signing",b.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:e}),t}})}_legacySignMessage(e){return Ko(this,void 0,void 0,function*(){const t="string"==typeof e?je(e):e,r=yield this.getAddress();try{return yield this.provider.send("eth_sign",[r.toLowerCase(),_(t)])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&Vo.throwError("user rejected signing",b.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:e}),t}})}_signTypedData(e,t,r){return Ko(this,void 0,void 0,function*(){const n=yield li.resolveNames(e,t,r,e=>this.provider.resolveName(e)),i=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(li.getPayload(n.domain,t,n.value))])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&Vo.throwError("user rejected signing",b.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:n.domain,types:t,value:n.value}}),e}})}unlock(e){return Ko(this,void 0,void 0,function*(){const t=this.provider,r=yield this.getAddress();return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])})}}class ra extends ta{sendTransaction(e){return this.sendUncheckedTransaction(e).then(e=>({hash:e,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:t=>this.provider.waitForTransaction(e,t)}))}}const na={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class ia extends qo{constructor(e,t){let r=t;null==r&&(r=new Promise((e,t)=>{setTimeout(()=>{this.detectNetwork().then(t=>{e(t)},e=>{t(e)})},0)})),super(r),e||(e=te(this.constructor,"defaultUrl")()),ee(this,"connection","string"==typeof e?Object.freeze({url:e}):Object.freeze(ie(e))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return Ko(this,void 0,void 0,function*(){yield Qo(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch(t){try{e=yield this.send("net_version",[])}catch(e){}}if(null!=e){const t=te(this.constructor,"getNetwork");try{return t(W.from(e).toNumber())}catch(t){return Vo.throwError("could not detect network",b.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:t})}}return Vo.throwError("could not detect network",b.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new ta(ea,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(e=>this.formatter.address(e)))}send(e,t){const r={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:ce(r),provider:this});const n=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(n&&this._cache[e])return this._cache[e];const i=lo(this.connection,JSON.stringify(r),Xo).then(e=>(this.emit("debug",{action:"response",request:r,response:e,provider:this}),e),e=>{throw this.emit("debug",{action:"response",error:e,request:r,provider:this}),e});return n&&(this._cache[e]=i,setTimeout(()=>{this._cache[e]=null},0)),i}prepareRequest(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[Zo(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[Zo(t.address),t.blockTag]];case"getCode":return["eth_getCode",[Zo(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[Zo(t.address),D(t.position,32),t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[te(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[te(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=Zo(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return Ko(this,void 0,void 0,function*(){if("call"===e||"estimateGas"===e){const e=t.transaction;if(e&&null!=e.type&&W.from(e.type).isZero()&&null==e.maxFeePerGas&&null==e.maxPriorityFeePerGas){const r=yield this.getFeeData();null==r.maxFeePerGas&&null==r.maxPriorityFeePerGas&&((t=ie(t)).transaction=ie(e),delete t.transaction.type)}}const r=this.prepareRequest(e,t);null==r&&Vo.throwError(e+" not implemented",b.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(r[0],r[1])}catch(r){return Jo(e,r,t)}})}_startEvent(e){"pending"===e.tag&&this._startPending(),super._startEvent(e)}_startPending(){if(null!=this._pendingFilter)return;const e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then(function(r){return function n(){e.send("eth_getFilterChanges",[r]).then(function(r){if(e._pendingFilter!=t)return null;let n=Promise.resolve();return r.forEach(function(t){e._emitted["t:"+t.toLowerCase()]="pending",n=n.then(function(){return e.getTransaction(t).then(function(t){return e.emit("pending",t),null})})}),n.then(function(){return Qo(1e3)})}).then(function(){if(e._pendingFilter==t)return setTimeout(function(){n()},0),null;e.send("eth_uninstallFilter",[r])}).catch(e=>{})}(),r}).catch(e=>{})}_stopEvent(e){"pending"===e.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,t){const r=ie(na);if(t)for(const e in t)t[e]&&(r[e]=!0);ne(e,r);const n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(t){if(null==e[t])return;const r=O(W.from(e[t]));"gasLimit"===t&&(t="gas"),n[t]=r}),["from","to","data"].forEach(function(t){null!=e[t]&&(n[t]=_(e[t]))}),e.accessList&&(n.accessList=hn(e.accessList)),n}}let sa=null;try{if(sa=WebSocket,null==sa)throw new Error("inject please")}catch(e){const t=new b(go);sa=function(){t.throwError("WebSockets not supported in this environment",b.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var oa=function(e,t,r,n){return new(r||(r=Promise))(function(i,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((n=n.apply(e,t||[])).next())})};const aa=new b(go);let ca=1;class ua extends ia{constructor(e,t){"any"===t&&aa.throwError("WebSocketProvider does not support 'any' network yet",b.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),super("string"==typeof e?e:"_websocket",t),this._pollingInterval=-1,this._wsReady=!1,ee(this,"_websocket","string"==typeof e?new sa(this.connection.url):e),ee(this,"_requests",{}),ee(this,"_subs",{}),ee(this,"_subIds",{}),ee(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(e=>{this.websocket.send(this._requests[e].payload)})},this.websocket.onmessage=e=>{const t=e.data,r=JSON.parse(t);if(null!=r.id){const e=String(r.id),n=this._requests[e];if(delete this._requests[e],void 0!==r.result)n.callback(null,r.result),this.emit("debug",{action:"response",request:JSON.parse(n.payload),response:r.result,provider:this});else{let e=null;r.error?(e=new Error(r.error.message||"unknown error"),ee(e,"code",r.error.code||null),ee(e,"response",t)):e=new Error("unknown error"),n.callback(e,void 0),this.emit("debug",{action:"response",error:e,request:JSON.parse(n.payload),provider:this})}}else if("eth_subscription"===r.method){const e=this._subs[r.params.subscription];e&&e.processFunc(r.params.result)}else console.warn("this should not happen")};const r=setInterval(()=>{this.emit("poll")},1e3);r.unref&&r.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){aa.throwError("cannot reset events block on WebSocketProvider",b.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){aa.throwError("cannot set polling interval on WebSocketProvider",b.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return oa(this,void 0,void 0,function*(){return null})}set polling(e){e&&aa.throwError("cannot set polling on WebSocketProvider",b.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,t){const r=ca++;return new Promise((n,i)=>{const s=JSON.stringify({method:e,params:t,id:r,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(s),provider:this}),this._requests[String(r)]={callback:function(e,t){return e?i(e):n(t)},payload:s},this._wsReady&&this.websocket.send(s)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,t,r){return oa(this,void 0,void 0,function*(){let n=this._subIds[e];null==n&&(n=Promise.all(t).then(e=>this.send("eth_subscribe",e)),this._subIds[e]=n);const i=yield n;this._subs[i]={tag:e,processFunc:r}})}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],e=>{const t=W.from(e.number).toNumber();this._emitted.block=t,this.emit("block",t)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],e=>{this.emit("pending",e)});break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],t=>{null==t.removed&&(t.removed=!1),this.emit(e.filter,this.formatter.filterLog(t))});break;case"tx":{const t=e=>{const t=e.hash;this.getTransactionReceipt(t).then(e=>{e&&this.emit(t,e)})};t(e),this._subscribe("tx",["newHeads"],e=>{this._events.filter(e=>"tx"===e.type).forEach(t)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e)}}_stopEvent(e){let t=e.tag;if("tx"===e.type){if(this._events.filter(e=>"tx"===e.type).length)return;t="tx"}else if(this.listenerCount(e.event))return;const r=this._subIds[t];r&&(delete this._subIds[t],r.then(e=>{this._subs[e]&&(delete this._subs[e],this.send("eth_unsubscribe",[e]))}))}destroy(){return oa(this,void 0,void 0,function*(){this.websocket.readyState===sa.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}const la=new b(go);class ha extends ia{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return t=this,r=void 0,i=function*(){let t=this.network;return null==t&&(t=yield e.detectNetwork.call(this),t||la.throwError("no network detected",b.errors.UNKNOWN_ERROR,{}),null==this._network&&(ee(this,"_network",t),this.emit("network",t,null))),t},new((n=void 0)||(n=Promise))(function(e,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n(function(e){e(r)})).then(o,a)}c((i=i.apply(t,r||[])).next())});var t,r,n,i}}class da extends ha{constructor(e,t){la.checkAbstract(new.target,da),e=te(new.target,"getNetwork")(e),t=te(new.target,"getApiKey")(t),super(te(new.target,"getUrl")(e,t),e),"string"==typeof t?ee(this,"apiKey",t):null!=t&&Object.keys(t).forEach(e=>{ee(this,e,t[e])})}_startPending(){la.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return la.throwError("API provider does not support signing",b.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,t){return la.throwError("not implemented; sub-classes must override getUrl",b.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const fa=new b(go),pa="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class ga extends ua{constructor(e,t){const r=new ma(e,t);super(r.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi."),r.network),ee(this,"apiKey",r.apiKey)}isCommunityResource(){return this.apiKey===pa}}class ma extends da{static getWebSocketProvider(e,t){return new ga(e,t)}static getApiKey(e){return null==e?pa:(e&&"string"!=typeof e&&fa.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,t){let r=null;switch(e.name){case"homestead":r="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":r="eth-goerli.g.alchemy.com/v2/";break;case"sepolia":r="eth-sepolia.g.alchemy.com/v2/";break;case"matic":r="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":r="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":r="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":r="arb-goerli.g.alchemy.com/v2/";break;case"arbitrum-sepolia":r="arb-sepolia.g.alchemy.com/v2/";break;case"optimism":r="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":r="opt-goerli.g.alchemy.com/v2/";break;case"optimism-sepolia":r="opt-sepolia.g.alchemy.com/v2/";break;default:fa.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+t,throttleCallback:(e,r)=>(t===pa&&Ao(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===pa}}const ya=new b(go),ba="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function wa(e){switch(e){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"sepolia":return"rpc.ankr.com/eth_sepolia/";case"matic":return"rpc.ankr.com/polygon/";case"maticmum":return"rpc.ankr.com/polygon_mumbai/";case"optimism":return"rpc.ankr.com/optimism/";case"optimism-goerli":return"rpc.ankr.com/optimism_testnet/";case"optimism-sepolia":return"rpc.ankr.com/optimism_sepolia/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return ya.throwArgumentError("unsupported network","name",e)}class va extends da{isCommunityResource(){return this.apiKey===ba}static getApiKey(e){return null==e?ba:e}static getUrl(e,t){null==t&&(t=ba);const r={allowGzip:!0,url:"https://"+wa(e.name)+t,throttleCallback:(e,r)=>(t.apiKey===ba&&Ao(),Promise.resolve(!0))};return null!=t.projectSecret&&(r.user="",r.password=t.projectSecret),r}}const Aa=new b(go);class Ea extends da{static getApiKey(e){return null!=e&&Aa.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,t){let r=null;return"homestead"===e.name?r="https://cloudflare-eth.com/":Aa.throwArgumentError("unsupported network","network",arguments[0]),r}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return n=this,i=void 0,o=function*(){return"getBlockNumber"===e?(yield r.perform.call(this,"getBlock",{blockTag:"latest"})).number:r.perform.call(this,e,t)},new((s=void 0)||(s=Promise))(function(e,t){function r(e){try{c(o.next(e))}catch(e){t(e)}}function a(e){try{c(o.throw(e))}catch(e){t(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof s?n:new s(function(e){e(n)})).then(r,a)}c((o=o.apply(n,i||[])).next())});var n,i,s,o}}var xa=function(e,t,r,n){return new(r||(r=Promise))(function(i,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((n=n.apply(e,t||[])).next())})};const ka=new b(go);function Ta(e){const t={};for(let r in e){if(null==e[r])continue;let n=e[r];"type"===r&&0===n||(n={type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?O(_(n)):"accessList"===r?"["+hn(n).map(e=>`{address:"${e.address}",storageKeys:["${e.storageKeys.join('","')}"]}`).join(",")+"]":_(n),t[r]=n)}return t}function Sa(e){if(0==e.status&&("No records found"===e.message||"No transactions found"===e.message))return e.result;if(1!=e.status||"string"!=typeof e.message||!e.message.match(/^OK/)){const t=new Error("invalid response");throw t.result=JSON.stringify(e),(e.result||"").toLowerCase().indexOf("rate limit")>=0&&(t.throttleRetry=!0),t}return e.result}function Ia(e){if(e&&0==e.status&&"NOTOK"==e.message&&(e.result||"").toLowerCase().indexOf("rate limit")>=0){const t=new Error("throttled response");throw t.result=JSON.stringify(e),t.throttleRetry=!0,t}if("2.0"!=e.jsonrpc){const t=new Error("invalid response");throw t.result=JSON.stringify(e),t}if(e.error){const t=new Error(e.error.message||"unknown error");throw e.error.code&&(t.code=e.error.code),e.error.data&&(t.data=e.error.data),t}return e.result}function Ca(e){if("pending"===e)throw new Error("pending not supported");return"latest"===e?e:parseInt(e.substring(2),16)}function Ba(e,t,r){if("call"===e&&t.code===b.errors.SERVER_ERROR){const e=t.error;if(e&&(e.message.match(/reverted/i)||e.message.match(/VM execution error/i))){let r=e.data;if(r&&(r="0x"+r.replace(/^.*0x/i,"")),B(r))return r;ka.throwError("missing revert data in call exception",b.errors.CALL_EXCEPTION,{error:t,data:"0x"})}}let n=t.message;throw t.code===b.errors.SERVER_ERROR&&(t.error&&"string"==typeof t.error.message?n=t.error.message:"string"==typeof t.body?n=t.body:"string"==typeof t.responseText&&(n=t.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&ka.throwError("insufficient funds for intrinsic transaction cost",b.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&ka.throwError("nonce has already been used",b.errors.NONCE_EXPIRED,{error:t,method:e,transaction:r}),n.match(/another transaction with same nonce/)&&ka.throwError("replacement fee too low",b.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&ka.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",b.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:r}),t}class Na extends qo{constructor(e,t){super(e),ee(this,"baseUrl",this.getBaseUrl()),ee(this,"apiKey",t||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return ka.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,t){const r=Object.keys(t).reduce((e,r)=>{const n=t[r];return null!=n&&(e+=`&${r}=${n}`),e},""),n=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${r}${n}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,t){return t.module=e,t.apikey=this.apiKey,t}fetch(e,t,r){return xa(this,void 0,void 0,function*(){const n=r?this.getPostUrl():this.getUrl(e,t),i=r?this.getPostData(e,t):null,s="proxy"===e?Ia:Sa;this.emit("debug",{action:"request",request:n,provider:this});const o={url:n,throttleSlotInterval:1e3,throttleCallback:(e,t)=>(this.isCommunityResource()&&Ao(),Promise.resolve(!0))};let a=null;i&&(o.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},a=Object.keys(i).map(e=>`${e}=${i[e]}`).join("&"));const c=yield lo(o,a,s||Ia);return this.emit("debug",{action:"response",request:n,response:ce(c),provider:this}),c})}detectNetwork(){return xa(this,void 0,void 0,function*(){return this.network})}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return xa(this,void 0,void 0,function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:t.address,tag:t.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:t.address,tag:t.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:t.address,tag:t.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:t.address,position:t.position,tag:t.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:t.signedTransaction},!0).catch(e=>Ba("sendTransaction",e,t.signedTransaction));case"getBlock":if(t.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:t.blockTag,boolean:t.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:t.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:t.transactionHash});case"call":{if("latest"!==t.blockTag)throw new Error("EtherscanProvider does not support blockTag for call");const e=Ta(t.transaction);e.module="proxy",e.action="eth_call";try{return yield this.fetch("proxy",e,!0)}catch(e){return Ba("call",e,t.transaction)}}case"estimateGas":{const e=Ta(t.transaction);e.module="proxy",e.action="eth_estimateGas";try{return yield this.fetch("proxy",e,!0)}catch(e){return Ba("estimateGas",e,t.transaction)}}case"getLogs":{const e={action:"getLogs"};if(t.filter.fromBlock&&(e.fromBlock=Ca(t.filter.fromBlock)),t.filter.toBlock&&(e.toBlock=Ca(t.filter.toBlock)),t.filter.address&&(e.address=t.filter.address),t.filter.topics&&t.filter.topics.length>0&&(t.filter.topics.length>1&&ka.throwError("unsupported topic count",b.errors.UNSUPPORTED_OPERATION,{topics:t.filter.topics}),1===t.filter.topics.length)){const r=t.filter.topics[0];"string"==typeof r&&66===r.length||ka.throwError("unsupported topic format",b.errors.UNSUPPORTED_OPERATION,{topic0:r}),e.topic0=r}const r=yield this.fetch("logs",e);let n={};for(let e=0;e<r.length;e++){const t=r[e];if(null==t.blockHash){if(null==n[t.blockNumber]){const e=yield this.getBlock(t.blockNumber);e&&(n[t.blockNumber]=e.hash)}t.blockHash=n[t.blockNumber]}}return r}case"getEtherPrice":return"homestead"!==this.network.name?0:parseFloat((yield this.fetch("stats",{action:"ethprice"})).ethusd)}return r.perform.call(this,e,t)})}getHistory(e,t,r){return xa(this,void 0,void 0,function*(){const n={action:"txlist",address:yield this.resolveName(e),startblock:null==t?0:t,endblock:null==r?99999999:r,sort:"asc"};return(yield this.fetch("account",n)).map(e=>{["contractAddress","to"].forEach(function(t){""==e[t]&&delete e[t]}),null==e.creates&&null!=e.contractAddress&&(e.creates=e.contractAddress);const t=this.formatter.transactionResponse(e);return e.timeStamp&&(t.timestamp=parseInt(e.timeStamp)),t})})}isCommunityResource(){return null==this.apiKey}}function _a(e){for(let t=(e=e.slice()).length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}var Ma=function(e,t,r,n){return new(r||(r=Promise))(function(i,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((n=n.apply(e,t||[])).next())})};const Ra=new b(go);function Pa(){return(new Date).getTime()}function Oa(e){let t=null;for(let r=0;r<e.length;r++){const n=e[r];if(null==n)return null;t?t.name===n.name&&t.chainId===n.chainId&&(t.ensAddress===n.ensAddress||null==t.ensAddress&&null==n.ensAddress)||Ra.throwArgumentError("provider mismatch","networks",e):t=n}return t}function La(e,t){e=e.slice().sort();const r=Math.floor(e.length/2);if(e.length%2)return e[r];const n=e[r-1],i=e[r];return null!=t&&Math.abs(n-i)>t?null:(n+i)/2}function Da(e){if(null===e)return"null";if("number"==typeof e||"boolean"==typeof e)return JSON.stringify(e);if("string"==typeof e)return e;if(W.isBigNumber(e))return e.toString();if(Array.isArray(e))return JSON.stringify(e.map(e=>Da(e)));if("object"==typeof e){const t=Object.keys(e);return t.sort(),"{"+t.map(t=>{let r=e[t];return r="function"==typeof r?"[function]":Da(r),JSON.stringify(t)+":"+r}).join(",")+"}"}throw new Error("unknown value type: "+typeof e)}let Ua=1;function Fa(e){let t=null,r=null,n=new Promise(n=>{t=function(){r&&(clearTimeout(r),r=null),n()},r=setTimeout(t,e)});return{cancel:t,getPromise:function(){return n},wait:e=>(n=n.then(e),n)}}const Ha=[b.errors.CALL_EXCEPTION,b.errors.INSUFFICIENT_FUNDS,b.errors.NONCE_EXPIRED,b.errors.REPLACEMENT_UNDERPRICED,b.errors.UNPREDICTABLE_GAS_LIMIT],za=["address","args","errorArgs","errorSignature","method","transaction"];function $a(e,t){const r={weight:e.weight};return Object.defineProperty(r,"provider",{get:()=>e.provider}),e.start&&(r.start=e.start),t&&(r.duration=t-e.start),e.done&&(e.error?r.error=e.error:r.result=e.result||null),r}function Ga(e,t){return Ma(this,void 0,void 0,function*(){const r=e.provider;return null!=r.blockNumber&&r.blockNumber>=t||-1===t?r:ho(()=>new Promise((n,i)=>{setTimeout(function(){return r.blockNumber>=t?n(r):e.cancelled?n(null):n(void 0)},0)}),{oncePoll:r})})}function ja(e,t,r,n){return Ma(this,void 0,void 0,function*(){let i=e.provider;switch(r){case"getBlockNumber":case"getGasPrice":return i[r]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&B(n.blockTag)&&(i=yield Ga(e,t)),i[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&B(n.blockTag)&&(i=yield Ga(e,t)),i.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&B(n.blockTag)&&(i=yield Ga(e,t)),i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&B(n.blockTag)&&(i=yield Ga(e,t)),"call"===r&&n.blockTag?i[r](n.transaction,n.blockTag):i[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return i[r](n.transactionHash);case"getLogs":{let r=n.filter;return(r.fromBlock&&B(r.fromBlock)||r.toBlock&&B(r.toBlock))&&(i=yield Ga(e,t)),i.getLogs(r)}}return Ra.throwError("unknown method error",b.errors.UNKNOWN_ERROR,{method:r,params:n})})}class qa extends qo{constructor(e,t){0===e.length&&Ra.throwArgumentError("missing providers","providers",e);const r=e.map((e,t)=>{if(nr.isProvider(e)){const t=wo(e)?2e3:750,r=1;return Object.freeze({provider:e,weight:1,stallTimeout:t,priority:r})}const r=ie(e);null==r.priority&&(r.priority=1),null==r.stallTimeout&&(r.stallTimeout=wo(e)?2e3:750),null==r.weight&&(r.weight=1);const n=r.weight;return(n%1||n>512||n<1)&&Ra.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${t}].weight`,n),Object.freeze(r)}),n=r.reduce((e,t)=>e+t.weight,0);null==t?t=n/2:t>n&&Ra.throwArgumentError("quorum will always fail; larger than total weight","quorum",t);let i=Oa(r.map(e=>e.provider.network));null==i&&(i=new Promise((e,t)=>{setTimeout(()=>{this.detectNetwork().then(e,t)},0)})),super(i),ee(this,"providerConfigs",Object.freeze(r)),ee(this,"quorum",t),this._highestBlockNumber=-1}detectNetwork(){return Ma(this,void 0,void 0,function*(){return Oa(yield Promise.all(this.providerConfigs.map(e=>e.provider.getNetwork())))})}perform(e,t){return Ma(this,void 0,void 0,function*(){if("sendTransaction"===e){const e=yield Promise.all(this.providerConfigs.map(e=>e.provider.sendTransaction(t.signedTransaction).then(e=>e.hash,e=>e)));for(let t=0;t<e.length;t++){const r=e[t];if("string"==typeof r)return r}throw e[0]}-1===this._highestBlockNumber&&"getBlockNumber"!==e&&(yield this.getBlockNumber());const r=function(e,t,r){let n=Da;switch(t){case"getBlockNumber":return function(t){const r=t.map(e=>e.result);let n=La(t.map(e=>e.result),2);if(null!=n)return n=Math.ceil(n),r.indexOf(n+1)>=0&&n++,n>=e._highestBlockNumber&&(e._highestBlockNumber=n),e._highestBlockNumber};case"getGasPrice":return function(e){const t=e.map(e=>e.result);return t.sort(),t[Math.floor(t.length/2)]};case"getEtherPrice":return function(e){return La(e.map(e=>e.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(e){return null==e?null:((e=ie(e)).confirmations=-1,Da(e))};break;case"getBlock":n=r.includeTransactions?function(e){return null==e?null:((e=ie(e)).transactions=e.transactions.map(e=>((e=ie(e)).confirmations=-1,e)),Da(e))}:function(e){return null==e?null:Da(e)};break;default:throw new Error("unknown method: "+t)}return function(e,t){return function(r){const n={};r.forEach(t=>{const r=e(t.result);n[r]||(n[r]={count:0,result:t.result}),n[r].count++});const i=Object.keys(n);for(let e=0;e<i.length;e++){const r=n[i[e]];if(r.count>=t)return r.result}}}(n,e.quorum)}(this,e,t),n=_a(this.providerConfigs.map(ie));n.sort((e,t)=>e.priority-t.priority);const i=this._highestBlockNumber;let s=0,o=!0;for(;;){const a=Pa();let c=n.filter(e=>e.runner&&a-e.start<e.stallTimeout).reduce((e,t)=>e+t.weight,0);for(;c<this.quorum&&s<n.length;){const r=n[s++],o=Ua++;r.start=Pa(),r.staller=Fa(r.stallTimeout),r.staller.wait(()=>{r.staller=null}),r.runner=ja(r,i,e,t).then(n=>{r.done=!0,r.result=n,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:o,backend:$a(r,Pa()),request:{method:e,params:ce(t)},provider:this})},n=>{r.done=!0,r.error=n,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:o,backend:$a(r,Pa()),request:{method:e,params:ce(t)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:o,backend:$a(r,null),request:{method:e,params:ce(t)},provider:this}),c+=r.weight}const u=[];n.forEach(e=>{!e.done&&e.runner&&(u.push(e.runner),e.staller&&u.push(e.staller.getPromise()))}),u.length&&(yield Promise.race(u));const l=n.filter(e=>e.done&&null==e.error);if(l.length>=this.quorum){const e=r(l);if(void 0!==e)return n.forEach(e=>{e.staller&&e.staller.cancel(),e.cancelled=!0}),e;o||(yield Fa(100).getPromise()),o=!1}const h=n.reduce((e,t)=>{if(!t.done||null==t.error)return e;const r=t.error.code;return Ha.indexOf(r)>=0&&(e[r]||(e[r]={error:t.error,weight:0}),e[r].weight+=t.weight),e},{});if(Object.keys(h).forEach(e=>{const t=h[e];if(t.weight<this.quorum)return;n.forEach(e=>{e.staller&&e.staller.cancel(),e.cancelled=!0});const r=t.error,i={};za.forEach(e=>{null!=r[e]&&(i[e]=r[e])}),Ra.throwError(r.reason||r.message,e,i)}),0===n.filter(e=>!e.done).length)break}return n.forEach(e=>{e.staller&&e.staller.cancel(),e.cancelled=!0}),Ra.throwError("failed to meet quorum",b.errors.SERVER_ERROR,{method:e,params:t,results:n.map(e=>$a(e)),provider:this})})}}const Ka=null,Va=new b(go),Wa="84842078b09946638c03157f83405213";class Ya extends ua{constructor(e,t){const r=new Ja(e,t),n=r.connection;n.password&&Va.throwError("INFURA WebSocket project secrets unsupported",b.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"}),super(n.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/"),e),ee(this,"apiKey",r.projectId),ee(this,"projectId",r.projectId),ee(this,"projectSecret",r.projectSecret)}isCommunityResource(){return this.projectId===Wa}}class Ja extends da{static getWebSocketProvider(e,t){return new Ya(e,t)}static getApiKey(e){const t={apiKey:Wa,projectId:Wa,projectSecret:null};return null==e||("string"==typeof e?t.projectId=e:null!=e.projectSecret?(Va.assertArgument("string"==typeof e.projectId,"projectSecret requires a projectId","projectId",e.projectId),Va.assertArgument("string"==typeof e.projectSecret,"invalid projectSecret","projectSecret","[REDACTED]"),t.projectId=e.projectId,t.projectSecret=e.projectSecret):e.projectId&&(t.projectId=e.projectId),t.apiKey=t.projectId),t}static getUrl(e,t){let r=null;switch(e?e.name:"unknown"){case"homestead":r="mainnet.infura.io";break;case"goerli":r="goerli.infura.io";break;case"sepolia":r="sepolia.infura.io";break;case"matic":r="polygon-mainnet.infura.io";break;case"maticmum":r="polygon-mumbai.infura.io";break;case"optimism":r="optimism-mainnet.infura.io";break;case"optimism-goerli":r="optimism-goerli.infura.io";break;case"optimism-sepolia":r="optimism-sepolia.infura.io";break;case"arbitrum":r="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":r="arbitrum-goerli.infura.io";break;case"arbitrum-sepolia":r="arbitrum-sepolia.infura.io";break;default:Va.throwError("unsupported network",b.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const n={allowGzip:!0,url:"https://"+r+"/v3/"+t.projectId,throttleCallback:(e,r)=>(t.projectId===Wa&&Ao(),Promise.resolve(!0))};return null!=t.projectSecret&&(n.user="",n.password=t.projectSecret),n}isCommunityResource(){return this.projectId===Wa}}class Qa extends ia{send(e,t){const r={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};null==this._pendingBatch&&(this._pendingBatch=[]);const n={request:r,resolve:null,reject:null},i=new Promise((e,t)=>{n.resolve=e,n.reject=t});return this._pendingBatch.push(n),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout(()=>{const e=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const t=e.map(e=>e.request);return this.emit("debug",{action:"requestBatch",request:ce(t),provider:this}),lo(this.connection,JSON.stringify(t)).then(r=>{this.emit("debug",{action:"response",request:t,response:r,provider:this}),e.forEach((e,t)=>{const n=r[t];if(n.error){const t=new Error(n.error.message);t.code=n.error.code,t.data=n.error.data,e.reject(t)}else e.resolve(n.result)})},r=>{this.emit("debug",{action:"response",error:r,request:t,provider:this}),e.forEach(e=>{e.reject(r)})})},10)),i}}const Xa=new b(go);class Za extends da{static getApiKey(e){return e&&"string"!=typeof e&&Xa.throwArgumentError("invalid apiKey","apiKey",e),e||"ETHERS_JS_SHARED"}static getUrl(e,t){Xa.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let r=null;switch(e.name){case"homestead":r="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":r="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":r="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":r="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":r="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:Xa.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+t}}const ec=new b(go),tc="62e1ad51b37b8e00394bda3b";class rc extends da{static getApiKey(e){const t={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return null==e?t.applicationId=tc:"string"==typeof e?t.applicationId=e:null!=e.applicationSecretKey?(t.applicationId=e.applicationId,t.applicationSecretKey=e.applicationSecretKey):e.applicationId?t.applicationId=e.applicationId:ec.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),t}static getUrl(e,t){let r=null;switch(e?e.name:"unknown"){case"goerli":r="eth-goerli.gateway.pokt.network";break;case"homestead":r="eth-mainnet.gateway.pokt.network";break;case"kovan":r="poa-kovan.gateway.pokt.network";break;case"matic":r="poly-mainnet.gateway.pokt.network";break;case"maticmum":r="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":r="eth-rinkeby.gateway.pokt.network";break;case"ropsten":r="eth-ropsten.gateway.pokt.network";break;default:ec.throwError("unsupported network",b.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const n={headers:{},url:`https://${r}/v1/lb/${t.applicationId}`};return null!=t.applicationSecretKey&&(n.user="",n.password=t.applicationSecretKey),n}isCommunityResource(){return this.applicationId===tc}}const nc=new b(go);class ic extends da{static getApiKey(e){return e&&"string"!=typeof e&&nc.throwArgumentError("invalid apiKey","apiKey",e),e||"919b412a057b5e9c9b6dce193c5a60242d6efadb"}static getUrl(e,t){let r=null;switch(e.name){case"homestead":r="ethers.quiknode.pro";break;case"goerli":r="ethers.ethereum-goerli.quiknode.pro";break;case"sepolia":r="ethers.ethereum-sepolia.quiknode.pro";break;case"holesky":r="ethers.ethereum-holesky.quiknode.pro";break;case"arbitrum":r="ethers.arbitrum-mainnet.quiknode.pro";break;case"arbitrum-goerli":r="ethers.arbitrum-goerli.quiknode.pro";break;case"arbitrum-sepolia":r="ethers.arbitrum-sepolia.quiknode.pro";break;case"base":r="ethers.base-mainnet.quiknode.pro";break;case"base-goerli":r="ethers.base-goerli.quiknode.pro";break;case"base-spolia":r="ethers.base-sepolia.quiknode.pro";break;case"bnb":r="ethers.bsc.quiknode.pro";break;case"bnbt":r="ethers.bsc-testnet.quiknode.pro";break;case"matic":r="ethers.matic.quiknode.pro";break;case"maticmum":r="ethers.matic-testnet.quiknode.pro";break;case"optimism":r="ethers.optimism.quiknode.pro";break;case"optimism-goerli":r="ethers.optimism-goerli.quiknode.pro";break;case"optimism-sepolia":r="ethers.optimism-sepolia.quiknode.pro";break;case"xdai":r="ethers.xdai.quiknode.pro";break;default:nc.throwArgumentError("unsupported network","network",arguments[0])}return"https://"+r+"/"+t}}const sc=new b(go);let oc=1;function ac(e,t){const r="Web3LegacyFetcher";return function(e,n){const i={method:e,params:n,id:oc++,jsonrpc:"2.0"};return new Promise((e,n)=>{this.emit("debug",{action:"request",fetcher:r,request:ce(i),provider:this}),t(i,(t,s)=>{if(t)return this.emit("debug",{action:"response",fetcher:r,error:t,request:i,provider:this}),n(t);if(this.emit("debug",{action:"response",fetcher:r,request:i,response:s,provider:this}),s.error){const e=new Error(s.error.message);return e.code=s.error.code,e.data=s.error.data,n(e)}e(s.result)})})}}class cc extends ia{constructor(e,t){null==e&&sc.throwArgumentError("missing provider","provider",e);let r=null,n=null,i=null;"function"==typeof e?(r="unknown:",n=e):(r=e.host||e.path||"",!r&&e.isMetaMask&&(r="metamask"),i=e,e.request?(""===r&&(r="eip-1193:"),n=function(e){return function(t,r){null==r&&(r=[]);const n={method:t,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:ce(n),provider:this}),e.request(n).then(e=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,response:e,provider:this}),e),e=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,error:e,provider:this}),e})}}(e)):e.sendAsync?n=ac(0,e.sendAsync.bind(e)):e.send?n=ac(0,e.send.bind(e)):sc.throwArgumentError("unsupported provider","provider",e),r||(r="unknown:")),super(r,t),ee(this,"jsonRpcFetchFunc",n),ee(this,"provider",i)}send(e,t){return this.jsonRpcFetchFunc(e,t)}}const uc=new b(go);function lc(e,t){if(null==e&&(e="homestead"),"string"==typeof e){const t=e.match(/^(ws|http)s?:/i);if(t)switch(t[1].toLowerCase()){case"http":case"https":return new ia(e);case"ws":case"wss":return new ua(e);default:uc.throwArgumentError("unsupported URL scheme","network",e)}}const r=Ms(e);return r&&r._defaultProvider||uc.throwError("unsupported getDefaultProvider network",b.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:e}),r._defaultProvider({FallbackProvider:qa,AlchemyProvider:ma,AnkrProvider:va,CloudflareProvider:Ea,EtherscanProvider:Na,InfuraProvider:Ja,JsonRpcProvider:ia,NodesmithProvider:Za,PocketProvider:rc,QuickNodeProvider:ic,Web3Provider:cc,IpcProvider:Ka},t)}const hc=new RegExp("^bytes([0-9]+)$"),dc=new RegExp("^(u?int)([0-9]*)$"),fc=new RegExp("^(.*)\\[([0-9]*)\\]$"),pc=new b("solidity/5.8.0");function gc(e,t,r){switch(e){case"address":return r?C(t,32):T(t);case"string":return je(t);case"bytes":return T(t);case"bool":return t=t?"0x01":"0x00",r?C(t,32):T(t)}let n=e.match(dc);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!=0||0===i||i>256)&&pc.throwArgumentError("invalid number type","type",e),r&&(i=256),C(t=W.from(t).toTwos(i),i/8)}if(n=e.match(hc),n){const i=parseInt(n[1]);return(String(i)!==n[1]||0===i||i>32)&&pc.throwArgumentError("invalid bytes type","type",e),T(t).byteLength!==i&&pc.throwArgumentError(`invalid value for ${e}`,"value",t),r?T((t+"0000000000000000000000000000000000000000000000000000000000000000").substring(0,66)):t}if(n=e.match(fc),n&&Array.isArray(t)){const r=n[1];parseInt(n[2]||String(t.length))!=t.length&&pc.throwArgumentError(`invalid array length for ${e}`,"value",t);const i=[];return t.forEach(function(e){i.push(gc(r,e,!0))}),S(i)}return pc.throwArgumentError("invalid type","type",e)}function mc(e,t){e.length!=t.length&&pc.throwArgumentError("wrong number of values; expected ${ types.length }","values",t);const r=[];return e.forEach(function(e,n){r.push(gc(e,t[n]))}),_(S(r))}function yc(e,t){return be(mc(e,t))}function bc(e,t){return mi(mc(e,t))}function wc(e,t){t||(t=function(e){return[parseInt(e,16)]});let r=0,n={};return e.split(",").forEach(e=>{let i=e.split(":");r+=parseInt(i[0],16),n[r]=t(i[1])}),n}function vc(e){let t=0;return e.split(",").map(e=>{let r=e.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=t+parseInt(r[0],16);return t=parseInt(r[1],16),{l:n,h:t}})}function Ac(e,t){let r=0;for(let n=0;n<t.length;n++){let i=t[n];if(r+=i.l,e>=r&&e<=r+i.h&&(e-r)%(i.d||1)===0){if(i.e&&-1!==i.e.indexOf(e-r))continue;return i}}return null}const Ec=vc("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),xc="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(e=>parseInt(e,16)),kc=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],Tc=wc("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),Sc=wc("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),Ic=wc("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",function(e){if(e.length%4!=0)throw new Error("bad data");let t=[];for(let r=0;r<e.length;r+=4)t.push(parseInt(e.substring(r,r+4),16));return t}),Cc=vc("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function Bc(e){if(e.match(/^[a-z0-9-]*$/i)&&e.length<=59)return e.toLowerCase();let t=Ye(e);var r;r=t.map(e=>{if(xc.indexOf(e)>=0)return[];if(e>=65024&&e<=65039)return[];let t=function(e){let t=Ac(e,kc);if(t)return[e+t.s];let r=Tc[e];if(r)return r;let n=Sc[e];return n?[e+n[0]]:Ic[e]||null}(e);return t||[e]}),t=r.reduce((e,t)=>(t.forEach(t=>{e.push(t)}),e),[]),t=Ye(Ve(t),Fe.NFKC),t.forEach(e=>{if(Ac(e,Cc))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")}),t.forEach(e=>{if(Ac(e,Ec))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")});let n=Ve(t);if("-"===n.substring(0,1)||"--"===n.substring(2,4)||"-"===n.substring(n.length-1))throw new Error("invalid hyphen");return n}function Nc(e){const t=je(e);if(t.length>31)throw new Error("bytes32 string must be less than 32 bytes");return _(S([t,xs]).slice(0,32))}function _c(e){const t=T(e);if(32!==t.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==t[31])throw new Error("invalid bytes32 string - no null terminator");let r=31;for(;0===t[r-1];)r--;return We(t.slice(0,r))}const Mc=new b("units/5.8.0"),Rc=["wei","kwei","mwei","gwei","szabo","finney","ether"];function Pc(e){const t=String(e).split(".");(t.length>2||!t[0].match(/^-?[0-9]*$/)||t[1]&&!t[1].match(/^[0-9]*$/)||"."===e||"-."===e)&&Mc.throwArgumentError("invalid value","value",e);let r=t[0],n="";for("-"===r.substring(0,1)&&(n="-",r=r.substring(1));"0"===r.substring(0,1);)r=r.substring(1);""===r&&(r="0");let i="";for(2===t.length&&(i="."+(t[1]||"0"));i.length>2&&"0"===i[i.length-1];)i=i.substring(0,i.length-1);const s=[];for(;r.length;){if(r.length<=3){s.unshift(r);break}{const e=r.length-3;s.unshift(r.substring(e)),r=r.substring(0,e)}}return n+s.join(",")+i}function Oc(e,t){if("string"==typeof t){const e=Rc.indexOf(t);-1!==e&&(t=3*e)}return $n(e,null!=t?t:18)}function Lc(e,t){if("string"!=typeof e&&Mc.throwArgumentError("value must be a string","value",e),"string"==typeof t){const e=Rc.indexOf(t);-1!==e&&(t=3*e)}return Gn(e,null!=t?t:18)}function Dc(e){return Oc(e,18)}function Uc(e){return Lc(e,18)}const Fc="ethers/5.8.0",Hc=new b(Fc);try{const e=window;null==e._ethers&&(e._ethers=c)}catch(e){}},9499(e,t,r){var n=t;n.utils=r(461),n.common=r(2191),n.sha=r(5746),n.ripemd=r(4169),n.hmac=r(1825),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},2191(e,t,r){"use strict";var n=r(461),i=r(7784);function s(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=s,s.prototype.update=function(e,t){if(e=n.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=n.join32(e,0,e.length-r,this.endian);for(var i=0;i<e.length;i+=this._delta32)this._update(e,i,i+this._delta32)}return this},s.prototype.digest=function(e){return this.update(this._pad()),i(null===this.pending),this._digest(e)},s.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(e<<=3,"big"===this.endian){for(var s=8;s<this.padLength;s++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=e>>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,s=8;s<this.padLength;s++)n[i++]=0;return n}},1825(e,t,r){"use strict";var n=r(461),i=r(7784);function s(e,t,r){if(!(this instanceof s))return new s(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(t,r))}e.exports=s,s.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},s.prototype.update=function(e,t){return this.inner.update(e,t),this},s.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}},4169(e,t,r){"use strict";var n=r(461),i=r(2191),s=n.rotl32,o=n.sum32,a=n.sum32_3,c=n.sum32_4,u=i.BlockHash;function l(){if(!(this instanceof l))return new l;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function h(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function d(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function f(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}n.inherits(l,u),t.ripemd160=l,l.blockSize=512,l.outSize=160,l.hmacStrength=192,l.padLength=64,l.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],i=this.h[2],u=this.h[3],l=this.h[4],b=r,w=n,v=i,A=u,E=l,x=0;x<80;x++){var k=o(s(c(r,h(x,n,i,u),e[p[x]+t],d(x)),m[x]),l);r=l,l=u,u=s(i,10),i=n,n=k,k=o(s(c(b,h(79-x,w,v,A),e[g[x]+t],f(x)),y[x]),E),b=E,E=A,A=s(v,10),v=w,w=k}k=a(this.h[1],i,A),this.h[1]=a(this.h[2],u,E),this.h[2]=a(this.h[3],l,b),this.h[3]=a(this.h[4],r,w),this.h[4]=a(this.h[0],n,v),this.h[0]=k},l.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],g=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],y=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},5746(e,t,r){"use strict";t.sha1=r(2986),t.sha224=r(5393),t.sha256=r(536),t.sha384=r(2348),t.sha512=r(2157)},2986(e,t,r){"use strict";var n=r(461),i=r(2191),s=r(600),o=n.rotl32,a=n.sum32,c=n.sum32_5,u=s.ft_1,l=i.BlockHash,h=[1518500249,1859775393,2400959708,3395469782];function d(){if(!(this instanceof d))return new d;l.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(d,l),e.exports=d,d.blockSize=512,d.outSize=160,d.hmacStrength=80,d.padLength=64,d.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=o(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var i=this.h[0],s=this.h[1],l=this.h[2],d=this.h[3],f=this.h[4];for(n=0;n<r.length;n++){var p=~~(n/20),g=c(o(i,5),u(p,s,l,d),f,r[n],h[p]);f=d,d=l,l=o(s,30),s=i,i=g}this.h[0]=a(this.h[0],i),this.h[1]=a(this.h[1],s),this.h[2]=a(this.h[2],l),this.h[3]=a(this.h[3],d),this.h[4]=a(this.h[4],f)},d.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},5393(e,t,r){"use strict";var n=r(461),i=r(536);function s(){if(!(this instanceof s))return new s;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(s,i),e.exports=s,s.blockSize=512,s.outSize=224,s.hmacStrength=192,s.padLength=64,s.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},536(e,t,r){"use strict";var n=r(461),i=r(2191),s=r(600),o=r(7784),a=n.sum32,c=n.sum32_4,u=n.sum32_5,l=s.ch32,h=s.maj32,d=s.s0_256,f=s.s1_256,p=s.g0_256,g=s.g1_256,m=i.BlockHash,y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function b(){if(!(this instanceof b))return new b;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=y,this.W=new Array(64)}n.inherits(b,m),e.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=c(g(r[n-2]),r[n-7],p(r[n-15]),r[n-16]);var i=this.h[0],s=this.h[1],m=this.h[2],y=this.h[3],b=this.h[4],w=this.h[5],v=this.h[6],A=this.h[7];for(o(this.k.length===r.length),n=0;n<r.length;n++){var E=u(A,f(b),l(b,w,v),this.k[n],r[n]),x=a(d(i),h(i,s,m));A=v,v=w,w=b,b=a(y,E),y=m,m=s,s=i,i=a(E,x)}this.h[0]=a(this.h[0],i),this.h[1]=a(this.h[1],s),this.h[2]=a(this.h[2],m),this.h[3]=a(this.h[3],y),this.h[4]=a(this.h[4],b),this.h[5]=a(this.h[5],w),this.h[6]=a(this.h[6],v),this.h[7]=a(this.h[7],A)},b.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},2348(e,t,r){"use strict";var n=r(461),i=r(2157);function s(){if(!(this instanceof s))return new s;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(s,i),e.exports=s,s.blockSize=1024,s.outSize=384,s.hmacStrength=192,s.padLength=128,s.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},2157(e,t,r){"use strict";var n=r(461),i=r(2191),s=r(7784),o=n.rotr64_hi,a=n.rotr64_lo,c=n.shr64_hi,u=n.shr64_lo,l=n.sum64,h=n.sum64_hi,d=n.sum64_lo,f=n.sum64_4_hi,p=n.sum64_4_lo,g=n.sum64_5_hi,m=n.sum64_5_lo,y=i.BlockHash,b=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function w(){if(!(this instanceof w))return new w;y.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=b,this.W=new Array(160)}function v(e,t,r,n,i){var s=e&r^~e&i;return s<0&&(s+=4294967296),s}function A(e,t,r,n,i,s){var o=t&n^~t&s;return o<0&&(o+=4294967296),o}function E(e,t,r,n,i){var s=e&r^e&i^r&i;return s<0&&(s+=4294967296),s}function x(e,t,r,n,i,s){var o=t&n^t&s^n&s;return o<0&&(o+=4294967296),o}function k(e,t){var r=o(e,t,28)^o(t,e,2)^o(t,e,7);return r<0&&(r+=4294967296),r}function T(e,t){var r=a(e,t,28)^a(t,e,2)^a(t,e,7);return r<0&&(r+=4294967296),r}function S(e,t){var r=o(e,t,14)^o(e,t,18)^o(t,e,9);return r<0&&(r+=4294967296),r}function I(e,t){var r=a(e,t,14)^a(e,t,18)^a(t,e,9);return r<0&&(r+=4294967296),r}function C(e,t){var r=o(e,t,1)^o(e,t,8)^c(e,t,7);return r<0&&(r+=4294967296),r}function B(e,t){var r=a(e,t,1)^a(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function N(e,t){var r=o(e,t,19)^o(t,e,29)^c(e,t,6);return r<0&&(r+=4294967296),r}function _(e,t){var r=a(e,t,19)^a(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}n.inherits(w,y),e.exports=w,w.blockSize=1024,w.outSize=512,w.hmacStrength=192,w.padLength=128,w.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var i=N(r[n-4],r[n-3]),s=_(r[n-4],r[n-3]),o=r[n-14],a=r[n-13],c=C(r[n-30],r[n-29]),u=B(r[n-30],r[n-29]),l=r[n-32],h=r[n-31];r[n]=f(i,s,o,a,c,u,l,h),r[n+1]=p(i,s,o,a,c,u,l,h)}},w.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],c=this.h[4],u=this.h[5],f=this.h[6],p=this.h[7],y=this.h[8],b=this.h[9],w=this.h[10],C=this.h[11],B=this.h[12],N=this.h[13],_=this.h[14],M=this.h[15];s(this.k.length===r.length);for(var R=0;R<r.length;R+=2){var P=_,O=M,L=S(y,b),D=I(y,b),U=v(y,0,w,0,B),F=A(0,b,0,C,0,N),H=this.k[R],z=this.k[R+1],$=r[R],G=r[R+1],j=g(P,O,L,D,U,F,H,z,$,G),q=m(P,O,L,D,U,F,H,z,$,G);P=k(n,i),O=T(n,i),L=E(n,0,o,0,c),D=x(0,i,0,a,0,u);var K=h(P,O,L,D),V=d(P,O,L,D);_=B,M=N,B=w,N=C,w=y,C=b,y=h(f,p,j,q),b=d(p,p,j,q),f=c,p=u,c=o,u=a,o=n,a=i,n=h(j,q,K,V),i=d(j,q,K,V)}l(this.h,0,n,i),l(this.h,2,o,a),l(this.h,4,c,u),l(this.h,6,f,p),l(this.h,8,y,b),l(this.h,10,w,C),l(this.h,12,B,N),l(this.h,14,_,M)},w.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},600(e,t,r){"use strict";var n=r(461).rotr32;function i(e,t,r){return e&t^~e&r}function s(e,t,r){return e&t^e&r^t&r}function o(e,t,r){return e^t^r}t.ft_1=function(e,t,r,n){return 0===e?i(t,r,n):1===e||3===e?o(t,r,n):2===e?s(t,r,n):void 0},t.ch32=i,t.maj32=s,t.p32=o,t.s0_256=function(e){return n(e,2)^n(e,13)^n(e,22)},t.s1_256=function(e){return n(e,6)^n(e,11)^n(e,25)},t.g0_256=function(e){return n(e,7)^n(e,18)^e>>>3},t.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},461(e,t,r){"use strict";var n=r(7784),i=r(5615);function s(e,t){return 55296==(64512&e.charCodeAt(t))&&!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1))}function o(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function a(e){return 1===e.length?"0"+e:e}function c(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=i,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i<e.length;i+=2)r.push(parseInt(e[i]+e[i+1],16))}else for(var n=0,i=0;i<e.length;i++){var o=e.charCodeAt(i);o<128?r[n++]=o:o<2048?(r[n++]=o>>6|192,r[n++]=63&o|128):s(e,i)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++i)),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=63&o|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=63&o|128)}else for(i=0;i<e.length;i++)r[i]=0|e[i];return r},t.toHex=function(e){for(var t="",r=0;r<e.length;r++)t+=a(e[r].toString(16));return t},t.htonl=o,t.toHex32=function(e,t){for(var r="",n=0;n<e.length;n++){var i=e[n];"little"===t&&(i=o(i)),r+=c(i.toString(16))}return r},t.zero2=a,t.zero8=c,t.join32=function(e,t,r,i){var s=r-t;n(s%4==0);for(var o=new Array(s/4),a=0,c=t;a<o.length;a++,c+=4){var u;u="big"===i?e[c]<<24|e[c+1]<<16|e[c+2]<<8|e[c+3]:e[c+3]<<24|e[c+2]<<16|e[c+1]<<8|e[c],o[a]=u>>>0}return o},t.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n<e.length;n++,i+=4){var s=e[n];"big"===t?(r[i]=s>>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=255&s):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=255&s)}return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},t.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},t.sum64=function(e,t,r,n){var i=e[t],s=n+e[t+1]>>>0,o=(s<n?1:0)+r+i;e[t]=o>>>0,e[t+1]=s},t.sum64_hi=function(e,t,r,n){return(t+n>>>0<t?1:0)+e+r>>>0},t.sum64_lo=function(e,t,r,n){return t+n>>>0},t.sum64_4_hi=function(e,t,r,n,i,s,o,a){var c=0,u=t;return c+=(u=u+n>>>0)<t?1:0,c+=(u=u+s>>>0)<s?1:0,e+r+i+o+(c+=(u=u+a>>>0)<a?1:0)>>>0},t.sum64_4_lo=function(e,t,r,n,i,s,o,a){return t+n+s+a>>>0},t.sum64_5_hi=function(e,t,r,n,i,s,o,a,c,u){var l=0,h=t;return l+=(h=h+n>>>0)<t?1:0,l+=(h=h+s>>>0)<s?1:0,l+=(h=h+a>>>0)<a?1:0,e+r+i+o+c+(l+=(h=h+u>>>0)<u?1:0)>>>0},t.sum64_5_lo=function(e,t,r,n,i,s,o,a,c,u){return t+n+s+a+u>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},9318(e,t){t.read=function(e,t,r,n,i){var s,o,a=8*i-n-1,c=(1<<a)-1,u=c>>1,l=-7,h=r?i-1:0,d=r?-1:1,f=e[t+h];for(h+=d,s=f&(1<<-l)-1,f>>=-l,l+=a;l>0;s=256*s+e[t+h],h+=d,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=256*o+e[t+h],h+=d,l-=8);if(0===s)s=1-u;else{if(s===c)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),s-=u}return(f?-1:1)*o*Math.pow(2,s-n)},t.write=function(e,t,r,n,i,s){var o,a,c,u=8*s-i-1,l=(1<<u)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:s-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(o++,c/=2),o+h>=l?(a=0,o=l):o+h>=1?(a=(t*c-1)*Math.pow(2,i),o+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;e[r+f]=255&a,f+=p,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;e[r+f]=255&o,f+=p,o/=256,u-=8);e[r+f-p]|=128*g}},5615(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},671(e,t,r){var n,i=r(9907);!function(){"use strict";var s="input is invalid type",o="object"==typeof window,a=o?window:{};a.JS_SHA3_NO_WINDOW&&(o=!1);var c=!o&&"object"==typeof self;!a.JS_SHA3_NO_NODE_JS&&"object"==typeof i&&i.versions&&i.versions.node?a=globalThis:c&&(a=self);var u=!a.JS_SHA3_NO_COMMON_JS&&e.exports,l=r.amdO,h=!a.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,d="0123456789abcdef".split(""),f=[4,1024,262144,67108864],p=[0,8,16,24],g=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],m=[224,256,384,512],y=[128,256],b=["hex","buffer","arrayBuffer","array","digest"],w={128:168,256:136};!a.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!h||!a.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var v=function(e,t,r){return function(n){return new O(e,t,e).update(n)[r]()}},A=function(e,t,r){return function(n,i){return new O(e,t,i).update(n)[r]()}},E=function(e,t,r){return function(t,n,i,s){return I["cshake"+e].update(t,n,i,s)[r]()}},x=function(e,t,r){return function(t,n,i,s){return I["kmac"+e].update(t,n,i,s)[r]()}},k=function(e,t,r,n){for(var i=0;i<b.length;++i){var s=b[i];e[s]=t(r,n,s)}return e},T=function(e,t){var r=v(e,t,"hex");return r.create=function(){return new O(e,t,e)},r.update=function(e){return r.create().update(e)},k(r,v,e,t)},S=[{name:"keccak",padding:[1,256,65536,16777216],bits:m,createMethod:T},{name:"sha3",padding:[6,1536,393216,100663296],bits:m,createMethod:T},{name:"shake",padding:[31,7936,2031616,520093696],bits:y,createMethod:function(e,t){var r=A(e,t,"hex");return r.create=function(r){return new O(e,t,r)},r.update=function(e,t){return r.create(t).update(e)},k(r,A,e,t)}},{name:"cshake",padding:f,bits:y,createMethod:function(e,t){var r=w[e],n=E(e,0,"hex");return n.create=function(n,i,s){return i||s?new O(e,t,n).bytepad([i,s],r):I["shake"+e].create(n)},n.update=function(e,t,r,i){return n.create(t,r,i).update(e)},k(n,E,e,t)}},{name:"kmac",padding:f,bits:y,createMethod:function(e,t){var r=w[e],n=x(e,0,"hex");return n.create=function(n,i,s){return new L(e,t,i).bytepad(["KMAC",s],r).bytepad([n],r)},n.update=function(e,t,r,i){return n.create(e,r,i).update(t)},k(n,x,e,t)}}],I={},C=[],B=0;B<S.length;++B)for(var N=S[B],_=N.bits,M=0;M<_.length;++M){var R=N.name+"_"+_[M];if(C.push(R),I[R]=N.createMethod(_[M],N.padding),"sha3"!==N.name){var P=N.name+_[M];C.push(P),I[P]=I[R]}}function O(e,t,r){this.blocks=[],this.s=[],this.padding=t,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function L(e,t,r){O.call(this,e,t,r)}O.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(s);if(null===e)throw new Error(s);if(h&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||h&&ArrayBuffer.isView(e)))throw new Error(s);t=!0}for(var n,i,o=this.blocks,a=this.byteCount,c=e.length,u=this.blockCount,l=0,d=this.s;l<c;){if(this.reset)for(this.reset=!1,o[0]=this.block,n=1;n<u+1;++n)o[n]=0;if(t)for(n=this.start;l<c&&n<a;++l)o[n>>2]|=e[l]<<p[3&n++];else for(n=this.start;l<c&&n<a;++l)(i=e.charCodeAt(l))<128?o[n>>2]|=i<<p[3&n++]:i<2048?(o[n>>2]|=(192|i>>6)<<p[3&n++],o[n>>2]|=(128|63&i)<<p[3&n++]):i<55296||i>=57344?(o[n>>2]|=(224|i>>12)<<p[3&n++],o[n>>2]|=(128|i>>6&63)<<p[3&n++],o[n>>2]|=(128|63&i)<<p[3&n++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++l)),o[n>>2]|=(240|i>>18)<<p[3&n++],o[n>>2]|=(128|i>>12&63)<<p[3&n++],o[n>>2]|=(128|i>>6&63)<<p[3&n++],o[n>>2]|=(128|63&i)<<p[3&n++]);if(this.lastByteIndex=n,n>=a){for(this.start=n-a,this.block=o[u],n=0;n<u;++n)d[n]^=o[n];D(d),this.reset=!0}else this.start=n}return this},O.prototype.encode=function(e,t){var r=255&e,n=1,i=[r];for(r=255&(e>>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},O.prototype.encodeString=function(e){var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(s);if(null===e)throw new Error(s);if(h&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||h&&ArrayBuffer.isView(e)))throw new Error(s);t=!0}var n=0,i=e.length;if(t)n=i;else for(var o=0;o<e.length;++o){var a=e.charCodeAt(o);a<128?n+=1:a<2048?n+=2:a<55296||a>=57344?n+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++o)),n+=4)}return n+=this.encode(8*n),this.update(e),n},O.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n<e.length;++n)r+=this.encodeString(e[n]);var i=t-r%t,s=[];return s.length=i,this.update(s),this},O.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,n=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t<r+1;++t)e[t]=0;for(e[r-1]|=2147483648,t=0;t<r;++t)n[t]^=e[t];D(n)}},O.prototype.toString=O.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,s=0,o=0,a="";o<n;){for(s=0;s<t&&o<n;++s,++o)e=r[s],a+=d[e>>4&15]+d[15&e]+d[e>>12&15]+d[e>>8&15]+d[e>>20&15]+d[e>>16&15]+d[e>>28&15]+d[e>>24&15];o%t===0&&(D(r),s=0)}return i&&(e=r[s],a+=d[e>>4&15]+d[15&e],i>1&&(a+=d[e>>12&15]+d[e>>8&15]),i>2&&(a+=d[e>>20&15]+d[e>>16&15])),a},O.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,s=0,o=0,a=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var c=new Uint32Array(e);o<n;){for(s=0;s<t&&o<n;++s,++o)c[o]=r[s];o%t===0&&D(r)}return i&&(c[s]=r[s],e=e.slice(0,a)),e},O.prototype.buffer=O.prototype.arrayBuffer,O.prototype.digest=O.prototype.array=function(){this.finalize();for(var e,t,r=this.blockCount,n=this.s,i=this.outputBlocks,s=this.extraBytes,o=0,a=0,c=[];a<i;){for(o=0;o<r&&a<i;++o,++a)e=a<<2,t=n[o],c[e]=255&t,c[e+1]=t>>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;a%r===0&&D(n)}return s&&(e=a<<2,t=n[o],c[e]=255&t,s>1&&(c[e+1]=t>>8&255),s>2&&(c[e+2]=t>>16&255)),c},L.prototype=new O,L.prototype.finalize=function(){return this.encode(this.outputBits,!0),O.prototype.finalize.call(this)};var D=function(e){var t,r,n,i,s,o,a,c,u,l,h,d,f,p,m,y,b,w,v,A,E,x,k,T,S,I,C,B,N,_,M,R,P,O,L,D,U,F,H,z,$,G,j,q,K,V,W,Y,J,Q,X,Z,ee,te,re,ne,ie,se,oe,ae,ce,ue,le;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],s=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],l=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(d=e[8]^e[18]^e[28]^e[38]^e[48])^(o<<1|a>>>31),r=(f=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|o>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(c<<1|u>>>31),r=s^(u<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=o^(l<<1|h>>>31),r=a^(h<<1|l>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(d<<1|f>>>31),r=u^(f<<1|d>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=l^(i<<1|s>>>31),r=h^(s<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,p=e[0],m=e[1],V=e[11]<<4|e[10]>>>28,W=e[10]<<4|e[11]>>>28,B=e[20]<<3|e[21]>>>29,N=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,G=e[40]<<18|e[41]>>>14,j=e[41]<<18|e[40]>>>14,O=e[2]<<1|e[3]>>>31,L=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,b=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,_=e[33]<<13|e[32]>>>19,M=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,le=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,D=e[14]<<6|e[15]>>>26,U=e[15]<<6|e[14]>>>26,w=e[25]<<11|e[24]>>>21,v=e[24]<<11|e[25]>>>21,Q=e[34]<<15|e[35]>>>17,X=e[35]<<15|e[34]>>>17,R=e[45]<<29|e[44]>>>3,P=e[44]<<29|e[45]>>>3,T=e[6]<<28|e[7]>>>4,S=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,F=e[26]<<25|e[27]>>>7,H=e[27]<<25|e[26]>>>7,A=e[36]<<21|e[37]>>>11,E=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,q=e[8]<<27|e[9]>>>5,K=e[9]<<27|e[8]>>>5,I=e[18]<<20|e[19]>>>12,C=e[19]<<20|e[18]>>>12,se=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,z=e[38]<<8|e[39]>>>24,$=e[39]<<8|e[38]>>>24,x=e[48]<<14|e[49]>>>18,k=e[49]<<14|e[48]>>>18,e[0]=p^~y&w,e[1]=m^~b&v,e[10]=T^~I&B,e[11]=S^~C&N,e[20]=O^~D&F,e[21]=L^~U&H,e[30]=q^~V&Y,e[31]=K^~W&J,e[40]=te^~ne&se,e[41]=re^~ie&oe,e[2]=y^~w&A,e[3]=b^~v&E,e[12]=I^~B&_,e[13]=C^~N&M,e[22]=D^~F&z,e[23]=U^~H&$,e[32]=V^~Y&Q,e[33]=W^~J&X,e[42]=ne^~se&ae,e[43]=ie^~oe&ce,e[4]=w^~A&x,e[5]=v^~E&k,e[14]=B^~_&R,e[15]=N^~M&P,e[24]=F^~z&G,e[25]=H^~$&j,e[34]=Y^~Q&Z,e[35]=J^~X&ee,e[44]=se^~ae&ue,e[45]=oe^~ce&le,e[6]=A^~x&p,e[7]=E^~k&m,e[16]=_^~R&T,e[17]=M^~P&S,e[26]=z^~G&O,e[27]=$^~j&L,e[36]=Q^~Z&q,e[37]=X^~ee&K,e[46]=ae^~ue&te,e[47]=ce^~le&re,e[8]=x^~p&y,e[9]=k^~m&b,e[18]=R^~T&I,e[19]=P^~S&C,e[28]=G^~O&D,e[29]=j^~L&U,e[38]=Z^~q&V,e[39]=ee^~K&W,e[48]=ue^~te&ne,e[49]=le^~re&ie,e[0]^=g[n],e[1]^=g[n+1]};if(u)e.exports=I;else{for(B=0;B<C.length;++B)a[C[B]]=I[C[B]];l&&(void 0===(n=function(){return I}.call(t,r,t,e))||(e.exports=n))}}()},7784(e){function t(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},9907(e){var t,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var a,c=[],u=!1,l=-1;function h(){u&&a&&(u=!1,a.length?c=a.concat(c):l=-1,c.length&&d())}function d(){if(!u){var e=o(h);u=!0;for(var t=c.length;t;){for(a=c,c=[];++l<t;)a&&a[l].run();l=-1,t=c.length}a=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function p(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new f(e,t)),1!==c.length||u||o(d)},f.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},3432(e){"use strict";!function(){const t=2147483647;function r(e){const t=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]);let r=1779033703,n=3144134277,i=1013904242,s=2773480762,o=1359893119,a=2600822924,c=528734635,u=1541459225;const l=new Uint32Array(64);function h(e){let h=0,d=e.length;for(;d>=64;){let f,p,g,m,y,b=r,w=n,v=i,A=s,E=o,x=a,k=c,T=u;for(p=0;p<16;p++)g=h+4*p,l[p]=(255&e[g])<<24|(255&e[g+1])<<16|(255&e[g+2])<<8|255&e[g+3];for(p=16;p<64;p++)f=l[p-2],m=(f>>>17|f<<15)^(f>>>19|f<<13)^f>>>10,f=l[p-15],y=(f>>>7|f<<25)^(f>>>18|f<<14)^f>>>3,l[p]=(m+l[p-7]|0)+(y+l[p-16]|0)|0;for(p=0;p<64;p++)m=(((E>>>6|E<<26)^(E>>>11|E<<21)^(E>>>25|E<<7))+(E&x^~E&k)|0)+(T+(t[p]+l[p]|0)|0)|0,y=((b>>>2|b<<30)^(b>>>13|b<<19)^(b>>>22|b<<10))+(b&w^b&v^w&v)|0,T=k,k=x,x=E,E=A+m|0,A=v,v=w,w=b,b=m+y|0;r=r+b|0,n=n+w|0,i=i+v|0,s=s+A|0,o=o+E|0,a=a+x|0,c=c+k|0,u=u+T|0,h+=64,d-=64}}h(e);let d,f=e.length%64,p=e.length/536870912|0,g=e.length<<3,m=f<56?56:120,y=e.slice(e.length-f,e.length);for(y.push(128),d=f+1;d<m;d++)y.push(0);return y.push(p>>>24&255),y.push(p>>>16&255),y.push(p>>>8&255),y.push(p>>>0&255),y.push(g>>>24&255),y.push(g>>>16&255),y.push(g>>>8&255),y.push(g>>>0&255),h(y),[r>>>24&255,r>>>16&255,r>>>8&255,r>>>0&255,n>>>24&255,n>>>16&255,n>>>8&255,n>>>0&255,i>>>24&255,i>>>16&255,i>>>8&255,i>>>0&255,s>>>24&255,s>>>16&255,s>>>8&255,s>>>0&255,o>>>24&255,o>>>16&255,o>>>8&255,o>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,c>>>24&255,c>>>16&255,c>>>8&255,c>>>0&255,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255]}function n(e,t,n){e=e.length<=64?e:r(e);const i=64+t.length+4,s=new Array(i),o=new Array(64);let a,c=[];for(a=0;a<64;a++)s[a]=54;for(a=0;a<e.length;a++)s[a]^=e[a];for(a=0;a<t.length;a++)s[64+a]=t[a];for(a=i-4;a<i;a++)s[a]=0;for(a=0;a<64;a++)o[a]=92;for(a=0;a<e.length;a++)o[a]^=e[a];function u(){for(let e=i-1;e>=i-4;e--){if(s[e]++,s[e]<=255)return;s[e]=0}}for(;n>=32;)u(),c=c.concat(r(o.concat(r(s)))),n-=32;return n>0&&(u(),c=c.concat(r(o.concat(r(s))).slice(0,n))),c}function i(e,t,r,n,i){let s;for(c(e,16*(2*r-1),i,0,16),s=0;s<2*r;s++)a(e,16*s,i,16),o(i,n),c(i,0,e,t+16*s,16);for(s=0;s<r;s++)c(e,t+2*s*16,e,16*s,16);for(s=0;s<r;s++)c(e,t+16*(2*s+1),e,16*(s+r),16)}function s(e,t){return e<<t|e>>>32-t}function o(e,t){c(e,0,t,0,16);for(let e=8;e>0;e-=2)t[4]^=s(t[0]+t[12],7),t[8]^=s(t[4]+t[0],9),t[12]^=s(t[8]+t[4],13),t[0]^=s(t[12]+t[8],18),t[9]^=s(t[5]+t[1],7),t[13]^=s(t[9]+t[5],9),t[1]^=s(t[13]+t[9],13),t[5]^=s(t[1]+t[13],18),t[14]^=s(t[10]+t[6],7),t[2]^=s(t[14]+t[10],9),t[6]^=s(t[2]+t[14],13),t[10]^=s(t[6]+t[2],18),t[3]^=s(t[15]+t[11],7),t[7]^=s(t[3]+t[15],9),t[11]^=s(t[7]+t[3],13),t[15]^=s(t[11]+t[7],18),t[1]^=s(t[0]+t[3],7),t[2]^=s(t[1]+t[0],9),t[3]^=s(t[2]+t[1],13),t[0]^=s(t[3]+t[2],18),t[6]^=s(t[5]+t[4],7),t[7]^=s(t[6]+t[5],9),t[4]^=s(t[7]+t[6],13),t[5]^=s(t[4]+t[7],18),t[11]^=s(t[10]+t[9],7),t[8]^=s(t[11]+t[10],9),t[9]^=s(t[8]+t[11],13),t[10]^=s(t[9]+t[8],18),t[12]^=s(t[15]+t[14],7),t[13]^=s(t[12]+t[15],9),t[14]^=s(t[13]+t[12],13),t[15]^=s(t[14]+t[13],18);for(let r=0;r<16;++r)e[r]+=t[r]}function a(e,t,r,n){for(let i=0;i<n;i++)r[i]^=e[t+i]}function c(e,t,r,n,i){for(;i--;)r[n++]=e[t++]}function u(e){if(!e||"number"!=typeof e.length)return!1;for(let t=0;t<e.length;t++){const r=e[t];if("number"!=typeof r||r%1||r<0||r>=256)return!1}return!0}function l(e,t){if("number"!=typeof e||e%1)throw new Error("invalid "+t);return e}function h(e,r,s,o,h,d,f){if(s=l(s,"N"),o=l(o,"r"),h=l(h,"p"),d=l(d,"dkLen"),0===s||s&s-1)throw new Error("N must be power of 2");if(s>t/128/o)throw new Error("N too large");if(o>t/128/h)throw new Error("r too large");if(!u(e))throw new Error("password must be an array or buffer");if(e=Array.prototype.slice.call(e),!u(r))throw new Error("salt must be an array or buffer");r=Array.prototype.slice.call(r);let p=n(e,r,128*h*o);const g=new Uint32Array(32*h*o);for(let e=0;e<g.length;e++){const t=4*e;g[e]=(255&p[t+3])<<24|(255&p[t+2])<<16|(255&p[t+1])<<8|255&p[t+0]}const m=new Uint32Array(64*o),y=new Uint32Array(32*o*s),b=32*o,w=new Uint32Array(16),v=new Uint32Array(16),A=h*s*2;let E,x,k=0,T=null,S=!1,I=0,C=0;const B=f?parseInt(1e3/o):4294967295,N="undefined"!=typeof setImmediate?setImmediate:setTimeout,_=function(){if(S)return f(new Error("cancelled"),k/A);let t;switch(I){case 0:x=32*C*o,c(g,x,m,0,b),I=1,E=0;case 1:t=s-E,t>B&&(t=B);for(let e=0;e<t;e++)c(m,0,y,(E+e)*b,b),i(m,b,o,w,v);if(E+=t,k+=t,f){const e=parseInt(1e3*k/A);if(e!==T){if(S=f(null,k/A),S)break;T=e}}if(E<s)break;E=0,I=2;case 2:t=s-E,t>B&&(t=B);for(let e=0;e<t;e++){const e=m[16*(2*o-1)]&s-1;a(y,e*b,m,b),i(m,b,o,w,v)}if(E+=t,k+=t,f){const e=parseInt(1e3*k/A);if(e!==T){if(S=f(null,k/A),S)break;T=e}}if(E<s)break;if(c(m,0,g,x,b),C++,C<h){I=0;break}p=[];for(let e=0;e<g.length;e++)p.push(255&g[e]),p.push(g[e]>>8&255),p.push(g[e]>>16&255),p.push(g[e]>>24&255);const r=n(e,p,d);return f&&f(null,1,r),r}f&&N(_)};if(!f)for(;;){const e=_();if(null!=e)return e}_()}const d={scrypt:function(e,t,r,n,i,s,o){return new Promise(function(a,c){let u=0;o&&o(0),h(e,t,r,n,i,s,function(e,t,r){if(e)c(e);else if(r)o&&1!==u&&o(1),a(new Uint8Array(r));else if(o&&t!==u)return u=t,o(t)})})},syncScrypt:function(e,t,r,n,i,s){return new Uint8Array(h(e,t,r,n,i,s))}};e.exports=d}()},3880(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SiweMessage=void 0;const n=r(2311),i=r(8708),s=r(1846),o=r(1386);t.SiweMessage=class{constructor(e){if("string"==typeof e){const t=new n.ParsedMessage(e);this.scheme=t.scheme,this.domain=t.domain,this.address=t.address,this.statement=t.statement,this.uri=t.uri,this.version=t.version,this.nonce=t.nonce,this.issuedAt=t.issuedAt,this.expirationTime=t.expirationTime,this.notBefore=t.notBefore,this.requestId=t.requestId,this.chainId=t.chainId,this.resources=t.resources}else this.scheme=null==e?void 0:e.scheme,this.domain=e.domain,this.address=e.address,this.statement=null==e?void 0:e.statement,this.uri=e.uri,this.version=e.version,this.chainId=e.chainId,this.nonce=e.nonce,this.issuedAt=null==e?void 0:e.issuedAt,this.expirationTime=null==e?void 0:e.expirationTime,this.notBefore=null==e?void 0:e.notBefore,this.requestId=null==e?void 0:e.requestId,this.resources=null==e?void 0:e.resources,"string"==typeof this.chainId&&(this.chainId=(0,n.parseIntegerNumber)(this.chainId)),this.nonce=this.nonce||(0,o.generateNonce)(),new n.ParsedMessage(this.prepareMessage())}toMessage(){const e=`${this.scheme?`${this.scheme}://${this.domain}`:this.domain} wants you to sign in with your Ethereum account:`,t=`URI: ${this.uri}`;let r=[e,this.address].join("\n");const n=`Version: ${this.version}`;this.nonce||(this.nonce=(0,o.generateNonce)());const i=[t,n,"Chain ID: "+this.chainId||0,`Nonce: ${this.nonce}`];if(this.issuedAt=this.issuedAt||(new Date).toISOString(),i.push(`Issued At: ${this.issuedAt}`),this.expirationTime){const e=`Expiration Time: ${this.expirationTime}`;i.push(e)}this.notBefore&&i.push(`Not Before: ${this.notBefore}`),this.requestId&&i.push(`Request ID: ${this.requestId}`),this.resources&&i.push(["Resources:",...this.resources.map(e=>`- ${e}`)].join("\n"));const s=i.join("\n");return r=[r,this.statement].join("\n\n"),void 0!==this.statement&&(r+="\n"),[r,s].join("\n")}prepareMessage(){let e;return this.version,e=this.toMessage(),e}async verify(e,t={suppressExceptions:!1}){return new Promise((r,n)=>{var a,c,u;const l=e=>t.suppressExceptions?r(e):n(e),h=(0,o.checkInvalidKeys)(e,s.VerifyParamsKeys);h.length>0&&l({success:!1,data:this,error:new Error(`${h.join(", ")} is/are not valid key(s) for VerifyParams.`)});const d=(0,o.checkInvalidKeys)(t,s.VerifyOptsKeys);d.length>0&&l({success:!1,data:this,error:new Error(`${d.join(", ")} is/are not valid key(s) for VerifyOpts.`)});const{signature:f,scheme:p,domain:g,nonce:m,time:y}=e;p&&p!==this.scheme&&l({success:!1,data:this,error:new s.SiweError(s.SiweErrorType.SCHEME_MISMATCH,p,this.scheme)}),g&&g!==this.domain&&l({success:!1,data:this,error:new s.SiweError(s.SiweErrorType.DOMAIN_MISMATCH,g,this.domain)}),m&&m!==this.nonce&&l({success:!1,data:this,error:new s.SiweError(s.SiweErrorType.NONCE_MISMATCH,m,this.nonce)});const b=new Date(y||new Date);if(this.expirationTime){const e=new Date(this.expirationTime);b.getTime()>=e.getTime()&&l({success:!1,data:this,error:new s.SiweError(s.SiweErrorType.EXPIRED_MESSAGE,`${b.toISOString()} < ${e.toISOString()}`,`${b.toISOString()} >= ${e.toISOString()}`)})}if(this.notBefore){const e=new Date(this.notBefore);b.getTime()<e.getTime()&&l({success:!1,data:this,error:new s.SiweError(s.SiweErrorType.NOT_YET_VALID_MESSAGE,`${b.toISOString()} >= ${e.toISOString()}`,`${b.toISOString()} < ${e.toISOString()}`)})}let w,v;try{w=this.prepareMessage()}catch(e){l({success:!1,data:this,error:e})}try{v=(0,i.verifyMessage)(w,f)}catch(e){console.error(e)}if(v===this.address)return r({success:!0,data:this});{const n=(0,o.checkContractWalletSignature)(this,f,t.provider).then(e=>e?{success:!0,data:this}:{success:!1,data:this,error:new s.SiweError(s.SiweErrorType.INVALID_SIGNATURE,v,`Resolved address to be ${this.address}`)}).catch(e=>({success:!1,data:this,error:e}));Promise.all([n,null===(u=null===(c=null===(a=null==t?void 0:t.verificationFallback)||void 0===a?void 0:a.call(t,e,t,this,n))||void 0===c?void 0:c.then(e=>e))||void 0===u?void 0:u.catch(e=>e)]).then(([e,t])=>{if(t){if(t.success)return r(t);l(t)}else{if(e.success)return r(e);l(e)}})}})}}},8708(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getAddress=t.hashMessage=t.verifyMessage=void 0;const n=r(8367);let i=null,s=null,o=null;try{i=n.ethers.utils.verifyMessage,s=n.ethers.utils.hashMessage,o=n.ethers.utils.getAddress}catch(e){i=n.ethers.verifyMessage,s=n.ethers.hashMessage,o=n.ethers.getAddress}t.verifyMessage=i,t.hashMessage=s,t.getAddress=o},427(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(3880),t),i(r(1846),t),i(r(1386),t)},1846(e,t){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.SiweErrorType=t.SiweError=t.VerifyOptsKeys=t.VerifyParamsKeys=void 0,t.VerifyParamsKeys=["signature","scheme","domain","nonce","time"],t.VerifyOptsKeys=["provider","suppressExceptions","verificationFallback"],t.SiweError=class{constructor(e,t,r){this.type=e,this.expected=t,this.received=r}},(r=t.SiweErrorType||(t.SiweErrorType={})).EXPIRED_MESSAGE="Expired message.",r.INVALID_DOMAIN="Invalid domain.",r.SCHEME_MISMATCH="Scheme does not match provided scheme for verification.",r.DOMAIN_MISMATCH="Domain does not match provided domain for verification.",r.NONCE_MISMATCH="Nonce does not match provided nonce for verification.",r.INVALID_ADDRESS="Invalid address.",r.INVALID_URI="URI does not conform to RFC 3986.",r.INVALID_NONCE="Nonce size smaller then 8 characters or is not alphanumeric.",r.NOT_YET_VALID_MESSAGE="Message is not valid yet.",r.INVALID_SIGNATURE="Signature does not match address of the message.",r.INVALID_TIME_FORMAT="Invalid time format.",r.INVALID_MESSAGE_VERSION="Invalid message version.",r.UNABLE_TO_PARSE="Unable to parse the message."},1386(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.checkInvalidKeys=t.isValidISO8601Date=t.generateNonce=t.checkContractWalletSignature=void 0;const n=r(7687),i=r(8367),s=r(8708),o=["function isValidSignature(bytes32 _message, bytes _signature) public view returns (bytes4)"],a=/^(?<date>[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]))[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(.[0-9]+)?(([Zz])|([+|-]([01][0-9]|2[0-3]):[0-5][0-9]))$/;t.checkContractWalletSignature=async(e,t,r)=>{if(!r)return!1;const n=new i.Contract(e.address,o,r),a=(0,s.hashMessage)(e.prepareMessage());return"0x1626ba7e"===await n.isValidSignature(a,t)},t.generateNonce=()=>{const e=(0,n.randomStringForEntropy)(96);if(!e||e.length<8)throw new Error("Error during nonce creation.");return e},t.isValidISO8601Date=e=>{const t=a.exec(e);if(!t)return!1;const r=new Date(t.groups.date).toISOString(),n=a.exec(r);return t.groups.date===n.groups.date},t.checkInvalidKeys=(e,t)=>{const r=[];return Object.keys(e).forEach(e=>{t.includes(e)||r.push(e)}),r}},5423(){},8379(){},7816(e,t,r){"use strict";r.d(t,{Az:()=>u,DM:()=>c,TQ:()=>s,ol:()=>o,r9:()=>i,tT:()=>l,yc:()=>a});var n=r(7997);function i(e,t,r){return e&t^~e&r}function s(e,t,r){return e&t^e&r^t&r}class o extends n.Hash{constructor(e,t,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(e),this.view=(0,n.createView)(this.buffer)}update(e){(0,n.aexists)(this),e=(0,n.toBytes)(e),(0,n.abytes)(e);const{view:t,buffer:r,blockLen:i}=this,s=e.length;for(let o=0;o<s;){const a=Math.min(i-this.pos,s-o);if(a===i){const t=(0,n.createView)(e);for(;i<=s-o;o+=i)this.process(t,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,n.aexists)(this),(0,n.aoutput)(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;t[o++]=128,(0,n.clean)(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(r,0),o=0);for(let e=o;e<i;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),c=n?4:0,u=n?0:4;e.setUint32(t+c,o,n),e.setUint32(t+u,a,n)}(r,i-8,BigInt(8*this.length),s),this.process(r,0);const a=(0,n.createView)(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<u;e++)a.setUint32(4*e,l[e],s)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:i,destroyed:s,pos:o}=this;return e.destroyed=s,e.finished=i,e.length=n,e.pos=o,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}const a=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),c=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),u=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),l=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209])},9964(e,t,r){"use strict";r.d(t,{B4:()=>m,CQ:()=>x,CW:()=>E,Ei:()=>d,F6:()=>s,F8:()=>k,P5:()=>g,R$:()=>f,R5:()=>p,TH:()=>T,Vl:()=>v,Vr:()=>A,WM:()=>y,WQ:()=>w,im:()=>b,jm:()=>c,lD:()=>o,qh:()=>h,rE:()=>u,ry:()=>l,xn:()=>a});const n=BigInt(2**32-1),i=BigInt(32);function s(e,t=!1){return t?{h:Number(e&n),l:Number(e>>i&n)}:{h:0|Number(e>>i&n),l:0|Number(e&n)}}function o(e,t=!1){const r=e.length;let n=new Uint32Array(r),i=new Uint32Array(r);for(let o=0;o<r;o++){const{h:r,l:a}=s(e[o],t);[n[o],i[o]]=[r,a]}return[n,i]}const a=(e,t,r)=>e>>>r,c=(e,t,r)=>e<<32-r|t>>>r,u=(e,t,r)=>e>>>r|t<<32-r,l=(e,t,r)=>e<<32-r|t>>>r,h=(e,t,r)=>e<<64-r|t>>>r-32,d=(e,t,r)=>e>>>r-32|t<<64-r,f=(e,t)=>t,p=(e,t)=>e,g=(e,t,r)=>e<<r|t>>>32-r,m=(e,t,r)=>t<<r|e>>>32-r,y=(e,t,r)=>t<<r-32|e>>>64-r,b=(e,t,r)=>e<<r-32|t>>>64-r;function w(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:0|i}}const v=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),A=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,E=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),x=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,k=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),T=(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0},6210(e,t,r){"use strict";r.d(t,{Zf:()=>m,sc:()=>g});var n=r(7816),i=r(9964),s=r(7997);const o=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]),a=new Uint32Array(64);class c extends n.ol{constructor(e=32){super(64,e,8,!1),this.A=0|n.yc[0],this.B=0|n.yc[1],this.C=0|n.yc[2],this.D=0|n.yc[3],this.E=0|n.yc[4],this.F=0|n.yc[5],this.G=0|n.yc[6],this.H=0|n.yc[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:s,G:o,H:a}=this;return[e,t,r,n,i,s,o,a]}set(e,t,r,n,i,s,o,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)a[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=a[e-15],r=a[e-2],n=(0,s.rotr)(t,7)^(0,s.rotr)(t,18)^t>>>3,i=(0,s.rotr)(r,17)^(0,s.rotr)(r,19)^r>>>10;a[e]=i+a[e-7]+n+a[e-16]|0}let{A:r,B:i,C:c,D:u,E:l,F:h,G:d,H:f}=this;for(let e=0;e<64;e++){const t=f+((0,s.rotr)(l,6)^(0,s.rotr)(l,11)^(0,s.rotr)(l,25))+(0,n.r9)(l,h,d)+o[e]+a[e]|0,p=((0,s.rotr)(r,2)^(0,s.rotr)(r,13)^(0,s.rotr)(r,22))+(0,n.TQ)(r,i,c)|0;f=d,d=h,h=l,l=u+t|0,u=c,c=i,i=r,r=t+p|0}r=r+this.A|0,i=i+this.B|0,c=c+this.C|0,u=u+this.D|0,l=l+this.E|0,h=h+this.F|0,d=d+this.G|0,f=f+this.H|0,this.set(r,i,c,u,l,h,d,f)}roundClean(){(0,s.clean)(a)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,s.clean)(this.buffer)}}const u=(()=>i.lD(["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(e=>BigInt(e))))(),l=(()=>u[0])(),h=(()=>u[1])(),d=new Uint32Array(80),f=new Uint32Array(80);class p extends n.ol{constructor(e=64){super(128,e,16,!1),this.Ah=0|n.tT[0],this.Al=0|n.tT[1],this.Bh=0|n.tT[2],this.Bl=0|n.tT[3],this.Ch=0|n.tT[4],this.Cl=0|n.tT[5],this.Dh=0|n.tT[6],this.Dl=0|n.tT[7],this.Eh=0|n.tT[8],this.El=0|n.tT[9],this.Fh=0|n.tT[10],this.Fl=0|n.tT[11],this.Gh=0|n.tT[12],this.Gl=0|n.tT[13],this.Hh=0|n.tT[14],this.Hl=0|n.tT[15]}get(){const{Ah:e,Al:t,Bh:r,Bl:n,Ch:i,Cl:s,Dh:o,Dl:a,Eh:c,El:u,Fh:l,Fl:h,Gh:d,Gl:f,Hh:p,Hl:g}=this;return[e,t,r,n,i,s,o,a,c,u,l,h,d,f,p,g]}set(e,t,r,n,i,s,o,a,c,u,l,h,d,f,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|s,this.Dh=0|o,this.Dl=0|a,this.Eh=0|c,this.El=0|u,this.Fh=0|l,this.Fl=0|h,this.Gh=0|d,this.Gl=0|f,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let r=0;r<16;r++,t+=4)d[r]=e.getUint32(t),f[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|d[e-15],r=0|f[e-15],n=i.rE(t,r,1)^i.rE(t,r,8)^i.xn(t,r,7),s=i.ry(t,r,1)^i.ry(t,r,8)^i.jm(t,r,7),o=0|d[e-2],a=0|f[e-2],c=i.rE(o,a,19)^i.qh(o,a,61)^i.xn(o,a,6),u=i.ry(o,a,19)^i.Ei(o,a,61)^i.jm(o,a,6),l=i.CW(s,u,f[e-7],f[e-16]),h=i.CQ(l,n,c,d[e-7],d[e-16]);d[e]=0|h,f[e]=0|l}let{Ah:r,Al:n,Bh:s,Bl:o,Ch:a,Cl:c,Dh:u,Dl:p,Eh:g,El:m,Fh:y,Fl:b,Gh:w,Gl:v,Hh:A,Hl:E}=this;for(let e=0;e<80;e++){const t=i.rE(g,m,14)^i.rE(g,m,18)^i.qh(g,m,41),x=i.ry(g,m,14)^i.ry(g,m,18)^i.Ei(g,m,41),k=g&y^~g&w,T=m&b^~m&v,S=i.F8(E,x,T,h[e],f[e]),I=i.TH(S,A,t,k,l[e],d[e]),C=0|S,B=i.rE(r,n,28)^i.qh(r,n,34)^i.qh(r,n,39),N=i.ry(r,n,28)^i.Ei(r,n,34)^i.Ei(r,n,39),_=r&s^r&a^s&a,M=n&o^n&c^o&c;A=0|w,E=0|v,w=0|y,v=0|b,y=0|g,b=0|m,({h:g,l:m}=i.WQ(0|u,0|p,0|I,0|C)),u=0|a,p=0|c,a=0|s,c=0|o,s=0|r,o=0|n;const R=i.Vl(C,N,M);r=i.Vr(R,I,B,_),n=0|R}({h:r,l:n}=i.WQ(0|this.Ah,0|this.Al,0|r,0|n)),({h:s,l:o}=i.WQ(0|this.Bh,0|this.Bl,0|s,0|o)),({h:a,l:c}=i.WQ(0|this.Ch,0|this.Cl,0|a,0|c)),({h:u,l:p}=i.WQ(0|this.Dh,0|this.Dl,0|u,0|p)),({h:g,l:m}=i.WQ(0|this.Eh,0|this.El,0|g,0|m)),({h:y,l:b}=i.WQ(0|this.Fh,0|this.Fl,0|y,0|b)),({h:w,l:v}=i.WQ(0|this.Gh,0|this.Gl,0|w,0|v)),({h:A,l:E}=i.WQ(0|this.Hh,0|this.Hl,0|A,0|E)),this.set(r,n,s,o,a,c,u,p,g,m,y,b,w,v,A,E)}roundClean(){(0,s.clean)(d,f)}destroy(){(0,s.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const g=(0,s.createHasher)(()=>new c),m=(0,s.createHasher)(()=>new p)},113(e,t,r){"use strict";r.r(t),r.d(t,{Keccak:()=>v,keccakP:()=>w,keccak_224:()=>S,keccak_256:()=>I,keccak_384:()=>C,keccak_512:()=>B,sha3_224:()=>E,sha3_256:()=>x,sha3_384:()=>k,sha3_512:()=>T,shake128:()=>_,shake256:()=>M});var n=r(9964),i=r(7997);const s=BigInt(0),o=BigInt(1),a=BigInt(2),c=BigInt(7),u=BigInt(256),l=BigInt(113),h=[],d=[],f=[];for(let e=0,t=o,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],h.push(2*(5*n+r)),d.push((e+1)*(e+2)/2%64);let i=s;for(let e=0;e<7;e++)t=(t<<o^(t>>c)*l)%u,t&a&&(i^=o<<(o<<BigInt(e))-o);f.push(i)}const p=(0,n.lD)(f,!0),g=p[0],m=p[1],y=(e,t,r)=>r>32?(0,n.WM)(e,t,r):(0,n.P5)(e,t,r),b=(e,t,r)=>r>32?(0,n.im)(e,t,r):(0,n.B4)(e,t,r);function w(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,i=(t+2)%10,s=r[i],o=r[i+1],a=y(s,o,1)^r[n],c=b(s,o,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=c}let t=e[2],i=e[3];for(let r=0;r<24;r++){const n=d[r],s=y(t,i,n),o=b(t,i,n),a=h[r];t=e[a],i=e[a+1],e[a]=s,e[a+1]=o}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=g[n],e[1]^=m[n]}(0,i.clean)(r)}class v extends i.Hash{constructor(e,t,r,n=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=s,(0,i.anumber)(r),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=(0,i.u32)(this.state)}clone(){return this._cloneInto()}keccak(){(0,i.swap32IfBE)(this.state32),w(this.state32,this.rounds),(0,i.swap32IfBE)(this.state32),this.posOut=0,this.pos=0}update(e){(0,i.aexists)(this),e=(0,i.toBytes)(e),(0,i.abytes)(e);const{blockLen:t,state:r}=this,n=e.length;for(let i=0;i<n;){const s=Math.min(t-this.pos,n-i);for(let t=0;t<s;t++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,128&t&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){(0,i.aexists)(this,!1),(0,i.abytes)(e),this.finish();const t=this.state,{blockLen:r}=this;for(let n=0,i=e.length;n<i;){this.posOut>=r&&this.keccak();const s=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+s),n),this.posOut+=s,n+=s}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,i.anumber)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,i.aoutput)(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,(0,i.clean)(this.state)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:s}=this;return e||(e=new v(t,r,n,s,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=s,e.destroyed=this.destroyed,e}}const A=(e,t,r)=>(0,i.createHasher)(()=>new v(t,e,r)),E=(()=>A(6,144,28))(),x=(()=>A(6,136,32))(),k=(()=>A(6,104,48))(),T=(()=>A(6,72,64))(),S=(()=>A(1,144,28))(),I=(()=>A(1,136,32))(),C=(()=>A(1,104,48))(),B=(()=>A(1,72,64))(),N=(e,t,r)=>(0,i.createXOFer)((n={})=>new v(t,e,void 0===n.dkLen?r:n.dkLen,!0)),_=(()=>N(31,168,16))(),M=(()=>N(31,136,32))()},7997(e,t,r){"use strict";r.r(t),r.d(t,{Hash:()=>O,abytes:()=>o,aexists:()=>c,ahash:()=>a,anumber:()=>s,aoutput:()=>u,asyncLoop:()=>C,byteSwap:()=>y,byteSwap32:()=>v,byteSwapIfBE:()=>w,bytesToHex:()=>k,bytesToUtf8:()=>N,checkOpts:()=>P,clean:()=>d,concatBytes:()=>R,createHasher:()=>L,createOptHasher:()=>D,createView:()=>f,createXOFer:()=>U,hexToBytes:()=>S,isBytes:()=>i,isLE:()=>m,kdfInputToBytes:()=>M,nextTick:()=>I,randomBytes:()=>$,rotl:()=>g,rotr:()=>p,swap32IfBE:()=>A,swap8IfBE:()=>b,toBytes:()=>_,u32:()=>h,u8:()=>l,utf8ToBytes:()=>B,wrapConstructor:()=>F,wrapConstructorWithOpts:()=>H,wrapXOFConstructorWithOpts:()=>z});var n=r(4402);function i(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function s(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function o(e,...t){if(!i(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function a(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.createHasher");s(e.outputLen),s(e.blockLen)}function c(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function u(e,t){o(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function l(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function h(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function d(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function f(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function p(e,t){return e<<32-t|e>>>t}function g(e,t){return e<<t|e>>>32-t>>>0}const m=(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])();function y(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const b=m?e=>e:e=>y(e),w=b;function v(e){for(let t=0;t<e.length;t++)e[t]=y(e[t]);return e}const A=m?e=>e:v,E=(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),x=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function k(e){if(o(e),E)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=x[e[r]];return t}function T(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:void 0}function S(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);if(E)return Uint8Array.fromHex(e);const t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;t<r;t++,i+=2){const r=T(e.charCodeAt(i)),s=T(e.charCodeAt(i+1));if(void 0===r||void 0===s){const t=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+i)}n[t]=16*r+s}return n}const I=async()=>{};async function C(e,t,r){let n=Date.now();for(let i=0;i<e;i++){r(i);const e=Date.now()-n;e>=0&&e<t||(await I(),n+=e)}}function B(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))}function N(e){return(new TextDecoder).decode(e)}function _(e){return"string"==typeof e&&(e=B(e)),o(e),e}function M(e){return"string"==typeof e&&(e=B(e)),o(e),e}function R(...e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];o(n),t+=n.length}const r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const i=e[t];r.set(i,n),n+=i.length}return r}function P(e,t){if(void 0!==t&&"[object Object]"!=={}.toString.call(t))throw new Error("options should be object or undefined");return Object.assign(e,t)}class O{}function L(e){const t=t=>e().update(_(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function D(e){const t=(t,r)=>e(r).update(_(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}function U(e){const t=(t,r)=>e(r).update(_(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}const F=L,H=D,z=U;function $(e=32){if(n.E&&"function"==typeof n.E.getRandomValues)return n.E.getRandomValues(new Uint8Array(e));if(n.E&&"function"==typeof n.E.randomBytes)return Uint8Array.from(n.E.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}},2072(e,t,r){"use strict";r.d(t,{secp256k1:()=>Ie});var n=r(6210),i=r(7997);class s extends i.Hash{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,(0,i.ahash)(e);const r=(0,i.toBytes)(t);if(this.iHash=e.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 n=this.blockLen,s=new Uint8Array(n);s.set(r.length>n?e.create().update(r).digest():r);for(let e=0;e<s.length;e++)s[e]^=54;this.iHash.update(s),this.oHash=e.create();for(let e=0;e<s.length;e++)s[e]^=106;this.oHash.update(s),(0,i.clean)(s)}update(e){return(0,i.aexists)(this),this.iHash.update(e),this}digestInto(e){(0,i.aexists)(this),(0,i.abytes)(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:n,destroyed:i,blockLen:s,outputLen:o}=this;return e.finished=n,e.destroyed=i,e.blockLen=s,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const o=(e,t,r)=>new s(e,t).update(r).digest();o.create=(e,t)=>new s(e,t);const a=BigInt(0),c=BigInt(1);function u(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function l(e){if(!u(e))throw new Error("Uint8Array expected")}function h(e,t){if("boolean"!=typeof t)throw new Error(e+" boolean expected, got "+t)}function d(e){const t=e.toString(16);return 1&t.length?"0"+t:t}function f(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return""===e?a:BigInt("0x"+e)}const p="function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex,g=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function m(e){if(l(e),p)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=g[e[r]];return t}function y(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:void 0}function b(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);if(p)return Uint8Array.fromHex(e);const t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;t<r;t++,i+=2){const r=y(e.charCodeAt(i)),s=y(e.charCodeAt(i+1));if(void 0===r||void 0===s){const t=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+i)}n[t]=16*r+s}return n}function w(e){return f(m(e))}function v(e){return l(e),f(m(Uint8Array.from(e).reverse()))}function A(e,t){return b(e.toString(16).padStart(2*t,"0"))}function E(e,t){return A(e,t).reverse()}function x(e,t,r){let n;if("string"==typeof t)try{n=b(t)}catch(t){throw new Error(e+" must be hex string or Uint8Array, cause: "+t)}else{if(!u(t))throw new Error(e+" must be hex string or Uint8Array");n=Uint8Array.from(t)}const i=n.length;if("number"==typeof r&&i!==r)throw new Error(e+" of length "+r+" expected, got "+i);return n}function k(...e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];l(n),t+=n.length}const r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const i=e[t];r.set(i,n),n+=i.length}return r}const T=e=>"bigint"==typeof e&&a<=e;function S(e,t,r){return T(e)&&T(t)&&T(r)&&t<=e&&e<r}function I(e,t,r,n){if(!S(t,r,n))throw new Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}const C=e=>(c<<BigInt(e))-c,B=e=>new Uint8Array(e),N=e=>Uint8Array.from(e),_={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||u(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function M(e,t,r={}){const n=(t,r,n)=>{const i=_[r];if("function"!=typeof i)throw new Error("invalid validator function");const s=e[t];if(!(n&&void 0===s||i(s,e)))throw new Error("param "+String(t)+" is invalid. Expected "+r+", got "+s)};for(const[e,r]of Object.entries(t))n(e,r,!1);for(const[e,t]of Object.entries(r))n(e,t,!0);return e}function R(e){const t=new WeakMap;return(r,...n)=>{const i=t.get(r);if(void 0!==i)return i;const s=e(r,...n);return t.set(r,s),s}}const P=BigInt(0),O=BigInt(1),L=BigInt(2),D=BigInt(3),U=BigInt(4),F=BigInt(5),H=BigInt(8);function z(e,t){const r=e%t;return r>=P?r:t+r}function $(e,t,r){let n=e;for(;t-- >P;)n*=n,n%=r;return n}function G(e,t){if(e===P)throw new Error("invert: expected non-zero number");if(t<=P)throw new Error("invert: expected positive modulus, got "+t);let r=z(e,t),n=t,i=P,s=O,o=O,a=P;for(;r!==P;){const e=n/r,t=n%r,c=i-o*e,u=s-a*e;n=r,r=t,i=o,s=a,o=c,a=u}if(n!==O)throw new Error("invert: does not exist");return z(i,t)}function j(e,t){const r=(e.ORDER+O)/U,n=e.pow(t,r);if(!e.eql(e.sqr(n),t))throw new Error("Cannot find square root");return n}function q(e,t){const r=(e.ORDER-F)/H,n=e.mul(t,L),i=e.pow(n,r),s=e.mul(t,i),o=e.mul(e.mul(s,L),i),a=e.mul(s,e.sub(o,e.ONE));if(!e.eql(e.sqr(a),t))throw new Error("Cannot find square root");return a}const K=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function V(e,t,r=!1){const n=new Array(t.length).fill(r?e.ZERO:void 0),i=t.reduce((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r)),e.ONE),s=e.inv(i);return t.reduceRight((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r)),s),n}function W(e,t){const r=(e.ORDER-O)/L,n=e.pow(t,r),i=e.eql(n,e.ONE),s=e.eql(n,e.ZERO),o=e.eql(n,e.neg(e.ONE));if(!i&&!s&&!o)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function Y(e,t){void 0!==t&&(0,i.anumber)(t);const r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function J(e,t,r=!1,n={}){if(e<=P)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:i,nByteLength:s}=Y(e,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:e,isLE:r,BITS:i,BYTES:s,MASK:C(i),ZERO:P,ONE:O,create:t=>z(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("invalid field element: expected bigint, got "+typeof t);return P<=t&&t<e},is0:e=>e===P,isOdd:e=>(e&O)===O,neg:t=>z(-t,e),eql:(e,t)=>e===t,sqr:t=>z(t*t,e),add:(t,r)=>z(t+r,e),sub:(t,r)=>z(t-r,e),mul:(t,r)=>z(t*r,e),pow:(e,t)=>function(e,t,r){if(r<P)throw new Error("invalid exponent, negatives unsupported");if(r===P)return e.ONE;if(r===O)return t;let n=e.ONE,i=t;for(;r>P;)r&O&&(n=e.mul(n,i)),i=e.sqr(i),r>>=O;return n}(a,e,t),div:(t,r)=>z(t*G(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>G(t,e),sqrt:n.sqrt||(t=>{return o||(o=(r=e)%U===D?j:r%H===F?q:function(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-O,r=0;for(;t%L===P;)t/=L,r++;let n=L;const i=J(e);for(;1===W(i,n);)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(1===r)return j;let s=i.pow(n,t);const o=(t+O)/L;return function(e,n){if(e.is0(n))return n;if(1!==W(e,n))throw new Error("Cannot find square root");let i=r,a=e.mul(e.ONE,s),c=e.pow(n,t),u=e.pow(n,o);for(;!e.eql(c,e.ONE);){if(e.is0(c))return e.ZERO;let t=1,r=e.sqr(c);for(;!e.eql(r,e.ONE);)if(t++,r=e.sqr(r),t===i)throw new Error("Cannot find square root");const n=O<<BigInt(i-t-1),s=e.pow(a,n);i=t,a=e.sqr(s),c=e.mul(c,a),u=e.mul(u,s)}return u}}(r)),o(a,t);var r}),toBytes:e=>r?E(e,s):A(e,s),fromBytes:e=>{if(e.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+e.length);return r?v(e):w(e)},invertBatch:e=>V(a,e),cmov:(e,t,r)=>r?t:e});return Object.freeze(a)}function Q(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function X(e){const t=Q(e);return t+Math.ceil(t/2)}const Z=BigInt(0),ee=BigInt(1);function te(e,t){const r=t.negate();return e?r:t}function re(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function ne(e,t){re(e,t);const r=2**e;return{windows:Math.ceil(t/e)+1,windowSize:2**(e-1),mask:C(e),maxNumber:r,shiftBy:BigInt(e)}}function ie(e,t,r){const{windowSize:n,mask:i,maxNumber:s,shiftBy:o}=r;let a=Number(e&i),c=e>>o;a>n&&(a-=s,c+=ee);const u=t*n;return{nextN:c,offset:u+Math.abs(a)-1,isZero:0===a,isNeg:a<0,isNegF:t%2!=0,offsetF:u}}const se=new WeakMap,oe=new WeakMap;function ae(e){return oe.get(e)||1}function ce(e,t,r,n){(function(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((e,r)=>{if(!(e instanceof t))throw new Error("invalid point at index "+r)})})(r,e),function(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((e,r)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+r)})}(n,t);const i=r.length,s=n.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");const o=e.ZERO,u=function(e){let t;for(t=0;e>a;e>>=c,t+=1);return t}(BigInt(i));let l=1;u>12?l=u-3:u>4?l=u-2:u>0&&(l=2);const h=C(l),d=new Array(Number(h)+1).fill(o);let f=o;for(let e=Math.floor((t.BITS-1)/l)*l;e>=0;e-=l){d.fill(o);for(let t=0;t<s;t++){const i=n[t],s=Number(i>>BigInt(e)&h);d[s]=d[s].add(r[t])}let t=o;for(let e=d.length-1,r=o;e>0;e--)r=r.add(d[e]),t=t.add(r);if(f=f.add(t),0!==e)for(let e=0;e<l;e++)f=f.double()}return f}function ue(e){return M(e.Fp,K.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),M(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Y(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}function le(e){void 0!==e.lowS&&h("lowS",e.lowS),void 0!==e.prehash&&h("prehash",e.prehash)}class he extends Error{constructor(e=""){super(e)}}const de={Err:he,_tlv:{encode:(e,t)=>{const{Err:r}=de;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(1&t.length)throw new r("tlv.encode: unpadded data");const n=t.length/2,i=d(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?d(i.length/2|128):"";return d(e)+s+i+t},decode(e,t){const{Err:r}=de;let n=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");const i=t[n++];let s=0;if(128&i){const e=127&i;if(!e)throw new r("tlv.decode(long): indefinite length not supported");if(e>4)throw new r("tlv.decode(long): byte length is too big");const o=t.subarray(n,n+e);if(o.length!==e)throw new r("tlv.decode: length bytes not complete");if(0===o[0])throw new r("tlv.decode(long): zero leftmost byte");for(const e of o)s=s<<8|e;if(n+=e,s<128)throw new r("tlv.decode(long): not minimal encoding")}else s=i;const o=t.subarray(n,n+s);if(o.length!==s)throw new r("tlv.decode: wrong value length");return{v:o,l:t.subarray(n+s)}}},_int:{encode(e){const{Err:t}=de;if(e<pe)throw new t("integer: negative integers are not allowed");let r=d(e);if(8&Number.parseInt(r[0],16)&&(r="00"+r),1&r.length)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){const{Err:t}=de;if(128&e[0])throw new t("invalid signature integer: negative");if(0===e[0]&&!(128&e[1]))throw new t("invalid signature integer: unnecessary leading zero");return w(e)}},toSig(e){const{Err:t,_int:r,_tlv:n}=de,i=x("signature",e),{v:s,l:o}=n.decode(48,i);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=n.decode(2,s),{v:u,l}=n.decode(2,c);if(l.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(u)}},hexFromSig(e){const{_tlv:t,_int:r}=de,n=t.encode(2,r.encode(e.r))+t.encode(2,r.encode(e.s));return t.encode(48,n)}};function fe(e,t){return m(A(e,t))}const pe=BigInt(0),ge=BigInt(1),me=(BigInt(2),BigInt(3)),ye=BigInt(4);function be(e){const t=function(e){const t=ue(e);return M(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:r,n,nByteLength:i,nBitLength:s}=t,o=r.BYTES+1,a=2*r.BYTES+1;function c(e){return z(e,n)}function l(e){return G(e,n)}const{ProjectivePoint:d,normPrivateKeyToScalar:f,weierstrassEquation:p,isWithinCurveOrder:g}=function(e){const t=function(e){const t=ue(e);M(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:r,Fp:n,a:i}=t;if(r){if(!n.eql(i,n.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}(e),{Fp:r}=t,n=J(t.n,t.nBitLength),i=t.toBytes||((e,t,n)=>{const i=t.toAffine();return k(Uint8Array.from([4]),r.toBytes(i.x),r.toBytes(i.y))}),s=t.fromBytes||(e=>{const t=e.subarray(1);return{x:r.fromBytes(t.subarray(0,r.BYTES)),y:r.fromBytes(t.subarray(r.BYTES,2*r.BYTES))}});function o(e){const{a:n,b:i}=t,s=r.sqr(e),o=r.mul(s,e);return r.add(r.add(o,r.mul(e,n)),i)}function a(e,t){const n=r.sqr(t),i=o(e);return r.eql(n,i)}if(!a(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const c=r.mul(r.pow(t.a,me),ye),l=r.mul(r.sqr(t.b),BigInt(27));if(r.is0(r.add(c,l)))throw new Error("bad curve params: a or b");function d(e){const{allowedPrivateKeyLengths:r,nByteLength:n,wrapPrivateKey:i,n:s}=t;if(r&&"bigint"!=typeof e){if(u(e)&&(e=m(e)),"string"!=typeof e||!r.includes(e.length))throw new Error("invalid private key");e=e.padStart(2*n,"0")}let o;try{o="bigint"==typeof e?e:w(x("private key",e,n))}catch(t){throw new Error("invalid private key, expected hex or "+n+" bytes, got "+typeof e)}return i&&(o=z(o,s)),I("private key",o,ge,s),o}function f(e){if(!(e instanceof y))throw new Error("ProjectivePoint expected")}const p=R((e,t)=>{const{px:n,py:i,pz:s}=e;if(r.eql(s,r.ONE))return{x:n,y:i};const o=e.is0();null==t&&(t=o?r.ONE:r.inv(s));const a=r.mul(n,t),c=r.mul(i,t),u=r.mul(s,t);if(o)return{x:r.ZERO,y:r.ZERO};if(!r.eql(u,r.ONE))throw new Error("invZ was invalid");return{x:a,y:c}}),g=R(e=>{if(e.is0()){if(t.allowInfinityPoint&&!r.is0(e.py))return;throw new Error("bad point: ZERO")}const{x:n,y:i}=e.toAffine();if(!r.isValid(n)||!r.isValid(i))throw new Error("bad point: x or y not FE");if(!a(n,i))throw new Error("bad point: equation left != right");if(!e.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class y{constructor(e,t,n){if(null==e||!r.isValid(e))throw new Error("x required");if(null==t||!r.isValid(t)||r.is0(t))throw new Error("y required");if(null==n||!r.isValid(n))throw new Error("z required");this.px=e,this.py=t,this.pz=n,Object.freeze(this)}static fromAffine(e){const{x:t,y:n}=e||{};if(!e||!r.isValid(t)||!r.isValid(n))throw new Error("invalid affine point");if(e instanceof y)throw new Error("projective point not allowed");const i=e=>r.eql(e,r.ZERO);return i(t)&&i(n)?y.ZERO:new y(t,n,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=V(r,e.map(e=>e.pz));return e.map((e,r)=>e.toAffine(t[r])).map(y.fromAffine)}static fromHex(e){const t=y.fromAffine(s(x("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return y.BASE.multiply(d(e))}static msm(e,t){return ce(y,n,e,t)}_setWindowSize(e){A.setWindowSize(this,e)}assertValidity(){g(this)}hasEvenY(){const{y:e}=this.toAffine();if(r.isOdd)return!r.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){f(e);const{px:t,py:n,pz:i}=this,{px:s,py:o,pz:a}=e,c=r.eql(r.mul(t,a),r.mul(s,i)),u=r.eql(r.mul(n,a),r.mul(o,i));return c&&u}negate(){return new y(this.px,r.neg(this.py),this.pz)}double(){const{a:e,b:n}=t,i=r.mul(n,me),{px:s,py:o,pz:a}=this;let c=r.ZERO,u=r.ZERO,l=r.ZERO,h=r.mul(s,s),d=r.mul(o,o),f=r.mul(a,a),p=r.mul(s,o);return p=r.add(p,p),l=r.mul(s,a),l=r.add(l,l),c=r.mul(e,l),u=r.mul(i,f),u=r.add(c,u),c=r.sub(d,u),u=r.add(d,u),u=r.mul(c,u),c=r.mul(p,c),l=r.mul(i,l),f=r.mul(e,f),p=r.sub(h,f),p=r.mul(e,p),p=r.add(p,l),l=r.add(h,h),h=r.add(l,h),h=r.add(h,f),h=r.mul(h,p),u=r.add(u,h),f=r.mul(o,a),f=r.add(f,f),h=r.mul(f,p),c=r.sub(c,h),l=r.mul(f,d),l=r.add(l,l),l=r.add(l,l),new y(c,u,l)}add(e){f(e);const{px:n,py:i,pz:s}=this,{px:o,py:a,pz:c}=e;let u=r.ZERO,l=r.ZERO,h=r.ZERO;const d=t.a,p=r.mul(t.b,me);let g=r.mul(n,o),m=r.mul(i,a),b=r.mul(s,c),w=r.add(n,i),v=r.add(o,a);w=r.mul(w,v),v=r.add(g,m),w=r.sub(w,v),v=r.add(n,s);let A=r.add(o,c);return v=r.mul(v,A),A=r.add(g,b),v=r.sub(v,A),A=r.add(i,s),u=r.add(a,c),A=r.mul(A,u),u=r.add(m,b),A=r.sub(A,u),h=r.mul(d,v),u=r.mul(p,b),h=r.add(u,h),u=r.sub(m,h),h=r.add(m,h),l=r.mul(u,h),m=r.add(g,g),m=r.add(m,g),b=r.mul(d,b),v=r.mul(p,v),m=r.add(m,b),b=r.sub(g,b),b=r.mul(d,b),v=r.add(v,b),g=r.mul(m,v),l=r.add(l,g),g=r.mul(A,v),u=r.mul(w,u),u=r.sub(u,g),g=r.mul(w,m),h=r.mul(A,h),h=r.add(h,g),new y(u,l,h)}subtract(e){return this.add(e.negate())}is0(){return this.equals(y.ZERO)}wNAF(e){return A.wNAFCached(this,e,y.normalizeZ)}multiplyUnsafe(e){const{endo:n,n:i}=t;I("scalar",e,pe,i);const s=y.ZERO;if(e===pe)return s;if(this.is0()||e===ge)return this;if(!n||A.hasPrecomputes(this))return A.wNAFCachedUnsafe(this,e,y.normalizeZ);let{k1neg:o,k1:a,k2neg:c,k2:u}=n.splitScalar(e),l=s,h=s,d=this;for(;a>pe||u>pe;)a&ge&&(l=l.add(d)),u&ge&&(h=h.add(d)),d=d.double(),a>>=ge,u>>=ge;return o&&(l=l.negate()),c&&(h=h.negate()),h=new y(r.mul(h.px,n.beta),h.py,h.pz),l.add(h)}multiply(e){const{endo:n,n:i}=t;let s,o;if(I("scalar",e,ge,i),n){const{k1neg:t,k1:i,k2neg:a,k2:c}=n.splitScalar(e);let{p:u,f:l}=this.wNAF(i),{p:h,f:d}=this.wNAF(c);u=A.constTimeNegate(t,u),h=A.constTimeNegate(a,h),h=new y(r.mul(h.px,n.beta),h.py,h.pz),s=u.add(h),o=l.add(d)}else{const{p:t,f:r}=this.wNAF(e);s=t,o=r}return y.normalizeZ([s,o])[0]}multiplyAndAddUnsafe(e,t,r){const n=y.BASE,i=(e,t)=>t!==pe&&t!==ge&&e.equals(n)?e.multiply(t):e.multiplyUnsafe(t),s=i(this,t).add(i(e,r));return s.is0()?void 0:s}toAffine(e){return p(this,e)}isTorsionFree(){const{h:e,isTorsionFree:r}=t;if(e===ge)return!0;if(r)return r(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:r}=t;return e===ge?this:r?r(y,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return h("isCompressed",e),this.assertValidity(),i(y,this,e)}toHex(e=!0){return h("isCompressed",e),m(this.toRawBytes(e))}}y.BASE=new y(t.Gx,t.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO);const{endo:b,nBitLength:v}=t,A=(E=y,T=b?Math.ceil(v/2):v,{constTimeNegate:te,hasPrecomputes:e=>1!==ae(e),unsafeLadder(e,t,r=E.ZERO){let n=e;for(;t>Z;)t&ee&&(r=r.add(n)),n=n.double(),t>>=ee;return r},precomputeWindow(e,t){const{windows:r,windowSize:n}=ne(t,T),i=[];let s=e,o=s;for(let e=0;e<r;e++){o=s,i.push(o);for(let e=1;e<n;e++)o=o.add(s),i.push(o);s=o.double()}return i},wNAF(e,t,r){let n=E.ZERO,i=E.BASE;const s=ne(e,T);for(let e=0;e<s.windows;e++){const{nextN:o,offset:a,isZero:c,isNeg:u,isNegF:l,offsetF:h}=ie(r,e,s);r=o,c?i=i.add(te(l,t[h])):n=n.add(te(u,t[a]))}return{p:n,f:i}},wNAFUnsafe(e,t,r,n=E.ZERO){const i=ne(e,T);for(let e=0;e<i.windows&&r!==Z;e++){const{nextN:s,offset:o,isZero:a,isNeg:c}=ie(r,e,i);if(r=s,!a){const e=t[o];n=n.add(c?e.negate():e)}}return n},getPrecomputes(e,t,r){let n=se.get(t);return n||(n=this.precomputeWindow(t,e),1!==e&&se.set(t,r(n))),n},wNAFCached(e,t,r){const n=ae(e);return this.wNAF(n,this.getPrecomputes(n,e,r),t)},wNAFCachedUnsafe(e,t,r,n){const i=ae(e);return 1===i?this.unsafeLadder(e,t,n):this.wNAFUnsafe(i,this.getPrecomputes(i,e,r),t,n)},setWindowSize(e,t){re(t,T),oe.set(e,t),se.delete(e)}});var E,T;return{CURVE:t,ProjectivePoint:y,normPrivateKeyToScalar:d,weierstrassEquation:o,isWithinCurveOrder:function(e){return S(e,ge,t.n)}}}({...t,toBytes(e,t,n){const i=t.toAffine(),s=r.toBytes(i.x),o=k;return h("isCompressed",n),n?o(Uint8Array.from([t.hasEvenY()?2:3]),s):o(Uint8Array.from([4]),s,r.toBytes(i.y))},fromBytes(e){const t=e.length,n=e[0],i=e.subarray(1);if(t!==o||2!==n&&3!==n){if(t===a&&4===n)return{x:r.fromBytes(i.subarray(0,r.BYTES)),y:r.fromBytes(i.subarray(r.BYTES,2*r.BYTES))};throw new Error("invalid Point, expected length of "+o+", or uncompressed "+a+", got "+t)}{const e=w(i);if(!S(e,ge,r.ORDER))throw new Error("Point is not on curve");const t=p(e);let s;try{s=r.sqrt(t)}catch(e){const t=e instanceof Error?": "+e.message:"";throw new Error("Point is not on curve"+t)}return!(1&~n)!=((s&ge)===ge)&&(s=r.neg(s)),{x:e,y:s}}}});function y(e){return e>n>>ge}const T=(e,t,r)=>w(e.slice(t,r));class _{constructor(e,t,r){I("r",e,ge,n),I("s",t,ge,n),this.r=e,this.s=t,null!=r&&(this.recovery=r),Object.freeze(this)}static fromCompact(e){const t=i;return e=x("compactSignature",e,2*t),new _(T(e,0,t),T(e,t,2*t))}static fromDER(e){const{r:t,s:r}=de.toSig(x("DER",e));return new _(t,r)}assertValidity(){}addRecoveryBit(e){return new _(this.r,this.s,e)}recoverPublicKey(e){const{r:n,s:i,recovery:s}=this,o=U(x("msgHash",e));if(null==s||![0,1,2,3].includes(s))throw new Error("recovery id invalid");const a=2===s||3===s?n+t.n:n;if(a>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const u=1&s?"03":"02",h=d.fromHex(u+fe(a,r.BYTES)),f=l(a),p=c(-o*f),g=c(i*f),m=d.BASE.multiplyAndAddUnsafe(h,p,g);if(!m)throw new Error("point at infinify");return m.assertValidity(),m}hasHighS(){return y(this.s)}normalizeS(){return this.hasHighS()?new _(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return b(this.toDERHex())}toDERHex(){return de.hexFromSig(this)}toCompactRawBytes(){return b(this.toCompactHex())}toCompactHex(){const e=i;return fe(this.r,e)+fe(this.s,e)}}const P={isValidPrivateKey(e){try{return f(e),!0}catch(e){return!1}},normPrivateKeyToScalar:f,randomPrivateKey:()=>{const e=X(t.n);return function(e,t,r=!1){const n=e.length,i=Q(t),s=X(t);if(n<16||n<s||n>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);const o=z(r?v(e):w(e),t-O)+O;return r?E(o,i):A(o,i)}(t.randomBytes(e),t.n)},precompute:(e=8,t=d.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function L(e){if("bigint"==typeof e)return!1;if(e instanceof d)return!0;const n=x("key",e).length,s=r.BYTES,o=s+1,a=2*s+1;return t.allowedPrivateKeyLengths||i===o?void 0:n===o||n===a}const D=t.bits2int||function(e){if(e.length>8192)throw new Error("input is too large");const t=w(e),r=8*e.length-s;return r>0?t>>BigInt(r):t},U=t.bits2int_modN||function(e){return c(D(e))},F=C(s);function H(e){return I("num < 2^"+s,e,pe,F),A(e,i)}const $={lowS:t.lowS,prehash:!1},j={lowS:t.lowS,prehash:!1};return d.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e,t=!0){return d.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,r=!0){if(!0===L(e))throw new Error("first arg must be private key");if(!1===L(t))throw new Error("second arg must be public key");return d.fromHex(t).multiply(f(e)).toRawBytes(r)},sign:function(e,n,i=$){const{seed:s,k2sig:o}=function(e,n,i=$){if(["recovered","canonical"].some(e=>e in i))throw new Error("sign() legacy options not supported");const{hash:s,randomBytes:o}=t;let{lowS:a,prehash:u,extraEntropy:h}=i;null==a&&(a=!0),e=x("msgHash",e),le(i),u&&(e=x("prehashed msgHash",s(e)));const p=U(e),m=f(n),b=[H(m),H(p)];if(null!=h&&!1!==h){const e=!0===h?o(r.BYTES):h;b.push(x("extraEntropy",e))}const w=k(...b),v=p;return{seed:w,k2sig:function(e){const t=D(e);if(!g(t))return;const r=l(t),n=d.BASE.multiply(t).toAffine(),i=c(n.x);if(i===pe)return;const s=c(r*c(v+i*m));if(s===pe)return;let o=(n.x===i?0:2)|Number(n.y&ge),u=s;return a&&y(s)&&(u=function(e){return y(e)?c(-e):e}(s),o^=1),new _(i,u,o)}}}(e,n,i),a=t;return function(e,t,r){if("number"!=typeof e||e<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 r)throw new Error("hmacFn must be a function");let n=B(e),i=B(e),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...e)=>r(i,n,...e),c=(e=B(0))=>{i=a(N([0]),e),n=a(),0!==e.length&&(i=a(N([1]),e),n=a())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const r=[];for(;e<t;){n=a();const t=n.slice();r.push(t),e+=n.length}return k(...r)};return(e,t)=>{let r;for(o(),c(e);!(r=t(u()));)c();return o(),r}}(a.hash.outputLen,a.nByteLength,a.hmac)(s,o)},verify:function(e,r,n,i=j){const s=e;r=x("msgHash",r),n=x("publicKey",n);const{lowS:o,prehash:a,format:h}=i;if(le(i),"strict"in i)throw new Error("options.strict was renamed to lowS");if(void 0!==h&&"compact"!==h&&"der"!==h)throw new Error("format must be compact or der");const f="string"==typeof s||u(s),p=!f&&!h&&"object"==typeof s&&null!==s&&"bigint"==typeof s.r&&"bigint"==typeof s.s;if(!f&&!p)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let g,m;try{if(p&&(g=new _(s.r,s.s)),f){try{"compact"!==h&&(g=_.fromDER(s))}catch(e){if(!(e instanceof de.Err))throw e}g||"der"===h||(g=_.fromCompact(s))}m=d.fromHex(n)}catch(e){return!1}if(!g)return!1;if(o&&g.hasHighS())return!1;a&&(r=t.hash(r));const{r:y,s:b}=g,w=U(r),v=l(b),A=c(w*v),E=c(y*v),k=d.BASE.multiplyAndAddUnsafe(m,A,E)?.toAffine();return!!k&&c(k.x)===y},ProjectivePoint:d,Signature:_,utils:P}}function we(e){return{hash:e,hmac:(t,...r)=>o(e,t,(0,i.concatBytes)(...r)),randomBytes:i.randomBytes}}const ve=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Ae=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Ee=BigInt(0),xe=BigInt(1),ke=BigInt(2),Te=(e,t)=>(e+t/ke)/t;const Se=J(ve,void 0,void 0,{sqrt:function(e){const t=ve,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),u=e*e*e%t,l=u*u*e%t,h=$(l,r,t)*l%t,d=$(h,r,t)*l%t,f=$(d,ke,t)*u%t,p=$(f,i,t)*f%t,g=$(p,s,t)*p%t,m=$(g,a,t)*g%t,y=$(m,c,t)*m%t,b=$(y,a,t)*g%t,w=$(b,r,t)*l%t,v=$(w,o,t)*p%t,A=$(v,n,t)*u%t,E=$(A,ke,t);if(!Se.eql(Se.sqr(E),e))throw new Error("Cannot find square root");return E}}),Ie=function(e,t){const r=t=>be({...e,...we(t)});return{...r(t),create:r}}({a:Ee,b:BigInt(7),Fp:Se,n:Ae,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=Ae,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-xe*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=Te(s*e,t),c=Te(-n*e,t);let u=z(e-a*r-c*i,t),l=z(-a*n-c*s,t);const h=u>o,d=l>o;if(h&&(u=t-u),d&&(l=t-l),u>o||l>o)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:h,k1:u,k2neg:d,k2:l}}}},n.sc)},4402(e,t,r){"use strict";r.d(t,{E:()=>i});const n=()=>"undefined"!=typeof globalThis&&globalThis.crypto?globalThis.crypto:"undefined"!=typeof window&&window.crypto?window.crypto:"undefined"!=typeof self&&self.crypto?self.crypto:void 0,i={web:n(),node:void 0,getRandomValues:function(e){const t=n();if(t&&t.getRandomValues)return t.getRandomValues(e);throw new Error("crypto.getRandomValues is unavailable")}}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(s.exports,s,s.exports,r),s.loaded=!0,s.exports}r.amdO={},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n={};(()=>{"use strict";r.r(n),r.d(n,{MAX_RENEWAL_HISTORY_STAMPS:()=>pi,OwnerRenewalOriginalExpiredError:()=>xi,RENEWAL_AUTHORITY_INACTIVE:()=>Si,RENEWAL_LEASE_EXPIRED:()=>Ti,RENEWAL_LEASE_ORIGINAL_EXPIRED:()=>Ei,RenewalAuthorityInactiveError:()=>Ci,RenewalLeaseExpiredError:()=>Ii,admitOwnerRenewalLease:()=>ki,assertRenewalNodeIdentity:()=>wi,verifyRenewalHistory:()=>Ai});var e=r(6210),t=r(7997);const i=BigInt(0),s=BigInt(1);function o(e,t=""){if("boolean"!=typeof e)throw new Error((t&&`"${t}"`)+"expected boolean, got type="+typeof e);return e}function a(e,r,n=""){const i=(0,t.isBytes)(e),s=e?.length,o=void 0!==r;if(!i||o&&s!==r)throw new Error((n&&`"${n}" `)+"expected Uint8Array"+(o?` of length ${r}`:"")+", got "+(i?`length=${s}`:"type="+typeof e));return e}function c(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return""===e?i:BigInt("0x"+e)}function u(e){return(0,t.abytes)(e),c((0,t.bytesToHex)(Uint8Array.from(e).reverse()))}function l(e,r){return(0,t.hexToBytes)(e.toString(16).padStart(2*r,"0"))}function h(e,r,n){let i;if("string"==typeof r)try{i=(0,t.hexToBytes)(r)}catch(t){throw new Error(e+" must be hex string or Uint8Array, cause: "+t)}else{if(!(0,t.isBytes)(r))throw new Error(e+" must be hex string or Uint8Array");i=Uint8Array.from(r)}const s=i.length;if("number"==typeof n&&s!==n)throw new Error(e+" of length "+n+" expected, got "+s);return i}function d(e){return Uint8Array.from(e)}const f=e=>"bigint"==typeof e&&i<=e;function p(e,t,r,n){if(!function(e,t,r){return f(e)&&f(t)&&f(r)&&t<=e&&e<r}(t,r,n))throw new Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}const g=e=>(s<<BigInt(e))-s;function m(e,t,r={}){if(!e||"object"!=typeof e)throw new Error("expected valid options object");function n(t,r,n){const i=e[t];if(n&&void 0===i)return;const s=typeof i;if(s!==r||null===i)throw new Error(`param "${t}" is invalid: expected ${r}, got ${s}`)}Object.entries(t).forEach(([e,t])=>n(e,t,!1)),Object.entries(r).forEach(([e,t])=>n(e,t,!0))}const y=()=>{throw new Error("not implemented")};function b(e){const t=new WeakMap;return(r,...n)=>{const i=t.get(r);if(void 0!==i)return i;const s=e(r,...n);return t.set(r,s),s}}const w=BigInt(0),v=BigInt(1),A=BigInt(2),E=BigInt(3),x=BigInt(4),k=BigInt(5),T=BigInt(7),S=BigInt(8),I=BigInt(9),C=BigInt(16);function B(e,t){const r=e%t;return r>=w?r:t+r}function N(e,t,r){let n=e;for(;t-- >w;)n*=n,n%=r;return n}function _(e,t){if(e===w)throw new Error("invert: expected non-zero number");if(t<=w)throw new Error("invert: expected positive modulus, got "+t);let r=B(e,t),n=t,i=w,s=v,o=v,a=w;for(;r!==w;){const e=n/r,t=n%r,c=i-o*e,u=s-a*e;n=r,r=t,i=o,s=a,o=c,a=u}if(n!==v)throw new Error("invert: does not exist");return B(i,t)}function M(e,t,r){if(!e.eql(e.sqr(t),r))throw new Error("Cannot find square root")}function R(e,t){const r=(e.ORDER+v)/x,n=e.pow(t,r);return M(e,n,t),n}function P(e,t){const r=(e.ORDER-k)/S,n=e.mul(t,A),i=e.pow(n,r),s=e.mul(t,i),o=e.mul(e.mul(s,A),i),a=e.mul(s,e.sub(o,e.ONE));return M(e,a,t),a}function O(e){if(e<E)throw new Error("sqrt is not defined for small field");let t=e-v,r=0;for(;t%A===w;)t/=A,r++;let n=A;const i=H(e);for(;1===F(i,n);)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(1===r)return R;let s=i.pow(n,t);const o=(t+v)/A;return function(e,n){if(e.is0(n))return n;if(1!==F(e,n))throw new Error("Cannot find square root");let i=r,a=e.mul(e.ONE,s),c=e.pow(n,t),u=e.pow(n,o);for(;!e.eql(c,e.ONE);){if(e.is0(c))return e.ZERO;let t=1,r=e.sqr(c);for(;!e.eql(r,e.ONE);)if(t++,r=e.sqr(r),t===i)throw new Error("Cannot find square root");const n=v<<BigInt(i-t-1),s=e.pow(a,n);i=t,a=e.sqr(s),c=e.mul(c,a),u=e.mul(u,s)}return u}}const L=(e,t)=>(B(e,t)&v)===v,D=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function U(e,t,r=!1){const n=new Array(t.length).fill(r?e.ZERO:void 0),i=t.reduce((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r)),e.ONE),s=e.inv(i);return t.reduceRight((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r)),s),n}function F(e,t){const r=(e.ORDER-v)/A,n=e.pow(t,r),i=e.eql(n,e.ONE),s=e.eql(n,e.ZERO),o=e.eql(n,e.neg(e.ONE));if(!i&&!s&&!o)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function H(e,r,n=!1,i={}){if(e<=w)throw new Error("invalid field: expected ORDER > 0, got "+e);let s,o,a,h=!1;if("object"==typeof r&&null!=r){if(i.sqrt||n)throw new Error("cannot specify opts in two arguments");const e=r;e.BITS&&(s=e.BITS),e.sqrt&&(o=e.sqrt),"boolean"==typeof e.isLE&&(n=e.isLE),"boolean"==typeof e.modFromBytes&&(h=e.modFromBytes),a=e.allowedLengths}else"number"==typeof r&&(s=r),i.sqrt&&(o=i.sqrt);const{nBitLength:d,nByteLength:f}=function(e,r){void 0!==r&&(0,t.anumber)(r);const n=void 0!==r?r:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}(e,s);if(f>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let p;const m=Object.freeze({ORDER:e,isLE:n,BITS:d,BYTES:f,MASK:g(d),ZERO:w,ONE:v,allowedLengths:a,create:t=>B(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("invalid field element: expected bigint, got "+typeof t);return w<=t&&t<e},is0:e=>e===w,isValidNot0:e=>!m.is0(e)&&m.isValid(e),isOdd:e=>(e&v)===v,neg:t=>B(-t,e),eql:(e,t)=>e===t,sqr:t=>B(t*t,e),add:(t,r)=>B(t+r,e),sub:(t,r)=>B(t-r,e),mul:(t,r)=>B(t*r,e),pow:(e,t)=>function(e,t,r){if(r<w)throw new Error("invalid exponent, negatives unsupported");if(r===w)return e.ONE;if(r===v)return t;let n=e.ONE,i=t;for(;r>w;)r&v&&(n=e.mul(n,i)),i=e.sqr(i),r>>=v;return n}(m,e,t),div:(t,r)=>B(t*_(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>_(t,e),sqrt:o||(t=>{return p||(p=(r=e)%x===E?R:r%S===k?P:r%C===I?function(e){const t=H(e),r=O(e),n=r(t,t.neg(t.ONE)),i=r(t,n),s=r(t,t.neg(n)),o=(e+T)/C;return(e,t)=>{let r=e.pow(t,o),a=e.mul(r,n);const c=e.mul(r,i),u=e.mul(r,s),l=e.eql(e.sqr(a),t),h=e.eql(e.sqr(c),t);r=e.cmov(r,a,l),a=e.cmov(u,c,h);const d=e.eql(e.sqr(a),t),f=e.cmov(r,a,d);return M(e,f,t),f}}(r):O(r)),p(m,t);var r}),toBytes:e=>n?l(e,f).reverse():l(e,f),fromBytes:(r,i=!0)=>{if(a){if(!a.includes(r.length)||r.length>f)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+r.length);const e=new Uint8Array(f);e.set(r,n?0:e.length-r.length),r=e}if(r.length!==f)throw new Error("Field.fromBytes: expected "+f+" bytes, got "+r.length);let s=n?u(r):function(e){return c((0,t.bytesToHex)(e))}(r);if(h&&(s=B(s,e)),!i&&!m.isValid(s))throw new Error("invalid field element: outside of range 0..ORDER");return s},invertBatch:e=>U(m,e),cmov:(e,t,r)=>r?t:e});return Object.freeze(m)}const z=BigInt(0),$=BigInt(1);function G(e,t){const r=t.negate();return e?r:t}function j(e,t){const r=U(e.Fp,t.map(e=>e.Z));return t.map((t,n)=>e.fromAffine(t.toAffine(r[n])))}function q(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function K(e,t){q(e,t);const r=2**e;return{windows:Math.ceil(t/e)+1,windowSize:2**(e-1),mask:g(e),maxNumber:r,shiftBy:BigInt(e)}}function V(e,t,r){const{windowSize:n,mask:i,maxNumber:s,shiftBy:o}=r;let a=Number(e&i),c=e>>o;a>n&&(a-=s,c+=$);const u=t*n;return{nextN:c,offset:u+Math.abs(a)-1,isZero:0===a,isNeg:a<0,isNegF:t%2!=0,offsetF:u}}const W=new WeakMap,Y=new WeakMap;function J(e){return Y.get(e)||1}function Q(e){if(e!==z)throw new Error("invalid wNAF")}class X{constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,r=this.ZERO){let n=e;for(;t>z;)t&$&&(r=r.add(n)),n=n.double(),t>>=$;return r}precomputeWindow(e,t){const{windows:r,windowSize:n}=K(t,this.bits),i=[];let s=e,o=s;for(let e=0;e<r;e++){o=s,i.push(o);for(let e=1;e<n;e++)o=o.add(s),i.push(o);s=o.double()}return i}wNAF(e,t,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let n=this.ZERO,i=this.BASE;const s=K(e,this.bits);for(let e=0;e<s.windows;e++){const{nextN:o,offset:a,isZero:c,isNeg:u,isNegF:l,offsetF:h}=V(r,e,s);r=o,c?i=i.add(G(l,t[h])):n=n.add(G(u,t[a]))}return Q(r),{p:n,f:i}}wNAFUnsafe(e,t,r,n=this.ZERO){const i=K(e,this.bits);for(let e=0;e<i.windows&&r!==z;e++){const{nextN:s,offset:o,isZero:a,isNeg:c}=V(r,e,i);if(r=s,!a){const e=t[o];n=n.add(c?e.negate():e)}}return Q(r),n}getPrecomputes(e,t,r){let n=W.get(t);return n||(n=this.precomputeWindow(t,e),1!==e&&("function"==typeof r&&(n=r(n)),W.set(t,n))),n}cached(e,t,r){const n=J(e);return this.wNAF(n,this.getPrecomputes(n,e,r),t)}unsafe(e,t,r,n){const i=J(e);return 1===i?this._unsafeLadder(e,t,n):this.wNAFUnsafe(i,this.getPrecomputes(i,e,r),t,n)}createCache(e,t){q(t,this.bits),Y.set(e,t),W.delete(e)}hasCache(e){return 1!==J(e)}}function Z(e,t,r,n){(function(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((e,r)=>{if(!(e instanceof t))throw new Error("invalid point at index "+r)})})(r,e),function(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((e,r)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+r)})}(n,t);const o=r.length,a=n.length;if(o!==a)throw new Error("arrays of points and scalars must have equal length");const c=e.ZERO,u=function(e){let t;for(t=0;e>i;e>>=s,t+=1);return t}(BigInt(o));let l=1;u>12?l=u-3:u>4?l=u-2:u>0&&(l=2);const h=g(l),d=new Array(Number(h)+1).fill(c);let f=c;for(let e=Math.floor((t.BITS-1)/l)*l;e>=0;e-=l){d.fill(c);for(let t=0;t<a;t++){const i=n[t],s=Number(i>>BigInt(e)&h);d[s]=d[s].add(r[t])}let t=c;for(let e=d.length-1,r=c;e>0;e--)r=r.add(d[e]),t=t.add(r);if(f=f.add(t),0!==e)for(let e=0;e<l;e++)f=f.double()}return f}function ee(e,t,r){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return function(e){const t=D.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"});m(e,t)}(t),t}return H(e,{isLE:r})}const te=BigInt(0),re=BigInt(1),ne=BigInt(2),ie=BigInt(8);class se{constructor(e){this.ep=e}static fromBytes(e){y()}static fromHex(e){y()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(e){return this.ep.toAffine(e)}toHex(){return(0,t.bytesToHex)(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(e){return this.assertSame(e),this.init(this.ep.add(e.ep))}subtract(e){return this.assertSame(e),this.init(this.ep.subtract(e.ep))}multiply(e){return this.init(this.ep.multiply(e))}multiplyUnsafe(e){return this.init(this.ep.multiplyUnsafe(e))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(e,t){return this.init(this.ep.precompute(e,t))}toRawBytes(){return this.toBytes()}}function oe(e){const{CURVE:r,curveOpts:n,hash:i,eddsaOpts:s}=function(e){const t={a:e.a,d:e.d,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},r={Fp:e.Fp,Fn:H(t.n,e.nBitLength,!0),uvRatio:e.uvRatio},n={randomBytes:e.randomBytes,adjustScalarBytes:e.adjustScalarBytes,domain:e.domain,prehash:e.prehash,mapToCurve:e.mapToCurve};return{CURVE:t,curveOpts:r,hash:e.hash,eddsaOpts:n}}(e);return function(e,t){const r=t.Point;return Object.assign({},t,{ExtendedPoint:r,CURVE:e,nBitLength:r.Fn.BITS,nByteLength:r.Fn.BYTES})}(e,function(e,r,n={}){if("function"!=typeof r)throw new Error('"hash" function param is required');m(n,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:i}=n,{BASE:s,Fp:c,Fn:l}=e,d=n.randomBytes||t.randomBytes,f=n.adjustScalarBytes||(e=>e),p=n.domain||((e,t,r)=>{if(o(r,"phflag"),t.length||r)throw new Error("Contexts/pre-hash are not supported");return e});function g(e){return l.create(u(e))}function y(e){const{head:t,prefix:n,scalar:i}=function(e){const t=E.secretKey;e=h("private key",e,t);const n=h("hashed private key",r(e),2*t),i=f(n.slice(0,t));return{head:i,prefix:n.slice(t,2*t),scalar:g(i)}}(e),o=s.multiply(i),a=o.toBytes();return{head:t,prefix:n,scalar:i,point:o,pointBytes:a}}function b(e){return y(e).pointBytes}function w(e=Uint8Array.of(),...n){const s=(0,t.concatBytes)(...n);return g(r(p(s,h("context",e),!!i)))}const v={zip215:!0},A=c.BYTES,E={secretKey:A,publicKey:A,signature:2*A,seed:A};function x(e=d(E.seed)){return a(e,E.seed,"seed")}const k={getExtendedPublicKey:y,randomSecretKey:x,isValidSecretKey:function(e){return(0,t.isBytes)(e)&&e.length===l.BYTES},isValidPublicKey:function(t,r){try{return!!e.fromBytes(t,r)}catch(e){return!1}},toMontgomery(t){const{y:r}=e.fromBytes(t),n=E.publicKey,i=32===n;if(!i&&57!==n)throw new Error("only defined for 25519 and 448");const s=i?c.div(re+r,re-r):c.div(r-re,r+re);return c.toBytes(s)},toMontgomerySecret(e){const t=E.secretKey;a(e,t);const n=r(e.subarray(0,t));return f(n).subarray(0,t)},randomPrivateKey:x,precompute:(t=8,r=e.BASE)=>r.precompute(t,!1)};return Object.freeze({keygen:function(e){const t=k.randomSecretKey(e);return{secretKey:t,publicKey:b(t)}},getPublicKey:b,sign:function(e,r,n={}){e=h("message",e),i&&(e=i(e));const{prefix:o,scalar:c,pointBytes:u}=y(r),d=w(n.context,o,e),f=s.multiply(d).toBytes(),p=w(n.context,f,u,e),g=l.create(d+p*c);if(!l.isValid(g))throw new Error("sign failed: invalid s");return a((0,t.concatBytes)(f,l.toBytes(g)),E.signature,"result")},verify:function(t,r,n,a=v){const{context:c,zip215:l}=a,d=E.signature;t=h("signature",t,d),r=h("message",r),n=h("publicKey",n,E.publicKey),void 0!==l&&o(l,"zip215"),i&&(r=i(r));const f=d/2,p=t.subarray(0,f),g=u(t.subarray(f,d));let m,y,b;try{m=e.fromBytes(n,l),y=e.fromBytes(p,l),b=s.multiplyUnsafe(g)}catch(e){return!1}if(!l&&m.isSmallOrder())return!1;const A=w(c,y.toBytes(),m.toBytes(),r);return y.add(m.multiplyUnsafe(A)).subtract(b).clearCofactor().is0()},utils:k,Point:e,lengths:E})}(function(e,r={}){const n=function(e,t,r={},n){if(void 0===n&&(n="edwards"===e),!t||"object"!=typeof t)throw new Error(`expected valid ${e} CURVE object`);for(const e of["p","n","h"]){const r=t[e];if(!("bigint"==typeof r&&r>z))throw new Error(`CURVE.${e} must be positive bigint`)}const i=ee(t.p,r.Fp,n),s=ee(t.n,r.Fn,n),o=["Gx","Gy","a","weierstrass"===e?"b":"d"];for(const e of o)if(!i.isValid(t[e]))throw new Error(`CURVE.${e} must be valid field element of CURVE.Fp`);return{CURVE:t=Object.freeze(Object.assign({},t)),Fp:i,Fn:s}}("edwards",e,r,r.FpFnLE),{Fp:i,Fn:s}=n;let c=n.CURVE;const{h:l}=c;m(r,{},{uvRatio:"function"});const f=ne<<BigInt(8*s.BYTES)-re,g=e=>i.create(e),y=r.uvRatio||((e,t)=>{try{return{isValid:!0,value:i.sqrt(i.div(e,t))}}catch(e){return{isValid:!1,value:te}}});if(!function(e,t,r,n){const i=e.sqr(r),s=e.sqr(n),o=e.add(e.mul(t.a,i),s),a=e.add(e.ONE,e.mul(t.d,e.mul(i,s)));return e.eql(o,a)}(i,c,c.Gx,c.Gy))throw new Error("bad curve params: generator point");function w(e,t,r=!1){return p("coordinate "+e,t,r?re:te,f),t}function v(e){if(!(e instanceof x))throw new Error("ExtendedPoint expected")}const A=b((e,t)=>{const{X:r,Y:n,Z:s}=e,o=e.is0();null==t&&(t=o?ie:i.inv(s));const a=g(r*t),c=g(n*t),u=i.mul(s,t);if(o)return{x:te,y:re};if(u!==re)throw new Error("invZ was invalid");return{x:a,y:c}}),E=b(e=>{const{a:t,d:r}=c;if(e.is0())throw new Error("bad point: ZERO");const{X:n,Y:i,Z:s,T:o}=e,a=g(n*n),u=g(i*i),l=g(s*s),h=g(l*l),d=g(a*t);if(g(l*g(d+u))!==g(h+g(r*g(a*u))))throw new Error("bad point: equation left != right (1)");if(g(n*i)!==g(s*o))throw new Error("bad point: equation left != right (2)");return!0});class x{constructor(e,t,r,n){this.X=w("x",e),this.Y=w("y",t),this.Z=w("z",r,!0),this.T=w("t",n),Object.freeze(this)}static CURVE(){return c}static fromAffine(e){if(e instanceof x)throw new Error("extended point not allowed");const{x:t,y:r}=e||{};return w("x",t),w("y",r),new x(t,r,re,g(t*r))}static fromBytes(e,t=!1){const r=i.BYTES,{a:n,d:s}=c;e=d(a(e,r,"point")),o(t,"zip215");const l=d(e),h=e[r-1];l[r-1]=-129&h;const m=u(l),b=t?f:i.ORDER;p("point.y",m,te,b);const w=g(m*m),v=g(w-re),A=g(s*w-n);let{isValid:E,value:k}=y(v,A);if(!E)throw new Error("bad point: invalid y coordinate");const T=(k&re)===re,S=!!(128&h);if(!t&&k===te&&S)throw new Error("bad point: x=0 and x_0=1");return S!==T&&(k=g(-k)),x.fromAffine({x:k,y:m})}static fromHex(e,t=!1){return x.fromBytes(h("point",e),t)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return k.createCache(this,e),t||this.multiply(ne),this}assertValidity(){E(this)}equals(e){v(e);const{X:t,Y:r,Z:n}=this,{X:i,Y:s,Z:o}=e,a=g(t*o),c=g(i*n),u=g(r*o),l=g(s*n);return a===c&&u===l}is0(){return this.equals(x.ZERO)}negate(){return new x(g(-this.X),this.Y,this.Z,g(-this.T))}double(){const{a:e}=c,{X:t,Y:r,Z:n}=this,i=g(t*t),s=g(r*r),o=g(ne*g(n*n)),a=g(e*i),u=t+r,l=g(g(u*u)-i-s),h=a+s,d=h-o,f=a-s,p=g(l*d),m=g(h*f),y=g(l*f),b=g(d*h);return new x(p,m,b,y)}add(e){v(e);const{a:t,d:r}=c,{X:n,Y:i,Z:s,T:o}=this,{X:a,Y:u,Z:l,T:h}=e,d=g(n*a),f=g(i*u),p=g(o*r*h),m=g(s*l),y=g((n+i)*(a+u)-d-f),b=m-p,w=m+p,A=g(f-t*d),E=g(y*b),k=g(w*A),T=g(y*A),S=g(b*w);return new x(E,k,S,T)}subtract(e){return this.add(e.negate())}multiply(e){if(!s.isValidNot0(e))throw new Error("invalid scalar: expected 1 <= sc < curve.n");const{p:t,f:r}=k.cached(this,e,e=>j(x,e));return j(x,[t,r])[0]}multiplyUnsafe(e,t=x.ZERO){if(!s.isValid(e))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return e===te?x.ZERO:this.is0()||e===re?this:k.unsafe(this,e,e=>j(x,e),t)}isSmallOrder(){return this.multiplyUnsafe(l).is0()}isTorsionFree(){return k.unsafe(this,c.n).is0()}toAffine(e){return A(this,e)}clearCofactor(){return l===re?this:this.multiplyUnsafe(l)}toBytes(){const{x:e,y:t}=this.toAffine(),r=i.toBytes(t);return r[r.length-1]|=e&re?128:0,r}toHex(){return(0,t.bytesToHex)(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(e){return j(x,e)}static msm(e,t){return Z(x,s,e,t)}_setWindowSize(e){this.precompute(e)}toRawBytes(){return this.toBytes()}}x.BASE=new x(c.Gx,c.Gy,re,g(c.Gx*c.Gy)),x.ZERO=new x(te,re,re,te),x.Fp=i,x.Fn=s;const k=new X(x,s.BITS);return x.BASE.precompute(8),x}(r,n),i,s))}(0,t.utf8ToBytes)("HashToScalar-");const ae=BigInt(0),ce=BigInt(1),ue=BigInt(2),le=(BigInt(3),BigInt(5)),he=BigInt(8),de=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),fe=(()=>({p:de,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:he,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")}))();function pe(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}const ge=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function me(e,t){const r=de,n=B(t*t*t,r),i=B(n*n*t,r);let s=B(e*n*function(e){const t=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),s=de,o=e*e%s*e%s,a=N(o,ue,s)*o%s,c=N(a,ce,s)*e%s,u=N(c,le,s)*c%s,l=N(u,t,s)*u%s,h=N(l,r,s)*l%s,d=N(h,n,s)*h%s,f=N(d,i,s)*d%s,p=N(f,i,s)*d%s,g=N(p,t,s)*u%s;return{pow_p_5_8:N(g,ue,s)*e%s,b2:o}}(e*i).pow_p_5_8,r);const o=B(t*s*s,r),a=s,c=B(s*ge,r),u=o===e,l=o===B(-e,r),h=o===B(-e*ge,r);return u&&(s=a),(l||h)&&(s=c),L(s,r)&&(s=B(-s,r)),{isValid:u||l,value:s}}const ye=(()=>H(fe.p,{isLE:!0}))(),be=(()=>H(fe.n,{isLE:!0}))(),we=(()=>({...fe,Fp:ye,hash:e.Zf,adjustScalarBytes:pe,uvRatio:me}))(),ve=(()=>oe(we))(),Ae=ge,Ee=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),xe=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),ke=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),Te=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),Se=e=>me(ce,e),Ie=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Ce=e=>ve.Point.Fp.create(u(e)&Ie);function Be(e){const{d:t}=fe,r=de,n=e=>ye.create(e),i=n(Ae*e*e),s=n((i+ce)*ke);let o=BigInt(-1);const a=n((o-t*i)*n(i+t));let{isValid:c,value:u}=me(s,a),l=n(u*e);L(l,r)||(l=n(-l)),c||(u=l),c||(o=i);const h=n(o*(i-ce)*Te-a),d=u*u,f=n((u+u)*a),p=n(h*Ee),g=n(ce-d),m=n(ce+d);return new ve.Point(n(f*m),n(g*p),n(p*m),n(f*g))}class Ne extends se{constructor(e){super(e)}static fromAffine(e){return new Ne(ve.Point.fromAffine(e))}assertSame(e){if(!(e instanceof Ne))throw new Error("RistrettoPoint expected")}init(e){return new Ne(e)}static hashToCurve(e){return function(e){(0,t.abytes)(e,64);const r=Be(Ce(e.subarray(0,32))),n=Be(Ce(e.subarray(32,64)));return new Ne(r.add(n))}(h("ristrettoHash",e,64))}static fromBytes(e){(0,t.abytes)(e,32);const{a:r,d:n}=fe,i=de,s=e=>ye.create(e),o=Ce(e);if(!function(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return 0===r}(ye.toBytes(o),e)||L(o,i))throw new Error("invalid ristretto255 encoding 1");const a=s(o*o),c=s(ce+r*a),u=s(ce-r*a),l=s(c*c),h=s(u*u),d=s(r*n*l-h),{isValid:f,value:p}=Se(s(d*h)),g=s(p*u),m=s(p*g*d);let y=s((o+o)*g);L(y,i)&&(y=s(-y));const b=s(c*m),w=s(y*b);if(!f||L(w,i)||b===ae)throw new Error("invalid ristretto255 encoding 2");return new Ne(new ve.Point(y,b,ce,w))}static fromHex(e){return Ne.fromBytes(h("ristrettoHex",e,32))}static msm(e,t){return Z(Ne,ve.Point.Fn,e,t)}toBytes(){let{X:e,Y:t,Z:r,T:n}=this.ep;const i=de,s=e=>ye.create(e),o=s(s(r+t)*s(r-t)),a=s(e*t),c=s(a*a),{value:u}=Se(s(o*c)),l=s(u*o),h=s(u*a),d=s(l*h*n);let f;if(L(n*d,i)){let r=s(t*Ae),n=s(e*Ae);e=r,t=n,f=s(l*xe)}else f=h;L(e*d,i)&&(t=s(-t));let p=s((r-t)*f);return L(p,i)&&(p=s(-p)),ye.toBytes(p)}equals(e){this.assertSame(e);const{X:t,Y:r}=this.ep,{X:n,Y:i}=e.ep,s=e=>ye.create(e),o=s(t*i)===s(r*n),a=s(r*i)===s(t*n);return o||a}is0(){return this.equals(Ne.ZERO)}}Ne.BASE=(()=>new Ne(ve.Point.BASE))(),Ne.ZERO=(()=>new Ne(ve.Point.ZERO))(),Ne.Fp=(()=>ye)(),Ne.Fn=(()=>be)();var _e=r(7816),Me=r(9964);function Re(e,r,n,i,s){return e=e+r+s|0,n=n+(i=(0,t.rotr)(i^e,16))|0,{a:e,b:r=(0,t.rotr)(r^n,12),c:n,d:i}}function Pe(e,r,n,i,s){return e=e+r+s|0,n=n+(i=(0,t.rotr)(i^e,8))|0,{a:e,b:r=(0,t.rotr)(r^n,7),c:n,d:i}}class Oe extends t.Hash{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,(0,t.anumber)(e),(0,t.anumber)(r),this.blockLen=e,this.outputLen=r,this.buffer=new Uint8Array(e),this.buffer32=(0,t.u32)(this.buffer)}update(e){(0,t.aexists)(this),e=(0,t.toBytes)(e),(0,t.abytes)(e);const{blockLen:r,buffer:n,buffer32:i}=this,s=e.length,o=e.byteOffset,a=e.buffer;for(let c=0;c<s;){this.pos===r&&((0,t.swap32IfBE)(i),this.compress(i,0,!1),(0,t.swap32IfBE)(i),this.pos=0);const u=Math.min(r-this.pos,s-c),l=o+c;if(u===r&&!(l%4)&&c+u<s){const e=new Uint32Array(a,l,Math.floor((s-c)/4));(0,t.swap32IfBE)(e);for(let t=0;c+r<s;t+=i.length,c+=r)this.length+=r,this.compress(e,t,!1);(0,t.swap32IfBE)(e);continue}n.set(e.subarray(c,c+u),this.pos),this.pos+=u,this.length+=u,c+=u}return this}digestInto(e){(0,t.aexists)(this),(0,t.aoutput)(e,this);const{pos:r,buffer32:n}=this;this.finished=!0,(0,t.clean)(this.buffer.subarray(r)),(0,t.swap32IfBE)(n),this.compress(n,0,!0),(0,t.swap32IfBE)(n);const i=(0,t.u32)(e);this.get().forEach((e,r)=>i[r]=(0,t.swap8IfBE)(e))}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){const{buffer:t,length:r,finished:n,destroyed:i,outputLen:s,pos:o}=this;return e||(e=new this.constructor({dkLen:s})),e.set(...this.get()),e.buffer.set(t),e.destroyed=i,e.finished=n,e.length=r,e.pos=o,e.outputLen=s,e}clone(){return this._cloneInto()}}function Le(e,t,r,n,i,s,o,a,c,u,l,h,d,f,p,g,m,y,b,w){let v=0;for(let A=0;A<n;A++)({a:i,b:c,c:d,d:m}=Re(i,c,d,m,r[t+e[v++]])),({a:i,b:c,c:d,d:m}=Pe(i,c,d,m,r[t+e[v++]])),({a:s,b:u,c:f,d:y}=Re(s,u,f,y,r[t+e[v++]])),({a:s,b:u,c:f,d:y}=Pe(s,u,f,y,r[t+e[v++]])),({a:o,b:l,c:p,d:b}=Re(o,l,p,b,r[t+e[v++]])),({a:o,b:l,c:p,d:b}=Pe(o,l,p,b,r[t+e[v++]])),({a,b:h,c:g,d:w}=Re(a,h,g,w,r[t+e[v++]])),({a,b:h,c:g,d:w}=Pe(a,h,g,w,r[t+e[v++]])),({a:i,b:u,c:p,d:w}=Re(i,u,p,w,r[t+e[v++]])),({a:i,b:u,c:p,d:w}=Pe(i,u,p,w,r[t+e[v++]])),({a:s,b:l,c:g,d:m}=Re(s,l,g,m,r[t+e[v++]])),({a:s,b:l,c:g,d:m}=Pe(s,l,g,m,r[t+e[v++]])),({a:o,b:h,c:d,d:y}=Re(o,h,d,y,r[t+e[v++]])),({a:o,b:h,c:d,d:y}=Pe(o,h,d,y,r[t+e[v++]])),({a,b:c,c:f,d:b}=Re(a,c,f,b,r[t+e[v++]])),({a,b:c,c:f,d:b}=Pe(a,c,f,b,r[t+e[v++]]));return{v0:i,v1:s,v2:o,v3:a,v4:c,v5:u,v6:l,v7:h,v8:d,v9:f,v10:p,v11:g,v12:m,v13:y,v14:b,v15:w}}_e.yc;const De=_e.yc.slice(),Ue=(()=>{const e=Array.from({length:16},(e,t)=>t),t=e=>[2,6,3,10,7,0,4,13,1,11,12,5,9,14,15,8].map(t=>e[t]),r=[];for(let n=0,i=e;n<7;n++,i=t(i))r.push(...i);return Uint8Array.from(r)})();class Fe extends Oe{constructor(e={},r=0){super(64,void 0===e.dkLen?32:e.dkLen),this.chunkPos=0,this.chunksDone=0,this.flags=0,this.stack=[],this.posOut=0,this.bufferOut32=new Uint32Array(16),this.chunkOut=0,this.enableXOF=!0;const{key:n,context:i}=e,s=void 0!==i;if(void 0!==n){if(s)throw new Error('Only "key" or "context" can be specified at same time');const e=(0,t.toBytes)(n).slice();(0,t.abytes)(e,32),this.IV=(0,t.u32)(e),(0,t.swap32IfBE)(this.IV),this.flags=16|r}else if(s){const e=(0,t.toBytes)(i),n=new Fe({dkLen:32},32).update(e).digest();this.IV=(0,t.u32)(n),(0,t.swap32IfBE)(this.IV),this.flags=64|r}else this.IV=De.slice(),this.flags=r;this.state=this.IV.slice(),this.bufferOut=(0,t.u8)(this.bufferOut32)}get(){return[]}set(){}b2Compress(e,t,r,n=0){const{state:i,pos:s}=this,{h:o,l:a}=(0,Me.F6)(BigInt(e),!0),{v0:c,v1:u,v2:l,v3:h,v4:d,v5:f,v6:p,v7:g,v8:m,v9:y,v10:b,v11:w,v12:v,v13:A,v14:E,v15:x}=Le(Ue,n,r,7,i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],De[0],De[1],De[2],De[3],o,a,s,t);i[0]=c^m,i[1]=u^y,i[2]=l^b,i[3]=h^w,i[4]=d^v,i[5]=f^A,i[6]=p^E,i[7]=g^x}compress(e,t=0,r=!1){let n=this.flags;if(this.chunkPos||(n|=1),(15===this.chunkPos||r)&&(n|=2),r||(this.pos=this.blockLen),this.b2Compress(this.chunksDone,n,e,t),this.chunkPos+=1,16===this.chunkPos||r){let e=this.state;this.state=this.IV.slice();for(let t,n=this.chunksDone+1;(r||!(1&n))&&(t=this.stack.pop());n>>=1)this.buffer32.set(t,0),this.buffer32.set(e,8),this.pos=this.blockLen,this.b2Compress(0,4|this.flags,this.buffer32,0),e=this.state,this.state=this.IV.slice();this.chunksDone++,this.chunkPos=0,this.stack.push(e)}this.pos=0}_cloneInto(e){e=super._cloneInto(e);const{IV:t,flags:r,state:n,chunkPos:i,posOut:s,chunkOut:o,stack:a,chunksDone:c}=this;return e.state.set(n.slice()),e.stack=a.map(e=>Uint32Array.from(e)),e.IV.set(t),e.flags=r,e.chunkPos=i,e.chunksDone=c,e.posOut=s,e.chunkOut=o,e.enableXOF=this.enableXOF,e.bufferOut32.set(this.bufferOut32),e}destroy(){this.destroyed=!0,(0,t.clean)(this.state,this.buffer32,this.IV,this.bufferOut32),(0,t.clean)(...this.stack)}b2CompressOut(){const{state:e,pos:r,flags:n,buffer32:i,bufferOut32:s}=this,{h:o,l:a}=(0,Me.F6)(BigInt(this.chunkOut++));(0,t.swap32IfBE)(i);const{v0:c,v1:u,v2:l,v3:h,v4:d,v5:f,v6:p,v7:g,v8:m,v9:y,v10:b,v11:w,v12:v,v13:A,v14:E,v15:x}=Le(Ue,0,i,7,e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],De[0],De[1],De[2],De[3],a,o,r,n);s[0]=c^m,s[1]=u^y,s[2]=l^b,s[3]=h^w,s[4]=d^v,s[5]=f^A,s[6]=p^E,s[7]=g^x,s[8]=e[0]^m,s[9]=e[1]^y,s[10]=e[2]^b,s[11]=e[3]^w,s[12]=e[4]^v,s[13]=e[5]^A,s[14]=e[6]^E,s[15]=e[7]^x,(0,t.swap32IfBE)(i),(0,t.swap32IfBE)(s),this.posOut=0}finish(){if(this.finished)return;this.finished=!0,(0,t.clean)(this.buffer.subarray(this.pos));let e=8|this.flags;this.stack.length?(e|=4,(0,t.swap32IfBE)(this.buffer32),this.compress(this.buffer32,0,!0),(0,t.swap32IfBE)(this.buffer32),this.chunksDone=0,this.pos=this.blockLen):e|=2|(this.chunkPos?0:1),this.flags=e,this.b2CompressOut()}writeInto(e){(0,t.aexists)(this,!1),(0,t.abytes)(e),this.finish();const{blockLen:r,bufferOut:n}=this;for(let t=0,i=e.length;t<i;){this.posOut>=r&&this.b2CompressOut();const s=Math.min(r-this.posOut,i-t);e.set(n.subarray(this.posOut,this.posOut+s),t),this.posOut+=s,t+=s}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible after digest call");return this.writeInto(e)}xof(e){return(0,t.anumber)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,t.aoutput)(e,this),this.finished)throw new Error("digest() was already called");return this.enableXOF=!1,this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}}const He=(0,t.createXOFer)(e=>new Fe(e));var ze=r(427);const $e="2.45.1";let Ge=({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,je=`viem@${$e}`;class qe extends Error{constructor(e,t={}){const r=t.cause instanceof qe?t.cause.details:t.cause?.message?t.cause.message:t.details,n=t.cause instanceof qe&&t.cause.docsPath||t.docsPath,i=Ge?.({...t,docsPath:n});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...r?[`Details: ${r}`]:[],...je?[`Version: ${je}`]:[]].join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=n,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=$e}walk(e){return Ke(this,e)}}function Ke(e,t){return t?.(e)?e:e&&"object"==typeof e&&"cause"in e&&void 0!==e.cause?Ke(e.cause,t):t?null:e}class Ve extends qe{constructor({max:e,min:t,signed:r,size:n,value:i}){super(`Number "${i}" is not in safe ${n?`${8*n}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}}class We extends qe{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}class Ye extends qe{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}}function Je(e,{dir:t,size:r=32}={}){return"string"==typeof e?function(e,{dir:t,size:r=32}={}){if(null===r)return e;const n=e.replace("0x","");if(n.length>2*r)throw new Ye({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n["right"===t?"padEnd":"padStart"](2*r,"0")}`}(e,{dir:t,size:r}):function(e,{dir:t,size:r=32}={}){if(null===r)return e;if(e.length>r)throw new Ye({size:e.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;i<r;i++){const s="right"===t;n[s?i:r-i-1]=e[s?i:e.length-i-1]}return n}(e,{dir:t,size:r})}function Qe(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}function Xe(e){return Qe(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function Ze(e,{size:t}){if(Xe(e)>t)throw new We({givenSize:Xe(e),maxSize:t})}function et(e,t={}){const{signed:r}=t;t.size&&Ze(e,{size:t.size});const n=BigInt(e);if(!r)return n;const i=(e.length-2)/2;return n<=(1n<<8n*BigInt(i)-1n)-1n?n:n-BigInt(`0x${"f".padStart(2*i,"f")}`)-1n}const tt=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function rt(e,t={}){return"number"==typeof e||"bigint"==typeof e?it(e,t):"string"==typeof e?ot(e,t):"boolean"==typeof e?function(e,t={}){const r=`0x${Number(e)}`;return"number"==typeof t.size?(Ze(r,{size:t.size}),Je(r,{size:t.size})):r}(e,t):nt(e,t)}function nt(e,t={}){let r="";for(let t=0;t<e.length;t++)r+=tt[e[t]];const n=`0x${r}`;return"number"==typeof t.size?(Ze(n,{size:t.size}),Je(n,{dir:"right",size:t.size})):n}function it(e,t={}){const{signed:r,size:n}=t,i=BigInt(e);let s;n?s=r?(1n<<8n*BigInt(n)-1n)-1n:2n**(8n*BigInt(n))-1n:"number"==typeof e&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o="bigint"==typeof s&&r?-s-1n:0;if(s&&i>s||i<o){const t="bigint"==typeof e?"n":"";throw new Ve({max:s?`${s}${t}`:void 0,min:`${o}${t}`,signed:r,size:n,value:`${e}${t}`})}const a=`0x${(r&&i<0?(1n<<BigInt(8*n))+BigInt(i):i).toString(16)}`;return n?Je(a,{size:n}):a}const st=new TextEncoder;function ot(e,t={}){return nt(st.encode(e),t)}class at extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const t=super.get(e);return super.has(e)&&void 0!==t&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){const e=this.keys().next().value;e&&this.delete(e)}return this}}class ct extends qe{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}const ut=new TextEncoder;const lt={zero:48,nine:57,A:65,F:70,a:97,f:102};function ht(e){return e>=lt.zero&&e<=lt.nine?e-lt.zero:e>=lt.A&&e<=lt.F?e-(lt.A-10):e>=lt.a&&e<=lt.f?e-(lt.a-10):void 0}function dt(e,t={}){let r=e;t.size&&(Ze(r,{size:t.size}),r=Je(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let e=0,t=0;e<i;e++){const r=ht(n.charCodeAt(t++)),i=ht(n.charCodeAt(t++));if(void 0===r||void 0===i)throw new qe(`Invalid byte sequence ("${n[t-2]}${n[t-1]}" in "${n}").`);s[e]=16*r+i}return s}function ft(e,t={}){const r=ut.encode(e);return"number"==typeof t.size?(Ze(r,{size:t.size}),Je(r,{dir:"right",size:t.size})):r}var pt=r(113);function gt(e,t){const r=t||"hex",n=(0,pt.keccak_256)(Qe(e,{strict:!1})?function(e,t={}){return"number"==typeof e||"bigint"==typeof e?function(e,t){return dt(it(e,t))}(e,t):"boolean"==typeof e?function(e,t={}){const r=new Uint8Array(1);return r[0]=Number(e),"number"==typeof t.size?(Ze(r,{size:t.size}),Je(r,{size:t.size})):r}(e,t):Qe(e)?dt(e,t):ft(e,t)}(e):e);return"bytes"===r?n:rt(n)}const mt=new at(8192);function yt(e,t){if(mt.has(`${e}.${t}`))return mt.get(`${e}.${t}`);const r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=gt(ft(r),"bytes"),i=(t?r.substring(`${t}0x`.length):r).split("");for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(15&n[e>>1])>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());const s=`0x${i.join("")}`;return mt.set(`${e}.${t}`,s),s}const bt=/^0x[a-fA-F0-9]{40}$/,wt=new at(8192);function vt(e,t){const{strict:r=!0}=t??{},n=`${e}.${r}`;if(wt.has(n))return wt.get(n);const i=!(!bt.test(e)||e.toLowerCase()!==e&&r&&yt(e)!==e);return wt.set(n,i),i}const At="Ethereum Signed Message:\n";function Et(e,t){return gt(function(e){const t="string"==typeof e?ot(e):"string"==typeof e.raw?e.raw:nt(e.raw);return"string"==typeof(r=[ot(`${At}${Xe(t)}`),t])[0]?function(e){return`0x${e.reduce((e,t)=>e+t.replace("0x",""),"")}`}(r):function(e){let t=0;for(const r of e)t+=r.length;const r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}(r);var r}(e),t)}function xt(e){if(0===e||1===e)return e;if(27===e)return 0;if(28===e)return 1;throw new Error("Invalid yParityOrV value")}async function kt({hash:e,signature:t}){return n=await async function({hash:e,signature:t}){const n=Qe(e)?e:rt(e),{secp256k1:i}=await Promise.resolve().then(r.bind(r,2072));return`0x${(()=>{if("object"==typeof t&&"r"in t&&"s"in t){const{r:e,s:r,v:n,yParity:s}=t,o=xt(Number(s??n));return new i.Signature(et(e),et(r)).addRecoveryBit(o)}const e=Qe(t)?t:rt(t);if(65!==Xe(e))throw new Error("invalid signature length");const r=xt(function(e,t={}){const r=et(e,t),n=Number(r);if(!Number.isSafeInteger(n))throw new Ve({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:t.signed,size:t.size,value:`${r}n`});return n}(`0x${e.slice(130)}`));return i.Signature.fromCompact(e.substring(2,130)).addRecoveryBit(r)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}({hash:e,signature:t}),yt(`0x${gt(`0x${n.substring(4)}`).substring(26)}`);var n}var Tt=r(1048).Buffer,St=Object.defineProperty,It=(e,t)=>{for(var r in t)St(e,r,{get:t[r],enumerable:!0})},Ct=(e,t,r)=>((e,t,r)=>t in e?St(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),Bt={};function Nt(e){if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}It(Bt,{base10:()=>Ft}),new Uint8Array(0);var _t=class{constructor(e,t,r){Ct(this,"name"),Ct(this,"prefix"),Ct(this,"baseEncode"),this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Mt=class{constructor(e,t,r){Ct(this,"name"),Ct(this,"prefix"),Ct(this,"baseDecode"),Ct(this,"prefixCodePoint"),this.name=e,this.prefix=t;const n=t.codePointAt(0);if(void 0===n)throw new Error("Invalid prefix character");this.prefixCodePoint=n,this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return Pt(this,e)}},Rt=class{constructor(e){Ct(this,"decoders"),this.decoders=e}or(e){return Pt(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(null!=r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Pt(e,t){return new Rt({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Ot=class{constructor(e,t,r,n){Ct(this,"name"),Ct(this,"prefix"),Ct(this,"baseEncode"),Ct(this,"baseDecode"),Ct(this,"encoder"),Ct(this,"decoder"),this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new _t(e,t,r),this.decoder=new Mt(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Lt({name:e,prefix:t,encode:r,decode:n}){return new Ot(e,t,r,n)}function Dt({name:e,prefix:t,alphabet:r}){const{encode:n,decode:i}=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var s=e.charAt(i),o=s.charCodeAt(0);if(255!==r[o])throw new TypeError(s+" is ambiguous");r[o]=i}var a=e.length,c=e.charAt(0),u=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function h(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,i=0;e[t]===c;)n++,t++;for(var s=(e.length-t)*u+1>>>0,o=new Uint8Array(s);e[t];){var l=r[e.charCodeAt(t)];if(255===l)return;for(var h=0,d=s-1;(0!==l||h<i)&&-1!==d;d--,h++)l+=a*o[d]>>>0,o[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=h,t++}if(" "!==e[t]){for(var f=s-i;f!==s&&0===o[f];)f++;for(var p=new Uint8Array(n+(s-f)),g=n;f!==s;)p[g++]=o[f++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,s=t.length;i!==s&&0===t[i];)i++,r++;for(var o=(s-i)*l+1>>>0,u=new Uint8Array(o);i!==s;){for(var h=t[i],d=0,f=o-1;(0!==h||d<n)&&-1!==f;f--,d++)h+=256*u[f]>>>0,u[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,i++}for(var p=o-n;p!==o&&0===u[p];)p++;for(var g=c.repeat(r);p<o;++p)g+=e.charAt(u[p]);return g},decodeUnsafe:h,decode:function(e){var r=h(e);if(r)return r;throw new Error(`Non-${t} character`)}}}(r,e);return Lt({prefix:t,name:e,encode:n,decode:e=>Nt(i(e))})}function Ut({name:e,prefix:t,bitsPerChar:r,alphabet:n}){const i=function(e){const t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}(n);return Lt({prefix:t,name:e,encode:e=>function(e,t,r){const n="="===t[t.length-1],i=(1<<r)-1;let s="",o=0,a=0;for(let n=0;n<e.length;++n)for(a=a<<8|e[n],o+=8;o>r;)o-=r,s+=t[i&a>>o];if(0!==o&&(s+=t[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s}(e,n,r),decode:t=>function(e,t,r,n){let i=e.length;for(;"="===e[i-1];)--i;const s=new Uint8Array(i*r/8|0);let o=0,a=0,c=0;for(let u=0;u<i;++u){const i=t[e[u]];if(void 0===i)throw new SyntaxError(`Non-${n} character`);a=a<<r|i,o+=r,o>=8&&(o-=8,s[c++]=255&a>>o)}if(o>=r||255&a<<8-o)throw new SyntaxError("Unexpected end of data");return s}(t,i,r,e)})}var Ft=Dt({prefix:"9",name:"base10",alphabet:"0123456789"}),Ht={};It(Ht,{base16:()=>zt,base16upper:()=>$t});var zt=Ut({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),$t=Ut({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Gt={};It(Gt,{base2:()=>jt});var jt=Ut({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),qt={};It(qt,{base256emoji:()=>Yt});var Kt=Array.from("๐๐ชโ๐ฐ๐๐๐๐๐๐๐๐๐๐๐๐๐โ๐ป๐ฅ๐พ๐ฟ๐โค๐๐คฃ๐๐๐๐ญ๐๐๐
๐๐๐ฅ๐ฅฐ๐๐๐๐ข๐ค๐๐๐ช๐โบ๐๐ค๐๐๐๐๐น๐คฆ๐๐โโจ๐คท๐ฑ๐๐ธ๐๐๐๐๐๐๐๐๐คฉ๐๐๐ค๐๐ฏ๐๐๐ถ๐๐คญโฃ๐๐๐๐ช๐๐ฅ๐๐๐ฉ๐ก๐คช๐๐ฅณ๐ฅ๐คค๐๐๐ณโ๐๐๐ด๐๐ฌ๐๐๐ท๐ป๐โญโ
๐ฅบ๐๐๐ค๐ฆโ๐ฃ๐๐โน๐๐๐ โ๐๐บ๐๐ป๐๐๐๐๐น๐ฃ๐ซ๐๐๐ต๐ค๐๐ด๐ค๐ผ๐ซโฝ๐คโ๐๐คซ๐๐ฎ๐๐ป๐๐ถ๐๐ฒ๐ฟ๐งก๐โก๐๐โโ๐๐ฐ๐คจ๐ถ๐ค๐ถ๐ฐ๐๐ข๐ค๐๐จ๐จ๐คฌโ๐๐บ๐ค๐๐๐ฑ๐๐ถ๐ฅดโถโกโ๐๐ธโฌ๐จ๐๐ฆ๐ท๐บโ ๐
๐๐ต๐๐คฒ๐ค ๐คง๐๐ต๐
๐ง๐พ๐๐๐ค๐๐คฏ๐ทโ๐ง๐ฏ๐๐๐ค๐๐โ๐ด๐ฃ๐ธ๐๐๐ฅ๐คข๐
๐ก๐ฉ๐๐ธ๐ป๐ค๐คฎ๐ผ๐ฅต๐ฉ๐๐๐ผ๐๐ฃ๐ฅ"),Vt=Kt.reduce((e,t,r)=>(e[r]=t,e),[]),Wt=Kt.reduce((e,t,r)=>{const n=t.codePointAt(0);if(null==n)throw new Error(`Invalid character: ${t}`);return e[n]=r,e},[]),Yt=Lt({prefix:"๐",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>e+Vt[t],"")},decode:function(e){const t=[];for(const r of e){const e=r.codePointAt(0);if(null==e)throw new Error(`Invalid character: ${r}`);const n=Wt[e];if(null==n)throw new Error(`Non-base256emoji character: ${r}`);t.push(n)}return new Uint8Array(t)}}),Jt={};It(Jt,{base32:()=>Qt,base32hex:()=>tr,base32hexpad:()=>nr,base32hexpadupper:()=>ir,base32hexupper:()=>rr,base32pad:()=>Zt,base32padupper:()=>er,base32upper:()=>Xt,base32z:()=>sr});var Qt=Ut({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Xt=Ut({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Zt=Ut({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),er=Ut({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),tr=Ut({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),rr=Ut({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),nr=Ut({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ir=Ut({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),sr=Ut({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),or={};It(or,{base36:()=>ar,base36upper:()=>cr});var ar=Dt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),cr=Dt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),ur={};It(ur,{base58btc:()=>lr,base58flickr:()=>hr});var lr=Dt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),hr=Dt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),dr={};It(dr,{base64:()=>fr,base64pad:()=>pr,base64url:()=>gr,base64urlpad:()=>mr});var fr=Ut({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),pr=Ut({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),gr=Ut({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),mr=Ut({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),yr={};It(yr,{base8:()=>br});var br=Ut({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),wr={};It(wr,{identity:()=>vr});var vr=Lt({prefix:"\0",name:"identity",encode:e=>{return t=e,(new TextDecoder).decode(t);var t},decode:e=>function(e){return(new TextEncoder).encode(e)}(e)});It((new TextEncoder,new TextDecoder,{}),{identity:()=>$r});var Ar=128,Er=-128,xr=Math.pow(2,31),kr=128,Tr=127,Sr=Math.pow(2,7),Ir=Math.pow(2,14),Cr=Math.pow(2,21),Br=Math.pow(2,28),Nr=Math.pow(2,35),_r=Math.pow(2,42),Mr=Math.pow(2,49),Rr=Math.pow(2,56),Pr=Math.pow(2,63),Or={encode:function e(t,r,n){r=r||[];for(var i=n=n||0;t>=xr;)r[n++]=255&t|Ar,t/=128;for(;t&Er;)r[n++]=255&t|Ar,t>>>=7;return r[n]=0|t,e.bytes=n-i+1,r},decode:function e(t,r){var n,i=0,s=0,o=r=r||0,a=t.length;do{if(o>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[o++],i+=s<28?(n&Tr)<<s:(n&Tr)*Math.pow(2,s),s+=7}while(n>=kr);return e.bytes=o-r,i},encodingLength:function(e){return e<Sr?1:e<Ir?2:e<Cr?3:e<Br?4:e<Nr?5:e<_r?6:e<Mr?7:e<Rr?8:e<Pr?9:10}};function Lr(e,t=0){return[Or.decode(e,t),Or.decode.bytes]}function Dr(e,t,r=0){return Or.encode(e,t,r),t}function Ur(e){return Or.encodingLength(e)}function Fr(e,t){const r=t.byteLength,n=Ur(e),i=n+Ur(r),s=new Uint8Array(i+r);return Dr(e,s,0),Dr(r,s,n),s.set(t,i),new Hr(e,r,t,s)}var Hr=class{constructor(e,t,r,n){Ct(this,"code"),Ct(this,"size"),Ct(this,"digest"),Ct(this,"bytes"),this.code=e,this.size=t,this.digest=r,this.bytes=n}},zr=Nt,$r={code:0,name:"identity",encode:zr,digest:function(e,t){if(null!=t?.truncate&&t.truncate!==e.byteLength){if(t.truncate<0||t.truncate>e.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${e.byteLength}`);e=e.subarray(0,t.truncate)}return Fr(0,zr(e))}};function Gr({name:e,code:t,encode:r,minDigestLength:n,maxDigestLength:i}){return new jr(e,t,r,n,i)}It({},{sha256:()=>Vr,sha512:()=>Wr});var jr=class{constructor(e,t,r,n,i){Ct(this,"name"),Ct(this,"code"),Ct(this,"encode"),Ct(this,"minDigestLength"),Ct(this,"maxDigestLength"),this.name=e,this.code=t,this.encode=r,this.minDigestLength=n??20,this.maxDigestLength=i}digest(e,t){if(null!=t?.truncate){if(t.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(null!=this.maxDigestLength&&t.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?qr(r,this.code,t?.truncate):r.then(e=>qr(e,this.code,t?.truncate))}throw Error("Unknown type, must be binary type")}};function qr(e,t,r){if(null!=r&&r!==e.byteLength){if(r>e.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${e.byteLength}`);e=e.subarray(0,r)}return Fr(t,e)}function Kr(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var Vr=Gr({name:"sha2-256",code:18,encode:Kr("SHA-256")}),Wr=Gr({name:"sha2-512",code:19,encode:Kr("SHA-512")});function Yr(e,t){const{bytes:r,version:n}=e;return 0===n?function(e,t,r){const{prefix:n}=r;if(n!==lr.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);const i=t.get(n);if(null==i){const i=r.encode(e).slice(1);return t.set(n,i),i}return i}(r,Xr(e),t??lr.encoder):function(e,t,r){const{prefix:n}=r,i=t.get(n);if(null==i){const i=r.encode(e);return t.set(n,i),i}return i}(r,Xr(e),t??Qt.encoder)}var Jr,Qr=new WeakMap;function Xr(e){const t=Qr.get(e);if(null==t){const t=new Map;return Qr.set(e,t),t}return t}var Zr=class e{constructor(e,t,r,n){Ct(this,"code"),Ct(this,"version"),Ct(this,"multihash"),Ct(this,"bytes"),Ct(this,"/"),Ct(this,Jr,"CID"),this.code=t,this.version=e,this.multihash=r,this.bytes=n,this["/"]=n}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{const{code:t,multihash:r}=this;if(t!==en)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==tn)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return e.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{const{code:t,digest:r}=this.multihash,n=Fr(t,r);return e.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return e.equals(this,t)}static equals(e,t){const r=t;return null!=r&&e.code===r.code&&e.version===r.version&&function(e,t){if(e===t)return!0;{const r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&function(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}(e.bytes,r.bytes)}}(e.multihash,r.multihash)}toString(e){return Yr(this,e)}toJSON(){return{"/":Yr(this)}}link(){return this}[(Jr=Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom"))](){return`CID(${this.toString()})`}static asCID(t){if(null==t)return null;const r=t;if(r instanceof e)return r;if(null!=r["/"]&&r["/"]===r.bytes||r.asCID===r){const{version:t,code:n,multihash:i,bytes:s}=r;return new e(t,n,i,s??rn(t,n,i.bytes))}if(!0===r[nn]){const{version:t,multihash:n,code:i}=r,s=function(e){const t=Nt(e),[r,n]=Lr(t),[i,s]=Lr(t.subarray(n)),o=t.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Hr(r,i,o,t)}(n);return e.create(t,i,s)}return null}static create(t,r,n){if("number"!=typeof r)throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:if(r!==en)throw new Error(`Version 0 CID must use dag-pb (code: ${en}) block encoding`);return new e(t,r,n,n.bytes);case 1:{const i=rn(t,r,n.bytes);return new e(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return e.create(0,en,t)}static createV1(t,r){return e.create(1,t,r)}static decode(t){const[r,n]=e.decodeFirst(t);if(0!==n.length)throw new Error("Incorrect length");return r}static decodeFirst(t){const r=e.inspectBytes(t),n=r.size-r.multihashSize,i=Nt(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");const s=i.subarray(r.multihashSize-r.digestSize),o=new Hr(r.multihashCode,r.digestSize,s,i);return[0===r.version?e.createV0(o):e.createV1(r.codec,o),t.subarray(r.size)]}static inspectBytes(e){let t=0;const r=()=>{const[r,n]=Lr(e.subarray(t));return t+=n,r};let n=r(),i=en;if(18===n?(n=0,t=0):i=r(),0!==n&&1!==n)throw new RangeError(`Invalid CID version ${n}`);const s=t,o=r(),a=r(),c=t+a;return{version:n,codec:i,multihashCode:o,digestSize:a,multihashSize:c-s,size:c}}static parse(t,r){const[n,i]=function(e,t){switch(e[0]){case"Q":{const r=t??lr;return[lr.prefix,r.decode(`${lr.prefix}${e}`)]}case lr.prefix:{const r=t??lr;return[lr.prefix,r.decode(e)]}case Qt.prefix:{const r=t??Qt;return[Qt.prefix,r.decode(e)]}case ar.prefix:{const r=t??ar;return[ar.prefix,r.decode(e)]}default:if(null==t)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}(t,r),s=e.decode(i);if(0===s.version&&"Q"!==t[0])throw Error("Version 0 CID string must not include multibase prefix");return Xr(s).set(n,t),s}},en=112,tn=18;function rn(e,t,r){const n=Ur(e),i=n+Ur(t),s=new Uint8Array(i+r.byteLength);return Dr(e,s,0),Dr(t,s,n),s.set(r,i),s}var nn=Symbol.for("@ipld/js-cid/CID"),sn={...wr,...Gt,...yr,...Bt,...Ht,...Jt,...or,...ur,...dr,...qt};function on(e){if(!/^[A-Za-z0-9_-]*$/.test(e)||e.length%4==1)throw new TypeError("value is not canonical base64url");const t="function"==typeof atob?Uint8Array.from(atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(4*Math.ceil(e.length/4),"=")),e=>e.charCodeAt(0)):new Uint8Array(Tt.from(e,"base64url"));if(function(e){if("function"==typeof btoa){let t="";for(const r of e)t+=String.fromCharCode(r);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}return Tt.from(e).toString("base64url")}(t)!==e)throw new TypeError("value is not canonical base64url");return t}var an=class extends Error{constructor(e){super(e),this.name="IdentityParseError"}},cn=/^did:pkh:eip155:(\d+):(0x[a-fA-F0-9]{40})$/,un=/^did:[a-z0-9]+:.+$/;function ln(e){const t=e.indexOf("#");return t<0?{did:e,fragment:""}:{did:e.slice(0,t),fragment:e.slice(t)}}function hn(e){if(!Number.isSafeInteger(e)||e<=0)throw new an(`Invalid EIP-155 chain ID: ${e}`)}function dn(e){if(!vt(e,{strict:!1}))throw new an(`Invalid EVM address: ${e}`);return function(e){if(!vt(e,{strict:!1}))throw new ct({address:e});return yt(e,void 0)}(e)}function fn(e){const t=function(e){const t=e.match(cn);if(!t)return null;const r=Number(t[1]);return hn(r),{method:"pkh",namespace:"eip155",chainId:r,address:dn(t[2])}}(e);if(t)return function(e,t=1){return hn(t),`did:pkh:eip155:${t}:${dn(e)}`}(t.address,t.chainId);if(un.test(e))return e;throw new an(`Invalid DID: ${e}`)}function pn(e){const{did:t,fragment:r}=ln(e);return`${fn(t)}${r}`}function gn(e){return fn(ln(e).did)}function mn(e,t){return function(e,t,r={}){const n=r.ignoreFragment?gn:pn;return n(e)===n(t)}(e,t,{ignoreFragment:!0})}var yn=65536,bn=64,wn="urn:recap:",vn="I further authorize the stated URI to perform the following actions on my behalf:";function An(e){let t=0;const r=new DataView(e.buffer,e.byteOffset,e.byteLength),n=r=>{if(r>e.length-t)throw new Error("CBOR input ended early");return e.subarray(t,t+=r)},i=s=>{if(s>bn)throw new Error(`CBOR nesting exceeds ${bn} levels`);const[o]=n(1),a=o>>5,c=31&o;if(7===a){if(20===c)return!1;if(21===c)return!0;if(22===c)return null;throw new Error("CBOR floats and other simple values are not part of a CACAO")}if(6===a)throw new Error("CBOR tags are not part of a CACAO");let u;if(c<24)u=c;else if(24===c)u=n(1)[0];else if(25===c)u=r.getUint16(n(2).byteOffset-e.byteOffset);else if(26===c)u=r.getUint32(n(4).byteOffset-e.byteOffset);else{if(27!==c)throw new Error("CBOR indefinite lengths are not DAG-CBOR");{const t=r.getBigUint64(n(8).byteOffset-e.byteOffset);if(t>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("CBOR integer is too large");u=Number(t)}}switch(a){case 0:return u;case 1:return-1-u;case 2:return n(u).slice();case 3:return new TextDecoder("utf-8",{fatal:!0}).decode(n(u));case 4:{if(u>e.length-t)throw new Error("CBOR input ended early");const r=[];for(let e=0;e<u;e++)r.push(i(s+1));return r}default:{if(u>e.length-t)throw new Error("CBOR input ended early");const r=Object.create(null);for(let e=0;e<u;e++){const e=i(s+1);if("string"!=typeof e)throw new Error("CBOR map keys must be strings");if("__proto__"===e)throw new Error("CBOR map key __proto__ is not allowed");if(Object.prototype.hasOwnProperty.call(r,e))throw new Error(`CBOR map has a duplicate key ${JSON.stringify(e)}`);r[e]=i(s+1)}return r}}},s=i(0);if(t!==e.length)throw new Error("CBOR input has trailing bytes");return s}function En(e){const t=An(e),r=xn(t);if(r.length!==e.length||r.some((t,r)=>t!==e[r]))throw new Error("DAG-CBOR is not canonical");return t}function xn(e){const t=[],r=(e,r)=>{r<24?t.push(e<<5|r):r<256?t.push(e<<5|24,r):r<65536?t.push(e<<5|25,r>>8,255&r):r<4294967296?t.push(e<<5|26,...[24,16,8,0].map(e=>r>>>e&255)):t.push(e<<5|27,...[56n,48n,40n,32n,24n,16n,8n,0n].map(e=>Number(BigInt(r)>>e&0xffn)))},n=e=>{if(null===e)t.push(246);else if(!1===e)t.push(244);else if(!0===e)t.push(245);else if("number"==typeof e&&Number.isSafeInteger(e))e>=0?r(0,e):r(1,-1-e);else if("string"==typeof e){const n=(new TextEncoder).encode(e);r(3,n.length),t.push(...n)}else if(e instanceof Uint8Array)r(2,e.length),t.push(...e);else if(Array.isArray(e))r(4,e.length),e.forEach(n);else{if("object"!=typeof e)throw new Error("value is not DAG-CBOR encodable");{const i=Object.keys(e).map(t=>[(new TextEncoder).encode(t),e[t]]);i.sort(([e],[t])=>function(e,t){if(e.length!==t.length)return e.length-t.length;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]-t[r];return 0}(e,t)),r(5,i.length);for(const[e,s]of i)r(3,e.length),t.push(...e),n(s)}}};return n(e),Uint8Array.from(t)}function kn(e,t,r,n=[]){if("object"!=typeof e||null===e||Array.isArray(e)||e instanceof Uint8Array)throw new Error(`CACAO ${t} must be a map`);const i=e;for(const e of Object.keys(i))if(!r.includes(e)&&!n.includes(e))throw new Error(`CACAO ${t} has unknown field ${JSON.stringify(e)}`);for(const e of r)if(!(e in i))throw new Error(`CACAO ${t} is missing ${e}`);return i}function Tn(e,t){if("string"!=typeof e||0===e.length)throw new Error(`CACAO ${t} must be a non-empty string`);return e}async function Sn(e,t){if(e.length>4*Math.ceil(yn/3)+2)throw new Error(`CACAO exceeds ${yn} bytes`);if(!/^[A-Za-z0-9_-]+={0,2}$/.test(e))throw new Error("CACAO must be base64url DAG-CBOR");const r=on(e.replace(/=+$/,""));if(r.length>yn)throw new Error(`CACAO exceeds ${yn} bytes`);const n=Zr.createV1(85,Fr(30,He(r))).toString();if(void 0!==t&&n!==t)throw new Error("CACAO CID does not match exact Authorization bytes");const i=An(r),s=xn(i);if(s.length!==r.length||s.some((e,t)=>e!==r[t]))throw new Error("CACAO is not canonical DAG-CBOR");const o=kn(i,"envelope",["h","p","s"]);if("eip4361"!==kn(o.h,"header",["t"]).t)throw new Error("CACAO header must be eip4361");const a=kn(o.s,"signature",["t","s"]);if("eip191"!==a.t||!(a.s instanceof Uint8Array)||65!==a.s.length)throw new Error("CACAO signature must be a 65-byte eip191 signature");const c=kn(o.p,"payload",["domain","iss","aud","version","nonce","iat"],["exp","nbf","statement","requestId","resources"]);if(1!==c.version)throw new Error("CACAO SIWE version must be the integer 1");const u=Tn(c.iss,"iss"),l=/^did:pkh:eip155:([1-9]\d*):(0x[0-9a-fA-F]{40})$/.exec(u),h=Number(l?.[1]);if(null===l||!Number.isSafeInteger(h)||String(h)!==l[1])throw new Error("CACAO issuer must be did:pkh:eip155 with a safe-integer chain ID");const d=Tn(c.aud,"aud"),f=e=>void 0===c[e]?void 0:Tn(c[e],e),p=f("statement"),g=f("exp"),m=f("nbf"),y=f("requestId");let b=[];if("resources"in c){if(!Array.isArray(c.resources)||0===c.resources.length)throw new Error("CACAO resources must be a non-empty array when present");b=c.resources.map((e,t)=>Tn(e,`resources[${t}]`))}const w=b.at(-1);if(b.slice(0,-1).some(e=>e.startsWith(wn)))throw new Error("CACAO has ambiguous ReCap resources");const{attenuation:v,proofs:A}=w?.startsWith(wn)?function(e){const t=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),r=new TextDecoder("utf-8",{fatal:!0}).decode(on(e.slice(wn.length))),n=[],i=[...r.matchAll(/"(?:[^"\\]|\\.)*"|[{}\[\]:,]|[^\s{}\[\]:,]+/g)].map(e=>e[0]);for(let e=0;e<i.length;e++){const t=i[e];if("{"===t)n.push(new Set);else if("["===t)n.push(null);else if("}"===t||"]"===t)n.pop();else if(t.startsWith('"')&&":"===i[e+1]){const e=n.at(-1),r=JSON.parse(t);if(e?.has(r))throw new Error("ReCap duplicate member is ambiguous");e?.add(r)}}const s=JSON.parse(r);if(!t(s)||!("att"in s)||!t(s.att))throw new Error("ReCap attenuation must be an object");const o=Object.create(null);for(const[e,r]of Object.entries(s.att)){if("__proto__"===e||!t(r)||0===Object.keys(r).length)throw new Error("ReCap resource must map to abilities");const n=Object.create(null);for(const[e,i]of Object.entries(r)){if("__proto__"===e||!/^[^/]+\/[^/]/.test(e))throw new Error("ReCap ability must be namespace/name");if(!Array.isArray(i)||0===i.length||!i.every(t))throw new Error("ReCap caveats must be a non-empty array of objects");n[e]=i}o[e]=n}if(Object.keys(s).some(e=>"att"!==e&&"prf"!==e))throw new Error("ReCap fields are invalid");const a="prf"in s?s.prf:[];if(!Array.isArray(a)||!a.every(e=>{if("string"!=typeof e)return!1;try{return Zr.parse(e).toString()===e}catch{return!1}}))throw new Error("ReCap proofs must be canonical CID strings");return{attenuation:o,proofs:Object.freeze([...a])}}(w):{attenuation:Object.create(null),proofs:Object.freeze([])};if(w?.startsWith(wn)&&!p?.endsWith(function(e){var t;let r=0,n="";for(const i of Object.keys(e).sort()){const s=Object.create(null);for(const r of Object.keys(e[i]).sort()){const e=r.indexOf("/");if(e<=0)throw new Error("ReCap ability must be namespace/name");(s[t=r.slice(0,e)]??(s[t]=[])).push(r.slice(e+1))}for(const e of Object.keys(s).sort())n+=` (${++r}) '${e}': ${s[e].map(e=>`'${e}'`).join(", ")} for '${i}'.`}return`${vn}${n}`}(v)))throw new Error("CACAO statement does not match its ReCap");const E=new ze.SiweMessage({domain:Tn(c.domain,"domain"),address:l[2],uri:d,version:"1",chainId:h,nonce:Tn(c.nonce,"nonce"),issuedAt:Tn(c.iat,"iat"),...void 0===p?{}:{statement:p},...void 0===g?{}:{expirationTime:g},...void 0===m?{}:{notBefore:m},...void 0===y?{}:{requestId:y},...0===b.length?{}:{resources:b}}).prepareMessage();if(!await async function(e,t,r){if(!/^0x[0-9a-fA-F]{130}$/.test(t))return!1;try{const n=await async function({message:e,signature:t}){return kt({hash:Et(e),signature:t})}({message:e,signature:t});return dn(n)===dn(r)}catch{return!1}}(E,nt(a.s),l[2]))throw new Error("CACAO signature is invalid");return{cid:n,issuer:u,audience:d,attenuation:v,proofs:A,issuedAt:Tn(c.iat,"iat"),...void 0===m?{}:{notBefore:m},...void 0===g?{}:{expiresAt:g}}}var In=new Map;function Cn(e,t,r){const n=Bn(t,r);In.set(e,n);const i=()=>{In.get(e)===n&&In.delete(e)};return n.then(i,i),n}async function Bn(e,t,r){const n=await fetch(`${e}/delegate`,{method:"POST",headers:t,redirect:"error",signal:r});if(n.ok)try{const e=await n.json();return{success:!0,status:n.status,activated:e.activated??[],skipped:e.skipped??[],commitEventCid:e.cid}}catch{return{success:!0,status:n.status,activated:[],skipped:[]}}return{success:!1,status:n.status,error:await n.text().catch(()=>n.statusText)}}function Nn(e=0){return new Uint8Array(e)}Math.pow(2,7),Math.pow(2,14),Math.pow(2,21),Math.pow(2,28),Math.pow(2,35),Math.pow(2,42),Math.pow(2,49);function _n(e,t){null==t&&(t=e.reduce((e,t)=>e+t.length,0));const r=Nn(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}function Mn(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}var Rn=Mn("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>(new TextEncoder).encode(e.substring(1))),Pn=Mn("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{const t=Nn((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),On={utf8:Rn,"utf-8":Rn,hex:sn.base16,latin1:Pn,ascii:Pn,binary:Pn,...sn};function Ln(e,t="utf8"){const r=On[t];if(null==r)throw new Error(`Unsupported encoding "${t}"`);return r.decoder.decode(`${r.prefix}${e}`)}function Dn(e,t="utf8"){const r=On[t];if(null==r)throw new Error(`Unsupported encoding "${t}"`);return r.encoder.encode(e).substring(1)}var Un=class extends Error{constructor(){super(...arguments),Ct(this,"name","InvalidMultiaddrError")}};Ct(Un,"name","InvalidMultiaddrError");var Fn=class extends Error{constructor(){super(...arguments),Ct(this,"name","ValidationError")}};Ct(Fn,"name","ValidationError");var Hn=class extends Error{constructor(){super(...arguments),Ct(this,"name","InvalidParametersError")}};Ct(Hn,"name","InvalidParametersError");var zn=class extends Error{constructor(){super(...arguments),Ct(this,"name","UnknownProtocolError")}};Ct(zn,"name","UnknownProtocolError");var $n=new class{constructor(){Ct(this,"index",0),Ct(this,"input","")}new(e){return this.index=0,this.input=e,this}readAtomically(e){const t=this.index,r=e();return void 0===r&&(this.index=t),r}parseWith(e){const t=e();if(this.index===this.input.length)return t}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{const t=this.readChar();if(t===e)return t})}readSeparator(e,t,r){return this.readAtomically(()=>{if(!(t>0&&void 0===this.readGivenChar(e)))return r()})}readNumber(e,t,r,n){return this.readAtomically(()=>{let i=0,s=0;const o=this.peekChar();if(void 0===o)return;const a="0"===o,c=2**(8*n)-1;for(;;){const r=this.readAtomically(()=>{const t=this.readChar();if(void 0===t)return;const r=Number.parseInt(t,e);return Number.isNaN(r)?void 0:r});if(void 0===r)break;if(i*=e,i+=r,i>c)return;if(s+=1,void 0!==t&&s>t)return}return 0===s||!r&&a&&s>1?void 0:i})}readIPv4Addr(){return this.readAtomically(()=>{const e=new Uint8Array(4);for(let t=0;t<e.length;t++){const r=this.readSeparator(".",t,()=>this.readNumber(10,3,!1,1));if(void 0===r)return;e[t]=r}return e})}readIPv6Addr(){const e=e=>{for(let t=0;t<e.length/2;t++){const r=2*t;if(t<e.length-3){const n=this.readSeparator(":",t,()=>this.readIPv4Addr());if(void 0!==n)return e[r]=n[0],e[r+1]=n[1],e[r+2]=n[2],e[r+3]=n[3],[r+4,!0]}const n=this.readSeparator(":",t,()=>this.readNumber(16,4,!0,2));if(void 0===n)return[r,!1];e[r]=n>>8,e[r+1]=255&n}return[e.length,!1]};return this.readAtomically(()=>{const t=new Uint8Array(16),[r,n]=e(t);if(16===r)return t;if(n)return;if(void 0===this.readGivenChar(":"))return;if(void 0===this.readGivenChar(":"))return;const i=new Uint8Array(14),s=16-(r+2),[o]=e(i.subarray(0,s));return t.set(i.subarray(0,o),16-o),t})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};function Gn(e){return Boolean(function(e){if(!(e.length>15))return $n.new(e).parseWith(()=>$n.readIPv4Addr())}(e))}function jn(e){return t=>Dn(t,e)}function qn(e){return t=>Ln(t,e)}function Kn(e){return new DataView(e.buffer).getUint16(e.byteOffset).toString()}function Vn(e){const t=new ArrayBuffer(2);return new DataView(t).setUint16(0,"string"==typeof e?parseInt(e):e),new Uint8Array(t)}function Wn(e){const t=e.subarray(0,e.length-2),r=e.subarray(e.length-2);return`${Dn(t,"base32")}:${Kn(r)}`}var Yn,Jn=function(e){e=e.toString().trim();const t=new Uint8Array(4);return e.split(/\./g).forEach((e,r)=>{const n=parseInt(e,10);if(isNaN(n)||n<0||n>255)throw new Un("Invalid byte value in IP address");t[r]=n}),t},Qn=Object.values(sn).map(e=>e.decoder),Xn=function(){let e=Qn[0].or(Qn[1]);return Qn.slice(2).forEach(t=>e=e.or(t)),e}(),Zn=function(...e){return t=>{for(const r of e)r(t)}}(function(e){if(parseInt(e).toString()!==e)throw new Fn("Value must be an integer")},function(e){if(e<0)throw new Fn("Value must be a positive integer, or zero")},e=>{if(e>65535)throw new Fn("Value must be smaller than or equal to 65535")}),ei=-1,ti=new class{constructor(){Ct(this,"protocolsByCode",new Map),Ct(this,"protocolsByName",new Map)}getProtocol(e){let t;if(t="string"==typeof e?this.protocolsByName.get(e):this.protocolsByCode.get(e),null==t)throw new zn(`Protocol ${e} was unknown`);return t}addProtocol(e){this.protocolsByCode.set(e.code,e),this.protocolsByName.set(e.name,e),e.aliases?.forEach(t=>{this.protocolsByName.set(t,e)})}removeProtocol(e){const t=this.protocolsByCode.get(e);null!=t&&(this.protocolsByCode.delete(t.code),this.protocolsByName.delete(t.name),t.aliases?.forEach(e=>{this.protocolsByName.delete(e)}))}};[{code:4,name:"ip4",size:32,valueToBytes:Jn,bytesToValue:function(e){if(4!==e.byteLength)throw new Un("IPv4 address was incorrect length");const t=[];for(let r=0;r<e.byteLength;r++)t.push(e[r]);return t.join(".")},validate:e=>{if(!Gn(e))throw new Fn(`Invalid IPv4 address "${e}"`)}},{code:6,name:"tcp",size:16,valueToBytes:Vn,bytesToValue:Kn,validate:Zn},{code:273,name:"udp",size:16,valueToBytes:Vn,bytesToValue:Kn,validate:Zn},{code:33,name:"dccp",size:16,valueToBytes:Vn,bytesToValue:Kn,validate:Zn},{code:41,name:"ip6",size:128,valueToBytes:function(e){let t=0;const r=(e=e.toString().trim()).split(":",8);let n;for(n=0;n<r.length;n++){let e;Gn(r[n])&&(e=Jn(r[n]),r[n]=Dn(e.subarray(0,2),"base16")),null!=e&&++n<8&&r.splice(n,0,Dn(e.subarray(2,4),"base16"))}if(""===r[0])for(;r.length<8;)r.unshift("0");else if(""===r[r.length-1])for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&""!==r[n];n++);const e=[n,1];for(n=9-r.length;n>0;n--)e.push("0");r.splice.apply(r,e)}const i=new Uint8Array(t+16);for(n=0;n<r.length;n++){""===r[n]&&(r[n]="0");const e=parseInt(r[n],16);if(isNaN(e)||e<0||e>65535)throw new Un("Invalid byte value in IP address");i[t++]=e>>8&255,i[t++]=255&e}return i},bytesToValue:function(e){if(16!==e.byteLength)throw new Un("IPv6 address was incorrect length");const t=[];for(let r=0;r<e.byteLength;r+=2){const n=e[r],i=e[r+1],s=`${n.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`;t.push(s)}const r=t.join(":");try{const e=new URL(`http://[${r}]`);return e.hostname.substring(1,e.hostname.length-1)}catch{throw new Un(`Invalid IPv6 address "${r}"`)}},stringToValue:function(e){try{const t=new URL(`http://[${e}]`);return t.hostname.substring(1,t.hostname.length-1)}catch{throw new Un(`Invalid IPv6 address "${e}"`)}},validate:e=>{if(!Boolean(function(e){if(e.includes("%")&&(e=e.split("%")[0]),!(e.length>45))return $n.new(e).parseWith(()=>$n.readIPv6Addr())}(e)))throw new Fn(`Invalid IPv6 address "${e}"`)}},{code:42,name:"ip6zone",size:ei},{code:43,name:"ipcidr",size:8,bytesToValue:jn("base10"),valueToBytes:qn("base10")},{code:53,name:"dns",size:ei},{code:54,name:"dns4",size:ei},{code:55,name:"dns6",size:ei},{code:56,name:"dnsaddr",size:ei},{code:132,name:"sctp",size:16,valueToBytes:Vn,bytesToValue:Kn,validate:Zn},{code:301,name:"udt"},{code:302,name:"utp"},{code:400,name:"unix",size:ei,stringToValue:e=>decodeURIComponent(e),valueToString:e=>encodeURIComponent(e)},{code:421,name:"p2p",aliases:["ipfs"],size:ei,bytesToValue:jn("base58btc"),valueToBytes:e=>e.startsWith("Q")||e.startsWith("1")?qn("base58btc")(e):Zr.parse(e).multihash.bytes},{code:444,name:"onion",size:96,bytesToValue:Wn,valueToBytes:function(e){const t=e.split(":");if(2!==t.length)throw new Error(`failed to parse onion addr: ["'${t.join('", "')}'"]' does not contain a port number`);if(16!==t[0].length)throw new Error(`failed to parse onion addr: ${t[0]} not a Tor onion address.`);const r=Ln(t[0],"base32"),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=Vn(n);return _n([r,i],r.length+i.length)}},{code:445,name:"onion3",size:296,bytesToValue:Wn,valueToBytes:function(e){const t=e.split(":");if(2!==t.length)throw new Error(`failed to parse onion addr: ["'${t.join('", "')}'"]' does not contain a port number`);if(56!==t[0].length)throw new Error(`failed to parse onion addr: ${t[0]} not a Tor onion3 address.`);const r=Qt.decode(`b${t[0]}`),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=Vn(n);return _n([r,i],r.length+i.length)}},{code:446,name:"garlic64",size:ei},{code:447,name:"garlic32",size:ei},{code:448,name:"tls"},{code:449,name:"sni",size:ei},{code:454,name:"noise"},{code:460,name:"quic"},{code:461,name:"quic-v1"},{code:465,name:"webtransport"},{code:466,name:"certhash",size:ei,bytesToValue:(Yn=gr,e=>Yn.encoder.encode(e)),valueToBytes:function(e){return Xn.decode(e)}},{code:480,name:"http"},{code:481,name:"http-path",size:ei,stringToValue:e=>`/${decodeURIComponent(e)}`,valueToString:e=>encodeURIComponent(e.substring(1))},{code:443,name:"https"},{code:477,name:"ws"},{code:478,name:"wss"},{code:479,name:"p2p-websocket-star"},{code:277,name:"p2p-stardust"},{code:275,name:"p2p-webrtc-star"},{code:276,name:"p2p-webrtc-direct"},{code:280,name:"webrtc-direct"},{code:281,name:"webrtc"},{code:290,name:"p2p-circuit"},{code:777,name:"memory",size:ei}].forEach(e=>{ti.addProtocol(e)});var ri=Symbol.for("@multiformats/multiaddr");new WeakMap,new WeakMap,new WeakMap;var ni="[a-fA-F\\d:]",ii=e=>e&&e.includeBoundaries?`(?:(?<=\\s|^)(?=${ni})|(?<=${ni})(?=\\s|$))`:"",si="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",oi="[a-fA-F\\d]{1,4}",ai=`\n(?:\n(?:${oi}:){7}(?:${oi}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${oi}:){6}(?:${si}|:${oi}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${oi}:){5}(?::${si}|(?::${oi}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${oi}:){4}(?:(?::${oi}){0,1}:${si}|(?::${oi}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${oi}:){3}(?:(?::${oi}){0,2}:${si}|(?::${oi}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${oi}:){2}(?:(?::${oi}){0,3}:${si}|(?::${oi}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${oi}:){1}(?:(?::${oi}){0,4}:${si}|(?::${oi}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::${oi}){0,5}:${si}|(?::${oi}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),ci=new RegExp(`(?:^${si}$)|(?:^${ai}$)`),ui=new RegExp(`^${si}$`),li=new RegExp(`^${ai}$`),hi=e=>e&&e.exact?ci:new RegExp(`(?:${ii(e)}${si}${ii(e)})|(?:${ii(e)}${ai}${ii(e)})`,"g");hi.v4=e=>e&&e.exact?ui:new RegExp(`${ii(e)}${si}${ii(e)}`,"g"),hi.v6=e=>e&&e.exact?li:new RegExp(`${ii(e)}${ai}${ii(e)}`,"g");var{toString:di}=Object.prototype,fi="tinycloud/node/renewal-stamp/v1",pi=Math.ceil(525600)+1;function gi(e,t,r){if("object"!=typeof e||null===e||Array.isArray(e)||e instanceof Uint8Array)throw new Error(`${t} must be a map`);const n=e,i=Object.keys(n).sort(),s=[...r].sort();if(i.length!==s.length||i.some((e,t)=>e!==s[t]))throw new Error(`${t} fields are invalid`);return n}function mi(e){return Number.isSafeInteger(e)&&e>=0}function yi(e){if("string"!=typeof e||!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/.test(e))throw new Error("Renewal stamp expiry is invalid");const t=Date.parse(e);if(!Number.isSafeInteger(t)||t%1e3!=0)throw new Error("Renewal stamp expiry is invalid");if(new Date(t).toISOString().replace(".000Z","Z")!==e)throw new Error("Renewal stamp expiry is not canonical");return t/1e3}function bi(e){if(!e.renewerDid.startsWith("did:key:z")||!Number.isSafeInteger(e.renewerEpoch)||e.renewerEpoch<0)throw new Error("Node renewal identity is invalid");const t=on(e.renewerPublicKey);if(32!==t.length)throw new Error("Node renewal public key is invalid");const r=e.renewerDid.slice(8),n=sn.base58btc.decode(r);if(34!==n.length||237!==n[0]||1!==n[1]||sn.base58btc.encode(n)!==r||!n.slice(2).every((e,r)=>e===t[r]))throw new Error("Node renewal key does not match its DID");return t}function wi(e){if(!e.nodeDid.startsWith("did:key:z"))throw new Error("Node renewal identity is invalid");const t=e.nodeDid.slice(8),r=sn.base58btc.decode(t);if(34!==r.length||237!==r[0]||1!==r[1]||sn.base58btc.encode(r)!==t)throw new Error("Node identity is invalid");bi(e)}function vi(e){return Zr.createV1(85,Fr(30,He(e))).toString()}function Ai(e){const{originalCid:t,leaseCid:r,leaseExpiresAt:n,ancestorEffectiveExpiry:i,nodeIdentity:s,history:o,now:a}=e;if(!t||!r||!mi(n)||!mi(a)||a>=n||void 0!==i&&!mi(i))throw new Error("Renewal authority bounds are invalid");wi(s);const c=bi(s),u=new Map;for(const e of o)if(e.lease_cid===r){if(u.size>=pi)throw new Error("Renewal history is missing or too large");if(u.has(e.previous_stamp_cid))throw new Error("Renewal history chain is invalid");u.set(e.previous_stamp_cid,e)}if(0===u.size)throw new Error("Renewal history is missing or too large");let l,h,d=r,f=0;for(;u.size>0;){const e=u.get(d);if(!e)throw new Error("Renewal history chain is invalid");if(u.delete(d),!e.cid||!Number.isSafeInteger(e.generation)||e.generation<=f||!mi(e.new_end)||void 0!==l&&e.new_end<=l||e.new_end>n||void 0!==i&&e.new_end>i)throw new Error("Renewal history chain is invalid");const o=on(e.signed_bytes),a=on(e.signature);if(0===o.length||64!==a.length||vi(o)!==e.cid)throw new Error("Renewal stamp bytes are invalid");if(!ve.verify(a,o,c,{zip215:!1}))throw new Error("Renewal stamp signature is invalid");const p=gi(En(o),"Renewal stamp",["domain","unsigned"]);if(p.domain!==fi)throw new Error("Renewal stamp domain is invalid");const g=gi(p.unsigned,"Renewal stamp payload",["type","newEnd","nodeDid","version","leaseCid","originalCid","renewerEpoch","leaseGeneration","previousStampCid"]);if("TinyCloudRenewalStamp"!==g.type||1!==g.version||g.originalCid!==t||g.leaseCid!==r||g.leaseGeneration!==e.generation||g.previousStampCid!==d||g.nodeDid!==s.nodeDid||g.renewerEpoch!==s.renewerEpoch||yi(g.newEnd)!==e.new_end)throw new Error("Renewal stamp binding is invalid");f=e.generation,l=e.new_end,d=e.cid,h=e}if(!h||h.new_end<=a)throw new Error("Renewal authority has expired");return{effectiveExpiry:Math.min(h.new_end,n,i??Number.MAX_SAFE_INTEGER),latestStampCid:h.cid}}var Ei="RENEWAL_LEASE_ORIGINAL_EXPIRED",xi=class extends Error{constructor(){super("Original grant expired before renewal lease admission. Restore an already-admitted renewal if available; otherwise fresh owner approval is required."),this.code=Ei,this.name="OwnerRenewalOriginalExpiredError"}};async function ki(e){const t=new URL(e.host);if(t.origin!==e.host||t.username||t.password||"https:"!==t.protocol&&("http:"!==t.protocol||!["localhost","127.0.0.1","[::1]"].includes(t.hostname)))throw new Error("Renewal admission requires a canonical verified node origin");wi(e.nodeIdentity);const r=await Sn(e.originalAuthorization.replace(/^Bearer\s+/i,""),e.originalCid),n=await Sn(e.leaseAuthorization.replace(/^Bearer\s+/i,""),e.leaseCid),i=`urn:cid:${r.cid}`,s=n.attenuation[i],o=s?.["tinycloud.delegation/renew"];if(!mn(r.issuer,e.ownerDid)||!mn(r.audience,e.agentDid)||!mn(n.issuer,r.issuer)||n.audience!==e.nodeIdentity.renewerDid||0!==r.proofs.length||0!==n.proofs.length||!e.spaceId.startsWith("tinycloud:")||!Object.keys(r.attenuation).some(t=>t===e.spaceId||t.startsWith(`${e.spaceId}/`))||1!==Object.keys(n.attenuation).length||!s||1!==Object.keys(s).length||!Array.isArray(o)||1!==o.length||"object"!=typeof o[0]||null===o[0]||Array.isArray(o[0])||0!==Object.keys(o[0]).length||n.expiresAt!==e.leaseExpiresAt)throw new Error("Owner renewal lease binding is invalid");const a=Date.now(),c=Date.parse(r.expiresAt??""),u=Date.parse(r.notBefore??r.issuedAt),l=Date.parse(n.expiresAt??""),h=Date.parse(n.notBefore??n.issuedAt),d=31536e6;if(Number.isSafeInteger(c)&&c<=a)throw new xi;if(![c,u,l,h].every(Number.isSafeInteger)||u<=0||u>a||c<=a||c<=u||c-u>10*d||h<=0||h>a||l<=a||l<=h||l-h>d||l>a+d)throw new Error("Owner renewal lease validity bounds are invalid or expired");const f=await fetch(`${e.host}/.well-known/tinycloud/node-keys`,{redirect:"error",signal:e.signal});if(!f.ok)throw new Error(`Renewal identity discovery failed: ${f.status}`);const p=await async function(e){const t=e.headers.get("content-length");if(null!==t&&(!/^\d+$/.test(t)||Number(t)>16384))return null;if(null===e.body)return new Uint8Array;const r=e.body.getReader(),n=[];let i=0;try{for(;;){const{done:e,value:t}=await r.read();if(e)break;if(void 0!==t){if(i+=t.byteLength,i>16384)return await r.cancel().catch(()=>{}),null;n.push(t)}}}finally{r.releaseLock()}const s=new Uint8Array(i);let o=0;for(const e of n)s.set(e,o),o+=e.byteLength;return s}(f);if(null===p)throw new Error("Renewal node identity response exceeds 16384 bytes");const g=JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(p));if(!g||Object.keys(e.nodeIdentity).some(t=>g[t]!==e.nodeIdentity[t]))throw new Error("Renewal node identity changed");const m=await async function(e,t,r){if(r)return Bn(e,t,r);const n=function(e,t){const r=Object.entries(t).sort(([e],[t])=>e<t?-1:e>t?1:0);return JSON.stringify([e,r])}(e,t),i=In.get(n);if(!i)return Cn(n,e,t);try{return await i}catch{return function(e,t,r){return In.get(e)??Cn(e,t,r)}(n,e,t)}}(e.host,{Authorization:e.leaseAuthorization.replace(/^Bearer\s+/i,"")},e.signal);if(!m.success)throw new Error(`Owner renewal admission failed: ${m.status} ${m.error??""}`);return Object.freeze({originalCid:r.cid,leaseCid:n.cid,leaseAuthorization:e.leaseAuthorization.replace(/^Bearer\s+/i,""),leaseExpiresAt:e.leaseExpiresAt,leaseGeneration:1,nodeIdentity:Object.freeze({...e.nodeIdentity})})}var Ti="RENEWAL_LEASE_EXPIRED",Si="RENEWAL_AUTHORITY_INACTIVE",Ii=class extends Error{constructor(){super("Renewal lease has expired"),this.code=Ti,this.name="RenewalLeaseExpiredError"}},Ci=class extends Error{constructor(){super("Node reports no active renewal authority"),this.code=Si,this.name="RenewalAuthorityInactiveError"}}})(),module.exports=n})();
|